Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-04 09:16:28 +08:00
commit 157c12c00b
14 changed files with 82 additions and 63 deletions

View File

@ -10,9 +10,9 @@ public class BmConfigItems {
public static final String WEI_XIU_ROLE_IDS = "KuGuanRoleIDs"; 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";

View File

@ -68,7 +68,7 @@ public interface IBmConfigService
*/ */
public int deleteBmConfigById(Long id); public int deleteBmConfigById(Long id);
public List<String> getLeaseTaskAuditRoleKeys(); public List<String> getLeaseTaskAuditRoleIds();
public List<String> getBackTaskAuditRoleKeys(); public List<String> getBackTaskAuditRoleIds();
} }

View File

@ -147,9 +147,9 @@ public class BmConfigServiceImpl implements IBmConfigService
} }
/**获取所设定的领料审核角色列表*/ /**获取所设定的领料审核角色列表*/
public List<String> getLeaseTaskAuditRoleKeys() { public List<String> getLeaseTaskAuditRoleIds() {
List<String> list = new ArrayList(); List<String> 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)) { if (Objects.nonNull(bmConfig)) {
String value = getValueWithDefault(bmConfig.getItemValue(), ""); String value = getValueWithDefault(bmConfig.getItemValue(), "");
if (StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {
@ -160,9 +160,9 @@ public class BmConfigServiceImpl implements IBmConfigService
} }
/**获取所设定的退料审核角色列表*/ /**获取所设定的退料审核角色列表*/
public List<String> getBackTaskAuditRoleKeys() { public List<String> getBackTaskAuditRoleIds() {
List<String> list = new ArrayList(); List<String> 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)) { if (Objects.nonNull(bmConfig)) {
String value = getValueWithDefault(bmConfig.getItemValue(), ""); String value = getValueWithDefault(bmConfig.getItemValue(), "");
if (StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {

View File

@ -85,9 +85,9 @@ public class TypeRepairController extends BaseController
@RequiresPermissions("ma:repair:add") @RequiresPermissions("ma:repair:add")
@SysLog(title = "维修班机具配置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增维修班机具配置") @SysLog(title = "维修班机具配置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增维修班机具配置")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody TypeRepair typeRepair) public AjaxResult add(@RequestBody List<TypeRepair> typeRepairs)
{ {
return toAjax(typeRepairService.insertTypeRepair(typeRepair)); return toAjax(typeRepairService.insertTypeRepair(typeRepairs));
} }
/** /**
@ -124,8 +124,8 @@ public class TypeRepairController extends BaseController
@RequiresPermissions("ma:repair:remove") @RequiresPermissions("ma:repair:remove")
@SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除单个维修班机具配置") @SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除单个维修班机具配置")
@DeleteMapping @DeleteMapping
public AjaxResult remove(@RequestBody TypeRepair typeRepair) public AjaxResult remove(@RequestBody List<TypeRepair> typeRepairs)
{ {
return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepair)); return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepairs));
} }
} }

View File

@ -2,6 +2,7 @@ package com.bonus.material.ma.mapper;
import java.util.List; import java.util.List;
import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.domain.TypeRepair;
import org.apache.ibatis.annotations.Param;
/** /**
* 维修班机具配置Mapper接口 * 维修班机具配置Mapper接口
@ -34,10 +35,10 @@ public interface TypeRepairMapper {
/** /**
* 新增维修班机具配置 * 新增维修班机具配置
* *
* @param typeRepair 维修班机具配置 * @param typeRepairs 维修班机具配置
* @return 结果 * @return 结果
*/ */
int insertTypeRepair(TypeRepair typeRepair); int insertTypeRepair(@Param("list") List<TypeRepair> typeRepairs);
/** /**
* 修改维修班机具配置 * 修改维修班机具配置
@ -65,8 +66,8 @@ public interface TypeRepairMapper {
/** /**
* 根据用户id和类型id删除配置记录 * 根据用户id和类型id删除配置记录
* @param typeRepair * @param typeRepairs
* @return * @return
*/ */
int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); int deleteTypeRepairByUserIdAndTypeId(@Param("list") List<TypeRepair> typeRepairs);
} }

View File

@ -34,10 +34,10 @@ public interface ITypeRepairService {
/** /**
* 新增维修班机具配置 * 新增维修班机具配置
* *
* @param typeRepair 维修班机具配置 * @param typeRepairs 维修班机具配置
* @return 结果 * @return 结果
*/ */
public int insertTypeRepair(TypeRepair typeRepair); public int insertTypeRepair(List<TypeRepair> typeRepairs);
/** /**
* 修改维修班机具配置 * 修改维修班机具配置
@ -66,5 +66,5 @@ public interface ITypeRepairService {
/** /**
* 根据用户id和类型id删除配置信息 * 根据用户id和类型id删除配置信息
*/ */
int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair); int deleteTypeRepairByUserIdAndTypeId(List<TypeRepair> typeRepairs);
} }

