Browse Source

议题数据查询

master
zhaoqifeng 5 years ago
parent
commit
ef6a5a0344
  1. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java
  2. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/feign/DataStatisticalOpenFeignClient.java
  3. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyDailyDao.java
  5. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java
  6. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridDailyDao.java
  7. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridMonthlyDao.java
  8. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  9. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyDailyService.java
  10. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java
  11. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridDailyService.java
  12. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java
  13. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyDailyServiceImpl.java
  14. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java
  15. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridDailyServiceImpl.java
  16. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java
  17. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyDailyDao.xml
  18. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml
  19. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml
  20. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml
  21. 19
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsIssueService.java
  22. 23
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  23. 32
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.issue.impl; package com.epmet.service.issue.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dao.issue.IssueDao; import com.epmet.dao.issue.IssueDao;
import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO;
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -167,6 +169,7 @@ public class IssueServiceImpl implements IssueService {
} }
private String toRatio(BigDecimal data) { private String toRatio(BigDecimal data) {
return data.stripTrailingZeros().toString().concat("%"); BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
return data.multiply(hundred).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toString().concat("%");
} }
} }

10
epmet-module/data-statistical/data-statistical-client/src/main/java/feign/DataStatisticalOpenFeignClient.java

@ -104,4 +104,14 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/statsgroup/groupagencymonthly") @PostMapping("/data/stats/statsgroup/groupagencymonthly")
Result groupAgencyMonthly(); Result groupAgencyMonthly();
/**
* 议题统计
* @author zhaoqifeng
* @date 2020/6/23 14:34
* @param
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/data/stats/statsissue/issuestats")
Result agencyGridIssueStats();
} }

5
epmet-module/data-statistical/data-statistical-client/src/main/java/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -109,4 +109,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result groupAgencyMonthly() { public Result groupAgencyMonthly() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyMonthly"); return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyMonthly");
} }
@Override
public Result agencyGridIssueStats() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "agencyGridIssueStats");
}
} }

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyDailyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactIssueAgencyDailyEntity; import com.epmet.entity.stats.FactIssueAgencyDailyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 议题数量(按日) * 议题数量(按日)
@ -29,5 +30,14 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface FactIssueAgencyDailyDao extends BaseDao<FactIssueAgencyDailyEntity> { public interface FactIssueAgencyDailyDao extends BaseDao<FactIssueAgencyDailyEntity> {
/**
* 删除
* @author zhaoqifeng
* @date 2020/6/23 14:02
* @param customerId
* @param dateId
* @return void
*/
void deleteByCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId);
} }

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueAgencyMonthlyDao.java

@ -42,5 +42,14 @@ public interface FactIssueAgencyMonthlyDao extends BaseDao<FactIssueAgencyMonthl
* @return java.util.List<com.epmet.dto.stats.FactIssueAgencyMonthlyDTO> * @return java.util.List<com.epmet.dto.stats.FactIssueAgencyMonthlyDTO>
*/ */
List<FactIssueAgencyMonthlyDTO> selectAgencyMonthlyInc(@Param("customerId") String customerId, @Param("monthId") String monthId); List<FactIssueAgencyMonthlyDTO> selectAgencyMonthlyInc(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* 删除
* @author zhaoqifeng
* @date 2020/6/23 14:02
* @param customerId
* @param monthId
* @return void
*/
void deleteByCustomerId(@Param("customerId") String customerId, @Param("monthId") String monthId);
} }

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridDailyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactIssueGridDailyEntity; import com.epmet.entity.stats.FactIssueGridDailyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 网格议题数量(按日) * 网格议题数量(按日)
@ -29,5 +30,14 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface FactIssueGridDailyDao extends BaseDao<FactIssueGridDailyEntity> { public interface FactIssueGridDailyDao extends BaseDao<FactIssueGridDailyEntity> {
/**
* 删除
* @author zhaoqifeng
* @date 2020/6/23 14:02
* @param customerId
* @param dateId
* @return void
*/
void deleteByCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId);
} }

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIssueGridMonthlyDao.java

