From f4074fdd922935cf7103fd25ef21c822abfe3e3e Mon Sep 17 00:00:00 2001 From: "LAPTOP-0SF788NU\\admin" <3306174053@qq.com> Date: Fri, 3 Nov 2023 11:10:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E6=A1=A3=E6=A1=88=E4=B8=8B?= =?UTF-8?q?=E6=89=80=E6=9C=89=E6=A8=A1=E5=9D=97=E7=9A=84=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AccountingBookController.java | 14 ---- .../AccountingReportController.java | 13 ---- .../ElectronicAssetsServiceImpl.java | 77 +++++++++---------- .../ElectronicConsultationServiceImpl.java | 49 +++--------- .../ElectronicContractsServiceImpl.java | 40 +++------- ...lectronicCustomerComplaintServiceImpl.java | 37 ++------- .../ElectronicEmployeeServiceImpl.java | 37 ++------- .../ElectronicOtherServiceImpl.java | 37 ++------- .../ea/utils/common/Do/GetPositionDo.java | 28 +++++++ .../ea/utils/common/GetPositionUtils.java | 71 +++++++++++++++++ 10 files changed, 182 insertions(+), 221 deletions(-) create mode 100644 yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/Do/GetPositionDo.java create mode 100644 yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetPositionUtils.java diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java index 8a8c8288..34de87b6 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java @@ -93,20 +93,6 @@ public class AccountingBookController { return "上传失败"; } - //TODO minio上传函数 后续封装为公用方法 - private String testExecuteUpload(S3FileClientConfig config,MultipartFile file) throws Exception { - // 校验配置 - ValidationUtils.validate(Validation.buildDefaultValidatorFactory().getValidator(), config); - // 创建 Client - S3FileClient client = new S3FileClient(0L, config); - client.init(); - // 上传文件 - String path = file.getOriginalFilename(); -// byte[] content = ResourceUtil.readBytes(file); - return client.upload(file.getBytes(), path, "xls/xlsx"); - } - - @GetMapping("/downloadXml") @Operation(summary = "获得分页Xml") @PreAuthorize("@ss.hasPermission('archives:accounting-book:query')") diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java index e67bcc56..9d1184c8 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java @@ -82,19 +82,6 @@ public class AccountingReportController { return CommonResult.error("上传失败"); } - //TODO minio上传函数 后续封装为公用方法 - private String testExecuteUpload(S3FileClientConfig config,MultipartFile file) throws Exception { - // 校验配置 - ValidationUtils.validate(Validation.buildDefaultValidatorFactory().getValidator(), config); - // 创建 Client - S3FileClient client = new S3FileClient(0L, config); - client.init(); - // 上传文件 - String path = file.getOriginalFilename(); -// byte[] content = ResourceUtil.readBytes(file); - return client.upload(file.getBytes(), path, "xls/xlsx"); - } - @PutMapping("/update") @Operation(summary = "更新会计报表") @PreAuthorize("@ss.hasPermission('archives:accounting-report:update')") 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 40f99ab1..ee24cc8b 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 @@ -4,7 +4,9 @@ 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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -40,49 +42,46 @@ public class ElectronicAssetsServiceImpl implements ElectronicAssetsService { @Resource private ElectronicAssetsMapper electronicAssetsMapper; - @Resource - private OrganizationMapper organizationMapper; - @Resource - private DepotMapper depotMapper; - @Resource - private DepotCabinetMapper depotCabinetMapper; - - @Resource - private AdminUserMapper userMapper; - @Override public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) { - if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ - GetElectronicDept getElectronicDept = new GetElectronicDept(); - createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); - } + GetPositionUtils getPositionUtils = new GetPositionUtils(); + + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setPosition(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName()); +// 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(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicAssets.setPosition(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicAssets.setCreateBy(adminUserDO.getUsername()); +// Long organizationId = createReqVO.getOrganizationId(); +// Long depotId = createReqVO.getDepotId(); +// Long cabinetId = createReqVO.getCabinetId(); +// OrganizationDO organizationDO = organizationMapper.selectById(organizationId); +// DepotDO depotDO = depotMapper.selectById(depotId); +// DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); +// String position=""; +// if (organizationDO != null){ +// position=position+organizationDO.getOrganizationName(); +// if (depotDO != null){ +// position=position+"/"+depotDO.getName(); +// if (depotCabinetDO != null){ +// position= position+"/"+depotCabinetDO.getName(); +// }else { +// position= position+"/默认档案柜"; +// } +// }else { +// position=position+"/默认库房/默认档案柜"; +// } +// } +// electronicAssets.setPosition(position); +// +// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); +// AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); +// electronicAssets.setCreateBy(adminUserDO.getUsername()); electronicAssetsMapper.insert(electronicAssets); // 返回 return electronicAssets.getId(); 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 3bbbeef8..3715ca9f 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 @@ -3,7 +3,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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -39,49 +41,18 @@ public class ElectronicConsultationServiceImpl implements ElectronicConsultation @Resource private ElectronicConsultationMapper electronicConsultationMapper; - @Resource - private OrganizationMapper organizationMapper; - @Resource - private DepotMapper depotMapper; - @Resource - private DepotCabinetMapper depotCabinetMapper; - - @Resource - private AdminUserMapper userMapper; - @Override public Long createElectronicConsultation(ElectronicConsultationCreateReqVO createReqVO) { - if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ - GetElectronicDept getElectronicDept = new GetElectronicDept(); - createReqVO.setSystemDept(getElectronicDept.getDeptName(createReqVO.getDeptId())); - } + + GetPositionUtils getPositionUtils = new GetPositionUtils(); + + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setPosition(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setSystemDept(positionDo.getDeptName()); // 插入 ElectronicConsultationDO electronicConsultation = ElectronicConsultationConvert.INSTANCE.convert(createReqVO); - Long organizationId = createReqVO.getOrganizationId(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicConsultation.setPosition(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicConsultation.setCreateBy(adminUserDO.getUsername()); electronicConsultationMapper.insert(electronicConsultation); // 返回 return electronicConsultation.getId(); 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 d4a497db..cb7df1c5 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 @@ -3,7 +3,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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -51,37 +53,17 @@ 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())); - } + + GetPositionUtils getPositionUtils = new GetPositionUtils(); + + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setPosition(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName()); + // 插入 ElectronicContractsDO electronicContracts = ElectronicContractsConvert.INSTANCE.convert(createReqVO); - Long organizationId = createReqVO.getOrganizationId(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicContracts.setPosition(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicContracts.setCreateBy(adminUserDO.getUsername()); electronicContractsMapper.insert(electronicContracts); // 返回 return electronicContracts.getId(); 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 c015f715..ae7cebd8 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 @@ -3,7 +3,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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -51,37 +53,14 @@ 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())); - } + GetPositionUtils getPositionUtils = new GetPositionUtils(); + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setPosition(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName()); // 插入 ElectronicCustomerComplaintDO electronicCustomerComplaint = ElectronicCustomerComplaintConvert.INSTANCE.convert(createReqVO); - Long organizationId = createReqVO.getOrganizationId(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicCustomerComplaint.setPosition(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicCustomerComplaint.setCreateBy(adminUserDO.getUsername()); electronicCustomerComplaintMapper.insert(electronicCustomerComplaint); // 返回 return electronicCustomerComplaint.getId(); 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 08744e03..38a11d65 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 @@ -3,7 +3,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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -50,37 +52,14 @@ 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())); - } + GetPositionUtils getPositionUtils = new GetPositionUtils(); + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setPosition(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName()); // 插入 ElectronicEmployeeDO electronicEmployee = ElectronicEmployeeConvert.INSTANCE.convert(createReqVO); - Long organizationId = createReqVO.getOrganizationId(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicEmployee.setPosition(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicEmployee.setCreateBy(adminUserDO.getUsername()); electronicEmployeeMapper.insert(electronicEmployee); // 返回 return electronicEmployee.getId(); 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 89d7399e..83d04cdc 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 @@ -3,7 +3,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.Do.GetPositionDo; import cn.iocoder.yudao.module.ea.utils.common.GetElectronicDept; +import cn.iocoder.yudao.module.ea.utils.common.GetPositionUtils; 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; @@ -51,37 +53,14 @@ 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())); - } + GetPositionUtils getPositionUtils = new GetPositionUtils(); + GetPositionDo positionDo = getPositionUtils.getPosition( + createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId()); + + createReqVO.setSource(positionDo.getPosition()) + .setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName()); // 插入 ElectronicOtherDO electronicOther = ElectronicOtherConvert.INSTANCE.convert(createReqVO); - Long organizationId = createReqVO.getOrganizationId(); - Long depotId = createReqVO.getDepotId(); - Long cabinetId = createReqVO.getCabinetId(); - OrganizationDO organizationDO = organizationMapper.selectById(organizationId); - DepotDO depotDO = depotMapper.selectById(depotId); - DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); - String position=""; - if (organizationDO != null){ - position=position+organizationDO.getOrganizationName(); - if (depotDO != null){ - position=position+"/"+depotDO.getName(); - if (depotCabinetDO != null){ - position= position+"/"+depotCabinetDO.getName(); - }else { - position= position+"/默认档案柜"; - } - }else { - position=position+"/默认库房/默认档案柜"; - } - } - electronicOther.setSource(position); - - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); - electronicOther.setCreateBy(adminUserDO.getUsername()); electronicOtherMapper.insert(electronicOther); // 返回 return electronicOther.getId(); diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/Do/GetPositionDo.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/Do/GetPositionDo.java new file mode 100644 index 00000000..9434d33f --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/Do/GetPositionDo.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.ea.utils.common.Do; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 获取纸档位置公共Do + */ +@Data +@Accessors(chain = true) +public class GetPositionDo { + + /** + * 纸档位置 + */ + private String position; + + /** + * 制单人 + */ + private String createBy; + + /** + * 部门名称 + */ + private String deptName; +} diff --git a/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetPositionUtils.java b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetPositionUtils.java new file mode 100644 index 00000000..0c12e68a --- /dev/null +++ b/yudao-module-electronic/yudao-module-ea-biz/src/main/java/cn/iocoder/yudao/module/ea/utils/common/GetPositionUtils.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.ea.utils.common; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.extra.spring.SpringUtil; +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.Do.GetPositionDo; +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; +import cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper; +import cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet.DepotCabinetMapper; +import cn.iocoder.yudao.module.setting.dal.mysql.organization.OrganizationMapper; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; + +import javax.annotation.Resource; + +public class GetPositionUtils { + + // 正常来说应该是用 server层引入 但是不想去用 + @Resource + private OrganizationMapper organizationMapper= SpringUtil.getBean(OrganizationMapper.class); + @Resource + private DepotMapper depotMapper= SpringUtil.getBean(DepotMapper.class); + @Resource + private DepotCabinetMapper depotCabinetMapper= SpringUtil.getBean(DepotCabinetMapper.class); + + @Resource + private AdminUserMapper userMapper= SpringUtil.getBean(AdminUserMapper.class); + + + /** + * + * @param organizationId 立档单位ID + * @param depotId 库房ID + * @param cabinetId 档案柜ID + * @param deptId 部门id + * @return + */ + public GetPositionDo getPosition(Long organizationId, Long depotId, Long cabinetId,Long deptId){ + GetPositionDo getPositionDo = new GetPositionDo(); + + if (ObjectUtil.isNotNull(deptId)){ + GetElectronicDept getElectronicDept = new GetElectronicDept(); + getPositionDo.setDeptName(getElectronicDept.getDeptName(deptId)); + } + + OrganizationDO organizationDO = organizationMapper.selectById(organizationId); + DepotDO depotDO = depotMapper.selectById(depotId); + DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); + String position=""; + if (organizationDO != null){ + position=position+organizationDO.getOrganizationName(); + if (depotDO != null){ + position=position+"/"+depotDO.getName(); + if (depotCabinetDO != null){ + position= position+"/"+depotCabinetDO.getName(); + }else { + position= position+"/默认档案柜"; + } + }else { + position=position+"/默认库房/默认档案柜"; + } + } + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + getPositionDo.setPosition(position).setCreateBy(userMapper.selectById(loginUser.getId()).getUsername()); + return getPositionDo; + } +}