From 609c0c3421b8b443da59eb10f0084daa88dac036 Mon Sep 17 00:00:00 2001
From: hayu <1604366271@qq.com>
Date: Tue, 21 Oct 2025 19:05:55 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/resources/mapper/material/basic/BmFileInfoMapper.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmFileInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmFileInfoMapper.xml
index 36895b09..185e8cf6 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmFileInfoMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmFileInfoMapper.xml
@@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
url,
file_type,
create_by,
- create_time,
+ create_time,
#{taskType},
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{url},
#{fileType},
#{createBy},
- #{createTime},
+ NOW(),
From 9e4dada56325fcb7c1a8fcad2aed58495c04cb09 Mon Sep 17 00:00:00 2001
From: mashuai
Date: Tue, 21 Oct 2025 19:08:04 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E5=8F=8A=E4=BF=AE?=
=?UTF-8?q?=E8=AF=95=E6=9C=AA=E5=85=A5=E5=BA=93=E5=AE=9A=E6=97=B6=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../material/task/mapper/TmTaskMapper.java | 28 +++
.../material/task/service/ITmTaskService.java | 30 +++
.../task/service/impl/TmTaskServiceImpl.java | 41 ++++
.../warning/WashHouseScheduledTasks.java | 190 ++++++++++++++++--
.../mapper/material/task/TmTaskMapper.xml | 48 +++++
5 files changed, 320 insertions(+), 17 deletions(-)
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java
index 8ad79734..cfd5d572 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java
@@ -183,4 +183,32 @@ public interface TmTaskMapper {
List selectBackApplyInfoById(BackApplyInfo backApplyInfo);
List getTaskIdByAgreementId(SltAgreementInfo info);
+
+ /**
+ * 查询新购待入库任务
+ * @param info
+ * @return
+ */
+ List selectPurchaseInfo(TmTask info);
+
+ /**
+ * 根据typeId查询审核人及部门
+ * @param list
+ * @return
+ */
+ List selectApplyInfo(@Param("list") List list);
+
+ /**
+ * 根据部门id获取部门人手机号
+ * @param userId
+ * @return
+ */
+ String selectPhone(int userId);
+
+ /**
+ * 查询修饰待入库任务
+ * @param info
+ * @return
+ */
+ List selectRepairInfo(TmTask info);
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java
index 0fbb4443..c406e4ac 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskService.java
@@ -1,6 +1,8 @@
package com.bonus.material.task.service;
import java.util.List;
+
+import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.task.domain.TmTask;
/**
@@ -58,6 +60,34 @@ public interface ITmTaskService {
*/
public int deleteTmTaskByTaskId(Long taskId);
+ /**
+ * 查询新购待入库任务
+ * @param info
+ * @return
+ */
+ List selectPurchaseInfo(TmTask info);
+
+ /**
+ * 根据typeId查询审核人及部门
+ * @param list
+ * @return
+ */
+ List selectApplyInfo(List list);
+
+ /**
+ * 根据部门id获取部门人手机号
+ * @param userId
+ * @return
+ */
+ String selectPhone(int userId);
+
+ /**
+ * 查询修饰待入库任务
+ * @param info
+ * @return
+ */
+ List selectRepairInfo(TmTask info);
+
// List getLeaseAuditList(TmTaskRequestVo tmTask);
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java
index c430234c..7614ca60 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskServiceImpl.java
@@ -3,6 +3,7 @@ package com.bonus.material.task.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
+import com.bonus.material.back.domain.BackApplyInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.task.mapper.TmTaskMapper;
@@ -96,6 +97,46 @@ public class TmTaskServiceImpl implements ITmTaskService {
return tmTaskMapper.deleteTmTaskByTaskId(taskId);
}
+ /**
+ * 查询新购待入库任务
+ * @param info
+ * @return
+ */
+ @Override
+ public List selectPurchaseInfo(TmTask info) {
+ return tmTaskMapper.selectPurchaseInfo(info);
+ }
+
+ /**
+ * 根据typeId查询审核人及部门
+ * @param list
+ * @return
+ */
+ @Override
+ public List selectApplyInfo(List list) {
+ return tmTaskMapper.selectApplyInfo(list);
+ }
+
+ /**
+ * 根据部门id获取部门人手机号
+ * @param userId
+ * @return
+ */
+ @Override
+ public String selectPhone(int userId) {
+ return tmTaskMapper.selectPhone(userId);
+ }
+
+ /**
+ * 查询修饰待入库任务
+ * @param info
+ * @return
+ */
+ @Override
+ public List selectRepairInfo(TmTask info) {
+ return tmTaskMapper.selectRepairInfo(info);
+ }
+
/**
* 获取单个申请列表
*/
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/WashHouseScheduledTasks.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/WashHouseScheduledTasks.java
index 2a39c234..40265598 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/WashHouseScheduledTasks.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/WashHouseScheduledTasks.java
@@ -4,10 +4,9 @@ import cn.hutool.json.JSONObject;
import com.ah.sbd.SmsTool;
import com.ah.sbd.utils.param.SmsParam;
import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.biz.constant.BmConfigItems;
-import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
-import com.bonus.common.biz.enums.RepairInputStatusEnum;
-import com.bonus.common.biz.enums.TmTaskTypeEnum;
+import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.service.ITmTaskService;
import lombok.extern.slf4j.Slf4j;
@@ -19,7 +18,9 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 待入库定时任务
@@ -75,27 +76,182 @@ public class WashHouseScheduledTasks {
* 未入库定时任务
*/
public void taskWithWashHouse() {
+ List mobileList = new ArrayList<>();
log.info("开始执行未入库定时推送任务");
- boolean hasNullTask = false;
TmTask info = new TmTask();
- List list = tmTaskService.selectTmTaskList(info);
- if (CollectionUtils.isNotEmpty(list)) {
- for (TmTask tmTask : list) {
- if (tmTask.getTaskType().equals(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId())) {
- if (tmTask.getTaskStatus().equals(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus())) {
- hasNullTask = true;
- break;
+ // 查询新购待入库任务
+ List purchaseList = tmTaskService.selectPurchaseInfo(info);
+ // 查询修试待入库任务
+ List repairList = tmTaskService.selectRepairInfo(info);
+ // 1. 处理【只有新购任务】的情况(purchaseList非空,repairList为空)
+ if (CollectionUtils.isNotEmpty(purchaseList) && CollectionUtils.isEmpty(repairList)) {
+ List purchaseInfoList = tmTaskService.selectApplyInfo(purchaseList);
+ if (CollectionUtils.isNotEmpty(purchaseInfoList)) {
+ // 1.1 部门107有新购任务
+ boolean purchaseHas107 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
+ if (purchaseHas107) {
+ // 李勇
+ String phone = tmTaskService.selectPhone(118);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
}
- } else if (tmTask.getTaskType().equals(TmTaskTypeEnum.TM_TASK_REPAIR_INPUT.getTaskTypeId())) {
- if (tmTask.getTaskStatus().equals(RepairInputStatusEnum.INPUT_TASK_NO_FINISHED.getStatus())) {
- hasNullTask = true;
- break;
+ }
+ // 1.2 部门336有新购任务
+ boolean purchaseHas336 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
+ if (purchaseHas336) {
+ // 王国宝
+ String phone = tmTaskService.selectPhone(455);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+ // 1.3 部门106或335有新购任务
+ boolean purchaseHas106 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
+ if (purchaseHas106) {
+ // 刘春杰
+ String phone = tmTaskService.selectPhone(1549);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+ // 1.4 部门334有新购任务
+ boolean purchaseHas334 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
+ if (purchaseHas334) {
+ // 董照霞
+ String phone = tmTaskService.selectPhone(65);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
}
}
}
}
- if (hasNullTask) {
- sendSms("15527030643", "您好!您还有待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!");
+
+ // 2. 处理【只有修试任务】的情况(purchaseList为空,repairList非空)
+ else if (CollectionUtils.isEmpty(purchaseList) && CollectionUtils.isNotEmpty(repairList)) {
+ List repairInfoList = tmTaskService.selectApplyInfo(repairList);
+ if (CollectionUtils.isNotEmpty(repairInfoList)) {
+ // 2.1 部门107有修试任务
+ boolean repairHas107 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
+ if (repairHas107) {
+ // 李勇
+ String phone = tmTaskService.selectPhone(118);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 2.2 部门336有修试任务
+ boolean repairHas336 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
+ if (repairHas336) {
+ // 王国宝
+ String phone = tmTaskService.selectPhone(455);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 2.3 部门106或335有修试任务
+ boolean repairHas106 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
+ if (repairHas106) {
+ // 刘春杰
+ String phone = tmTaskService.selectPhone(1549);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 2.4 部门334有修试任务
+ boolean repairHas334 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
+ if (repairHas334) {
+ // 董照霞
+ String phone = tmTaskService.selectPhone(65);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+ }
+ }
+
+ // 3. 处理【既有新购又有修试任务】的情况(原逻辑保留,内容微调)
+ else if (CollectionUtils.isNotEmpty(purchaseList) && CollectionUtils.isNotEmpty(repairList)) {
+ List purchaseInfoList = tmTaskService.selectApplyInfo(purchaseList);
+ List repairInfoList = tmTaskService.selectApplyInfo(repairList);
+ if (CollectionUtils.isNotEmpty(purchaseInfoList) && CollectionUtils.isNotEmpty(repairInfoList)) {
+ // 3.1 部门107既有新购又有修试任务
+ boolean purchaseHas107 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
+ boolean repairHas107 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 107);
+ if (purchaseHas107 && repairHas107) {
+ // 李勇
+ String phone = tmTaskService.selectPhone(118);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 3.2 部门336既有新购又有修试任务
+ boolean purchaseHas336 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
+ boolean repairHas336 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 336);
+ if (purchaseHas336 && repairHas336) {
+ // 王国宝
+ String phone = tmTaskService.selectPhone(455);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 3.3 部门106/335既有新购又有修试任务
+ boolean purchaseHas106 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
+ boolean repairHas106 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 106 || dto.getDeptId() == 335);
+ if (purchaseHas106 && repairHas106) {
+ // 刘春杰
+ String phone = tmTaskService.selectPhone(1549);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+
+ // 3.4 部门334既有新购又有修试任务
+ boolean purchaseHas334 = purchaseInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
+ boolean repairHas334 = repairInfoList.stream().anyMatch(dto -> dto.getDeptId() == 334);
+ if (purchaseHas334 && repairHas334) {
+ // 董照霞
+ String phone = tmTaskService.selectPhone(65);
+ if (StringUtils.isNotBlank(phone)) {
+ String content = "您好!您所属班组还有新购及修试待入库任务需要进行处理,请及时登录系统查看处理,感谢配合!";
+ mobileList.add(new SmsParam(phone, content));
+ }
+ }
+ }
+ }
+ if (CollectionUtils.isNotEmpty(mobileList)) {
+ // 根据mobileList相同手机号只发送一次短信
+ List uniqueMobileList = new ArrayList<>(mobileList.stream()
+ // 以手机号为键,SmsParam为值,自动去重(后出现的会覆盖前一个)
+ .collect(Collectors.toMap(
+ SmsParam::getMobile,
+ param -> param,
+ (existing, replacement) -> replacement
+ ))
+ .values());
+ JSONObject sendResult = SmsTool.sendSms(uniqueMobileList, BmConfigItems.ANHUI_COMPANY_SMS_KEY);
+ if (sendResult != null && !sendResult.isEmpty()) {
+ log.info("短信发送成功: {}", sendResult);
+ System.out.println("短信发送成功: " + sendResult);
+ } else {
+ log.error("短信发送失败,发送结果为空!");
+ System.out.println("短信发送失败,发送结果为空!");
+ }
} else {
log.info("没有待入库的单子");
System.out.println("没有待入库的单子");
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml
index 4c067c86..423e691d 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml
@@ -287,4 +287,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+
+
+
+
+
+
+
From a26d40d9ea8f7df0ce5e9f975a295102fd9cd233 Mon Sep 17 00:00:00 2001
From: bonus <1203338439@qq.com>
Date: Wed, 22 Oct 2025 16:32:39 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=9D=90=E6=96=99=E7=AB=99=E7=BB=93?=
=?UTF-8?q?=E7=AE=97=E6=9F=A5=E7=9C=8B=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../clz/mapper/ClzSltAgreementInfoMapper.java | 9 +
.../impl/ClzSltAgreementInfoServiceImpl.java | 207 ++++++++++--------
.../material/clz/ClzAgreementInfoMapper.xml | 124 ++++++++++-
3 files changed, 238 insertions(+), 102 deletions(-)
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java
index 328ae46d..31f746f2 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java
@@ -125,4 +125,13 @@ public interface ClzSltAgreementInfoMapper {
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
+
+
+ List getSltLeaseList(MaterialSltAgreementInfo info);
+
+ List getSltRepairList(MaterialSltAgreementInfo info);
+
+ List getSltScrapList(MaterialSltAgreementInfo info);
+
+ List getSltLoseList(MaterialSltAgreementInfo info);
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java
index 31ef2ab8..cae972d0 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java
@@ -181,30 +181,30 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
List resultVo = new ArrayList<>();
// 查询数据库
List list = clzSltAgreementInfoMapper.getSltList(bean);
- if (CollectionUtils.isNotEmpty(list)) {
- // 按照结算单号分组
- Map> sltListByCodeMap = list.stream().collect(Collectors.groupingBy(SltAgreementInfo::getSltApplyCode));
- // 遍历Map
- sltListByCodeMap.forEach((s, sltAgreementInfoList) -> {
- if (CollectionUtils.isNotEmpty(sltAgreementInfoList)) {
- // 定义初始化对象
- SltAgreementInfo obj = new SltAgreementInfo();
- BeanUtil.copyProperties(sltAgreementInfoList.get(0), obj, true);
+// if (CollectionUtils.isNotEmpty(list)) {
+// // 按照结算单号分组
+// Map> sltListByCodeMap = list.stream().collect(Collectors.groupingBy(SltAgreementInfo::getSltApplyCode));
+// // 遍历Map
+// sltListByCodeMap.forEach((s, sltAgreementInfoList) -> {
+// if (CollectionUtils.isNotEmpty(sltAgreementInfoList)) {
+// // 定义初始化对象
+// SltAgreementInfo obj = new SltAgreementInfo();
+// BeanUtil.copyProperties(sltAgreementInfoList.get(0), obj, true);
+//
+// // 合并结算单中的多个单位名称及费用
+// String unitNames = sltAgreementInfoList.stream().map(SltAgreementInfo::getUnitName).collect(Collectors.joining(","));
+// BigDecimal costsSum = sltAgreementInfoList.stream().map(SltAgreementInfo::getCosts).reduce(BigDecimal.ZERO, BigDecimal::add);
+// obj.setUnitName(unitNames);
+// obj.setCosts(costsSum);
+//
+// resultVo.add(obj);
+// }
+// });
+// } else {
+// throw new ServiceException("数据库未查询到结算信息!");
+// }
- // 合并结算单中的多个单位名称及费用
- String unitNames = sltAgreementInfoList.stream().map(SltAgreementInfo::getUnitName).collect(Collectors.joining(","));
- BigDecimal costsSum = sltAgreementInfoList.stream().map(SltAgreementInfo::getCosts).reduce(BigDecimal.ZERO, BigDecimal::add);
- obj.setUnitName(unitNames);
- obj.setCosts(costsSum);
-
- resultVo.add(obj);
- }
- });
- } else {
- throw new ServiceException("数据库未查询到结算信息!");
- }
-
- return resultVo;
+ return list;
}
/**
@@ -267,83 +267,104 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
* 获取已结算清单
*/
private List getSettledInfo(MaterialSltAgreementInfo info) {
- // 查询各项费用列表
- List sltedList = clzSltAgreementInfoMapper.getSltedList(info);
-
- if (CollectionUtils.isEmpty(sltedList)) {
- throw new ServiceException("未查询到已结算信息!");
- }
-
- // 定义遍历集合
- Map> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId));
-
// 定义返回对象
List resultVoList = new ArrayList<>();
- for (List key : materialSltInfoResultMap.values()) {
- if (CollectionUtils.isEmpty(key)) {
- throw new ServiceException("已结算信息异常,请联系管理员!");
- }
+ //租赁费用列表
+ List leaseList = clzSltAgreementInfoMapper.getSltLeaseList(info);
+ //维修费用列表
+ List repairList = clzSltAgreementInfoMapper.getSltRepairList(info);
+ //报废费用列表
+ List scrapList = clzSltAgreementInfoMapper.getSltScrapList(info);
+ //丢失费用列表
+ ListloseList =clzSltAgreementInfoMapper.getSltLoseList(info);
- key.forEach((item) -> {
- MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
- BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
- BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
- //租赁费用列表
- List leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
- //维修费用列表
- List repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
- //报废费用列表
- List scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
- //丢失费用列表
- List loseList = key.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
+ MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
- sltInfoVo.setLeaseList(leaseList);
- sltInfoVo.setRepairList(repairList);
- sltInfoVo.setScrapList(scrapList);
- sltInfoVo.setLoseList(loseList);
- sltInfoVo.setReductionList(Collections.emptyList());
- for (MaterialSltAgreementInfo lease : leaseList) {
- if (lease.getCosts() != null) {
- leaseCost = leaseCost.add(lease.getCosts());
- }
- }
- for (MaterialSltAgreementInfo lose : loseList) {
- if (lose.getCosts() != null) {
- loseCost = loseCost.add(lose.getCosts());
- }
- }
+ sltInfoVo.setLeaseList(leaseList);
+ sltInfoVo.setRepairList(repairList);
+ sltInfoVo.setScrapList(scrapList);
+ sltInfoVo.setLoseList(loseList);
+ resultVoList.add(sltInfoVo);
+ // 查询各项费用列表
+ // List sltedList = clzSltAgreementInfoMapper.getSltedList(info);
- sltInfoVo.setLeaseCost(leaseCost);
- sltInfoVo.setRepairCost(repairCost);
- sltInfoVo.setScrapCost(scrapCost);
- sltInfoVo.setLoseCost(loseCost);
- sltInfoVo.setReductionCost(reducCost);
- List relations = getRelations(leaseList, repairList, scrapList, loseList, info);
- sltInfoVo.setRelations(relations);
-
- resultVoList.add(sltInfoVo);
-
- // 给外层的单位名称/工程名称赋值
- extractInnerNameToOuter(resultVoList, sltInfoVo);
-
- });
- }
-
- // 返回之前对集合做去重处理,根据外层的单位名称去重,保留每个单位名称的第一个
- Set seen = new HashSet<>();
- List dedup = new ArrayList<>(resultVoList.size());
- for (MaterialSltInfoVo it : resultVoList) {
- if (it == null) continue;
- String key = normalize(it.getUnitName());
- if (key == null) continue;
- if (seen.add(key)) {
- dedup.add(it); // 第一次见到该单位名 -> 保留
- }
- }
-
- return dedup;
+// if (CollectionUtils.isEmpty(sltedList)) {
+// throw new ServiceException("未查询到已结算信息!");
+// }
+//
+// // 定义遍历集合
+// Map> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId));
+//
+// // 定义返回对象
+// List resultVoList = new ArrayList<>();
+//
+// for (List key : materialSltInfoResultMap.values()) {
+// if (CollectionUtils.isEmpty(key)) {
+// throw new ServiceException("已结算信息异常,请联系管理员!");
+// }
+//
+// key.forEach((item) -> {
+// MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
+// BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
+// BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
+//
+// //租赁费用列表
+// List leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
+// //维修费用列表
+// List repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
+// //报废费用列表
+// List scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
+// //丢失费用列表
+// List loseList = key.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
+//
+// sltInfoVo.setLeaseList(leaseList);
+// sltInfoVo.setRepairList(repairList);
+// sltInfoVo.setScrapList(scrapList);
+// sltInfoVo.setLoseList(loseList);
+// sltInfoVo.setReductionList(Collections.emptyList());
+// for (MaterialSltAgreementInfo lease : leaseList) {
+// if (lease.getCosts() != null) {
+// leaseCost = leaseCost.add(lease.getCosts());
+// }
+// }
+// for (MaterialSltAgreementInfo lose : loseList) {
+// if (lose.getCosts() != null) {
+// loseCost = loseCost.add(lose.getCosts());
+// }
+// }
+//
+// sltInfoVo.setLeaseCost(leaseCost);
+// sltInfoVo.setRepairCost(repairCost);
+// sltInfoVo.setScrapCost(scrapCost);
+// sltInfoVo.setLoseCost(loseCost);
+// sltInfoVo.setReductionCost(reducCost);
+// List relations = getRelations(leaseList, repairList, scrapList, loseList, info);
+// sltInfoVo.setRelations(relations);
+//
+// resultVoList.add(sltInfoVo);
+//
+// // 给外层的单位名称/工程名称赋值
+// extractInnerNameToOuter(resultVoList, sltInfoVo);
+//
+// });
+// }
+//
+// // 返回之前对集合做去重处理,根据外层的单位名称去重,保留每个单位名称的第一个
+// Set seen = new HashSet<>();
+// List dedup = new ArrayList<>(resultVoList.size());
+// for (MaterialSltInfoVo it : resultVoList) {
+// if (it == null) continue;
+// String key = normalize(it.getUnitName());
+// if (key == null) continue;
+// if (seen.add(key)) {
+// dedup.add(it); // 第一次见到该单位名 -> 保留
+// }
+// }
+//
+// return dedup;
+ return resultVoList;
}
/**
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml
index 06d7a012..cb290d21 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml
@@ -345,24 +345,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+
+
+
+
+
update clz_bm_agreement_info
set is_slt = 1, update_time = now()
From 55435560c39b028c8363ceca6e38302ddaa9c517 Mon Sep 17 00:00:00 2001
From: hayu <1604366271@qq.com>
Date: Wed, 22 Oct 2025 18:54:45 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E6=95=B0=E9=87=8F?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../material/repair/mapper/RepairMapper.java | 7 ++++
.../service/impl/RepairServiceImpl.java | 37 +++++++++++++++++++
.../mapper/material/repair/RepairMapper.xml | 8 ++++
3 files changed, 52 insertions(+)
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java
index 051718d8..dbaf7521 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java
@@ -443,4 +443,11 @@ public interface RepairMapper {
List getRepairProjectList(RepairProjectInfo bean);
List getPartUsingList(PartDetails bean);
+
+ /**
+ * 根据任务id查询待修数量
+ * @param bean
+ * @return
+ */
+ RepairDeviceVO getRepairNumByTaskId(RepairDeviceVO bean);
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
index 997aaa9b..d5100126 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java
@@ -684,6 +684,43 @@ public class RepairServiceImpl implements RepairService {
continue;
}
+ //校验本次维修数量不能大于待维修数量
+ if (bean.getTaskId() != null && bean.getTypeId() != null) {
+ // 查询该任务待维修数量
+ RepairDeviceVO repairDeviceVO = repairMapper.getRepairNumByTaskId(bean);
+ BigDecimal thisRepairNum = BigDecimal.ZERO;
+
+ // 计算本次维修数量
+ if (bean.getNumberInRepairPartList().size() > 0) {
+ if (null != bean.getNumberInRepairPartList().get(0).getRepairNum() && 0 < bean.getNumberInRepairPartList().get(0).getRepairNum().compareTo(BigDecimal.ZERO)) {
+ thisRepairNum = thisRepairNum.add(bean.getNumberInRepairPartList().get(0).getRepairNum());
+ }
+ }
+ if (bean.getNumberOutRepairPartList().size() > 0) {
+ if (null != bean.getNumberOutRepairPartList().get(0).getRepairNum() && 0 < bean.getNumberOutRepairPartList().get(0).getRepairNum().compareTo(BigDecimal.ZERO)) {
+ thisRepairNum = thisRepairNum.add(bean.getNumberOutRepairPartList().get(0).getRepairNum());
+ }
+ }
+ if (bean.getNumberScrapRepairPartList().size() > 0) {
+ if (null != bean.getNumberScrapRepairPartList().get(0).getScrapNum() && 0 < bean.getNumberScrapRepairPartList().get(0).getScrapNum().compareTo(BigDecimal.ZERO)) {
+ thisRepairNum = thisRepairNum.add(bean.getNumberScrapRepairPartList().get(0).getScrapNum());
+ }
+ }
+
+ // 比较 repairHomeInfo.getRepairNum() 和 thisRepairNum 的值
+ if (repairDeviceVO != null && repairDeviceVO.getRepairNum() != null) {
+ int comparisonResult = thisRepairNum.compareTo(repairDeviceVO.getRepairNum());
+
+ if (comparisonResult > 0) {
+ // thisRepairNum 大于 repairHomeInfo.getRepairNum()
+ return AjaxResult.success("维修已完成");
+ }
+ } else {
+ // repairHomeInfo 或 repairHomeInfo.getRepairNum() 为 null 的处理
+ throw new ServiceException("此维修记录不存在,请检查后提交");
+ }
+ }
+
// 更新维修人员信息
if (!CollectionUtils.isEmpty(bean.getRepairList())) {
RepairPartDetails repairPartDetails = bean.getRepairList().get(0);
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
index 262a9453..38d41861 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml
@@ -1591,4 +1591,12 @@
order by rpd.create_time desc
+