|
|
@@ -62,7 +62,7 @@ public class MachineManageAction implements IMINAction {
|
|
|
*/
|
|
|
public final static String EDIT_MACHINE_CODE_STATE = "editMachineCodeState";
|
|
|
/**
|
|
|
- * 编辑售货机货道
|
|
|
+ * 查询售货机货道
|
|
|
*/
|
|
|
public final static String QUERY_PROEQUREL_MANAGE = "queryProEquRelManage";
|
|
|
/**
|
|
|
@@ -73,6 +73,17 @@ public class MachineManageAction implements IMINAction {
|
|
|
/**清空累计金额*/
|
|
|
public final static String EMPTY_PROEQUREL = "emptyProEquRel";
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改设备商品
|
|
|
+ */
|
|
|
+ public final static String EDIT_PROEQUREL = "editProEquRel";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询货道
|
|
|
+ */
|
|
|
+ public final static String QUERY_PROEQURELONE = "queryProEquRelOne";
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private boolean contains;
|
|
|
|
|
|
@@ -88,6 +99,7 @@ public class MachineManageAction implements IMINAction {
|
|
|
public MINActionResult queryProEquRel(
|
|
|
@MINParam(key = "equId") String equId,
|
|
|
@MINParam(key = "gameType") String gameType,
|
|
|
+ @MINParam(key = "perId") String perId,
|
|
|
MINSession session
|
|
|
) throws MINBusinessException {
|
|
|
|
|
|
@@ -101,12 +113,13 @@ public class MachineManageAction implements IMINAction {
|
|
|
.selectByPrimaryKey(equId);
|
|
|
if (vmEquipmentInf == null){
|
|
|
throw new MINBusinessException("该设备不存在!");
|
|
|
- }
|
|
|
+ }
|
|
|
// 查询条件
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
map.put("channel", "V01");
|
|
|
map.put("equId", equId);
|
|
|
map.put("gameType", gameType);
|
|
|
+ map.put("perId", perId);
|
|
|
List<Map<String, Object>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
.getMybatisMapper(MachineManageMapper.class)
|
|
|
.queryProEquRel(map);
|
|
|
@@ -615,4 +628,198 @@ public class MachineManageAction implements IMINAction {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改设备商品
|
|
|
+ *
|
|
|
+ * @param perId 设备商品关联id
|
|
|
+ * @param perRow 货道层
|
|
|
+ * @param perLine 货道列
|
|
|
+ * @param perNum 货道容量
|
|
|
+ * @param numbers 商品余量
|
|
|
+ * @param sallPrice 售货价
|
|
|
+ * @param gamePrice 游戏价
|
|
|
+ * @param costPrice 成本价
|
|
|
+ * @param isPromotton 是否促销
|
|
|
+ * @param promottonPrice 促销价
|
|
|
+ * @param isFragile 是否易碎
|
|
|
+ * @param perRemarks 备注
|
|
|
+ * @param proId 商品id
|
|
|
+ * @param equId 设备id
|
|
|
+ * @param perState 状态
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = EDIT_PROEQUREL)
|
|
|
+ public MINActionResult editProEquRel(
|
|
|
+ @MINParam(key = "perId") String perId,
|
|
|
+ @MINParam(key = "aisle") String aisle,
|
|
|
+ @MINParam(key = "perRow") String perRow,
|
|
|
+ @MINParam(key = "perLine") String perLine,
|
|
|
+ @MINParam(key = "perNum") String perNum,
|
|
|
+ @MINParam(key = "numbers") String numbers,
|
|
|
+ @MINParam(key = "sallPrice") String sallPrice,
|
|
|
+ @MINParam(key = "gamePrice") String gamePrice,
|
|
|
+ @MINParam(key = "costPrice") String costPrice,
|
|
|
+ @MINParam(key = "type") String type,
|
|
|
+ @MINParam(key = "isPromotton") String isPromotton,
|
|
|
+ @MINParam(key = "promottonPrice") String promottonPrice,
|
|
|
+ @MINParam(key = "isFragile") String isFragile,
|
|
|
+ @MINParam(key = "perRemarks") String perRemarks,
|
|
|
+ @MINParam(key = "proId") String proId,
|
|
|
+ @MINParam(key = "equId") String equId,
|
|
|
+ @MINParam(key = "perState") String perState,
|
|
|
+ @MINParam(key = "luck") String luck,
|
|
|
+ @MINParam(key = "accumulatedAmount") String accumulatedAmount,
|
|
|
+ @MINParam(key = "drawAmount") String drawAmount,
|
|
|
+ MINSession session
|
|
|
+ ) throws MINBusinessException {
|
|
|
+
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ //当前时间
|
|
|
+ String dateTime = DateUtil.getCurrentDateTimeString();
|
|
|
+ User user = session.getUser();
|
|
|
+ //操作员id
|
|
|
+ String uId = user.getId();
|
|
|
+ //渠道
|
|
|
+ String channel = user.getChannel();
|
|
|
+ //校验设备是否正常
|
|
|
+ VmEquipmentInf equipmentInf = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmEquipmentInfMapper.class)
|
|
|
+ .selectByPrimaryKey(equId);
|
|
|
+ if (equipmentInf == null) {
|
|
|
+ throw new MINBusinessException("该设备不存在!");
|
|
|
+ } else if (equipmentInf.getState().equals(Constant.EQUIPMENT_STT_03)) {
|
|
|
+ throw new MINBusinessException("该设备已销毁!");
|
|
|
+ }
|
|
|
+ int comcosAndsal = CommonUtil.compare(costPrice, sallPrice);
|
|
|
+
|
|
|
+ int comproAndsal = CommonUtil.compare(promottonPrice, sallPrice);
|
|
|
+ int comnumAndper = CommonUtil.compare(numbers, perNum);
|
|
|
+ if (comcosAndsal == 1 || comcosAndsal == 0) {
|
|
|
+ throw new MINBusinessException("成本价不能大于或等于售货价!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (comproAndsal == 1 || comproAndsal == 0) {
|
|
|
+ throw new MINBusinessException("促销价不能大于或等于售货价!");
|
|
|
+ }
|
|
|
+ if (comnumAndper == 1) {
|
|
|
+ throw new MINBusinessException("商品余量不能大于货道容量!");
|
|
|
+ }
|
|
|
+
|
|
|
+ VmProEquRel proEquRel = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .selectByPrimaryKey(perId);
|
|
|
+
|
|
|
+ //修改设备新增商品
|
|
|
+ if (!CommonUtil.isEmpty(proId)) {
|
|
|
+ proEquRel.setProductId(proId); //商品id
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(equId)) {
|
|
|
+ proEquRel.setEquipmentId(equId); //设备id
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(aisle)) {
|
|
|
+ VmProEquRelExample example = new VmProEquRelExample();
|
|
|
+ example.createCriteria().andChannelEqualTo(channel)
|
|
|
+ .andEquipmentIdEqualTo(equId)
|
|
|
+ .andAisleEqualTo(aisle)
|
|
|
+ .andExeitStateEqualTo(Constant.PROEQUREL_STT_00)
|
|
|
+ .andIdNotEqualTo(perId);
|
|
|
+ List<VmProEquRel> list = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .selectByExample(example);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ throw new MINBusinessException("该设备货道指令已使用!");
|
|
|
+ }
|
|
|
+ proEquRel.setAisle(aisle); //货道指令
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(perRow)) {
|
|
|
+ proEquRel.setCargoWayRow(perRow); //货道层
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(perLine)) {
|
|
|
+ proEquRel.setCargoWayLine(perLine); //货道列
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(perNum)) {
|
|
|
+ proEquRel.setCargoWayNums(perNum); //货道容量
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(numbers)) {
|
|
|
+ proEquRel.setProductNums(numbers); //商品余量
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(sallPrice)) {
|
|
|
+ proEquRel.setSallPrice(sallPrice); //售货价
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(gamePrice)) {
|
|
|
+ proEquRel.setGamePrice(gamePrice); //游戏价
|
|
|
+ }else{
|
|
|
+ proEquRel.setGamePrice("0");
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(costPrice)) {
|
|
|
+ proEquRel.setCostPrice(costPrice); //成本价
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(isPromotton)) {
|
|
|
+ proEquRel.setIsPromotion(isPromotton); //是否促销
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(promottonPrice)) {
|
|
|
+ proEquRel.setPromotionPrice(promottonPrice); //促销价
|
|
|
+ }else {
|
|
|
+ proEquRel.setPromotionPrice("0");
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(perRemarks)) {
|
|
|
+ proEquRel.setRemarks(perRemarks); //备注
|
|
|
+ }
|
|
|
+ proEquRel.setGameType(type); //游戏类型
|
|
|
+ proEquRel.setModifyUser(uId); //最后修改人
|
|
|
+ proEquRel.setModifyTime(dateTime); //最后修改时间
|
|
|
+ if (!CommonUtil.isEmpty(perState)) {
|
|
|
+ proEquRel.setExeitState(perState); //状态
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isEmpty(drawAmount)) {
|
|
|
+ proEquRel.setDrawAmount(drawAmount);
|
|
|
+ }
|
|
|
+ proEquRel.setAccumulatedAmount("0");
|
|
|
+ Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .updateByPrimaryKeySelective(proEquRel);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询设备中商品
|
|
|
+ *
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = QUERY_PROEQURELONE)
|
|
|
+ public MINActionResult queryProEquRelOne(
|
|
|
+ @MINParam(key = "perId") String perId,
|
|
|
+ MINSession session
|
|
|
+ ) throws MINBusinessException {
|
|
|
+
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+
|
|
|
+ User user = session.getUser();
|
|
|
+ // 查询条件
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("channel", "V01");
|
|
|
+ map.put("perId", perId);
|
|
|
+ List<Map<String, Object>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(MachineManageMapper.class)
|
|
|
+ .queryProEquRel(map);
|
|
|
+
|
|
|
+ if(list.size() !=1){
|
|
|
+ throw new MINBusinessException("货道数据异常!");
|
|
|
+ }
|
|
|
+ //格式化时间和状态
|
|
|
+ list = Service.lookup(IFormatService.class).formatDateTime(list, "createTime", "modifyTime");
|
|
|
+ list = new MINCopyFormat("{perState:'sttDesc',isPromotton:'isPromottonDesc',isFragile:'isFragileDesc',type:'gameType'}").format(list);
|
|
|
+ list = Service.lookup(IFormatService.class).formatEnum(list, "{sttDesc:'PROEQUREL_STATE',isPromottonDesc:'IS_PROMOTION',isFragileDesc:'IS_FRAGILE','gameType':'GAME_SETUP_TYPE'}");
|
|
|
+ //传递数据
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|