This commit is contained in:
mashuai 2025-06-09 11:25:22 +08:00
parent 1fb377de60
commit 5a89c77c8a
2 changed files with 16 additions and 4 deletions

View File

@ -127,6 +127,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
break; break;
} }
} }
} else {
details.setNum(BigDecimal.ZERO);
} }
// 为每个退料详情设置附件信息 // 为每个退料详情设置附件信息
setBmFileInfosForDetails(details, bmFileInfos); setBmFileInfosForDetails(details, bmFileInfos);
@ -350,6 +352,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
} }
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) { if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy); dto.getBackApplyInfo().setCreateBy(createBy);
} else {
createBy = dto.getBackApplyInfo().getCreateBy();
} }
//对传入的手机号进行校验 //对传入的手机号进行校验
if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) { if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) {
@ -475,7 +479,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
// 判断是否为编码设备并处理附件 // 判断是否为编码设备并处理附件
Integer isBack = dto.getBackApplyInfo().getIsBack(); Integer isBack = dto.getBackApplyInfo().getIsBack();
details.setIsFinished(isBack); details.setIsFinished(isBack);
result = saveMaCodeBmFileInfo(isBack, details, backApplyInfo.getId(), result); result = saveMaCodeBmFileInfo(createBy, isBack, details, backApplyInfo.getId(), result);
if (isBack == 1) { if (isBack == 1) {
// 更新任务表及退料申请表状态 // 更新任务表及退料申请表状态
result += updateTaskAndBackInfo(backApplyInfo); result += updateTaskAndBackInfo(backApplyInfo);
@ -541,9 +545,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
* @param result * @param result
* @return * @return
*/ */
private int saveMaCodeBmFileInfo(Integer isBack, BackApplyDetails details, Long id, int result) { private int saveMaCodeBmFileInfo(String createBy, Integer isBack, BackApplyDetails details, Long id, int result) {
// 设置公共字段 // 设置公共字段
setCommonFields(details, id); setCommonFields(details, id);
details.setCreateBy(createBy);
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) { if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
for (MaCodeDto maCodeDto : details.getMaCodeList()) { for (MaCodeDto maCodeDto : details.getMaCodeList()) {
// 设置每个 MaCodeDto 的独立属性 // 设置每个 MaCodeDto 的独立属性
@ -601,6 +606,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
String createBy = ""; String createBy = "";
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) { if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy); dto.getBackApplyInfo().setCreateBy(createBy);
} else {
createBy = dto.getBackApplyInfo().getCreateBy();
} }
//对提交的退料详情数量进行校验 //对提交的退料详情数量进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {

View File

@ -286,6 +286,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
String createBy = ""; String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) { if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy); leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
} else {
createBy = leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy();
} }
try { try {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId()); int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
@ -322,7 +324,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} }
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId()); TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); tmTaskAgreement.setCreateBy(createBy);
tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
leaseApplyRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId()); leaseApplyRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId());
leaseApplyRequestVo.getLeaseApplyInfo().setCode(taskCode); leaseApplyRequestVo.getLeaseApplyInfo().setCode(taskCode);
@ -337,12 +339,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo()); int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo());
if (!CollectionUtils.isEmpty(leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos())) { if (!CollectionUtils.isEmpty(leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos())) {
TmTask finalTmTask = tmTask; TmTask finalTmTask = tmTask;
String finalCreateBy = createBy;
leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos().forEach(bmFileInfo -> { leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos().forEach(bmFileInfo -> {
bmFileInfo.setTaskType(2); bmFileInfo.setTaskType(2);
bmFileInfo.setTaskId(finalTmTask.getTaskId()); bmFileInfo.setTaskId(finalTmTask.getTaskId());
bmFileInfo.setModelId(leaseApplyRequestVo.getLeaseApplyInfo().getId()); bmFileInfo.setModelId(leaseApplyRequestVo.getLeaseApplyInfo().getId());
bmFileInfo.setFileType(5L); bmFileInfo.setFileType(5L);
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); bmFileInfo.setCreateBy(finalCreateBy);
bmFileInfo.setCreateTime(DateUtils.getNowDate()); bmFileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo); bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}); });
@ -978,6 +981,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
String createBy = ""; String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) { if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy); leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
} else {
createBy = leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy();
} }
// 提取到局部变量中减少重复代码 // 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo(); LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();