|
@@ -8,13 +8,23 @@ import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
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.iden.common.cache.DictCache;
|
|
|
|
+import com.iden.common.entity.IdenCommunity;
|
|
import com.iden.common.entity.IdenCrowd;
|
|
import com.iden.common.entity.IdenCrowd;
|
|
|
|
+import com.iden.common.entity.IdenPerson;
|
|
import com.iden.common.entity.IdenPersonCrowdRef;
|
|
import com.iden.common.entity.IdenPersonCrowdRef;
|
|
|
|
+import com.iden.common.enums.CredentialsTypeEnum;
|
|
|
|
+import com.iden.common.enums.GenderEnum;
|
|
|
|
+import com.iden.common.enums.PersonTypeEnum;
|
|
|
|
+import com.iden.common.enums.PopulationTypeEnum;
|
|
|
|
+import com.iden.common.service.IdenCommunityService;
|
|
import com.iden.common.service.IdenCrowdService;
|
|
import com.iden.common.service.IdenCrowdService;
|
|
import com.iden.common.service.IdenPersonCrowdRefService;
|
|
import com.iden.common.service.IdenPersonCrowdRefService;
|
|
|
|
|
|
|
|
+import com.iden.common.service.IdenPersonService;
|
|
import com.iden.common.vo.CrowdVO;
|
|
import com.iden.common.vo.CrowdVO;
|
|
import com.iden.common.vo.PageReqVO;
|
|
import com.iden.common.vo.PageReqVO;
|
|
|
|
+import com.iden.common.vo.PersonVO;
|
|
import com.iden.common.vo.UserLoginedConvertVO;
|
|
import com.iden.common.vo.UserLoginedConvertVO;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -37,8 +47,10 @@ public class CrowdService {
|
|
private IdenCrowdService idenCrowdService;
|
|
private IdenCrowdService idenCrowdService;
|
|
@Resource
|
|
@Resource
|
|
private IdenPersonCrowdRefService idenPersonCrowdRefService;
|
|
private IdenPersonCrowdRefService idenPersonCrowdRefService;
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IdenCommunityService idenCommunityService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IdenPersonService idenPersonService;
|
|
/**
|
|
/**
|
|
* 查询区域列表
|
|
* 查询区域列表
|
|
* @return
|
|
* @return
|
|
@@ -181,4 +193,63 @@ public class CrowdService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询人员列表
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IPage<PersonVO> listPersonByCrowd(Long crowdId,UserLoginedConvertVO loginUser, PageReqVO pageReqVo) {
|
|
|
|
+ IPage<IdenPerson> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
|
|
+
|
|
|
|
+ QueryWrapper<IdenPerson> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda()
|
|
|
|
+ .orderByDesc(IdenPerson::getModifyTime)
|
|
|
|
+ .orderByDesc(IdenPerson::getCreateTime);
|
|
|
|
+
|
|
|
|
+ if (crowdId != null) {
|
|
|
|
+ queryWrapper.apply(" iden_person.id in ( select person_id from iden_person_crowd_ref ipcr where ipcr.crowd_id = "+ crowdId + ")");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IPage<IdenPerson> pageRes = this.idenPersonService.page(page, queryWrapper);
|
|
|
|
+ IPage<PersonVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
|
|
+ if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
|
|
+ List<PersonVO> list = new ArrayList<>();
|
|
|
|
+ pageRes.getRecords().forEach(item -> {
|
|
|
|
+ PersonVO resVO = new PersonVO();
|
|
|
|
+ BeanUtils.copyProperties(item,resVO);
|
|
|
|
+ resVO.setPopulationTypeName(PopulationTypeEnum.getValueToName(resVO.getPopulationType()));
|
|
|
|
+ resVO.setTypeName(PersonTypeEnum.getValueToName(resVO.getType()));
|
|
|
|
+ resVO.setGenderName(GenderEnum.getValueToName(resVO.getGender()));
|
|
|
|
+ resVO.setCredentialsTypeName(CredentialsTypeEnum.getValueToName(resVO.getCredentialsType()));
|
|
|
|
+ resVO.setMarriageName(DictCache.getNameByValue("marriage", resVO.getMarriage()));
|
|
|
|
+ resVO.setPolicitalStatusName(DictCache.getNameByValue("policital_status", resVO.getPolicitalStatus()));
|
|
|
|
+ Long communityId1 = resVO.getCommunityId();
|
|
|
|
+ if(communityId1 != null){
|
|
|
|
+ IdenCommunity idenCommunity = this.idenCommunityService.getById(communityId1);
|
|
|
|
+ if(idenCommunity != null) {
|
|
|
|
+ resVO.setCommunityName(idenCommunity.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<IdenPersonCrowdRef> queryWrapper1 = new QueryWrapper<>();
|
|
|
|
+ queryWrapper1.lambda().eq(IdenPersonCrowdRef::getPersonId,resVO.getId());
|
|
|
|
+ List<IdenPersonCrowdRef> listIdenPersonCrowdRef = idenPersonCrowdRefService.list(queryWrapper1);
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ if (CollUtil.isNotEmpty(listIdenPersonCrowdRef)) {
|
|
|
|
+ for(IdenPersonCrowdRef idenPersonCrowdRef : listIdenPersonCrowdRef){
|
|
|
|
+ IdenCrowd idenCrowd = idenCrowdService.getById(idenPersonCrowdRef.getCrowdId());
|
|
|
|
+ if(idenCrowd != null) {
|
|
|
|
+ sb.append(idenCrowd.getName()).append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String crowdName = sb.toString();
|
|
|
|
+ if(crowdName != null && crowdName.endsWith(",")) {
|
|
|
|
+ crowdName = crowdName.substring(0, crowdName.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ resVO.setCrowdName(crowdName);
|
|
|
|
+ list.add(resVO);
|
|
|
|
+ });
|
|
|
|
+ results.setRecords(list);
|
|
|
|
+ }
|
|
|
|
+ return results;
|
|
|
|
+ }
|
|
}
|
|
}
|