智慧保安后台管理-外网项目备份
zhongrj
2023-12-01 daaf2caafd40f3657aa1f7e45bc1641d482baeb1
保安员详情信息新增,修改,删除调整
6 files modified
10 files added
1012 ■■■■ changed files
src/main/java/org/springblade/common/config/MetaObjectConfig.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserController.java 428 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserDetailController.java 126 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/dto/UserDetailDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/entity/UserDetailEntity.java 145 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserDetailMapper.java 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserDetailMapper.xml 32 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IUserDetailService.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IUserService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserDetailServiceImpl.java 25 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/UserVO.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/wrapper/UserDetailWrapper.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/MetaObjectConfig.java
New file
@@ -0,0 +1,31 @@
package org.springblade.common.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Component;
import java.util.Date;
@Slf4j
@Component
public class MetaObjectConfig implements MetaObjectHandler {
   @Override
   public void insertFill(MetaObject metaObject) {
       //设置自动插入填充
       this.setFieldValByName("createTime", new Date(), metaObject);
       this.setFieldValByName("create_user", AuthUtil.getUserId(), metaObject);
       this.setFieldValByName("updateTime", new Date(), metaObject);
       this.setFieldValByName("update_user", AuthUtil.getUserId(), metaObject);
   }
   @Override
   public void updateFill(MetaObject metaObject) {
       //设置自动修改填充
       this.setFieldValByName("updateTime", new Date(), metaObject);
       this.setFieldValByName("update_user", AuthUtil.getUserId(), metaObject);
   }
}
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -73,12 +73,10 @@
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.excel.*;
import org.springblade.modules.system.node.TreeNode;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.system.service.MyAsyncService;
import org.springblade.modules.system.service.*;
import org.springblade.modules.system.vo.UserVO;
import org.springblade.modules.system.wrapper.UserWrapper;
import org.springblade.modules.training.entity.TrainingRegistration;
@@ -113,6 +111,7 @@
public class UserController {
    private final IUserService userService;
    private final IUserDetailService userDetailService;
    private final IDeptService iDeptService;
    private final IRoleService roleService;
    private final IExperienceService experienceService;
@@ -270,50 +269,64 @@
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入User")
    public R update(@Valid @RequestBody User user) throws Exception {
    @Transactional(rollbackFor = Exception.class)
    public R update(@Valid @RequestBody Map<String, Object> userMap) throws Exception {
        //获取user
        User user = JSON.parseObject(JSON.toJSONString(userMap.get("user")), User.class);
        // 用户详情
        UserDetailEntity userDetailEntity = JSON.parseObject(JSON.toJSONString(userMap.get("userDetail")), UserDetailEntity.class);
        //分配保安角色
        CacheUtil.clear(USER_CACHE);
        User user1 = userService.getById(user.getId());
        String url = "";
        if (null != user.getFingerprint() && !user.getFingerprint().equals("")) {
            if (user.getFingerprint().length() > 100) {
                //指纹图片上传并返回url
                String s = uploadBase64String(user);
                String[] split = s.split(",");
                user.setFingerprint(split[0]);
                //内网指纹图片url
                url = split[1];
            }
        }
        //判断是否持证
        boolean states = false;
        if (user.getHold().equals("1") && null!=user.getSecuritynumber() && !user.getSecuritynumber().equals("")){
            //持证,校验保安证编号是否合法
            SecurityPaper securityPaper = new SecurityPaper();
            securityPaper.setIdCardNo(user.getCardid());
            List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper));
            if (securityPaperList.size()>0){
                //遍历
                for (SecurityPaper paper : securityPaperList) {
                    if (paper.getNumber().equals(user.getSecuritynumber())){
                        states = true;
                    }
                }
                if (!states){
                    user.setHold("2");
//                    throw new ServiceException("保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
                }
            }else {
//                throw new ServiceException("保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
                states = false;
                user.setHold("2");
            }
        }
        if (user.getHold().equals("2")){
            states = true;
        }
        // 指纹设置
        fingerprintSet(user);
        // 校验是否持证
        boolean states = updateByIsSecurity(user);
        //如果是离职
        if (leaveHandle(user)) return R.success("修改成功");
        int state = 0;
        //如果是异常标记
        if (null != user.getExaminationType() && !user.getExaminationType().equals("")) {
            if (user.getExaminationType().equals("1")) {
                //吊销保安证
                user.setHold("3");
                state = 1;
            }
        }
        user.setPassword(user1.getPassword());
        user.setUpdateTime(new Date());
        //如果身份证号修改
        if (!user.getCardid().equals(user1.getCardid())) {
            //账号,密码也修改
            user.setAccount(user.getCardid());
            //获取默认密码配置
            user.setPassword(user.getCardid().substring(user.getCardid().length() - 6));
            //加密
            if (Func.isNotEmpty(user.getPassword())) {
                user.setPassword(DigestUtil.encrypt(user.getPassword()));
            }
            state = 2;
        }
        //修改
        boolean status = userService.updateById(user);
        if (status){
            //同时更新用户详情信息
            userDetailService.updateById(userDetailEntity);
        }
        if (!states) {
            return R.data(201,null,"保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
        }
        return R.data(200,null,"修改成功!");
    }
    /**
     * 离职处理
     * @param user
     * @return
     */
    public boolean leaveHandle(@RequestBody @Valid User user) {
        if (null != user.getStatus()) {
            if (user.getStatus().equals(2)) {
                //修改派遣状态
@@ -403,60 +416,46 @@
                            + " " + "where id = " + "'" + user.getId() + "'";
                    myAsyncService.dataSync(s1);
                }
                return R.success("修改成功");
                return true;
            }
        }
        return false;
    }
        int state = 0;
        //如果是异常标记
        if (null != user.getExaminationType() && !user.getExaminationType().equals("")) {
            if (user.getExaminationType().equals("1")) {
                //吊销保安证
                user.setHold("3");
                state = 1;
    /**
     *     校验是否持证-更新
     * @param user
     * @return
     */
    public boolean updateByIsSecurity(@RequestBody @Valid User user) {
        //判断是否持证
        boolean states = false;
        if (user.getHold().equals("1") && null!=user.getSecuritynumber() && !user.getSecuritynumber().equals("")){
            //持证,校验保安证编号是否合法
            SecurityPaper securityPaper = new SecurityPaper();
            securityPaper.setIdCardNo(user.getCardid());
            List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper));
            if (securityPaperList.size()>0){
                //遍历
                for (SecurityPaper paper : securityPaperList) {
                    if (paper.getNumber().equals(user.getSecuritynumber())){
                        states = true;
                    }
                }
                if (!states){
                    user.setHold("2");
//                    throw new ServiceException("保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
                }
            }else {
//                throw new ServiceException("保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
                states = false;
                user.setHold("2");
            }
        }
        user.setPassword(user1.getPassword());
        user.setUpdateTime(new Date());
        //如果身份证号修改
        if (!user.getCardid().equals(user1.getCardid())) {
            //账号,密码也修改
            user.setAccount(user.getCardid());
            //获取默认密码配置
            user.setPassword(user.getCardid().substring(user.getCardid().length() - 6));
            //加密
            if (Func.isNotEmpty(user.getPassword())) {
                user.setPassword(DigestUtil.encrypt(user.getPassword()));
            }
            state = 2;
        if (user.getHold().equals("2")){
            states = true;
        }
        //修改
        boolean status = userService.updateById(user);
        if (status) {
            if (state == 2) {
                UserDTO userDTO = new UserDTO();
                userDTO.setAccount(user.getAccount());
                userDTO.setCardid(user.getCardid());
                userDTO.setOldCardid(user1.getCardid());
                userDTO.setPassword(user.getPassword());
                userDTO.setRealName(user.getRealName());
                userDTO.setPhone(user.getPhone());
                userDTO.setSex(user.getSex());
                userDTO.setAvatar(user.getAvatar());
                //推送qfqk
//                myAsyncService.updateUserByAccount(userDTO);
            } else {
//                myAsyncService.updateUserByQfqk(user);
            }
        }
        if (!states) {
            return R.data(201,null,"保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
        }
        return R.data(200,null,"修改成功!");
        return states;
    }
@@ -656,25 +655,15 @@
    @PostMapping("/remove")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "删除", notes = "传入id集合")
    //@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
    public R remove(@RequestParam String ids) {
        CacheUtil.clear(USER_CACHE);
//        List<String> list = Arrays.asList(ids.split(","));
//        list.forEach(id -> {
//            User user = userService.getById(id);
//            User user1 = new User();
//            user1.setId(user.getId());
//            user1.setCardid(user.getCardid());
//            user1.setIsDeleted(1);
//            //qfqk 同步
////            myAsyncService.deleteUserByQfqk(user1);
//            //内网同步
//            String s1 = "update blade_user set is_deleted = 1"
//                + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "'"
//                + " " + "where id = " + "'" + id + "'";
//            //FtpUtil.sqlFileUpload(s1);
//            myAsyncService.dataSync(s1);
//        });
        List<String> list = Arrays.asList(ids.split(","));
        // 遍历删除用户详情信息
        list.forEach(id -> {
            QueryWrapper<UserDetailEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("user_id",id);
            userDetailService.remove(wrapper);
        });
        return R.status(userService.removeUser(ids));
    }
@@ -1068,6 +1057,8 @@
    public R securitySave(@Valid @RequestBody Map<String, Object> userMap) throws Exception {
        //获取user
        User user = JSON.parseObject(JSON.toJSONString(userMap.get("user")), User.class);
        // 用户详情
        UserDetailEntity userDetailEntity = JSON.parseObject(JSON.toJSONString(userMap.get("userDetail")), UserDetailEntity.class);
        //分配保安角色
        Role role = new Role();
        role.setRoleAlias("保安");
@@ -1075,14 +1066,124 @@
        user.setRoleId(oneRole.getId().toString());
        user.setDispatch("1");
        user.setExaminationType("0");
        user.setCreateTime(new Date());
        user.setTenantId("000000");
        user.setAccount(user.getCardid());
        // 用户校验
        userCheck(user);
        // 保安员证校验
        boolean state = securityPaperCheck(user);
        // 指纹设置
        fingerprintSet(user);
        //密码加密
        if (Func.isNotEmpty(user.getCardid())) {
//            user.setPassword(DigestUtil.encrypt(user.getPassword()));
            //取身份证号码后6位作为密码
            user.setPassword(DigestUtil.encrypt(user.getCardid().substring(user.getCardid().length() - 6)));
        }
        //用户新增
        boolean status = userService.save(user);
        // 用户详情信息新增
        if (status){
            userDetailEntity.setUserId(user.getId());
            // 新增
            userDetailService.save(userDetailEntity);
        }
        //从业记录新增
        experienceSave(user);
        //判断是否持证是否为空
        if (!state) {
            return R.data(201, null, "保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
        }
        return R.data(200,null,"新增成功!");
    }
    /**
     * 指纹设置
     * @param user
     * @throws Exception
     */
    private void fingerprintSet(User user) throws Exception {
        String url = "";
        if (null != user.getFingerprint() && !user.getFingerprint().equals("")) {
            if (user.getFingerprint().length() > 100) {
                String s = uploadBase64String(user);
                String[] split = s.split(",");
                user.setFingerprint(split[0]);
                url = split[1];
            }
        }
    }
    /**
     * 保安员证校验
     * @param user
     * @return
     */
    private boolean securityPaperCheck(User user) {
        boolean state = false;
        if (user.getHold().equals("1")){
            //持证,校验保安证编号是否合法
            SecurityPaper securityPaper = new SecurityPaper();
            securityPaper.setIdCardNo(user.getCardid());
            List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper));
            if (securityPaperList.size()>0){
                //遍历
                for (SecurityPaper paper : securityPaperList) {
                    if (paper.getNumber().equals(user.getSecuritynumber())){
                        state = true;
                    }
                }
                if (!state){
                    user.setHold("2");
                    user.setSecuritynumber(null);
                }
            }else {
                user.setHold("2");
                user.setSecuritynumber(null);
            }
        }else {
            state = true;
        }
        return state;
    }
    /**
     * 从业记录新增
     * @param user
     */
    public void experienceSave(User user) {
        //从业记录新增
        Experience experience = new Experience();
        String rtime;
        String paperTime;
        if (user.getRtime() == null) {
            rtime = null;
        } else {
            rtime = new SimpleDateFormat("yyyy-MM-dd").format(user.getRtime());
            experience.setEntrytime(user.getRtime());
        }
        Dept dept = iDeptService.getById(user.getDeptId());
        experience.setCardid(user.getCardid());
        experience.setSecurityid(user.getId().toString());
        experience.setCompanyname(dept.getDeptName());
        experience.setName(user.getRealName());
        experience.setPost("保安员");
        experienceService.save(experience);
    }
    /**
     * 用户校验
     * @param user
     */
    public void userCheck(User user) {
        User user1 = new User();
        user1.setIsDeleted(0);
        user1.setStatus(1);
        user1.setAccount(user.getCardid());
        List<User> list = userService.list(Condition.getQueryWrapper(user1));
        // 判断校验
        if (list.size() > 0 && Func.isEmpty(user.getId())) {
            if (null != user.getCell() && !user.getCell().equals("")) {
                if (user.getCell().equals("2")) {
@@ -1113,91 +1214,6 @@
                throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
            }
        }
        //判断是否持证
        boolean state = false;
        if (user.getHold().equals("1")){
            //持证,校验保安证编号是否合法
            SecurityPaper securityPaper = new SecurityPaper();
            securityPaper.setIdCardNo(user.getCardid());
            List<SecurityPaper> securityPaperList = securityPaperService.list(Condition.getQueryWrapper(securityPaper));
            if (securityPaperList.size()>0){
                //遍历
                for (SecurityPaper paper : securityPaperList) {
                    if (paper.getNumber().equals(user.getSecuritynumber())){
                        state = true;
                    }
                }
                if (!state){
                    user.setHold("2");
                    user.setSecuritynumber(null);
                }
            }else {
                user.setHold("2");
                user.setSecuritynumber(null);
            }
        }else {
            state = true;
        }
        String url = "";
        if (null != user.getFingerprint() && !user.getFingerprint().equals("")) {
            if (user.getFingerprint().length() > 100) {
                String s = uploadBase64String(user);
                String[] split = s.split(",");
                user.setFingerprint(split[0]);
                url = split[1];
            }
        }
        //密码加密
        if (Func.isNotEmpty(user.getCardid())) {
//            user.setPassword(DigestUtil.encrypt(user.getPassword()));
            //取身份证号码后6位作为密码
            user.setPassword(DigestUtil.encrypt(user.getCardid().substring(user.getCardid().length() - 6)));
        }
        user.setCreateTime(new Date());
        user.setTenantId("000000");
        //用户新增
        boolean status = userService.save(user);
        //从业记录新增
        Experience experience = new Experience();
        String rtime;
        String paperTime;
        if (user.getRtime() == null) {
            rtime = null;
        } else {
            rtime = new SimpleDateFormat("yyyy-MM-dd").format(user.getRtime());
            experience.setEntrytime(user.getRtime());
        }
        Dept dept = iDeptService.getById(user.getDeptId());
        experience.setCardid(user.getCardid());
        experience.setSecurityid(user.getId().toString());
        experience.setCompanyname(dept.getDeptName());
        experience.setName(user.getRealName());
        experience.setPost("保安员");
        experienceService.save(experience);
        //发证日期处理
//        if (user.getPaperTime() == null) {
//            paperTime = "";
//        } else {
//            paperTime = new SimpleDateFormat("yyyy-MM-dd").format(user.getPaperTime());
//        }
        //头像
        if (null != user.getAvatar() && !user.getAvatar().equals("")) {
            user.setAvatar(FtpConfig.ip + user.getAvatar().substring(26));
        }
        //判断是否持证是否为空
        if (!state) {
            return R.data(201, null, "保安证编号不匹配,请核实!也可通过提供保安证件信息提交核实申请!");
        }
        return R.data(200,null,"新增成功!");
    }
    /**
@@ -1314,14 +1330,20 @@
     */
    @GetMapping("/details")
    public R details(User user) {
        User user1 = userService.getById(user.getId());
        if (null != user1.getFingerprint() && !user1.getFingerprint().equals("")) {
            //url 转base64
            String base64Url = ImageUtils.imageUrlToBase64(user1.getFingerprint());
            System.out.println("base64Url = " + base64Url);
            user1.setFingerprint(base64Url);
        UserVO userInfo = userService.getUserDetailById(user.getId());
        // 查询对应的详情信息
        if (null!=userInfo){
            QueryWrapper<UserDetailEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("user_id",userInfo.getId()).eq("is_deleted",0);
            UserDetailEntity one = userDetailService.getOne(wrapper);
            userInfo.setUserDetail(one);
        }
        return R.data(user1);
        if (null != userInfo.getFingerprint() && !userInfo.getFingerprint().equals("")) {
            //url 转base64
            String base64Url = ImageUtils.imageUrlToBase64(userInfo.getFingerprint());
            userInfo.setFingerprint(base64Url);
        }
        return R.data(userInfo);
    }
src/main/java/org/springblade/modules/system/controller/UserDetailController.java
New file
@@ -0,0 +1,126 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.vo.UserDetailVO;
import org.springblade.modules.system.wrapper.UserDetailWrapper;
import org.springblade.modules.system.service.IUserDetailService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 用户详情表 控制器
 *
 * @author BladeX
 * @since 2023-11-30
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-userDetail/userDetail")
@Api(value = "用户详情表", tags = "用户详情表接口")
public class UserDetailController{
    private final IUserDetailService userDetailService;
    /**
     * 用户详情表 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入userDetail")
    public R<UserDetailVO> detail(UserDetailEntity userDetail) {
        UserDetailEntity detail = userDetailService.getOne(Condition.getQueryWrapper(userDetail));
        return R.data(UserDetailWrapper.build().entityVO(detail));
    }
    /**
     * 用户详情表 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入userDetail")
    public R<IPage<UserDetailVO>> list(UserDetailEntity userDetail, Query query) {
        IPage<UserDetailEntity> pages = userDetailService.page(Condition.getPage(query), Condition.getQueryWrapper(userDetail));
        return R.data(UserDetailWrapper.build().pageVO(pages));
    }
    /**
     * 用户详情表 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入userDetail")
    public R<IPage<UserDetailVO>> page(UserDetailVO userDetail, Query query) {
        IPage<UserDetailVO> pages = userDetailService.selectUserDetailPage(Condition.getPage(query), userDetail);
        return R.data(pages);
    }
    /**
     * 用户详情表 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入userDetail")
    public R save(@Valid @RequestBody UserDetailEntity userDetail) {
        return R.status(userDetailService.save(userDetail));
    }
    /**
     * 用户详情表 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入userDetail")
    public R update(@Valid @RequestBody UserDetailEntity userDetail) {
        return R.status(userDetailService.updateById(userDetail));
    }
    /**
     * 用户详情表 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入userDetail")
    public R submit(@Valid @RequestBody UserDetailEntity userDetail) {
        return R.status(userDetailService.saveOrUpdate(userDetail));
    }
    /**
     * 用户详情表 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(userDetailService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/system/dto/UserDetailDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.dto;
import org.springblade.modules.system.entity.UserDetailEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 用户详情表 数据传输对象实体类
 *
 * @author BladeX
 * @since 2023-11-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserDetailDTO extends UserDetailEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/system/entity/UserDetailEntity.java
New file
@@ -0,0 +1,145 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
 * 用户详情表 实体类
 *
 * @author BladeX
 * @since 2023-11-30
 */
@Data
@TableName("blade_user_detail")
@ApiModel(value = "UserDetail对象", description = "用户详情表")
public class UserDetailEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Long userId;
    /**
     * 婚姻状态
     */
    @ApiModelProperty(value = "婚姻状态")
    private Integer marriageStatus;
    /**
     * 报考等级
     */
    @ApiModelProperty(value = "报考等级")
    private Integer signLevel;
    /**
     * 户籍地址
     */
    @ApiModelProperty(value = "户籍地址")
    private String permanentResidenceAddress;
    /**
     * 居住地址
     */
    @ApiModelProperty(value = "居住地址")
    private String dwellAddress;
    /**
     * 家庭主要成员及联系方式
     */
    @ApiModelProperty(value = "家庭主要成员及联系方式")
    private String memberOfFamily;
    /**
     * 工作经历
     */
    @ApiModelProperty(value = "工作经历")
    private String workExperience;
    /**
     * 教育经历
     */
    @ApiModelProperty(value = "教育经历")
    private String educationExperience;
    /**
     * 健康状况图片(健康证)
     */
    @ApiModelProperty(value = "健康状况图片(健康证)")
    private String healthCertificateUrl;
    /**
     * 无犯罪记录图片
     */
    @ApiModelProperty(value = "无犯罪记录图片")
    private String noCriminalRecordProveUrl;
    /**
     * 创建人
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty("创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createUser;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private Date createTime;
    /**
     * 更新人
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty("更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateUser;
    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("更新时间")
    private Date updateTime;
    /**
     * 是否删除
     */
    @TableLogic
    @ApiModelProperty("是否已删除 0:否  1:是")
    private Integer isDeleted;
}
src/main/java/org/springblade/modules/system/mapper/UserDetailMapper.java
New file
@@ -0,0 +1,43 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.mapper;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.vo.UserDetailVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 用户详情表 Mapper 接口
 *
 * @author BladeX
 * @since 2023-11-30
 */
public interface UserDetailMapper extends BaseMapper<UserDetailEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param userDetail
     * @return
     */
    List<UserDetailVO> selectUserDetailPage(IPage page, UserDetailVO userDetail);
}
src/main/java/org/springblade/modules/system/mapper/UserDetailMapper.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.system.mapper.UserDetailMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="userDetailResultMap" type="org.springblade.modules.system.entity.UserDetailEntity">
        <result column="id" property="id"/>
        <result column="user_id" property="userId"/>
        <result column="marriage_status" property="marriageStatus"/>
        <result column="sign_level" property="signLevel"/>
        <result column="permanent_residence_address" property="permanentResidenceAddress"/>
        <result column="dwell_address" property="dwellAddress"/>
        <result column="member_of_family" property="memberOfFamily"/>
        <result column="work_experience" property="workExperience"/>
        <result column="education_experience" property="educationExperience"/>
        <result column="health_certificate_url" property="healthCertificateUrl"/>
        <result column="no_criminal_record_prove_url" property="noCriminalRecordProveUrl"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectUserDetailPage" resultMap="userDetailResultMap">
        select * from blade_user_detail where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/system/mapper/UserMapper.java
@@ -304,4 +304,11 @@
     * @return
     */
    User getUserIsApply(@Param("id") Long id);
    /**
     * 自定义查询详情信息
     * @param id
     * @return
     */
    UserVO getUserDetailById(@Param("id") Long id);
}
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -1191,5 +1191,12 @@
        and br.role_alias = '保安'
    </select>
    <!--自定义查询详情信息-->
    <select id="getUserDetailById" resultType="org.springblade.modules.system.vo.UserVO">
        select bu.* from blade_user bu
        where bu.is_deleted = 0
        and bu.id = #{id}
    </select>
