|
@@ -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);
|
|
|
|