Commit 1fca1a0e authored by fangxinjiang's avatar fangxinjiang

客户服务平台相关代码-fxj

parent f39c5ec6
...@@ -162,4 +162,13 @@ public class SysUser extends BaseEntity { ...@@ -162,4 +162,13 @@ public class SysUser extends BaseEntity {
**/ **/
private String type; private String type;
/**
* @Author fxj
* @Description 0 管理员 1 普通用户
* @Date 14:56 2023/1/6
**/
@TableField(exist = false)
private String userType;
} }
package com.yifu.cloud.plus.v1.yifu.admin.api.vo; package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -21,7 +20,7 @@ public class SysDeptMoveVo implements Serializable { ...@@ -21,7 +20,7 @@ public class SysDeptMoveVo implements Serializable {
* @Description 部门ID * @Description 部门ID
* @Date 17:29 2025/2/26 * @Date 17:29 2025/2/26
**/ **/
private String sysDeptId; private String deptId;
/** /**
* @Author fxj * @Author fxj
* @Description 部门父级ID * @Description 部门父级ID
......
...@@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; ...@@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -32,7 +33,7 @@ import java.util.List; ...@@ -32,7 +33,7 @@ import java.util.List;
* @date 2019/2/1 * @date 2019/2/1
*/ */
@Data @Data
public class UserCspVO extends SysUser implements Serializable { public class UserCspVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -61,9 +62,13 @@ public class UserCspVO extends SysUser implements Serializable { ...@@ -61,9 +62,13 @@ public class UserCspVO extends SysUser implements Serializable {
/** /**
* 部门ID * 部门ID
*/ */
@NotBlank(message = "部门ID 不能为空")
private Long deptId; private Long deptId;
/**
* 部门名称
*/
@NotBlank(message = "部门名称 不能为空")
@Schema(description = "部门名称")
private String deptName;
//关系表数据开始 //关系表数据开始
@NotBlank(message = "关联项目编码 不能为空") @NotBlank(message = "关联项目编码 不能为空")
...@@ -80,6 +85,16 @@ public class UserCspVO extends SysUser implements Serializable { ...@@ -80,6 +85,16 @@ public class UserCspVO extends SysUser implements Serializable {
@NotBlank(message = "账号类型 不能为空") @NotBlank(message = "账号类型 不能为空")
@Schema(description = "账号类型:0 管理员, 1 普通成员") @Schema(description = "账号类型:0 管理员, 1 普通成员")
private String userType; private String userType;
/**
* 邮箱
*/
@Schema(description = "邮箱")
private String email;
/**
* 用户分组
*/
@Schema(description = "用户分组")
private String userGroup;
} }
...@@ -14,20 +14,5 @@ public class UserDeptPermConstants { ...@@ -14,20 +14,5 @@ public class UserDeptPermConstants {
public static final String USER_EXITS_ERROR = "已存在对应用户数据,请勿重复配置!"; public static final String USER_EXITS_ERROR = "已存在对应用户数据,请勿重复配置!";
public static final String CUSTOMER_SERVICE_PLATFORM = "客户服务平台用户"; public static final String CUSTOMER_SERVICE_PLATFORM = "客户服务平台用户";
public static final String DEFAULT_PASSWORD = "123456"; public static final String DEFAULT_PASSWORD = "123456";
public static final String ERROR_TEMPLATE = "模板中已存在对应员工"; public static final String DEPT_MOVE_FORBIDDEN = "禁止配置多个顶级节点";
public static final String YL = "养老";
public static final String DB = "大病";
public static final String SY = "失业";
public static final String BIR = "生育";
public static final String GS = "工伤";
public static final String YB = "医保";
public static final String BJ = "补缴";
public static final String YEAR_1970 = "1970-02";
public static final String NOT_EXIT_SETTLEiNFO = "未找到该人员对应的项目信息,请核实";
public static final String ERROR_PRI = "该人员归属的";
public static final String ERROR_END = "信息缺失,将导致后续无法结算,请联系卢名旭处理";
} }
...@@ -255,7 +255,7 @@ public class DeptController { ...@@ -255,7 +255,7 @@ public class DeptController {
* @Date 17:27 2025/2/26 * @Date 17:27 2025/2/26
**/ **/
@PostMapping(value = "/cspUpdateDept") @PostMapping(value = "/cspUpdateDept")
public R<Boolean> cspUpdateDept(SysDeptMoveVo dept) { public R<Boolean> cspUpdateDept(@RequestBody SysDeptMoveVo dept) {
return sysDeptService.cspUpdateDept(dept); return sysDeptService.cspUpdateDept(dept);
} }
} }
...@@ -71,7 +71,7 @@ public class SysUserDeptPermissionController { ...@@ -71,7 +71,7 @@ public class SysUserDeptPermissionController {
* @return success、false * @return success、false
*/ */
@SysLog("新增用户") @SysLog("新增用户")
@PostMapping("add") @PostMapping("/add")
public R<Boolean> save(@Valid @RequestBody UserCspVO entity) { public R<Boolean> save(@Valid @RequestBody UserCspVO entity) {
return sysUserDeptPermissionService.saveAsso(entity); return sysUserDeptPermissionService.saveAsso(entity);
} }
......
...@@ -648,9 +648,9 @@ public class UserController { ...@@ -648,9 +648,9 @@ public class UserController {
* @return * @return
**/ **/
@GetMapping("/cspUserPage") @GetMapping("/cspUserPage")
public R<IPage<SysUser>> cspUserPage(Page page, @RequestParam(required = true,value = "deptId") String deptId, public R<IPage<SysUser>> cspUserPage(Page page, @RequestParam(required = true) String deptId,
@RequestParam(required = false,value = "userName") String userName, @RequestParam(required = false) String username,
@RequestParam(required = false,value = "nickName") String nickName) { @RequestParam(required = false) String nickname) {
return userService.cspUserPage(page, deptId,userName,nickName); return userService.cspUserPage(page, deptId,username,nickname);
} }
} }
...@@ -100,5 +100,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -100,5 +100,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
*/ */
IPage<SysUser> getAllUserPageWhere(Page page, @Param("query") UserDTO userDTO); IPage<SysUser> getAllUserPageWhere(Page page, @Param("query") UserDTO userDTO);
IPage<SysUser> cspUserPage(Page page, @Param("deptId")String deptId, @Param("userName")String userName, @Param("nickName")String nickName); IPage<SysUser> cspUserPage(Page page, @Param("deptId")String deptId, @Param("userName")String userName,
@Param("nickName")String nickName,
@Param("projectNo")String projectNo);
} }
...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptSortVo; ...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptSortVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptTreeSelectVO; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptTreeSelectVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptMoveVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptMoveVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo;
import com.yifu.cloud.plus.v1.yifu.admin.constants.UserDeptPermConstants;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper; import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper; import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptRelationService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptRelationService;
...@@ -43,8 +44,6 @@ import com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil; ...@@ -43,8 +44,6 @@ import com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -524,21 +523,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -524,21 +523,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
public R<Boolean> cspUpdateDept(SysDeptMoveVo dept) { public R<Boolean> cspUpdateDept(SysDeptMoveVo dept) {
try { try {
if(Common.isEmpty(dept) if(Common.isEmpty(dept)
|| Common.isEmpty(dept.getSysDeptId()) || Common.isEmpty(dept.getDeptId())
|| Common.isEmpty(dept.getParentId()) || Common.isEmpty(dept.getParentId())
|| Common.isEmpty(dept.getDeptSortList())){ || Common.isEmpty(dept.getDeptSortList())){
R.failed(CommonConstants.PARAM_IS_NOT_ERROR); R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
if (CommonConstants.ZERO_STRING.equals(dept.getParentId())){
return R.failed(UserDeptPermConstants.DEPT_MOVE_FORBIDDEN);
}
SysDept parentDept = baseMapper.selectById(dept.getParentId()); SysDept parentDept = baseMapper.selectById(dept.getParentId());
if (Common.isEmpty(parentDept)){ if (Common.isEmpty(parentDept)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
SysDept updateEntity = baseMapper.selectById(dept.getSysDeptId()); SysDept updateEntity = baseMapper.selectById(dept.getDeptId());
if (Common.isEmpty(updateEntity)){ if (Common.isEmpty(updateEntity)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
updateEntity.setParentId(parentDept.getDeptId()); updateEntity.setParentId(parentDept.getDeptId());
updateEntity.setAncestors(parentDept.getAncestors()); updateEntity.setAncestors(parentDept.getAncestors()+","+parentDept.getDeptId());
baseMapper.updateById(updateEntity); baseMapper.updateById(updateEntity);
List<DeptSortVo> moveVos = dept.getDeptSortList(); List<DeptSortVo> moveVos = dept.getDeptSortList();
baseMapper.batchUpdateSort(moveVos); baseMapper.batchUpdateSort(moveVos);
......
...@@ -486,8 +486,14 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer ...@@ -486,8 +486,14 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
user.setDeptName(entity.getDeptName()); user.setDeptName(entity.getDeptName());
user.setDeptId(entity.getDeptId()); user.setDeptId(entity.getDeptId());
LambdaUpdateWrapper<SysUser> updateWrappers = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SysUser> updateWrappers = new LambdaUpdateWrapper<>();
updateWrappers.set(SysUser::getUserId,user.getUserId()); updateWrappers.eq(SysUser::getUserId,user.getUserId());
sysUserMapper.update(entity,updateWrappers); updateWrappers.set(SysUser::getNickname,entity.getNickname());
updateWrappers.set(SysUser::getPhone,entity.getPhone());
if (CommonConstants.FOUR_STRING.equals(user.getType())){
updateWrappers.set(SysUser::getDeptName,entity.getDeptName());
updateWrappers.set(SysUser::getDeptId,entity.getDeptId());
}
sysUserMapper.update(null,updateWrappers);
permission.setDeptId(entity.getDeptId()); permission.setDeptId(entity.getDeptId());
permission.setUserType(entity.getUserType()); permission.setUserType(entity.getUserType());
baseMapper.updateById(permission); baseMapper.updateById(permission);
......
...@@ -990,7 +990,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -990,7 +990,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (Common.isEmpty(deptId)){ if (Common.isEmpty(deptId)){
return R.failed(null,CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(null,CommonConstants.PARAM_IS_NOT_ERROR);
} }
return R.ok(baseMapper.cspUserPage(page,deptId,userName,nickName)); SysDept dept = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda()
.eq(SysDept::getDeptId,deptId).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(dept)){
return R.failed(null,CommonConstants.PARAM_IS_NOT_ERROR);
}
return R.ok(baseMapper.cspUserPage(page,deptId,userName,nickName,dept.getProjectNo()));
} }
} }
...@@ -413,21 +413,24 @@ ...@@ -413,21 +413,24 @@
</select> </select>
<select id="cspUserPage" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser"> <select id="cspUserPage" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser">
select u.user_id,u.nickname,u.phone,u.create_time,u.username from sys_user u select u.user_id,u.nickname,u.phone,u.create_time,u.username,p.dept_id,d.`name` as dept_name,p.user_type from sys_user u
LEFT JOIN sys_user_dept_permission p on u.user_id=p.user_id LEFT JOIN sys_user_dept_permission p on u.user_id=p.user_id
LEFT JOIN sys_dept d on d.dept_id=p.dept_id
where where
1=1 1=1
<if test="nickName != null and nickName != ''"> <if test="nickName != null and nickName != ''">
and u.nickname LIKE CONCAT('%',#{nickName},'%') and u.nickname LIKE CONCAT('%',#{nickName},'%')
</if> </if>
<if test="userName != null and username != ''"> <if test="userName != null and userName != ''">
and u.username LIKE CONCAT('%',#{userName,'%') and u.username LIKE CONCAT('%',#{userName},'%')
</if> </if>
<if test="null != deptId and deptId != ''"> <if test="null != deptId and deptId != ''">
p.dept_id in ( and p.dept_id in (
select d.dept_id from sys_dept d where d.ancestors like CONCAT("0","%",#{deptId},"%") select d.dept_id from sys_dept d where
d.project_no =#{projectNo} and (d.ancestors like CONCAT("0","%",#{deptId},"%") or d.dept_id =#{deptId} )
) )
</if> </if>
ORDER BY u.create_time DESC ORDER BY u.create_time DESC
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment