|
@@ -25,6 +25,7 @@ import com.startup.minpay.frame.target.MINAction;
|
|
|
import com.startup.minpay.frame.target.MINComponent;
|
|
|
import com.startup.minpay.frame.target.MINParam;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -56,6 +57,9 @@ public class MachineManageAction implements IMINAction {
|
|
|
/**补货*/
|
|
|
public final static String EDIT_PROEQUREL_NUM = "editProEquRelNum";
|
|
|
|
|
|
+ /**主页数据*/
|
|
|
+ public final static String HOME_PAGE_DATA = "homePageData";
|
|
|
+
|
|
|
private boolean contains;
|
|
|
|
|
|
|
|
@@ -284,4 +288,78 @@ public class MachineManageAction implements IMINAction {
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 主页数据
|
|
|
+ *
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = HOME_PAGE_DATA)
|
|
|
+ public MINActionResult homePageData(
|
|
|
+ @MINParam(key = "dateFlag") String dateFlag,
|
|
|
+ @MINParam(key = "page", defaultValue = "1") int page,
|
|
|
+ @MINParam(key = "limit", defaultValue = "10") int limit,
|
|
|
+ MINSession session
|
|
|
+ ) throws MINBusinessException {
|
|
|
+
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+
|
|
|
+ MINRowBounds rows = new MINRowBounds(page, limit);
|
|
|
+ //获取当前时间
|
|
|
+ Date currentTime = new Date();
|
|
|
+ String nowDate = DateUtil.format(currentTime,"yyyyMMdd");
|
|
|
+ Map<String, String> m = new HashMap<String, String>();
|
|
|
+ //昨天
|
|
|
+ String yesDate = DateUtil.getDifferentDate(-1).substring(0,8);
|
|
|
+ //本月第一天
|
|
|
+ String monthFirstDay = DateUtil.getmindate();
|
|
|
+ //本月最后一天
|
|
|
+ String monthLastDay = DateUtil.getmaxdate();
|
|
|
+ String monthDate = monthFirstDay.concat(monthLastDay);
|
|
|
+ User user = session.getUser();
|
|
|
+ //操作员id
|
|
|
+ String uId = user.getId();
|
|
|
+ //渠道
|
|
|
+ // 查询条件
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("channel", "V01");
|
|
|
+ map.put("branchId",user.getBranchId());
|
|
|
+ List<Map<String, Object>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .queryEquipment(map, rows);
|
|
|
+ //格式化时间和状态
|
|
|
+ list = Service.lookup(IFormatService.class).formatDateTime(list, "createTime", "modifyTime");
|
|
|
+ list = new MINCopyFormat("{equState:'sttDesc',type:'typeDesc'}").format(list);
|
|
|
+ list = Service.lookup(IFormatService.class).formatEnum(list, "{sttDesc:'EQUIPMENT_STATE','typeDesc':'GAME_TYPE'}");
|
|
|
+ if (dateFlag.equals("1")){
|
|
|
+ m.put("nowDate",nowDate);
|
|
|
+ }else if (dateFlag.equals("2")){
|
|
|
+ m.put("yesDate",yesDate);
|
|
|
+ }else if (dateFlag.equals("3")){
|
|
|
+ m.put("monthDate",monthDate);
|
|
|
+ }
|
|
|
+ //成本
|
|
|
+ String chengben = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .selectPredictIncome(m);
|
|
|
+ //营业额
|
|
|
+ String shouru = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .selectCountIncome(m);
|
|
|
+ //订单数
|
|
|
+ String dingdanCount = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .selectCountOrderNum(m);
|
|
|
+ //利润
|
|
|
+ String lirun = CommonUtil.subtract(shouru,chengben);
|
|
|
+ //传递数据
|
|
|
+ res.set("chengben",chengben);
|
|
|
+ res.set("shouru",shouru);
|
|
|
+ res.set("lirun",lirun);
|
|
|
+ res.set("dingdanCount",dingdanCount);
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|