1.前言
在现有的业务逻辑上增加,简历手动上传和插件上传的控制:
@Component
@Aspect
public class ResumeControAspectextends Observable {
private final static Loggerlogger = LoggerFactory.getLogger(ResumeControAspect.class);
//增加观察者
public ResumeControAspect(InResumeFlowObserver inResumeFlow, AlreadyEntryResumeObserver alreadyEntryResume, TalentResumeFlowObserver talentResumeFlow, ResumeOutObserver resumeOutObserver) {
this.addObserver(inResumeFlow);//流程中
this.addObserver(alreadyEntryResume);//已入职处理
this.addObserver(talentResumeFlow);//事业部人才库
this.addObserver(resumeOutObserver);
}
private ResumeOutVoresumeOutVo;
public void setResumeId(ResumeOutVo resumeOutVo) {
//增加入参
this.resumeOutVo = resumeOutVo;
//被观察的东西发生改变,
setChanged();
//唤醒观察者
notifyObservers(resumeOutVo);
}
@Autowired
private ResumeServiceresumeService;
@Before("excuteService()")
public void doBeforeMethod(JoinPoint joinPoint) {
Object[] obj = joinPoint.getArgs();
BaseResumeEntity baseResumeEntity =null;
SysLoginUserDTO sysLoginUserDTO =null;
ResumeAccessVo resumeAccessVo =null;
for (Object argItem : obj) {
if (argIteminstanceof BaseResumeEntity) {
baseResumeEntity = (BaseResumeEntity) argItem;
}
if (argIteminstanceof ResumeAccessVo) {
resumeAccessVo = (ResumeAccessVo) argItem;
}
if (argIteminstanceof SysLoginUserDTO) {
sysLoginUserDTO = (SysLoginUserDTO) argItem;
}
}
if (sysLoginUserDTO.getBussDeptId()==null){
throw new CustomException("登录用户事业部信息异常");
}
/***********************************************简历上传****************************************************************************/
//判断是不是在该事业部人才库中 phone +buss_dept_id
if (baseResumeEntity !=null && sysLoginUserDTO !=null) {
List bussIds = sysLoginUserDTO.getAccessibleDeptIds();
//根据部门ID和手机号判断是否已存在
List resumeOutVos =resumeService.selectIdByPhone(baseResumeEntity.getPhone(), bussIds);
if (resumeOutVos!=null && resumeOutVos.size()>0){
List collect = resumeOutVos.stream().filter(t -> t.getState().equals(StateEnum.FLOW.getCode())).collect(Collectors.toList());
if (collect.size()>0){
collect.get(0).setOperUserId(sysLoginUserDTO.getId());
collect.get(0).setBaseResumeEntity(baseResumeEntity);
for (Object argItem : obj) {
if (argIteminstanceof BaseResumeEntity) {
baseResumeEntity = (BaseResumeEntity) argItem;
//在流程中的简历需要继续往下走 其他的直接返回
baseResumeEntity.setIsContinue(!StateEnum.FLOW.getCode().equals(collect.get(0).getState())?false:true);
}
}
//唤醒观察者
setResumeId(collect.get(0));
}else{
resumeOutVos.get(0).setOperUserId(sysLoginUserDTO.getId());
resumeOutVos.get(0).setBaseResumeEntity(baseResumeEntity);
for (Object argItem : obj) {
if (argIteminstanceof BaseResumeEntity) {
baseResumeEntity = (BaseResumeEntity) argItem;
baseResumeEntity.setBussDeptId(sysLoginUserDTO.getBussDeptId());
//在流程中的简历需要继续往下走 其他的直接返回
baseResumeEntity.setIsContinue(!StateEnum.FLOW.getCode().equals(resumeOutVos.get(0).getState())?false:true);
}
}
//唤醒观察者
setResumeId(resumeOutVos.get(0));
}
}
}
/***********************************************简历插件上传****************************************************************************/
if (resumeAccessVo!=null && sysLoginUserDTO !=null){
List bussId = sysLoginUserDTO.getAccessibleDeptIds();
//根据部门ID和手机号判断是否已存在
List resumeOutVos =resumeService.selectIdByPhone(resumeAccessVo.getPhone(), bussId);
if (resumeOutVos!=null && resumeOutVos.size()>0){
List collect = resumeOutVos.stream().filter(t -> t.getState().equals(StateEnum.FLOW.getCode())).collect(Collectors.toList());
if (collect.size()>0){
collect.get(0).setOperUserId(sysLoginUserDTO.getId());
collect.get(0).setResumeAccessVo(resumeAccessVo);
for (Object argItem : obj) {
if (argIteminstanceof ResumeAccessVo) {
resumeAccessVo = (ResumeAccessVo) argItem;
//在流程中的简历需要继续往下走 其他的直接返回
resumeAccessVo.setIsContinue(!StateEnum.FLOW.getCode().equals(collect.get(0).getState())?false:true);
}
}
setResumeId(collect.get(0));
}else{
resumeOutVos.get(0).setOperUserId(sysLoginUserDTO.getId());
resumeOutVos.get(0).setResumeAccessVo(resumeAccessVo);
for (Object argItem : obj) {
if (argIteminstanceof ResumeAccessVo) {
resumeAccessVo = (ResumeAccessVo) argItem;
resumeAccessVo.setBussDeptId(sysLoginUserDTO.getBussDeptId());
//在流程中的简历需要继续往下走 其他的直接返回
resumeAccessVo.setIsContinue(!StateEnum.FLOW.getCode().equals(resumeOutVos.get(0).getState())?false:true);
}
}
setResumeId(resumeOutVos.get(0));
}
}
}
}
@Pointcut(value ="@annotation(ResumeContro)")
public void excuteService() {
}
}
网友评论