|
@@ -138,7 +138,7 @@ public class DeliveryAction implements IMINAction{
|
|
|
MINSession session) throws Exception{
|
|
|
MINActionResult res = new MINActionResult();
|
|
|
User user = session.getUser();
|
|
|
- //获取售货机推送地址
|
|
|
+ /**获取售货机推送地址*/
|
|
|
String url = Service.lookup(IPropertiesService.class)
|
|
|
.getSystemProperties().get(user.getChannel() + "_GET_MACHINE_ADDRESS").getKey();
|
|
|
String retUrl = Service.lookup(IPropertiesService.class)
|
|
@@ -146,8 +146,8 @@ public class DeliveryAction implements IMINAction{
|
|
|
//组装推送接口
|
|
|
String sendUrl = url.concat("/VendingMachineAction/pushGoods").concat("?MINView=JSON");
|
|
|
String returnUrl = retUrl.concat("/DeliveryAction/backDeliveryForMachine");
|
|
|
-
|
|
|
- //组装传送参数
|
|
|
+
|
|
|
+ /**查询数据(提货单号是否存在)*/
|
|
|
//初始化查询条件
|
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
|
map.put("deliveryNo", deliveryNo);//提货编号
|
|
@@ -157,52 +157,29 @@ public class DeliveryAction implements IMINAction{
|
|
|
List<Map<String,String>> list = Service.lookup(IMINDataBaseService.class)
|
|
|
.getMybatisMapper(DeliveryMapper.class)
|
|
|
.queryDeliverys(map);
|
|
|
- if(CommonUtil.isEmpty(deliveryNo)){
|
|
|
-
|
|
|
- VmOrderInf orderInf = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmOrderInfMapper.class)
|
|
|
- .selectByPrimaryKey(orderNo);
|
|
|
- //如果直接购买选择存入卡包则不进行推货
|
|
|
- if(orderInf.getProState().equals("01")){
|
|
|
- return res;
|
|
|
- }
|
|
|
- }
|
|
|
-// //未创建提货信息的执行新增
|
|
|
-// if(list == null || list.size() == 0){
|
|
|
-// MINActionResult result = createDeliveryInfoTwo(orderNo);
|
|
|
-// deliveryNo = result.get("dlId");
|
|
|
-// map.put("deliveryNo", deliveryNo);//提货编号
|
|
|
-// list = Service.lookup(IMINDataBaseService.class)
|
|
|
-// .getMybatisMapper(DeliveryMapper.class)
|
|
|
-// .queryDeliverys(map);
|
|
|
-// }
|
|
|
-
|
|
|
- if(list == null || list.size() == 0){
|
|
|
+
|
|
|
+ if(list == null || list.size() != 1 ){
|
|
|
throw new MINBusinessException("没有提货信息!");
|
|
|
}
|
|
|
-
|
|
|
- if(CommonUtil.isEmpty(deliveryNo)){
|
|
|
- deliveryNo = list.get(0).get("deliveryNo");
|
|
|
+ String equType = list.get(0).get("equType");
|
|
|
+ if(!"00".equals(equType) || !"01".equals(equType)){
|
|
|
+ throw new MINBusinessException("机器类型不支持推货!");
|
|
|
}
|
|
|
-
|
|
|
- VmDeliveryInf deliveryInf = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
- .selectByPrimaryKey(deliveryNo);
|
|
|
- if(deliveryInf == null){
|
|
|
+
|
|
|
+ VmDeliveryInf delInf = Service.lookup(IMINDataBaseService.class)
|
|
|
+ .getMybatisMapper(VmDeliveryInfMapper.class).selectByPrimaryKey(deliveryNo);
|
|
|
+ if(delInf == null){
|
|
|
throw new MINBusinessException("没有提货信息!");
|
|
|
}
|
|
|
-
|
|
|
- if(deliveryInf.getProNums().equals(deliveryInf.getDeliveryNums())){
|
|
|
+
|
|
|
+ if(delInf.getProNums().equals(delInf.getDeliveryNums())){
|
|
|
throw new MINBusinessException("提货已完成!");
|
|
|
}
|
|
|
-
|
|
|
- if(!deliveryInf.getStatus().equals("0")
|
|
|
- && !deliveryInf.getStatus().equals("1") && !deliveryInf.getStatus().equals("5")){
|
|
|
+
|
|
|
+ if(!delInf.getStatus().equals("0")
|
|
|
+ && !delInf.getStatus().equals("1") && !delInf.getStatus().equals("5")){
|
|
|
throw new MINBusinessException("提货处理中,请稍后!");
|
|
|
}
|
|
|
-
|
|
|
- VmDeliveryInf delInf = Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmDeliveryInfMapper.class).selectByPrimaryKey(deliveryNo);
|
|
|
|
|
|
//改变提货状态为5处理中....
|
|
|
delInf.setStatus("5");
|
|
@@ -226,42 +203,6 @@ public class DeliveryAction implements IMINAction{
|
|
|
//数据加密
|
|
|
String desDe = Base64.encode(DesUtils.getInstance().encrypt(Base64.encode(str).getBytes(),passwardKey.getBytes(),null));
|
|
|
|
|
|
-// new Thread() {
|
|
|
-// public void run() {
|
|
|
-// HttpPostUtil.sendPostFormachine(sendUrl, desDe);
|
|
|
-// }
|
|
|
-// }.start();
|
|
|
-
|
|
|
-// //获取转义后响应信息
|
|
|
-// JSONObject detail = JSONObject.fromObject(results);
|
|
|
-// String code = String.valueOf(detail.get("code"));
|
|
|
-//
|
|
|
-// if(!"0".equals(code)){
|
|
|
-// Log.info("售货机退货失败:".concat(code));
|
|
|
-// //改变提货状态为3卡货(提货失败)....
|
|
|
-// delInf.setStatus("3");
|
|
|
-// //处理提货状态
|
|
|
-// Service.lookup(IMINDataBaseService.class)
|
|
|
-// .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
-// .updateByPrimaryKeySelective(delInf);
|
|
|
-// throw new BusinessCodeException("JINM0011");//操作失败!
|
|
|
-// }
|
|
|
-//
|
|
|
-// //获取处理状态
|
|
|
-// String state = String.valueOf(detail.get("returnData"));
|
|
|
-// JSONObject stateNew = JSONObject.fromObject(state);
|
|
|
-// if(stateNew != null
|
|
|
-// && !"200".equals(String.valueOf(stateNew.get("code")))){
|
|
|
-// Log.info("售货机退货卡货:".concat(CommonUtil.objToString(stateNew.get("msg"))));
|
|
|
-// //改变提货状态为3卡货....
|
|
|
-// delInf.setStatus("3");
|
|
|
-// //处理提货状态
|
|
|
-// Service.lookup(IMINDataBaseService.class)
|
|
|
-// .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
-// .updateByPrimaryKeySelective(delInf);
|
|
|
-// String msg = String.valueOf(stateNew.get("msg"));
|
|
|
-// throw new MINBusinessException(msg);//操作失败!
|
|
|
-// }
|
|
|
|
|
|
String results = HttpPostUtil.sendPostFormachine(sendUrl, desDe);
|
|
|
// //获取转义后响应信息
|
|
@@ -278,14 +219,6 @@ public class DeliveryAction implements IMINAction{
|
|
|
.updateByPrimaryKeySelective(delInf);
|
|
|
throw new BusinessCodeException("JINM0011");//操作失败!
|
|
|
}
|
|
|
-
|
|
|
- //改变提货状态为2成功....
|
|
|
- delInf.setStatus("5");
|
|
|
- //处理提货状态
|
|
|
- Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmDeliveryInfMapper.class)
|
|
|
- .updateByPrimaryKeySelective(delInf);
|
|
|
-
|
|
|
//获取处理状态
|
|
|
String state = String.valueOf(detail.get("returnData"));
|
|
|
JSONObject stateNew = JSONObject.fromObject(state);
|
|
@@ -418,19 +351,13 @@ public class DeliveryAction implements IMINAction{
|
|
|
|
|
|
//更新订单详情
|
|
|
detInf.setDeliveryId(dlId);
|
|
|
- ordInf.setIsDraw("01");
|
|
|
detInf.setIsWinning("01");
|
|
|
+ detInf.setIsDelivery("01");
|
|
|
Service.lookup(IMINDataBaseService.class)
|
|
|
.getMybatisMapper(VmOrderDetailsMapper.class)
|
|
|
.updateByPrimaryKeySelective(detInf);
|
|
|
- if(!ordInf.equals("01") && !ordInf.equals("02")){
|
|
|
- Service.lookup(IMINDataBaseService.class)
|
|
|
- .getMybatisMapper(VmOrderInfMapper.class)
|
|
|
- .updateByPrimaryKeySelective(ordInf);
|
|
|
- }
|
|
|
/**没有中奖的*/
|
|
|
}else{
|
|
|
- ordInf.setIsDraw("00");
|
|
|
detInf.setIsWinning("02");
|
|
|
Service.lookup(IMINDataBaseService.class)
|
|
|
.getMybatisMapper(VmOrderDetailsMapper.class)
|