|
@@ -10,19 +10,13 @@ import com.min.util.CommonUtil;
|
|
|
import com.min.util.DateUtil;
|
|
|
import com.minpay.common.constant.ShConstant;
|
|
|
import com.minpay.common.service.IVendingMachineService;
|
|
|
-import com.minpay.common.util.DataUtil;
|
|
|
import com.minpay.common.util.HttpPost;
|
|
|
import com.minpay.db.table.mapper.VmDeliveryInfMapper;
|
|
|
import com.minpay.db.table.mapper.VmEquipmentInfMapper;
|
|
|
import com.minpay.db.table.mapper.VmOrderDetailsMapper;
|
|
|
import com.minpay.db.table.mapper.VmProEquRelMapper;
|
|
|
import com.minpay.db.table.mapper.VmPushNewsMapper;
|
|
|
-import com.minpay.db.table.model.VmDeliveryInf;
|
|
|
-import com.minpay.db.table.model.VmEquipmentInf;
|
|
|
-import com.minpay.db.table.model.VmEquipmentInfExample;
|
|
|
-import com.minpay.db.table.model.VmOrderDetails;
|
|
|
-import com.minpay.db.table.model.VmProEquRel;
|
|
|
-import com.minpay.db.table.model.VmPushNews;
|
|
|
+import com.minpay.db.table.model.*;
|
|
|
import com.minpay.db.table.own.mapper.MachineMapper;
|
|
|
import com.startup.minpay.frame.exception.MINBusinessException;
|
|
|
import com.startup.minpay.frame.service.base.IMINDataBaseService;
|
|
@@ -207,85 +201,88 @@ public class VendingMachineServiceImpl implements IVendingMachineService {
|
|
|
* 掉货回调
|
|
|
*/
|
|
|
@Override
|
|
|
- public void dropGoods(String[] strArr,String imeiAddr) throws MINBusinessException {
|
|
|
- if(!CommonUtil.isEmpty(imeiAddr)){
|
|
|
- //货道号
|
|
|
- String cargoNo = strArr[3];
|
|
|
- //推货状态
|
|
|
- String cargoState = strArr[4];
|
|
|
- Map<String, String> map = new HashMap<String, String>();
|
|
|
- map.put("state", "00");
|
|
|
- map.put("cargoNo", cargoNo);
|
|
|
- map.put("type", "00");
|
|
|
- map.put("imeiAddr", imeiAddr);
|
|
|
- map.put("pushType", "00");
|
|
|
-
|
|
|
- //查询收到的推货信息 最近的
|
|
|
- List<Map<String, String>> pnList = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(MachineMapper.class)
|
|
|
- .queryMaxPushNews(map);
|
|
|
- if(pnList.size() > 0){
|
|
|
- //获取消息
|
|
|
- Map<String, String> pushNewsMap = pnList.get(0);
|
|
|
- String deliveryno = pushNewsMap.get("deliveryno");
|
|
|
-
|
|
|
- /**根据推货编号 修改商品库存 和 推货表状态*/
|
|
|
- //查询推货详情
|
|
|
- VmDeliveryInf vdi = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
- .selectByPrimaryKey(deliveryno);
|
|
|
- if("00".equals(cargoState)){ //出货正常
|
|
|
- // 提货状态:0未出货1部分出货2已出货3卡货4清零5处理中
|
|
|
- vdi.setStatus("1");
|
|
|
- //订单详情编号
|
|
|
- String orddetid = vdi.getOrdDetId();
|
|
|
- //查询订单详情
|
|
|
- VmOrderDetails vod = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmOrderDetailsMapper.class)
|
|
|
- .selectByPrimaryKey(orddetid);
|
|
|
- //商品关联编号
|
|
|
- String equRelId = vod.getProEquRelId();
|
|
|
- VmProEquRel vpe = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
- .selectByPrimaryKey(equRelId);
|
|
|
-
|
|
|
- if(!vpe.getProductNums().equals("0")) {
|
|
|
- //变更数量
|
|
|
- vpe.setProductNums(CommonUtil.subtract(vpe.getProductNums(), "1"));
|
|
|
- }
|
|
|
- vpe.setModifyTime(DateUtil.getCurrentDateTimeString());
|
|
|
- Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
- .updateByPrimaryKeySelective(vpe);
|
|
|
- // 增加提货数量 + 1
|
|
|
- vdi.setDeliveryNums(CommonUtil.add(vdi.getDeliveryNums(), "1"));
|
|
|
-
|
|
|
- }else if("01".equals(cargoState)){//出货失败
|
|
|
- vdi.setStatus("3");
|
|
|
- }
|
|
|
-
|
|
|
- // 全部提货完毕
|
|
|
- if(vdi.getProNums().equals(vdi.getDeliveryNums())) {
|
|
|
- // 提货状态:0未出货1部分出货2已出货3卡货4清零5处理中
|
|
|
- vdi.setStatus("2");
|
|
|
+ public Map<String, String> dropGoods(String[] strArr, String imeiAddr) throws MINBusinessException {
|
|
|
+ //推货编号
|
|
|
+ String deliveryId = strArr[2];
|
|
|
+ //推货状态
|
|
|
+ String state = strArr[3];
|
|
|
+
|
|
|
+ VmDeliveryInf vdi = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
+ .selectByPrimaryKey(deliveryId);
|
|
|
+ String cargoState = "";
|
|
|
+ //成功的不在处理
|
|
|
+ if(vdi!= null && !vdi.equals("2")){
|
|
|
+ if("01".equals(state)){
|
|
|
+ cargoState ="00";
|
|
|
+ // 提货状态:0未出货1部分出货2已出货3卡货4清零5处理中
|
|
|
+ vdi.setStatus("1");
|
|
|
+ //订单详情编号
|
|
|
+ String orddetid = vdi.getOrdDetId();
|
|
|
+ //查询订单详情
|
|
|
+ VmOrderDetails vod = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmOrderDetailsMapper.class)
|
|
|
+ .selectByPrimaryKey(orddetid);
|
|
|
+ //商品关联编号
|
|
|
+ String equRelId = vod.getProEquRelId();
|
|
|
+ VmProEquRel vpe = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .selectByPrimaryKey(equRelId);
|
|
|
+
|
|
|
+ if(!vpe.getProductNums().equals("0")) {
|
|
|
+ //变更数量
|
|
|
+ vpe.setProductNums(CommonUtil.subtract(vpe.getProductNums(), "1"));
|
|
|
}
|
|
|
- //变更推货状态
|
|
|
+ vpe.setModifyTime(DateUtil.getCurrentDateTimeString());
|
|
|
Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
- .updateByPrimaryKeySelective(vdi);
|
|
|
+ .getMybatisMapper(VmProEquRelMapper.class)
|
|
|
+ .updateByPrimaryKeySelective(vpe);
|
|
|
+ // 增加提货数量 + 1
|
|
|
+ vdi.setDeliveryNums(CommonUtil.add(vdi.getDeliveryNums(), "1"));
|
|
|
+
|
|
|
+ }else {//出货失败
|
|
|
+ cargoState ="01";
|
|
|
+ vdi.setStatus("3");
|
|
|
+ }
|
|
|
+ // 全部提货完毕
|
|
|
+ if(vdi.getProNums().equals(vdi.getDeliveryNums())) {
|
|
|
+ // 提货状态:0未出货1部分出货2已出货3卡货4清零5处理中
|
|
|
+ vdi.setStatus("2");
|
|
|
+ }
|
|
|
+ //变更推货状态
|
|
|
+ Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
+ .updateByPrimaryKeySelective(vdi);
|
|
|
+ VmPushNewsExample vmPushNewsExample = new VmPushNewsExample();
|
|
|
+ vmPushNewsExample.createCriteria().andDeliverynoEqualTo(deliveryId);
|
|
|
+ List<VmPushNews> VmPushNewsList = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmPushNewsMapper.class)
|
|
|
+ .selectByExample(vmPushNewsExample);
|
|
|
+ if(VmPushNewsList.size() == 1 ){
|
|
|
//变更消息状态
|
|
|
VmPushNews vpm = new VmPushNews();
|
|
|
- vpm.setFlowno(pushNewsMap.get("flowno"));
|
|
|
+ vpm.setFlowno(VmPushNewsList.get(0).getFlowno());
|
|
|
vpm.setState("02");
|
|
|
vpm.setCargoState(cargoState);
|
|
|
vpm.setModifyTime(DateUtil.getCurrentDateTimeString());
|
|
|
Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmPushNewsMapper.class)
|
|
|
- .updateByPrimaryKeySelective(vpm);
|
|
|
+ .getMybatisMapper(VmPushNewsMapper.class)
|
|
|
+ .updateByPrimaryKeySelective(vpm);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+ //[q|机序列号(5位)|执行订单号(10位)|ok]
|
|
|
+ /**设置放回*/
|
|
|
+ List<String> restList = new ArrayList<String>();
|
|
|
+ restList.add(ShConstant.Q);
|
|
|
+ restList.add(imeiAddr);
|
|
|
+ restList.add(deliveryId);
|
|
|
+ restList.add("ok");
|
|
|
+ String strr = assembleReturnMessage(restList);
|
|
|
+ //设置返回值
|
|
|
+ Map<String,String> runMap = new HashMap<String,String>();
|
|
|
+ runMap.put("runData", strr);
|
|
|
+ return runMap;
|
|
|
}
|
|
|
/*
|
|
|
* 推送温度回调
|
|
@@ -355,6 +352,5 @@ public class VendingMachineServiceImpl implements IVendingMachineService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|