From 40f90333b9e10ee19af301e34170773557b1d5a5 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 21 Oct 2024 09:42:17 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9B=BF=E4=BB=A3MaTypeConfigController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeController.java | 12 ++ .../material/ma/service/ITypeService.java | 4 + .../ma/service/impl/TypeServiceImpl.java | 104 ++++++++++++++++++ 3 files changed, 120 insertions(+) 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 e8571ea0..4b87bc05 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 @@ -9,6 +9,7 @@ import javax.validation.constraints.NotNull; import com.bonus.common.biz.domain.TreeSelect; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.ma.MaTypeConfigDto; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; import com.bonus.material.warehouse.domain.WhHouseSet; @@ -187,4 +188,15 @@ public class TypeController extends BaseController { public AjaxResult remove(@PathVariable Long[] typeIds) { return toAjax(typeService.deleteTypeByTypeIds(typeIds)); } + + /** + * 查询物资类型配置右侧列表 + */ + @ApiOperation(value = "查询物资类型配置右侧列表") + @RequiresPermissions("ma:typeConfig:list") + @GetMapping("/getMaTypeConfigList") + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 调用service处理业务逻辑 + return typeService.getMaTypeConfigList(maTypeConfigDto); + } } 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 79548d23..2e953619 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 @@ -3,6 +3,8 @@ package com.bonus.material.ma.service; import java.util.List; import com.bonus.common.biz.domain.TreeSelect; +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.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; @@ -91,4 +93,6 @@ public interface ITypeService { * @return 树结构列表 */ List buildMaTypeTree(List maTypeList); + + AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); } 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 9224ab63..5003a1dc 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 @@ -8,6 +8,12 @@ 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.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.vo.MaTypeConfigVo; import com.bonus.material.ma.vo.MaTypeListVo; import com.bonus.material.ma.vo.MaTypeSelectVo; @@ -33,6 +39,12 @@ public class TypeServiceImpl implements ITypeService { @Resource private TypeMapper typeMapper; + @Resource + private ITypeKeeperService typeKeeperService; + + @Resource + private ITypeRepairService typeRepairService; + /** * 查询物资类型 -- 根据id * @@ -329,4 +341,96 @@ public class TypeServiceImpl implements ITypeService { return !getChildList(list, t).isEmpty(); } + @Override + public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { + // 1.把所有物资类型查出来 + List list = 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); + } } From a542efc44d332bf391d1dca4fac117039615e3a0 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 18 Oct 2024 16:57:12 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=89=A9=E8=B5=84=E7=B1=BB=E5=9E=8B--?= =?UTF-8?q?=E5=85=AC=E7=94=A8=E8=A7=84=E6=A0=BC=E5=9E=8B=E5=8F=B7=E8=BF=9E?= =?UTF-8?q?=E5=8A=A8=E5=BC=8F=E4=B8=8B=E6=8B=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeController.java | 14 ++++++ .../bonus/material/ma/mapper/TypeMapper.java | 3 ++ .../material/ma/service/ITypeService.java | 2 + .../ma/service/impl/TypeServiceImpl.java | 44 +++++++++++++++++++ .../mapper/material/ma/TypeMapper.xml | 21 +++++++++ 5 files changed, 84 insertions(+) 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 e8571ea0..e6de4c5a 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 @@ -74,6 +74,20 @@ public class TypeController extends BaseController { return success(list); } + /** + * 查询物资类型4级规格型号--前端联动式下拉框 + * + * @param typeId 规格型号 + */ + @ApiOperation(value = "获取物资类型连动式下拉框") + @GetMapping("/equipmentType") + public AjaxResult equipmentType(@RequestParam(required = false) Long typeId, + @RequestParam(required = false) String typeName) { + List listByMaType = typeService.getEquipmentType(typeId, typeName); + return success(listByMaType); + } + + /** * 根据左列表类型id查询右表格 --- 暂未启用,代码有问题!! * TODO: 待完善 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 95d81f94..24004336 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 @@ -14,6 +14,9 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface TypeMapper { + + List selectMaTypeList(String typeName); + /** * 查询物资类型 * 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 79548d23..728f0640 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 @@ -23,6 +23,8 @@ public interface ITypeService { List selectParentId(Long typeId, Integer level); + List getEquipmentType(Long typeId, String typeName); + List selectMaTypeListByHouseId(Long houseId); List getListByParentId(Long typeId, String typeName); 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 9224ab63..0a2efe27 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 @@ -48,6 +48,31 @@ public class TypeServiceImpl implements ITypeService { return typeMapper.selectParentId(typeId, level); } + /** + * 查询物资类型四级树--前端联动式下拉框 + * @param typeId 类型id + * @param typeName 类型名称 + */ + @Override + public List getEquipmentType(Long typeId, String typeName) { + List maTypes = typeMapper.selectMaTypeList(""); + List list = new ArrayList<>(); + for (Type maType : maTypes) { + if (maType.getParentId() == 0) { + list.add(maType); + } + } + //根据父节点获取对应的儿子节点 + for (Type maType : list) { + List child = getChild(maTypes, maType.getTypeId()); + maType.setChildren(child); + } + return list; + } + + + + @Override public List selectMaTypeListByHouseId(Long houseId) { return typeMapper.selectMaTypeListByHouseId(houseId); @@ -272,6 +297,25 @@ public class TypeServiceImpl implements ITypeService { return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children); } + /** + * 递归调用获取子级 + * @param list 集合 + * @param parentId 父级id + */ + public List getChild(List list, Long parentId) { + List childList = new ArrayList(); + for (Type maType : list) { + Long typeId = maType.getTypeId(); + Long pid = maType.getParentId(); + if (parentId.equals(pid)) { + List childLists = getChild(list, typeId); + maType.setChildren(childLists); + childList.add(maType); + } + } + return childList; + } + /** * 构建前端所需要树结构 * 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 022953d4..9a70c583 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 @@ -408,4 +408,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE a.del_flag = 0 AND a.`level` = '3' + + \ No newline at end of file From 8093deda18c8ae36a8c88911648d03940e9e2c35 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 21 Oct 2024 14:27:17 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E4=BB=BB=E5=8A=A1--?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=A2=9E=E5=8A=A0=E4=BA=BA=E5=91=98=E9=80=9A?= =?UTF-8?q?=E7=9F=A5API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseNoticePersonController.java | 27 +++++++++++++++---- .../purchase/domain/PurchaseCheckInfo.java | 6 +++++ .../purchase/domain/PurchaseNoticePerson.java | 4 +++ .../mapper/PurchaseNoticePersonMapper.java | 8 ++++++ .../service/IPurchaseNoticePersonService.java | 8 ++++++ .../impl/PurchaseCheckInfoServiceImpl.java | 2 +- .../impl/PurchaseNoticePersonServiceImpl.java | 15 +++++++++++ .../purchase/PurchaseCheckInfoMapper.xml | 5 +++- .../purchase/PurchaseNoticePersonMapper.xml | 7 +++++ 9 files changed, 75 insertions(+), 7 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseNoticePersonController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseNoticePersonController.java index dcd57809..27854fa3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseNoticePersonController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseNoticePersonController.java @@ -1,6 +1,7 @@ package com.bonus.material.purchase.controller; import java.util.List; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; @@ -26,15 +27,15 @@ import com.bonus.common.core.web.page.TableDataInfo; /** * 新购短信通知人员Controller - * - * @author xsheng - * @date 2024-10-16 + * + * @author syruan */ @Api(tags = "新购短信通知人员接口") @RestController @RequestMapping("/purchase_notice_person") public class PurchaseNoticePersonController extends BaseController { - @Autowired + + @Resource private IPurchaseNoticePersonService purchaseNoticePersonService; /** @@ -89,13 +90,29 @@ public class PurchaseNoticePersonController extends BaseController { } } + /** + * 批量新增--新购短信通知人员 + */ + @ApiOperation(value = "批量新增新购短信通知人员") + @PreventRepeatSubmit + @RequiresPermissions("purchase:person:add") + @SysLog(title = "批量新增新购短信通知人员", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->批量新增新购短信通知人员") + @PostMapping("/batchAddNoticePerson") + public AjaxResult batchAddNoticePerson(@RequestBody List purchaseNoticePersonList) { + try { + return toAjax(purchaseNoticePersonService.insertBatchPurchaseNoticePerson(purchaseNoticePersonList)); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + /** * 修改新购短信通知人员 */ @ApiOperation(value = "修改新购短信通知人员") @PreventRepeatSubmit @RequiresPermissions("purchase:person:edit") - @SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购短信通知人员") + @SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, module = "仓储管理->修改新购短信通知人员") @PutMapping public AjaxResult edit(@RequestBody PurchaseNoticePerson purchaseNoticePerson) { try { 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 96498bb7..6f2acd88 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 @@ -30,6 +30,9 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "任务状态") private String taskStatus; + @ApiModelProperty(value = "采购单号") + private String code; + /** 采购日期 */ @ApiModelProperty(value = "采购日期") @JsonFormat(pattern = "yyyy-MM-dd") @@ -64,4 +67,7 @@ public class PurchaseCheckInfo extends BaseEntity { @ApiModelProperty(value = "采购数量--外层Table字段") private String purchaseMaNumber; + @ApiModelProperty(value = "操作人名称") + private String createUserName; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseNoticePerson.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseNoticePerson.java index ed50a9d5..ad7612fd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseNoticePerson.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseNoticePerson.java @@ -32,6 +32,10 @@ public class PurchaseNoticePerson extends BaseEntity { @ApiModelProperty(value = "用户名") private String userName; + /** 用户角色名 */ + @ApiModelProperty(value = "用户角色名") + private String userRoleName; + /** 联系电话 */ @Excel(name = "联系电话") @ApiModelProperty(value = "联系电话") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseNoticePersonMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseNoticePersonMapper.java index 9d8ee7e7..f3b2b264 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseNoticePersonMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseNoticePersonMapper.java @@ -34,6 +34,14 @@ public interface PurchaseNoticePersonMapper { */ public int insertPurchaseNoticePerson(PurchaseNoticePerson purchaseNoticePerson); + /** + * 批量新购短信通知人员 + * + * @param purchaseNoticePersonList 新购短信通知人员集合 + * @return 结果 + */ + int insertBatchPurchaseNoticePerson(List purchaseNoticePersonList); + /** * 修改新购短信通知人员 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseNoticePersonService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseNoticePersonService.java index 5d6d1b68..f9799d6e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseNoticePersonService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseNoticePersonService.java @@ -34,6 +34,14 @@ public interface IPurchaseNoticePersonService { */ public int insertPurchaseNoticePerson(PurchaseNoticePerson purchaseNoticePerson); + /** + * 批量新增新购短信通知人员 + * + * @param purchaseNoticePersonList 新购短信通知人员集合 + * @return 结果 + */ + int insertBatchPurchaseNoticePerson(List purchaseNoticePersonList); + /** * 修改新购短信通知人员 * 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 6270cf0e..81a62df9 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 @@ -64,7 +64,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { @Override public List selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfoDto) { // 查询新购info列表 - List purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfoDto); + List purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoJoinList(purchaseCheckInfoDto); // 过滤info列表中空的对象 purchaseCheckInfos.removeIf(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() == null); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java index ae3c689b..1f04a425 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java @@ -58,6 +58,21 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer } } + /** + * 批量新增新购短信通知人员 + * + * @param purchaseNoticePersonList 新购短信通知人员集合 + * @return 结果 + */ + @Override + public int insertBatchPurchaseNoticePerson(List purchaseNoticePersonList) { + try { + return purchaseNoticePersonMapper.insertBatchPurchaseNoticePerson(purchaseNoticePersonList); + } catch (Exception e) { + throw new RuntimeException("批量新增执行SQL错误:" + e.getMessage()); + } + } + /** * 修改新购短信通知人员 * 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 03042160..40a0da1c 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 @@ -6,10 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -30,10 +32,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, - t.task_status, t.task_type + t.task_status, t.task_type, t.code, su.user_name as create_user_name from purchase_check_info pci left join tm_task t on t.task_id = pci.task_id + left join sys_user su ON pci.create_by = su.user_id + + and bfi.task_id = #{taskId} + + + + insert into bm_file_info + + model_id, + file_name, + file_url, + dic_id, + create_by, + create_time, + task_id + + + #{modelId,jdbcType=INTEGER}, + #{fileName,jdbcType=VARCHAR}, + #{fileUrl,jdbcType=VARCHAR}, + #{dictCode}, + #{createBy,jdbcType=VARCHAR}, + now(), + #{taskId} + + + + \ No newline at end of file From 7067ff72907261d03cd5a97596205dce9f1369a6 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 22 Oct 2024 13:27:25 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E6=9B=BF=E4=BB=A3MaTypeConfigController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/MaTypeConfigController.java | 248 ++++++------ .../ma/service/MaTypeConfigService.java | 36 +- .../service/impl/MaTypeConfigServiceImpl.java | 374 +++++++++--------- 3 files changed, 329 insertions(+), 329 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 975aa8de..2707df3f 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 @@ -1,124 +1,124 @@ -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.PreventRepeatSubmit; -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.service.MaTypeConfigService; -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.*; - -import javax.annotation.Resource; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -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 { - - @Resource - private MaTypeConfigService maTypeConfigService; - - @ApiOperation(value = "配置物资类型绑定信息") - @PreventRepeatSubmit - @RequiresPermissions("ma:typeConfig:edit") - @PostMapping("/updateMaTypeBindInfo") - public AjaxResult updateMaTypeBindInfo(@RequestBody @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不能为空"); - } - - // ---------------- 数据校验结束 --------------------- - - // 执行业务逻辑 - return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); - } - - - - /** - * 查询物资类型配置右侧列表 - */ - @ApiOperation(value = "查询物资类型配置右侧列表") - @RequiresPermissions("ma:typeConfig:list") - @GetMapping("/getMaTypeConfigList") - public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { - // 调用service处理业务逻辑 - return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); - } - - - /** - * 查询物资配置左侧组织人员树-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 treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); - TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); - - // 3. 创建部门人员 - 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)); - treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); - treeSelect03.setChildren(ImmutableList.of(treeSelect003)); - treeSelect3.setChildren(Collections.singletonList(treeSelect03)); - - // 3.把根节点添加到集合中 - treeSelectList1.add(treeSelect1); - treeSelectList1.add(treeSelect2); - treeSelectList1.add(treeSelect3); - - // -------------- 模拟人员Tree数据结束 ------------------ - - return success(treeSelectList1); - } - -} +//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.PreventRepeatSubmit; +//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.service.MaTypeConfigService; +//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.*; +// +//import javax.annotation.Resource; +//import javax.validation.Valid; +//import javax.validation.constraints.NotNull; +//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 { +// +// @Resource +// private MaTypeConfigService maTypeConfigService; +// +// @ApiOperation(value = "配置物资类型绑定信息") +// @PreventRepeatSubmit +// @RequiresPermissions("ma:typeConfig:edit") +// @PostMapping("/updateMaTypeBindInfo") +// public AjaxResult updateMaTypeBindInfo(@RequestBody @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不能为空"); +// } +// +// // ---------------- 数据校验结束 --------------------- +// +// // 执行业务逻辑 +// return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); +// } +// +// +// +// /** +// * 查询物资类型配置右侧列表 +// */ +// @ApiOperation(value = "查询物资类型配置右侧列表") +// @RequiresPermissions("ma:typeConfig:list") +// @GetMapping("/getMaTypeConfigList") +// public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { +// // 调用service处理业务逻辑 +// return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); +// } +// +// +// /** +// * 查询物资配置左侧组织人员树-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 treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); +// TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); +// +// // 3. 创建部门人员 +// 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)); +// treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); +// treeSelect03.setChildren(ImmutableList.of(treeSelect003)); +// treeSelect3.setChildren(Collections.singletonList(treeSelect03)); +// +// // 3.把根节点添加到集合中 +// 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/service/MaTypeConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java index 029e5026..57cde1a9 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 @@ -1,18 +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); - - AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); -} +//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); +// +// 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 37d1f000..6021d8b7 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 @@ -1,187 +1,187 @@ -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 : 阮世耀 - * @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; - - // 物资类型Service - @Resource - private ITypeService typeService; - - - @Override - public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { - int result; - switch (maTypeConfigDto.getBindFlag()) { - case 1: - result = handleBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); - case 2: - result = handleUnBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); - default: - // 处理其他情况或抛出异常 - return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); - } - } - - @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) { - 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); - } - } -} +//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 : 阮世耀 +// * @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; +// +// // 物资类型Service +// @Resource +// private ITypeService typeService; +// +// +// @Override +// public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { +// int result; +// switch (maTypeConfigDto.getBindFlag()) { +// case 1: +// result = handleBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); +// return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); +// case 2: +// result = handleUnBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); +// return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); +// default: +// // 处理其他情况或抛出异常 +// return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); +// } +// } +// +// @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) { +// 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); +// } +// } +//}