From 6af0da03bbea71b4f8b21477bded05f2e1cd04fb Mon Sep 17 00:00:00 2001 From: "LAPTOP-0SF788NU\\admin" <3306174053@qq.com> Date: Tue, 31 Oct 2023 15:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C,=E5=91=98=E5=B7=A5,=E5=AE=A2?= =?UTF-8?q?=E8=AF=89,=E5=92=A8=E8=AF=A2,=E8=B5=84=E4=BA=A7=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E6=96=B0=E5=A2=9E=E9=83=A8=E9=97=A8=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/ElectronicConsultationCreateReqVO.java | 4 ++ ...lectronicCustomerComplaintCreateReqVO.java | 4 ++ .../vo/ElectronicEmployeeCreateReqVO.java | 7 ++++ .../ElectronicAssetsServiceImpl.java | 7 ++++ .../ElectronicConsultationServiceImpl.java | 6 +++ .../ElectronicContractsServiceImpl.java | 6 +++ ...lectronicCustomerComplaintServiceImpl.java | 6 +++ .../ElectronicEmployeeServiceImpl.java | 6 +++ .../ElectronicOtherServiceImpl.java | 6 +++ .../ea/utils/common/GetElectronicDept.java | 38 +++++++++++++++++++ 10 files changed, 90 insertions(+) create mode 100644 yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetElectronicDept.java diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicconsultation/vo/ElectronicConsultationCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicconsultation/vo/ElectronicConsultationCreateReqVO.java index 3ef33f5c..e812416c 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicconsultation/vo/ElectronicConsultationCreateReqVO.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicconsultation/vo/ElectronicConsultationCreateReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.ea.controller.admin.electronicconsultation.vo; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -11,4 +12,7 @@ import javax.validation.constraints.*; @ToString(callSuper = true) public class ElectronicConsultationCreateReqVO extends ElectronicConsultationBaseVO { + @Schema(description = "部门Id", example = "部门Id") + @TableField(exist = false) + private Long deptId; } diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccustomercomplaint/vo/ElectronicCustomerComplaintCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccustomercomplaint/vo/ElectronicCustomerComplaintCreateReqVO.java index e06a3eb3..7c56bcfc 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccustomercomplaint/vo/ElectronicCustomerComplaintCreateReqVO.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electroniccustomercomplaint/vo/ElectronicCustomerComplaintCreateReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.ea.controller.admin.electroniccustomercomplaint.vo; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -11,4 +12,7 @@ import javax.validation.constraints.*; @ToString(callSuper = true) public class ElectronicCustomerComplaintCreateReqVO extends ElectronicCustomerComplaintBaseVO { + @Schema(description = "部门Id", example = "部门Id") + @TableField(exist = false) + private Long deptId; } diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java index a1ee752b..563e089c 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/controller/admin/electronicemployee/vo/ElectronicEmployeeCreateReqVO.java @@ -1,10 +1,13 @@ package cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.*; import java.time.LocalDate; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.experimental.Accessors; + import javax.validation.constraints.*; /** @@ -97,4 +100,8 @@ public class ElectronicEmployeeCreateReqVO extends ElectronicEmployeeBaseVO { @Schema(description = "特长", example = "你说的对") private String personalDescription; + @Schema(description = "部门Id", example = "部门Id") + @TableField(exist = false) + private Long deptId; + } diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java index dd4543c3..08daed62 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicassets/ElectronicAssetsServiceImpl.java @@ -1,7 +1,10 @@ package cn.iocoder.yudao.module.ea.service.electronicassets; +import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -49,6 +52,10 @@ public class ElectronicAssetsServiceImpl implements ElectronicAssetsService { @Override public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicAssetsDO electronicAssets = ElectronicAssetsConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicconsultation/ElectronicConsultationServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicconsultation/ElectronicConsultationServiceImpl.java index 49f2f70a..a3d32d04 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicconsultation/ElectronicConsultationServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicconsultation/ElectronicConsultationServiceImpl.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.ea.service.electronicconsultation; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -49,6 +51,10 @@ public class ElectronicConsultationServiceImpl implements ElectronicConsultation @Override public Long createElectronicConsultation(ElectronicConsultationCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setSystemDept(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicConsultationDO electronicConsultation = ElectronicConsultationConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java index ccc5d4d3..31d1500a 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccontracts/ElectronicContractsServiceImpl.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.ea.service.electroniccontracts; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -49,6 +51,10 @@ public class ElectronicContractsServiceImpl implements ElectronicContractsServic @Override public Long createElectronicContracts(ElectronicContractsCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicContractsDO electronicContracts = ElectronicContractsConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccustomercomplaint/ElectronicCustomerComplaintServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccustomercomplaint/ElectronicCustomerComplaintServiceImpl.java index 48a582c2..925ae86f 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccustomercomplaint/ElectronicCustomerComplaintServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electroniccustomercomplaint/ElectronicCustomerComplaintServiceImpl.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.ea.service.electroniccustomercomplaint; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -49,6 +51,10 @@ public class ElectronicCustomerComplaintServiceImpl implements ElectronicCustome @Override public Long createElectronicCustomerComplaint(ElectronicCustomerComplaintCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicCustomerComplaintDO electronicCustomerComplaint = ElectronicCustomerComplaintConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java index 23511971..663a36c7 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicemployee/ElectronicEmployeeServiceImpl.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.ea.service.electronicemployee; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -48,6 +50,10 @@ public class ElectronicEmployeeServiceImpl implements ElectronicEmployeeService @Override public Long createElectronicEmployee(ElectronicEmployeeCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicEmployeeDO electronicEmployee = ElectronicEmployeeConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java index 1440badb..a1245fd9 100644 --- a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/service/electronicother/ElectronicOtherServiceImpl.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.ea.service.electronicother; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; @@ -49,6 +51,10 @@ public class ElectronicOtherServiceImpl implements ElectronicOtherService { @Override public Long createElectronicOther(ElectronicOtherCreateReqVO createReqVO) { + if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); + } // 插入 ElectronicOtherDO electronicOther = ElectronicOtherConvert.INSTANCE.convert(createReqVO); Long organizationId = createReqVO.getOrganizationId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetElectronicDept.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetElectronicDept.java new file mode 100644 index 00000000..e0da0d4a --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetElectronicDept.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.ea.utils.common; + +import cn.hutool.extra.spring.SpringUtil; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +/** + * 公共获取所属部门 + */ +public class GetElectronicDept { + + @Resource + private DeptService deptService = SpringUtil.getBean(DeptService.class); + + /** 获取部门管理 Tree形结构的部门名称 + * dept 一级部门 + * dept1 二级部门 + * dept2 三级部门 + * @param deptId + * @return 拼接 + */ + public String getDeptName(Long deptId){ + DeptDO dept = deptService.getDept(deptId); + if (dept.getParentId()==0){ + return dept.getName(); + } + DeptDO dept1 = deptService.getDept(dept.getParentId()); + if (dept1.getParentId()==0){ + return dept1.getName()+"/"+dept.getName(); + } + DeptDO dept2 = deptService.getDept(dept1.getParentId()); + return dept2.getName()+"/"+dept1.getName()+"/"+dept.getName(); + } +}