@ -42,4 +42,14 @@ public interface FactIssueGridMonthlyDao extends BaseDao<FactIssueGridMonthlyEnt
* @return java.util.List<com.epmet.dto.stats.FactIssueGridMonthlyDTO> * @return java.util.List<com.epmet.dto.stats.FactIssueGridMonthlyDTO>
*/ */
List<FactIssueGridMonthlyDTO> selectGridMonthlyInc(@Param("customerId") String customerId, @Param("monthId") String monthId); List<FactIssueGridMonthlyDTO> selectGridMonthlyInc(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* 删除
* @author zhaoqifeng
* @date 2020/6/23 14:02
* @param customerId
* @param monthId
* @return void
*/
void deleteByCustomerId(@Param("customerId") String customerId, @Param("monthId") String monthId);
} }

65
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -96,6 +96,10 @@ public class StatsIssueServiceImpl implements StatsIssueService {
String dateString = DateUtils.format(date); String dateString = DateUtils.format(date);
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); DimAgencyDTO dimAgencyDTO = new DimAgencyDTO();
dimAgencyDTO.setCustomerId(customerId); dimAgencyDTO.setCustomerId(customerId);
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//清空数据
factIssueAgencyDailyService.deleteByCustomerId(customerId, dimId.getDateId());
//获取当前客户下所有机关 //获取当前客户下所有机关
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO);
//获取机关下议题各种状态的数目统计 //获取机关下议题各种状态的数目统计
@ -110,8 +114,6 @@ public class StatsIssueServiceImpl implements StatsIssueService {
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString);
//已结案项目增量 //已结案项目增量
List<ProjectAgencyDTO> projectAgencyClosedIncList = projectService.getAgencyClosedProjectInc(customerId, dateString); List<ProjectAgencyDTO> projectAgencyClosedIncList = projectService.getAgencyClosedProjectInc(customerId, dateString);
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
List<FactIssueAgencyDailyEntity> list = new ArrayList<>(); List<FactIssueAgencyDailyEntity> list = new ArrayList<>();
for (DimAgencyDTO agency : agencyList) { for (DimAgencyDTO agency : agencyList) {
@ -149,7 +151,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
list.add(entity); list.add(entity);
} }
//批量插入 //批量插入
factIssueAgencyDailyService.insertBatch(list); factIssueAgencyDailyService.saveList(list);
} }
@Override @Override
@ -157,6 +159,10 @@ public class StatsIssueServiceImpl implements StatsIssueService {
String dateString = DateUtils.format(date); String dateString = DateUtils.format(date);
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); DimAgencyDTO dimAgencyDTO = new DimAgencyDTO();
dimAgencyDTO.setCustomerId(customerId); dimAgencyDTO.setCustomerId(customerId);
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//清空数据
factIssueAgencyMonthlyService.deleteByCustomerId(customerId, dimId.getMonthId());
//获取当前客户下所有机关 //获取当前客户下所有机关
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO);
//获取机关下议题各种状态的数目统计 //获取机关下议题各种状态的数目统计
@ -165,11 +171,8 @@ public class StatsIssueServiceImpl implements StatsIssueService {
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString);
//已结案项目统计 //已结案项目统计
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString);
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//统计机关下议题各个指标月度增量 //统计机关下议题各个指标月度增量
List<FactIssueAgencyMonthlyDTO> issueAgencyMonthlyIncList = factIssueAgencyMonthlyService.getAgencyMonthlyInc(customerId, dimId.getMonthId()); List<FactIssueAgencyMonthlyDTO> issueAgencyMonthlyIncList = factIssueAgencyMonthlyService.getAgencyMonthlyInc(customerId, dimId.getMonthId());
List<FactIssueAgencyMonthlyEntity> list = new ArrayList<>(); List<FactIssueAgencyMonthlyEntity> list = new ArrayList<>();
for (DimAgencyDTO agency : agencyList) { for (DimAgencyDTO agency : agencyList) {
FactIssueAgencyDailyEntity daily = initIssueAgencyDaily(dimId); FactIssueAgencyDailyEntity daily = initIssueAgencyDaily(dimId);
@ -215,7 +218,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
list.add(monthly); list.add(monthly);
} }
//批量插入 //批量插入
factIssueAgencyMonthlyService.insertBatch(list); factIssueAgencyMonthlyService.saveList(list);
} }
@Override @Override
@ -225,6 +228,8 @@ public class StatsIssueServiceImpl implements StatsIssueService {
dimAgencyDTO.setCustomerId(customerId); dimAgencyDTO.setCustomerId(customerId);
//获取日期相关维度 //获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//清空数据
factIssueGridDailyService.deleteByCustomerId(customerId, dimId.getDateId());
//获取客户下所有网格数据 //获取客户下所有网格数据
List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId); List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId);
//获取网格下议题各种状态的数目统计 //获取网格下议题各种状态的数目统计
@ -241,6 +246,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
List<ProjectGridDTO> closedProjectTotalList = projectService.getGridClosedProjectTotal(customerId, dateString); List<ProjectGridDTO> closedProjectTotalList = projectService.getGridClosedProjectTotal(customerId, dateString);
//已结案项目增量 //已结案项目增量
List<ProjectGridDTO> closedProjectIncList = projectService.getGridClosedProjectTotal(customerId, dateString); List<ProjectGridDTO> closedProjectIncList = projectService.getGridClosedProjectTotal(customerId, dateString);
Map<String, Long> resolveMap= new HashMap<>(); Map<String, Long> resolveMap= new HashMap<>();
Map<String, Long> unResolveMap = new HashMap<>(); Map<String, Long> unResolveMap = new HashMap<>();
Map<String, Long> resolveIncMap = new HashMap<>(); Map<String, Long> resolveIncMap = new HashMap<>();
@ -313,7 +319,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
saveClosedProject(resolveMap, unResolveMap, resolveIncMap, unResolveIncMap, grid, entity); saveClosedProject(resolveMap, unResolveMap, resolveIncMap, unResolveIncMap, grid, entity);
list.add(entity); list.add(entity);
} }
factIssueGridDailyService.insertBatch(list); factIssueGridDailyService.saveList(list);
} }
@Override @Override
@ -323,6 +329,8 @@ public class StatsIssueServiceImpl implements StatsIssueService {
dimAgencyDTO.setCustomerId(customerId); dimAgencyDTO.setCustomerId(customerId);
//获取日期相关维度 //获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//清空数据
factIssueGridMonthlyService.deleteByCustomerId(customerId, dimId.getMonthId());
//获取客户下所有网格数据 //获取客户下所有网格数据
List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId); List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId);
//获取网格下议题各种状态的数目统计 //获取网格下议题各种状态的数目统计
@ -383,12 +391,11 @@ public class StatsIssueServiceImpl implements StatsIssueService {
monthly.setClosedCaseResolvedTotal(resolve); monthly.setClosedCaseResolvedTotal(resolve);
monthly.setClosedCaseUnresolvedTotal(unResolve); monthly.setClosedCaseUnresolvedTotal(unResolve);
if(total > NumConstant.ZERO) { if(total > NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal resolved = new BigDecimal(resolve); BigDecimal resolved = new BigDecimal(resolve);
BigDecimal unresolved = new BigDecimal(unResolve); BigDecimal unresolved = new BigDecimal(unResolve);
BigDecimal closed = new BigDecimal(total); BigDecimal closed = new BigDecimal(total);
monthly.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); monthly.setClosedCaseResolvedPercent(resolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
monthly.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); monthly.setClosedCaseUnresolvedPercent(unresolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
} }
//各指标增量统计 //各指标增量统计
@ -413,7 +420,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
monthly.setGridId(grid.getId()); monthly.setGridId(grid.getId());
list.add(monthly); list.add(monthly);
} }
factIssueGridMonthlyService.insertBatch(list); factIssueGridMonthlyService.saveList(list);
} }
/** /**
@ -443,12 +450,11 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedCaseResolvedIncr(resolveInc); entity.setClosedCaseResolvedIncr(resolveInc);
entity.setClosedCaseUnresolvedIncr(unResolveInc); entity.setClosedCaseUnresolvedIncr(unResolveInc);
if(total != NumConstant.ZERO) { if(total != NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal resolved = new BigDecimal(resolve); BigDecimal resolved = new BigDecimal(resolve);
BigDecimal unresolved = new BigDecimal(unResolve); BigDecimal unresolved = new BigDecimal(unResolve);
BigDecimal closed = new BigDecimal(total); BigDecimal closed = new BigDecimal(total);
entity.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedCaseResolvedPercent(resolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedCaseUnresolvedPercent(unresolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }
@ -513,12 +519,11 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedResolvedTotal(resolvedCount); entity.setClosedResolvedTotal(resolvedCount);
entity.setClosedUnresolvedTotal(unresolvedCount); entity.setClosedUnresolvedTotal(unresolvedCount);
if(entity.getClosedTotal() > NumConstant.ZERO) { if(entity.getClosedTotal() > NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal resolved = new BigDecimal(resolvedCount); BigDecimal resolved = new BigDecimal(resolvedCount);
BigDecimal unresolved = new BigDecimal(unresolvedCount); BigDecimal unresolved = new BigDecimal(unresolvedCount);
BigDecimal closed = new BigDecimal(entity.getClosedTotal()); BigDecimal closed = new BigDecimal(entity.getClosedTotal());
entity.setClosedResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedResolvedPercent(resolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedUnresolvedPercent(unresolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }
@ -597,14 +602,13 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedTotal(closedCount); entity.setClosedTotal(closedCount);
entity.setIssueTotal(issueTotal); entity.setIssueTotal(issueTotal);
if (NumConstant.ZERO != issueTotal) { if (NumConstant.ZERO != issueTotal) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal voting = new BigDecimal(votingCount); BigDecimal voting = new BigDecimal(votingCount);
BigDecimal shift = new BigDecimal(shiftCount); BigDecimal shift = new BigDecimal(shiftCount);
BigDecimal closed = new BigDecimal(closedCount); BigDecimal closed = new BigDecimal(closedCount);
BigDecimal total = new BigDecimal(issueTotal); BigDecimal total = new BigDecimal(issueTotal);
entity.setVotingPercent(voting.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setVotingPercent(voting.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setShiftProjectPercent(shift.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setShiftProjectPercent(shift.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedPercent(closed.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedPercent(closed.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }
@ -676,12 +680,11 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedCaseUnresolvedTotal(unresolvedCount); entity.setClosedCaseUnresolvedTotal(unresolvedCount);
entity.setClosedCaseTotal(total); entity.setClosedCaseTotal(total);
if (total > NumConstant.ZERO) { if (total > NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal resolved = new BigDecimal(resolvedCount); BigDecimal resolved = new BigDecimal(resolvedCount);
BigDecimal unresolved = new BigDecimal(unresolvedCount); BigDecimal unresolved = new BigDecimal(unresolvedCount);
BigDecimal closed = new BigDecimal(total); BigDecimal closed = new BigDecimal(total);
entity.setClosedCaseResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedCaseResolvedPercent(resolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedCaseUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedCaseUnresolvedPercent(unresolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }
@ -763,14 +766,13 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedTotal(closedCount); entity.setClosedTotal(closedCount);
entity.setIssueTotal(issueTotal); entity.setIssueTotal(issueTotal);
if (NumConstant.ZERO != issueTotal) { if (NumConstant.ZERO != issueTotal) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal voting = new BigDecimal(votingCount); BigDecimal voting = new BigDecimal(votingCount);
BigDecimal shift = new BigDecimal(shiftCount); BigDecimal shift = new BigDecimal(shiftCount);
BigDecimal closed = new BigDecimal(closedCount); BigDecimal closed = new BigDecimal(closedCount);
BigDecimal total = new BigDecimal(issueTotal); BigDecimal total = new BigDecimal(issueTotal);
entity.setVotingPercent(voting.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setVotingPercent(voting.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setShiftProjectPercent(shift.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setShiftProjectPercent(shift.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedPercent(closed.multiply(hundred).divide(total, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedPercent(closed.divide(total, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }
@ -806,12 +808,11 @@ public class StatsIssueServiceImpl implements StatsIssueService {
entity.setClosedResolvedTotal(resolvedCount); entity.setClosedResolvedTotal(resolvedCount);
entity.setClosedUnresolvedTotal(unresolvedCount); entity.setClosedUnresolvedTotal(unresolvedCount);
if (entity.getClosedTotal() > NumConstant.ZERO) { if (entity.getClosedTotal() > NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
BigDecimal resolved = new BigDecimal(resolvedCount); BigDecimal resolved = new BigDecimal(resolvedCount);
BigDecimal unresolved = new BigDecimal(unresolvedCount); BigDecimal unresolved = new BigDecimal(unresolvedCount);
BigDecimal closed = new BigDecimal(entity.getClosedTotal()); BigDecimal closed = new BigDecimal(entity.getClosedTotal());
entity.setClosedResolvedPercent(resolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedResolvedPercent(resolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
entity.setClosedUnresolvedPercent(unresolved.multiply(hundred).divide(closed, NumConstant.TWO, RoundingMode.HALF_UP)); entity.setClosedUnresolvedPercent(unresolved.divide(closed, NumConstant.SIX, RoundingMode.HALF_UP));
} }
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyDailyService.java

@ -92,4 +92,23 @@ public interface FactIssueAgencyDailyService extends BaseService<FactIssueAgency
* @date 2020-06-17 * @date 2020-06-17
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 根据客户ID删除
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param customerId
* @param dateId
* @return void
*/
void deleteByCustomerId(String customerId, String dateId);
/**
* 批量保存
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param list
* @return void
*/
void saveList(List<FactIssueAgencyDailyEntity> list);
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueAgencyMonthlyService.java

