feat: 设备优化

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

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

Loading…
Cancel
Save