View File

@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.TypeKeeperMapper; import com.bonus.material.ma.mapper.TypeKeeperMapper;
import com.bonus.material.ma.domain.TypeKeeper; import com.bonus.material.ma.domain.TypeKeeper;
import com.bonus.material.ma.service.ITypeKeeperService; import com.bonus.material.ma.service.ITypeKeeperService;
import org.springframework.util.CollectionUtils;
/** /**
* 库管员配置Service业务层处理 * 库管员配置Service业务层处理
@ -59,7 +60,11 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService {
*/ */
@Override @Override
public int insertTypeKeeper(List<TypeKeeper> typeKeepers) { public int insertTypeKeeper(List<TypeKeeper> typeKeepers) {
if (CollectionUtils.isEmpty(typeKeepers)) {
return 0;
}
typeKeepers.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate())); typeKeepers.forEach(typeKeeper -> typeKeeper.setCreateTime(DateUtils.getNowDate()));
typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers);
return typeKeeperMapper.insertTypeKeeper(typeKeepers); return typeKeeperMapper.insertTypeKeeper(typeKeepers);
} }
@ -106,6 +111,9 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService {
*/ */
@Override @Override
public int deleteTypeKeeperByUserIdAndTypeId(List<TypeKeeper> typeKeepers) { public int deleteTypeKeeperByUserIdAndTypeId(List<TypeKeeper> typeKeepers) {
if (CollectionUtils.isEmpty(typeKeepers)) {
return 0;
}
return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers); return typeKeeperMapper.deleteTypeKeeperByUserIdAndTypeId(typeKeepers);
} }
} }

View File

@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.TypeRepairMapper; import com.bonus.material.ma.mapper.TypeRepairMapper;
import com.bonus.material.ma.domain.TypeRepair; import com.bonus.material.ma.domain.TypeRepair;
import com.bonus.material.ma.service.ITypeRepairService; import com.bonus.material.ma.service.ITypeRepairService;
import org.springframework.util.CollectionUtils;
/** /**
* 维修班机具配置Service业务层处理 * 维修班机具配置Service业务层处理
@ -57,14 +58,18 @@ public class TypeRepairServiceImpl implements ITypeRepairService {
/** /**
* 新增维修班机具配置 * 新增维修班机具配置
* *
* @param typeRepair 维修班机具配置 * @param typeRepairs 维修班机具配置
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertTypeRepair(TypeRepair typeRepair) public int insertTypeRepair(List<TypeRepair> typeRepairs)
{ {
typeRepair.setCreateTime(DateUtils.getNowDate()); if (CollectionUtils.isEmpty(typeRepairs)) {
return typeRepairMapper.insertTypeRepair(typeRepair); 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删除配置信息 * 根据用户id和类型id删除配置信息
* *
* @param typeRepair * @param typeRepairs
*/ */
@Override @Override
public int deleteTypeRepairByUserIdAndTypeId(TypeRepair typeRepair) { public int deleteTypeRepairByUserIdAndTypeId(List<TypeRepair> typeRepairs) {
return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepair); return typeRepairMapper.deleteTypeRepairByUserIdAndTypeId(typeRepairs);
} }
} }