@ -102,4 +102,23 @@ public interface FactIssueAgencyMonthlyService extends BaseService<FactIssueAgen
* @return java.util.List<com.epmet.dto.stats.FactIssueAgencyMonthlyDTO> * @return java.util.List<com.epmet.dto.stats.FactIssueAgencyMonthlyDTO>
*/ */
List<FactIssueAgencyMonthlyDTO> getAgencyMonthlyInc(String customerId, String monthId); List<FactIssueAgencyMonthlyDTO> getAgencyMonthlyInc(String customerId, String monthId);
/**
* 根据客户ID删除
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param customerId
* @param monthId
* @return void
*/
void deleteByCustomerId(String customerId, String monthId);
/**
* 批量保存
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param list
* @return void
*/
void saveList(List<FactIssueAgencyMonthlyEntity> list);
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridDailyService.java

@ -92,4 +92,23 @@ public interface FactIssueGridDailyService extends BaseService<FactIssueGridDail
* @date 2020-06-17 * @date 2020-06-17
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 根据客户ID删除
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param customerId
* @param dateId
* @return void
*/
void deleteByCustomerId(String customerId, String dateId);
/**
* 批量保存
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param list
* @return void
*/
void saveList(List<FactIssueGridDailyEntity> list);
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIssueGridMonthlyService.java

