Blame view

src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java 1.59 KB
pengcheng authored
1
2
3
4
5
6
7
package com.huaheng.api.wcs.service.taskCancel;

import com.alibaba.fastjson.JSON;
import com.huaheng.api.wcs.domain.WcsTask;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.http.HttpUtils;
8
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
pengcheng authored
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.address.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TaskCancelServiceImpl implements TaskCancelService {


    @Autowired
    private AddressService addressService;

    /**取消任务
     * 1、判断参数是否为空
     * 2、转换实体
     * 3、发送数据
     * @param id
     * @return
     */
    @Override
pengcheng authored
29
    public AjaxResult TaskCance(Integer id) {
pengcheng authored
30
31
32
33
34

        //1、判断参数是否为空
        if(id == null){
            throw new ServiceException("任务号为空");
        }
pengcheng authored
35
pengcheng authored
36
37

        //2、转换实体
38
39
//        WcsTask wcsTask = new WcsTask();
//        wcsTask.setTaskNo(id.toString());
pengcheng authored
40
41
42

        //3、发送数据
        String param="wcs";
pengcheng authored
43
        String url=addressService.selectAddress(param)+"TaskCancel";
44
        String JsonParam = JSON.toJSONString(id.toString());
pengcheng authored
45
46
47
48
49
50
51
52
        String result = HttpUtils.bodypost(url, JsonParam);
        if(StringUtils.isEmpty(result)){
            throw new ServiceException("接口地址错误");
        }
        AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
        return ajaxResult;
    }
}