From 639cdc3af74810355dd853976d3a519e5894f475 Mon Sep 17 00:00:00 2001 From: mashuai Date: Thu, 15 Jan 2026 14:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/ma/controller/TypeController.java | 3 ++- .../bonus/material/ma/mapper/TypeMapper.java | 2 +- .../material/ma/service/ITypeService.java | 2 +- .../ma/service/impl/DirectRotationImpl.java | 18 ++++++++++++++++++ .../ma/service/impl/TypeServiceImpl.java | 4 ++-- .../mapper/material/ma/TypeMapper.xml | 7 +++++++ 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index a9930809..03219985 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -207,7 +207,8 @@ public class TypeController extends BaseController { @ApiOperation(value = "获取领用物资类型连动式下拉框") @GetMapping("/equipmentTypeLease") public AjaxResult equipmentTypeLease(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName) { - List listByMaType = typeService.equipmentTypeLease(typeId, typeName); + Long deptId = typeService.getUserDeptId(); + List listByMaType = typeService.equipmentTypeLease(typeId, typeName, deptId); return success(listByMaType); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java index 78648bb8..3cca8af8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java @@ -286,5 +286,5 @@ public interface TypeMapper { * @param typeName * @return */ - List equipmentTypeLease(@Param("typeId") Long typeId, @Param("typeName") String typeName); + List equipmentTypeLease(@Param("typeId") Long typeId, @Param("typeName") String typeName, @Param("companyId") Long companyId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index f5f26a8a..31fd88c9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -172,7 +172,7 @@ public interface ITypeService { * @param typeName * @return */ - List equipmentTypeLease(Long typeId, String typeName); + List equipmentTypeLease(Long typeId, String typeName, Long deptId); Long getUserDeptId(); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/DirectRotationImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/DirectRotationImpl.java index 68bdff5a..a80f2240 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/DirectRotationImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/DirectRotationImpl.java @@ -654,6 +654,10 @@ public class DirectRotationImpl implements DirectRotationService { BmAgreementInfo bmAgreementInfo = new BmAgreementInfo(); bmAgreementInfo.setUnitId(Long.valueOf(directApplyInfos.getLeaseUnitId())); bmAgreementInfo.setProjectId(Long.valueOf(directApplyInfos.getLeaseProId())); + bmAgreementInfo.setCreateTime(DateUtils.getNowDate()); + bmAgreementInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); + bmAgreementInfo.setSignTime(DateUtils.getNowDate()); + bmAgreementInfo.setAgreementCode(getAgreementCode()); // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 Long agreementId = null; BmAgreementInfo bmAgreementInfo1 = bmAgreementInfoMapper.queryByTeamIdAndProjectIdCl(bmAgreementInfo); @@ -714,6 +718,20 @@ public class DirectRotationImpl implements DirectRotationService { } } + /** + * 获取协议编号 + * + * @return + */ + private String getAgreementCode() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date nowDate = DateUtils.getNowDate(); + String format = dateFormat.format(nowDate); + String result = format.replace("-", ""); + int num = bmAgreementInfoMapper.selectNumByMonthClz(nowDate); + return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + GlobalConstants.INT_1); + } + /** * 获取材料站领料任务编号 * @param clzMonthMaxOrder diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index 5f7ef3cd..491e8bbb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -356,8 +356,8 @@ public class TypeServiceImpl implements ITypeService { * @return */ @Override - public List equipmentTypeLease(Long typeId, String typeName) { - List maTypes = typeMapper.equipmentTypeLease(typeId, typeName); + public List equipmentTypeLease(Long typeId, String typeName, Long deptId) { + List maTypes = typeMapper.equipmentTypeLease(typeId, typeName, deptId); List roots = maTypes.stream() .filter(t -> t.getParentId() == 0) .collect(Collectors.toList()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index eeefb210..4654daab 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -1524,6 +1524,13 @@ AND m.type_id = #{typeId} + + AND CASE + WHEN (#{companyId} = 102 or #{companyId} = 327) THEN mt.company_id= 101 + WHEN #{companyId} = 309 THEN (mt.company_id=#{companyId}) or (mt.company_id=101 and mt.jiju_type=1) + ELSE mt.type_id=-1 + END +