Преглед изворни кода

预装箱单推送返回报错信息

huxy пре 1 година
родитељ
комит
7d46b8b708

+ 15 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java

@@ -358,9 +358,10 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
     @AutoLog(value = "预装箱单主表-推送")
     @ApiOperation(value="预装箱单主表-推送", notes="预装箱单主表-推送")
     @RequestMapping(value = "/push", method = {RequestMethod.GET})
-    public JSONObject push(@RequestParam(value = "id",required = true) String id) {
+    public Result push(@RequestParam(value = "id",required = true) String id) {
 
-        JSONObject result = new JSONObject();
+        Result result = new Result();
+        JSONObject jsonObject=new JSONObject();
         List<PackingHeaderVo> list=new ArrayList<>();
         try{
             if(oConvertUtils.isEmpty(id)){
@@ -379,8 +380,8 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             PackingHeaderVo vo=syPreAssembledPackingListService.pushData(id);
             list.add(vo);
             Gson userGson = new GsonBuilder().create();
-            result.put("payload", userGson.toJson(JSONObject.toJSON(list)));
-            log.info("JSON数据:" + result);
+            jsonObject.put("payload", userGson.toJson(JSONObject.toJSON(list)));
+            log.info("JSON数据:" + jsonObject);
 
             String url = resultList.get(0).getItemIp() + resultList.get(0).getItemUrl();//拼接url
 
@@ -393,7 +394,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             //调用doPost
             InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
             //处理返回信息
-            JSONObject  informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "发预装箱单接口-");
+            JSONObject  informationJson = interfaceConnUtils.doPostToBearer(jsonObject, url,tokenUrl, "发预装箱单接口-");
             //获取返回信息
             JSONObject jsonArray = informationJson.getJSONObject("payload");
 
@@ -402,15 +403,12 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             String code = jsonArray.getString("code");
             //获取返回消息
             String message = jsonArray.getString("message");
-
+            result.setMessage(message);
             SyPreAssembledPackingList syPreAssembledPackingList =   syPreAssembledPackingListService.getById(id);
             if(code.equals("S")){
                 syPreAssembledPackingList.setPushStatus("1");
-                System.out.println("推送过去了");
             }else{
                 syPreAssembledPackingList.setPushStatus("2");
-                System.out.println("失败原因:\t"+message);
-                System.out.println("推送失败了");
             }
             syPreAssembledPackingListService.updateById(syPreAssembledPackingList);
 
@@ -505,8 +503,9 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
     @AutoLog(value = "批量推送")
     @ApiOperation(value="批量推送", notes="批量推送")
     @RequestMapping(value = "/pushBatch", method = {RequestMethod.GET})
-    public JSONObject pushBatch(@RequestParam(value = "id",required = true) String[] ids) {
-        JSONObject result=new JSONObject();
+    public Result pushBatch(@RequestParam(value = "id",required = true) String[] ids) {
+        Result result=new Result();
+        JSONObject jsonObject=new JSONObject();
         List<PackingHeaderVo> list=new ArrayList<>();
         try{
             if(oConvertUtils.isEmpty(ids)){
@@ -525,8 +524,8 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             System.out.println("list的长度:\t"+list.size());
             list.forEach(System.out::println);
             Gson userGson = new GsonBuilder().create();
-            result.put("payload", userGson.toJson(JSONObject.toJSON(list)));
-            log.info("JSON数据:" + result);
+            jsonObject.put("payload", userGson.toJson(JSONObject.toJSON(list)));
+            log.info("JSON数据:" + jsonObject);
 
             String url = resultList.get(0).getItemIp() + resultList.get(0).getItemUrl();//拼接url
 
@@ -539,7 +538,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             //调用doPost
             InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
             //处理返回信息
-            JSONObject  informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "发预装箱单接口-");
+            JSONObject  informationJson = interfaceConnUtils.doPostToBearer(jsonObject, url,tokenUrl, "发预装箱单接口-");
             //获取返回信息
             JSONObject jsonArray = informationJson.getJSONObject("payload");
 
@@ -547,16 +546,14 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             String code = jsonArray.getString("code");
             //获取返回消息
             String message = jsonArray.getString("message");
-
+            result.setMessage(message);
             UpdateWrapper<SyPreAssembledPackingList> wrapper=new UpdateWrapper<>();
             if(code.equals("S")){
                 wrapper.set("push_Status","1");//推送过去
-                wrapper.in(" id",ids);
-                System.out.println("推送过去了");
+                wrapper.in(" id",ids); 
             }else{
                 wrapper.set("push_Status","2");//推送失败
                 wrapper.in(" id",ids);
-                System.out.println("推送失败了");
             }
             syPreAssembledPackingListService.update(wrapper);
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java

@@ -654,7 +654,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 					if(syshippings!=null){
 						total1=syshippings.getShipmentQuantity();
 					}else{
-						//throw new JeecgBootException("该单据在上游未找到");
+						throw new JeecgBootException("该单据在上游未找到");
 					}
 					queryWrapper=new QueryWrapper();
 					queryWrapper.in("sy_declaration_elements_item_id", Arrays.asList(ids.split(",")));

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -238,7 +238,7 @@ public class SyPackingListTailoringController {
 			 queryWrapper.like("a.product_Name",syPreAssembledPackingListVo.getProductName());//品名
 		 }
 		 if(oConvertUtils.isNotEmpty(syPreAssembledPackingListVo.getDepositaryReceiptNo())){
-			 queryWrapper.like("a.depositary_Receipt_No",syPreAssembledPackingListVo.getDepositaryReceiptNo());//导入时间
+			 queryWrapper.like("a.depositary_Receipt_No",syPreAssembledPackingListVo.getDepositaryReceiptNo());//预托书号
 		 }
 		 //预发货日期
 		 if(oConvertUtils.isNotEmpty(stratDate)){//起始