From a3a8783f573674e619a59a29d3465f5a6271ebb7 Mon Sep 17 00:00:00 2001 From: mashuai Date: Mon, 2 Jun 2025 17:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/domain/lease/LeaseApplyInfo.java | 3 + .../controller/LeaseApplyInfoController.java | 15 ++++ .../lease/domain/LeaseApplyDetails.java | 5 ++ .../lease/service/ILeaseApplyInfoService.java | 7 ++ .../impl/LeaseApplyInfoServiceImpl.java | 71 ++++++++++++------- .../impl/LeaseOutDetailsServiceImpl.java | 6 +- .../lease/LeaseApplyDetailsMapper.xml | 8 ++- .../material/lease/LeaseApplyInfoMapper.xml | 2 + 8 files changed, 89 insertions(+), 28 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 522bdb85..bad59974 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -316,4 +316,7 @@ public class LeaseApplyInfo extends BaseEntity{ @ApiModelProperty(value = "计量单位") private String unitNames; + + @ApiModelProperty(value = "是否电子签名 0 是,1 否") + private Integer isElectronicSign; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index a42afde2..90963d25 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -342,6 +342,21 @@ public class LeaseApplyInfoController extends BaseController { } } + /** + * app领料出库提交 + * @param leaseApplyDetails + * @return + */ + @ApiOperation(value = "app领料出库提交") + @PostMapping("/submitLeaseOut") + public AjaxResult submitLeaseOut(@RequestBody LeaseApplyDetails leaseApplyDetails) { + try { + return leaseApplyInfoService.submitLeaseOut(leaseApplyDetails); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + /** * app领料出库退回 * @param leaseOutDetails diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java index b19ebaf4..9976f843 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java @@ -22,6 +22,11 @@ public class LeaseApplyDetails extends BaseEntity { private static final long serialVersionUID = 1L; + /** + * 是否第一次提交 0 是 + */ + private Integer isSubmit; + /** ID */ private Long id; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java index dad49af9..fc762fd8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java @@ -206,4 +206,11 @@ public interface ILeaseApplyInfoService { * @return */ List getOutNum(LeaseApplyDetails leaseApplyDetails); + + /** + * app领料出库提交 + * @param leaseApplyDetails + * @return + */ + AjaxResult submitLeaseOut(LeaseApplyDetails leaseApplyDetails); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index 4df4574f..717d7db1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -151,27 +151,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { - //leaseApplyInfo.setUserId(SecurityUtils.getUserId()); List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); - /*// 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 - if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { - if (leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4) || leaseApplyInfo.getStatusList().contains(5)) { - // 查询领用出库数据 - List leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo); - if (!CollectionUtils.isEmpty(leaseApplyOutList)) { - for (LeaseApplyInfo applyInfo : leaseApplyOutList) { - if (applyInfo.getPreCountNum().compareTo(applyInfo.getAlNum()) == 0) { - applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); - applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatusName()); - } else { - applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus()); - applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatusName()); - } - } - list.addAll(leaseApplyOutList); - } - } - }*/ // 使用 Stream API 进行降序排序 List sortedList = list.stream() .sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime).reversed()) @@ -183,9 +163,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { if (num == null) { num = BigDecimal.ZERO; } - applyInfo.setPreCountNum(applyInfo.getPreCountNum().add(num)); applyInfo.setAlNum(num); applyInfo.setWaitCountNum(applyInfo.getPreCountNum().subtract(num).compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : applyInfo.getPreCountNum().subtract(num)); + if (StringUtils.isNotBlank(applyInfo.getLeaseSignUrl())) { + applyInfo.setIsElectronicSign(0); + } else { + applyInfo.setIsElectronicSign(1); + } } String keyWord = leaseApplyInfo.getKeyWord(); // 如果关键字不为空,进行过滤 @@ -646,11 +630,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { // 处理已有数据的状态 list.forEach(applyDetails -> { if (outNumMap.containsKey(applyDetails.getTypeId())) { - applyDetails.setStatus("1"); - outNumMap.remove(applyDetails.getTypeId()); // 移除已匹配的项 + outNumMap.remove(applyDetails.getTypeId());// 移除已匹配的项 + if (applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0){ + applyDetails.setStatus("1"); + } } }); - // 添加outNumList中剩余的typeId对应数据 if (!outNumMap.isEmpty()) { list.addAll(outNumMap.values()); @@ -664,6 +649,42 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { return list; } + @Override + public AjaxResult submitLeaseOut(LeaseApplyDetails leaseApplyDetails) { + // 第一次提交,进行数据查询,给予提醒 + if (leaseApplyDetails.getIsSubmit() != null && leaseApplyDetails.getIsSubmit() == 0) { + List list = leaseApplyDetailsMapper.getOutNum(leaseApplyDetails); + // 根据id去出库表查询数据,进行数据拼接 + List outNumList = leaseApplyDetailsMapper.getOutNumList(leaseApplyDetails); + // 构建typeId到LeaseApplyDetails的映射,用于快速查找 + Map outNumMap = outNumList.stream() + .collect(Collectors.toMap(LeaseApplyDetails::getTypeId, details -> details, (existing, replacement) -> existing)); + if (!CollectionUtils.isEmpty(list)) { + // 处理已有数据的状态 + list.forEach(applyDetails -> { + if (outNumMap.containsKey(applyDetails.getTypeId()) && applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0) { + applyDetails.setStatus("1"); + outNumMap.remove(applyDetails.getTypeId()); + } + }); + + // 添加outNumList中剩余的typeId对应数据 + if (!outNumMap.isEmpty()) { + list.addAll(outNumMap.values()); + } + } + // 判断list中status状态是否全部为1 已完成 + if (list.size() > list.stream().filter(item -> "1".equals(item.getStatus())).count()) { + return AjaxResult.success("该领料单有未出库领料数据,请确认是否提交"); + } else { + return AjaxResult.success("该领料单无未出库领料数据,请确认是否提交"); + } + } + String taskId = leaseApplyInfoMapper.getTaskId(leaseApplyDetails.getId()); + int result = tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); + return result == 1 ? AjaxResult.success("提交成功") : AjaxResult.error("提交失败"); + } + /** * 总站点领料记录数据过滤 * @param item @@ -860,6 +881,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public int updateLeaseApplyInfoSign(LeaseApplyInfo leaseApplyInfo) { + leaseApplyInfo.setUpdateBy( SecurityUtils.getUserId().toString()); + leaseApplyInfo.setUpdateTime(DateUtils.getNowDate()); return leaseApplyInfoMapper.updateLeaseApplyInfoSign(leaseApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index f59e2b9a..0c2506fe 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -188,7 +188,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { throw new RuntimeException("出库失败,更新设备规格库存数量时出错!"); } // 4、修改任务状态(tm_task) - if (record.getIsApp() != null && record.getIsApp() == 0) { + /*if (record.getIsApp() != null && record.getIsApp() == 0) { LeaseApplyDetails leaseApplyDetails = new LeaseApplyDetails(); leaseApplyDetails.setId(record.getParentId()); List list = leaseApplyDetailsMapper.getOutNum(leaseApplyDetails); @@ -200,7 +200,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { if (!CollectionUtils.isEmpty(list)) { // 处理已有数据的状态 list.forEach(applyDetails -> { - if (outNumMap.containsKey(applyDetails.getTypeId())) { + if (outNumMap.containsKey(applyDetails.getTypeId()) && applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0) { applyDetails.setStatus("1"); outNumMap.remove(applyDetails.getTypeId()); // 移除已匹配的项 } @@ -220,7 +220,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } if (res == 0) { throw new RuntimeException("出库失败,修改任务状态失败"); - } + }*/ // 5、插入结算记录 String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); record.setTaskId(taskId); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index ae519a36..58b0fe8e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -277,7 +277,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' LEFT JOIN ma_station_code ms ON mm.ma_code = ms.ma_code where - ms.ma_qrcode = #{qrCode} + ms.ma_qrcode = #{qrCode} + + and mt.type_id = #{typeId} +