From 08b66ff0fdff211873c7b1e34d138bd63256ee37 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 31 Oct 2024 19:38:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BA=93=E7=AE=A1=E5=91=98=E6=9C=BA?= =?UTF-8?q?=E5=85=B7=E5=85=B3=E8=81=94=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/ma/service/impl/TypeKeeperServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 5bff4228..8e7b2163 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 @@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.TypeKeeperMapper; import com.bonus.material.ma.domain.TypeKeeper; import com.bonus.material.ma.service.ITypeKeeperService; +import org.springframework.util.CollectionUtils; /** * 库管员配置Service业务层处理 @@ -59,7 +60,11 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { */ @Override public int insertTypeKeeper(List typeKeepers) { + if (CollectionUtils.isEmpty(typeKeepers)) { + return 0; + } typeKeepers.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); + typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); return typeKeeperMapper.insertTypeKeeper(typeKeepers); } @@ -106,6 +111,9 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService { */ @Override public int deleteTypeKeeperByUserIdAndTypeId(List typeKeepers) { + if (CollectionUtils.isEmpty(typeKeepers)) { + return 0; + } return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); } } From cd2eeb1b5b23e300a123959560e3e9d73ff1b796 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 31 Oct 2024 19:46:00 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=91=98=E6=9C=BA?= =?UTF-8?q?=E5=85=B7=E5=85=B3=E8=81=94=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeRepairController.java | 8 ++-- .../material/ma/mapper/TypeRepairMapper.java | 9 +++-- .../ma/service/ITypeRepairService.java | 6 +-- .../service/impl/TypeRepairServiceImpl.java | 19 ++++++---- .../mapper/material/ma/TypeRepairMapper.xml | 37 +++++++++++-------- 5 files changed, 45 insertions(+), 34 deletions(-) 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 fb6286d2..2263a609 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 @@ -85,9 +85,9 @@ public class TypeRepairController extends BaseController @RequiresPermissions("ma:repair:add") @SysLog(title = "维修班机具配置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增维修班机具配置") @PostMapping - public AjaxResult add(@RequestBody TypeRepair typeRepair) + public AjaxResult add(@RequestBody List typeRepairs) { - return toAjax(typeRepairService.insertTypeRepair(typeRepair)); + return toAjax(typeRepairService.insertTypeRepair(typeRepairs)); } /** @@ -124,8 +124,8 @@ public class TypeRepairController extends BaseController @RequiresPermissions("ma:repair:remove") @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除单个维修班机具配置") @DeleteMapping - public AjaxResult remove(@RequestBody TypeRepair typeRepair) + public AjaxResult remove(@RequestBody List typeRepairs) { - return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepair)); + return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepairs)); } } 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 ff7b9088..647e36f2 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 @@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper; import java.util.List; import com.bonus.material.ma.domain.TypeRepair; +import org.apache.ibatis.annotations.Param; /** * 维修班机具配置Mapper接口 @@ -34,10 +35,10 @@ public interface TypeRepairMapper { /** * 新增维修班机具配置 * - * @param typeRepair 维修班机具配置 + * @param typeRepairs 维修班机具配置 * @return 结果 */ - int insertTypeRepair(TypeRepair typeRepair); + int insertTypeRepair(@Param("list") List typeRepairs); /** * 修改维修班机具配置 @@ -65,8 +66,8 @@ public interface TypeRepairMapper { /** * 根据用户id和类型id删除配置记录 - * @param typeRepair + * @param typeRepairs * @return */ - int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); + int deleteTypeRepairByUserIdAndTypeId(@Param("list") List typeRepairs); } 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 8c7382da..a43a02f8 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 @@ -34,10 +34,10 @@ public interface ITypeRepairService { /** * 新增维修班机具配置 * - * @param typeRepair 维修班机具配置 + * @param typeRepairs 维修班机具配置 * @return 结果 */ - public int insertTypeRepair(TypeRepair typeRepair); + public int insertTypeRepair(List typeRepairs); /** * 修改维修班机具配置 @@ -66,5 +66,5 @@ public interface ITypeRepairService { /** * 根据用户id和类型id删除配置信息 */ - int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); + int deleteTypeRepairByUserIdAndTypeId(List typeRepairs); } 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 be717e8a..456a9298 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 @@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; import com.bonus.material.ma.mapper.TypeRepairMapper; import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.service.ITypeRepairService; +import org.springframework.util.CollectionUtils; /** * 维修班机具配置Service业务层处理 @@ -57,14 +58,18 @@ public class TypeRepairServiceImpl implements ITypeRepairService { /** * 新增维修班机具配置 * - * @param typeRepair 维修班机具配置 + * @param typeRepairs 维修班机具配置 * @return 结果 */ @Override - public int insertTypeRepair(TypeRepair typeRepair) + public int insertTypeRepair(List typeRepairs) { - typeRepair.setCreateTime(DateUtils.getNowDate()); - return typeRepairMapper.insertTypeRepair(typeRepair); + if (CollectionUtils.isEmpty(typeRepairs)) { + return 0; + } + typeRepairs.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); + typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepairs); + return typeRepairMapper.insertTypeRepair(typeRepairs); } /** @@ -107,10 +112,10 @@ public class TypeRepairServiceImpl implements ITypeRepairService { /** * 根据用户id和类型id删除配置信息 * - * @param typeRepair + * @param typeRepairs */ @Override - public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { - return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); + public int deleteTypeRepairByUserIdAndTypeId(List typeRepairs) { + return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepairs); } } 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 926cbf2f..3a6dfafa 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 @@ -31,21 +31,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into ma_type_repair - - type_id, - user_id, - create_time, - update_time, - company_id, - - - #{typeId}, - #{userId}, - #{createTime}, - #{updateTime}, - #{companyId}, - + insert into ma_type_repair (type_id,user_id,create_time,update_time,company_id) + values + + ( + #{item.typeId}, + #{item.userId}, + #{item.createTime}, + #{item.updateTime}, + #{item.companyId} + ) + @@ -82,6 +78,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from ma_type_repair where user_id = #{userId} and type_id = #{typeId} + delete from ma_type_repair where + type_id in + + #{item.typeId} + + and + user_id in + + #{item.userId} + \ No newline at end of file From d82dccea6d1b5b778797b8d666daf72c8090c50b Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 31 Oct 2024 19:48:07 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=91=98=E6=9C=BA?= =?UTF-8?q?=E5=85=B7=E5=85=B3=E8=81=94=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/ma/service/impl/TypeRepairServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 456a9298..b4668065 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 @@ -67,7 +67,7 @@ public class TypeRepairServiceImpl implements ITypeRepairService { if (CollectionUtils.isEmpty(typeRepairs)) { return 0; } - typeRepairs.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); + typeRepairs.forEach(typeRepair -> typeRepair.setCreateTime(DateUtils.getNowDate())); typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepairs); return typeRepairMapper.insertTypeRepair(typeRepairs); } From fb174749d9173101595492e38e80f399368a4360 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Fri, 1 Nov 2024 17:33:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=A2=86=E9=80=80=E6=96=99=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=B5=81=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=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/material/basic/service/IBmConfigService.java | 4 ++-- .../basic/service/impl/BmConfigServiceImpl.java | 8 ++++---- .../com/bonus/material/task/domain/TmTaskAuditLog.java | 8 ++++---- .../task/service/impl/TmTaskAuditLogServiceImpl.java | 10 +++++----- .../mapper/material/task/TmTaskAuditLogMapper.xml | 2 +- 6 files changed, 18 insertions(+), 18 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 0e00c824..cbc8f32e 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 @@ -10,9 +10,9 @@ public class BmConfigItems { public static final String WEI_XIU_ROLE_IDS = "KuGuanRoleIDs"; - public static final String LEASE_TASK_AUDIT_ROLE_KEYS = "LeaseTaskAuditRoleKeys"; + public static final String LEASE_TASK_AUDIT_ROLE_IDS = "LeaseTaskAuditRoleIDs"; - public static final String BACK_TASK_AUDIT_ROLE_KEYS = "BackTaskAuditRoleKeys"; + public static final String BACK_TASK_AUDIT_ROLE_IDS = "BackTaskAuditRoleIDs"; 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 d7eef2cd..f3bb5c3b 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 @@ -68,7 +68,7 @@ public interface IBmConfigService */ public int deleteBmConfigById(Long id); - public List getLeaseTaskAuditRoleKeys(); + public List getLeaseTaskAuditRoleIds(); - public List getBackTaskAuditRoleKeys(); + public List getBackTaskAuditRoleIds(); } 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 51e09d0f..714337f6 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 @@ -147,9 +147,9 @@ public class BmConfigServiceImpl implements IBmConfigService } /**获取所设定的领料审核角色列表*/ - public List getLeaseTaskAuditRoleKeys() { + public List getLeaseTaskAuditRoleIds() { List list = new ArrayList(); - BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_TASK_AUDIT_ROLE_KEYS); + BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_TASK_AUDIT_ROLE_IDS); if (Objects.nonNull(bmConfig)) { String value = getValueWithDefault(bmConfig.getItemValue(), ""); if (StringUtils.isNotEmpty(value)) { @@ -160,9 +160,9 @@ public class BmConfigServiceImpl implements IBmConfigService } /**获取所设定的退料审核角色列表*/ - public List getBackTaskAuditRoleKeys() { + public List getBackTaskAuditRoleIds() { List list = new ArrayList(); - BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_KEYS); + BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_IDS); if (Objects.nonNull(bmConfig)) { String value = getValueWithDefault(bmConfig.getItemValue(), ""); if (StringUtils.isNotEmpty(value)) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java index 234fe66d..5d9b0aa4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java @@ -32,9 +32,9 @@ public class TmTaskAuditLog extends BaseEntity { @ApiModelProperty(value = "任务类型(定义数据字典)") private Long taskType; - /** 角色权限字符串 */ - @Excel(name = "角色权限字符串") - @ApiModelProperty(value = "角色权限字符串") - private String roleKey; + /** 角色Id字符串 */ + @Excel(name = "角色Id字符串") + @ApiModelProperty(value = "角色Id字符串") + private String roleId; } 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 d270c615..27c8b917 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 @@ -118,26 +118,26 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService { public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) { List needRoles = new ArrayList<>(); if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { - needRoles = bmConfigService.getLeaseTaskAuditRoleKeys(); + needRoles = bmConfigService.getLeaseTaskAuditRoleIds(); } else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { - needRoles = bmConfigService.getBackTaskAuditRoleKeys(); + needRoles = bmConfigService.getBackTaskAuditRoleIds(); } //TODO, add more tasks logic to get needRoles if (CollectionUtils.isEmpty(needRoles)) { return new TmTaskAuditResult(true); } else { - List auditRoleKeys = selectTmTaskAuditRoleKeyList(tmTaskAuditLog); + List auditRoleIds = selectTmTaskAuditRoleKeyList(tmTaskAuditLog); String nextRole = needRoles.get(0); boolean finished = false; for (int i = 0; i < needRoles.size(); i++) { if (i < needRoles.size() - 1) { // 遍历,还没到最后一个 - if (auditRoleKeys.contains(needRoles.get(i))) { + if (auditRoleIds.contains(needRoles.get(i))) { nextRole = needRoles.get(i + 1); } } else { // 遍历,已经到最后一个了 - if (auditRoleKeys.contains(needRoles.get(i))) { + if (auditRoleIds.contains(needRoles.get(i))) { nextRole = ""; finished = true; } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml index 787d9295..4ede6c8a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml @@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -24,11 +24,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and task_id = #{taskId} and task_type = #{taskType} - and role_key = #{roleKey} + and role_id = #{roleId} - select role_id from tm_task_audit_log @@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" task_id, task_type, - role_key, + role_id, create_by, create_time, update_by, @@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{taskId}, #{taskType}, - #{roleKey}, + #{roleId}, #{createBy}, #{createTime}, #{updateBy}, @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" task_id = #{taskId}, task_type = #{taskType}, - role_key = #{roleKey}, + role_id = #{roleId}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy},