|
|
@@ -0,0 +1,269 @@
|
|
|
+package com.minpay.common.action;
|
|
|
+
|
|
|
+import com.min.util.DateUtil;
|
|
|
+import com.minpay.common.exception.BusinessCodeException;
|
|
|
+import com.minpay.common.service.ILogService;
|
|
|
+import com.minpay.common.service.IPublicService;
|
|
|
+import com.minpay.common.util.RegexUtil;
|
|
|
+import com.minpay.db.table.mapper.VmProEquRelMapper;
|
|
|
+import com.minpay.db.table.model.VmProEquRel;
|
|
|
+import com.minpay.db.table.model.VmProEquRelExample;
|
|
|
+import com.minpay.db.table.own.mapper.GoodsWayMapper;
|
|
|
+import com.startup.minpay.frame.business.IMINAction;
|
|
|
+import com.startup.minpay.frame.business.res.MINActionResult;
|
|
|
+import com.startup.minpay.frame.constant.IMINBusinessConstant;
|
|
|
+import com.startup.minpay.frame.exception.MINBusinessException;
|
|
|
+import com.startup.minpay.frame.jdbc.MINRowBounds;
|
|
|
+import com.startup.minpay.frame.service.base.IMINDataBaseService;
|
|
|
+import com.startup.minpay.frame.service.base.Service;
|
|
|
+import com.startup.minpay.frame.session.MINSession;
|
|
|
+import com.startup.minpay.frame.target.MINAction;
|
|
|
+import com.startup.minpay.frame.target.MINComponent;
|
|
|
+import com.startup.minpay.frame.target.MINParam;
|
|
|
+import com.startup.minpay.frame.target.MINValidator;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 货道管理
|
|
|
+ * @author WANGLM
|
|
|
+ */
|
|
|
+@MINComponent
|
|
|
+public class GoodsWayManageAction implements IMINAction {
|
|
|
+
|
|
|
+
|
|
|
+ //新增货道
|
|
|
+ public final static String ADD_GOODSWAY_INFO = "addGoodsWayInfo";
|
|
|
+
|
|
|
+ //查询货道数据
|
|
|
+ public final static String SELECT_GOODSWAY_INFO = "selectGoodsWayInfo";
|
|
|
+
|
|
|
+ //修改货道数据
|
|
|
+ public final static String MODIFY_GOODSWAY_INFO = "modifyGoodsWayInfo";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改货道信息
|
|
|
+ * @param proequrelId 货道Id
|
|
|
+ * @param productId 商品Id
|
|
|
+ * @param userId 商户Id
|
|
|
+ * @param sallPrice 售货价
|
|
|
+ * @param gamePrice 游戏价
|
|
|
+ * @param costPrice 成本价
|
|
|
+ * @param isPromotion 是否促销:0是1否
|
|
|
+ * @param promotionPrice 促销价
|
|
|
+ * @param gameType 游戏类型(GAME_TYEP:00:不参与,10:游戏购 20:幸运购)
|
|
|
+ * @param isFragile 是否易碎:0是1否
|
|
|
+ * @param remarks 备注
|
|
|
+ * @param state 状态:00正常01货道删除02删除
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = "MODIFY_GOODSWAY_INFO")
|
|
|
+ public MINActionResult modifyGoodsWayInfo(
|
|
|
+ @MINParam(key = "proequrelId") String proequrelId,
|
|
|
+ @MINParam(key = "productId") String productId,
|
|
|
+ @MINParam(key = "userId") String userId,
|
|
|
+ @MINParam(key = "sallPrice") String sallPrice,
|
|
|
+ @MINParam(key = "gamePrice") String gamePrice,
|
|
|
+ @MINParam(key = "costPrice") String costPrice,
|
|
|
+ @MINParam(key = "isPromotion") String isPromotion,
|
|
|
+ @MINParam(key = "promotionPrice") String promotionPrice,
|
|
|
+ @MINParam(key = "gameType") String gameType,
|
|
|
+ @MINParam(key = "isFragile") String isFragile,
|
|
|
+ @MINParam(key = "remarks") String remarks,
|
|
|
+ @MINParam(key = "state") String state,
|
|
|
+
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ //修改
|
|
|
+ VmProEquRel vp =new VmProEquRel();
|
|
|
+ vp.setId(proequrelId);
|
|
|
+ vp.setExeitState(state);
|
|
|
+ vp.setModifyUser(userId);
|
|
|
+ vp.setProductId(productId);
|
|
|
+ vp.setUserId(userId);
|
|
|
+ vp.setSallPrice(sallPrice);
|
|
|
+ vp.setGamePrice(gamePrice);
|
|
|
+ vp.setCostPrice(costPrice);
|
|
|
+ vp.setIsPromotion(isPromotion);
|
|
|
+ vp.setPromotionPrice(promotionPrice);
|
|
|
+ vp.setGameType(gameType);
|
|
|
+ vp.setIsFragile(isFragile);
|
|
|
+ vp.setRemarks(remarks);
|
|
|
+ vp.setModifyTime(DateUtil.getCurrentDateTimeString());
|
|
|
+ // 执行新增货到数据
|
|
|
+ Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class).updateByPrimaryKeySelective(vp);
|
|
|
+ // 记录操作日志
|
|
|
+ String logInfo = "商户:" + userId + "修改货道,货道编号:" + proequrelId + "货道状态"+ state;
|
|
|
+ Service.lookup(ILogService.class).logging(session, logInfo);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改货道信息 校验
|
|
|
+ * @param proequrelId
|
|
|
+ * @param productId
|
|
|
+ * @param session
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINValidator( value = MODIFY_GOODSWAY_INFO)
|
|
|
+ public void modifyGoodsWayInfoValidator(
|
|
|
+ @MINParam(key = "proequrelId", regex = RegexUtil.NOT_NULL, error = "货道编号不可为空!") String proequrelId,
|
|
|
+ @MINParam(key = "productId", regex = RegexUtil.NOT_NULL, error = "商品编号不可为空!") String productId,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * * 查询货道
|
|
|
+ * @param vciId 设备
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = "SELECT_GOODSWAY_INFO")
|
|
|
+ public MINActionResult selectGoodsWayInfo(
|
|
|
+ @MINParam(key = "vciId") String vciId,
|
|
|
+ @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);
|
|
|
+ // 创建查询条件
|
|
|
+ Map<String, String> p = new HashMap<String, String>();
|
|
|
+ p.put("vciId",vciId);
|
|
|
+ List<Map<String, String>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(GoodsWayMapper.class).queryGoodsWay(p,rows);
|
|
|
+ // 设置返回值
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询货道数据 校验
|
|
|
+ * @param vciId
|
|
|
+ * @param session
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = "SELECT_GOODSWAY_INFO")
|
|
|
+ public void selectGoodsWayInfoValidator(
|
|
|
+ @MINParam(key = "vciId", regex = RegexUtil.NOT_NULL, error = "售货机编号不可为空!") String vciId,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增货道
|
|
|
+ * @param vciId 设备Id
|
|
|
+ * @param productId 商品Id
|
|
|
+ * @param wayRow 货道行
|
|
|
+ * @param wayLine 货道列
|
|
|
+ * @param aisle 货道指令
|
|
|
+ * @param wayNums 货道容量
|
|
|
+ * @param proNums 商品余量
|
|
|
+ * @param userId 商户Id
|
|
|
+ * @param sallPrice 售货价
|
|
|
+ * @param gamePrice 游戏价
|
|
|
+ * @param costPrice 成本价
|
|
|
+ * @param isPromotion 是否促销:0是1否
|
|
|
+ * @param promotionPrice 促销价
|
|
|
+ * @param gameType 游戏类型(GAME_TYEP:00:不参与,10:游戏购 20:幸运购)
|
|
|
+ * @param isFragile 是否易碎:0是1否
|
|
|
+ * @param remarks 备注
|
|
|
+ * @param state 状态:00正常01货道删除02删除
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINAction(value = "ADD_GOODSWAY_INFO")
|
|
|
+ public MINActionResult addGoodsWayInfo(
|
|
|
+ @MINParam(key = "vciId") String vciId,
|
|
|
+ @MINParam(key = "productId") String productId,
|
|
|
+ @MINParam(key = "wayRow") String wayRow,
|
|
|
+ @MINParam(key = "wayLine") String wayLine,
|
|
|
+ @MINParam(key = "aisle") String aisle,
|
|
|
+ @MINParam(key = "wayNums") String wayNums,
|
|
|
+ @MINParam(key = "proNums") String proNums,
|
|
|
+ @MINParam(key = "userId") String userId,
|
|
|
+ @MINParam(key = "sallPrice") String sallPrice,
|
|
|
+ @MINParam(key = "gamePrice") String gamePrice,
|
|
|
+ @MINParam(key = "costPrice") String costPrice,
|
|
|
+ @MINParam(key = "isPromotion") String isPromotion,
|
|
|
+ @MINParam(key = "promotionPrice") String promotionPrice,
|
|
|
+ @MINParam(key = "gameType") String gameType,
|
|
|
+ @MINParam(key = "isFragile") String isFragile,
|
|
|
+ @MINParam(key = "remarks") String remarks,
|
|
|
+ @MINParam(key = "state") String state,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ //查询货道是否已存在
|
|
|
+ VmProEquRelExample example = new VmProEquRelExample();
|
|
|
+ example.createCriteria().andEquipmentIdEqualTo(vciId)
|
|
|
+ .andCargoWayLineEqualTo(wayLine)
|
|
|
+ .andCargoWayNumsEqualTo(wayNums);
|
|
|
+ List<VmProEquRel> countList = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class).selectByExample(example);
|
|
|
+ if(countList.size() > 0) {
|
|
|
+ //该货道已存在,请重新添加
|
|
|
+ throw new BusinessCodeException("JINM4001");
|
|
|
+ }
|
|
|
+ //获取货到主键
|
|
|
+ String proequrel_Id = Service.lookup(IPublicService.class).
|
|
|
+ getSequence("VM_PROEQUREL_ID");
|
|
|
+ //新增
|
|
|
+ VmProEquRel vp =new VmProEquRel();
|
|
|
+ vp.setEquipmentId(vciId);
|
|
|
+ vp.setCargoWayRow(wayRow);
|
|
|
+ vp.setCargoWayNums(wayNums);
|
|
|
+ vp.setId(proequrel_Id);
|
|
|
+ vp.setChannel("01");
|
|
|
+ vp.setProductId(productId);
|
|
|
+ vp.setAisle(aisle);
|
|
|
+ vp.setCargoWayLine(wayLine);
|
|
|
+ vp.setCargoWayRow(wayRow);
|
|
|
+ vp.setCargoWayNums(wayNums);
|
|
|
+ vp.setProductNums(proNums);
|
|
|
+ vp.setUserId(userId);
|
|
|
+ vp.setSallPrice(sallPrice);
|
|
|
+ vp.setGamePrice(gamePrice);
|
|
|
+ vp.setCostPrice(costPrice);
|
|
|
+ vp.setIsPromotion(isPromotion);
|
|
|
+ vp.setPromotionPrice(promotionPrice);
|
|
|
+ vp.setGameType(gameType);
|
|
|
+ vp.setIsFragile(isFragile);
|
|
|
+ vp.setRemarks(remarks);
|
|
|
+ vp.setExeitState(state);
|
|
|
+ vp.setCreateUser(userId);
|
|
|
+ vp.setModifyUser(userId);
|
|
|
+ vp.setCreateTime(DateUtil.getCurrentDateTimeString());
|
|
|
+ vp.setModifyTime(DateUtil.getCurrentDateTimeString());
|
|
|
+ // 执行新增货到数据
|
|
|
+ Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class).insert(vp);
|
|
|
+ // 记录操作日志
|
|
|
+ String logInfo = "商户:" + userId + "新增货道,货道编号:" + proequrel_Id;
|
|
|
+ Service.lookup(ILogService.class).logging(session, logInfo);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增货道 校验
|
|
|
+ * @param vciId
|
|
|
+ * @param productId
|
|
|
+ * @param wayRow
|
|
|
+ * @param wayLine
|
|
|
+ * @param session
|
|
|
+ * @throws MINBusinessException
|
|
|
+ */
|
|
|
+ @MINValidator( value = ADD_GOODSWAY_INFO)
|
|
|
+ public void addGoodsWayInfoValidator(
|
|
|
+ @MINParam(key = "vciId", regex = RegexUtil.NOT_NULL, error = "售货机编号不可为空!") String vciId,
|
|
|
+ @MINParam(key = "productId", regex = RegexUtil.NOT_NULL, error = "商品编号不可为空!") String productId,
|
|
|
+ @MINParam(key = "wayRow", regex = RegexUtil.NOT_NULL, error = "货道行不可为空!") String wayRow,
|
|
|
+ @MINParam(key = "wayLine", regex = RegexUtil.NOT_NULL, error = "货道列不可为空!") String wayLine,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ }
|
|
|
+
|
|
|
+}
|