From f2408b6f6e2fc77d52ee2007290c67742428ded1 Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Wed, 24 Sep 2025 19:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/basic/domain/BmProject.java | 5 + .../impl/LeaseApplyInfoServiceImpl.java | 6 +- .../service/impl/RepairServiceImpl.java | 10 +- .../SltAgreementInfoController.java | 3 - .../mapper/SltAgreementInfoMapper.java | 10 ++ .../service/ISltAgreementInfoService.java | 31 +++--- .../impl/SltAgreementInfoServiceImpl.java | 95 +++++++------------ .../settlement/SltAgreementInfoMapper.xml | 49 +++++++--- 8 files changed, 101 insertions(+), 108 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java index c3f77f05..7364d18b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java @@ -159,6 +159,11 @@ public class BmProject extends BaseEntity */ private Boolean enableFilter; + /** + * 是否开启已结算过滤 + */ + private Boolean enableFilterSlt; + @ApiModelProperty(value = "班组id") private Long teamId; 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 52292d89..ad6ce239 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 @@ -1689,14 +1689,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { List userList = leaseApplyInfoMapper.getUserList(leaseApplyInfo); // 省公司短信发送 - List mobileList = new ArrayList(); - if(userList !=null && userList.size()>0){ + List mobileList = new ArrayList<>(); + if(userList !=null && !userList.isEmpty()) { for (LeaseApplyInfo item : userList){ LeaseApplyInfo item1 = leaseApplyInfoMapper.getUserPhoneById(item); mobileList.add(item1.getPhone()); } } - if (mobileList != null && mobileList.size() > 0){ + if (!mobileList.isEmpty()){ JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList, "您有一条待确认的领料信息,请尽快登录机具系统进行确认!"), BmConfigItems.ANHUI_COMPANY_SMS_KEY); if (sendResult != null) { // 短信发送成功 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 7d653b49..828fe9f1 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 @@ -812,7 +812,7 @@ public class RepairServiceImpl implements RepairService { // 计算报废金额 BigDecimal scrapCosts = Optional.ofNullable(details.getBuyPrice()).orElse(BigDecimal.ZERO).multiply(scrapNum); - + // 附件📎 if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) { for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) { fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId()) @@ -866,9 +866,8 @@ public class RepairServiceImpl implements RepairService { /** * 拆分维修单,生成任务协议表 * - * @param newTaskId - * @param agreementId - * @return + * @param newTaskId 新任务ID + * @param agreementId 协议ID */ private int insertTta(Long newTaskId, Long agreementId) { int res; @@ -881,9 +880,6 @@ public class RepairServiceImpl implements RepairService { /** * 生成任务表 - * - * @param createBy - * @return */ private Long insertTt(String createBy) { Long newTask = null; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index 33bf5deb..5313a8cd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -108,7 +108,6 @@ public class SltAgreementInfoController extends BaseController { for (Object row : paginated.getRows()) { if (row instanceof SltAgreementInfo) { ((SltAgreementInfo) row).setSettlementType(loginUserHasSettlementPermission); - } SltInfoVo sltInfoVo = null; if (row instanceof SltAgreementInfo) { @@ -116,10 +115,8 @@ public class SltAgreementInfoController extends BaseController { } if (sltInfoVo != null) { list.get(list.indexOf(row)).setCosts(sltAgreementInfoService.sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost())); - //((SltAgreementInfo) row).setCosts(sltAgreementInfoService.sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost())); } } - //ListPagingUtil resultPaging = ListPagingUtil.paging(pageIndex, pageSize, paginated.getRows()); ListPagingUtil resultPaging = ListPagingUtil.paging(pageIndex, pageSize, list); resultPaging.setTotal(list.size()); return AjaxResult.success(resultPaging); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index de0f6f54..68cbc4cc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -260,8 +260,18 @@ public interface SltAgreementInfoMapper { */ int updateBmAgreementReject(SltAgreementApply sltAgreementApply); + /** + * 根据单位id查询工程集合 + * @param unitId 单位ID + */ int[] getProjectListByUnitIds(int unitId); + /** + * 根据单位id查询工程集合(未结算的工程) + * @param unitId 单位ID + */ + int[] getProjectListAndSltByUnitIds(@Param("unitId") int unitId, @Param("sltType") int sltType); + List getProjectList(int projectId); List getAgreementInfoById(@Param("unitIds") List unitIds, @Param("projectId") int projectId); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java index 5a51db6c..d00384a2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java @@ -17,7 +17,6 @@ import com.bonus.material.settlement.domain.vo.PeriodCostSummaryVo; * 结算信息Service接口 * * @author xsheng - * @date 2024-10-16 */ public interface ISltAgreementInfoService { /** @@ -26,7 +25,7 @@ public interface ISltAgreementInfoService { * @param id 结算信息主键 * @return 结算信息 */ - public SltAgreementInfo selectSltAgreementInfoById(Long id); + SltAgreementInfo selectSltAgreementInfoById(Long id); /** * 查询结算信息列表 @@ -34,13 +33,13 @@ public interface ISltAgreementInfoService { * @param sltAgreementInfo 结算信息 * @return 结算信息集合 */ - public List selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo); + List selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo); - public List getSltAgreementInfo4Project(SltAgreementInfo bean); + List getSltAgreementInfo4Project(SltAgreementInfo bean); - public BigDecimal sum(BigDecimal... values); + BigDecimal sum(BigDecimal... values); - public SltInfoVo getSltInfo(SltAgreementInfo info); + SltInfoVo getSltInfo(SltAgreementInfo info); /** * 批量查询结算信息列表 -- 未结算报表专用 @@ -63,7 +62,7 @@ public interface ISltAgreementInfoService { * @param sltAgreementInfo 结算信息 * @return 结果 */ - public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo); + int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo); /** * 修改结算信息 @@ -71,7 +70,7 @@ public interface ISltAgreementInfoService { * @param sltAgreementInfo 结算信息 * @return 结果 */ - public int updateSltAgreementInfo(SltAgreementInfo sltAgreementInfo); + int updateSltAgreementInfo(SltAgreementInfo sltAgreementInfo); /** * 批量删除结算信息 @@ -79,7 +78,7 @@ public interface ISltAgreementInfoService { * @param ids 需要删除的结算信息主键集合 * @return 结果 */ - public int deleteSltAgreementInfoByIds(Long[] ids); + int deleteSltAgreementInfoByIds(Long[] ids); /** * 删除结算信息信息 @@ -87,15 +86,15 @@ public interface ISltAgreementInfoService { * @param id 结算信息主键 * @return 结果 */ - public int deleteSltAgreementInfoById(Long id); + int deleteSltAgreementInfoById(Long id); /** - * 提交结算信息 + * 提交结算 * * @param sltInfoVo 结算信息 * @return 结果 */ - public int submitCosts(SltInfoVo sltInfoVo); + int submitCosts(SltInfoVo sltInfoVo); /** * 结算审批列表 @@ -107,15 +106,11 @@ public interface ISltAgreementInfoService { /** * 查询已结算报表list - * @param bean - * @return */ List getSltReportedList(SltAgreementInfo bean); /** * 查询未结算报表list - * @param bean - * @return */ List getSltReportList(SltAgreementInfo bean); @@ -134,12 +129,8 @@ public interface ISltAgreementInfoService { */ List getScrapReportList(SltAgreementInfo bean); - /** * 进行结算审批 - * - * @param sltAgreementApply 进行结算审批 - * @return 结果 */ AjaxResult costExamine(SltAgreementApply sltAgreementApply); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index a814edc1..96c49ac4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -142,7 +142,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { @Override public List getSltAgreementInfo4Project(SltAgreementInfo bean) { - Long userId = SecurityUtils.getLoginUser().getUserid(); List list = sltAgreementInfoMapper.getSltAgreementInfo4Project(bean); // 删除 null 对象 @@ -322,34 +321,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltAgreementInfoMapper.getSltExam(bean); } - /** - * 批量分批查询工具 - * - * @param ids 待查询的id集合 - * @param batchSize 每次查询的最大数量 - * @param queryFunc 查询函数,比如 service::queryByIds - * @return 合并后的结果集合 - * @param id类型 - * @param 返回结果类型 - */ - public static List batchQuery(List ids, int batchSize, Function, List> queryFunc) { - if (ids == null || ids.isEmpty()) { - return Collections.emptyList(); - } - - List result = new ArrayList<>(); - int total = ids.size(); - for (int i = 0; i < total; i += batchSize) { - int end = Math.min(i + batchSize, total); - List subList = ids.subList(i, end); - List batchResult = queryFunc.apply(subList); - if (batchResult != null && !batchResult.isEmpty()) { - result.addAll(batchResult); - } - } - return result; - } - /** * 新增结算信息 * @@ -362,6 +333,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { try { return sltAgreementInfoMapper.insertSltAgreementInfo(sltAgreementInfo); } catch (Exception e) { + System.err.println(e.getMessage()); throw new ServiceException("错误信息描述"); } } @@ -378,6 +350,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { try { return sltAgreementInfoMapper.updateSltAgreementInfo(sltAgreementInfo); } catch (Exception e) { + System.err.println(e.getMessage()); throw new ServiceException("错误信息描述"); } } @@ -638,8 +611,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { throw new ServiceException("协议id错误"); } - - int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId); if (sltInfoVo.getAgreementIds().length <= 1) { // 如果不是批量提交,已结算的费用类型就直接提示已结算 @@ -662,7 +633,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { //获取该协议下的所有维修任务 List repairList = taskMapper.getTaskIdByAgreementId(info); - if(repairList != null && !repairList.isEmpty()){ + if(CollectionUtils.isNotEmpty(repairList)){ throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!"); } @@ -803,7 +774,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { List list = sltAgreementInfoMapper.getSltList(bean); if (CollectionUtils.isNotEmpty(list)) { for (SltAgreementInfo row : list){ - SltInfoVo sltInfoVo = null; + SltInfoVo sltInfoVo; sltInfoVo = getSltInfo(row); if (sltInfoVo != null) { row.setCosts(sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost())); @@ -824,25 +795,18 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { sltReportedList.removeIf(Objects::isNull); // 去掉没有审核的or审核不通过的 sltReportedList.removeIf(obj -> Objects.isNull(obj.getSltStatus()) || !Objects.equals("2", obj.getSltStatus())); - sltReportedList.forEach(sltAgreementInfo -> { - if (sltAgreementInfo.getCosts() == null || sltAgreementInfo.getCosts().equals(BigDecimal.ZERO)) { - sltAgreementInfo.setCosts( - sltAgreementInfo.getLeaseCost() - .add(sltAgreementInfo.getRepairCost()) - .add(sltAgreementInfo.getScrapCost()) - .add(sltAgreementInfo.getLoseCost()) - ); - } - }); + sltReportedList.forEach(sltAgreementInfo -> sltAgreementInfo.setCosts( + sltAgreementInfo.getLeaseCost() + .add(sltAgreementInfo.getRepairCost()) + .add(sltAgreementInfo.getScrapCost()) + .add(sltAgreementInfo.getLoseCost()) + )); } return sltReportedList; } /** * 查询未结算报表list - * - * @param bean - * @return */ @Override public List getSltReportList(SltAgreementInfo bean) { @@ -889,8 +853,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } } - return list != null ? list : new ArrayList<>(); - + return list != null ? list : Collections.emptyList(); } catch (Exception e) { System.err.println("查询未结算报表失败:" + e.getMessage()); throw new ServiceException("查询未结算报表失败:" + e.getMessage()); @@ -919,8 +882,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { /** * 维修报表list - * - * @param bean */ @Override public List getRepairReportList(SltAgreementInfo bean) { @@ -929,13 +890,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { /** * 报废报表list - * - * @param bean */ @Override public List getScrapReportList(SltAgreementInfo bean) { - List scrapList = sltAgreementInfoMapper.getScrapDetailsListBatch(bean); - return scrapList; + return sltAgreementInfoMapper.getScrapDetailsListBatch(bean); } /** @@ -1008,6 +966,10 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } } + /** + * 查询结算记录明细 + * @param info 结算信息 + */ @Override public SltInfoVo getSltRecordDetailsList(SltAgreementInfo info) { SltInfoVo sltInfoVo = new SltInfoVo(); @@ -1076,18 +1038,30 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { /** * 工程类型树 - * @param bmProject - * @return */ @Override public AjaxResult getProjectListByUnitIds(BmProject bmProject) { List groupList = new ArrayList<>(); List list = new ArrayList<>(); + + // 检查登录用户是否有结算权限 + int loginUserSettlementTypePermission = 0; + try { + loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission(); + } catch (Exception e) { + System.err.println("虽然当前登陆用户无结算权限,但是允许下拉框查看"); + } + try { if (bmProject.getUnitIds() != null) { Map map = new HashMap<>(); for (int i = 0; i < bmProject.getUnitIds().length; i++) { - int[] projectIds= sltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]); + int[] projectIds; + if (bmProject.getEnableFilterSlt() != null && bmProject.getEnableFilterSlt()) { + projectIds = sltAgreementInfoMapper.getProjectListAndSltByUnitIds(bmProject.getUnitIds()[i], loginUserSettlementTypePermission); + } else { + projectIds = sltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]); + } Map mapTemp = new HashMap<>(); for (int projectId : projectIds) { mapTemp.put(projectId, 1); @@ -1100,7 +1074,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } }); } - if(!map.isEmpty()){ + if (!map.isEmpty()) { List keys = new ArrayList<>(); for (Map.Entry entry : map.entrySet()) { if (entry.getValue() == bmProject.getUnitIds().length) { @@ -1130,6 +1104,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } + /** + * 根据ID查询协议信息 + */ @Override public AjaxResult getAgreementInfoById(SelectDto dto) { List vo; @@ -1539,8 +1516,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltAgreementInfoMapper.getRepairCodeList(bean); } - - /** * 按协议汇总费用数据 * diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 0c1f949f..a1c86243 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -219,7 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -1362,4 +1380,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and tt.code like concat('%', #{repairCode}, '%') +