From 9eeb4b49402a72acfa9eb908b0e1ee9a26c4aaf6 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 10:00:55 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9D=A1=E4=BB=B6,=E5=86=97=E4=BD=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/warehouse/mapper/WhHouseInfoMapper.java | 10 +++++----- .../mapper/material/ma/SupplierInfoMapper.xml | 6 ++++-- .../mapper/material/warehouse/WhHouseInfoMapper.xml | 12 +++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java index 82976b74..3b7af9d0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warehouse/mapper/WhHouseInfoMapper.java @@ -17,7 +17,7 @@ public interface WhHouseInfoMapper * @param houseId 仓库管理主键 * @return 仓库管理 */ - public WhHouseInfo selectWhHouseInfoByHouseId(Long houseId); + WhHouseInfo selectWhHouseInfoByHouseId(Long houseId); /** * 查询仓库管理列表 @@ -33,7 +33,7 @@ public interface WhHouseInfoMapper * @param whHouseInfo 仓库管理 * @return 结果 */ - public int insertWhHouseInfo(WhHouseInfo whHouseInfo); + int insertWhHouseInfo(WhHouseInfo whHouseInfo); /** * 修改仓库管理 @@ -41,7 +41,7 @@ public interface WhHouseInfoMapper * @param whHouseInfo 仓库管理 * @return 结果 */ - public int updateWhHouseInfo(WhHouseInfo whHouseInfo); + int updateWhHouseInfo(WhHouseInfo whHouseInfo); /** * 删除仓库管理 @@ -49,7 +49,7 @@ public interface WhHouseInfoMapper * @param houseId 仓库管理主键 * @return 结果 */ - public int deleteWhHouseInfoByHouseId(Long houseId); + int deleteWhHouseInfoByHouseId(Long houseId); /** * 批量删除仓库管理 @@ -57,5 +57,5 @@ public interface WhHouseInfoMapper * @param houseIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteWhHouseInfoByHouseIds(Long[] houseIds); + int deleteWhHouseInfoByHouseIds(Long[] houseIds); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml index cc2cae3c..05e30bb2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/SupplierInfoMapper.xml @@ -23,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select supplier_id, supplier, address, legal_person, primary_contact, phone, business_scope, business_license, del_flag, create_by, create_time, update_by, update_time, remark, company_id, status from ma_supplier_info + select supplier_id, supplier, address, legal_person, primary_contact, phone, business_scope, business_license, + del_flag, create_by, create_time, update_by, update_time, remark, company_id, status + from ma_supplier_info @@ -39,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sort = #{sort} and concat = #{concat} and phone = #{phone} + and del_flag = '0' @@ -59,8 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" del_flag, create_by, create_time, - update_by, - update_time, remark, company_id, sort, @@ -77,8 +79,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{delFlag}, #{createBy}, #{createTime}, - #{updateBy}, - #{updateTime}, #{remark}, #{companyId}, #{sort}, @@ -97,8 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status = #{status}, dept_id = #{deptId}, del_flag = #{delFlag}, - create_by = #{createBy}, - create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, From 3d26950c9915a04a06c5f9742743cb254994b766 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 14:14:28 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E6=96=B0=E5=BB=BAvo=E5=8F=8A=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E4=BA=BA=E5=91=98=E6=A0=91API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 82 +++++++++++++++++++ .../ma/controller/TypeKeeperController.java | 10 +-- .../bonus/material/ma/vo/MaTypeConfigVo.java | 39 +++++++++ 3 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java new file mode 100644 index 00000000..6937394f --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -0,0 +1,82 @@ +package com.bonus.material.ma.controller; + +import com.bonus.common.biz.domain.TreeSelect; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.annotation.RequiresPermissions; +import com.bonus.material.ma.service.ITypeKeeperService; +import com.bonus.material.ma.service.ITypeRepairService; +import com.google.common.collect.ImmutableList; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.*; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.controller + * @CreateTime: 2024-10-16 10:52 + * @Description: 物资类型配置API + */ +@Api(tags = "物资类型配置API") +@RestController +@RequestMapping("/ma_type_config") +public class MaTypeConfigController extends BaseController { + + /** + * 物资类型库管员配置Service + */ + @Resource + private ITypeKeeperService typeKeeperService; + + /** + * 物资类型维修员配置Service + */ + @Resource + private ITypeRepairService typeRepairService; + + /** + * 查询物资配置左侧组织人员树-tree + */ + @ApiOperation(value = "查询物资配置左侧组织人员树") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getDeptUserTree") + public AjaxResult getDeptUserTree() { + // ---------- 模拟人员Tree数据 -------------- + + // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 + List treeSelectList1 = new ArrayList<>(); + TreeSelect treeSelect1 = new TreeSelect(1L, "机具设备分公司", 1, null); + TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); + TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); + + // 给公司级部门添加子部门 + + // 2.创建一个TreeSelect集合,用于外层放组织部门--部门级 + TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); + TreeSelect treeSelect001 = new TreeSelect(111L, "王小明", 3, 11L); + TreeSelect treeSelect002 = new TreeSelect(112L, "张小三", 3, 11L); + treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); + + TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); + treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); + + + TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); + TreeSelect treeSelect003 = new TreeSelect(113L, "李四", 3, 12L); + treeSelect03.setChildren(ImmutableList.of(treeSelect003)); + treeSelect3.setChildren(Collections.singletonList(treeSelect03)); + + // 3.把根节点添加到集合中 + treeSelectList1.add(treeSelect1); + treeSelectList1.add(treeSelect2); + treeSelectList1.add(treeSelect3); + return success(treeSelectList1); + } + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java index b328de4f..1080cdf9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java @@ -28,7 +28,7 @@ import com.bonus.common.core.web.page.TableDataInfo; * 库管员配置Controller * @author bonus */ -@Api(tags = "库管员配置接口") +@Api(tags = "库管员配置API") @RestController @RequestMapping("/ma_type_keeper") public class TypeKeeperController extends BaseController { @@ -54,7 +54,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "导出库管员配置列表") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:export") - @SysLog(title = "库管员配置", businessType = OperaType.EXPORT, module = "仓储管理->导出库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.EXPORT, module = "物资管理->导出库管员配置") @PostMapping("/export") public void export(HttpServletResponse response, TypeKeeper typeKeeper) { List list = typeKeeperService.selectTypeKeeperList(typeKeeper); @@ -78,7 +78,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "新增库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:add") - @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "仓储管理->新增库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "物资管理->新增库管员配置") @PostMapping public AjaxResult add(@RequestBody TypeKeeper typeKeeper) { return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper)); @@ -90,7 +90,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "修改库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:edit") - @SysLog(title = "库管员配置", businessType = OperaType.UPDATE, module = "仓储管理->修改库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.UPDATE, module = "物资管理->修改库管员配置") @PutMapping public AjaxResult edit(@RequestBody TypeKeeper typeKeeper) { return toAjax(typeKeeperService.updateTypeKeeper(typeKeeper)); @@ -102,7 +102,7 @@ public class TypeKeeperController extends BaseController { @ApiOperation(value = "删除库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:remove") - @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "仓储管理->删除库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "物资管理->删除库管员配置") @DeleteMapping("/{IDs}") public AjaxResult remove(@PathVariable Long[] IDs) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java new file mode 100644 index 00000000..be776d31 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java @@ -0,0 +1,39 @@ +package com.bonus.material.ma.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.vo + * @CreateTime: 2024-10-16 10:57 + * @Description: 物资类型配置vo + */ +@Data +@ToString +public class MaTypeConfigVo { + + @ApiModelProperty(value = "配置id") + private Long id; + + @ApiModelProperty(value = "物资类型id") + private Long typeId; + + @ApiModelProperty(value = "物资类型名称") + private String typeName; + + @ApiModelProperty(value = "库管员id") + private String keeperUserId; + + @ApiModelProperty(value = "库管员姓名") + private String keeperUserName; + + @ApiModelProperty(value = "维修员id") + private Long repairUserId; + + @ApiModelProperty(value = "维修员姓名") + private String repairUserName; + +} From e33c93d51e8b7de886774a58136956857386c7f8 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 15:58:45 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E5=8F=B3=E4=BE=A7=E7=89=A9=E8=B5=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/ma/MaTypeConfigDto.java | 23 ++++ .../ma/controller/MaTypeConfigController.java | 103 ++++++++++++++++-- .../ma/controller/TypeController.java | 3 +- .../bonus/material/ma/domain/TypeRepair.java | 14 ++- .../material/ma/mapper/TypeKeeperMapper.java | 5 + .../bonus/material/ma/mapper/TypeMapper.java | 15 +++ .../material/ma/mapper/TypeRepairMapper.java | 20 ++-- .../ma/service/ITypeKeeperService.java | 5 + .../ma/service/ITypeRepairService.java | 8 +- .../material/ma/service/ITypeService.java | 10 +- .../service/impl/TypeKeeperServiceImpl.java | 13 ++- .../service/impl/TypeRepairServiceImpl.java | 10 ++ .../ma/service/impl/TypeServiceImpl.java | 29 ++++- .../bonus/material/ma/vo/MaTypeConfigVo.java | 34 +++++- .../mapper/material/ma/TypeKeeperMapper.xml | 14 +++ .../mapper/material/ma/TypeMapper.xml | 47 ++++++++ .../mapper/material/ma/TypeRepairMapper.xml | 11 ++ 17 files changed, 329 insertions(+), 35 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java new file mode 100644 index 00000000..66766743 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java @@ -0,0 +1,23 @@ +package com.bonus.material.ma; + +import lombok.Data; +import lombok.ToString; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma + * @CreateTime: 2024-10-16 15:50 + * @Description: 物资类型配置请求封装DTO + */ +@Data +@ToString +public class MaTypeConfigDto implements java.io.Serializable { + + private Long id; + + private Long typeId; + + private Long userId; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 6937394f..c7a92273 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -3,9 +3,17 @@ package com.bonus.material.ma.controller; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.common.security.annotation.RequiresPermissions; +import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.domain.TypeKeeper; +import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.vo.MaTypeConfigVo; +import com.bonus.material.ma.vo.MaTypeListVo; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -15,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * @author : 阮世耀 @@ -40,6 +49,75 @@ public class MaTypeConfigController extends BaseController { @Resource private ITypeRepairService typeRepairService; + // 物资类型Service + @Resource + private ITypeService typeService; + + /** + * 查询物资类型配置右侧列表 + */ + @ApiOperation(value = "查询物资类型配置右侧列表") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getMaTypeConfigList") + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 1.把所有物资类型查出来 + List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); + // 2.把维修配置信息查出来 + List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); + // 3.把库管配置信息查出来 + List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); + + // ------------------- 开启数据处理 --------------------- + + // 4.1 先循环维修配置信息 + for (TypeRepair typeRepair : typeRepairList) { + // 4.循环维修配置信息,把维修员信息设置到物资类型配置信息中 + for (MaTypeConfigVo maTypeConfigVo1 : list) { + // 5.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(maTypeConfigVo1.getTypeId())) { + // 6.如果相等,把维修员信息设置到物资类型配置信息中 + maTypeConfigVo1.setRepairUserId(typeRepair.getUserId()); + maTypeConfigVo1.setRepairUserName(typeRepair.getUserName()); + } + } + } + + // 4.2 再循环库管配置信息 + for (TypeKeeper typeKeeper : typeKeeperList) { + // 4.2循环库管配置信息,把库管员信息设置到物资类型配置信息中 + for (MaTypeConfigVo maTypeConfigVo1 : list) { + // 5.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(maTypeConfigVo1.getTypeId())) { + // 6.如果相等,把库管员信息设置到物资类型配置信息中 + maTypeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); + maTypeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + + // ------------------- 数据过滤开始 --------------------- + if (maTypeConfigDto != null) { + // 1.根据库管员或维修员用户id过滤数据 + if (maTypeConfigDto.getUserId() != null && maTypeConfigDto.getUserId() != 0L) { + List filterCollected = list.stream(). + filter(maTypeConfigVo -> maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) + || + maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId() + )) + .collect(Collectors.toList()); + return success(filterCollected); + } + } + // ------------------- 数据过滤结束 --------------------- + + + + // -------------------- 数据处理结束 --------------------- + return success(list); + } + + + /** * 查询物资配置左侧组织人员树-tree */ @@ -47,7 +125,8 @@ public class MaTypeConfigController extends BaseController { @RequiresPermissions("ma:typeConfig:list") @GetMapping("/getDeptUserTree") public AjaxResult getDeptUserTree() { - // ---------- 模拟人员Tree数据 -------------- + + // ---------- 模拟人员Tree数据 --------------- // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 List treeSelectList1 = new ArrayList<>(); @@ -55,20 +134,19 @@ public class MaTypeConfigController extends BaseController { TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); - // 给公司级部门添加子部门 - - // 2.创建一个TreeSelect集合,用于外层放组织部门--部门级 + // 2. 给公司级部门添加子部门 ,创建TreeSelect集合,存放组织部门--部门级 TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); + TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); + TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); + + // 3. 创建部门人员 TreeSelect treeSelect001 = new TreeSelect(111L, "王小明", 3, 11L); TreeSelect treeSelect002 = new TreeSelect(112L, "张小三", 3, 11L); - treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); - - TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); - treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); - - - TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); TreeSelect treeSelect003 = new TreeSelect(113L, "李四", 3, 12L); + + // 4. 把子部门人员添加到子部门中 + treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); + treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); treeSelect03.setChildren(ImmutableList.of(treeSelect003)); treeSelect3.setChildren(Collections.singletonList(treeSelect03)); @@ -76,6 +154,9 @@ public class MaTypeConfigController extends BaseController { treeSelectList1.add(treeSelect1); treeSelectList1.add(treeSelect2); treeSelectList1.add(treeSelect3); + + // -------------- 模拟人员Tree数据结束 ------------------ + return success(treeSelectList1); } 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 0a7bc6c5..1acb1974 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 @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import javax.validation.constraints.NotNull; import com.bonus.common.log.enums.OperaType; @@ -49,7 +48,7 @@ public class TypeController extends BaseController { @GetMapping("/list") public TableDataInfo list(MaTypeListVo type) { startPage(); - List list = typeService.selectTypeListAndParent(type); + List list = typeService.selectTypeListAndParentInfo(type); return getDataTable(list); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java index ba7fe586..e1b61f4c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java @@ -3,21 +3,20 @@ package com.bonus.material.ma.domain; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 维修班机具配置对象 ma_type_repair - * - * @author xsheng - * @date 2024-09-27 + * + * @author syruan */ - +@EqualsAndHashCode(callSuper = false) @Data @ToString -public class TypeRepair extends BaseEntity -{ +public class TypeRepair extends BaseEntity { private static final long serialVersionUID = 1L; /** ID */ @@ -31,6 +30,9 @@ public class TypeRepair extends BaseEntity @ApiModelProperty(value = "用户") private Long userId; + @ApiModelProperty(value = "用户姓名") + private String userName; + /** 数据所属组织 */ @Excel(name = "数据所属组织") @ApiModelProperty(value = "数据所属组织") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java index 4dc372fd..f7501bb5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java @@ -25,6 +25,11 @@ public interface TypeKeeperMapper { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * 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 30af360e..95d81f94 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 @@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper; import java.util.List; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.apache.ibatis.annotations.Mapper; @@ -66,6 +67,20 @@ public interface TypeMapper { List selectTypeListAndParent(Type typeListVo); + /** + * 查询四级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectFourLevelTypeListAndParent(Type type); + + /** + * 查询三级物资类型列表 -- 并且查询当前节点的父级节点名称 + * @param type + * @return + */ + List selectThreeLevelTypeListAndParent(Type type); + /** * 新增物资类型 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java index e2a2fd4f..6e2de569 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java @@ -9,15 +9,14 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface TypeRepairMapper -{ +public interface TypeRepairMapper { /** * 查询维修班机具配置 * * @param ID 维修班机具配置主键 * @return 维修班机具配置 */ - public TypeRepair selectTypeRepairByID(Long ID); + TypeRepair selectTypeRepairByID(Long ID); /** * 查询维修班机具配置列表 @@ -25,7 +24,12 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 维修班机具配置集合 */ - public List selectTypeRepairList(TypeRepair typeRepair); + List selectTypeRepairList(TypeRepair typeRepair); + + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); /** * 新增维修班机具配置 @@ -33,7 +37,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int insertTypeRepair(TypeRepair typeRepair); + int insertTypeRepair(TypeRepair typeRepair); /** * 修改维修班机具配置 @@ -41,7 +45,7 @@ public interface TypeRepairMapper * @param typeRepair 维修班机具配置 * @return 结果 */ - public int updateTypeRepair(TypeRepair typeRepair); + int updateTypeRepair(TypeRepair typeRepair); /** * 删除维修班机具配置 @@ -49,7 +53,7 @@ public interface TypeRepairMapper * @param ID 维修班机具配置主键 * @return 结果 */ - public int deleteTypeRepairByID(Long ID); + int deleteTypeRepairByID(Long ID); /** * 批量删除维修班机具配置 @@ -57,5 +61,5 @@ public interface TypeRepairMapper * @param IDs 需要删除的数据主键集合 * @return 结果 */ - public int deleteTypeRepairByIDs(Long[] IDs); + int deleteTypeRepairByIDs(Long[] IDs); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java index 701e600f..000627e7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java @@ -23,6 +23,11 @@ public interface ITypeKeeperService { */ List selectTypeKeeperList(TypeKeeper typeKeeper); + /** + * 查询库管员配置列表-并关联查询用户名称 + */ + List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper); + /** * 新增库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java index 53bd6412..ffb23427 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java @@ -9,8 +9,7 @@ import com.bonus.material.ma.domain.TypeRepair; * @author xsheng * @date 2024-09-27 */ -public interface ITypeRepairService -{ +public interface ITypeRepairService { /** * 查询维修班机具配置 * @@ -27,6 +26,11 @@ public interface ITypeRepairService */ public List selectTypeRepairList(TypeRepair typeRepair); + /** + * 查询配置列表并关联查询用户姓名 + */ + List selectTypeRepairListAndUserName(TypeRepair typeRepair); + /** * 新增维修班机具配置 * 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 6ea729cc..79548d23 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 @@ -4,6 +4,7 @@ import java.util.List; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; @@ -40,7 +41,14 @@ public interface ITypeService { */ List selectTypeList(Type type); - List selectTypeListAndParent(Type type); + List selectTypeListAndParentInfo(Type type); + + + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * @param type 参数 + */ + List selectThreeFourLevelTypeListAndParent(Type type); /** * 新增物资类型 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java index 0da9dd02..c7343f4e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java @@ -11,8 +11,7 @@ import com.bonus.material.ma.service.ITypeKeeperService; /** * 库管员配置Service业务层处理 * - * @author xsheng - * @date 2024-09-27 + * @author syruan */ @Service public class TypeKeeperServiceImpl implements ITypeKeeperService { @@ -42,6 +41,16 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { return typeKeeperMapper.selectTypeKeeperList(typeKeeper); } + /** + * 查询库管员配置列表-并关联查询用户名称 + * + * @param typeKeeper 查询条件 + */ + @Override + public List selectTypeKeeperListAndUserName(TypeKeeper typeKeeper) { + return typeKeeperMapper.selectTypeKeeperListAndUserName(typeKeeper); + } + /** * 新增库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java index 83d43a8a..f3b84b3b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java @@ -44,6 +44,16 @@ public class TypeRepairServiceImpl implements ITypeRepairService return typeRepairMapper.selectTypeRepairList(typeRepair); } + /** + * 查询配置列表并关联查询用户姓名 + * + * @param typeRepair + */ + @Override + public List selectTypeRepairListAndUserName(TypeRepair typeRepair) { + return typeRepairMapper.selectTypeRepairListAndUserName(typeRepair); + } + /** * 新增维修班机具配置 * 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 2057fa68..a4537a97 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 @@ -9,6 +9,7 @@ import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.biz.enums.DataCodeEnum; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.ma.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import org.springframework.stereotype.Service; @@ -97,7 +98,7 @@ public class TypeServiceImpl implements ITypeService { * @return 物资类型管理 */ @Override - public List selectTypeListAndParent(Type type) { + public List selectTypeListAndParentInfo(Type type) { // 如果是顶级节点,则查询所有子节点 if (type != null && type.getLevel() != null && "0".equals(type.getLevel())) { type.setLevel(null); @@ -156,6 +157,32 @@ public class TypeServiceImpl implements ITypeService { return maTypeListVos; } + /** + * 查询4级加3级的所有物资类型,携带父级信息 + * + * @param type 参数 + */ + @Override + public List selectThreeFourLevelTypeListAndParent(Type type) { + List fourLevelTypeList = typeMapper.selectFourLevelTypeListAndParent(type); + if (fourLevelTypeList != null && !fourLevelTypeList.isEmpty()) { + List threeLevelTypeList = typeMapper.selectThreeLevelTypeListAndParent(type); + if (threeLevelTypeList != null && !threeLevelTypeList.isEmpty()) { + // 循环,把三级节点放入fourLevelTypeList集合中 + for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { + // 循环,把三级节点放入fourLevelTypeList集合中 + for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { + // 如果三级节点的父级id和四级节点的id相同,则把三级节点放入四级节点的children集合中 + if (threeLevelType.getParentId().equals(fourLevelType.getTypeId())) { + fourLevelType.getChildren().add(threeLevelType); + } + } + } + } + } + return fourLevelTypeList; + } + /** * 新增物资类型管理 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java index be776d31..b50cc638 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeConfigVo.java @@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; +import java.util.ArrayList; +import java.util.List; + /** * @author : 阮世耀 * @version : 1.0 @@ -13,7 +16,7 @@ import lombok.ToString; */ @Data @ToString -public class MaTypeConfigVo { +public class MaTypeConfigVo implements java.io.Serializable { @ApiModelProperty(value = "配置id") private Long id; @@ -24,8 +27,17 @@ public class MaTypeConfigVo { @ApiModelProperty(value = "物资类型名称") private String typeName; + @ApiModelProperty(value = "父级id") + private Long parentId; + + @ApiModelProperty(value = "物资仓库id") + private Long houseId; + + @ApiModelProperty(value = "物资仓库名称") + private String houseName; + @ApiModelProperty(value = "库管员id") - private String keeperUserId; + private Long keeperUserId; @ApiModelProperty(value = "库管员姓名") private String keeperUserName; @@ -36,4 +48,22 @@ public class MaTypeConfigVo { @ApiModelProperty(value = "维修员姓名") private String repairUserName; + + private String parentOneLevelName; + + private String parentTwoLevelName; + + private String parentThreeLevelName; + + private String parentFourLevelName; + + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree用户ID") + private Long userId; + + @ApiModelProperty(value = "请求API时调用参数--左侧Tree层级") + private String level; + + @ApiModelProperty(value = "子节点") + private List children = new ArrayList<>(); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml index 6394a01b..7ae19e3c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -68,4 +69,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + \ No newline at end of file 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 be58065a..d4559f71 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 @@ -70,6 +70,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + select type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, @@ -331,4 +342,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where parent_id = #{typeId} and del_flag = 0 + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index 672ddded..de02fc41 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -69,4 +70,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{ID} + + \ No newline at end of file From d8f69259ec1bc280328be8329dc016c408b16e91 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 16:12:03 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E4=BC=98=E5=8C=96=E4=B8=89=E5=9B=9B?= =?UTF-8?q?=E7=BA=A7=E8=8A=82=E7=82=B9=E5=86=85=E5=BE=AA=E7=8E=AF=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 25 +++++++++++-------- .../ma/service/impl/TypeServiceImpl.java | 14 ++++++----- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index c7a92273..72fdd1b4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -96,24 +96,27 @@ public class MaTypeConfigController extends BaseController { } // ------------------- 数据过滤开始 --------------------- - if (maTypeConfigDto != null) { - // 1.根据库管员或维修员用户id过滤数据 - if (maTypeConfigDto.getUserId() != null && maTypeConfigDto.getUserId() != 0L) { - List filterCollected = list.stream(). - filter(maTypeConfigVo -> maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) - || - maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId() - )) - .collect(Collectors.toList()); - return success(filterCollected); + if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { + // 如果参数无效,则返回原始列表 + return success(list); + } + + List filteredList = new ArrayList<>(); + + for (MaTypeConfigVo maTypeConfigVo : list) { + if (maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || + maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) + ) { + filteredList.add(maTypeConfigVo); } } + + return success(filteredList); // ------------------- 数据过滤结束 --------------------- // -------------------- 数据处理结束 --------------------- - return success(list); } 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 a4537a97..0a6b5728 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 @@ -164,17 +164,19 @@ public class TypeServiceImpl implements ITypeService { */ @Override public List selectThreeFourLevelTypeListAndParent(Type type) { + // 查询四级节点列表 List fourLevelTypeList = typeMapper.selectFourLevelTypeListAndParent(type); if (fourLevelTypeList != null && !fourLevelTypeList.isEmpty()) { + // 查询三级节点列表 List threeLevelTypeList = typeMapper.selectThreeLevelTypeListAndParent(type); if (threeLevelTypeList != null && !threeLevelTypeList.isEmpty()) { // 循环,把三级节点放入fourLevelTypeList集合中 - for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { - // 循环,把三级节点放入fourLevelTypeList集合中 - for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { - // 如果三级节点的父级id和四级节点的id相同,则把三级节点放入四级节点的children集合中 - if (threeLevelType.getParentId().equals(fourLevelType.getTypeId())) { - fourLevelType.getChildren().add(threeLevelType); + for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { + // 内循环四级节点 + for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { + // 如果四级节点的父级id和三级节点的id相同,则把四级节点放入三级节点的children集合中 + if (fourLevelType.getParentId().equals(threeLevelType.getTypeId())) { + threeLevelType.getChildren().add(fourLevelType); } } } From 16e4db25c9051c9a8452a4812ee363268dfacd76 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 18:45:27 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E5=BA=93=E7=AE=A1=E5=91=98=E3=80=81?= =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=91=98=E7=9A=84=E7=BB=91=E5=AE=9A=E5=8F=8A?= =?UTF-8?q?=E8=A7=A3=E7=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/ma/MaTypeConfigDto.java | 28 +++++++ .../ma/controller/MaTypeConfigController.java | 84 +++++++++++++++++-- .../bonus/material/ma/domain/TypeKeeper.java | 5 ++ .../bonus/material/ma/domain/TypeRepair.java | 6 ++ .../material/ma/mapper/TypeKeeperMapper.java | 10 +++ .../material/ma/mapper/TypeRepairMapper.java | 7 ++ .../ma/service/ITypeKeeperService.java | 8 ++ .../ma/service/ITypeRepairService.java | 5 ++ .../service/impl/TypeKeeperServiceImpl.java | 13 ++- .../service/impl/TypeRepairServiceImpl.java | 14 +++- .../mapper/material/ma/TypeKeeperMapper.xml | 10 +++ .../mapper/material/ma/TypeRepairMapper.xml | 4 + 12 files changed, 185 insertions(+), 9 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java index 66766743..4919a6cf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/MaTypeConfigDto.java @@ -1,8 +1,11 @@ package com.bonus.material.ma; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; +import javax.validation.constraints.NotNull; + /** * @author : 阮世耀 * @version : 1.0 @@ -14,10 +17,35 @@ import lombok.ToString; @ToString public class MaTypeConfigDto implements java.io.Serializable { + /** + * 配置id + */ private Long id; + /** + * 物资类型id + */ + @NotNull(message = "物资类型id不能为空") private Long typeId; + /** + * 左侧Tree层级用户id + */ + @NotNull(message = "用户id不能为空") private Long userId; + /** + * 绑定标识 1:绑定, 2:解绑 + */ + @ApiModelProperty(value = "绑定标识 1:绑定, 2:解绑") + @NotNull(message = "绑定标识不能为空") + private Integer bindFlag; + + /** + * 绑定角色类型: 1:库管员,2:维修员 + */ + @ApiModelProperty(value = "绑定角色类型: 1:库管员,2:维修员") + @NotNull(message = "绑定角色类型不能为空") + private Integer bindRoleType; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 72fdd1b4..c7fdfeb8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -3,7 +3,7 @@ package com.bonus.material.ma.controller; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.security.annotation.PreventRepeatSubmit; import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.ma.MaTypeConfigDto; import com.bonus.material.ma.domain.Type; @@ -13,17 +13,18 @@ import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeRepairService; import com.bonus.material.ma.service.ITypeService; import com.bonus.material.ma.vo.MaTypeConfigVo; -import com.bonus.material.ma.vo.MaTypeListVo; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; import java.util.*; -import java.util.stream.Collectors; /** * @author : 阮世耀 @@ -53,6 +54,78 @@ public class MaTypeConfigController extends BaseController { @Resource private ITypeService typeService; + + @ApiOperation(value = "配置物资类型绑定信息") + @PreventRepeatSubmit + @RequiresPermissions("ma:typeConfig:edit") + @PostMapping("/updateMaTypeBindInfo") + public AjaxResult updateMaTypeBindInfo(@Valid @NotNull MaTypeConfigDto maTypeConfigDto) { + // -------------------- 数据校验开始 --------------------- + + // 1.判断绑定标识是否为空 + if (maTypeConfigDto.getBindFlag() == null) { + return error("绑定标识不能为空"); + } + + // 2.判断绑定角色类型是否为空 + if (maTypeConfigDto.getBindRoleType() == null) { + return error("绑定角色类型不能为空"); + } + + // 3.判断用户id是否为空 + if (maTypeConfigDto.getUserId() == null) { + return error("用户id不能为空"); + } + + // ---------------- 数据校验结束 --------------------- + int result; + switch (maTypeConfigDto.getBindFlag()) { + case 1: + result = handleBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("绑定成功") : error("绑定失败"); + case 2: + result = handleUnBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("解绑成功") : error("解绑失败"); + default: + // 处理其他情况或抛出异常 + return error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); + } + } + + private int handleBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } + + private int handleUnBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } + + + /** * 查询物资类型配置右侧列表 */ @@ -111,11 +184,10 @@ public class MaTypeConfigController extends BaseController { } } - return success(filteredList); // ------------------- 数据过滤结束 --------------------- - - + // 返回前端 + return success(filteredList); // -------------------- 数据处理结束 --------------------- } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java index 660b4187..b16a3bfc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeKeeper.java @@ -41,5 +41,10 @@ public class TypeKeeper extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private String companyId; + public TypeKeeper(Long typeId, Long userId) { + this.typeId = typeId; + this.userId = userId; + } + public TypeKeeper() {} } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java index e1b61f4c..7b0b44dc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/TypeRepair.java @@ -38,5 +38,11 @@ public class TypeRepair extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; + public TypeRepair() {} + + public TypeRepair(Long typeId, Long userId) { + this.typeId = typeId; + this.userId = userId; + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java index f7501bb5..c5c195a9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeKeeperMapper.java @@ -17,6 +17,11 @@ public interface TypeKeeperMapper { */ TypeKeeper selectTypeKeeperByID(Long ID); + /** + * 根据用户ID和物资类型ID查询库管员配置 + */ + TypeKeeper selectTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); + /** * 查询库管员配置列表 * @@ -54,6 +59,11 @@ public interface TypeKeeperMapper { */ int deleteTypeKeeperByID(Long ID); + /** + * 根据用户ID和物资类型ID删除库管员配置 + */ + int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); + /** * 批量删除库管员配置 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java index 6e2de569..ff7b9088 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeRepairMapper.java @@ -62,4 +62,11 @@ public interface TypeRepairMapper { * @return 结果 */ int deleteTypeRepairByIDs(Long[] IDs); + + /** + * 根据用户id和类型id删除配置记录 + * @param typeRepair + * @return + */ + int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java index 000627e7..6a129bda 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeKeeperService.java @@ -59,4 +59,12 @@ public interface ITypeKeeperService { * @return 结果 */ int deleteTypeKeeperByID(Long ID); + + /** + * 根据用户ID和物资类型ID删除库管员配置信息 + * + * @param typeKeeper + * @return + */ + int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java index ffb23427..442c3708 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java @@ -55,6 +55,11 @@ public interface ITypeRepairService { */ public int deleteTypeRepairByIDs(Long[] IDs); + /** + * 根据用户id和类型id删除配置信息 + */ + int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); + /** * 删除维修班机具配置信息 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java index c7343f4e..dc6b184b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeKeeperServiceImpl.java @@ -87,7 +87,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { } /** - * 删除库管员配置信息 + * 根据主键id删除库管员配置信息 * * @param ID 库管员配置主键 * @return 结果 @@ -97,4 +97,15 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { { return typeKeeperMapper.deleteTypeKeeperByID(ID); } + + /** + * 根据用户ID和物资类型ID删除库管员配置信息 + * + * @param typeKeeper + * @return + */ + @Override + public int deleteTypeKeeperByUserIdAndTypeId(TypeKeeper typeKeeper) { + return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeeper); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java index f3b84b3b..4597b8da 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java @@ -15,8 +15,8 @@ import com.bonus.material.ma.service.ITypeRepairService; * @date 2024-09-27 */ @Service -public class TypeRepairServiceImpl implements ITypeRepairService -{ +public class TypeRepairServiceImpl implements ITypeRepairService { + @Autowired private TypeRepairMapper typeRepairMapper; @@ -92,6 +92,16 @@ public class TypeRepairServiceImpl implements ITypeRepairService return typeRepairMapper.deleteTypeRepairByIDs(IDs); } + /** + * 根据用户id和类型id删除配置信息 + * + * @param typeRepair + */ + @Override + public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { + return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); + } + /** * 删除维修班机具配置信息 * diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml index 7ae19e3c..7e3a918f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeKeeperMapper.xml @@ -29,6 +29,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where ID = #{ID} + + insert into ma_type_keeper @@ -82,4 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and tk.company_id = #{companyId} + + + delete from ma_type_keeper where user_id = #{userId} and type_id = #{typeId} + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index de02fc41..289aed11 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -80,4 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ma_type m ON m.type_id = mtk.type_id left join sys_user su on mtk.user_id = su.user_id + + + delete from ma_type_repair where user_id = #{userId} and type_id = #{typeId} + \ No newline at end of file From cdcba68d850b574ff87e75e1239bef28eed3b041 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 19:17:53 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E6=8A=BD=E7=A6=BB=EF=BC=8C=E9=81=8D=E5=8E=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 73 ++++++---------- .../ma/service/MaTypeConfigService.java | 18 ++++ .../service/impl/MaTypeConfigServiceImpl.java | 85 +++++++++++++++++++ 3 files changed, 131 insertions(+), 45 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index c7fdfeb8..aff20f32 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -12,6 +12,7 @@ import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeRepairService; import com.bonus.material.ma.service.ITypeService; +import com.bonus.material.ma.service.MaTypeConfigService; import com.bonus.material.ma.vo.MaTypeConfigVo; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; @@ -55,6 +56,9 @@ public class MaTypeConfigController extends BaseController { private ITypeService typeService; + @Resource + private MaTypeConfigService maTypeConfigService; + @ApiOperation(value = "配置物资类型绑定信息") @PreventRepeatSubmit @RequiresPermissions("ma:typeConfig:edit") @@ -66,62 +70,19 @@ public class MaTypeConfigController extends BaseController { if (maTypeConfigDto.getBindFlag() == null) { return error("绑定标识不能为空"); } - // 2.判断绑定角色类型是否为空 if (maTypeConfigDto.getBindRoleType() == null) { return error("绑定角色类型不能为空"); } - // 3.判断用户id是否为空 if (maTypeConfigDto.getUserId() == null) { return error("用户id不能为空"); } // ---------------- 数据校验结束 --------------------- - int result; - switch (maTypeConfigDto.getBindFlag()) { - case 1: - result = handleBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("绑定成功") : error("绑定失败"); - case 2: - result = handleUnBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("解绑成功") : error("解绑失败"); - default: - // 处理其他情况或抛出异常 - return error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); - } - } - private int handleBind(int bindRoleType, Long typeId, Long userId) { - switch (bindRoleType) { - case 1: - // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 - // TODO: 实现具体逻辑 - return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); - case 2: - // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 - // TODO: 实现具体逻辑 - return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); - default: - // 处理其他情况或抛出异常 - throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); - } - } - - private int handleUnBind(int bindRoleType, Long typeId, Long userId) { - switch (bindRoleType) { - case 1: - // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 - // TODO: 实现具体逻辑 - return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); - case 2: - // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 - // TODO: 实现具体逻辑 - return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); - default: - // 处理其他情况或抛出异常 - throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); - } + // 执行业务逻辑 + return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); } @@ -152,6 +113,17 @@ public class MaTypeConfigController extends BaseController { maTypeConfigVo1.setRepairUserId(typeRepair.getUserId()); maTypeConfigVo1.setRepairUserName(typeRepair.getUserName()); } + // 判断当前maTypeConfigVo1对象是否有子节点,如果有再继续循环 + if (maTypeConfigVo1.getChildren() != null) { + for (MaTypeConfigVo maTypeConfigVo2 : maTypeConfigVo1.getChildren()) { + // 5.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(maTypeConfigVo2.getTypeId())) { + // 6.如果相等,把维修员信息设置到物资类型配置信息中 + maTypeConfigVo2.setRepairUserId(typeRepair.getUserId()); + maTypeConfigVo2.setRepairUserName(typeRepair.getUserName()); + } + } + } } } @@ -165,6 +137,17 @@ public class MaTypeConfigController extends BaseController { maTypeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); maTypeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); } + // 判断当前maTypeConfigVo1对象是否有子节点,如果有再继续循环 + if (maTypeConfigVo1.getChildren() != null) { + for (MaTypeConfigVo maTypeConfigVo2 : maTypeConfigVo1.getChildren()) { + // 5.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(maTypeConfigVo2.getTypeId())) { + // 6.如果相等,把库管员信息设置到物资类型配置信息中 + maTypeConfigVo2.setKeeperUserId(typeKeeper.getUserId()); + maTypeConfigVo2.setKeeperUserName(typeKeeper.getUserName()); + } + } + } } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java new file mode 100644 index 00000000..c915d30f --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java @@ -0,0 +1,18 @@ +package com.bonus.material.ma.service; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.MaTypeConfigDto; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.service + * @CreateTime: 2024-10-16 18:50 + * @Description: 物资类型配置Service + */ +public interface MaTypeConfigService{ + + AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto); + + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java new file mode 100644 index 00000000..4d8e29ec --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java @@ -0,0 +1,85 @@ +package com.bonus.material.ma.service.impl; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.TypeKeeper; +import com.bonus.material.ma.domain.TypeRepair; +import com.bonus.material.ma.service.ITypeKeeperService; +import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.MaTypeConfigService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.service.impl + * @CreateTime: 2024-10-16 18:50 + * @Description: 描述 + */ +@Service +public class MaTypeConfigServiceImpl implements MaTypeConfigService { + + /** + * 物资类型库管员配置Service + */ + @Resource + private ITypeKeeperService typeKeeperService; + + /** + * 物资类型维修员配置Service + */ + @Resource + private ITypeRepairService typeRepairService; + + + @Override + public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { + int result; + switch (maTypeConfigDto.getBindFlag()) { + case 1: + result = handleBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); + case 2: + result = handleUnBind(maTypeConfigDto.getBindFlag(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); + return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); + default: + // 处理其他情况或抛出异常 + return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); + } + } + + + private int handleBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } + + private int handleUnBind(int bindRoleType, Long typeId, Long userId) { + switch (bindRoleType) { + case 1: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 + // TODO: 实现具体逻辑 + return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); + case 2: + // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 + // TODO: 实现具体逻辑 + return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); + default: + // 处理其他情况或抛出异常 + throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); + } + } +} From 0d779b47e6b4ef493b50e5ba88ea66ecd82f257b Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 19:57:57 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E4=BC=98=E5=8C=96=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 73 +++++++++++++++++-- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index aff20f32..cae6122a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -103,6 +103,66 @@ public class MaTypeConfigController extends BaseController { // ------------------- 开启数据处理 --------------------- + // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 + for (MaTypeConfigVo typeConfigVo1 : list) { + + // 1.外层 先对比维修班组 + for (TypeRepair typeRepair : typeRepairList) { + // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把维修员信息设置到物资类型配置信息中 + typeConfigVo1.setRepairUserId(typeRepair.getUserId()); + typeConfigVo1.setRepairUserName(typeRepair.getUserName()); + break; + } + } + // 1.外层 再对比库管班组 + for (TypeKeeper typeKeeper : typeKeeperList) { + // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把库管员信息设置到物资类型配置信息中 + typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); + } + } + + + // 5.判断当前物资类型配置信息是否有子节点 + if (typeConfigVo1.getChildren() != null) { + // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 + for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { + // 7.有维修配置信息,把维修员信息设置到子节点中 + for (TypeRepair typeRepair : typeRepairList) { + if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { + typeConfigVo2.setRepairUserId(typeRepair.getUserId()); + typeConfigVo2.setRepairUserName(typeRepair.getUserName()); + } + } + } + + // 8.有子节点,继续循环子节点, + for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { + // 9.判断子节点是否有库管配置信息 + for (TypeKeeper typeKeeper : typeKeeperList) { + if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { + typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + } + + + + } + + // TODO: 先暂时取消后续过滤流程 + if (true) { + return success(list); + } + + // -------------------- NEW ---------------------------- + // 4.1 先循环维修配置信息 for (TypeRepair typeRepair : typeRepairList) { // 4.循环维修配置信息,把维修员信息设置到物资类型配置信息中 @@ -151,6 +211,7 @@ public class MaTypeConfigController extends BaseController { } } + // ------------------- 数据过滤开始 --------------------- if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { // 如果参数无效,则返回原始列表 @@ -160,9 +221,11 @@ public class MaTypeConfigController extends BaseController { List filteredList = new ArrayList<>(); for (MaTypeConfigVo maTypeConfigVo : list) { - if (maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || + if ( + maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) - ) { + ) + { filteredList.add(maTypeConfigVo); } } @@ -198,9 +261,9 @@ public class MaTypeConfigController extends BaseController { TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); // 3. 创建部门人员 - TreeSelect treeSelect001 = new TreeSelect(111L, "王小明", 3, 11L); - TreeSelect treeSelect002 = new TreeSelect(112L, "张小三", 3, 11L); - TreeSelect treeSelect003 = new TreeSelect(113L, "李四", 3, 12L); + TreeSelect treeSelect001 = new TreeSelect(117L, "袁泷", 3, 11L); + TreeSelect treeSelect002 = new TreeSelect(133L, "喵喵喵", 3, 11L); + TreeSelect treeSelect003 = new TreeSelect(129L, "村上春树", 3, 12L); // 4. 把子部门人员添加到子部门中 treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); From ab23106e1a33e4f1ebb63c0a4e480b787424d9cd Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 20:04:29 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E7=BB=B4=E4=BF=AE=E5=BA=93=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2SQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/material/ma/TypeRepairMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index 289aed11..d5f05ac0 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select m.type_id, su.nick_name as user_name, m.create_time from - ma_type_keeper mtk + ma_type_repair mtk left join ma_type m ON m.type_id = mtk.type_id left join sys_user su on mtk.user_id = su.user_id From 99c76a7b7df0cda4b9876c6c57dd1539e8e77885 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 16 Oct 2024 20:06:38 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/ma/controller/MaTypeConfigController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index cae6122a..58349225 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -17,10 +17,7 @@ import com.bonus.material.ma.vo.MaTypeConfigVo; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; @@ -63,7 +60,7 @@ public class MaTypeConfigController extends BaseController { @PreventRepeatSubmit @RequiresPermissions("ma:typeConfig:edit") @PostMapping("/updateMaTypeBindInfo") - public AjaxResult updateMaTypeBindInfo(@Valid @NotNull MaTypeConfigDto maTypeConfigDto) { + public AjaxResult updateMaTypeBindInfo(@RequestBody @Valid @NotNull MaTypeConfigDto maTypeConfigDto) { // -------------------- 数据校验开始 --------------------- // 1.判断绑定标识是否为空 From 8cd0754e0cf7e4e5b48fdd0d7fcc81c98d1d95bc Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Thu, 17 Oct 2024 09:07:54 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86--=E5=A2=9E=E5=8A=A0SQL=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 54 +------------------ .../mapper/material/ma/TypeRepairMapper.xml | 2 +- 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 58349225..93bd7014 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -102,7 +102,6 @@ public class MaTypeConfigController extends BaseController { // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 for (MaTypeConfigVo typeConfigVo1 : list) { - // 1.外层 先对比维修班组 for (TypeRepair typeRepair : typeRepairList) { // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id @@ -149,65 +148,14 @@ public class MaTypeConfigController extends BaseController { } } - - } + // -------------------- NEW ---------------------------- // TODO: 先暂时取消后续过滤流程 if (true) { return success(list); } - // -------------------- NEW ---------------------------- - - // 4.1 先循环维修配置信息 - for (TypeRepair typeRepair : typeRepairList) { - // 4.循环维修配置信息,把维修员信息设置到物资类型配置信息中 - for (MaTypeConfigVo maTypeConfigVo1 : list) { - // 5.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeRepair.getTypeId().equals(maTypeConfigVo1.getTypeId())) { - // 6.如果相等,把维修员信息设置到物资类型配置信息中 - maTypeConfigVo1.setRepairUserId(typeRepair.getUserId()); - maTypeConfigVo1.setRepairUserName(typeRepair.getUserName()); - } - // 判断当前maTypeConfigVo1对象是否有子节点,如果有再继续循环 - if (maTypeConfigVo1.getChildren() != null) { - for (MaTypeConfigVo maTypeConfigVo2 : maTypeConfigVo1.getChildren()) { - // 5.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeRepair.getTypeId().equals(maTypeConfigVo2.getTypeId())) { - // 6.如果相等,把维修员信息设置到物资类型配置信息中 - maTypeConfigVo2.setRepairUserId(typeRepair.getUserId()); - maTypeConfigVo2.setRepairUserName(typeRepair.getUserName()); - } - } - } - } - } - - // 4.2 再循环库管配置信息 - for (TypeKeeper typeKeeper : typeKeeperList) { - // 4.2循环库管配置信息,把库管员信息设置到物资类型配置信息中 - for (MaTypeConfigVo maTypeConfigVo1 : list) { - // 5.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeKeeper.getTypeId().equals(maTypeConfigVo1.getTypeId())) { - // 6.如果相等,把库管员信息设置到物资类型配置信息中 - maTypeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); - maTypeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); - } - // 判断当前maTypeConfigVo1对象是否有子节点,如果有再继续循环 - if (maTypeConfigVo1.getChildren() != null) { - for (MaTypeConfigVo maTypeConfigVo2 : maTypeConfigVo1.getChildren()) { - // 5.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeKeeper.getTypeId().equals(maTypeConfigVo2.getTypeId())) { - // 6.如果相等,把库管员信息设置到物资类型配置信息中 - maTypeConfigVo2.setKeeperUserId(typeKeeper.getUserId()); - maTypeConfigVo2.setKeeperUserName(typeKeeper.getUserName()); - } - } - } - } - } - // ------------------- 数据过滤开始 --------------------- if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index d5f05ac0..926cbf2f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -73,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - type_id,type_name,parent_id,level + type_id as typeId, + type_name as typeName, + parent_id as parentId, + level from ma_type where - parent_id = #{typeId} and del_flag = 0 + parent_id = #{parentId} and del_flag = 0 - + and task_id = #{taskId} and purchase_time = #{purchaseTime} @@ -33,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" From c16a47c9572332cff5e68b520b40dabc44dc7fda Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 17 Oct 2024 15:26:31 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E7=8F=AD=E5=BA=93=E7=AE=A1=E5=91=98=E5=88=A0=E9=99=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeKeeperController.java | 19 +++++++++++++++--- .../ma/controller/TypeRepairController.java | 19 +++++++++++++++--- .../ma/service/ITypeRepairService.java | 10 +++++----- .../service/impl/TypeRepairServiceImpl.java | 20 +++++++++---------- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java index 1080cdf9..7b3b00e5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeKeeperController.java @@ -97,15 +97,28 @@ public class TypeKeeperController extends BaseController { } /** - * 删除库管员配置 + * 批量删除库管员配置 */ - @ApiOperation(value = "删除库管员配置") + @ApiOperation(value = "批量删除库管员配置") @PreventRepeatSubmit @RequiresPermissions("ma:keeper:remove") - @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "物资管理->删除库管员配置") + @SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "物资管理->批量删除库管员配置") @DeleteMapping("/{IDs}") public AjaxResult remove(@PathVariable Long[] IDs) { return toAjax(typeKeeperService.deleteTypeKeeperByIDs(IDs)); } + + /** + * 删除单个库管员配置 + */ + @ApiOperation(value = "删除单个库管员配置") + @PreventRepeatSubmit + @RequiresPermissions("ma:keeper:remove") + @SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "物资管理->删除单个库管员配置") + @DeleteMapping + public AjaxResult remove(@RequestBody TypeKeeper typeKeeper) + { + return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeeper)); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java index 024021af..fb6286d2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeRepairController.java @@ -104,15 +104,28 @@ public class TypeRepairController extends BaseController } /** - * 删除维修班机具配置 + * 批量删除维修班机具配置 */ - @ApiOperation(value = "删除维修班机具配置") + @ApiOperation(value = "批量删除维修班机具配置") @PreventRepeatSubmit @RequiresPermissions("ma:repair:remove") - @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除维修班机具配置") + @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->批量删除维修班机具配置") @DeleteMapping("/{IDs}") public AjaxResult remove(@PathVariable Long[] IDs) { return toAjax(typeRepairService.deleteTypeRepairByIDs(IDs)); } + + /** + * 删除单个维修班机具配置 + */ + @ApiOperation(value = "删除单个维修班机具配置") + @PreventRepeatSubmit + @RequiresPermissions("ma:repair:remove") + @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除单个维修班机具配置") + @DeleteMapping + public AjaxResult remove(@RequestBody TypeRepair typeRepair) + { + return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepair)); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java index 442c3708..8c7382da 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeRepairService.java @@ -55,11 +55,6 @@ public interface ITypeRepairService { */ public int deleteTypeRepairByIDs(Long[] IDs); - /** - * 根据用户id和类型id删除配置信息 - */ - int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); - /** * 删除维修班机具配置信息 * @@ -67,4 +62,9 @@ public interface ITypeRepairService { * @return 结果 */ public int deleteTypeRepairByID(Long ID); + + /** + * 根据用户id和类型id删除配置信息 + */ + int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java index 4597b8da..be717e8a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeRepairServiceImpl.java @@ -92,16 +92,6 @@ public class TypeRepairServiceImpl implements ITypeRepairService { return typeRepairMapper.deleteTypeRepairByIDs(IDs); } - /** - * 根据用户id和类型id删除配置信息 - * - * @param typeRepair - */ - @Override - public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { - return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); - } - /** * 删除维修班机具配置信息 * @@ -113,4 +103,14 @@ public class TypeRepairServiceImpl implements ITypeRepairService { { return typeRepairMapper.deleteTypeRepairByID(ID); } + + /** + * 根据用户id和类型id删除配置信息 + * + * @param typeRepair + */ + @Override + public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { + return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); + } } From bb4d2ebf80487d340a46458feb2bddc36b991ec4 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 18 Oct 2024 13:54:24 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=90=A5=E4=B8=9A=E6=89=A7=E7=85=A7=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=EF=BC=8C=E6=96=B0=E8=B4=AD=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/mapper/BmFileInfoMapper.java | 50 +++++-------- .../ma/controller/SupplierInfoController.java | 2 +- .../material/ma/domain/SupplierInfo.java | 13 +++- .../ma/service/ISupplierInfoService.java | 4 +- .../service/impl/SupplierInfoServiceImpl.java | 52 ++++++++++++- .../PurchaseCheckInfoController.java | 46 +++++++----- .../purchase/domain/PurchaseCheckDetails.java | 23 ++++-- .../purchase/domain/PurchaseCheckInfo.java | 22 ++++-- .../purchase/dto/PurchaseCheckDto.java | 35 +++++++++ .../mapper/PurchaseCheckDetailsMapper.java | 27 +++++-- .../mapper/PurchaseCheckInfoMapper.java | 23 ++++-- .../service/IPurchaseCheckInfoService.java | 7 +- .../impl/PurchaseCheckInfoServiceImpl.java | 73 +++++++++++++++++-- .../bonus/material/task/domain/TmTask.java | 22 ++++-- .../material/task/mapper/TmTaskMapper.java | 21 ++++-- .../purchase/PurchaseCheckDetailsMapper.xml | 26 +++++++ .../purchase/PurchaseCheckInfoMapper.xml | 15 +++- .../mapper/material/task/TmTaskMapper.xml | 20 ++++- 18 files changed, 373 insertions(+), 108 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java index d9ca7f77..92e79f81 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmFileInfoMapper.java @@ -4,65 +4,49 @@ import java.util.List; import com.bonus.material.basic.domain.BmFileInfo; /** - * 附件 -Mapper接口 - * + * 附件Mapper接口 * @author xsheng - * @date 2024-09-26 */ -public interface BmFileInfoMapper -{ +public interface BmFileInfoMapper { /** * 查询附件 - - * - * @param id 附件 -主键 + * + * @param id 附件主键 * @return 附件 - */ - public BmFileInfo selectBmFileInfoById(Long id); + BmFileInfo selectBmFileInfoById(Long id); /** - * 查询附件 -列表 - * + * 查询附件列表 + * * @param bmFileInfo 附件 - - * @return 附件 -集合 + * @return 附件集合 */ - public List selectBmFileInfoList(BmFileInfo bmFileInfo); + List selectBmFileInfoList(BmFileInfo bmFileInfo); /** * 新增附件 - - * + * * @param bmFileInfo 附件 - * @return 结果 */ - public int insertBmFileInfo(BmFileInfo bmFileInfo); + int insertBmFileInfo(BmFileInfo bmFileInfo); /** * 修改附件 - - * + * * @param bmFileInfo 附件 - * @return 结果 */ - public int updateBmFileInfo(BmFileInfo bmFileInfo); + int updateBmFileInfo(BmFileInfo bmFileInfo); /** * 删除附件 - - * - * @param id 附件 -主键 + * + * @param id 附件主键 * @return 结果 */ - public int deleteBmFileInfoById(Long id); + int deleteBmFileInfoById(Long id); /** * 批量删除附件 @@ -71,5 +55,5 @@ public interface BmFileInfoMapper * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deleteBmFileInfoByIds(Long[] ids); + int deleteBmFileInfoByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java index ea8163fe..b4a50319 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/SupplierInfoController.java @@ -82,7 +82,7 @@ public class SupplierInfoController extends BaseController { @SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理") @PostMapping public AjaxResult add(@RequestBody SupplierInfo supplierInfo) { - return toAjax(supplierInfoService.insertSupplierInfo(supplierInfo)); + return supplierInfoService.insertSupplierInfo(supplierInfo); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java index 71f67ca1..9252b4ce 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/SupplierInfo.java @@ -1,11 +1,15 @@ package com.bonus.material.ma.domain; import com.bonus.common.core.annotation.Excel; +import com.bonus.system.api.domain.SysFile; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; /** * 物资厂家管理对象 ma_supplier_info @@ -54,8 +58,8 @@ public class SupplierInfo extends BaseEntity { private String businessScope; /** 营业执照 */ - @Excel(name = "营业执照") - @ApiModelProperty(value = "营业执照") + @Excel(name = "营业执照URL") + @ApiModelProperty(value = "营业执照URL") private String businessLicense; /** 删除标志(0代表存在 2代表删除) */ @@ -71,5 +75,10 @@ public class SupplierInfo extends BaseEntity { @ApiModelProperty(value = "状态(0开 1关)") private Long status; + /** + * 营业执照文件列表 + */ + @ApiModelProperty(value = "营业执照文件列表") + List businessLicenseFileList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java index 3226fe8d..61b02eb3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ISupplierInfoService.java @@ -1,6 +1,8 @@ package com.bonus.material.ma.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.ma.domain.SupplierInfo; /** @@ -31,7 +33,7 @@ public interface ISupplierInfoService { * @param supplierInfo 物资厂家管理 * @return 结果 */ - int insertSupplierInfo(SupplierInfo supplierInfo); + AjaxResult insertSupplierInfo(SupplierInfo supplierInfo); /** * 修改物资厂家管理 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java index ba057dfe..535dcbb0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java @@ -1,8 +1,13 @@ package com.bonus.material.ma.service.impl; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + import com.bonus.common.core.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.basic.domain.BmFileInfo; +import com.bonus.material.basic.mapper.BmFileInfoMapper; +import com.bonus.system.api.RemoteFileService; import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.SupplierInfoMapper; import com.bonus.material.ma.domain.SupplierInfo; @@ -17,9 +22,17 @@ import javax.annotation.Resource; */ @Service public class SupplierInfoServiceImpl implements ISupplierInfoService { + public static final long MODEL_ID = 16L; + @Resource private SupplierInfoMapper supplierInfoMapper; + @Resource + private RemoteFileService remoteFileService; + + @Resource + private BmFileInfoMapper bmFileInfoMapper; + /** * 查询物资厂家管理 * @@ -49,9 +62,42 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService { * @return 结果 */ @Override - public int insertSupplierInfo(SupplierInfo supplierInfo) { + public AjaxResult insertSupplierInfo(SupplierInfo supplierInfo) { supplierInfo.setCreateTime(DateUtils.getNowDate()); - return supplierInfoMapper.insertSupplierInfo(supplierInfo); + int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo); + if (insertedSupplierInfoResult > 0) { + AtomicBoolean addFileInfoResult = new AtomicBoolean(false); + supplierInfo.getBusinessLicenseFileList().forEach(file -> { + BmFileInfo bmFileInfo = new BmFileInfo(); + if (file.getName() != null) { + bmFileInfo.setFileName(file.getName()); + } + bmFileInfo.setFileUrl(file.getUrl()); + // TODO: 此处需要修改为字典表中定义的Model模块id + bmFileInfo.setModelId(MODEL_ID); + addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0); + }); + return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条"); + } else { + return AjaxResult.error("新增任务失败,info表插入0条"); + } + + + + +// if (insertedSupplierInfoResult > 0 && ArrayUtil.isNotEmpty(supplierInfo.getFiles())) { +// AjaxResult uploadedFilesResult = remoteFileService.uploadFile(supplierInfo.getFiles()); +// if (uploadedFilesResult.isSuccess()) { +// Object uploadFilesResultData = uploadedFilesResult.get("data"); +// if (uploadFilesResultData != null) { +// if (uploadFilesResultData instanceof List) { +// +// } +// } +// } else { +// return AjaxResult.error("新增任务失败,文件上传失败:" + uploadedFilesResult.get("msg")); +// } +// } } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java index 18de5dbb..9f4195a4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java @@ -1,9 +1,14 @@ package com.bonus.material.purchase.controller; import java.util.List; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.purchase.dto.PurchaseCheckDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -35,7 +40,7 @@ import com.bonus.common.core.web.page.TableDataInfo; @RequestMapping("/purchase_check_info") public class PurchaseCheckInfoController extends BaseController { - @Autowired + @Resource private IPurchaseCheckInfoService purchaseCheckInfoService; /** @@ -50,19 +55,6 @@ public class PurchaseCheckInfoController extends BaseController { return getDataTable(list); } - /** - * 导出新购验收任务列表 - */ - @ApiOperation(value = "导出新购验收任务列表") - @PreventRepeatSubmit - @RequiresPermissions("purchase:info:export") - @SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收任务") - @PostMapping("/export") - public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) { - List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo); - ExcelUtil util = new ExcelUtil(PurchaseCheckInfo.class); - util.exportExcel(response, list, "新购验收任务数据"); - } /** * 获取新购验收任务详细信息 @@ -80,11 +72,11 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "新增新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:add") - @SysLog(title = "新购验收任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.INSERT, module = "仓储管理->新增新购验收任务") @PostMapping - public AjaxResult add(@RequestBody PurchaseCheckInfo purchaseCheckInfo) { + public AjaxResult add(@Valid @NotNull @RequestBody PurchaseCheckDto purchaseCheckDto) { try { - return toAjax(purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckInfo)); + return purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckDto); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } @@ -96,7 +88,7 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "修改新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:edit") - @SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务") @PutMapping public AjaxResult edit(@RequestBody PurchaseCheckInfo purchaseCheckInfo) { try { @@ -112,9 +104,25 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "删除新购验收任务") @PreventRepeatSubmit @RequiresPermissions("purchase:info:remove") - @SysLog(title = "新购验收任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除新购验收任务") + @SysLog(title = "新购验收任务", businessType = OperaType.DELETE, module = "仓储管理->删除新购验收任务") @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByIds(ids)); } + + + + /** + * 导出新购验收任务列表 + */ + @ApiOperation(value = "导出新购验收任务列表") + @PreventRepeatSubmit + @RequiresPermissions("purchase:info:export") + @SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, module = "仓储管理->导出新购验收任务") + @PostMapping("/export") + public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) { + List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo); + ExcelUtil util = new ExcelUtil(PurchaseCheckInfo.class); + util.exportExcel(response, list, "新购验收任务数据"); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java index 199361b4..1b2c64a4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java @@ -6,20 +6,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 新购验收任务详细对象 purchase_check_details - * * @author xsheng - * @date 2024-10-16 */ - - +@EqualsAndHashCode(callSuper = false) @Data @ToString public class PurchaseCheckDetails extends BaseEntity { + private static final long serialVersionUID = 1L; /** 主键id */ @@ -35,6 +34,12 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "规格id") private Long typeId; + @ApiModelProperty(value = "规格名称") + private String typeName; + + @ApiModelProperty(value = "物资名称--规格parent类型") + private String maTypeName; + /** 采购单价 */ @Excel(name = "采购单价") @ApiModelProperty(value = "采购单价") @@ -60,11 +65,15 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "验收结论") private String checkResult; - /** 供应商id */ - @Excel(name = "供应商id") - @ApiModelProperty(value = "供应商id") + /** 物资厂家id */ + @Excel(name = "物资厂家id") + @ApiModelProperty(value = "物资厂家id") private Long supplierId; + /** 物资厂家名称 */ + @ApiModelProperty(value = "物资厂家名称") + private String supplierName; + /** 0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过 */ @Excel(name = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过") @ApiModelProperty(value = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过,7-综合服务中心不通过") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java index ffd8a5aa..96498bb7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckInfo.java @@ -5,17 +5,15 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 新购验收任务对象 purchase_check_info - * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ - - +@EqualsAndHashCode(callSuper = false) @Data @ToString public class PurchaseCheckInfo extends BaseEntity { @@ -29,6 +27,9 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "任务ID") private Long taskId; + @ApiModelProperty(value = "任务状态") + private String taskStatus; + /** 采购日期 */ @ApiModelProperty(value = "采购日期") @JsonFormat(pattern = "yyyy-MM-dd") @@ -51,5 +52,16 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; + /** + * 采购物资 + */ + @ApiModelProperty(value = "采购物资--外层Table字段") + private String purchaseMaTypeName; + + /** + * 采购数量 + */ + @ApiModelProperty(value = "采购数量--外层Table字段") + private String purchaseMaNumber; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java new file mode 100644 index 00000000..c8c65134 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/dto/PurchaseCheckDto.java @@ -0,0 +1,35 @@ +package com.bonus.material.purchase.dto; + +import com.bonus.material.purchase.domain.PurchaseCheckDetails; +import com.bonus.material.purchase.domain.PurchaseCheckInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.purchase + * @CreateTime: 2024-10-18 09:52 + * @Description: 新购任务新增-请求参数封装DTO + */ +@Data +public class PurchaseCheckDto { + + /** + * 采购验收任务info + */ + @ApiModelProperty(value = "采购验收任务info") + @NotNull(message = "采购验收任务info对象不能为空") + private PurchaseCheckInfo purchaseCheckInfo; + + /** + * 采购验收任务详情集合 + */ + @ApiModelProperty(value = "采购验收任务详情集合") + private List purchaseCheckDetailsList; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java index 2d24d913..b19e1416 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper; import java.util.List; import com.bonus.material.purchase.domain.PurchaseCheckDetails; +import org.apache.ibatis.annotations.Param; /** * 新购验收任务详细Mapper接口 @@ -10,6 +11,16 @@ import com.bonus.material.purchase.domain.PurchaseCheckDetails; * @date 2024-10-16 */ public interface PurchaseCheckDetailsMapper { + + /** + * 根据任务id查询物资类型名称,1-验收,2-入库 + * + * @param taskId * @param type 1-验收,2-入库 + * @return String类型,多个物资类型根据逗号分割 + */ + String selectMaTypeNameByTaskId(@Param("taskId") Long taskId, @Param("type") String type); + + /** * 查询新购验收任务详细 * @@ -24,7 +35,7 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 新购验收任务详细集合 */ - public List selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails); + List selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails); /** * 新增新购验收任务详细 @@ -32,7 +43,13 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 结果 */ - public int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + + /** + * 批量新增新购验收任务详细 + * @param purchaseCheckDetailsList 新购验收任务详细集合 + */ + int insertPurchaseCheckDetailsList(List purchaseCheckDetailsList); /** * 修改新购验收任务详细 @@ -40,7 +57,7 @@ public interface PurchaseCheckDetailsMapper { * @param purchaseCheckDetails 新购验收任务详细 * @return 结果 */ - public int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); + int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails); /** * 删除新购验收任务详细 @@ -48,7 +65,7 @@ public interface PurchaseCheckDetailsMapper { * @param id 新购验收任务详细主键 * @return 结果 */ - public int deletePurchaseCheckDetailsById(Long id); + int deletePurchaseCheckDetailsById(Long id); /** * 批量删除新购验收任务详细 @@ -56,5 +73,5 @@ public interface PurchaseCheckDetailsMapper { * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deletePurchaseCheckDetailsByIds(Long[] ids); + int deletePurchaseCheckDetailsByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java index 94cfe84c..c59d67e9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckInfoMapper.java @@ -16,15 +16,24 @@ public interface PurchaseCheckInfoMapper { * @param id 新购验收任务主键 * @return 新购验收任务 */ - public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); + PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); /** - * 查询新购验收任务列表 + * 查询新购验收任务列表--单表基础查询 * * @param purchaseCheckInfo 新购验收任务 * @return 新购验收任务集合 */ - public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); + List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo); + + /** + * 查询新购验收任务列表--多表关联查询 + * + * @param purchaseCheckInfo 新购验收任务 + * @return 新购验收任务集合 + */ + List selectPurchaseCheckInfoJoinList(PurchaseCheckInfo purchaseCheckInfo); + /** * 新增新购验收任务 @@ -32,7 +41,7 @@ public interface PurchaseCheckInfoMapper { * @param purchaseCheckInfo 新购验收任务 * @return 结果 */ - public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); /** * 修改新购验收任务 @@ -40,7 +49,7 @@ public interface PurchaseCheckInfoMapper { * @param purchaseCheckInfo 新购验收任务 * @return 结果 */ - public int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); /** * 删除新购验收任务 @@ -48,7 +57,7 @@ public interface PurchaseCheckInfoMapper { * @param id 新购验收任务主键 * @return 结果 */ - public int deletePurchaseCheckInfoById(Long id); + int deletePurchaseCheckInfoById(Long id); /** * 批量删除新购验收任务 @@ -56,5 +65,5 @@ public interface PurchaseCheckInfoMapper { * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deletePurchaseCheckInfoByIds(Long[] ids); + int deletePurchaseCheckInfoByIds(Long[] ids); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java index 8d9f7d49..7b50b2fb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java @@ -1,7 +1,10 @@ package com.bonus.material.purchase.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.purchase.domain.PurchaseCheckInfo; +import com.bonus.material.purchase.dto.PurchaseCheckDto; /** * 新购验收任务Service接口 @@ -28,10 +31,10 @@ public interface IPurchaseCheckInfoService { /** * 新增新购验收任务 * - * @param purchaseCheckInfo 新购验收任务 + * @param purchaseCheckDto 新购验收任务dto * @return 结果 */ - int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo); + AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckDto); /** * 修改新购验收任务 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 15b90954..8a3e38a7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -3,6 +3,11 @@ package com.bonus.material.purchase.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.purchase.dto.PurchaseCheckDto; +import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper; +import com.bonus.material.task.domain.TmTask; +import com.bonus.material.task.mapper.TmTaskMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper; @@ -10,6 +15,7 @@ import com.bonus.material.purchase.domain.PurchaseCheckInfo; import com.bonus.material.purchase.service.IPurchaseCheckInfoService; import javax.annotation.Resource; +import javax.validation.constraints.NotNull; /** * 新购验收任务Service业务层处理 @@ -22,6 +28,12 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { @Resource private PurchaseCheckInfoMapper purchaseCheckInfoMapper; + @Resource + private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper; + + @Resource + private TmTaskMapper tmTaskMapper; + /** * 查询新购验收任务 * @@ -36,12 +48,22 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { /** * 查询新购验收任务列表 * - * @param purchaseCheckInfo 新购验收任务 + * @param purchaseCheckInfoDto 新购验收任务请求参数 * @return 新购验收任务 */ @Override - public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo) { - return purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfo); + public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfoDto) { + // 查询新购info列表 + List purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfoDto); + // 过滤info列表中空的对象 + purchaseCheckInfos.removeIf(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() == null); + + // 查询details表,获取详细的采购物资名称 + for (PurchaseCheckInfo purchaseCheckInfo : purchaseCheckInfos) { + String purchaseMaName = purchaseCheckDetailsMapper.selectMaTypeNameByTaskId(purchaseCheckInfo.getTaskId(), null); + purchaseCheckInfo.setPurchaseMaTypeName(purchaseMaName != null ? purchaseMaName : ""); + } + return purchaseCheckInfos; } /** @@ -51,12 +73,49 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { * @return 结果 */ @Override - public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo) { - purchaseCheckInfo.setCreateTime(DateUtils.getNowDate()); + public AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckInfo) { + // 赋值创建时间 + purchaseCheckInfo.getPurchaseCheckInfo().setCreateTime(DateUtils.getNowDate()); try { - return purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo); + // TODO: 任务类型、XG 待完善,先定义死,后期修改至配置中心 + + // 查询新购任务当月最大单号 + Integer thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), 16L); + // 查询出的单号值,进行必要性校正 + if (thisMonthMaxOrder == null || thisMonthMaxOrder == 0) { + thisMonthMaxOrder = 1; + } else { + thisMonthMaxOrder = thisMonthMaxOrder + 1; + } + // 生成单号 + String taskCode = "XG" + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder); + + // 先往tm_task任务表中创建任务 + TmTask tmTask = new TmTask(null, 16L, 55L, taskCode, purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1); + Long taskId = 0L; + if (tmTaskMapper.insertTmTask(tmTask) > 0) { + taskId = tmTask.getTaskId(); + } else { + return AjaxResult.error("新增任务失败_task表插入0条"); + } + + // tm_task 插入成功后,再往新购验收info表中插入数据 + purchaseCheckInfo.getPurchaseCheckInfo().setTaskId(taskId); + if (purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo.getPurchaseCheckInfo()) > 0) { + Long finalTaskId = taskId; + purchaseCheckInfo.getPurchaseCheckDetailsList().forEach( + details -> { + details.setTaskId(finalTaskId); + details.setInputStatus("0"); + }); + // 批量插入详情数据 + boolean purchaseCheckDetailsListAddResult = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckInfo.getPurchaseCheckDetailsList()) > 0; + return purchaseCheckDetailsListAddResult ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条"); + } else { + return AjaxResult.error("新增任务失败,info表插入0条"); + } } catch (Exception e) { - throw new ServiceException("错误信息描述"); + return AjaxResult.error("新增任务失败:" + e.getMessage()); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java index 4a535d8b..dc021f41 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java @@ -3,20 +3,19 @@ package com.bonus.material.task.domain; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; /** * 任务对象 tm_task - * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ - - +@EqualsAndHashCode(callSuper = true) @Data @ToString public class TmTask extends BaseEntity { + private static final long serialVersionUID = 1L; /** 任务ID */ @@ -47,5 +46,18 @@ public class TmTask extends BaseEntity { @ApiModelProperty(value = "0不启用 1启用") private String status; + @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") + private Integer monthOrder; + public TmTask(Long taskId, Long taskType, Long taskStatus, String code, Long companyId, String status, Integer monthOrder) { + this.taskId = taskId; + this.taskType = taskType; + this.taskStatus = taskStatus; + this.code = code; + this.companyId = companyId; + this.status = status; + this.monthOrder = monthOrder; + } + + public TmTask() {} } 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 a33d450e..73aa4615 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 @@ -2,6 +2,7 @@ package com.bonus.material.task.mapper; import java.util.List; import com.bonus.material.task.domain.TmTask; +import org.apache.ibatis.annotations.Param; /** * 任务Mapper接口 @@ -16,7 +17,15 @@ public interface TmTaskMapper { * @param taskId 任务主键 * @return 任务 */ - public TmTask selectTmTaskByTaskId(Long taskId); + TmTask selectTmTaskByTaskId(Long taskId); + + /** + * 查询当年当月最大任务序号,用于生成任务编号 by 分类型查询 + * @param year 年 + * @param month 月 + * @param type 任务类型(字典表中获取,例如新购是:16) + */ + Integer getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("type") Long type); /** * 查询任务列表 @@ -24,7 +33,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 任务集合 */ - public List selectTmTaskList(TmTask tmTask); + List selectTmTaskList(TmTask tmTask); /** * 新增任务 @@ -32,7 +41,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 结果 */ - public int insertTmTask(TmTask tmTask); + int insertTmTask(TmTask tmTask); /** * 修改任务 @@ -40,7 +49,7 @@ public interface TmTaskMapper { * @param tmTask 任务 * @return 结果 */ - public int updateTmTask(TmTask tmTask); + int updateTmTask(TmTask tmTask); /** * 删除任务 @@ -48,7 +57,7 @@ public interface TmTaskMapper { * @param taskId 任务主键 * @return 结果 */ - public int deleteTmTaskByTaskId(Long taskId); + int deleteTmTaskByTaskId(Long taskId); /** * 批量删除任务 @@ -56,5 +65,5 @@ public interface TmTaskMapper { * @param taskIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteTmTaskByTaskIds(Long[] taskIds); + int deleteTmTaskByTaskIds(Long[] taskIds); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index cfb3c508..ec52950b 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -157,4 +157,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + + + insert into purchase_check_details(task_id,type_id,purchase_price,purchase_num,check_num,bind_num,check_result,supplier_id,status,production_time,create_by,create_time,update_by,update_time,remark,check_url_name,check_url,input_num,input_status,input_time,file_name,file_url,company_id) + values(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId}) + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml index fbcb6d09..03042160 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -28,9 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select pci.id, pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, - pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id + pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id, + t.task_status, t.task_type from purchase_check_info pci + left join tm_task t on t.task_id = pci.task_id + + + and pci.task_id = #{taskId} + and pci.purchase_time = #{purchaseTime} + and pci.arrival_time = #{arrivalTime} + and pci.purchaser = #{purchaser} + + \ No newline at end of file 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 5c69b852..f6ded252 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 @@ -15,10 +15,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id, status from tm_task + select task_id, task_type, task_status, code, create_by, create_time, + update_by, update_time, remark, company_id, status , month_order + from tm_task + select max(month_order) from tm_task + where + month(create_time) = #{month} and year(create_time) = #{year} + + and task_type = #{type} + + \ No newline at end of file From c6aa29b09f09a2e68da66918a658f032f3aadfcb Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 18 Oct 2024 15:20:00 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/controller/BmUnitController.java | 37 +-------------- .../controller/BmUnitPersonController.java | 41 ---------------- .../basic/mapper/BmUnitPersonMapper.java | 7 --- .../basic/service/IBmUnitPersonService.java | 7 --- .../service/impl/BmProjectServiceImpl.java | 26 ++++++++-- .../service/impl/BmUnitPersonServiceImpl.java | 22 --------- .../basic/service/impl/BmUnitServiceImpl.java | 35 +++++++++++++- .../mapper/material/basic/BmProjectMapper.xml | 3 +- .../material/basic/BmUnitPersonMapper.xml | 47 ------------------- 9 files changed, 59 insertions(+), 166 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java index cef89e90..724a2d2a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitController.java @@ -1,19 +1,12 @@ package com.bonus.material.basic.controller; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import com.bonus.common.core.constant.SecurityConstants; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.system.api.RemoteDictDataService; -import com.bonus.system.api.domain.SysDictData; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -55,13 +48,12 @@ public class BmUnitController extends BaseController * 查询往来单位管理列表 */ @ApiOperation(value = "查询往来单位管理列表") - @RequiresPermissions("basic:unit:list") + //@RequiresPermissions("basic:unit:list") @GetMapping("/list") public TableDataInfo list(BmUnit bmUnit) { startPage(); List list = bmUnitService.selectBmUnitList(bmUnit); - extracted(list); return getDataTable(list); } @@ -76,37 +68,10 @@ public class BmUnitController extends BaseController public void export(HttpServletResponse response, BmUnit bmUnit) { List list = bmUnitService.selectBmUnitList(bmUnit); - extracted(list); ExcelUtil util = new ExcelUtil(BmUnit.class); util.exportExcel(response, list, "往来单位管理数据"); } - /** - * 将字典数据转换为 BmUnit 对象 - * @param list - */ - private void extracted(List list) { - AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER); - // 假设 ajaxResult.get("data") 返回的是 List - List rawData = (List) ajaxResult.get("data"); - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - // 将 rawData 转换为 SysDictData 列表 - List dataList = rawData.stream() - .map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class)) - .collect(Collectors.toList()); - // 使用 Map 存储字典数据以提高查找速度 - Map dictMap = dataList.stream() - .collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel)); - // 更新 BmUnit 列表 - list.forEach(unit -> { - String typeName = dictMap.get(unit.getTypeId().toString()); - if (typeName != null) { - unit.setTypeName(typeName); - } - }); - } - /** * 获取往来单位管理详细信息 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitPersonController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitPersonController.java index 42c06bb2..77bd96d0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitPersonController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmUnitPersonController.java @@ -1,15 +1,10 @@ package com.bonus.material.basic.controller; -import com.alibaba.nacos.common.utils.CollectionUtils; -import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; -import com.bonus.system.api.RemoteUserService; -import com.bonus.system.api.domain.SysDept; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -23,10 +18,6 @@ import com.bonus.material.basic.service.IBmUnitPersonService; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - /** * 往来单位管理Controller * @@ -41,37 +32,6 @@ public class BmUnitPersonController extends BaseController @Autowired private IBmUnitPersonService bmUnitPersonService; - @Resource - private RemoteUserService remoteUserService; - - /** - * 查询部门下拉树 - */ - @ApiOperation(value = "查询部门下拉树") - @GetMapping("/getDeptUserTree") - public AjaxResult selectDeptTree(SysDept dept) { - AjaxResult ajaxResult = remoteUserService.deptTree(dept, null); - List data = (List) ajaxResult.get("data"); - if (CollectionUtils.isEmpty(data)) { - return AjaxResult.success(); - } - List branches = getBranches(data); - return AjaxResult.success(branches); - } - - private List getBranches(List data) { - List branches = new ArrayList<>(); - for (TreeSelect company : data) { - if (company.getChildren() != null) { - for (TreeSelect child : company.getChildren()) { - // 添加分公司 - branches.add(child); - } - } - } - return branches; - } - /** * 绑定往来单位人员列表 */ @@ -85,7 +45,6 @@ public class BmUnitPersonController extends BaseController return bmUnitPersonService.insertBmUnitPerson(bmUnitPerson); } - /** * 解绑往来单位人员列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmUnitPersonMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmUnitPersonMapper.java index c6fbb717..c5e2a817 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmUnitPersonMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmUnitPersonMapper.java @@ -29,11 +29,4 @@ public interface BmUnitPersonMapper * @return 结果 */ public int deleteBmUnitPersonByID(Long unitId); - - /** - * 查询部门树 - * @param unitPerson - * @return - */ - List selectDeptTree(BmUnitPerson unitPerson); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmUnitPersonService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmUnitPersonService.java index 0819cf7a..07f202ca 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmUnitPersonService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmUnitPersonService.java @@ -28,11 +28,4 @@ public interface IBmUnitPersonService */ public AjaxResult deleteBmUnitPersonByID(Long unitId); - /** - * 查询部门下拉树结构 - * @param unitPerson - * @return - */ - AjaxResult selectDeptTree(BmUnitPerson unitPerson); - } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmProjectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmProjectServiceImpl.java index 4139b487..20ac6ab0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmProjectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmProjectServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.material.basic.service.impl; +import java.util.LinkedHashMap; import java.util.List; import java.util.Objects; @@ -7,13 +8,15 @@ import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.enums.HttpCodeEnum; -import com.bonus.common.biz.exception.BusinessException; +import com.bonus.common.core.constant.SecurityConstants; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteDeptService; +import com.bonus.system.api.domain.SysDept; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; -import org.hibernate.validator.internal.util.StringHelper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.basic.mapper.BmProjectMapper; import com.bonus.material.basic.domain.BmProject; @@ -35,6 +38,9 @@ public class BmProjectServiceImpl implements IBmProjectService @Resource private BmProjectMapper bmProjectMapper; + @Resource + private RemoteDeptService remoteDeptService; + /** * 查询标段工程管理 * @@ -45,10 +51,23 @@ public class BmProjectServiceImpl implements IBmProjectService public BmProject selectBmProjectByProId(Long proId) { BmProject project = bmProjectMapper.selectBmProjectByProId(proId); + extractedImpUnit(project); extracted(project); return project; } + private void extractedImpUnit(BmProject project) { + AjaxResult ajaxResult = remoteDeptService.getInfo(Long.parseLong(project.getImpUnit()), SecurityConstants.INNER); + // ajaxResult.get("data") 返回的是 LinkedHashMap + LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data"); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + if (rawDataList != null) { + SysDept sysDept = objectMapper.convertValue(rawDataList, SysDept.class); + project.setImpUnit(sysDept.getDeptName() == null ? "" : sysDept.getDeptName()); + } + } + /** * 查询标段工程管理列表 * @@ -61,6 +80,7 @@ public class BmProjectServiceImpl implements IBmProjectService List list = bmProjectMapper.selectBmProjectList(bmProject); if (CollectionUtils.isNotEmpty(list)) { list.forEach(item -> { + extractedImpUnit(item); extracted(item); }); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitPersonServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitPersonServiceImpl.java index 38d41a45..2ded4d81 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitPersonServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitPersonServiceImpl.java @@ -65,26 +65,4 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } - /** - * 查询部门下拉树结构 - * @param unitPerson - * @return - */ - @Override - public AjaxResult selectDeptTree(BmUnitPerson unitPerson) { - List groupList = new ArrayList<>(); - List list = new ArrayList<>(); - try { - list = bmUnitPersonMapper.selectDeptTree(unitPerson); - if (CollectionUtils.isNotEmpty(list)) { - // 创建树形结构(数据集合作为参数) - TreeBuild treeBuild = new TreeBuild(list); - // 原查询结果转换树形结构 - groupList = treeBuild.buildTree(); - } - } catch (Exception e) { - } - return AjaxResult.success(groupList); - } - } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java index 3fbf9846..d02ff4db 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmUnitServiceImpl.java @@ -1,21 +1,31 @@ package com.bonus.material.basic.service.impl; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.enums.HttpCodeEnum; +import com.bonus.common.core.constant.SecurityConstants; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteDictDataService; +import com.bonus.system.api.domain.SysDictData; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.basic.mapper.BmUnitMapper; import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.basic.service.IBmUnitService; +import javax.annotation.Resource; + /** * 往来单位管理Service业务层处理 * @@ -28,6 +38,9 @@ public class BmUnitServiceImpl implements IBmUnitService @Autowired private BmUnitMapper bmUnitMapper; + @Resource + private RemoteDictDataService remoteDictDataService; + /** * 查询往来单位管理 * @@ -50,15 +63,35 @@ public class BmUnitServiceImpl implements IBmUnitService public List selectBmUnitList(BmUnit bmUnit) { List bmUnitList = bmUnitMapper.selectBmUnitList(bmUnit); + extracted(bmUnitList); + return bmUnitList; + } + + private void extracted(List bmUnitList) { + AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER); + // 假设 ajaxResult.get("data") 返回的是 List + List rawData = (List) ajaxResult.get("data"); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + // 将 rawData 转换为 SysDictData 列表 + List dataList = rawData.stream() + .map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class)) + .collect(Collectors.toList()); + // 使用 Map 存储字典数据以提高查找速度 + Map dictMap = dataList.stream() + .collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel)); if (CollectionUtils.isNotEmpty(bmUnitList)) { for (BmUnit unit : bmUnitList) { if (unit.getUnitId() != null) { //根据单位id去人员绑定中查询是否绑定,赋值绑定状态 unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0); } + String typeName = dictMap.get(unit.getTypeId().toString()); + if (typeName != null) { + unit.setTypeName(typeName); + } } } - return bmUnitList; } /** diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmProjectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmProjectMapper.xml index c2ada98b..dd5d9448 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmProjectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmProjectMapper.xml @@ -52,13 +52,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bp.remark, bp.del_flag, bp.pro_code, - sd.dept_name as impUnit, + bp.imp_unit, bp.pro_nature, bp.pro_status, bp.contract_part, bp.pro_center from bm_project bp - left join sys_dept sd on sd.dept_id = bp.imp_unit and sd.del_flag = 0 - - - - SELECT - d.dept_id AS id, - d.parent_id AS parentId, - d.ancestors, - d.dept_name AS label, - d.order_num, - d.leader, - d.phone, - d.email, - d.status, - d.del_flag, - d.create_by, - d.create_time - FROM sys_dept d - WHERE d.del_flag = '0' - AND d.status = '0' - AND (LENGTH(d.ancestors) - LENGTH(REPLACE(d.ancestors, ',', ''))) + 1 != 3 - - - - SELECT - * - FROM - ( - SELECT - d.dept_id AS id, - d.parent_id AS parentId, - d.dept_name AS label - FROM sys_dept d - WHERE d.del_flag = '0' - AND d.STATUS = '0' - UNION - SELECT - su.user_id AS id, - su.dept_id AS parentId, - su.user_name AS label - FROM sys_user su - LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id - ) AS combined_results - - - - insert into bm_unit_person From 77e19d4d9df121ec50cc6f647d5c73665c37c5a3 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 18 Oct 2024 15:29:49 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/material/ma/domain/Type.java | 26 ++++++++++- .../service/impl/SupplierInfoServiceImpl.java | 5 ++- .../mapper/material/ma/TypeMapper.xml | 43 +++++++++++++++---- 3 files changed, 64 insertions(+), 10 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java index 6de6e0c2..a00ee6a4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java @@ -33,6 +33,10 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "类型名称") private String typeName; + /** 仓库名称 */ + @ApiModelProperty(value = "物资仓库名称") + private String houseName; + /** 上级ID */ @Excel(name = "上级ID") @ApiModelProperty(value = "上级ID") @@ -41,7 +45,15 @@ public class Type extends BaseEntity { /** 实时库存 */ @Excel(name = "实时库存") @ApiModelProperty(value = "实时库存") - private Long storageNum; + private Long storageNum = 0L; + + /** 是否扣费 */ + @ApiModelProperty(value = "是否扣费,true:扣费, false:不") + private Boolean isCharging = false; + + /** 检验周期 */ + @ApiModelProperty(value = "检验周期,单位:月") + private Integer testCycle = 0; /** 类型编号 */ @Excel(name = "类型编号") @@ -58,6 +70,10 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "计量单位ID") private Long unitId; + /** 计量单位名称 */ + @ApiModelProperty(value = "计量单位名称") + private String unitName; + /** 管理方式(0编号 1计数) */ @Excel(name = "管理方式(0编号 1计数)") @ApiModelProperty(value = "管理方式(0编号 1计数)") @@ -89,6 +105,14 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "丢失赔偿比率") private BigDecimal payRatio; + /** 丢失赔偿价 */ + @ApiModelProperty(value = "丢失赔偿价") + private BigDecimal payPrice; + + /** 税率 */ + @ApiModelProperty(value = "税率") + private BigDecimal taxRatio; + /** 层级 */ @Excel(name = "层级") @ApiModelProperty(value = "层级") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java index 535dcbb0..e5dd6512 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/SupplierInfoServiceImpl.java @@ -66,6 +66,9 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService { supplierInfo.setCreateTime(DateUtils.getNowDate()); int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo); if (insertedSupplierInfoResult > 0) { + if (supplierInfo.getBusinessLicenseFileList() == null) { + return AjaxResult.success("新增任务成功,无营业执照附件"); + } AtomicBoolean addFileInfoResult = new AtomicBoolean(false); supplierInfo.getBusinessLicenseFileList().forEach(file -> { BmFileInfo bmFileInfo = new BmFileInfo(); @@ -77,7 +80,7 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService { bmFileInfo.setModelId(MODEL_ID); addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0); }); - return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条"); + return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,附件表插入0条"); } else { return AjaxResult.error("新增任务失败,info表插入0条"); } 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 163568cd..022953d4 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 @@ -12,12 +12,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -43,12 +46,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -68,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -75,6 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -83,8 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, - eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num, + type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, unit_name, manage_type, lease_price, + eff_time, rent_price, buy_price, pay_ratio, pay_price, tax_ratio, level, rated_load, test_load, holding_time, warn_num, create_by, create_time, update_by, update_time, is_plan,is_ancuo, remark, fac_model, intelligent_code from ma_type @@ -156,12 +165,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type_code, model_code, unit_id, + unit_name, manage_type, lease_price, eff_time, rent_price, buy_price, pay_ratio, + pay_price, + tax_ratio, `level`, rated_load, test_load, @@ -184,12 +196,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{typeCode}, #{modelCode}, #{unitId}, + #{unitName}, #{manageType}, #{leasePrice}, #{effTime}, #{rentPrice}, #{buyPrice}, #{payRatio}, + #{payPrice}, + #{taxRatio}, #{level}, #{ratedLoad}, #{testLoad}, @@ -216,12 +231,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type_code = #{typeCode}, model_code = #{modelCode}, unit_id = #{unitId}, + unit_name = #{unitName}, manage_type = #{manageType}, lease_price = #{leasePrice}, eff_time = #{effTime}, rent_price = #{rentPrice}, buy_price = #{buyPrice}, pay_ratio = #{payRatio}, + pay_price = #{payPrice}, + tax_ratio = #{taxRatio}, `level` = #{level}, rated_load = #{ratedLoad}, test_load = #{testLoad}, @@ -262,11 +280,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT a.*, -- 当前层级的所有字段 b.type_name AS parentThreeLevelName, -- 父层级名称 - c.type_name AS parentTwoLevelName, -- 祖父层级名称 - d.type_name AS parentOneLevelName -- 曾祖父层级名称 + d.type_name AS parentOneLevelName, -- 曾祖父层级名称 + whi.house_name FROM ma_type a + LEFT JOIN + wh_house_set whs ON a.type_id = whs.type_id AND whs.del_flag = '0' + LEFT JOIN + wh_house_info whi ON whi.house_id = whs.house_id AND whs.del_flag = '0' LEFT JOIN ma_type b ON a.parent_id = b.type_id and b.del_flag = '0' -- 第一层,父类型 LEFT JOIN @@ -352,15 +374,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.type_name AS parentFourLevelName, -- 当前层级名称 b.type_name AS parentThreeLevelName, -- 父层级名称 c.type_name AS parentTwoLevelName, -- 祖父层级名称 - d.type_name AS parentOneLevelName -- 曾祖父层级名称 + d.type_name AS parentOneLevelName, -- 曾祖父层级名称 + whs.house_id,whi.house_name FROM ma_type a LEFT JOIN - ma_type b ON a.parent_id = b.type_id and b.del_flag = '0' -- 第一层,父类型 + wh_house_set whs ON a.type_id = whs.type_id AND whs.del_flag = '0' LEFT JOIN - ma_type c ON b.parent_id = c.type_id and c.del_flag = '0' -- 第二层,祖父类型 + wh_house_info whi ON whi.house_id = whs.house_id AND whs.del_flag = '0' LEFT JOIN - ma_type d ON c.parent_id = d.type_id and d.del_flag = '0' -- 第三层,曾祖父类型 + ma_type b ON a.parent_id = b.type_id AND b.del_flag = '0' -- 第一层,父类型 + LEFT JOIN + ma_type c ON b.parent_id = c.type_id AND c.del_flag = '0' -- 第二层,祖父类型 + LEFT JOIN + ma_type d ON c.parent_id = d.type_id AND d.del_flag = '0' -- 第三层,曾祖父类型 WHERE a.del_flag = 0 AND a.`level` = '4' From 07e05db2535510917a396501a1a22f9eb8dce1e9 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Fri, 18 Oct 2024 16:13:17 +0800 Subject: [PATCH 16/19] update scritps --- scripts_244/deploy_material.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts_244/deploy_material.sh b/scripts_244/deploy_material.sh index e60518d5..157e1cb4 100644 --- a/scripts_244/deploy_material.sh +++ b/scripts_244/deploy_material.sh @@ -1,12 +1,6 @@ #!/bin/bash -#jar_version="24.10.0-SNAPSHOT" export deploy_path=/opt/webapps/bonus-material -#export app_workspace=/opt/builds/releases/Bonus-Cloud/${jar_version} -#export biz_workspace=/opt/install/jenkins_home/workspace/Bonus-Cloud-Material - -#cp -f ${biz_workspace}/"bonus-modules/bonus-material/target/bonus-material.jar" $deploy_path -#echo "copied ${app_workspace}/${source_jar} to $deploy_path" # Define an array of JAR files to run jars=("bonus-material.jar --spring.config.location=file:material_bootstrap.yml") @@ -43,5 +37,4 @@ for jar in "${jars[@]}"; do nohup /usr/local/jdk1.8.0/bin/java -jar $jar >/dev/null 2>&1 & done -echo "All JARs have been run successfully." - +echo "All JARs have been run successfully." \ No newline at end of file From ed2290bc99ed91a86e57fc6dd98878b3744a537e Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 18 Oct 2024 16:57:12 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E7=B1=BB=E5=9E=8B--?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E4=BB=A3=E7=A0=81=E6=8A=BD=E5=87=BA?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E4=B8=89=E5=9B=9B=E7=BA=A7=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=85=B3=E8=81=94=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 109 +----------------- .../com/bonus/material/ma/domain/Type.java | 4 +- .../ma/service/MaTypeConfigService.java | 2 +- .../service/impl/MaTypeConfigServiceImpl.java | 102 ++++++++++++++++ .../ma/service/impl/TypeServiceImpl.java | 35 ++++-- .../mapper/PurchaseCheckDetailsMapper.java | 2 +- .../service/IPurchaseCheckInfoService.java | 2 +- .../impl/PurchaseCheckInfoServiceImpl.java | 16 ++- 8 files changed, 146 insertions(+), 126 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 93bd7014..975aa8de 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -36,23 +36,6 @@ import java.util.*; @RequestMapping("/ma_type_config") public class MaTypeConfigController extends BaseController { - /** - * 物资类型库管员配置Service - */ - @Resource - private ITypeKeeperService typeKeeperService; - - /** - * 物资类型维修员配置Service - */ - @Resource - private ITypeRepairService typeRepairService; - - // 物资类型Service - @Resource - private ITypeService typeService; - - @Resource private MaTypeConfigService maTypeConfigService; @@ -91,99 +74,11 @@ public class MaTypeConfigController extends BaseController { @RequiresPermissions("ma:typeConfig:list") @GetMapping("/getMaTypeConfigList") public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { - // 1.把所有物资类型查出来 - List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); - // 2.把维修配置信息查出来 - List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); - // 3.把库管配置信息查出来 - List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); - - // ------------------- 开启数据处理 --------------------- - - // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 - for (MaTypeConfigVo typeConfigVo1 : list) { - // 1.外层 先对比维修班组 - for (TypeRepair typeRepair : typeRepairList) { - // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { - // 3.如果相等,把维修员信息设置到物资类型配置信息中 - typeConfigVo1.setRepairUserId(typeRepair.getUserId()); - typeConfigVo1.setRepairUserName(typeRepair.getUserName()); - break; - } - } - // 1.外层 再对比库管班组 - for (TypeKeeper typeKeeper : typeKeeperList) { - // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { - // 3.如果相等,把库管员信息设置到物资类型配置信息中 - typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); - typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); - } - } - - - // 5.判断当前物资类型配置信息是否有子节点 - if (typeConfigVo1.getChildren() != null) { - // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 - for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { - // 7.有维修配置信息,把维修员信息设置到子节点中 - for (TypeRepair typeRepair : typeRepairList) { - if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { - typeConfigVo2.setRepairUserId(typeRepair.getUserId()); - typeConfigVo2.setRepairUserName(typeRepair.getUserName()); - } - } - } - - // 8.有子节点,继续循环子节点, - for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { - // 9.判断子节点是否有库管配置信息 - for (TypeKeeper typeKeeper : typeKeeperList) { - if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { - typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); - typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); - } - } - } - } - - } - // -------------------- NEW ---------------------------- - - // TODO: 先暂时取消后续过滤流程 - if (true) { - return success(list); - } - - - // ------------------- 数据过滤开始 --------------------- - if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { - // 如果参数无效,则返回原始列表 - return success(list); - } - - List filteredList = new ArrayList<>(); - - for (MaTypeConfigVo maTypeConfigVo : list) { - if ( - maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || - maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) - ) - { - filteredList.add(maTypeConfigVo); - } - } - - // ------------------- 数据过滤结束 --------------------- - - // 返回前端 - return success(filteredList); - // -------------------- 数据处理结束 --------------------- + // 调用service处理业务逻辑 + return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); } - /** * 查询物资配置左侧组织人员树-tree */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java index a00ee6a4..922d9bdd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java @@ -48,8 +48,8 @@ public class Type extends BaseEntity { private Long storageNum = 0L; /** 是否扣费 */ - @ApiModelProperty(value = "是否扣费,true:扣费, false:不") - private Boolean isCharging = false; + @ApiModelProperty(value = "是否扣费,0:扣费, 1:不扣费") + private Byte isCharging = 1; /** 检验周期 */ @ApiModelProperty(value = "检验周期,单位:月") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java index c915d30f..029e5026 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java @@ -14,5 +14,5 @@ public interface MaTypeConfigService{ AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto); - + AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java index b51af9fb..37d1f000 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java @@ -2,14 +2,19 @@ package com.bonus.material.ma.service.impl; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.ma.MaTypeConfigDto; +import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.TypeKeeper; import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeRepairService; +import com.bonus.material.ma.service.ITypeService; import com.bonus.material.ma.service.MaTypeConfigService; +import com.bonus.material.ma.vo.MaTypeConfigVo; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; /** * @author : 阮世耀 @@ -33,6 +38,10 @@ public class MaTypeConfigServiceImpl implements MaTypeConfigService { @Resource private ITypeRepairService typeRepairService; + // 物资类型Service + @Resource + private ITypeService typeService; + @Override public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { @@ -50,6 +59,99 @@ public class MaTypeConfigServiceImpl implements MaTypeConfigService { } } + @Override + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 1.把所有物资类型查出来 + List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); + // 2.把维修配置信息查出来 + List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); + // 3.把库管配置信息查出来 + List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); + + // ------------------- 开启数据处理 --------------------- + + // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 + for (MaTypeConfigVo typeConfigVo1 : list) { + // 1.外层 先对比维修班组 + for (TypeRepair typeRepair : typeRepairList) { + // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把维修员信息设置到物资类型配置信息中 + typeConfigVo1.setRepairUserId(typeRepair.getUserId()); + typeConfigVo1.setRepairUserName(typeRepair.getUserName()); + break; + } + } + // 1.外层 再对比库管班组 + for (TypeKeeper typeKeeper : typeKeeperList) { + // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id + if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { + // 3.如果相等,把库管员信息设置到物资类型配置信息中 + typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); + } + } + + // 5.判断当前物资类型配置信息是否有子节点 + if (typeConfigVo1.getChildren() != null) { + // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 + for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { + // 7.有维修配置信息,把维修员信息设置到子节点中 + for (TypeRepair typeRepair : typeRepairList) { + if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { + typeConfigVo2.setRepairUserId(typeRepair.getUserId()); + typeConfigVo2.setRepairUserName(typeRepair.getUserName()); + } + } + } + + // 8.有子节点,继续循环子节点, + for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { + // 9.判断子节点是否有库管配置信息 + for (TypeKeeper typeKeeper : typeKeeperList) { + if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { + typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); + typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + } + + } + + // -------------------- 数据处理结束 --------------------- + + // TODO: 先暂时取消后续过滤流程 + if (true) { + return AjaxResult.success(list); + } + + + // ------------------- 数据过滤开始 --------------------- + if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { + // 如果参数无效,则返回原始列表 + return AjaxResult.success(list); + } + + List filteredList = new ArrayList<>(); + + for (MaTypeConfigVo maTypeConfigVo : list) { + if ( + maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || + maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) + ) + { + filteredList.add(maTypeConfigVo); + } + } + + // ------------------- 数据过滤结束 --------------------- + + + // 返回前端 + return AjaxResult.success(filteredList); + } + private int handleBind(int bindRoleType, Long typeId, Long userId) { switch (bindRoleType) { 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 4ae71913..9224ab63 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 @@ -1,10 +1,9 @@ package com.bonus.material.ma.service.impl; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; +import cn.hutool.core.util.ArrayUtil; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.biz.enums.DataCodeEnum; import com.bonus.common.core.utils.DateUtils; @@ -167,18 +166,30 @@ public class TypeServiceImpl implements ITypeService { // 查询四级节点列表 List fourLevelTypeList = typeMapper.selectFourLevelTypeListAndParent(type); List threeLevelTypeList = null; - if (fourLevelTypeList != null && !fourLevelTypeList.isEmpty()) { + + if (ArrayUtil.isNotEmpty(fourLevelTypeList)) { // 查询三级节点列表 threeLevelTypeList = typeMapper.selectThreeLevelTypeListAndParent(type); - if (threeLevelTypeList != null && !threeLevelTypeList.isEmpty()) { - // 循环,把三级节点放入fourLevelTypeList集合中 + if (ArrayUtil.isNotEmpty(threeLevelTypeList)) { + + // 使用 HashMap 存储三级节点,以便快速查找 + Map threeLevelTypeMap = new HashMap<>(); + for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { + threeLevelTypeMap.put(threeLevelType.getTypeId(), threeLevelType); + } + + // 外层循环四级节点列表 for (MaTypeConfigVo fourLevelType : fourLevelTypeList) { - // 内循环四级节点 - for (MaTypeConfigVo threeLevelType : threeLevelTypeList) { - // 如果四级节点的父级id和三级节点的id相同,则把四级节点放入三级节点的children集合中 - if (fourLevelType.getParentId().equals(threeLevelType.getTypeId())) { - threeLevelType.getChildren().add(fourLevelType); - } + // 对4级节点进行必要性检查 + if (fourLevelType == null || fourLevelType.getParentId() == null) { + continue; + } + // 拿到4级节点的父级id + Long fourLevelTypeParentId = fourLevelType.getParentId(); + // 查找对应的三级节点 + MaTypeConfigVo threeLevelType = threeLevelTypeMap.get(fourLevelTypeParentId); + if (threeLevelType != null) { + threeLevelType.getChildren().add(fourLevelType); } } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java index b19e1416..57dfad7e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java @@ -27,7 +27,7 @@ public interface PurchaseCheckDetailsMapper { * @param id 新购验收任务详细主键 * @return 新购验收任务详细 */ - public PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id); + PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id); /** * 查询新购验收任务详细列表 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java index 7b50b2fb..1648944e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseCheckInfoService.java @@ -18,7 +18,7 @@ public interface IPurchaseCheckInfoService { * @param id 新购验收任务主键 * @return 新购验收任务 */ - PurchaseCheckInfo selectPurchaseCheckInfoById(Long id); + PurchaseCheckDto selectPurchaseCheckInfoById(Long id); /** * 查询新购验收任务列表 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 8a3e38a7..7a7346c9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -4,6 +4,7 @@ import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.purchase.domain.PurchaseCheckDetails; import com.bonus.material.purchase.dto.PurchaseCheckDto; import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper; import com.bonus.material.task.domain.TmTask; @@ -41,8 +42,19 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { * @return 新购验收任务 */ @Override - public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id) { - return purchaseCheckInfoMapper.selectPurchaseCheckInfoById(id); + public PurchaseCheckDto selectPurchaseCheckInfoById(Long id) { + PurchaseCheckDto purchaseCheckDtoResult = new PurchaseCheckDto(); + PurchaseCheckInfo purchaseCheckInfo = purchaseCheckInfoMapper.selectPurchaseCheckInfoById(id); + if (purchaseCheckInfo != null) { + purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo); + PurchaseCheckDetails purchaseCheckDetailDto = new PurchaseCheckDetails(); + purchaseCheckDetailDto.setTaskId(purchaseCheckInfo.getTaskId()); + List purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsList(purchaseCheckDetailDto); + if (purchaseCheckDetails != null) { + purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); + } + } + return purchaseCheckDtoResult; } /** From 31c7da67982ec7004c1deb3bea894198bbf4a021 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Fri, 18 Oct 2024 17:41:51 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=80=E6=96=99?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=85=8D=E7=BD=AE=E5=92=8C=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/common/biz/constant/BmConfigItems.java | 4 ++++ .../bonus/common/biz/constant/MaterialConstants.java | 6 +++++- .../material/basic/service/IBmConfigService.java | 2 ++ .../basic/service/impl/BmConfigServiceImpl.java | 12 ++++++++++++ .../task/service/impl/TmTaskAuditLogServiceImpl.java | 6 ++++-- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java index b7ad19e7..33ce566d 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java @@ -7,4 +7,8 @@ package com.bonus.common.biz.constant; public class BmConfigItems { public static final String LEASE_TASK_AUDIT_ROLE_KEYS = "LeaseTaskAuditRoleKeys"; + public static final String BACK_TASK_AUDIT_ROLE_KEYS = "BackTaskAuditRoleKeys"; + + + } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java index bac92021..1d110ca3 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java @@ -14,11 +14,15 @@ public class MaterialConstants public static final String UTF8 = "UTF-8"; /** -<<<<<<< HEAD * 领料任务类型 */ public static final Long LEASE_TASK_TYPE = 2L; + /** + * 退料任务类型 + */ + public static final Long BACK_TASK_TYPE = 3L; + /** * XLS */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java index 08ebcb88..d7eef2cd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java @@ -69,4 +69,6 @@ public interface IBmConfigService public int deleteBmConfigById(Long id); public List getLeaseTaskAuditRoleKeys(); + + public List getBackTaskAuditRoleKeys(); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java index 625dcf7e..81cd0bac 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java @@ -131,4 +131,16 @@ public class BmConfigServiceImpl implements IBmConfigService } return list; } + + public List getBackTaskAuditRoleKeys() { + List list = new ArrayList(); + BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_KEYS); + if (Objects.nonNull(bmConfig)) { + String value = getValueWithDefault(bmConfig.getItemValue(), ""); + if (StringUtils.isNotEmpty(value)) { + list = Arrays.asList(value.split(",")); + } + } + return list; + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java index 3efa54c7..d270c615 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java @@ -119,8 +119,10 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService { List needRoles = new ArrayList<>(); if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { needRoles = bmConfigService.getLeaseTaskAuditRoleKeys(); - } - //TODO, add more tasks logic to get needRoles + } else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { + needRoles = bmConfigService.getBackTaskAuditRoleKeys(); + } //TODO, add more tasks logic to get needRoles + if (CollectionUtils.isEmpty(needRoles)) { return new TmTaskAuditResult(true); } else { From 65fff1eefb3df4638cba33cfcf083c1584df7dcd Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 18 Oct 2024 18:05:29 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E7=89=A9=E8=B5=84=E6=96=B0=E8=B4=AD?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseCheckDetailsController.java | 2 +- .../mapper/PurchaseCheckDetailsMapper.java | 6 ++++++ .../impl/PurchaseCheckInfoServiceImpl.java | 4 +--- .../purchase/PurchaseCheckDetailsMapper.xml | 17 +++++++++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java index 3d70bc41..b1acb0f2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckDetailsController.java @@ -95,7 +95,7 @@ public class PurchaseCheckDetailsController extends BaseController { @ApiOperation(value = "修改新购验收任务详细") @PreventRepeatSubmit @RequiresPermissions("purchase:details:edit") - @SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收任务详细") + @SysLog(title = "新购验收任务详细", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务详细") @PutMapping public AjaxResult edit(@RequestBody PurchaseCheckDetails purchaseCheckDetails) { try { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java index 57dfad7e..3eebe2de 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseCheckDetailsMapper.java @@ -29,6 +29,12 @@ public interface PurchaseCheckDetailsMapper { */ PurchaseCheckDetails selectPurchaseCheckDetailsById(Long id); + /** + * 根据任务id查询新购验收任务详细列表--Join查询 + * @param taskId 任务id + */ + List selectPurchaseCheckDetailsListByTaskId(Long taskId); + /** * 查询新购验收任务详细列表 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 7a7346c9..6270cf0e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -47,9 +47,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { PurchaseCheckInfo purchaseCheckInfo = purchaseCheckInfoMapper.selectPurchaseCheckInfoById(id); if (purchaseCheckInfo != null) { purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo); - PurchaseCheckDetails purchaseCheckDetailDto = new PurchaseCheckDetails(); - purchaseCheckDetailDto.setTaskId(purchaseCheckInfo.getTaskId()); - List purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsList(purchaseCheckDetailDto); + List purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByTaskId(purchaseCheckInfo.getTaskId()); if (purchaseCheckDetails != null) { purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index ec52950b..e947e915 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -34,6 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, task_id, type_id, purchase_price, purchase_num, check_num, bind_num, check_result, supplier_id, status, create_by, production_time, create_time, update_by, update_time, remark, check_url_name, check_url, input_num, input_status, input_time, file_name, file_url, company_id from purchase_check_details + + select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result, + pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time, + pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name, + pcd.file_url, pcd.company_id, mt.type_name, mtp.type_name as ma_type_name + from purchase_check_details pcd + left join ma_type mt on pcd.type_id = mt.type_id + left join ma_type mtp on mt.parent_id = mtp.type_id + + + + insert into purchase_check_details