电子档案下所有模块的创建档案新增接口代码优化
parent
2b3506f455
commit
f4074fdd92
@ -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…
Reference in New Issue