From 3d4d5d1c2aa03020f5a75fad1023b1dd3fceffe8 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Thu, 8 Aug 2024 20:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AE=A1=E7=90=86-=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/common/BaseConstants.java | 8 + .../common/CommonErrorCodeConstants.java | 10 + .../service/impl/CompanyStaffServiceImpl.java | 97 ----- .../module/company/vo/CompanyStaffReqVO.java | 13 - .../admin/CompanyStaffChangeController.java | 53 +++ .../admin/CompanyStaffController.java | 43 ++- .../entity/CompanyStaff.java | 14 +- .../staff/entity/CompanyStaffChange.java | 44 +++ .../yudao/module/staff/entity/UniqueCode.java | 22 ++ .../mapper/CompanyStaffChangeMapper.java | 14 + .../mapper/CompanyStaffMapper.java | 6 +- .../module/staff/mapper/UniqueCodeMapper.java | 14 + .../service/CompanyStaffChangeService.java | 31 ++ .../service/CompanyStaffService.java | 23 +- .../staff/service/UniqueCodeService.java | 21 ++ .../impl/CompanyStaffChangeServiceImpl.java | 64 ++++ .../service/impl/CompanyStaffServiceImpl.java | 350 ++++++++++++++++++ .../service/impl/UniqueCodeServiceImpl.java | 30 ++ .../staff/vo/CompanyStaffChangeReqVO.java | 13 + .../staff/vo/CompanyStaffChangeRespVO.java | 20 + .../module/staff/vo/CompanyStaffReqVO.java | 27 ++ .../vo/CompanyStaffRespVO.java | 9 +- .../mapper/company/CompanyStaffMapper.xml | 9 - .../mapper/staff/CompanyStaffChangeMapper.xml | 6 + .../mapper/staff/CompanyStaffMapper.xml | 81 ++++ .../mapper/staff/UniqueCodeMapper.xml | 6 + 26 files changed, 872 insertions(+), 156 deletions(-) create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java delete mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyStaffServiceImpl.java delete mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/company/vo/CompanyStaffReqVO.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffChangeController.java rename dl-module-company/src/main/java/cn/iocoder/yudao/module/{company => staff}/controller/admin/CompanyStaffController.java (79%) rename dl-module-company/src/main/java/cn/iocoder/yudao/module/{company => staff}/entity/CompanyStaff.java (80%) create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/CompanyStaffChange.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/UniqueCode.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/CompanyStaffChangeMapper.java rename dl-module-company/src/main/java/cn/iocoder/yudao/module/{company => staff}/mapper/CompanyStaffMapper.java (76%) create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/mapper/UniqueCodeMapper.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/CompanyStaffChangeService.java rename dl-module-company/src/main/java/cn/iocoder/yudao/module/{company => staff}/service/CompanyStaffService.java (71%) create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/UniqueCodeService.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffChangeServiceImpl.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/UniqueCodeServiceImpl.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffChangeReqVO.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffChangeRespVO.java create mode 100644 dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/vo/CompanyStaffReqVO.java rename dl-module-company/src/main/java/cn/iocoder/yudao/module/{company => staff}/vo/CompanyStaffRespVO.java (69%) delete mode 100644 dl-module-company/src/main/resources/mapper/company/CompanyStaffMapper.xml create mode 100644 dl-module-company/src/main/resources/mapper/staff/CompanyStaffChangeMapper.xml create mode 100644 dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml create mode 100644 dl-module-company/src/main/resources/mapper/staff/UniqueCodeMapper.xml diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java index 44f87724..a1cb7160 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java @@ -23,4 +23,12 @@ public class BaseConstants { public static final String PASSWORD_DEFAULT = "123456"; /**租户下部门名称*/ public static final String DEPT_NAME_CORP_NAME = "政企客户"; + /**企业管理-员工管理表名称*/ + public static final String COMPANY_STAFF = "company_staff"; + /**员工标识*/ + public static final String COMPANY_SING_STAFF = "staff"; + /** 标签默认外观 */ + public static final String LABEL_TYPE = "default"; + /** 唯一推广码生成长度 */ + public static final Integer UNIQUE_CODE_LEN = 6; } diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java new file mode 100644 index 00000000..5032d26f --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/CommonErrorCodeConstants.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.common; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants; + +public interface CommonErrorCodeConstants extends ErrorCodeConstants { + + /** 企业管理-员工管理 */ + ErrorCode UNIQUE_CODE_CREATE_REPEAT = new ErrorCode(2_002_000_000, "唯一推广码生成失败"); +} diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyStaffServiceImpl.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyStaffServiceImpl.java deleted file mode 100644 index b76b62d8..00000000 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyStaffServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package cn.iocoder.yudao.module.company.service.impl; - -import cn.iocoder.yudao.framework.security.core.LoginUser; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; -import cn.iocoder.yudao.module.label.entity.Label; -import cn.iocoder.yudao.module.label.service.LabelService; -import cn.iocoder.yudao.module.company.entity.CompanyStaff; -import cn.iocoder.yudao.module.company.mapper.CompanyStaffMapper; -import cn.iocoder.yudao.module.company.service.CompanyStaffService; -import cn.iocoder.yudao.module.company.vo.CompanyStaffReqVO; -import cn.iocoder.yudao.module.company.vo.CompanyStaffRespVO; -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; -import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; -import com.baomidou.dynamic.datasource.annotation.DSTransactional; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 企业管理-员工信息表 服务实现类 - * @author 小李 - * @date 16:29 2024/8/6 - **/ -@Service -public class CompanyStaffServiceImpl extends ServiceImpl implements CompanyStaffService { - - @Resource - private CompanyStaffMapper staffMapper; - - @Resource - private AdminUserApi adminUserApi; - - @Resource - private LabelService labelService; - /** - * 获得企业管理-员工信息表分页 - * @author 小李 - * @date 17:11 2024/8/6 - * @param pageReqVO 分页查询 - * @param page 分页对象 - **/ - @Override - public IPage queryListPage(CompanyStaffReqVO pageReqVO, Page page) { - return staffMapper.selectListPage(pageReqVO, page); - } - - /** - * 新增企业管理-员工管理信息 - * @author 小李 - * @date 13:57 2024/8/7 - * @param staffRespVO 员工对象 - **/ - @Override - @DSTransactional - public void saveStaff(CompanyStaffRespVO staffRespVO) { - // 获取当前登录用户的信息 - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId()); - // 创建UserDTO用于给sys_user插入数据 - UserDTO userDTO = new UserDTO(); - userDTO.setUsername(staffRespVO.getLoginAccount()); - userDTO.setPassword(staffRespVO.getPassword()); - userDTO.setNickname(staffRespVO.getName()); - userDTO.setDeptId(user.getDeptId()); - userDTO.setMobile(staffRespVO.getTel()); - adminUserApi.createUser(userDTO); - // 获取sys_users中刚插入记录ID - Long id = userDTO.getId(); - - } - - @Override - public void updateStaff(CompanyStaffRespVO staffRespVO) { - - } - - @Override - public void deleteStaff(String id) { - - } - - /** - * 获取当前功能的标签 - * @author 小李 - * @date 14:59 2024/8/7 - **/ - @Override - public List