feat: 设备优化

lh_dev_fifo^2
chenhc 1 week ago
parent 5ab099ee85
commit 35c8e04e39

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.PurContractEntity;
import com.glxp.api.req.purchase.PurContractRequest;
import com.glxp.api.res.purchase.PurContractEntityResponse;
@ -9,8 +10,8 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PurContractMapper extends BaseMapper<PurContractEntity> {
@Override
public interface PurContractMapper extends BaseMapperPlus<PurContractMapper,PurContractMapper,PurContractEntity> {
// @Override
int insert(PurContractEntity purContractEntity);
List<PurContractEntityResponse> selectPage(@Param("purContractRequest") PurContractRequest purContractRequest);

@ -120,6 +120,12 @@ public class HeartService {
private PurContractService purContractService;
@Autowired
private PurContractDetailService purContractDetailService;
@Autowired
private PurApplyDao purApplyDao;
@Autowired
private PurContractDetailMapper purContractDetailMapper;
@Autowired
private PurContractMapper purContractMapper;
//上传最近更新扫码单据
public BaseResponse uploadAllOrder(String syncTime) {
@ -1186,23 +1192,28 @@ public class HeartService {
}
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();
List<Long> ids = purApplyEntities.stream()
.map(PurApplyEntity::getId)
.filter(Objects::nonNull) // 过滤掉可能的null值
.distinct() // 去重
.collect(Collectors.toList());
List<PurApplyDetailEntity> purApplyDetailEntityList = purApplyDetailService.list(Wrappers.lambdaQuery(PurApplyDetailEntity.class)
.in(CollectionUtil.isNotEmpty(ids), PurApplyDetailEntity::getOrderIdFk, ids)
);
if (CollectionUtil.isNotEmpty(purApplyDetailEntityList)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurApplyDetailEntityList(purApplyDetailEntityList);
remark.append("申购单据明细:").append(purApplyDetailEntityList.size()).append("条\n");
}
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)
@ -1216,25 +1227,28 @@ public class HeartService {
}
dataResponse.setPurContractEntities(purContractEntities);
remark.append("合同单据:").append(purContractEntities.size()).append("条\n");
}
List<Long> ids = purContractEntities.stream()
.map(PurContractEntity::getId)
.filter(Objects::nonNull) // 过滤掉可能的null值
.distinct() // 去重
.collect(Collectors.toList());
List<PurContractDetailEntity> purContractDetailEntities = purContractDetailService.list(Wrappers.lambdaQuery(PurContractDetailEntity.class)
.in(CollectionUtil.isNotEmpty(ids), PurContractDetailEntity::getOrderIdFk, ids)
);
if (CollectionUtil.isNotEmpty(purContractDetailEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
List<Long> ids = purContractEntities.stream()
.map(PurContractEntity::getId)
.filter(Objects::nonNull) // 过滤掉可能的null值
.distinct() // 去重
.collect(Collectors.toList());
List<PurContractDetailEntity> purContractDetailEntities = purContractDetailService.list(Wrappers.lambdaQuery(PurContractDetailEntity.class)
.in(CollectionUtil.isNotEmpty(ids), PurContractDetailEntity::getOrderIdFk, ids)
);
if (CollectionUtil.isNotEmpty(purContractDetailEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceTaskResponse();
}
dataResponse.setPurContractDetailEntities(purContractDetailEntities);
remark.append("合同单据明细:").append(purContractDetailEntities.size()).append("条\n");
}
dataResponse.setPurContractDetailEntities(purContractDetailEntities);
remark.append("合同单据明细:").append(purContractDetailEntities.size()).append("条\n");
}
}
@ -1998,6 +2012,9 @@ public class HeartService {
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
List<DeviceInspectTaskEntity> deviceInspectTaskEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceInspectTaskEntity.class.getSimpleName()), DeviceInspectTaskEntity.class);
List<DeviceInspectTaskDetailEntity> deviceInspectTaskDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceInspectTaskDetailEntity.class.getSimpleName()), DeviceInspectTaskDetailEntity.class);
List<PurApplyEntity> purApplyEntities = JSONUtil.toList(jsonObject.getJSONArray(PurApplyEntity.class.getSimpleName()), PurApplyEntity.class);
List<PurContractEntity> purContractEntities = JSONUtil.toList(jsonObject.getJSONArray(PurContractEntity.class.getSimpleName()), PurContractEntity.class);
if (CollectionUtil.isNotEmpty(deviceInspectTaskEntities)) {
for (DeviceInspectTaskEntity deviceInspectTaskEntity : deviceInspectTaskEntities) {
deviceInspectTaskEntity.setUpdateTime(null);
@ -2008,6 +2025,14 @@ public class HeartService {
deviceInspectTaskDetailMapper.replaceBatchs(deviceInspectTaskDetailEntities);
}
if (CollectionUtil.isNotEmpty(purApplyEntities)) {
purApplyDao.replaceBatchs(purApplyEntities);
}
if (CollectionUtil.isNotEmpty(purContractEntities)) {
purContractMapper.replaceBatchs(purContractEntities);
}
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
fileService.download(syncFiles);

Loading…
Cancel
Save