@ -102,4 +102,23 @@ public interface FactIssueGridMonthlyService extends BaseService<FactIssueGridMo
* @return java.util.List<com.epmet.dto.stats.FactIssueGridMonthlyDTO> * @return java.util.List<com.epmet.dto.stats.FactIssueGridMonthlyDTO>
*/ */
List<FactIssueGridMonthlyDTO> getGridMonthlyInc(String customerId, String monthId); List<FactIssueGridMonthlyDTO> getGridMonthlyInc(String customerId, String monthId);
/**
* 根据客户ID删除
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param customerId
* @param monthId
* @return void
*/
void deleteByCustomerId(String customerId, String monthId);
/**
* 批量保存
* @author zhaoqifeng
* @date 2020/6/23 14:07
* @param list
* @return void
*/
void saveList(List<FactIssueGridMonthlyEntity> list);
} }

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyDailyServiceImpl.java

@ -97,4 +97,16 @@ public class FactIssueAgencyDailyServiceImpl extends BaseServiceImpl<FactIssueAg
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByCustomerId(String customerId, String dateId) {
baseDao.deleteByCustomerId(customerId, dateId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveList(List<FactIssueAgencyDailyEntity> list) {
insertBatch(list);
}
} }

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueAgencyMonthlyServiceImpl.java

