|
@@ -5,12 +5,14 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.iden.common.entity.IdenWarningSta;
|
|
|
-import com.iden.common.service.IdenWarningStaService;
|
|
|
+import com.iden.common.entity.*;
|
|
|
+import com.iden.common.enums.PersonTypeEnum;
|
|
|
+import com.iden.common.enums.PopulationTypeEnum;
|
|
|
+import com.iden.common.enums.StrangerTypeEnum;
|
|
|
+import com.iden.common.enums.WarningTypeEnum;
|
|
|
+import com.iden.common.service.*;
|
|
|
|
|
|
-import com.iden.common.vo.WarningStaVO;
|
|
|
-import com.iden.common.vo.PageReqVO;
|
|
|
-import com.iden.common.vo.UserLoginedConvertVO;
|
|
|
+import com.iden.common.vo.*;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -26,8 +28,17 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class WarningStaService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IdenPersonService idenPersonService;
|
|
|
@Resource
|
|
|
private IdenWarningStaService idenWarningStaService;
|
|
|
+ @Resource
|
|
|
+ private IdenWarningPersonService idenWarningPersonService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IdenPersonCrowdRefService idenPersonCrowdRefService;
|
|
|
+ @Resource
|
|
|
+ private IdenCrowdService idenCrowdService;
|
|
|
|
|
|
public Integer countCommunity(String type,String district, String subdistrict, String communityName, String beginDate, String endDate, UserLoginedConvertVO loginUser) {
|
|
|
QueryWrapper<IdenWarningSta> queryWrapper = new QueryWrapper<>();
|
|
@@ -59,7 +70,7 @@ public class WarningStaService {
|
|
|
IPage<IdenWarningSta> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
|
QueryWrapper<IdenWarningSta> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.lambda().eq(IdenWarningSta::getType,type)
|
|
|
- .like(StrUtil.isNotEmpty(communityName),IdenWarningSta::getCommunityName,communityName)
|
|
|
+ .like(StrUtil.isNotEmpty(communityName), IdenWarningSta::getCommunityName,communityName)
|
|
|
.eq(StrUtil.isNotEmpty(district),IdenWarningSta::getDistrict,district)
|
|
|
.eq(StrUtil.isNotEmpty(subdistrict),IdenWarningSta::getSubdistrict,subdistrict)
|
|
|
.ge(StrUtil.isNotEmpty(beginDate),IdenWarningSta::getDataDate,beginDate)
|
|
@@ -84,6 +95,7 @@ public class WarningStaService {
|
|
|
pageRes.getRecords().forEach(item -> {
|
|
|
WarningStaVO resVO = new WarningStaVO();
|
|
|
BeanUtils.copyProperties(item,resVO);
|
|
|
+ resVO.setTypeName(WarningTypeEnum.getValueToName(resVO.getType()));
|
|
|
list.add(resVO);
|
|
|
});
|
|
|
results.setRecords(list);
|
|
@@ -92,4 +104,77 @@ public class WarningStaService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据小区查询预警人员列表分页
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<WarningPersonVO> listWarningPersonbyCommunity(String type,Long communityId, String nameOrCred, String populationType, Long crowdId, String beginDate, String endDate, UserLoginedConvertVO loginUser, PageReqVO pageReqVo) {
|
|
|
+ QueryWrapper<IdenPerson> queryWrapper0 = new QueryWrapper<>();
|
|
|
+ queryWrapper0.lambda().eq(StrUtil.isNotEmpty(populationType),IdenPerson::getPopulationType,populationType)
|
|
|
+ .and(StrUtil.isNotEmpty(nameOrCred),wrapper -> wrapper.like(IdenPerson::getName,nameOrCred)
|
|
|
+ .or().like(IdenPerson::getCredentialsCode,nameOrCred));
|
|
|
+ if (crowdId != null) {
|
|
|
+ queryWrapper0.apply(" EXISTS ( select dev_code from iden_person_crowd_ref ipcr where ipcr.person_id = iden_person.id and ipcr.crowd_id = " + crowdId + ")");
|
|
|
+ }
|
|
|
+ List<IdenPerson> listIdenPerson = idenPersonService.list(queryWrapper0);
|
|
|
+ List<Long> listIdenPersonId = new ArrayList<>();
|
|
|
+ if(CollUtil.isNotEmpty(listIdenPerson)){
|
|
|
+ listIdenPerson.forEach(item->{
|
|
|
+ listIdenPersonId.add(item.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<IdenWarningPerson> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
|
+ QueryWrapper<IdenWarningPerson> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(IdenWarningPerson::getType,type).eq(IdenWarningPerson::getCommunityId,communityId)
|
|
|
+ .ge(StrUtil.isNotEmpty(beginDate),IdenWarningPerson::getDataDate,beginDate)
|
|
|
+ .le(StrUtil.isNotEmpty(endDate),IdenWarningPerson::getDataDate,endDate)
|
|
|
+ .in(CollUtil.isNotEmpty(listIdenPersonId),IdenWarningPerson::getPersonId,listIdenPersonId)
|
|
|
+ .orderByAsc(IdenWarningPerson::getId);
|
|
|
+
|
|
|
+ IPage<IdenWarningPerson> pageRes = this.idenWarningPersonService.page(page, queryWrapper);
|
|
|
+ IPage<WarningPersonVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
|
+ if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
|
+ List<WarningPersonVO> list = new ArrayList<>();
|
|
|
+ pageRes.getRecords().forEach(item -> {
|
|
|
+ WarningPersonVO resVO = new WarningPersonVO();
|
|
|
+ BeanUtils.copyProperties(item,resVO);
|
|
|
+ resVO.setTypeName(WarningTypeEnum.getValueToName(resVO.getType()));
|
|
|
+ resVO.setStrangerTypeName(StrangerTypeEnum.getValueToName(resVO.getStrangerType()));
|
|
|
+
|
|
|
+ Long personId = resVO.getPersonId();
|
|
|
+ if (personId != null) {
|
|
|
+ IdenPerson idenPerson = this.idenPersonService.getById(personId);
|
|
|
+ PersonVO personVO = new PersonVO();
|
|
|
+ BeanUtils.copyProperties(idenPerson,personVO);
|
|
|
+ personVO.setPopulationTypeName(PopulationTypeEnum.getValueToName(personVO.getPopulationType()));
|
|
|
+ personVO.setTypeName(PersonTypeEnum.getValueToName(personVO.getType()));
|
|
|
+
|
|
|
+ QueryWrapper<IdenPersonCrowdRef> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.lambda().eq(IdenPersonCrowdRef::getPersonId,personVO.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);
|
|
|
+ }
|
|
|
+ personVO.setCrowdName(crowdName);
|
|
|
+ resVO.setPersonVO(personVO);
|
|
|
+ }
|
|
|
+ list.add(resVO);
|
|
|
+ });
|
|
|
+ results.setRecords(list);
|
|
|
+ }
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|