|
@@ -0,0 +1,124 @@
|
|
|
+package com.iden.bms.service;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+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.IdenCrowd;
|
|
|
+import com.iden.common.entity.IdenImageStore;
|
|
|
+import com.iden.common.entity.IdenPerson;
|
|
|
+import com.iden.common.entity.IdenPersonCrowdRef;
|
|
|
+import com.iden.common.enums.PersonTypeEnum;
|
|
|
+import com.iden.common.enums.PopulationTypeEnum;
|
|
|
+import com.iden.common.service.IdenCrowdService;
|
|
|
+import com.iden.common.service.IdenImageStoreService;
|
|
|
+import com.iden.common.service.IdenPersonCrowdRefService;
|
|
|
+import com.iden.common.service.IdenPersonService;
|
|
|
+import com.iden.common.vo.*;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author makejava
|
|
|
+ * @since 2021-05-21 00:08:38
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ImageStoreService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IdenImageStoreService idenImageStoreService;
|
|
|
+ @Resource
|
|
|
+ private IdenPersonService idenPersonService;
|
|
|
+ @Resource
|
|
|
+ private IdenPersonCrowdRefService idenPersonCrowdRefService;
|
|
|
+ @Resource
|
|
|
+ private IdenCrowdService idenCrowdService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询人脸抓拍库列表
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<ImageStoreVO> listImageStore(String type,Long communityId,String photographPlace, String beginDate,String endDate,UserLogindConvertVO loginUser, PageReqVO pageReqVo) {
|
|
|
+ IPage<IdenImageStore> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
|
+ QueryWrapper<IdenImageStore> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().like(IdenImageStore::getType,type)
|
|
|
+ .like(StrUtil.isNotEmpty(photographPlace),IdenImageStore::getPhotographPlace,photographPlace)
|
|
|
+ .eq(communityId != null,IdenImageStore::getCommunityId,communityId)
|
|
|
+ .orderByAsc(IdenImageStore::getId);
|
|
|
+ if(StrUtil.isNotEmpty(beginDate)){
|
|
|
+ queryWrapper.apply(" date_format(photograph_time,'%Y-%m-%d') >= {0}", beginDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StrUtil.isNotEmpty(endDate)){
|
|
|
+ queryWrapper.apply(" date_format(photograph_time,'%Y-%m-%d') <= {0}", endDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<IdenImageStore> pageRes = this.idenImageStoreService.page(page, queryWrapper);
|
|
|
+ IPage<ImageStoreVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
|
+ if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
|
+ List<ImageStoreVO> list = new ArrayList<>();
|
|
|
+ pageRes.getRecords().forEach(item -> {
|
|
|
+ ImageStoreVO resVO = new ImageStoreVO();
|
|
|
+ BeanUtils.copyProperties(item,resVO);
|
|
|
+ resVO.setTypeName(PersonTypeEnum.getValueToName(resVO.getType()));
|
|
|
+
|
|
|
+ list.add(resVO);
|
|
|
+ });
|
|
|
+ results.setRecords(list);
|
|
|
+ }
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ImageStoreVO getImageStoreInfo(Long id){
|
|
|
+ IdenImageStore idenImageStore = this.idenImageStoreService.getById(id);
|
|
|
+ if (idenImageStore != null){
|
|
|
+ ImageStoreVO resVO = new ImageStoreVO();
|
|
|
+ BeanUtil.copyProperties(idenImageStore,resVO);
|
|
|
+
|
|
|
+ if(resVO.getPersonId() != null){
|
|
|
+ IdenPerson idenPerson = idenPersonService.getById(resVO.getPersonId());
|
|
|
+ if(idenPerson != null) {
|
|
|
+ PersonVO personVO = new PersonVO();
|
|
|
+ BeanUtil.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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return resVO;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|