提交 199b08af 作者: wangwenqi

人物审核、查询等相关逻辑调整

上级 03f520fd
......@@ -115,9 +115,10 @@ public class CharacterBasicInfoController {
* @return
*/
@GetMapping("/getPreviousDuty")
public Result<?> getPreviousDuty(@RequestParam(name = "uid", required = true) String uid) {
public Result<?> getPreviousDuty(@RequestParam(name = "uid") String uid,
@RequestParam(name = "id") String id,@RequestParam(name = "category") String category) {
log.info("根据uid查询人物的历任职务:{}", uid);
List<CharacterBasicInfo> list = characterBasicInfoService.getPreviousDuty(uid);
List<CharacterBasicInfo> list = characterBasicInfoService.getPreviousDuty(uid,id,category);
return Result.OK(list);
}
......
......@@ -181,9 +181,10 @@ public class CharacterInfoController {
* @return
*/
@GetMapping("/getPreviousDuty")
public Result<?> getPreviousDuty(@RequestParam(name="uid",required=true) String uid){
log.info("根据uid查询人物的历任职务:{}",uid);
return characterInfoService.getPreviousDuty(uid);
public Result<?> getPreviousDuty(@RequestParam(name="uid") String uid,@RequestParam(name="id") String id
,@RequestParam(name="category") String category){
log.info("根据uid查询人物的历任职务:{},{}",uid,id);
return characterInfoService.getPreviousDuty(uid,id,category);
}
/**
......
......@@ -51,6 +51,17 @@ public class CharacterTagController {
return characterTagService.getTagList(id, name);
}
/**
* @description:获取指定id标签树及树下数据
* @param: [tagRootId]
* @return: Result<?>
**/
@GetMapping("/getTagAndDataTree")
public Result<?> getTagAndDataTree(@RequestParam(name="tagRootId",required=false) String tagRootId){
return characterTagService.getTagAndDataTreeByRootId(tagRootId);
}
/**
* 根据标签分页查询人物
* @param tagId
......
......@@ -54,7 +54,6 @@ public interface CharacterBasicInfoMapper extends BaseMapper<CharacterBasicInfo>
"from character_basic_info a " +
"where 1=1 " +
"and main_entry = 1 " +
"and category = '1' "+
"and a.name = #{name} ")
List<CharacterBasicInfo> getListByName(String name);
......@@ -69,14 +68,8 @@ public interface CharacterBasicInfoMapper extends BaseMapper<CharacterBasicInfo>
)
Integer deduplication(String duty, String company, String name);
@Select("select " +
"*" +
"from character_basic_info " +
"where 1=1 " +
"and uid = #{uid} " +
"and main_entry = 0 " +
"order by FIELD(take_office_status, '现任', '历任') ASC, create_time desc")
List<CharacterBasicInfo> getPreviousDuty(String uid);
List<CharacterBasicInfo> getPreviousDuty(String uid,String id,String category);
@Select("select " +
"id " +
......
......@@ -34,7 +34,7 @@ public interface CharacterBasicInfoService extends IService<CharacterBasicInfo>
List<CharacterBasicInfo> getData(String time);
List<CharacterBasicInfo> getPreviousDuty(String uid);
List<CharacterBasicInfo> getPreviousDuty(String uid,String id,String category);
List<String> getCorrelationByUid(String uid);
......
......@@ -50,7 +50,7 @@ public interface CharacterInfoService {
Result<?> mergeCancel(String id);
Result<?> getPreviousDuty(String uid);
Result<?> getPreviousDuty(String uid,String id,String category);
Result<?> correlation(CharacterVo characterVo);
......
......@@ -18,6 +18,8 @@ public interface CharacterTagService extends IService<LabelEntity> {
Result<?> getTagList(String id, String name);
Result<?> getTagAndDataTreeByRootId(String rootId);
Result<?> getCharacterListByTag(String tagId, Integer offset, Integer pageSize);
void addTagTop(CharacterTagTop characterTagTop);
......
......@@ -2,6 +2,7 @@ package com.zzsn.leaderbase.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -19,9 +20,7 @@ import com.zzsn.leaderbase.service.CharacterBasicInfoService;
import com.zzsn.leaderbase.service.CharacterTagService;
import com.zzsn.leaderbase.service.IGeneratorIdService;
import com.zzsn.leaderbase.service.LeaderCategoryService;
import com.zzsn.leaderbase.util.AuthUtil;
import com.zzsn.leaderbase.util.ExcelUtil;
import com.zzsn.leaderbase.util.LoginUser;
import com.zzsn.leaderbase.vo.BasicInfoListVo;
import com.zzsn.leaderbase.vo.CharacterVo;
import com.zzsn.leaderbase.vo.Result;
......@@ -98,26 +97,21 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
}
private List<CharacterBasicInfo> setListValues(List<CharacterBasicInfo> list, BasicInfoListVo basicInfoListVo) {
//查询结果替换主数据
List<CharacterBasicInfo> listNew=new ArrayList<>(list.size());
for (CharacterBasicInfo characterBasicInfo : list) {
Integer mainEntry = characterBasicInfo.getMainEntry();
if(mainEntry == 0){
QueryWrapper<CharacterBasicInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("uid", characterBasicInfo.getUid())
.eq("main_entry",1);
List<CharacterBasicInfo> mainList = this.list(queryWrapper);
if(mainList.size() > 0){
listNew.add(mainList.get(0));
} else {
listNew.add(characterBasicInfo);
}
} else {
listNew.add(characterBasicInfo);
if(CollectionUtil.isNotEmpty(list)){
List<String> ids=list.stream().map(CharacterBasicInfo::getId).collect(Collectors.toList());
Set<String> uIds = list.stream().map(CharacterBasicInfo::getUid).collect(Collectors.toSet());
LambdaQueryWrapper<CharacterBasicInfo> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.in(CharacterBasicInfo::getUid,uIds);
queryWrapper.notIn(CharacterBasicInfo::getId,ids);
queryWrapper.select(CharacterBasicInfo::getUid);
List<CharacterBasicInfo> subList = this.list(queryWrapper);
Set<String> containsUIds= subList.stream().map(CharacterBasicInfo::getUid).collect(Collectors.toSet());
list.forEach(t->{
if(containsUIds.contains(t.getUid())){
t.setHasChild(1);
}
});
}
//判断是否有关联数据
hasChild(listNew);
//记录热门标签
String tagId = basicInfoListVo.getTagId();
if(tagId != null && tagId.length() >0){
......@@ -182,8 +176,8 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
}
@Override
public List<CharacterBasicInfo> getPreviousDuty(String uid) {
return baseMapper.getPreviousDuty(uid);
public List<CharacterBasicInfo> getPreviousDuty(String uid,String id,String category) {
return baseMapper.getPreviousDuty(uid,id,category);
}
@Override
......@@ -201,7 +195,7 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
String id = Long.toString(generatorIdService.getOrderId());
characterBasicInfo.setId(id);
characterBasicInfo.setCreateTime(new Date());
characterBasicInfo.setUpdateTime(new Date());
String uid = generatorIdService.getIdNo();
characterBasicInfo.setUid(uid);
characterBasicInfo.setMainEntry(1);
......@@ -231,10 +225,15 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
String newId = Long.toString(generatorIdService.getOrderId());
characterBasicInfo.setId(newId);
characterBasicInfo.setMainEntry(0);
characterBasicInfo.setMainEntry(1);
characterBasicInfo.setCategory(newInfo.getCategory());
characterBasicInfo.setCreateTime(new Date());
characterBasicInfo.setUpdateTime(new Date());
Boolean res = this.save(characterBasicInfo);
//主条目重新设置
newInfo.setMainEntry(0);
this.updateById(newInfo);
return Result.OK(res);
}
......@@ -349,7 +348,7 @@ public class CharacterBasicInfoServiceImpl extends ServiceImpl<CharacterBasicInf
String titleName = cell.getStringCellValue();
if (importFieldMap.containsKey(titleName)) {
try {
String stringCellValue = sheetRow.getCell(cell.getColumnIndex()).getStringCellValue();
String stringCellValue =Objects.toString(sheetRow.getCell(cell.getColumnIndex()),"");
//如果是分类列,转换成id
if ("分类".equals(titleName) && "typeId".equals(importFieldMap.get(titleName))) {
stringCellValue = typeNameKeyMap.get(stringCellValue);
......
package com.zzsn.leaderbase.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -13,6 +13,7 @@ import com.zzsn.leaderbase.service.IGeneratorIdService;
import com.zzsn.leaderbase.vo.CheckVo;
import com.zzsn.leaderbase.vo.ExtractListVo;
import com.zzsn.leaderbase.vo.Result;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -79,109 +80,121 @@ public class CharacterExtractInfoServiceImpl extends ServiceImpl<CharacterExtrac
//保存人物信息
CharacterBasicInfo character = checkVo.getCharacter();
String id = Long.toString(generatorIdService.getOrderId());
character.setId(id);
character.setCreateTime(new Date());
String uid = generatorIdService.getIdNo();
character.setUid(uid);
character.setCategory("1");//审核人物默认入领导人
character.setMainEntry(1);
character.setArticleId(extractInfo.getArticleId());
character.setArticleIndex(extractInfo.getArticleIndex());
character.setArticleTitle(extractInfo.getArticleTitle());
character.setArticleOrigin(extractInfo.getArticleOrigin());
character.setUpdateDesc(extractInfo.getUpdateDesc());
character=convertCharacter(character,extractInfo);
character.setUid(generatorIdService.getIdNo());
Boolean characterRes = characterBasicInfoService.save(character);
if(!characterRes)
return Result.error("人物信息保存失败");
//修改审核状态
UpdateWrapper<CharacterExtractInfo> extractWrapper = new UpdateWrapper<>();
extractWrapper.eq("id", extractId)
.set("check_status", 1);
Boolean updateCheck = this.update(extractWrapper);
Boolean updateCheck = updateExtractInfoCheckStatus(extractId);
if(!updateCheck)
return Result.error("审核状态更改失败!");
return Result.OK();
}
@Override
public Result<?> checkMerge(CheckVo checkVo) {
//查询审核人物信息
String extractId = checkVo.getExtractId();
CharacterExtractInfo extractInfo = this.getById(extractId);
//查询疑似人物信息
//查询疑似人物信息(主)
String suspectedId = checkVo.getSuspectedId();
CharacterBasicInfo suspectedInfo = characterBasicInfoService.getById(suspectedId);
//保存人物信息
String uid = suspectedInfo.getUid();
//同步疑似人物uid
syncSuspectedUid(uid,checkVo.getSubSuspectedIds());
//前端传的人物信息
CharacterBasicInfo character = checkVo.getCharacter();
Boolean opFlag;
//相同 更新
if(checkSimilarPerson(suspectedInfo,character)){
opFlag =synCharacterBasicInfo(character,suspectedId);
}else{//新建人物信息
character=convertCharacter(character,extractInfo);
character.setUid(uid );
opFlag = characterBasicInfoService.save(character);
//人物信息为现任,则将该人物的原现任信息修改为历任
if("在职".equals(character.getTakeOfficeStatus())){
LambdaUpdateWrapper<CharacterBasicInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(CharacterBasicInfo::getId, suspectedId)
.set(CharacterBasicInfo::getTakeOfficeStatus, "历任")
.set(CharacterBasicInfo::getMainEntry,0);
characterBasicInfoService.update(updateWrapper);
}
}
if(!opFlag)
return Result.error("人物信息操作失败");
//修改审核状态
Boolean updateCheck = updateExtractInfoCheckStatus(extractId);
if(!updateCheck)
return Result.error("审核状态更改失败!");
return Result.OK();
}
private CharacterBasicInfo convertCharacter( CharacterBasicInfo character ,CharacterExtractInfo extractInfo){
String id = Long.toString(generatorIdService.getOrderId());
character.setId(id);
character.setCreateTime(new Date());
String uid = suspectedInfo.getUid();
character.setUid(uid);
character.setCategory("1");//审核人物默认入领导人
character.setUpdateTime(new Date());
character.setMainEntry(1);
character.setArticleId(extractInfo.getArticleId());
character.setArticleIndex(extractInfo.getArticleIndex());
character.setArticleTitle(extractInfo.getArticleTitle());
character.setArticleOrigin(extractInfo.getArticleOrigin());
character.setUpdateDesc(extractInfo.getUpdateDesc());
Boolean characterRes = characterBasicInfoService.save(character);
if(!characterRes)
return Result.error("人物信息保存失败");
return character;
}
//修改审核状态
UpdateWrapper<CharacterExtractInfo> extractWrapper = new UpdateWrapper<>();
extractWrapper.eq("id", extractId)
.set("check_status", 1);
Boolean updateCheck = this.update(extractWrapper);
if(!updateCheck)
return Result.error("审核状态更改失败!");
//更新审核状态
private boolean updateExtractInfoCheckStatus(String extractId ){
LambdaUpdateWrapper<CharacterExtractInfo> extractWrapper = new LambdaUpdateWrapper<>();
extractWrapper.eq(CharacterExtractInfo::getId, extractId)
.set(CharacterExtractInfo::getCheckStatus, 1)
.set(CharacterExtractInfo::getUpdateTime, new Date());
return this.update(extractWrapper);
}
//人物信息为现任,则将该人物的原现任信息修改为历任
if("在职".equals(character.getTakeOfficeStatus())){
UpdateWrapper<CharacterBasicInfo> suspectedWrapper = new UpdateWrapper<>();
suspectedWrapper.eq("id", suspectedId)
.set("take_office_status", "历任")
.set("main_entry",0);
Boolean updateTask = characterBasicInfoService.update(suspectedWrapper);
if(!updateTask)
return Result.error("疑似人物任职状态更改失败!");
//同步疑似人物uid和主疑似人物uid保持一致
private void syncSuspectedUid(String uid,List<String> subSuspectedIds){
if(CollectionUtils.isNotEmpty(subSuspectedIds)){
LambdaUpdateWrapper<CharacterBasicInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(CharacterBasicInfo::getId, subSuspectedIds)
.set(CharacterBasicInfo::getUid, uid)
.set(CharacterBasicInfo::getUpdateTime, new Date());
characterBasicInfoService.update(updateWrapper);
}
}
//批量修改同一人物的基本信息
UpdateWrapper<CharacterBasicInfo> uidWrapper = new UpdateWrapper<>();
uidWrapper.eq("uid", uid);
if(StringUtils.isNotEmpty(character.getName()))
uidWrapper.set("name", character.getName());
if(StringUtils.isNotEmpty(character.getSex()))
uidWrapper.set("sex", character.getSex());
if(StringUtils.isNotEmpty(character.getBirthplace()))
uidWrapper.set("birthplace", character.getBirthplace());
if(StringUtils.isNotEmpty(character.getBirthday()))
uidWrapper.set("birthday", character.getBirthday());
if(StringUtils.isNotEmpty(character.getNativePlace()))
uidWrapper.set("native_place", character.getNativePlace());
if(StringUtils.isNotEmpty(character.getSchool()))
uidWrapper.set("school", character.getSchool());
if(StringUtils.isNotEmpty(character.getSpeciality()))
uidWrapper.set("speciality", character.getSpeciality());
if(StringUtils.isNotEmpty(character.getEducation()))
uidWrapper.set("education", character.getEducation());
if(StringUtils.isNotEmpty(character.getExpertOccupation()))
uidWrapper.set("expert_occupation", character.getExpertOccupation());
if(StringUtils.isNotEmpty(character.getHeadSculpture()))
uidWrapper.set("head_sculpture", character.getHeadSculpture());
if(StringUtils.isNotEmpty(character.getBiographicalNotes()))
uidWrapper.set("biographical_notes", character.getBiographicalNotes());
Boolean updateUid = characterBasicInfoService.update(uidWrapper);
if(!updateUid)
return Result.error("人物基本信息修改失败!");
//判断人物信息是否和主疑似人物信息一致(姓名、单位、职务)
private boolean checkSimilarPerson(CharacterBasicInfo suspectedInfo,CharacterBasicInfo character){
return StringUtils.equals(suspectedInfo.getName(), character.getName())
&& StringUtils.equals(suspectedInfo.getDepartment(), character.getDepartment())
&& StringUtils.equals(suspectedInfo.getDuty(), character.getDuty());
}
return Result.OK();
//更新主疑似人物信息
private boolean synCharacterBasicInfo(CharacterBasicInfo character, String suspectedId){
LambdaUpdateWrapper<CharacterBasicInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(CharacterBasicInfo::getId, suspectedId);
updateWrapper.set(StringUtils.isNotEmpty(character.getName()), CharacterBasicInfo::getName, character.getName());
updateWrapper.set(StringUtils.isNotEmpty(character.getSex()), CharacterBasicInfo::getSex, character.getSex());
updateWrapper.set(StringUtils.isNotEmpty(character.getBirthplace()), CharacterBasicInfo::getBirthplace, character.getBirthplace());
updateWrapper.set(StringUtils.isNotEmpty(character.getBirthday()), CharacterBasicInfo::getBirthday, character.getBirthday());
updateWrapper.set(StringUtils.isNotEmpty(character.getNativePlace()), CharacterBasicInfo::getNativePlace, character.getNativePlace());
updateWrapper.set(StringUtils.isNotEmpty(character.getSchool()), CharacterBasicInfo::getSchool, character.getSchool());
updateWrapper.set(StringUtils.isNotEmpty(character.getSpeciality()), CharacterBasicInfo::getSpeciality, character.getSpeciality());
updateWrapper.set(StringUtils.isNotEmpty(character.getEducation()), CharacterBasicInfo::getEducation, character.getEducation());
updateWrapper.set(StringUtils.isNotEmpty(character.getExpertOccupation()), CharacterBasicInfo::getExpertOccupation, character.getExpertOccupation());
updateWrapper.set(StringUtils.isNotEmpty(character.getHeadSculpture()), CharacterBasicInfo::getHeadSculpture, character.getHeadSculpture());
updateWrapper.set(StringUtils.isNotEmpty(character.getBiographicalNotes()), CharacterBasicInfo::getBiographicalNotes, character.getBiographicalNotes());
//职位状态
updateWrapper.set(StringUtils.isNotEmpty(character.getTakeOfficeStatus()), CharacterBasicInfo::getTakeOfficeStatus, character.getTakeOfficeStatus());
updateWrapper.set(CharacterBasicInfo::getUpdateTime , new Date());
return characterBasicInfoService.update(updateWrapper);
}
}
......@@ -404,8 +404,8 @@ public class CharacterInfoServiceImpl implements CharacterInfoService {
}
@Override
public Result<?> getPreviousDuty(String uid) {
return Result.OK(characterBasicInfoService.getPreviousDuty(uid));
public Result<?> getPreviousDuty(String uid,String id,String category) {
return Result.OK(characterBasicInfoService.getPreviousDuty(uid,id,category));
}
@Override
......
......@@ -17,11 +17,13 @@ import com.zzsn.leaderbase.service.CharacterBasicInfoService;
import com.zzsn.leaderbase.service.CharacterInfoService;
import com.zzsn.leaderbase.service.CharacterTagService;
import com.zzsn.leaderbase.vo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Version 1.0
......@@ -104,7 +106,7 @@ public class CharacterTagServiceImpl extends ServiceImpl<CharacterTagMapper, Lab
// sysBaseLabelTypeVo.setHasChild("1");
List<SysBaseLabelTypeVo> list = characterTagMapper.getTagTypeListAll();
//只获取人物服务相关的类别
List<SysBaseLabelTypeVo> treeList = getBaseLabelTreeList(list,sys_base_label_type_id);
List<SysBaseLabelTypeVo> treeList = getBaseLabelTreeList(list,sys_base_label_type_id,null);
// sysBaseLabelTypeVo.setChildren(treeList);
// allList.add(sysBaseLabelTypeVo);
// return allList;
......@@ -174,36 +176,84 @@ public class CharacterTagServiceImpl extends ServiceImpl<CharacterTagMapper, Lab
}
//获取树状结构
private List<SysBaseLabelTypeVo> getBaseLabelTreeList(List<SysBaseLabelTypeVo> baseLabelTypeList, String id){
private List<SysBaseLabelTypeVo> getBaseLabelTreeList(List<SysBaseLabelTypeVo> baseLabelTypeList, String id,Map<String,List<SysLabelVo>> dataMap){
List<SysBaseLabelTypeVo> topList = new ArrayList<>();
baseLabelTypeList.forEach(e->{
if (id.equals(e.getId())) {
if(dataMap!=null && dataMap.containsKey(e.getId())){
e.setDataList(dataMap.get(e.getId()));
}
topList.add(e);
}
});
for (SysBaseLabelTypeVo sysLabelVo : topList) {
setBaseLabelChildren(sysLabelVo, baseLabelTypeList);
setBaseLabelChildren(sysLabelVo, baseLabelTypeList,dataMap);
}
return topList;
}
//递归获取树形结构数据
private void setBaseLabelChildren(SysBaseLabelTypeVo parent, List<SysBaseLabelTypeVo> list) {
Set<SysBaseLabelTypeVo> children = getBaseLabelChildren(list, parent.getId());
private void setBaseLabelChildren(SysBaseLabelTypeVo parent, List<SysBaseLabelTypeVo> list,Map<String,List<SysLabelVo>> dataMap) {
Set<SysBaseLabelTypeVo> children = getBaseLabelChildren(list, parent.getId(),dataMap);
parent.setChildren(new ArrayList<>(children));
for (SysBaseLabelTypeVo sysLabelVo : children) {
setBaseLabelChildren(sysLabelVo, list);
setBaseLabelChildren(sysLabelVo, list,dataMap);
}
}
private Set<SysBaseLabelTypeVo> getBaseLabelChildren(List<SysBaseLabelTypeVo> list, String id) {
private Set<SysBaseLabelTypeVo> getBaseLabelChildren(List<SysBaseLabelTypeVo> list, String id,Map<String,List<SysLabelVo>> dataMap) {
Set<SysBaseLabelTypeVo> children = new HashSet<>();
for (SysBaseLabelTypeVo sysLabelVo : list) {
if (sysLabelVo.getPid().equals(id)) {
if(dataMap!=null&&dataMap.containsKey(sysLabelVo.getId())){
sysLabelVo.setDataList(dataMap.get(sysLabelVo.getId()));
}
children.add(sysLabelVo);
}
}
return children;
}
@Override
public Result<?> getTagAndDataTreeByRootId(String rootId){
if(StringUtils.isEmpty(rootId)){
rootId = sys_base_label_type_id;
}
List<SysBaseLabelTypeVo> list = characterTagMapper.getTagTypeListAll();
List<SysBaseLabelTypeVo> originList =new ArrayList<>(list);
List<String> typeIds=getAllIdsByRootId(list, rootId);
List<SysLabelVo> dataList = characterTagMapper.queryCustomLabel(typeIds,null);
Map<String,List<SysLabelVo>> dataMap=dataList.stream().collect(Collectors.groupingBy(SysLabelVo::getLabelTypeId));
List<SysBaseLabelTypeVo> changeList =originList.stream().filter(t -> !list.contains(t)).collect(Collectors.toList());
String finalRootId = rootId;
SysBaseLabelTypeVo rootType=list.stream().filter(t->t.getId().equals(finalRootId)).findFirst().get();
setBaseLabelChildren(rootType, changeList,dataMap);
return Result.OK(rootType);
}
//获取指定根节点下所有子节点id集合
public static List<String> getAllIdsByRootId(List<SysBaseLabelTypeVo> baseTypeList, String rootId) {
if(StringUtils.isEmpty(rootId)||CollectionUtil.isEmpty(baseTypeList)){
return Collections.emptyList();
}
List<String> idList = new ArrayList<>();
Queue<String> queue = new LinkedList<>();
queue.offer(rootId);
while (!queue.isEmpty()) {
String currentId = queue.poll();
idList.add(currentId);
Iterator<SysBaseLabelTypeVo> iterator = baseTypeList.iterator();
while (iterator.hasNext()) {
SysBaseLabelTypeVo node = iterator.next();
if (currentId.equals(node.getPid())) {
queue.offer(node.getId());
iterator.remove();
}
}
}
return idList;
}
}
......
......@@ -4,6 +4,8 @@ import com.zzsn.leaderbase.entity.CharacterBasicInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 人物基本信息表
*/
......@@ -17,7 +19,10 @@ public class CheckVo {
//审核的抽取人物id
private String extractId;
//疑似人物id
//疑似人物id(主)
private String suspectedId;
//疑似人物id集合(不包含主疑似人物ID)
private List<String> subSuspectedIds;
}
......@@ -5,6 +5,8 @@ import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.List;
@Data
public class SysBaseLabelTypeVo {
/**主键*/
......@@ -42,4 +44,6 @@ public class SysBaseLabelTypeVo {
private String labelType;
/**下级节点*/
private java.util.List<SysBaseLabelTypeVo> children;
/**当前节点关联的数据*/
private List<SysLabelVo> dataList;
}
......@@ -5,14 +5,30 @@
<mapper namespace="com.zzsn.leaderbase.mapper.CharacterBasicInfoMapper">
<select id="getList" resultType="com.zzsn.leaderbase.entity.CharacterBasicInfo">
select
*
from character_basic_info
SELECT cbi.*
FROM character_basic_info cbi
JOIN (
SELECT uid,max(create_time) create_time
FROM character_basic_info
where 1 = 1
<include refid="getListWhere"/>
group by uid
ORDER BY CONVERT (${column} USING gbk) ${order}
ORDER BY ${column} ${order}
limit #{offset}, #{pageSize}
) sub on cbi.uid = sub.uid and cbi.create_time = sub.create_time
</select>
<select id="getPreviousDuty" resultType="com.zzsn.leaderbase.entity.CharacterBasicInfo">
SELECT cbi.*
FROM character_basic_info cbi
JOIN (
SELECT id
FROM character_basic_info
where uid = #{uid} and id != #{id}
ORDER BY FIELD(category, #{category}, '1', '3', '2'),
FIELD(take_office_status, '在职', '历任') ,
update_time desc
) sub on cbi.id = sub.id
</select>
<select id="getAllList" resultType="com.zzsn.leaderbase.entity.CharacterBasicInfo">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论