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