|
|
@ -1,17 +1,25 @@ |
|
|
|
package com.epmet.dataaggre.service.epmetuser.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao; |
|
|
|
import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; |
|
|
|
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; |
|
|
|
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zxc |
|
|
@ -24,6 +32,10 @@ public class EpmetUserServiceImpl implements EpmetUserService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserBaseInfoDao userBaseInfoDao; |
|
|
|
@Autowired |
|
|
|
private GovOrgService govOrgService; |
|
|
|
@Autowired |
|
|
|
private StaffPatrolRecordDao staffPatrolRecordDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根据UserIds查询 |
|
|
@ -54,7 +66,32 @@ public class EpmetUserServiceImpl implements EpmetUserService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StaffListResultDTO> staffList(StaffListFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
List<StaffListResultDTO> resultList = new ArrayList<>(); |
|
|
|
//1.设置分页参数
|
|
|
|
int num = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); |
|
|
|
formDTO.setPageNo(num); |
|
|
|
|
|
|
|
//2.查询当前人员所属组织下网格列表数据,供后续使用
|
|
|
|
List<CustomerGridDTO> list = govOrgService.gridListByStaffId(formDTO.getUserId()); |
|
|
|
if (list.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
//网格集合为空则查询当前人员所属组织下网格列表
|
|
|
|
if (CollectionUtils.isEmpty(formDTO.getGridIds())) { |
|
|
|
formDTO.setGridIds(list.stream().map(CustomerGridDTO::getId).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
|
|
|
|
//3.按条件查询巡查业务数据
|
|
|
|
formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime())); |
|
|
|
resultList = staffPatrolRecordDao.selectPatrolList(formDTO); |
|
|
|
if (resultList.size() < NumConstant.ONE) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
//4.封装数据并返回
|
|
|
|
resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|