Commit f44abe31c36623ca65b2388199c0ecfe06beb308

Authored by pengyongcheng
1 parent b3a2b0cd

fix: 任务取消接收wcs返回内容message改为msg

src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java
@@ -6,10 +6,7 @@ import com.huaheng.api.wcs.domain.WcsTask; @@ -6,10 +6,7 @@ import com.huaheng.api.wcs.domain.WcsTask;
6 import com.huaheng.common.constant.HttpConstant; 6 import com.huaheng.common.constant.HttpConstant;
7 import com.huaheng.common.constant.QuantityConstant; 7 import com.huaheng.common.constant.QuantityConstant;
8 import com.huaheng.common.exception.service.ServiceException; 8 import com.huaheng.common.exception.service.ServiceException;
9 -import com.huaheng.common.utils.StringUtils;  
10 -import com.huaheng.common.utils.http.HttpUtils;  
11 import com.huaheng.common.utils.restful.RestUtil; 9 import com.huaheng.common.utils.restful.RestUtil;
12 -import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;  
13 import com.huaheng.framework.web.domain.AjaxResult; 10 import com.huaheng.framework.web.domain.AjaxResult;
14 import com.huaheng.framework.web.domain.WcsAjaxResult; 11 import com.huaheng.framework.web.domain.WcsAjaxResult;
15 import com.huaheng.framework.web.service.ConfigService; 12 import com.huaheng.framework.web.service.ConfigService;
@@ -29,10 +26,12 @@ public class TaskCancelServiceImpl implements TaskCancelService { @@ -29,10 +26,12 @@ public class TaskCancelServiceImpl implements TaskCancelService {
29 @Resource 26 @Resource
30 private ConfigService configService; 27 private ConfigService configService;
31 28
32 - /**取消任务 29 + /**
  30 + * 取消任务
33 * 1、判断参数是否为空 31 * 1、判断参数是否为空
34 * 2、转换实体 32 * 2、转换实体
35 * 3、发送数据 33 * 3、发送数据
  34 + *
36 * @param id 35 * @param id
37 * @return 36 * @return
38 */ 37 */
@@ -40,7 +39,7 @@ public class TaskCancelServiceImpl implements TaskCancelService { @@ -40,7 +39,7 @@ public class TaskCancelServiceImpl implements TaskCancelService {
40 public AjaxResult cancelTask(String id, String warehouseCode, String area) { 39 public AjaxResult cancelTask(String id, String warehouseCode, String area) {
41 40
42 //1、判断参数是否为空 41 //1、判断参数是否为空
43 - if(id == null){ 42 + if (id == null) {
44 throw new ServiceException("任务号为空"); 43 throw new ServiceException("任务号为空");
45 } 44 }
46 45
@@ -51,13 +50,13 @@ public class TaskCancelServiceImpl implements TaskCancelService { @@ -51,13 +50,13 @@ public class TaskCancelServiceImpl implements TaskCancelService {
51 //3、发送数据 50 //3、发送数据
52 String value = configService.getKey(QuantityConstant.RULE_CONNECT_WCS); 51 String value = configService.getKey(QuantityConstant.RULE_CONNECT_WCS);
53 int connectWCS = Integer.parseInt(value); 52 int connectWCS = Integer.parseInt(value);
54 - if(connectWCS == QuantityConstant.RULE_WCS_CONNECT) { 53 + if (connectWCS == QuantityConstant.RULE_WCS_CONNECT) {
55 String url = addressService.selectAddress(QuantityConstant.ADDRESS_WCS_TASK_CANCEL, warehouseCode, area); 54 String url = addressService.selectAddress(QuantityConstant.ADDRESS_WCS_TASK_CANCEL, warehouseCode, area);
56 String jsonParam = JSON.toJSONString(wcsTask); 55 String jsonParam = JSON.toJSONString(wcsTask);
57 ResponseEntity<JSONObject> result = RestUtil.request_post(url, warehouseCode, jsonParam); 56 ResponseEntity<JSONObject> result = RestUtil.request_post(url, warehouseCode, jsonParam);
58 if (result != null && result.getBody() != null) { 57 if (result != null && result.getBody() != null) {
59 String code = result.getBody().getString("code"); 58 String code = result.getBody().getString("code");
60 - String msg = result.getBody().getString("message"); 59 + String msg = result.getBody().getString("msg");
61 if (Integer.parseInt(code) != HttpConstant.OK) { 60 if (Integer.parseInt(code) != HttpConstant.OK) {
62 return AjaxResult.error(msg); 61 return AjaxResult.error(msg);
63 } 62 }
@@ -66,7 +65,7 @@ public class TaskCancelServiceImpl implements TaskCancelService { @@ -66,7 +65,7 @@ public class TaskCancelServiceImpl implements TaskCancelService {
66 } 65 }
67 String data = String.valueOf(result.getBody()); 66 String data = String.valueOf(result.getBody());
68 WcsAjaxResult ajaxResult = JSON.parseObject(data, WcsAjaxResult.class); 67 WcsAjaxResult ajaxResult = JSON.parseObject(data, WcsAjaxResult.class);
69 - if(ajaxResult.hasErr()){ 68 + if (ajaxResult.hasErr()) {
70 return AjaxResult.error(ajaxResult.getMessage()); 69 return AjaxResult.error(ajaxResult.getMessage());
71 } 70 }
72 return AjaxResult.success(); 71 return AjaxResult.success();