@ -103,4 +103,16 @@ public class FactIssueAgencyMonthlyServiceImpl extends BaseServiceImpl<FactIssue
return baseDao.selectAgencyMonthlyInc(customerId, monthId); return baseDao.selectAgencyMonthlyInc(customerId, monthId);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByCustomerId(String customerId, String monthId) {
baseDao.deleteByCustomerId(customerId, monthId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveList(List<FactIssueAgencyMonthlyEntity> list) {
insertBatch(list);
}
} }

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridDailyServiceImpl.java

@ -97,4 +97,16 @@ public class FactIssueGridDailyServiceImpl extends BaseServiceImpl<FactIssueGrid
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByCustomerId(String customerId, String dateId) {
baseDao.deleteByCustomerId(customerId, dateId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveList(List<FactIssueGridDailyEntity> list) {
insertBatch(list);
}
} }

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIssueGridMonthlyServiceImpl.java

@ -102,4 +102,16 @@ public class FactIssueGridMonthlyServiceImpl extends BaseServiceImpl<FactIssueGr
return baseDao.selectGridMonthlyInc(customerId, monthId); return baseDao.selectGridMonthlyInc(customerId, monthId);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByCustomerId(String customerId, String monthId) {
baseDao.deleteByCustomerId(customerId, monthId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveList(List<FactIssueGridMonthlyEntity> list) {
insertBatch(list);
}
} }

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyDailyDao.xml

