|
|
|
|
@ -151,6 +151,10 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
// 更新
|
|
|
|
|
MoldRepairDO updateObj = BeanUtils.toBean(updateReqVO, MoldRepairDO.class);
|
|
|
|
|
moldRepairMapper.updateById(updateObj);
|
|
|
|
|
MoldRepairDO updatedMoldRepair = moldRepairMapper.selectById(updateReqVO.getId());
|
|
|
|
|
if (updatedMoldRepair != null && MoldRecordStatusEnum.PENDING_ACCEPTANCE.getCode().equals(updatedMoldRepair.getStatus())) {
|
|
|
|
|
savePendingAcceptanceHistory(updatedMoldRepair);
|
|
|
|
|
}
|
|
|
|
|
Long moldId = updateReqVO.getMoldId() != null ? updateReqVO.getMoldId() : oldMoldRepair.getMoldId();
|
|
|
|
|
updateMoldBrandStatusByRepairResult(moldId, updateReqVO.getRepairStatus());
|
|
|
|
|
|
|
|
|
|
@ -353,7 +357,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
}
|
|
|
|
|
applyAcceptance(moldRepairDO, acceptanceReqVO);
|
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
|
createAcceptanceHistory(moldRepairDO);
|
|
|
|
|
updateAcceptanceHistory(moldRepairDO);
|
|
|
|
|
updateMoldBrandStatusByRepairResult(moldRepairDO.getMoldId(), moldRepairDO.getRepairResult());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -386,7 +390,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
moldRepairDO.setRejectBy(String.valueOf(loginUserId));
|
|
|
|
|
}
|
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
|
createAcceptanceHistory(moldRepairDO);
|
|
|
|
|
updateAcceptanceHistory(moldRepairDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void validateAcceptanceStatus(Integer status) {
|
|
|
|
|
@ -413,22 +417,69 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
moldRepairDO.setConfirmDate(LocalDateTime.now());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void savePendingAcceptanceHistory(MoldRepairDO moldRepairDO) {
|
|
|
|
|
MoldRepairAcceptanceHistoryDO historyDO = moldRepairAcceptanceHistoryMapper.selectLatestByRepairIdAndStatus(
|
|
|
|
|
moldRepairDO.getId(), MoldRecordStatusEnum.PENDING_ACCEPTANCE.getCode());
|
|
|
|
|
if (historyDO == null) {
|
|
|
|
|
historyDO = new MoldRepairAcceptanceHistoryDO();
|
|
|
|
|
historyDO.setRepairId(moldRepairDO.getId());
|
|
|
|
|
fillAcceptanceHistoryRepairSnapshot(historyDO, moldRepairDO);
|
|
|
|
|
historyDO.setStatus(MoldRecordStatusEnum.PENDING_ACCEPTANCE.getCode());
|
|
|
|
|
moldRepairAcceptanceHistoryMapper.insert(historyDO);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fillAcceptanceHistoryRepairSnapshot(historyDO, moldRepairDO);
|
|
|
|
|
historyDO.setStatus(MoldRecordStatusEnum.PENDING_ACCEPTANCE.getCode());
|
|
|
|
|
historyDO.setConfirmBy(null);
|
|
|
|
|
historyDO.setConfirmDate(null);
|
|
|
|
|
historyDO.setRejectReason(null);
|
|
|
|
|
moldRepairAcceptanceHistoryMapper.updateById(historyDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateAcceptanceHistory(MoldRepairDO moldRepairDO) {
|
|
|
|
|
MoldRepairAcceptanceHistoryDO historyDO = getLatestPendingOrLastAcceptanceHistory(moldRepairDO.getId());
|
|
|
|
|
if (historyDO == null) {
|
|
|
|
|
createAcceptanceHistory(moldRepairDO);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fillAcceptanceHistoryRepairSnapshot(historyDO, moldRepairDO);
|
|
|
|
|
historyDO.setConfirmDate(moldRepairDO.getConfirmDate());
|
|
|
|
|
historyDO.setConfirmBy(moldRepairDO.getConfirmBy());
|
|
|
|
|
historyDO.setStatus(moldRepairDO.getStatus());
|
|
|
|
|
historyDO.setRejectReason(moldRepairDO.getRejectReason());
|
|
|
|
|
moldRepairAcceptanceHistoryMapper.updateById(historyDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MoldRepairAcceptanceHistoryDO getLatestPendingOrLastAcceptanceHistory(Long repairId) {
|
|
|
|
|
MoldRepairAcceptanceHistoryDO historyDO = moldRepairAcceptanceHistoryMapper.selectLatestByRepairIdAndStatus(
|
|
|
|
|
repairId, MoldRecordStatusEnum.PENDING_ACCEPTANCE.getCode());
|
|
|
|
|
if (historyDO != null) {
|
|
|
|
|
return historyDO;
|
|
|
|
|
}
|
|
|
|
|
List<MoldRepairAcceptanceHistoryDO> historyList = moldRepairAcceptanceHistoryMapper.selectListByRepairId(repairId);
|
|
|
|
|
return com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(historyList) ? null : historyList.get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createAcceptanceHistory(MoldRepairDO moldRepairDO) {
|
|
|
|
|
MoldRepairAcceptanceHistoryDO historyDO = new MoldRepairAcceptanceHistoryDO();
|
|
|
|
|
historyDO.setRepairId(moldRepairDO.getId());
|
|
|
|
|
historyDO.setRepairResult(moldRepairDO.getRepairStatus());
|
|
|
|
|
historyDO.setFinishDate(moldRepairDO.getFinishDate());
|
|
|
|
|
fillAcceptanceHistoryRepairSnapshot(historyDO, moldRepairDO);
|
|
|
|
|
historyDO.setConfirmDate(moldRepairDO.getConfirmDate());
|
|
|
|
|
historyDO.setConfirmBy(moldRepairDO.getConfirmBy());
|
|
|
|
|
historyDO.setStatus(moldRepairDO.getStatus());
|
|
|
|
|
historyDO.setRejectReason(moldRepairDO.getRejectReason());
|
|
|
|
|
moldRepairAcceptanceHistoryMapper.insert(historyDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fillAcceptanceHistoryRepairSnapshot(MoldRepairAcceptanceHistoryDO historyDO, MoldRepairDO moldRepairDO) {
|
|
|
|
|
historyDO.setRepairResult(moldRepairDO.getRepairStatus());
|
|
|
|
|
historyDO.setFinishDate(moldRepairDO.getFinishDate());
|
|
|
|
|
historyDO.setShutdownDuration(moldRepairDO.getShutdownDuration());
|
|
|
|
|
historyDO.setFaultReason(moldRepairDO.getFaultReason());
|
|
|
|
|
historyDO.setTreatmentMeasures(moldRepairDO.getTreatmentMeasures());
|
|
|
|
|
historyDO.setReplacementParts(moldRepairDO.getReplacementParts());
|
|
|
|
|
historyDO.setRepairSummary(moldRepairDO.getRepairSummary());
|
|
|
|
|
historyDO.setRepairedImages(moldRepairDO.getRepairedImages());
|
|
|
|
|
moldRepairAcceptanceHistoryMapper.insert(historyDO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -587,6 +638,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
updateMoldBrandStatus(moldRepairDO.getMoldId(), MoldBrandStatusEnum.STANDBY.getStatus());
|
|
|
|
|
}
|
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
|
savePendingAcceptanceHistory(moldRepairDO);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|