Merge branch 'dev_fifo' into lh_dev_fifo

lh_dev_fifo
wangwei 4 days ago
commit dc83537a01

@ -9,5 +9,6 @@ public class FileConstant {
public static String PDF_FILE_PATH = "";
public static String COMMON_FILE_PATH = "register/image2/";
public static String DEV_COMMON_FILE_PATH = "register/device/";
}

@ -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,PurContractEntity,PurContractEntity> {
// @Override
int insert(PurContractEntity purContractEntity);
List<PurContractEntityResponse> selectPage(@Param("purContractRequest") PurContractRequest purContractRequest);

@ -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;

@ -87,6 +87,7 @@ public class IdcServiceImpl implements IdcService {
private ScheduledDao scheduledDao;
private String imagePath = FileConstant.COMMON_FILE_PATH;
private String devImagePath = FileConstant.DEV_COMMON_FILE_PATH;
/*获取拉取任务列表*/
@Override
@ -1166,8 +1167,8 @@ public class IdcServiceImpl implements IdcService {
@Override
public boolean signleDownloadFile(String syncIp, String fileName) {
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
if (!FileUtils.makeDirectory(filePath + filePathSlash + imagePath))
IDCUtils.createDirectory(filePath + filePathSlash + imagePath);
if (!FileUtils.makeDirectory(filePath + filePathSlash + devImagePath))
IDCUtils.createDirectory(filePath + filePathSlash + devImagePath);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
;
@ -1189,7 +1190,7 @@ public class IdcServiceImpl implements IdcService {
try (InputStream inputStream = result.body().byteStream()) {
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath + fileName);
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + devImagePath + fileName);
byte b[] = new byte[1024];
@ -1203,7 +1204,7 @@ public class IdcServiceImpl implements IdcService {
outputStream.flush();
outputStream.close();
if (!(total > 0)) {
new File(filePath + filePathSlash + imagePath + fileName).delete();
new File(filePath + filePathSlash + devImagePath + fileName).delete();
executeSql("delete from idc_file where filePath='" + fileName + "'");
}

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

@ -107,6 +107,7 @@ public class DeviceRepairApplyDetailServiceImpl extends ServiceImpl<DeviceRepair
.setCreateDeptCode(user.getLocDeptCode()).setCreateDeptName(user.getDeptName())
.setCreateTime(now).setDiagnosisInfo(param.getDiagnosisInfo()).setInnerFlag(param.getInnerFlag())
.setRepairUserName(param.getRepairUserName())
.setUpdateTime(LocalDateTime.now())
.setRepairUserId(param.getRepairUserId())
.setRepairUserPhone(param.getRepairUserPhone())
.setRepairDeptCode(param.getRepairDeptCode())
@ -125,6 +126,7 @@ public class DeviceRepairApplyDetailServiceImpl extends ServiceImpl<DeviceRepair
.set(DeviceRepairApplyDetailEntity::getConfirmDeptCode, user.getLocDeptCode())
.set(DeviceRepairApplyDetailEntity::getConfirmDeptName, user.getDeptName())
.set(DeviceRepairApplyDetailEntity::getDiagnosisLivePath, param.getDiagnosisLivePath())
.set(DeviceRepairApplyDetailEntity::getUpdateTime,LocalDateTime.now())
.set(DeviceRepairApplyDetailEntity::getConfirmTime, now)
.set(!param.getRepairFlag(), DeviceRepairApplyDetailEntity::getFinishTime, now)
.eq(DeviceRepairApplyDetailEntity::getApplyId, param.getApplyId())
@ -138,6 +140,7 @@ public class DeviceRepairApplyDetailServiceImpl extends ServiceImpl<DeviceRepair
//根据设备号和报修单标识更新巡检任务明细
deviceCheckDetailService.update(Wrappers.lambdaUpdate(DeviceCheckDetailEntity.class)
.set(DeviceCheckDetailEntity::getRepairId, repairId)
.set(DeviceCheckDetailEntity::getUpdateTime,LocalDateTime.now())
.eq(DeviceCheckDetailEntity::getApplyId, param.getApplyId())
.eq(DeviceCheckDetailEntity::getDeviceCode, param.getDeviceCode())
);
@ -158,10 +161,12 @@ public class DeviceRepairApplyDetailServiceImpl extends ServiceImpl<DeviceRepair
if (CollectionUtil.isNotEmpty(list)){
deviceRepairApplyService.update(Wrappers.lambdaUpdate(DeviceRepairApplyEntity.class)
.set(DeviceRepairApplyEntity::getStatus, DeviceRepairApplyStatusEnum.PROCESSING)
.set(DeviceRepairApplyEntity::getUpdateTime,LocalDateTime.now())
.eq(DeviceRepairApplyEntity::getId, applyId));
}else {
deviceRepairApplyService.update(Wrappers.lambdaUpdate(DeviceRepairApplyEntity.class)
.set(DeviceRepairApplyEntity::getStatus, DeviceRepairApplyStatusEnum.FINISH)
.set(DeviceRepairApplyEntity::getUpdateTime,LocalDateTime.now())
.eq(DeviceRepairApplyEntity::getId, applyId));
}
}

@ -161,6 +161,7 @@ public class DeviceRepairApplyServiceImpl extends ServiceImpl<DeviceRepairApplyM
super.update(Wrappers.lambdaUpdate(DeviceRepairApplyEntity.class)
.setSql("finishCount = finishCount + 1")
.eq(DeviceRepairApplyEntity::getId, applyId)
.set(DeviceRepairApplyEntity::getUpdateTime,LocalDateTime.now())
.eq(DeviceRepairApplyEntity::getStatus, DeviceRepairApplyStatusEnum.PROCESSING)
.last("and finishCount + 1 <= deviceCount")
);

@ -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,16 @@ public class HeartService {
@Resource
IoOrderInvoiceMapper ioOrderInvoiceMapper;
private final ApplicationContext applicationContext;
@Autowired
private PurContractService purContractService;
@Autowired
private PurContractDetailService purContractDetailService;
@Autowired
private PurApplyDao purApplyDao;
@Autowired
private PurContractDetailMapper purContractDetailMapper;
@Autowired
private PurContractMapper purContractMapper;
//上传最近更新扫码单据
public BaseResponse uploadAllOrder(String syncTime) {
@ -1077,6 +1093,7 @@ public class HeartService {
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.SYS_SET_DATA.getRemark());
@ -1114,6 +1131,11 @@ public class HeartService {
@Resource
FileService fileService;
@Resource
PurApplyService purApplyService;
@Resource
PurApplyDetailService purApplyDetailService;
/**
* @param info
* @param taskId
@ -1156,7 +1178,80 @@ 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<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");
}
}
//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<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");
}
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.THIRD_DATA.getRemark());
@ -1917,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);
@ -1927,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);
@ -2721,14 +2827,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