|
@@ -1,14 +1,22 @@
|
|
package com.ruoyi.system.service.impl;
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import com.ruoyi.common.core.domain.entity.SysRole;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.system.domain.ExamineConfig;
|
|
import com.ruoyi.system.domain.ExamineConfig;
|
|
import com.ruoyi.system.mapper.ExamineConfigMapper;
|
|
import com.ruoyi.system.mapper.ExamineConfigMapper;
|
|
|
|
+import com.ruoyi.system.mapper.SysRoleMapper;
|
|
import com.ruoyi.system.service.IExamineConfigService;
|
|
import com.ruoyi.system.service.IExamineConfigService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
|
+import javax.validation.constraints.Size;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 审核角色配置Service业务层处理
|
|
* 审核角色配置Service业务层处理
|
|
@@ -21,6 +29,9 @@ public class ExamineConfigServiceImpl implements IExamineConfigService {
|
|
@Autowired
|
|
@Autowired
|
|
private ExamineConfigMapper examineConfigMapper;
|
|
private ExamineConfigMapper examineConfigMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysRoleMapper sysRoleMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询审核角色配置
|
|
* 查询审核角色配置
|
|
*
|
|
*
|
|
@@ -29,7 +40,25 @@ public class ExamineConfigServiceImpl implements IExamineConfigService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ExamineConfig selectExamineConfigById(Long id) {
|
|
public ExamineConfig selectExamineConfigById(Long id) {
|
|
- return examineConfigMapper.selectExamineConfigById(id);
|
|
|
|
|
|
+ ExamineConfig examineConfig = examineConfigMapper.selectExamineConfigById(id);
|
|
|
|
+ String roleId = examineConfig.getRoleId();
|
|
|
|
+ if (StringUtils.isNotBlank(roleId)) {
|
|
|
|
+ List<Integer> arr = new ArrayList<>();
|
|
|
|
+ String[] split = roleId.split(",");
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ if (split.length > 0){
|
|
|
|
+
|
|
|
|
+ for (String roleIds : split) {
|
|
|
|
+ SysRole sysRole = sysRoleMapper.selectRoleById(Long.valueOf(roleIds));
|
|
|
|
+ String roleName = sysRole.getRoleName();
|
|
|
|
+ sb.append(roleName).append("|");
|
|
|
|
+ arr.add(Integer.valueOf(roleIds));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examineConfig.setRoleName(sb.toString());
|
|
|
|
+ examineConfig.setRoleIds(arr.stream().mapToInt(Integer::valueOf).toArray());
|
|
|
|
+ }
|
|
|
|
+ return examineConfig;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -40,7 +69,30 @@ public class ExamineConfigServiceImpl implements IExamineConfigService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<ExamineConfig> selectExamineConfigList(ExamineConfig examineConfig) {
|
|
public List<ExamineConfig> selectExamineConfigList(ExamineConfig examineConfig) {
|
|
- return examineConfigMapper.selectExamineConfigList(examineConfig);
|
|
|
|
|
|
+
|
|
|
|
+ List<ExamineConfig> examineConfigs = examineConfigMapper.selectExamineConfigList(examineConfig);
|
|
|
|
+ if (examineConfigs.size() > 0) {
|
|
|
|
+ for (ExamineConfig config : examineConfigs) {
|
|
|
|
+ String roleId = config.getRoleId();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(roleId)) {
|
|
|
|
+ String[] split = roleId.split(",");
|
|
|
|
+ List<Integer> arr = new ArrayList<>();
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ if (split.length > 0){
|
|
|
|
+ for (String id : split) {
|
|
|
|
+ SysRole sysRole = sysRoleMapper.selectRoleById(Long.valueOf(id));
|
|
|
|
+ String roleName = sysRole.getRoleName();
|
|
|
|
+ sb.append(roleName).append("|");
|
|
|
|
+ arr.add(Integer.valueOf(id));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ config.setRoleName(sb.toString());
|
|
|
|
+ config.setRoleIds(arr.stream().mapToInt(Integer::valueOf).toArray());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return examineConfigs;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -51,6 +103,18 @@ public class ExamineConfigServiceImpl implements IExamineConfigService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public int insertExamineConfig(ExamineConfig examineConfig) {
|
|
public int insertExamineConfig(ExamineConfig examineConfig) {
|
|
|
|
+ int[] roleIds = examineConfig.getRoleIds();
|
|
|
|
+ if (roleIds.length > 0) {
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ for (int i = 0; i < roleIds.length; i++) {
|
|
|
|
+ if (i == roleIds.length - 1) {
|
|
|
|
+ sb.append(roleIds[i]);
|
|
|
|
+ } else {
|
|
|
|
+ sb.append(roleIds[i]).append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examineConfig.setRoleId(sb.toString());
|
|
|
|
+ }
|
|
examineConfig.setCreateTime(DateUtils.getNowDate());
|
|
examineConfig.setCreateTime(DateUtils.getNowDate());
|
|
return examineConfigMapper.insertExamineConfig(examineConfig);
|
|
return examineConfigMapper.insertExamineConfig(examineConfig);
|
|
}
|
|
}
|
|
@@ -63,6 +127,18 @@ public class ExamineConfigServiceImpl implements IExamineConfigService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public int updateExamineConfig(ExamineConfig examineConfig) {
|
|
public int updateExamineConfig(ExamineConfig examineConfig) {
|
|
|
|
+ int[] roleIds = examineConfig.getRoleIds();
|
|
|
|
+ if (roleIds.length > 0) {
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ for (int i = 0; i < roleIds.length; i++) {
|
|
|
|
+ if (i == roleIds.length - 1) {
|
|
|
|
+ sb.append(roleIds[i]);
|
|
|
|
+ } else {
|
|
|
|
+ sb.append(roleIds[i]).append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examineConfig.setRoleId(sb.toString());
|
|
|
|
+ }
|
|
examineConfig.setUpdateTime(DateUtils.getNowDate());
|
|
examineConfig.setUpdateTime(DateUtils.getNowDate());
|
|
return examineConfigMapper.updateExamineConfig(examineConfig);
|
|
return examineConfigMapper.updateExamineConfig(examineConfig);
|
|
}
|
|
}
|