|
@@ -65,6 +65,13 @@ public class MachineManageAction implements IMINAction {
|
|
|
* 编辑售货机货道
|
|
|
*/
|
|
|
public final static String QUERY_PROEQUREL_MANAGE = "queryProEquRelManage";
|
|
|
+ /**
|
|
|
+ * 查询设备中商品
|
|
|
+ */
|
|
|
+ public final static String QUERY_PROEQURELPAGE = "queryProEquRelPage";
|
|
|
+
|
|
|
+ /**清空累计金额*/
|
|
|
+ public final static String EMPTY_PROEQUREL = "emptyProEquRel";
|
|
|
|
|
|
|
|
|
private boolean contains;
|
|
@@ -482,6 +489,130 @@ public class MachineManageAction implements IMINAction {
|
|
|
res.set(IMINBusinessConstant.F_PAGING_LAY, reslist);
|
|
|
return res;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 查询设备中商品(游戏购)
|
|
|
+ *
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = QUERY_PROEQURELPAGE)
|
|
|
+ public MINActionResult queryProEquRelPage(
|
|
|
+ @MINParam(key = "equId") String equId,
|
|
|
+ @MINParam(key = "proName") String proName,
|
|
|
+ @MINParam(key = "gameType") String gameType,
|
|
|
+ @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);
|
|
|
+ User user = session.getUser();
|
|
|
+
|
|
|
+ //查询是否拥有权限
|
|
|
+ /**校验用户是否是商户的内管员*/
|
|
|
+ String personId = user.getId();
|
|
|
+ String branchid = user.getBranchId();
|
|
|
+ VmPersonRoleInfExample vmPersonRoleInfExample = new VmPersonRoleInfExample();
|
|
|
+ vmPersonRoleInfExample.createCriteria().andBranchIdEqualTo(branchid)
|
|
|
+ .andStateEqualTo("00").andPersonIdEqualTo(personId).andRoleEqualTo("02");
|
|
|
+ List<VmPersonRoleInf> vmPersonRoleInfList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonRoleInfMapper.class).selectByExample(vmPersonRoleInfExample);
|
|
|
+ if(vmPersonRoleInfList.size() != 1){
|
|
|
+ throw new MINBusinessException("权限不足!");
|
|
|
+ }
|
|
|
+ VmEquipmentInf vmEquipmentInf = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmEquipmentInfMapper.class)
|
|
|
+ .selectByPrimaryKey(equId);
|
|
|
+ if (vmEquipmentInf == null){
|
|
|
+ throw new MINBusinessException("该设备不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //渠道
|
|
|
+ String channel = user.getChannel();
|
|
|
+ // 查询条件
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("channel", "V01");
|
|
|
+ map.put("equId", equId);
|
|
|
+ if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
|
|
|
+ map.put("branchId", user.getBranchId());
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("gameType", "02");
|
|
|
+ map.put("proName", proName);
|
|
|
+ List<Map<String, Object>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .queryProEquRelPage(map,rows);
|
|
|
+ //格式化时间和状态
|
|
|
+ list = Service.lookup(IFormatService.class).formatDateTime(list, "createTime", "modifyTime");
|
|
|
+ list = new MINCopyFormat("{perState:'sttDesc',isPromotton:'isPromottonDesc',isFragile:'isFragileDesc',type:'typeDesc'}").format(list);
|
|
|
+ list = Service.lookup(IFormatService.class).formatEnum(list, "{sttDesc:'PROEQUREL_STATE',isPromottonDesc:'IS_PROMOTION',typeDesc:'GAME_SETUP_TYPE'}");
|
|
|
+ //传递数据
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getMaxRows());
|
|
|
+ res.set("imeiAddr",vmEquipmentInf.getImeiAddr());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清空累计金额
|
|
|
+ * @param perId
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = EMPTY_PROEQUREL)
|
|
|
+ public MINActionResult emptyProEquRel(
|
|
|
+ @MINParam(key = "perId") String perId,
|
|
|
+ MINSession session
|
|
|
+ ) throws MINBusinessException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ VmProEquRel proEquRel = new VmProEquRel();
|
|
|
+
|
|
|
+ User user = session.getUser();
|
|
|
+
|
|
|
+ //查询是否拥有权限
|
|
|
+ /**校验用户是否是商户的内管员*/
|
|
|
+ String personId = user.getId();
|
|
|
+ String branchid = user.getBranchId();
|
|
|
+ VmPersonRoleInfExample vmPersonRoleInfExample = new VmPersonRoleInfExample();
|
|
|
+ vmPersonRoleInfExample.createCriteria().andBranchIdEqualTo(branchid)
|
|
|
+ .andStateEqualTo("00").andPersonIdEqualTo(personId).andRoleEqualTo("02");
|
|
|
+ List<VmPersonRoleInf> vmPersonRoleInfList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonRoleInfMapper.class).selectByExample(vmPersonRoleInfExample);
|
|
|
+ if(vmPersonRoleInfList.size() != 1){
|
|
|
+ throw new MINBusinessException("权限不足!");
|
|
|
+ }
|
|
|
+ if(CommonUtil.isEmpty(perId)){
|
|
|
+ throw new MINBusinessException("数据异常!");
|
|
|
+ }
|
|
|
+ //查询货道是否属于此机器
|
|
|
+ VmProEquRel vmProEquRel = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .selectByPrimaryKey(perId);
|
|
|
+ String gameType = vmProEquRel.getGameType();
|
|
|
+ if(vmProEquRel == null){
|
|
|
+ throw new MINBusinessException("货道不存在!");
|
|
|
+ }
|
|
|
+ if(!gameType.equals("02") ){
|
|
|
+ throw new MINBusinessException("此货道非游戏购!");
|
|
|
+ }
|
|
|
+ VmEquipmentInf vmEquipmentInf = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmEquipmentInfMapper.class)
|
|
|
+ .selectByPrimaryKey(vmProEquRel.getEquipmentId());
|
|
|
+ if(!Constant.ADMINISTRATION_SYSTEM_NUMBER.equals(user.getBranchId())){
|
|
|
+ if(!vmEquipmentInf.getBranchid().equals(branchid)){
|
|
|
+ throw new MINBusinessException("请确认权限!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ proEquRel.setId(perId);
|
|
|
+ proEquRel.setAccumulatedAmount("0");
|
|
|
+ Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .updateByPrimaryKeySelective(proEquRel);
|
|
|
+ String logInfo = "清空累计金额:" + perId;
|
|
|
+ Service.lookup(ILogService.class).logging(session, logInfo);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
}
|