电子档案下所有模块的创建档案新增接口代码优化

new
parent 2b3506f455
commit f4074fdd92

@ -93,20 +93,6 @@ public class AccountingBookController {
return "上传失败"; 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") @GetMapping("/downloadXml")
@Operation(summary = "获得分页Xml") @Operation(summary = "获得分页Xml")
@PreAuthorize("@ss.hasPermission('archives:accounting-book:query')") @PreAuthorize("@ss.hasPermission('archives:accounting-book:query')")

@ -82,19 +82,6 @@ public class AccountingReportController {
return CommonResult.error("上传失败"); 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") @PutMapping("/update")
@Operation(summary = "更新会计报表") @Operation(summary = "更新会计报表")
@PreAuthorize("@ss.hasPermission('archives:accounting-report:update')") @PreAuthorize("@ss.hasPermission('archives:accounting-report:update')")

@ -4,7 +4,9 @@ import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -40,49 +42,46 @@ public class ElectronicAssetsServiceImpl implements ElectronicAssetsService {
@Resource @Resource
private ElectronicAssetsMapper electronicAssetsMapper; private ElectronicAssetsMapper electronicAssetsMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private DepotMapper depotMapper;
@Resource
private DepotCabinetMapper depotCabinetMapper;
@Resource
private AdminUserMapper userMapper;
@Override @Override
public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) { public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ GetPositionUtils getPositionUtils = new GetPositionUtils();
GetElectronicDept getElectronicDept = new GetElectronicDept();
createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); 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); ElectronicAssetsDO electronicAssets = ElectronicAssetsConvert.INSTANCE.convert(createReqVO);
Long organizationId = createReqVO.getOrganizationId(); // Long organizationId = createReqVO.getOrganizationId();
Long depotId = createReqVO.getDepotId(); // Long depotId = createReqVO.getDepotId();
Long cabinetId = createReqVO.getCabinetId(); // Long cabinetId = createReqVO.getCabinetId();
OrganizationDO organizationDO = organizationMapper.selectById(organizationId); // OrganizationDO organizationDO = organizationMapper.selectById(organizationId);
DepotDO depotDO = depotMapper.selectById(depotId); // DepotDO depotDO = depotMapper.selectById(depotId);
DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); // DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId);
String position=""; // String position="";
if (organizationDO != null){ // if (organizationDO != null){
position=position+organizationDO.getOrganizationName(); // position=position+organizationDO.getOrganizationName();
if (depotDO != null){ // if (depotDO != null){
position=position+"/"+depotDO.getName(); // position=position+"/"+depotDO.getName();
if (depotCabinetDO != null){ // if (depotCabinetDO != null){
position= position+"/"+depotCabinetDO.getName(); // position= position+"/"+depotCabinetDO.getName();
}else { // }else {
position= position+"/默认档案柜"; // position= position+"/默认档案柜";
} // }
}else { // }else {
position=position+"/默认库房/默认档案柜"; // position=position+"/默认库房/默认档案柜";
} // }
} // }
electronicAssets.setPosition(position); // electronicAssets.setPosition(position);
//
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); // AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId());
electronicAssets.setCreateBy(adminUserDO.getUsername()); // electronicAssets.setCreateBy(adminUserDO.getUsername());
electronicAssetsMapper.insert(electronicAssets); electronicAssetsMapper.insert(electronicAssets);
// 返回 // 返回
return electronicAssets.getId(); return electronicAssets.getId();

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.ea.service.electronicconsultation;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -39,49 +41,18 @@ public class ElectronicConsultationServiceImpl implements ElectronicConsultation
@Resource @Resource
private ElectronicConsultationMapper electronicConsultationMapper; private ElectronicConsultationMapper electronicConsultationMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private DepotMapper depotMapper;
@Resource
private DepotCabinetMapper depotCabinetMapper;
@Resource
private AdminUserMapper userMapper;
@Override @Override
public Long createElectronicConsultation(ElectronicConsultationCreateReqVO createReqVO) { public Long createElectronicConsultation(ElectronicConsultationCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){
GetElectronicDept getElectronicDept = new GetElectronicDept(); GetPositionUtils getPositionUtils = new GetPositionUtils();
createReqVO.setSystemDept(getElectronicDept.getDeptName(createReqVO.getDeptId()));
} 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); 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); electronicConsultationMapper.insert(electronicConsultation);
// 返回 // 返回
return electronicConsultation.getId(); return electronicConsultation.getId();

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.ea.service.electroniccontracts;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -51,37 +53,17 @@ public class ElectronicContractsServiceImpl implements ElectronicContractsServic
@Override @Override
public Long createElectronicContracts(ElectronicContractsCreateReqVO createReqVO) { public Long createElectronicContracts(ElectronicContractsCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){
GetElectronicDept getElectronicDept = new GetElectronicDept(); GetPositionUtils getPositionUtils = new GetPositionUtils();
createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId()));
} 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); 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); electronicContractsMapper.insert(electronicContracts);
// 返回 // 返回
return electronicContracts.getId(); return electronicContracts.getId();

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.ea.service.electroniccustomercomplaint;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -51,37 +53,14 @@ public class ElectronicCustomerComplaintServiceImpl implements ElectronicCustome
@Override @Override
public Long createElectronicCustomerComplaint(ElectronicCustomerComplaintCreateReqVO createReqVO) { public Long createElectronicCustomerComplaint(ElectronicCustomerComplaintCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ GetPositionUtils getPositionUtils = new GetPositionUtils();
GetElectronicDept getElectronicDept = new GetElectronicDept(); GetPositionDo positionDo = getPositionUtils.getPosition(
createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId());
}
createReqVO.setPosition(positionDo.getPosition())
.setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName());
// 插入 // 插入
ElectronicCustomerComplaintDO electronicCustomerComplaint = ElectronicCustomerComplaintConvert.INSTANCE.convert(createReqVO); 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); electronicCustomerComplaintMapper.insert(electronicCustomerComplaint);
// 返回 // 返回
return electronicCustomerComplaint.getId(); return electronicCustomerComplaint.getId();

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.ea.service.electronicemployee;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -50,37 +52,14 @@ public class ElectronicEmployeeServiceImpl implements ElectronicEmployeeService
@Override @Override
public Long createElectronicEmployee(ElectronicEmployeeCreateReqVO createReqVO) { public Long createElectronicEmployee(ElectronicEmployeeCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ GetPositionUtils getPositionUtils = new GetPositionUtils();
GetElectronicDept getElectronicDept = new GetElectronicDept(); GetPositionDo positionDo = getPositionUtils.getPosition(
createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId());
}
createReqVO.setPosition(positionDo.getPosition())
.setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName());
// 插入 // 插入
ElectronicEmployeeDO electronicEmployee = ElectronicEmployeeConvert.INSTANCE.convert(createReqVO); 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); electronicEmployeeMapper.insert(electronicEmployee);
// 返回 // 返回
return electronicEmployee.getId(); return electronicEmployee.getId();

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.ea.service.electronicother;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; 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.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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
@ -51,37 +53,14 @@ public class ElectronicOtherServiceImpl implements ElectronicOtherService {
@Override @Override
public Long createElectronicOther(ElectronicOtherCreateReqVO createReqVO) { public Long createElectronicOther(ElectronicOtherCreateReqVO createReqVO) {
if (ObjectUtil.isNotNull(createReqVO.getDeptId())){ GetPositionUtils getPositionUtils = new GetPositionUtils();
GetElectronicDept getElectronicDept = new GetElectronicDept(); GetPositionDo positionDo = getPositionUtils.getPosition(
createReqVO.setDeptName(getElectronicDept.getDeptName(createReqVO.getDeptId())); createReqVO.getOrganizationId(), createReqVO.getDepotId(), createReqVO.getCabinetId(), createReqVO.getDeptId());
}
createReqVO.setSource(positionDo.getPosition())
.setCreateBy(positionDo.getCreateBy()).setDeptName(positionDo.getDeptName());
// 插入 // 插入
ElectronicOtherDO electronicOther = ElectronicOtherConvert.INSTANCE.convert(createReqVO); 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); electronicOtherMapper.insert(electronicOther);
// 返回 // 返回
return electronicOther.getId(); return electronicOther.getId();

@ -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;
}

@ -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;
}
}
Loading…
Cancel
Save