feat: 设备优化

lh_dev_fifo^2
chenhc 1 week ago
parent 47c2d5eb33
commit c8c00768e4

@ -118,7 +118,7 @@ public class FileServiceImpl implements FileService {
boolean isExists = true;
List<String> noExitsList = new ArrayList<>();
for (String strs : list) {
if (!StringUtils.isEmpty(strs) && FileUtils.isFileExist(strs)) {
if (!StringUtils.isEmpty(strs) && FileUtils.isFileExist(filePath + "register/device/" + strs)) {
files.add(strs);
} else {
isExists = false;

@ -2,6 +2,10 @@ package com.glxp.api.res.sync;
import com.glxp.api.entity.dev.DeviceInspectTaskDetailEntity;
import com.glxp.api.entity.dev.DeviceInspectTaskEntity;
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.entity.purchase.PurApplyEntity;
import com.glxp.api.entity.purchase.PurContractDetailEntity;
import com.glxp.api.entity.purchase.PurContractEntity;
import lombok.Data;
import java.util.List;
@ -13,4 +17,12 @@ public class SpsSyncDeviceTaskResponse extends BaseSyncResponse {
List<DeviceInspectTaskDetailEntity> deviceInspectTaskDetailEntities;
List<PurApplyDetailEntity> purApplyDetailEntityList;
List<PurApplyEntity> purApplyEntities;
List<PurContractEntity> purContractEntities;
List<PurContractDetailEntity> purContractDetailEntities;
}

@ -6,6 +6,10 @@ import com.glxp.api.dao.thrsys.ThrManufacturerMapper;
import com.glxp.api.entity.dev.*;
import com.glxp.api.res.inv.InnerOrderPrintResponse;
import com.glxp.api.service.dev.*;
import com.glxp.api.service.purchase.impl.PurApplyDetailService;
import com.glxp.api.service.purchase.impl.PurApplyService;
import com.glxp.api.service.purchase.impl.PurContractDetailService;
import com.glxp.api.service.purchase.impl.PurContractService;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import cn.hutool.core.collection.CollUtil;
@ -56,6 +60,7 @@ import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.TransactionIsolationLevel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
@ -69,6 +74,7 @@ import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.glxp.api.constant.BasicProcessStatus.NEW_ALL_ORDER;
import static com.glxp.api.constant.BasicProcessStatus.NEW_ALL_UDIS;
@ -110,6 +116,10 @@ public class HeartService {
@Resource
IoOrderInvoiceMapper ioOrderInvoiceMapper;
private final ApplicationContext applicationContext;
@Autowired
private PurContractService purContractService;
@Autowired
private PurContractDetailService purContractDetailService;
//上传最近更新扫码单据
public BaseResponse uploadAllOrder(String syncTime) {
@ -1077,6 +1087,7 @@ public class HeartService {
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.SYS_SET_DATA.getRemark());
@ -1114,6 +1125,11 @@ public class HeartService {
@Resource
FileService fileService;
@Resource
PurApplyService purApplyService;
@Resource
PurApplyDetailService purApplyDetailService;
/**
* @param info
* @param taskId
@ -1156,7 +1172,72 @@ public class HeartService {
}
fileService.upload(files);
}
//pur apply
List<PurApplyEntity> purApplyEntities = purApplyService.list(Wrappers.lambdaQuery(PurApplyEntity.class)
.le(!ge && (boolean) map.get("isNew"), PurApplyEntity::getUpdateTime, now)
.between(ge, PurApplyEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), PurApplyEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(purApplyEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurApplyEntities(purApplyEntities);
remark.append("申购单据:").append(purApplyEntities.size()).append("条\n");
}
List<String> billNoList = purApplyEntities.stream()
.map(PurApplyEntity::getBillNo)
.filter(Objects::nonNull) // 过滤掉可能的null值
.distinct() // 去重
.collect(Collectors.toList());
List<PurApplyDetailEntity> purApplyDetailEntityList = purApplyDetailService.list(Wrappers.lambdaQuery(PurApplyDetailEntity.class)
.in(CollectionUtil.isNotEmpty(billNoList), PurApplyDetailEntity::getOrderIdFk, billNoList)
);
if (CollectionUtil.isNotEmpty(purApplyDetailEntityList)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurApplyDetailEntityList(purApplyDetailEntityList);
remark.append("申购单据明细:").append(purApplyDetailEntityList.size()).append("条\n");
}
//pur contract
List<PurContractEntity> purContractEntities = purContractService.list(Wrappers.lambdaQuery(PurContractEntity.class)
.le(!ge && (boolean) map.get("isNew"), PurContractEntity::getUpdateTime, now)
.between(ge, PurContractEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), PurContractEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(purContractEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurContractEntities(purContractEntities);
remark.append("合同单据:").append(purContractEntities.size()).append("条\n");
}
List<String> codeList = purContractEntities.stream()
.map(PurContractEntity::getCode)
.filter(Objects::nonNull) // 过滤掉可能的null值
.distinct() // 去重
.collect(Collectors.toList());
List<PurContractDetailEntity> purContractDetailEntities = purContractDetailService.list(Wrappers.lambdaQuery(PurContractDetailEntity.class)
.in(CollectionUtil.isNotEmpty(codeList), PurContractDetailEntity::getOrderIdFk, codeList)
);
if (CollectionUtil.isNotEmpty(purContractDetailEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurContractDetailEntities(purContractDetailEntities);
remark.append("合同单据明细:").append(purContractDetailEntities.size()).append("条\n");
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.THIRD_DATA.getRemark());
@ -2721,14 +2802,14 @@ public class HeartService {
list.add(deviceRepairApplyDetailEntity.getDiagnosisLivePath());
}
log.error("当前数据接受到的报修单明细list{}",list);
// BaseResponse<String> response = spGetHttp.postTemplateFile(list);
// if (response.getCode() == 20000) {
// log.error("图片列表上传成功");
//// uploadFileLog = "\n模板文件列表上传成功";
// } else {
// log.info("模板文件上传失败,响应信息:{}", response.getMessage());
//// uploadFileLog = "\n模板文件列表上传失败错误信息" + response.getMessage();
// }
BaseResponse<String> response = spGetHttp.postTemplateFile(list);
if (response.getCode() == 20000) {
log.error("图片列表上传成功");
// uploadFileLog = "\n模板文件列表上传成功";
} else {
log.info("模板文件上传失败,响应信息:{}", response.getMessage());
// uploadFileLog = "\n模板文件列表上传失败错误信息" + response.getMessage();
}
});
}

Loading…
Cancel
Save