@ -45,6 +45,9 @@
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteByCustomerId">
DELETE FROM fact_issue_agency_daily WHERE CUSTOMER_ID = #{customerId} AND DATE_ID = #{dateId}
</delete>
</mapper> </mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml

@ -43,6 +43,9 @@
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteByCustomerId">
DELETE FROM fact_issue_agency_monthly WHERE CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId}
</delete>
<select id="selectAgencyMonthlyInc" resultType="com.epmet.dto.stats.FactIssueAgencyMonthlyDTO"> <select id="selectAgencyMonthlyInc" resultType="com.epmet.dto.stats.FactIssueAgencyMonthlyDTO">
SELECT SELECT

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridDailyDao.xml

@ -45,6 +45,9 @@
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteByCustomerId">
DELETE FROM fact_issue_grid_daily WHERE CUSTOMER_ID = #{customerId} AND DATE_ID = #{dateId}
</delete>
</mapper> </mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml

@ -43,6 +43,14 @@
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<delete id="deleteByCustomerId">
DELETE
FROM
fact_issue_grid_monthly
WHERE
CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
</delete>
<select id="selectGridMonthlyInc" resultType="com.epmet.dto.stats.FactIssueGridMonthlyDTO"> <select id="selectGridMonthlyInc" resultType="com.epmet.dto.stats.FactIssueGridMonthlyDTO">
SELECT SELECT

19
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsIssueService.java

@ -0,0 +1,19 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/6/23 14:38
*/
public interface StatsIssueService {
/**
* 议题统计
* @author zhaoqifeng
* @date 2020/6/23 14:39
* @param
* @return com.epmet.commons.tools.utils.Result
*/
Result agencyGridIssueStats();
}

23
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -0,0 +1,23 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.StatsIssueService;
import feign.DataStatisticalOpenFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/6/23 14:40
*/
@Service
public class StatsIssueServiceImpl implements StatsIssueService {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public Result agencyGridIssueStats() {
return dataStatisticalOpenFeignClient.agencyGridIssueStats();
}
}

32
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java

@ -0,0 +1,32 @@
package com.epmet.task;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.StatsIssueService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/6/23 14:36
*/
@Slf4j
@Component("statsIssueTask")
public class StatsIssueTask implements ITask {
@Autowired
private StatsIssueService statsIssueService;
@Override
public void run(String params) {
log.debug("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
Result result = statsIssueService.agencyGridIssueStats();
if (result.success()){
log.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行成功");
}else {
log.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
}
}
}
Loading…
Cancel
Save