提交 a4e67b97 作者: ZhangJingKun

解决新增履历后,再取消合并逻辑不正确的问题

上级 303f7c07
...@@ -83,7 +83,7 @@ public class CharacterChangeInfo extends Model<CharacterChangeInfo> { ...@@ -83,7 +83,7 @@ public class CharacterChangeInfo extends Model<CharacterChangeInfo> {
private String originalId; private String originalId;
//审核标识 新人物id //审核标识 新人物id
private String newId; private String newId;
//合并标识 1:更新人物 2:添加职位 //合并结果 0手动新增 1合并人物 2作为新人物 3新增履历 -1取消操作
private Long mergeStatus; private Long mergeStatus;
} }
...@@ -95,4 +95,17 @@ public interface CharacterBasicInfoMapper extends BaseMapper<CharacterBasicInfo> ...@@ -95,4 +95,17 @@ public interface CharacterBasicInfoMapper extends BaseMapper<CharacterBasicInfo>
"and status = 2 " + "and status = 2 " +
"and uid = #{uid} ") "and uid = #{uid} ")
List<String> getCorrelationByUid(String uid); List<String> getCorrelationByUid(String uid);
@Select("select " +
"a.id,a.uid,a.name,a.sex,a.birthplace,a.birthday,a.native_place,a.school,a.speciality,a.education,a.expert_occupation,a.head_sculpture,a.biographical_notes,a.category,a.award_records,a.part_time_job,a.research_field,a.evaluate,a.status," +
"b.type_id,b.company_original,b.department_original,b.duty_original,b.company,b.department,b.duty,b.take_office_time,b.take_office_time_end,b.take_office_status,b.change_url,b.duties_update_time,b.duties_update_reason,b.check_status,b.check_result,b.article_id,b.article_index,b.update_desc,b.original_id,b.new_id,b.merge_status,a.create_by,a.create_time,a.update_by,a.update_time " +
"from character_basic_info a " +
"LEFT JOIN character_change_info b " +
"on a.id = b.id " +
"where 1=1 " +
"and merge_status = 3 " +
"and b.original_id = #{id} " +
"order by update_time desc " +
"limit 1 ")
List<CharacterVo> getByOriginalId(String id);
} }
...@@ -34,4 +34,6 @@ public interface CharacterBasicInfoService extends IService<CharacterBasicInfo> ...@@ -34,4 +34,6 @@ public interface CharacterBasicInfoService extends IService<CharacterBasicInfo>
List<CharacterVo> getPreviousDuty(String uid); List<CharacterVo> getPreviousDuty(String uid);
List<String> getCorrelationByUid(String uid); List<String> getCorrelationByUid(String uid);
List<CharacterVo> getByOriginalId(String id);
} }
...@@ -2,6 +2,7 @@ package com.zzsn.leaderbase.service; ...@@ -2,6 +2,7 @@ package com.zzsn.leaderbase.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.leaderbase.entity.CharacterChangeInfo; import com.zzsn.leaderbase.entity.CharacterChangeInfo;
import com.zzsn.leaderbase.vo.CharacterVo;
/** /**
* @Version 1.0 * @Version 1.0
......
...@@ -84,4 +84,9 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf ...@@ -84,4 +84,9 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
public List<String> getCorrelationByUid(String uid) { public List<String> getCorrelationByUid(String uid) {
return characterBasicInfoMapper.getCorrelationByUid(uid); return characterBasicInfoMapper.getCorrelationByUid(uid);
} }
@Override
public List<CharacterVo> getByOriginalId(String id) {
return characterBasicInfoMapper.getByOriginalId(id);
}
} }
package com.zzsn.leaderbase.service.impl; package com.zzsn.leaderbase.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.leaderbase.entity.CharacterBasicInfo; import com.zzsn.leaderbase.entity.CharacterBasicInfo;
...@@ -402,11 +403,34 @@ public class CharacterInfoServiceImpl implements CharacterInfoService { ...@@ -402,11 +403,34 @@ public class CharacterInfoServiceImpl implements CharacterInfoService {
@Override @Override
public Result<?> mergeCancel(String id) { public Result<?> mergeCancel(String id) {
//先查询又没有新增履历的人物
List<CharacterVo> list = characterBasicInfoService.getByOriginalId(id);
if(list.size() > 0){
CharacterVo vo = list.get(0);
//解绑人物uid
vo.setUid("");
//状态为可用
vo.setStatus(1L);
//审核状态置为未审核
vo.setCheckResult(1L);
vo.setOriginalId("");
this.edit(vo);
//type状态取消
// vo.setMergeStatus(null);
UpdateWrapper<CharacterChangeInfo> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("merge_status", null) // 设置字段名为fieldName的字段值为null
.eq("id", vo.getId()); // 设置更新条件,这里以id作为更新条件
characterChangeInfoService.update(updateWrapper);
} else {
//根据id查询数据 //根据id查询数据
CharacterVo characterVo = characterBasicInfoService.getById(id); CharacterVo characterVo = characterBasicInfoService.getById(id);
if(characterVo == null){ if(characterVo == null){
return Result.error("根据id未查询到人物信息"); return Result.error("根据id未查询到人物信息");
} }
Long type = characterVo.getMergeStatus(); Long type = characterVo.getMergeStatus();
if(type == 1L){ if(type == 1L){
//删除当前数据 //删除当前数据
...@@ -436,21 +460,10 @@ public class CharacterInfoServiceImpl implements CharacterInfoService { ...@@ -436,21 +460,10 @@ public class CharacterInfoServiceImpl implements CharacterInfoService {
cci1.setStatus(1L); cci1.setStatus(1L);
characterChangeInfoService.updateById(cci1); characterChangeInfoService.updateById(cci1);
} else if(type == 3L){
//解绑人物uid
characterVo.setUid("");
//状态为可用
characterVo.setStatus(1L);
//type状态取消
characterVo.setMergeStatus(0L);
//审核状态置为未审核
characterVo.setCheckResult(-1L);
this.edit(characterVo);
} else { } else {
return Result.error("参数type有误!"); return Result.error("参数type有误!");
} }
}
return Result.OK(); return Result.OK();
} }
...@@ -566,6 +579,7 @@ public class CharacterInfoServiceImpl implements CharacterInfoService { ...@@ -566,6 +579,7 @@ public class CharacterInfoServiceImpl implements CharacterInfoService {
CharacterVo originalCharacter = characterBasicInfoService.getById(originalId); CharacterVo originalCharacter = characterBasicInfoService.getById(originalId);
characterVo.setUid(originalCharacter.getUid()); characterVo.setUid(originalCharacter.getUid());
} }
characterVo.setOriginalId(originalId);
characterVo.setMergeStatus(3L); characterVo.setMergeStatus(3L);
characterVo.setStatus(0L); characterVo.setStatus(0L);
this.edit(characterVo); this.edit(characterVo);
......
...@@ -129,7 +129,7 @@ public class CharacterVo { ...@@ -129,7 +129,7 @@ public class CharacterVo {
private String originalId; private String originalId;
//审核信息 新人物id //审核信息 新人物id
private String newId; private String newId;
//合并结果 0手动新增 1合并人物 2新增人物 3追加历任职务 -1取消操作 //合并结果 0手动新增 1合并人物 2作为新人物 3新增履历 -1取消操作
private Long mergeStatus; private Long mergeStatus;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论