|
|
@ -25,11 +25,11 @@ import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; |
|
|
|
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 javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -274,10 +274,31 @@ public class EpmetUserServiceImpl implements EpmetUserService { |
|
|
|
formDTO.setPageNo(pageIndex); |
|
|
|
//起始查询日期
|
|
|
|
formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime(), "yyyyMMdd")); |
|
|
|
List<CustomerStaffDTO> staffList = new ArrayList<>(); |
|
|
|
//2-1.按名字检索时先查询人员基础信息
|
|
|
|
if (StringUtils.isEmpty(formDTO.getStaffName())) { |
|
|
|
staffList = customerStaffDao.selectByStaffIds(null, formDTO.getStaffName()); |
|
|
|
if (!CollectionUtils.isEmpty(staffList)) { |
|
|
|
formDTO.setStaffId(staffList.get(0).getUserId()); |
|
|
|
} |
|
|
|
} |
|
|
|
//2-2.查询业务数据
|
|
|
|
resultList = staffPatrolRecordDao.selectStaffPatrolList(formDTO); |
|
|
|
//2-3.查询人员基本信息【之前sql关联人员表查性别、姓名效率低 所以分开查)
|
|
|
|
if (!CollectionUtils.isEmpty(staffList)) { |
|
|
|
List<String> staffIdList = resultList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList()); |
|
|
|
staffList = customerStaffDao.selectByStaffIds(staffIdList, null); |
|
|
|
} |
|
|
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); |
|
|
|
List<CustomerStaffDTO> finalStaffList = staffList; |
|
|
|
resultList.forEach(re -> { |
|
|
|
list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); |
|
|
|
finalStaffList.stream().filter(l -> re.getStaffId().equals(l.getUserId())).forEach(s -> { |
|
|
|
re.setGender(s.getGender().toString()); |
|
|
|
re.setStaffName(s.getRealName()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
//NumberFormat numberFormat = NumberFormat.getInstance();
|
|
|
|
//numberFormat.setMaximumFractionDigits(NumConstant.ZERO);
|
|
|
|
resultList.forEach(re -> { |
|
|
|