Browse Source

Merge remote-tracking branch 'origin/dev_shibei_match' into shibei_master

release
jianjun 4 years ago
parent
commit
fb2dda4827
  1. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  2. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java
  6. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java
  8. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  9. 5
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/WorkDayServiceImpl.java
  10. 1
      epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/CalenderDao.xml

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -135,10 +135,15 @@ public class StatsGroupServiceImpl implements StatsGroupService {
if (customerIds.size() != NumConstant.ZERO) { if (customerIds.size() != NumConstant.ZERO) {
DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(formDTO); DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(formDTO);
customerIds.forEach(customerId -> { customerIds.forEach(customerId -> {
Boolean status = true;
try { try {
List<DimAgencyDTO> customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId); List<DimAgencyDTO> customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId);
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId); List<List<DimAgencyDTO>> partition = ListUtils.partition(customerAgencyInfos, NumConstant.ONE_HUNDRED);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily, customerId); for (List<DimAgencyDTO> p : partition) {
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(p, dimIdBean, customerId);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily, customerId,status);
status = false;
}
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(GroupConstant.STATS_FAILED_AGENCY_DAILY, customerId, LocalDate.now(), e)); log.error(String.format(GroupConstant.STATS_FAILED_AGENCY_DAILY, customerId, LocalDate.now(), e));
} }

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java

@ -185,13 +185,15 @@ public class StatsProjectServiceImpl implements StatsProjectService {
projectEntity.setCustomerId(customerId); projectEntity.setCustomerId(customerId);
projectEntity.setCreatedTime(date); projectEntity.setCreatedTime(date);
projectEntity.setStatus(ProjectConstant.CLOSED); projectEntity.setStatus(ProjectConstant.CLOSED);
projectEntity.setPageSize(NumConstant.ONE_THOUSAND); projectEntity.setPageSize(NumConstant.FIFTY);
int pageNo = NumConstant.ONE; int pageNo = NumConstant.ONE;
int size = NumConstant.ZERO;
List<ProjectProcessEntity> processList = new ArrayList<>(); List<ProjectProcessEntity> processList = new ArrayList<>();
do { do {
//1.一千条一循环查询节点数据,封装每个组织对应数据 //1.一千条一循环查询节点数据,封装每个组织对应数据
projectEntity.setPageNo(pageNo); projectEntity.setPageNo(pageNo);
processList = projectProcessService.getProcessList(projectEntity); processList = projectProcessService.getProcessList(projectEntity);
size = processList.size();
pageNo++; pageNo++;
//遍历删除项目节点表查询的无效数据 //遍历删除项目节点表查询的无效数据
if (list.size() > NumConstant.ZERO) { if (list.size() > NumConstant.ZERO) {
@ -248,8 +250,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
entity.setPendingTotal(entity.getPendingTotal() + projectTotal.intValue() - closedTotal.intValue()); entity.setPendingTotal(entity.getPendingTotal() + projectTotal.intValue() - closedTotal.intValue());
entity.setClosedTotal(entity.getClosedTotal() + closedTotal.intValue()); entity.setClosedTotal(entity.getClosedTotal() + closedTotal.intValue());
if (projectTotal.intValue() > NumConstant.ZERO) { if (projectTotal.intValue() > NumConstant.ZERO) {
entity.setPendingRatio(new BigDecimal(numberFormat.format((float) entity.getPendingTotal() / (float) projectTotal.intValue()))); entity.setPendingRatio(new BigDecimal(numberFormat.format((float) entity.getPendingTotal() / (float) entity.getProjectTotal())));
entity.setClosedRatio(new BigDecimal(numberFormat.format((float) closedTotal.intValue() / (float) projectTotal.intValue()))); entity.setClosedRatio(new BigDecimal(numberFormat.format((float) entity.getClosedTotal() / (float) entity.getProjectTotal())));
} }
entity.setProjectIncr(entity.getProjectIncr() + projectIncr.intValue()); entity.setProjectIncr(entity.getProjectIncr() + projectIncr.intValue());
entity.setPendingIncr(entity.getPendingIncr() + projectIncr.intValue()); entity.setPendingIncr(entity.getPendingIncr() + projectIncr.intValue());
@ -267,8 +269,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
entity.setPendingTotal(projectTotal.intValue() - closedTotal.intValue()); entity.setPendingTotal(projectTotal.intValue() - closedTotal.intValue());
entity.setClosedTotal(closedTotal.intValue()); entity.setClosedTotal(closedTotal.intValue());
if (projectTotal.intValue() > NumConstant.ZERO) { if (projectTotal.intValue() > NumConstant.ZERO) {
entity.setPendingRatio(new BigDecimal(numberFormat.format((float) entity.getPendingTotal() / (float) projectTotal.intValue()))); entity.setPendingRatio(new BigDecimal(numberFormat.format((float) entity.getPendingTotal() / (float) entity.getProjectTotal())));
entity.setClosedRatio(new BigDecimal(numberFormat.format((float) closedTotal.intValue() / (float) projectTotal.intValue()))); entity.setClosedRatio(new BigDecimal(numberFormat.format((float) entity.getClosedTotal() / (float) entity.getProjectTotal())));
} }
entity.setProjectIncr(projectIncr.intValue()); entity.setProjectIncr(projectIncr.intValue());
entity.setPendingIncr(projectIncr.intValue()); entity.setPendingIncr(projectIncr.intValue());
@ -276,7 +278,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
} }
mapList.put(agency.getId(), entity); mapList.put(agency.getId(), entity);
} }
} while (!CollectionUtil.isEmpty(processList) && processList.size() == NumConstant.ONE_THOUSAND); } while (size == NumConstant.FIFTY);
//二、再分页查询项目表数据,封装每个组织的已结案已解决总数、已结案未解决总数;日增量中已结案已解决总数、已结案未解决总数 //二、再分页查询项目表数据,封装每个组织的已结案已解决总数、已结案未解决总数;日增量中已结案已解决总数、已结案未解决总数
int num = NumConstant.ONE; int num = NumConstant.ONE;
@ -285,6 +287,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
//3.一千条一循环查询项目数据,封装每个组织对应数据 //3.一千条一循环查询项目数据,封装每个组织对应数据
projectEntity.setPageNo(num); projectEntity.setPageNo(num);
projectList = projectService.getProjectList(projectEntity); projectList = projectService.getProjectList(projectEntity);
size = projectList.size();
num++; num++;
//遍历删除项目主表查询的无效数据 //遍历删除项目主表查询的无效数据
if (list.size() > NumConstant.ZERO) { if (list.size() > NumConstant.ZERO) {
@ -343,8 +346,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
entity.setResolvedTotal(entity.getResolvedTotal() + resolvedTotal.intValue()); entity.setResolvedTotal(entity.getResolvedTotal() + resolvedTotal.intValue());
entity.setUnresolvedTotal(entity.getUnresolvedTotal() + unResolvedTotal.intValue()); entity.setUnresolvedTotal(entity.getUnresolvedTotal() + unResolvedTotal.intValue());
if (entity.getClosedTotal() > NumConstant.ZERO) { if (entity.getClosedTotal() > NumConstant.ZERO) {
entity.setResolvedRatio(new BigDecimal(numberFormat.format((float) resolvedTotal.intValue() / (float) entity.getClosedTotal()))); entity.setResolvedRatio(new BigDecimal(numberFormat.format((float) entity.getResolvedTotal() / (float) entity.getClosedTotal())));
entity.setUnresolvedRatio(new BigDecimal(numberFormat.format((float) unResolvedTotal.intValue() / (float) entity.getClosedTotal()))); entity.setUnresolvedRatio(new BigDecimal(numberFormat.format((float) entity.getUnresolvedTotal() / (float) entity.getClosedTotal())));
} }
entity.setResolvedIncr(entity.getResolvedIncr() + resolvedIncr.intValue()); entity.setResolvedIncr(entity.getResolvedIncr() + resolvedIncr.intValue());
entity.setUnresolvedIncr(entity.getUnresolvedIncr() + unResolvedIncr.intValue()); entity.setUnresolvedIncr(entity.getUnresolvedIncr() + unResolvedIncr.intValue());
@ -371,7 +374,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
} }
mapList.put(agency.getId(), entity); mapList.put(agency.getId(), entity);
} }
} while (!CollectionUtil.isEmpty(projectList) && projectList.size() == NumConstant.ONE_THOUSAND); } while (size == NumConstant.FIFTY);
List<FactAgencyProjectDailyEntity> projectDateEntityList = new ArrayList<>(mapList.values()); List<FactAgencyProjectDailyEntity> projectDateEntityList = new ArrayList<>(mapList.values());
//三、批量保存数据,先删后增 //三、批量保存数据,先删后增

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java

