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/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/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); } } 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..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 @@ -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(typeRepair -> typeRepair.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/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/mapper/TmTaskAuditLogMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java index 9068cf04..b53ec482 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java @@ -32,7 +32,7 @@ public interface TmTaskAuditLogMapper { * @param tmTaskAuditLog 任务 * @return 任务集合 */ - public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog); + public List selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog); /** * 新增任务 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java index d85aa08f..2e001501 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java @@ -33,7 +33,7 @@ public interface ITmTaskAuditLogService { * @param tmTaskAuditLog 任务 * @return 任务集合 */ - public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog); + public List selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog); /** * 新增任务 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..55d426a8 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 @@ -57,8 +57,8 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService { * @param tmTaskAuditLog 任务 * @return 任务集合 */ - public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog) { - return tmTaskAuditLogsMapper.selectTmTaskAuditRoleKeyList(tmTaskAuditLog); + public List selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog) { + return tmTaskAuditLogsMapper.selectTmTaskAuditRoleList(tmTaskAuditLog); } /** @@ -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 = selectTmTaskAuditRoleList(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/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 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..86dde170 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 @@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, task_id, task_type, role_key, create_by, create_time, update_by, update_time, remark from tm_task_audit_log + select id, task_id, task_type, role_id, create_by, create_time, update_by, update_time, remark from tm_task_audit_log - + select role_id from tm_task_audit_log and task_id = #{taskId} @@ -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},