Merge branch 'qtz3' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #195.
This commit is contained in:
qtz
2023-11-06 15:12:56 +08:00
committed by Gitea
9 changed files with 97 additions and 24 deletions
@@ -138,7 +138,7 @@ public class SysUserController extends BaseController
}
user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
return userService.insertUser(user);
}
/**
@@ -164,7 +164,7 @@ public class SysUserController extends BaseController
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(getUsername());
return toAjax(userService.updateUser(user));
return userService.updateUser(user);
}
/**
@@ -33,6 +33,14 @@ public interface SysPostMapper
*/
public SysPost selectPostById(Long postId);
/**
* 查询岗位为经办人的岗位信息
*
* @param postCode 岗位编码
* @return 角色对象信息
*/
public SysPost selectPostByPostCode(String postCode);
/**
* 根据用户ID获取岗位选择框列表
*
@@ -58,6 +58,13 @@ public interface SysUserMapper
* @return 用户对象信息
*/
public SysUser selectUserById(Long userId);
/**
* 通过部门ID查询用户
*
* @param deptId 部门ID
* @return 用户对象信息
*/
public List<SysUser> selectUserByDeptId(Long deptId);
/**
* 新增用户信息
@@ -1,6 +1,8 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
@@ -112,7 +114,7 @@ public interface ISysUserService
* @param user 用户信息
* @return 结果
*/
public int insertUser(SysUser user);
public AjaxResult insertUser(SysUser user);
/**
* 注册用户信息
@@ -128,7 +130,7 @@ public interface ISysUserService
* @param user 用户信息
* @return 结果
*/
public int updateUser(SysUser user);
public AjaxResult updateUser(SysUser user);
/**
* 用户授权角色
@@ -1,10 +1,14 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.mapper.*;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -24,11 +28,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
@@ -48,6 +47,9 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysPostMapper postMapper;
@@ -261,15 +263,35 @@ public class SysUserServiceImpl implements ISysUserService
*/
@Override
@Transactional
public int insertUser(SysUser user)
public AjaxResult insertUser(SysUser user)
{
Long deptId = user.getDeptId();
Long[] postIds = user.getPostIds();
if(deptId!=null){
SysDept dept = sysDeptMapper.selectDeptById(deptId);
Integer deptType = dept.getDeptType();
if(deptType.intValue()==1){
SysPost sysPost = postMapper.selectPostByPostCode("jbr");
Long postId = sysPost.getPostId();
if(postIds.length>0){
boolean isContain = Arrays.asList(postIds).contains(postId);
if(isContain){
List<SysUser> sysUsers = userMapper.selectUserByDeptId(deptId);
if(sysUsers!=null&&sysUsers.size()>0){
return AjaxResult.error("部门类型为仲裁机构的部门的岗位为经办人的用户只能有一个!");
}
}
}
}
}
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
return rows;
return AjaxResult.success("新建用户成功");
}
/**
@@ -292,8 +314,28 @@ public class SysUserServiceImpl implements ISysUserService
*/
@Override
@Transactional
public int updateUser(SysUser user)
public AjaxResult updateUser(SysUser user)
{
Long deptId = user.getDeptId();
Long[] postIds = user.getPostIds();
if(deptId!=null){
SysDept dept = sysDeptMapper.selectDeptById(deptId);
Integer deptType = dept.getDeptType();
if(deptType.intValue()==1){
SysPost sysPost = postMapper.selectPostByPostCode("jbr");
Long postId = sysPost.getPostId();
if(postIds.length>0){
boolean isContain = Arrays.asList(postIds).contains(postId);
if(isContain){
List<SysUser> sysUsers = userMapper.selectUserByDeptId(deptId);
if(sysUsers!=null&&sysUsers.size()>0){
return AjaxResult.error("部门类型为仲裁机构的部门的岗位为经办人的用户只能有一个!");
}
}
}
}
}
Long userId = user.getUserId();
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
@@ -303,7 +345,8 @@ public class SysUserServiceImpl implements ISysUserService
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
return userMapper.updateUser(user);
userMapper.updateUser(user);
return AjaxResult.success("更新用户成功");
}
/**
@@ -632,17 +632,17 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
//查询案件信息
CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
if (caseApplication1 != null) {
archivesDetailVO.setCaseApplication(caseApplication1);
}
// CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
// if (caseApplication1 != null) {
// archivesDetailVO.setCaseApplication(caseApplication1);
// }
//查询案件日志信息
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(id);
List<CaseLogRecord> caseLogRecords = caseLogRecordService.selectCaseLogRecordList(caseLogRecord);
if (caseLogRecords != null && caseLogRecords.size() > 0) {
archivesDetailVO.setCaseLogRecordList(caseLogRecords);
}
// CaseLogRecord caseLogRecord = new CaseLogRecord();
// caseLogRecord.setCaseAppliId(id);
// List<CaseLogRecord> caseLogRecords = caseLogRecordService.selectCaseLogRecordList(caseLogRecord);
// if (caseLogRecords != null && caseLogRecords.size() > 0) {
// archivesDetailVO.setCaseLogRecordList(caseLogRecords);
// }
//查询快递信息
List<LogisticsInfoVO> logisticsInfo = this.getLogisticsInfo(caseApplication);
if (logisticsInfo != null && logisticsInfo.size() > 0) {
@@ -40,7 +40,6 @@ public class FixSelectFlowDetailUtils {
private DeptIdentifyMapper deptIdentifyMapper;
@Scheduled(cron = "0/10 * * * * ?")
// @Scheduled(cron = "0/30 * * * * ?")
@Transactional
public void fixExecuteSelectFlowDetailUtils(){
Gson gson = new Gson();
@@ -45,6 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostByPostCode" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code = #{postCode}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
@@ -131,6 +131,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="selectUserByDeptId" parameterType="Long" resultMap="SysUserResult">
SELECT ud.user_id , ud.nick_name ,ud.phonenumber ,ud.dept_id ,d.dept_name
FROM (SELECT u.user_id , u.nick_name ,u.phonenumber ,u.dept_id
FROM sys_user_post up left join sys_user u on u.user_id = up.user_id
left join sys_post sp on up.post_id = sp.post_id
where sp.post_code = 'jbr') ud left join sys_dept d on ud.dept_id = d.dept_id
where d.dept_id = #{deptId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1