@ -34,6 +34,7 @@ import com.epmet.dto.screen.ScreenProjectProcessDTO;
import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.entity.project.ProjectProcessEntity;
import com.epmet.service.project.ProjectProcessService; import com.epmet.service.project.ProjectProcessService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -62,6 +63,7 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao
**/ **/
@Override @Override
public List<ProjectProcessEntity> getProcessList(ProjectEntity projectEntity) { public List<ProjectProcessEntity> getProcessList(ProjectEntity projectEntity) {
PageHelper.startPage(projectEntity.getPageNo(), projectEntity.getPageSize());
return baseDao.selectProcessList(projectEntity); return baseDao.selectProcessList(projectEntity);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java

@ -28,6 +28,7 @@ import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectEntity;
import com.epmet.service.project.ProjectService; import com.epmet.service.project.ProjectService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -54,6 +55,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
**/ **/
@Override @Override
public List<ProjectEntity> getProjectList(ProjectEntity projectEntity) { public List<ProjectEntity> getProjectList(ProjectEntity projectEntity) {
PageHelper.startPage(projectEntity.getPageNo(), projectEntity.getPageSize());
return baseDao.selectProjectList(projectEntity); return baseDao.selectProjectList(projectEntity);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java

@ -101,7 +101,7 @@ public interface FactGroupAgencyDailyService extends BaseService<FactGroupAgency
* @param agencyList * @param agencyList
* @author zxc * @author zxc
*/ */
void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId); void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId,Boolean status);
/** /**
* @param * @param

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java

@ -113,12 +113,15 @@ public class FactGroupAgencyDailyServiceImpl extends BaseServiceImpl<FactGroupAg
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId) { public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId,Boolean status) {
if (!CollectionUtils.isEmpty(agencyList)){ if (!CollectionUtils.isEmpty(agencyList)){
Integer delNum; // true 为当前客户第一回进入,需要删除历史数据
do { if (status){
delNum = baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId(),customerId); Integer delNum;
}while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND); do {
delNum = baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId(),customerId);
}while (delNum > NumConstant.ZERO && delNum == NumConstant.ONE_THOUSAND);
}
List<List<AgencyGroupDailyResultDTO>> partition = ListUtils.partition(agencyList, NumConstant.ONE_HUNDRED); List<List<AgencyGroupDailyResultDTO>> partition = ListUtils.partition(agencyList, NumConstant.ONE_HUNDRED);
partition.forEach(p -> { partition.forEach(p -> {
baseDao.insertGroupAgencyDaily(p); baseDao.insertGroupAgencyDaily(p);

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java

@ -120,8 +120,8 @@ public class FactGroupGridDailyServiceImpl extends BaseServiceImpl<FactGroupGrid
return; return;
} }
String dateId = formDto.get(NumConstant.ZERO).getDateId(); String dateId = formDto.get(NumConstant.ZERO).getDateId();
// true 为当前客户第一回进入 // true 为当前客户第一回进入,需要删除历史数据
if (!status){ if (status){
Integer delNum; Integer delNum;
do { do {
delNum = baseDao.deleteInsertDateId(dateId,customerId); delNum = baseDao.deleteInsertDateId(dateId,customerId);

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -5,7 +5,10 @@
<select id="selectProjectList" resultType="com.epmet.entity.project.ProjectEntity"> <select id="selectProjectList" resultType="com.epmet.entity.project.ProjectEntity">
SELECT SELECT
* id,
customer_id,
agency_id,
closed_status
FROM FROM
project project
WHERE WHERE

5
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/WorkDayServiceImpl.java

@ -3,14 +3,13 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ProjectConstant; import com.epmet.constant.ProjectConstant;
import com.epmet.dao.CalenderDao; import com.epmet.dao.CalenderDao;
import com.epmet.dto.form.CostDayFormDTO; import com.epmet.dto.form.CostDayFormDTO;
import com.epmet.dto.form.TimestampIntervalFormDTO; import com.epmet.dto.form.TimestampIntervalFormDTO;
import com.epmet.dto.form.WorkDayFormDTO; import com.epmet.dto.form.WorkDayFormDTO;
import com.epmet.dto.result.CostDayResultDTO;
import com.epmet.dto.form.WorkMinuteFormDTO; import com.epmet.dto.form.WorkMinuteFormDTO;
import com.epmet.dto.result.CostDayResultDTO;
import com.epmet.dto.result.WorkDayResultDTO; import com.epmet.dto.result.WorkDayResultDTO;
import com.epmet.entity.CalenderEntity; import com.epmet.entity.CalenderEntity;
import com.epmet.service.WorkDayService; import com.epmet.service.WorkDayService;
@ -271,7 +270,7 @@ public class WorkDayServiceImpl implements WorkDayService {
LocalDateTime initialTime = LocalDateTime.ofInstant(right.toInstant(), ZoneId.systemDefault()) LocalDateTime initialTime = LocalDateTime.ofInstant(right.toInstant(), ZoneId.systemDefault())
.withHour(NumConstant.ZERO).withMinute(NumConstant.ZERO).withSecond(NumConstant.ZERO).withNano(NumConstant.ZERO); .withHour(NumConstant.ZERO).withMinute(NumConstant.ZERO).withSecond(NumConstant.ZERO).withNano(NumConstant.ZERO);
//ChronoUnit日期枚举类,between方法计算两个时间对象之间的时间量 //ChronoUnit日期枚举类,between方法计算两个时间对象之间的时间量
costMin += ChronoUnit.SECONDS.between(localDateTime, initialTime)/NumConstant.SIXTY; costMin += ChronoUnit.SECONDS.between(initialTime, localDateTime)/NumConstant.SIXTY;
} }
if(NumConstant.TWO == list.size()) { if(NumConstant.TWO == list.size()) {
return costMin; return costMin;

1
epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/CalenderDao.xml

@ -60,6 +60,7 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND QUERY_DATE BETWEEN #{begin} AND QUERY_DATE BETWEEN #{begin}
AND #{end} AND #{end}
order by query_date asc
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save