Lius
2025-05-15 5a0dbf5c84f677c9f20252ccc63221dc7ba68d6c
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
69
70
71
72
73
74
75
76
77
78
79
80
package org.jeecg.modules.mdc.webservice.impl;
 
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.mdc.entity.MdcEquipmentDaySchedule;
import org.jeecg.modules.mdc.entity.MdcEquipmentDaySummary;
import org.jeecg.modules.mdc.service.IMdcEquipmentDayScheduleService;
import org.jeecg.modules.mdc.service.IMdcEquipmentDaySummaryService;
import org.jeecg.modules.mdc.vo.EquipmentDaySchedule;
import org.jeecg.modules.mdc.vo.EquipmentDaySummary;
import org.jeecg.modules.mdc.vo.WsResult;
import org.jeecg.modules.mdc.webservice.EquipmentWebService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import javax.jws.WebService;
import java.util.ArrayList;
import java.util.List;
 
 
/**
 * @author Lius
 * @date 2024/6/11 11:07
 */
@Service
@WebService(name = "EquipmentWebService",
        targetNamespace = "http://mdc.webservice.equipment.com",
        endpointInterface = "org.jeecg.modules.mdc.webservice.EquipmentWebService"
)
@Slf4j
public class EquipmentWebServiceImpl implements EquipmentWebService {
 
    @Resource
    private IMdcEquipmentDaySummaryService mdcEquipmentDaySummaryService;
 
    @Resource
    private IMdcEquipmentDayScheduleService mdcEquipmentDayScheduleService;
 
    @Override
    public String equipmentDaySchedule(String msg) {
        log.info("接收MES上报日计划原始数据 === {}", msg);
        List<EquipmentDaySchedule> equipmentDayScheduleList = JSONObject.parseArray(msg, EquipmentDaySchedule.class);
        if (equipmentDayScheduleList == null || equipmentDayScheduleList.isEmpty()) {
            WsResult wsResult = new WsResult("0", "json解析失败");
            return JSONObject.toJSONString(wsResult);
        }
        List<MdcEquipmentDaySchedule> mdcEquipmentDayScheduleList = new ArrayList<>();
        for (EquipmentDaySchedule equipmentDaySchedule : equipmentDayScheduleList) {
            MdcEquipmentDaySchedule mdcEquipmentDaySchedule = new MdcEquipmentDaySchedule();
            BeanUtils.copyProperties(equipmentDaySchedule, mdcEquipmentDaySchedule);
            mdcEquipmentDayScheduleList.add(mdcEquipmentDaySchedule);
        }
        mdcEquipmentDayScheduleService.saveBatch(mdcEquipmentDayScheduleList);
 
        log.info("接收MES上报日计划数据成功!");
        WsResult wsResult = new WsResult("1", "成功");
        return JSONObject.toJSONString(wsResult);
    }
 
    @Override
    public String equipmentDaySummary(String msg) {
        log.info("接收MES上报日汇总原始数据 === {}", msg);
        List<EquipmentDaySummary> equipmentDaySummaryList = JSONObject.parseArray(msg, EquipmentDaySummary.class);
        if (equipmentDaySummaryList == null || equipmentDaySummaryList.isEmpty()) {
            WsResult wsResult = new WsResult("0", "json解析失败");
            return JSONObject.toJSONString(wsResult);
        }
        List<MdcEquipmentDaySummary> mdcEquipmentDaySummaryList = new ArrayList<>();
        for (EquipmentDaySummary equipmentDaySummary : equipmentDaySummaryList) {
            MdcEquipmentDaySummary mdcEquipmentDaySummary = new MdcEquipmentDaySummary();
            BeanUtils.copyProperties(equipmentDaySummary, mdcEquipmentDaySummary);
            mdcEquipmentDaySummaryList.add(mdcEquipmentDaySummary);
        }
        mdcEquipmentDaySummaryService.saveBatch(mdcEquipmentDaySummaryList);
        log.info("接收MES上报日汇总数据成功!");
        WsResult wsResult = new WsResult("1", "成功");
        return JSONObject.toJSONString(wsResult);
    }
}