</mapper>
src/main/java/org/springblade/modules/system/service/IUserDetailService.java
New file
@@ -0,0 +1,26 @@
package org.springblade.modules.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.vo.UserDetailVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 用户详情表 服务类
 *
 * @author BladeX
 * @since 2023-11-30
 */
public interface IUserDetailService extends IService<UserDetailEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param userDetail
     * @return
     */
    IPage<UserDetailVO> selectUserDetailPage(IPage<UserDetailVO> page, UserDetailVO userDetail);
}
src/main/java/org/springblade/modules/system/service/IUserService.java
@@ -418,4 +418,11 @@
     * @return
     */
    boolean getUserIsApply(Long id);
    /**
     * 自定义查询详情信息
     * @param id
     * @return
     */
    UserVO getUserDetailById(Long id);
}
src/main/java/org/springblade/modules/system/service/impl/UserDetailServiceImpl.java
New file
@@ -0,0 +1,25 @@
package org.springblade.modules.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.vo.UserDetailVO;
import org.springblade.modules.system.mapper.UserDetailMapper;
import org.springblade.modules.system.service.IUserDetailService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 用户详情表 服务实现类
 *
 * @author BladeX
 * @since 2023-11-30
 */
@Service
public class UserDetailServiceImpl extends ServiceImpl<UserDetailMapper, UserDetailEntity> implements IUserDetailService {
    @Override
    public IPage<UserDetailVO> selectUserDetailPage(IPage<UserDetailVO> page, UserDetailVO userDetail) {
        return page.setRecords(baseMapper.selectUserDetailPage(page, userDetail));
    }
}
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -2061,4 +2061,14 @@
        }
        return false;
    }
    /**
     * 自定义查询详情信息
     * @param id
     * @return
     */
    @Override
    public UserVO getUserDetailById(Long id) {
        return baseMapper.getUserDetailById(id);
    }
}
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
New file
@@ -0,0 +1,35 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.vo;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 用户详情表 视图实体类
 *
 * @author BladeX
 * @since 2023-11-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserDetailVO extends UserDetailEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/system/vo/UserVO.java
