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);
|
}
|
}
|