View File

@ -32,9 +32,9 @@ public class TmTaskAuditLog extends BaseEntity {
@ApiModelProperty(value = "任务类型(定义数据字典)") @ApiModelProperty(value = "任务类型(定义数据字典)")
private Long taskType; private Long taskType;
/** 角色权限字符串 */ /** 角色Id字符串 */
@Excel(name = "角色权限字符串") @Excel(name = "角色Id字符串")
@ApiModelProperty(value = "角色权限字符串") @ApiModelProperty(value = "角色Id字符串")
private String roleKey; private String roleId;
} }

View File

@ -32,7 +32,7 @@ public interface TmTaskAuditLogMapper {
* @param tmTaskAuditLog 任务 * @param tmTaskAuditLog 任务
* @return 任务集合 * @return 任务集合
*/ */
public List<String> selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog); public List<String> selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog);
/** /**
* 新增任务 * 新增任务

View File

@ -33,7 +33,7 @@ public interface ITmTaskAuditLogService {
* @param tmTaskAuditLog 任务 * @param tmTaskAuditLog 任务
* @return 任务集合 * @return 任务集合
*/ */
public List<String> selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog); public List<String> selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog);
/** /**
* 新增任务 * 新增任务

View File

@ -57,8 +57,8 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService {
* @param tmTaskAuditLog 任务 * @param tmTaskAuditLog 任务
* @return 任务集合 * @return 任务集合
*/ */
public List<String> selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog) { public List<String> selectTmTaskAuditRoleList(TmTaskAuditLog tmTaskAuditLog) {
return tmTaskAuditLogsMapper.selectTmTaskAuditRoleKeyList(tmTaskAuditLog); return tmTaskAuditLogsMapper.selectTmTaskAuditRoleList(tmTaskAuditLog);
} }
/** /**
@ -118,26 +118,26 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService {
public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) { public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) {
List<String> needRoles = new ArrayList<>(); List<String> needRoles = new ArrayList<>();
if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
needRoles = bmConfigService.getLeaseTaskAuditRoleKeys(); needRoles = bmConfigService.getLeaseTaskAuditRoleIds();
} else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) { } else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
needRoles = bmConfigService.getBackTaskAuditRoleKeys(); needRoles = bmConfigService.getBackTaskAuditRoleIds();
} //TODO, add more tasks logic to get needRoles } //TODO, add more tasks logic to get needRoles
if (CollectionUtils.isEmpty(needRoles)) { if (CollectionUtils.isEmpty(needRoles)) {
return new TmTaskAuditResult(true); return new TmTaskAuditResult(true);
} else { } else {
List<String> auditRoleKeys = selectTmTaskAuditRoleKeyList(tmTaskAuditLog); List<String> auditRoleIds = selectTmTaskAuditRoleList(tmTaskAuditLog);
String nextRole = needRoles.get(0); String nextRole = needRoles.get(0);
boolean finished = false; boolean finished = false;
for (int i = 0; i < needRoles.size(); i++) { for (int i = 0; i < needRoles.size(); i++) {
if (i < needRoles.size() - 1) { if (i < needRoles.size() - 1) {
// 遍历还没到最后一个 // 遍历还没到最后一个
if (auditRoleKeys.contains(needRoles.get(i))) { if (auditRoleIds.contains(needRoles.get(i))) {
nextRole = needRoles.get(i + 1); nextRole = needRoles.get(i + 1);
} }
} else { } else {
// 遍历已经到最后一个了 // 遍历已经到最后一个了
if (auditRoleKeys.contains(needRoles.get(i))) { if (auditRoleIds.contains(needRoles.get(i))) {
nextRole = ""; nextRole = "";
finished = true; finished = true;
} }

View File

@ -31,21 +31,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertTypeRepair" parameterType="com.bonus.material.ma.domain.TypeRepair" useGeneratedKeys="true" keyProperty="ID"> <insert id="insertTypeRepair" parameterType="com.bonus.material.ma.domain.TypeRepair" useGeneratedKeys="true" keyProperty="ID">
insert into ma_type_repair insert into ma_type_repair (type_id,user_id,create_time,update_time,company_id)
<trim prefix="(" suffix=")" suffixOverrides=","> values
<if test="typeId != null">type_id,</if> <foreach collection="list" item="item" separator=",">
<if test="userId != null">user_id,</if> (
<if test="createTime != null">create_time,</if> #{item.typeId},
<if test="updateTime != null">update_time,</if> #{item.userId},
<if test="companyId != null">company_id,</if> #{item.createTime},
</trim> #{item.updateTime},
<trim prefix="values (" suffix=")" suffixOverrides=","> #{item.companyId}
<if test="typeId != null">#{typeId},</if> )
<if test="userId != null">#{userId},</if> </foreach>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert> </insert>
<update id="updateTypeRepair" parameterType="com.bonus.material.ma.domain.TypeRepair"> <update id="updateTypeRepair" parameterType="com.bonus.material.ma.domain.TypeRepair">
@ -82,6 +78,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<delete id="deleteTypeRepairByUserIdAndTypeId"> <delete id="deleteTypeRepairByUserIdAndTypeId">
delete from ma_type_repair where user_id = #{userId} and type_id = #{typeId} delete from ma_type_repair where
type_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.typeId}
</foreach>
and
user_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.userId}
</foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" /> <result property="id" column="id" />
<result property="taskId" column="task_id" /> <result property="taskId" column="task_id" />
<result property="taskType" column="task_type" /> <result property="taskType" column="task_type" />
<result property="roleKey" column="role_key" /> <result property="roleId" column="role_id" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTmTaskAuditLogVo"> <sql id="selectTmTaskAuditLogVo">
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
</sql> </sql>
<select id="selectTmTaskAuditLogList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultMap="TmTaskAuditLogResult"> <select id="selectTmTaskAuditLogList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultMap="TmTaskAuditLogResult">
@ -24,12 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="taskId != null "> and task_id = #{taskId}</if> <if test="taskId != null "> and task_id = #{taskId}</if>
<if test="taskType != null "> and task_type = #{taskType}</if> <if test="taskType != null "> and task_type = #{taskType}</if>
<if test="roleKey != null and roleKey != ''"> and role_key = #{roleKey}</if> <if test="roleId != null and roleId != ''"> and role_id = #{roleId}</if>
</where> </where>
</select> </select>
<select id="selectTmTaskAuditRoleKeyList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultType="java.lang.String"> <select id="selectTmTaskAuditRoleList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultType="java.lang.String">
select role_key select role_id
from tm_task_audit_log from tm_task_audit_log
<where> <where>
<if test="taskId != null "> and task_id = #{taskId}</if> <if test="taskId != null "> and task_id = #{taskId}</if>
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">task_id,</if> <if test="taskId != null">task_id,</if>
<if test="taskType != null">task_type,</if> <if test="taskType != null">task_type,</if>
<if test="roleKey != null">role_key,</if> <if test="roleId != null">role_id,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if> <if test="taskId != null">#{taskId},</if>
<if test="taskType != null">#{taskType},</if> <if test="taskType != null">#{taskType},</if>
<if test="roleKey != null">#{roleKey},</if> <if test="roleId != null">#{roleId},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="taskId != null">task_id = #{taskId},</if> <if test="taskId != null">task_id = #{taskId},</if>
<if test="taskType != null">task_type = #{taskType},</if> <if test="taskType != null">task_type = #{taskType},</if>
<if test="roleKey != null">role_key = #{roleKey},</if> <if test="roleId != null">role_id = #{roleId},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>