@@ -23,6 +23,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserDetailEntity;
/**
 * 视图实体类
@@ -174,4 +175,9 @@
     * 年龄段类型 1:18-30周岁  2:30-45周岁  3:45-60周岁  4:全部
     */
    private Integer ageType;
    /**
     * 用户详情
     */
    private UserDetailEntity userDetail = new UserDetailEntity();
}
src/main/java/org/springblade/modules/system/wrapper/UserDetailWrapper.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.system.entity.UserDetailEntity;
import org.springblade.modules.system.vo.UserDetailVO;
import java.util.Objects;
/**
 * 用户详情表 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2023-11-30
 */
public class UserDetailWrapper extends BaseEntityWrapper<UserDetailEntity, UserDetailVO>  {
    public static UserDetailWrapper build() {
        return new UserDetailWrapper();
     }
    @Override
    public UserDetailVO entityVO(UserDetailEntity userDetail) {
        UserDetailVO userDetailVO = Objects.requireNonNull(BeanUtil.copy(userDetail, UserDetailVO.class));
        //User createUser = UserCache.getUser(userDetail.getCreateUser());
        //User updateUser = UserCache.getUser(userDetail.getUpdateUser());
        //userDetailVO.setCreateUserName(createUser.getName());
        //userDetailVO.setUpdateUserName(updateUser.getName());
        return userDetailVO;
    }
}