zhang
9 天以前 ce2d24454495d6f145dc8af7936b31541b2fdfa3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.zy.acs.manager.core.scheduler;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.framework.common.SnowflakeIdWorker;
import com.zy.acs.manager.core.service.MainLockWrapService;
import com.zy.acs.manager.core.service.MainService;
import com.zy.acs.manager.core.service.TrafficService;
import com.zy.acs.manager.core.utils.HttpHandler;
import com.zy.acs.manager.manager.entity.TaskReport;
import com.zy.acs.manager.manager.service.*;
import com.zy.acs.manager.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
 
import java.io.IOException;
import java.util.List;
 
@Slf4j
@Component
public class ReportThirdScheduler {
 
 
    @Autowired
    private TaskReportService taskReportService;
 
    @Autowired
    private ConfigService configService;
 
 
//    @Scheduled(fixedDelay = 1000)
    public void execute() {
//        List<TaskReport> list = taskReportService.list();
//        for (TaskReport taskReport : list) {
//            report(taskReport);
//        }
 
        String wmsUrl = configService.getVal("WMS_URL", String.class);
        String wmsPath = configService.getVal("WMS_PATH", String.class);
    }
 
    @Transactional
    public void report(TaskReport taskReport,String wmsUrl,String wmsPath) {
        //TODO 原先应该调用接口,现在直接修改数据
        String response = null;
        try {
            response = new HttpHandler.Builder()
                    .setUri(wmsUrl)
                    .setPath(wmsPath)
                    .setJson(JSON.toJSONString(taskReport))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("code").equals(200)) {
 
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        JSONObject jsonObject = JSON.parseObject(response);
    }
 
 
}