|
@@ -12,10 +12,7 @@ import com.minpay.common.service.IPublicService;
|
|
|
import com.minpay.common.util.CommonUtil;
|
|
|
import com.minpay.common.util.DateUtil;
|
|
|
import com.minpay.common.util.HttpPostUtil;
|
|
|
-import com.minpay.db.table.mapper.VmDeliveryInfMapper;
|
|
|
-import com.minpay.db.table.mapper.VmOrderDetailsMapper;
|
|
|
-import com.minpay.db.table.mapper.VmOrderInfMapper;
|
|
|
-import com.minpay.db.table.mapper.VmProEquRelMapper;
|
|
|
+import com.minpay.db.table.mapper.*;
|
|
|
import com.minpay.db.table.model.*;
|
|
|
import com.minpay.db.table.own.mapper.DeliveryMapper;
|
|
|
import com.startup.minpay.frame.business.IMINAction;
|
|
@@ -31,6 +28,7 @@ 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.util.Log;
|
|
|
+import io.netty.util.internal.StringUtil;
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -63,6 +61,9 @@ public class DeliveryAction implements IMINAction{
|
|
|
/**提货(无需session)*/
|
|
|
public static final String MAKE_DELIVERY_FOR_MACHINE_NOSESSION = "makeDeliveryForMachineNoSession";
|
|
|
|
|
|
+ /**提货(测试专用)*/
|
|
|
+ public static final String MAKE_DELIVERY_FOR_MACHINE_TEST = "makeDeliveryForMachineTest";
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -623,6 +624,88 @@ public class DeliveryAction implements IMINAction{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 提货接口(测试专用)
|
|
|
+ * @param equNo
|
|
|
+ * @param startAisle
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @MINAction(value = MAKE_DELIVERY_FOR_MACHINE_TEST)
|
|
|
+ public MINActionResult makeDeliveryForMachineTest(
|
|
|
+ @MINParam ( key = "equNo")String equNo,
|
|
|
+ @MINParam ( key = "startAisle")String startAisle,
|
|
|
+ @MINParam ( key = "endAisle")String endAisle,
|
|
|
+ MINSession session
|
|
|
+ ) throws Exception{
|
|
|
+ if(CommonUtil.isEmpty(equNo)){
|
|
|
+ throw new MINBusinessException("售货机编号不能为空!");
|
|
|
+ }
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ 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("00");
|
|
|
+ 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(equNo);
|
|
|
+ if(vmEquipmentInf == null){
|
|
|
+ throw new MINBusinessException("机器不存在!");
|
|
|
+ }
|
|
|
+ String imeiAddr = vmEquipmentInf.getImeiAddr();
|
|
|
+
|
|
|
+ /**获取售货机推送地址*/
|
|
|
+ String url = Service.lookup(IPropertiesService.class)
|
|
|
+ .getSystemProperties().get(user.getChannel() + "_GET_MACHINE_ADDRESS").getKey();
|
|
|
+ //组装推送接口
|
|
|
+ String sendUrl = url.concat("/VendingMachineAction/cePushGoods").concat("?MINView=JSON");
|
|
|
+
|
|
|
+ int endAisleNum = Integer.valueOf(endAisle);
|
|
|
+ for (int startAisleNum = Integer.valueOf(startAisle); startAisleNum < (endAisleNum+1); startAisleNum++) {
|
|
|
+ if(Integer.valueOf(startAisle) != startAisleNum){
|
|
|
+ Thread.sleep(5 * 1000); //设置暂停的时间 5 秒
|
|
|
+ System.out.println("==============="+"延迟5秒后执行");
|
|
|
+ }
|
|
|
+
|
|
|
+ String cargoNo = "";
|
|
|
+ if(startAisleNum < 10){
|
|
|
+ cargoNo = "0".concat(String.valueOf(startAisleNum));
|
|
|
+ }else{
|
|
|
+ cargoNo = String.valueOf(startAisleNum);
|
|
|
+ }
|
|
|
+ //获取提货表主键
|
|
|
+ String dlId = Service.lookup(IPublicService.class).getSequence("VM_DELIVERY_TEST_ID");
|
|
|
+ Map<String,String> mapNew = new HashMap<String,String>();
|
|
|
+ mapNew.put("imeiAddr", imeiAddr);
|
|
|
+ mapNew.put("cargoNo", cargoNo);
|
|
|
+ mapNew.put("deliveryNo", "T".concat(dlId));
|
|
|
+ mapNew.put("channel", "V01");
|
|
|
+ mapNew.put("returnUrl", "");
|
|
|
+ mapNew.put("MINView", "JSON");
|
|
|
+ JSONObject jsonOb = JSONObject.fromObject(mapNew);
|
|
|
+ String str = jsonOb.toString();
|
|
|
+ Log.info("通知售货机推货:".concat(str));
|
|
|
+ String passwardKey = Service.lookup(IPropertiesService.class)
|
|
|
+ .getSystemProperties().get("V01_TO_MACHINE_PASSWORD_KEY").getKey();
|
|
|
+ //数据加密
|
|
|
+ String desDe = Base64.encode(DesUtils.getInstance().encrypt(Base64.encode(str).getBytes(),passwardKey.getBytes(),null));
|
|
|
+
|
|
|
+
|
|
|
+ String results = HttpPostUtil.sendPostFormachine(sendUrl, desDe);
|
|
|
+ // //获取转义后响应信息
|
|
|
+ JSONObject detail = JSONObject.fromObject(results);
|
|
|
+ String code = String.valueOf(detail.get("code"));
|
|
|
+
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|