|
|
@ -1,7 +1,11 @@
|
|
|
|
package com.glxp.api.service.sync;
|
|
|
|
package com.glxp.api.service.sync;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.dev.*;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.thrsys.ThrManufacturerMapper;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.dev.*;
|
|
|
|
import com.glxp.api.res.inv.InnerOrderPrintResponse;
|
|
|
|
import com.glxp.api.res.inv.InnerOrderPrintResponse;
|
|
|
|
|
|
|
|
import com.glxp.api.service.dev.*;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
@ -19,16 +23,12 @@ import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.constant.*;
|
|
|
|
import com.glxp.api.constant.*;
|
|
|
|
import com.glxp.api.dao.basic.*;
|
|
|
|
import com.glxp.api.dao.basic.*;
|
|
|
|
import com.glxp.api.dao.inout.*;
|
|
|
|
import com.glxp.api.dao.inout.*;
|
|
|
|
import com.glxp.api.dao.dev.DeviceInspectTaskDetailMapper;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.dev.DeviceInspectTaskMapper;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.purchase.*;
|
|
|
|
import com.glxp.api.dao.purchase.*;
|
|
|
|
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
|
|
|
|
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
|
|
|
|
import com.glxp.api.dto.RelaySyncDto;
|
|
|
|
import com.glxp.api.dto.RelaySyncDto;
|
|
|
|
import com.glxp.api.entity.auth.*;
|
|
|
|
import com.glxp.api.entity.auth.*;
|
|
|
|
import com.glxp.api.entity.basic.*;
|
|
|
|
import com.glxp.api.entity.basic.*;
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
import com.glxp.api.entity.dev.DeviceInspectTaskDetailEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.dev.DeviceInspectTaskEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.purchase.*;
|
|
|
|
import com.glxp.api.entity.purchase.*;
|
|
|
|
import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
|
|
|
|
import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusEntity;
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusEntity;
|
|
|
@ -43,8 +43,6 @@ import com.glxp.api.res.sync.*;
|
|
|
|
import com.glxp.api.service.auth.*;
|
|
|
|
import com.glxp.api.service.auth.*;
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
import com.glxp.api.service.dev.DeviceInspectTaskDetailService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.dev.DeviceInspectTaskService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.system.*;
|
|
|
|
import com.glxp.api.service.system.*;
|
|
|
|
import com.glxp.api.service.thrsys.*;
|
|
|
|
import com.glxp.api.service.thrsys.*;
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
@ -67,6 +65,7 @@ import javax.annotation.Resource;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileWriter;
|
|
|
|
import java.io.FileWriter;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
|
|
|
|
@ -274,8 +273,27 @@ public class HeartService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case IO_ORDER:
|
|
|
|
case IO_ORDER:
|
|
|
|
if (needExec())
|
|
|
|
// if (needExec())
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVICE_INFO_DATA:
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceInfo())) {
|
|
|
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getDeviceInfoData(info, taskId, now, syncTime));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVICE_CHECK_DATA:
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceCheck(),info.getDeviceCheckDetail(),info.getDeviceCheckDetailItem())) {
|
|
|
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getDeviceCheckData(info, taskId, now, syncTime));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVICE_REPAIR_DATA:
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceRepairApply(),info.getDeviceRepairDetail(),info.getDeviceRepair())) {
|
|
|
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getDeviceRepair(info, taskId, now, syncTime));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRODUCE_BUSINESS_DATA:
|
|
|
|
|
|
|
|
if (needExec(info.getProduceBusiness())) {
|
|
|
|
|
|
|
|
uploadData(exportType, taskId, x -> x.getProBusinessData(info, taskId, now, syncTime));
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DEVICE_TASK:
|
|
|
|
case DEVICE_TASK:
|
|
|
|
// if (needExec(info.getDeviceTask())) {
|
|
|
|
// if (needExec(info.getDeviceTask())) {
|
|
|
@ -1678,16 +1696,20 @@ public class HeartService {
|
|
|
|
Date startTime = new Date();
|
|
|
|
Date startTime = new Date();
|
|
|
|
|
|
|
|
|
|
|
|
String data = spGetHttp.pullData(exportType);
|
|
|
|
String data = spGetHttp.pullData(exportType);
|
|
|
|
|
|
|
|
log.warn("打印出来{}",data);
|
|
|
|
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(data);
|
|
|
|
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(data);
|
|
|
|
Integer code = obj.getInt("code");
|
|
|
|
Integer code = obj.getInt("code");
|
|
|
|
if (!code.equals(20000)) {
|
|
|
|
if (!code.equals(20000)) {
|
|
|
|
log.error("从UDI自助平台拉取数据错误,报文-----{}", data);
|
|
|
|
log.error("从UDI自助平台拉取数据错误,报文-----{}", data);
|
|
|
|
|
|
|
|
log.error("打印出来{}",exportType);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//数据内容
|
|
|
|
//数据内容
|
|
|
|
String dataStr = obj.getStr("data");
|
|
|
|
String dataStr = obj.getStr("data");
|
|
|
|
|
|
|
|
log.error("shujv neirong xiwangshi duide bushi cuode {}",dataStr);
|
|
|
|
if (StrUtil.isNotBlank(dataStr)) {
|
|
|
|
if (StrUtil.isNotBlank(dataStr)) {
|
|
|
|
RelaySyncDto bean = JSONUtil.toBean(dataStr, RelaySyncDto.class);
|
|
|
|
RelaySyncDto bean = JSONUtil.toBean(dataStr, RelaySyncDto.class);
|
|
|
|
|
|
|
|
log.error("??????????????????{}",bean);
|
|
|
|
switch (exportType) {
|
|
|
|
switch (exportType) {
|
|
|
|
case BASIC_DATA:
|
|
|
|
case BASIC_DATA:
|
|
|
|
this.insertBasicData(bean.getFileContent());
|
|
|
|
this.insertBasicData(bean.getFileContent());
|
|
|
@ -1698,10 +1720,22 @@ public class HeartService {
|
|
|
|
case DOCUMENT_TYPE_DATA:
|
|
|
|
case DOCUMENT_TYPE_DATA:
|
|
|
|
this.insertDocumentTypeData(bean.getFileContent());
|
|
|
|
this.insertDocumentTypeData(bean.getFileContent());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case DEVICE_TASK:
|
|
|
|
case DEVICE_TASK:
|
|
|
|
this.insertDevTaskData(bean.getFileContent());
|
|
|
|
this.insertDevTaskData(bean.getFileContent());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVICE_INFO_DATA:
|
|
|
|
|
|
|
|
this.insertDeviceInfoData(bean.getFileContent());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVICE_CHECK_DATA:
|
|
|
|
|
|
|
|
this.insertDeviceCheckData(bean.getFileContent());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
//insertDeviceRepairData
|
|
|
|
|
|
|
|
case DEVICE_REPAIR_DATA:
|
|
|
|
|
|
|
|
this.insertDeviceRepairData(bean.getFileContent());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PRODUCE_BUSINESS_DATA:
|
|
|
|
|
|
|
|
this.insertProBusinessData(bean.getFileContent());
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String taskId = bean.getTaskId();
|
|
|
|
String taskId = bean.getTaskId();
|
|
|
|
if (StrUtil.isNotBlank(taskId)) {
|
|
|
|
if (StrUtil.isNotBlank(taskId)) {
|
|
|
@ -1892,6 +1926,147 @@ public class HeartService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceInfoMapper deviceInfoMapper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量插入设备基础数据
|
|
|
|
|
|
|
|
* insertDeviceInfoData
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.NESTED)
|
|
|
|
|
|
|
|
public void insertDeviceInfoData(String content) {
|
|
|
|
|
|
|
|
log.error("这个是什么{}",content);
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
|
|
|
|
List<DeviceInfoEntity> deviceInfoEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceInfoEntity.class.getSimpleName()), DeviceInfoEntity.class);
|
|
|
|
|
|
|
|
log.error("shebei jichu 数据 到底是什么{}",deviceInfoEntities);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceInfoEntities)) {
|
|
|
|
|
|
|
|
for (DeviceInfoEntity deviceInfoEntity : deviceInfoEntities) {
|
|
|
|
|
|
|
|
deviceInfoEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.error("hahahhahhahahah woyao fengle{}",deviceInfoEntities);
|
|
|
|
|
|
|
|
boolean b = deviceInfoMapper.replaceBatchs(deviceInfoEntities);
|
|
|
|
|
|
|
|
if (b == false){
|
|
|
|
|
|
|
|
log.error("差距自己找,头像右上角");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncFiles)) {
|
|
|
|
|
|
|
|
fileService.download(syncFiles);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量插入或者更改 巡检管理数据
|
|
|
|
|
|
|
|
* insertDeviceCheckData
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckMapper deviceCheckMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckDetailMapper deviceCheckDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckDetailItemMapper deviceCheckDetailItemMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.NESTED)
|
|
|
|
|
|
|
|
public void insertDeviceCheckData(String content){
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
|
|
|
|
List<DeviceCheckEntity> deviceCheckEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckEntity.class.getSimpleName()), DeviceCheckEntity.class);
|
|
|
|
|
|
|
|
List<DeviceCheckDetailEntity> deviceCheckDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckDetailEntity.class.getSimpleName()), DeviceCheckDetailEntity.class);
|
|
|
|
|
|
|
|
List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckDetailItemEntity.class.getSimpleName()), DeviceCheckDetailItemEntity.class);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckEntities)) {
|
|
|
|
|
|
|
|
for (DeviceCheckEntity deviceCheckEntity : deviceCheckEntities) {
|
|
|
|
|
|
|
|
deviceCheckEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceCheckMapper.replaceBatchs(deviceCheckEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckDetailEntities)) {
|
|
|
|
|
|
|
|
for (DeviceCheckDetailEntity deviceCheckDetailEntity : deviceCheckDetailEntities) {
|
|
|
|
|
|
|
|
deviceCheckDetailEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceCheckDetailMapper.replaceBatchs(deviceCheckDetailEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckDetailItemEntities)) {
|
|
|
|
|
|
|
|
for (DeviceCheckDetailItemEntity deviceCheckDetailItemEntity : deviceCheckDetailItemEntities) {
|
|
|
|
|
|
|
|
deviceCheckDetailItemEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceCheckDetailItemMapper.replaceBatchs(deviceCheckDetailItemEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncFiles)) {
|
|
|
|
|
|
|
|
fileService.download(syncFiles);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairApplyMapper deviceRepairApplyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairApplyDetailMapper deviceRepairApplyDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairMapper deviceRepairMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量 插入 || 更新 报修管理
|
|
|
|
|
|
|
|
* @param content
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.NESTED)
|
|
|
|
|
|
|
|
public void insertDeviceRepairData(String content){
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
|
|
|
|
List<DeviceRepairApplyEntity> deviceRepairApplyEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairApplyEntity.class.getSimpleName()), DeviceRepairApplyEntity.class);
|
|
|
|
|
|
|
|
List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairApplyDetailEntity.class.getSimpleName()), DeviceRepairApplyDetailEntity.class);
|
|
|
|
|
|
|
|
List<DeviceRepairEntity> deviceRepairEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairEntity.class.getSimpleName()), DeviceRepairEntity.class);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairApplyEntities)) {
|
|
|
|
|
|
|
|
for (DeviceRepairApplyEntity deviceRepairApplyEntity : deviceRepairApplyEntities) {
|
|
|
|
|
|
|
|
deviceRepairApplyEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceRepairApplyMapper.replaceBatchs(deviceRepairApplyEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairApplyDetailEntities)) {
|
|
|
|
|
|
|
|
for (DeviceRepairApplyDetailEntity deviceRepairApplyDetailEntity : deviceRepairApplyDetailEntities) {
|
|
|
|
|
|
|
|
deviceRepairApplyDetailEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceRepairApplyDetailMapper.replaceBatchs(deviceRepairApplyDetailEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairEntities)) {
|
|
|
|
|
|
|
|
for (DeviceRepairEntity deviceRepairEntity : deviceRepairEntities) {
|
|
|
|
|
|
|
|
deviceRepairEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceRepairMapper.replaceBatchs(deviceRepairEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncFiles)) {
|
|
|
|
|
|
|
|
fileService.download(syncFiles);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量 || 插入 企业信息
|
|
|
|
|
|
|
|
* insertProBusinessData
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ThrManufacturerMapper thrManufacturerMapper;
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.NESTED)
|
|
|
|
|
|
|
|
public void insertProBusinessData(String content){
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
|
|
|
|
List<ThrManufacturerEntity> thrManufacturerEntities = JSONUtil.toList(jsonObject.getJSONArray(ThrManufacturerEntity.class.getSimpleName()), ThrManufacturerEntity.class);
|
|
|
|
|
|
|
|
log.error("heiheihieheihi 生产企业信息",thrManufacturerEntities);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thrManufacturerEntities)) {
|
|
|
|
|
|
|
|
for (ThrManufacturerEntity deviceRepairApplyEntity : thrManufacturerEntities) {
|
|
|
|
|
|
|
|
deviceRepairApplyEntity.setUpdateTime(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
thrManufacturerMapper.replaceBatchs(thrManufacturerEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(syncFiles)) {
|
|
|
|
|
|
|
|
fileService.download(syncFiles);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 从UDI自助平台拉取基础数据
|
|
|
|
* 从UDI自助平台拉取基础数据
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -2317,4 +2492,244 @@ public class HeartService {
|
|
|
|
basicExportService.updateExportStatus(basicExportStatusEntity1);
|
|
|
|
basicExportService.updateExportStatus(basicExportStatusEntity1);
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceInfoService deviceInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceChangeOrderService deviceChangeOrderService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SpsSyncDeviceDataResponse getDeviceInfoData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
|
|
|
|
|
|
|
|
SpsSyncDeviceDataResponse dataResponse = null;
|
|
|
|
|
|
|
|
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
|
|
|
|
|
|
|
|
syncTimeMap.put("isNew", true);
|
|
|
|
|
|
|
|
boolean ge = false;
|
|
|
|
|
|
|
|
if (syncTime != null) {
|
|
|
|
|
|
|
|
ge = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 确认设备信息数据开启
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceInfo())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEVICE_INFO_DATA);
|
|
|
|
|
|
|
|
log.error("map libian de shujv {}",map);
|
|
|
|
|
|
|
|
List<DeviceInfoEntity> deptEntityList = deviceInfoService.list(Wrappers.lambdaQuery(DeviceInfoEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceInfoEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceInfoEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceInfoEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deptEntityList)) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
dataResponse.setDeviceInfoEntities(deptEntityList);
|
|
|
|
|
|
|
|
remark.append("设备基础信息:").append(deptEntityList.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dataResponse != null) {
|
|
|
|
|
|
|
|
dataResponse.setTaskId(taskId);
|
|
|
|
|
|
|
|
dataResponse.setType(BasicExportTypeEnum.DEVICE_INFO_DATA.getRemark());
|
|
|
|
|
|
|
|
dataResponse.setSyncRemark(remark.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.error("这是第三方数据库的东西 嘿嘿嘿嘿{}",dataResponse);
|
|
|
|
|
|
|
|
return dataResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckService deviceCheckService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckDetailService deviceCheckDetailService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceCheckDetailItemService deviceCheckDetailItemService;
|
|
|
|
|
|
|
|
public SpsSyncDeviceDataResponse getDeviceCheckData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
|
|
|
|
|
|
|
|
SpsSyncDeviceDataResponse dataResponse = null;
|
|
|
|
|
|
|
|
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
|
|
|
|
|
|
|
|
syncTimeMap.put("isNew", true);
|
|
|
|
|
|
|
|
boolean ge = false;
|
|
|
|
|
|
|
|
if (syncTime != null) {
|
|
|
|
|
|
|
|
ge = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 确认巡检任务管理开启
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceCheck())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DATA);
|
|
|
|
|
|
|
|
List<DeviceCheckEntity> deviceCheckEntities = deviceCheckService.list(Wrappers.lambdaQuery(DeviceCheckEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceCheckEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceCheckEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceCheckEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckEntities)) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
dataResponse.setDeviceCheckEntities(deviceCheckEntities);
|
|
|
|
|
|
|
|
remark.append("巡检任务信息:").append(deviceCheckEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//巡检任务具体数据 deviceCheckDetail
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceCheckDetail())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL);
|
|
|
|
|
|
|
|
List<DeviceCheckDetailEntity> deviceCheckDetailEntities = deviceCheckDetailService.list(Wrappers.lambdaQuery(DeviceCheckDetailEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceCheckDetailEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckDetailEntities)) {
|
|
|
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dataResponse.setDeviceCheckDetailEntities(deviceCheckDetailEntities);
|
|
|
|
|
|
|
|
remark.append("巡检设备具体信息:").append(deviceCheckDetailEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//巡检设备项目表
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceCheckDetailItem())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL_ITEM);
|
|
|
|
|
|
|
|
List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities = deviceCheckDetailItemService.list(Wrappers.lambdaQuery(DeviceCheckDetailItemEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailItemEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceCheckDetailItemEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceCheckDetailItemEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceCheckDetailItemEntities)) {
|
|
|
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dataResponse.setDeviceCheckDetailItemEntities(deviceCheckDetailItemEntities);
|
|
|
|
|
|
|
|
remark.append("巡检设备项目表:").append(deviceCheckDetailItemEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dataResponse != null) {
|
|
|
|
|
|
|
|
dataResponse.setTaskId(taskId);
|
|
|
|
|
|
|
|
dataResponse.setType(BasicExportTypeEnum.DEVICE_CHECK_DATA.getRemark());
|
|
|
|
|
|
|
|
dataResponse.setSyncRemark(remark.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.error("巡检任务管理的数据,zzhzzhzzh{}",dataResponse);
|
|
|
|
|
|
|
|
return dataResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairApplyService deviceRepairApplyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairApplyDetailService deviceRepairApplyDetailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
DeviceRepairService deviceRepairService;
|
|
|
|
|
|
|
|
// 报修表
|
|
|
|
|
|
|
|
public SpsSyncDeviceDataResponse getDeviceRepair(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
|
|
|
|
|
|
|
|
SpsSyncDeviceDataResponse dataResponse = null;
|
|
|
|
|
|
|
|
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
|
|
|
|
|
|
|
|
syncTimeMap.put("isNew", true);
|
|
|
|
|
|
|
|
boolean ge = false;
|
|
|
|
|
|
|
|
if (syncTime != null) {
|
|
|
|
|
|
|
|
ge = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
|
|
|
//确认同步报修单开启
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceRepairApply())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY);
|
|
|
|
|
|
|
|
List<DeviceRepairApplyEntity> deviceRepairApplyEntities = deviceRepairApplyService.list(Wrappers.lambdaQuery(DeviceRepairApplyEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceRepairApplyEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceRepairApplyEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceRepairApplyEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairApplyEntities)) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
dataResponse.setDeviceRepairApplyEntities(deviceRepairApplyEntities);
|
|
|
|
|
|
|
|
remark.append("报修单数据:").append(deviceRepairApplyEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//确认开启报修单明细同步
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceRepairDetail())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY_DETAIL);
|
|
|
|
|
|
|
|
List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities = deviceRepairApplyDetailService.list(Wrappers.lambdaQuery(DeviceRepairApplyDetailEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceRepairApplyDetailEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceRepairApplyDetailEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceRepairApplyDetailEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairApplyDetailEntities)) {
|
|
|
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dataResponse.setDeviceRepairApplyDetailEntities(deviceRepairApplyDetailEntities);
|
|
|
|
|
|
|
|
remark.append("报修单明细数据:").append(deviceRepairApplyDetailEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//确认开启维修单同步
|
|
|
|
|
|
|
|
if (needExec(info.getDeviceRepair())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR);
|
|
|
|
|
|
|
|
List<DeviceRepairEntity> deviceRepairEntities = deviceRepairService.list(Wrappers.lambdaQuery(DeviceRepairEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, DeviceRepairEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceRepairEntities)) {
|
|
|
|
|
|
|
|
if (dataResponse == null) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncDeviceDataResponse();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dataResponse.setDeviceRepairEntities(deviceRepairEntities);
|
|
|
|
|
|
|
|
remark.append("维修单数据:").append(deviceRepairEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dataResponse != null) {
|
|
|
|
|
|
|
|
dataResponse.setTaskId(taskId);
|
|
|
|
|
|
|
|
dataResponse.setType(BasicExportTypeEnum.DEVICE_REPAIR_DATA.getRemark());
|
|
|
|
|
|
|
|
dataResponse.setSyncRemark(remark.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.error("自主平台服务数据{}",dataResponse);
|
|
|
|
|
|
|
|
return dataResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ThrManufacturerService thrManufacturerService;
|
|
|
|
|
|
|
|
//生产企业
|
|
|
|
|
|
|
|
public SpsSyncProBusinessDataResponse getProBusinessData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
|
|
|
|
|
|
|
|
SpsSyncProBusinessDataResponse dataResponse = null;
|
|
|
|
|
|
|
|
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
|
|
|
|
|
|
|
|
syncTimeMap.put("isNew", true);
|
|
|
|
|
|
|
|
boolean ge = false;
|
|
|
|
|
|
|
|
if (syncTime != null) {
|
|
|
|
|
|
|
|
ge = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer remark = new StringBuffer();
|
|
|
|
|
|
|
|
//确认同步报修单开启
|
|
|
|
|
|
|
|
if (needExec(info.getProduceBusiness())) {
|
|
|
|
|
|
|
|
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.PRODUCE_BUSINESS_DATA);
|
|
|
|
|
|
|
|
List<ThrManufacturerEntity> thrManufacturerEntities = thrManufacturerService.list(Wrappers.lambdaQuery(ThrManufacturerEntity.class)
|
|
|
|
|
|
|
|
.le(!ge && (boolean) map.get("isNew"), ThrManufacturerEntity::getUpdateTime, now)
|
|
|
|
|
|
|
|
.between(ge, ThrManufacturerEntity::getUpdateTime, syncTime, now)
|
|
|
|
|
|
|
|
.between(!ge && !(boolean) map.get("isNew"), ThrManufacturerEntity::getUpdateTime
|
|
|
|
|
|
|
|
, map.get("oldDate"), now)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thrManufacturerEntities)) {
|
|
|
|
|
|
|
|
dataResponse = new SpsSyncProBusinessDataResponse();
|
|
|
|
|
|
|
|
dataResponse.setThrManufacturerEntities(thrManufacturerEntities);
|
|
|
|
|
|
|
|
remark.append("企业信息数据:").append(thrManufacturerEntities.size()).append("条\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dataResponse != null) {
|
|
|
|
|
|
|
|
dataResponse.setTaskId(taskId);
|
|
|
|
|
|
|
|
dataResponse.setType(BasicExportTypeEnum.PRODUCE_BUSINESS_DATA.getRemark());
|
|
|
|
|
|
|
|
dataResponse.setSyncRemark(remark.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.error("自主平台服务数据{}",dataResponse);
|
|
|
|
|
|
|
|
return dataResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|