diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java index 48512ed7af..62939c595f 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/config/DynamicDataSource.java @@ -24,7 +24,9 @@ public class DynamicDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { - return DynamicContextHolder.peek(); + String ds = DynamicContextHolder.peek(); + logger.info("动态数据源:{}" + ds); + return ds; } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java index 8e065c792a..4500453213 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java @@ -41,7 +41,7 @@ public class CustomerApplicationRunner implements ApplicationRunner { //发送启动成功消息 EnvEnum currentEnv = EnvEnum.getCurrentEnv(); logger.info(currentEnv); - if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode())) { + if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java index 0c3f798318..ed782790e8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java @@ -11,6 +11,7 @@ import org.springframework.core.env.Environment; * @date 2020-07-03 11:14 **/ public enum EnvEnum { + LOCAL("local", "本地环境"), DEV("dev", "开发环境"), TEST("test", "体验环境"), PROD("prod", "生产环境"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 786067c3f0..ea8f100f6c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -325,6 +325,14 @@ public class RedisKeys { * @return */ public static String getCustomerStatsCalFlag(String customerId) { - return String.format(rootPrefix + "stats:calflag:%s", customerId); + return getCustomerStatsCalKeyPrefix().concat(":").concat(customerId); + } + + /** + * 获取计算标记的key前缀 + * @return + */ + public static String getCustomerStatsCalKeyPrefix() { + return rootPrefix.concat("stats:calflag"); } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java new file mode 100644 index 0000000000..80019a15c4 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ActTrendMonthlyResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 公益互助-公益活动次数 + * @Author sun + */ +@Data +public class ActTrendMonthlyResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 月id :yyyyMM + */ + private String monthId = ""; + + /** + * 活动数量(本月举行的活动) + */ + private Integer actCount = 0; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java new file mode 100644 index 0000000000..4ebc3422d0 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartActcounttrendResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; +import rx.internal.util.LinkedArrayList; + +import java.io.Serializable; +import java.util.LinkedList; + +/** + * 公益互助-公益活动次数 + * @Author sun + */ +@Data +public class HeartActcounttrendResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 横坐标 月份集合 + */ + private LinkedList xAxis; + + /** + * 活动次数 集合 + */ + private LinkedList actCountDataList; + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java new file mode 100644 index 0000000000..a91482cebe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HeartSummaryResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 公益互助-各类总数汇总 + * @Author sun + */ +@Data +public class HeartSummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 日期Id, 数据更新至:yyyyMMdd + */ + private String dateId = ""; + + /** + * 活动次数 + */ + private Integer actCount = 0; + /** + * 志愿者总数 + */ + private Integer volunteerCount = 0; + /** + * 参与人次 + */ + private Integer partiUserCount = 0; + /** + * 发放积分 + */ + private Integer rewardPointCount = 0; + /** + * 公益时长 + */ + private Integer heartTime = 0; + + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java new file mode 100644 index 0000000000..cbecba012c --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/HomepageSummaryResultDTO.java @@ -0,0 +1,71 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 首页-平台各类总数 + * @Author sun + */ +@Data +public class HomepageSummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 数据更新至:yyyyMMdd + */ + private String dateId = ""; + + /** + * 网格总数 + */ + private Integer gridCount = 0; + /** + * 已开通网格数 + */ + private Integer openedGridCount = 0; + /** + * 议题总数 + */ + private Integer issueCount = 0; + /** + * 项目总数 + */ + private Integer projectCount = 0; + /** + * 用户总数 + */ + private Integer userCount = 0; + /** + * 党员用户 + */ + private Integer partyUserCount = 0; + /** + * 社群总数 + */ + private Integer groupCount = 0; + /** + * 话题总数 + */ + private Integer topicCount = 0; + /** + * 新闻总数 + */ + private Integer newsCount = 0; + /** + * 阅读数量 + */ + private Integer readCount = 0; + /** + * 公益活动总数 + */ + private Integer actCount = 0; + /** + * 志愿者总数 + */ + private Integer volunteerCount = 0; + + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java index eb28cd5270..88a9a425bd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java @@ -1,7 +1,14 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.utils.Result; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -19,12 +26,37 @@ public class KcScreenController { private KcScreenService kcScreenService; -// @ExternalAppRequestAuth -// @PostMapping("homepage/summary") -// public Result yearAverageIndex(){ -//// ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class); -//// return new Result().ok(indexService.yearAverageIndex(yearAverageIndexFormDTO)); -// } + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("homepage/summary") + public Result homepageSummary(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.homepageSummary(externalAppRequestParam)); + } + + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("heart/summary") + public Result heartSummary(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.heartSummary(externalAppRequestParam)); + } + + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + @ExternalAppRequestAuth + @PostMapping("heart/actcounttrend") + public Result heartActcounttrend(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(kcScreenService.heartActcounttrend(externalAppRequestParam)); + } - // @RequestBody } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java index 052febf324..bb7cdaad84 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcActTrendMonthlyDao.java @@ -17,8 +17,11 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.ActTrendMonthlyResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * KC-活动(次数+时长)趋势(先根据customerId+monthId删除) * @@ -28,4 +31,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcActTrendMonthlyDao { + /** + * @param customerId + * @Description 按客户查询最近十二个月数据 + * @author sun + */ + List selectActTrendMonthly(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java index 04c0d5dec9..44ac5c506a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcPlatformSummaryDailyDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -28,4 +29,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcPlatformSummaryDailyDao { + /** + * @param customerId + * @Description 首页-平台各类总数 + * @author sun + */ + HomepageSummaryResultDTO selectSummaryDaily(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java index 91bd730689..64ef74f376 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screenkc; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; import org.apache.ibatis.annotations.Mapper; /** @@ -28,4 +29,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenKcVolunteerHeatRankGridDailyDao { + /** + * @param customerId + * @Description 公益互助-各类总数汇总 + * @author sun + */ + HeartSummaryResultDTO selectHeartSummary(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java index e079aefb42..0e58cf7c08 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java @@ -1,5 +1,10 @@ package com.epmet.datareport.service.evaluationindex.screen; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; + /** * 孔村大屏api * @@ -8,5 +13,24 @@ package com.epmet.datareport.service.evaluationindex.screen; */ public interface KcScreenService { + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam); + + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam); + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java index 619eba4625..73ebfc5c14 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java @@ -86,7 +86,11 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) { - return screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + PartymemberAgeDistributionResultDTO ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + if(null == ageInfo){ + ageInfo = new PartymemberAgeDistributionResultDTO(); + } + return ageInfo; } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index e3e6ce4a61..b0c9715031 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.Comparator; @@ -53,6 +54,10 @@ public class IndexServiceImpl implements IndexService { if (null == yearAverageIndexResultDTO){ return new YearAverageIndexResultDTO(); } + yearAverageIndexResultDTO.setPartyDevAbility(getRound(yearAverageIndexResultDTO.getPartyDevAbility())); + yearAverageIndexResultDTO.setGovernAbility(getRound(yearAverageIndexResultDTO.getGovernAbility())); + yearAverageIndexResultDTO.setServiceAbility(getRound(yearAverageIndexResultDTO.getServiceAbility())); + yearAverageIndexResultDTO.setYearAverageIndex(getRound(yearAverageIndexResultDTO.getYearAverageIndex())); return yearAverageIndexResultDTO; } @@ -66,19 +71,23 @@ public class IndexServiceImpl implements IndexService { @Override public MonthPieChartResultDTO monthPieChart(MonthPieChartFormDTO monthPieChartFormDTO) { - MonthPieChartResultDTO monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),null); + MonthPieChartResultDTO pieChartDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),null); + if (null == pieChartDTO){ + return new MonthPieChartResultDTO(); + } + // 处理小数四舍五入 + pieChartDTO.setPartyDevAbility(getRound(pieChartDTO.getPartyDevAbility())); + pieChartDTO.setGovernAbility(getRound(pieChartDTO.getGovernAbility())); + pieChartDTO.setServiceAbility(getRound(pieChartDTO.getServiceAbility())); String monthId = dateUtils.getCurrentMonthId(); int time = NumConstant.TWELVE; //保证获取月度指数数据的最大可能性 - while(null == monthPieChartResultDTO && time > NumConstant.ONE){ + while(null == pieChartDTO && time > NumConstant.ONE){ time--; monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); - monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),monthId); + pieChartDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId(),monthId); } - if (null == monthPieChartResultDTO){ - return new MonthPieChartResultDTO(); - } - return monthPieChartResultDTO; + return pieChartDTO; } /** @@ -112,6 +121,13 @@ public class IndexServiceImpl implements IndexService { result.setTotalIndexData(totalIndexData); return result; } + // 处理小数四舍五入 + monthBarchartResults.forEach(barchart -> { + barchart.setPartyDevAbility(getRound(barchart.getPartyDevAbility())); + barchart.setGovernAbility(getRound(barchart.getGovernAbility())); + barchart.setServiceAbility(getRound(barchart.getServiceAbility())); + barchart.setIndexTotal(getRound(barchart.getIndexTotal())); + }); List collect = monthBarchartResults.stream().sorted(Comparator.comparing(MonthBarchartResult::getMonthId)).collect(Collectors.toList()); //升序 当前月份在队尾 List _ymList = dateUtils.getXpro().keySet().stream().collect(Collectors.toList()); @@ -178,6 +194,13 @@ public class IndexServiceImpl implements IndexService { if (CollectionUtils.isEmpty(subAgencyIndexRankResultDTOS)){ return new ArrayList<>(); } + // 小数四舍五入 + subAgencyIndexRankResultDTOS.forEach(indexRank -> { + indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility())); + indexRank.setGovernAbility(getRound(indexRank.getGovernAbility())); + indexRank.setServiceAbility(getRound(indexRank.getServiceAbility())); + indexRank.setTotalIndex(getRound(indexRank.getTotalIndex())); + }); return subAgencyIndexRankResultDTOS; } @@ -191,7 +214,25 @@ public class IndexServiceImpl implements IndexService { } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())){ // 月(上一个月) 指数排行 subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectAnNingSubAgencyIndexMonthlyRank(formDTO); + subAgencyIndexRankResultDTOS.forEach(rank -> { + rank.setPartyDevAbility(getRound(rank.getPartyDevAbility())); + rank.setGovernAbility(getRound(rank.getGovernAbility())); + rank.setServiceAbility(getRound(rank.getServiceAbility())); + rank.setTotalIndex(getRound(rank.getTotalIndex())); + }); } return subAgencyIndexRankResultDTOS; } + + /** + * @Description 小数四舍五入 + * @param d + * @author zxc + * @date 2020/9/14 2:01 下午 + */ + public Double getRound(Double d){ + BigDecimal bigDecimal = new BigDecimal(d); + BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP); + return Double.valueOf(b.toString()); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java index a7f656884b..02b2c9c02d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java @@ -1,12 +1,23 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcActTrendMonthlyDao; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcPlatformSummaryDailyDao; +import com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcVolunteerHeatRankGridDailyDao; import com.epmet.datareport.service.evaluationindex.screen.KcScreenService; import com.epmet.datareport.utils.DateUtils; +import com.epmet.evaluationindex.screen.dto.result.ActTrendMonthlyResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartActcounttrendResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HeartSummaryResultDTO; +import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.LinkedList; +import java.util.List; + /** * 孔村大屏api * @@ -19,6 +30,54 @@ public class KcScreenServiceImpl implements KcScreenService { @Autowired private DateUtils dateUtils; + @Autowired + private ScreenKcPlatformSummaryDailyDao screenKcPlatformSummaryDailyDao; + @Autowired + private ScreenKcVolunteerHeatRankGridDailyDao screenKcVolunteerHeatRankGridDailyDao; + @Autowired + private ScreenKcActTrendMonthlyDao screenKcActTrendMonthlyDao; + + /** + * @param externalAppRequestParam + * @Description 首页-平台各类总数 + * @author sun + */ + @Override + public HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam) { + return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId()); + } + + /** + * @param externalAppRequestParam + * @Description 公益互助-各类总数汇总 + * @author sun + */ + @Override + public HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam) { + return screenKcVolunteerHeatRankGridDailyDao.selectHeartSummary(externalAppRequestParam.getCustomerId()); + } + /** + * @param externalAppRequestParam + * @Description 公益互助-公益活动次数 + * @author sun + */ + @Override + public HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam) { + HeartActcounttrendResultDTO resultDTO = new HeartActcounttrendResultDTO(); + LinkedList xAxis = new LinkedList<>(); + LinkedList actCountDataList = new LinkedList<>(); + //1.按客户查询最近十二个月数据 + List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId()); + //2.倒序遍历封装数据 + for (int i = list.size() - 1; i >= 0; i--) { + xAxis.add(list.get(i).getMonthId()); + actCountDataList.add(list.get(i).getActCount().toString()); + } + //3.封装数据并返回 + resultDTO.setXAxis(xAxis); + resultDTO.setActCountDataList(actCountDataList); + return resultDTO; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml index 793be083a1..1be215aa54 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index 58a41b9d5f..0a040c2ccb 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -6,9 +6,9 @@ SELECT month_id AS monthId, - ROUND(service_ablity,1) AS serviceAbility, - ROUND(party_dev_ablity,1) AS partyDevAbility, - ROUND(govern_ablity,1) AS governAbility, - ROUND(index_total,1) AS indexTotal + service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility, + party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility, + govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility, + (service_ablity * SERVICE_ABLITY_WEIGHT + party_dev_ablity * PARTY_DEV_WEIGHT + govern_ablity * GOVERN_ABLITY_WEIGHT) AS indexTotal FROM screen_index_data_monthly WHERE @@ -47,10 +47,10 @@ SELECT - ROUND(index_total,1) AS yearAverageIndex, - ROUND(service_ablity,1) AS serviceAbility, - ROUND(party_dev_ablity,1) AS partyDevAbility, - ROUND(govern_ablity,1) AS governAbility + index_total AS yearAverageIndex, + service_ablity AS serviceAbility, + party_dev_ablity AS partyDevAbility, + govern_ablity AS governAbility FROM screen_index_data_yearly WHERE diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml index 5978feed5a..55b9bca50a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcActTrendMonthlyDao.xml @@ -4,5 +4,18 @@ - + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml index 1618b51341..1b2818d77c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcPlatformSummaryDailyDao.xml @@ -3,5 +3,29 @@ + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml index 4c6ff538f8..581f4a013e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcVolunteerHeatRankGridDailyDao.xml @@ -4,4 +4,21 @@ + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java new file mode 100644 index 0000000000..f4425ee714 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CalculateStatus.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * 计算状态 + * calculating:正在计算中。有实例正在计算 + * pendding:计算暂停,说明计算过程中实例发生重启,等待重新计算 + */ +public interface CalculateStatus { + + String PENDDING = "pendding"; + String CALCULATING = "calculating"; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java index 6e6bdf9359..5d00324e55 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcNewsTrendFormDTO.java @@ -15,11 +15,6 @@ public class KcNewsTrendFormDTO implements Serializable { private static final long serialVersionUID = 1L; - /** - * 阅读数量 - */ - private Integer readCount; - /** * 参与数量 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index 1f1c1b10fe..107bc8f478 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -173,4 +173,11 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/statstopic/execute") Result execTopicStatistical(@RequestParam(value = "date",required = false) String date); + /** + * 处理暂停的计算 + * @return + */ + @PostMapping("/data/stats/indexcalculate/process-pendding-cals") + Result processPenddingCalculate(); + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index d58fa69ec4..1c79cfc56b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -170,4 +170,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result execTopicStatistical(String date) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execTopicStatistical",date); } + + @Override + public Result processPenddingCalculate() { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "processPenddingCalculate"); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 8459b99f50..b9491f1cf2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -2,13 +2,17 @@ package com.epmet.controller; import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.CalculateStatus; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.model.CalculateFlagModel; import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.util.DimIdGenerator; @@ -25,6 +29,7 @@ import javax.annotation.PreDestroy; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.concurrent.*; /** @@ -59,20 +64,43 @@ public class IndexCalculateController { private Map futureMap = new HashMap<>(); @PreDestroy - public void clearDataCalFlag() { - // 实例销毁之前,将正在本实例中执行计算的客户列表的计算状态清空 + public void saveCalStatus() { + // 实例销毁之前,将正在本实例中执行计算的客户列表的计算状态修改为pendding,等待其他实例重新计算 futureMap.forEach((customerId, future) -> { - redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); + CalculateFlagModel flag = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); + flag.setStatus(CalculateStatus.PENDDING); + redisUtils.set(RedisKeys.getCustomerStatsCalFlag(customerId), flag); + log.info("客户【%s】正在执行计算,实例发生重启,修改计算状态为:calculation->pendding", customerId); }); } + /** + * 处理暂停中的计算 + */ + @PostMapping("process-pendding-cals") + public Result processPenddingCalculate() { + String keyPrefix = RedisKeys.getCustomerStatsCalKeyPrefix(); + Set calFlagKeys = redisUtils.keys(keyPrefix.concat("*")); + calFlagKeys.forEach(key -> { + CalculateFlagModel flag = (CalculateFlagModel) redisUtils.get(key); + if (flag != null && CalculateStatus.PENDDING.equals(flag.getStatus())) { + // 找到状态是pendding的key,执行计算 + CalculateCommonFormDTO form = new CalculateCommonFormDTO(); + form.setCustomerId(flag.getForm().getCustomerId()); + form.setMonthId(flag.getForm().getMonthId()); + indexCalculate(form); + } + }); + + return new Result(); + } /** * 按照客户计算所有指标(按照月份) * * @param formDTO * @return com.epmet.commons.tools.utils.Result - * @Author zhangyong + * @Author zhangyongç * @Date 10:52 2020-08-20 **/ @ExternalAppRequestAuth @@ -80,34 +108,66 @@ public class IndexCalculateController { public Result indexCalculate(ExternalAppRequestParam externalAppRequestParam, @RequestBody CalculateCommonFormDTO formDTO) { String customerId = externalAppRequestParam.getCustomerId(); //String customerId = "epmettest"; - Boolean executing = (Boolean) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); - if (executing == null || !executing) { + formDTO.setCustomerId(customerId); + indexCalculate(formDTO); + return new Result().ok(true); + } + + /** + * 指标计算 + * @param formDTO + */ + private void indexCalculate(CalculateCommonFormDTO formDTO) { + CalculateFlagModel executeFlag = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + if (executeFlag == null || !CalculateStatus.CALCULATING.equals(executeFlag.getStatus())) { + // 可以计算 synchronized (statsCalLock) { - Boolean executing2 = (Boolean) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(customerId)); - if (executing2 != null && executing2) { - log.error(String.format("该客户正在执行计算,请勿重复提交计算请求。", customerId)); - return new Result().ok(false); + CalculateFlagModel executingFlag2 = (CalculateFlagModel) redisUtils.get(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + if (executingFlag2 != null && CalculateStatus.CALCULATING.equals(executingFlag2.getStatus())) { + //log.error(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", customerId)); + throw new RenException(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", formDTO.getCustomerId())); } - Future future = singleThreadPool.submit(() -> { - formDTO.setCustomerId(customerId); - long start = System.currentTimeMillis(); - Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); - if (aBoolean) { - log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); - } - redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); - futureMap.remove(customerId); - }); - futureMap.put(customerId, future); - redisUtils.set(RedisKeys.getCustomerStatsCalFlag(customerId), true); + // 提交异步计算 + submitCalculate(formDTO); } } else { - log.error(String.format("该客户正在执行计算,请勿重复提交计算请求。", customerId)); - return new Result().ok(false); + throw new RenException(String.format("客户【%s】正在执行计算,请勿重复提交计算请求。", formDTO.getCustomerId())); } + } + /** + * 提交异步计算 + * @param formDTO + * @return + */ + private void submitCalculate(CalculateCommonFormDTO formDTO) { + Future future = singleThreadPool.submit(() -> { + long start = System.currentTimeMillis(); + Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); + if (aBoolean) { + log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000); + } - return new Result().ok(true); + redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + futureMap.remove(formDTO.getCustomerId()); + + //测试代码 + //try { + // Thread.sleep(20000l); + // System.out.println(System.currentTimeMillis()); + //} catch (InterruptedException e) { + // e.printStackTrace(); + //} + //redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); + //futureMap.remove(formDTO.getCustomerId()); + }); + + futureMap.put(formDTO.getCustomerId(), future); + + CalculateFlagModel flag = new CalculateFlagModel(); + flag.setStatus(CalculateStatus.CALCULATING); + flag.setForm(formDTO); + redisUtils.set(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()), flag); } /** @@ -126,7 +186,7 @@ public class IndexCalculateController { future.cancel(true); redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(customerId)); futureMap.remove(customerId); - HttpClientManager.getInstance().sendAlarmMsg(String.format("数据统计服务-中止计算成功,customerId:%s", customerId)); + HttpClientManager.getInstance().sendAlarmMsg(String.format(EnvEnum.getCurrentEnv().getName() + "数据统计服务-中止计算成功,customerId:%s", customerId)); } return new Result(); } @@ -135,7 +195,7 @@ public class IndexCalculateController { public Result calculateAll(@RequestBody CalculateCommonFormDTO formDTO) { long start = System.currentTimeMillis(); Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); - HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); + HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); if (aBoolean) { return new Result().ok(true); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java index 548d34f284..d63a96ee08 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcNewsTrendMonthlyEntity.java @@ -48,11 +48,6 @@ public class ScreenKcNewsTrendMonthlyEntity extends BaseEpmetEntity { */ private String monthId; - /** - * 阅读数量 - */ - private Integer readCount; - /** * 参与数量 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java new file mode 100644 index 0000000000..95d114ae16 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/CalculateFlagModel.java @@ -0,0 +1,20 @@ +package com.epmet.model; + +import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import lombok.Data; + +@Data +public class CalculateFlagModel { + + /** + * 提交计算时候的参数 + */ + private CalculateCommonFormDTO form; + + /** + * 计算状态 + * CalculateStatus.java + */ + private String status; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 4821e0ee59..a1cd97e164 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -69,6 +69,33 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni @Autowired private CommunitySubScoreDao communitySubScoreDao; + /** + * @param customerId + * @param monthId + * @Description 计算社区相关总分 + * @author zxc + * @date 2020/9/1 4:12 下午 + */ + public Boolean calCommunityAll(String customerId, String monthId) { + Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力 + if (!aBoolean.equals(true)) { + throw new RenException("calculate community-party-ability failure ......"); + } + Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力 + if (!bBoolean.equals(true)) { + throw new RenException("calculate community-govern-ability failure ......"); + } + Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力 + if (!cBoolean.equals(true)) { + throw new RenException("calculate community-service-ability failure ......"); + } + Boolean dBoolean = communityRelate(customerId, monthId); + if (!dBoolean.equals(true)) { + throw new RenException("calculate community-all insert failure ......"); + } + return true; + } + /** * @param customerId * @Description 社区名义发文数量计算【党建能力】 @@ -91,7 +118,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.error(IndexCalConstant.GRID_PARTY_AVG_NULL); - return; } else { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -112,7 +138,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.error(IndexCalConstant.COMMUNITY_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -166,7 +191,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridGovernAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridGovernAvg)){ log.error("社区下级治理能力平均分集合为空"); - return; }else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); @@ -187,7 +211,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -241,7 +264,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List subGridServiceAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridServiceAvg)) { log.error("查询社区下级所有网格服务能力得分平均值集合为空"); - //todo return; } else { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE); @@ -261,7 +283,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -336,33 +357,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni return true; } - /** - * @param customerId - * @param monthId - * @Description 计算社区相关总分 - * @author zxc - * @date 2020/9/1 4:12 下午 - */ - public Boolean calCommunityAll(String customerId, String monthId) { - Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力 - if (!aBoolean.equals(true)) { - throw new RenException("calculate community-party-ability failure ......"); - } - Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力 - if (!bBoolean.equals(true)) { - throw new RenException("calculate community-govern-ability failure ......"); - } - Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力 - if (!cBoolean.equals(true)) { - throw new RenException("calculate community-service-ability failure ......"); - } - Boolean dBoolean = communityRelate(customerId, monthId); - if (!dBoolean.equals(true)) { - throw new RenException("calculate community-all insert failure ......"); - } - return true; - } - /** * @param list * @Description BigDecimal类型获取最大数和最小数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 8ae71e38d1..3143fdf4e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -116,7 +116,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); - return; } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -137,7 +136,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.error(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -191,7 +189,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(districtGovernAvgList)) { log.error("查询所有街道治理能力平均值集合为空"); - return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); @@ -211,7 +208,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(deptScoreAvgList)) { log.error("查询所有直属部门治理能力平均值集合为空"); - //return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); @@ -261,7 +257,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(subStreetAvgList)) { log.error("查询区下属街道服务能力汇总平均值集合为空"); - return; } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 5fb28ac104..dfec8da308 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -119,7 +119,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); - //todo return; } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); Integer indexEnd = NumConstant.TEN; @@ -141,7 +140,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId, IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(mapList)) { log.error(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); - return; } String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldName)) { @@ -194,7 +192,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridGovernAvg)){ log.error("查询街道下属所有社区治理能力汇总为空"); - //todo return; }else if (subGridGovernAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); @@ -215,7 +212,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -269,7 +265,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List subCommServiceAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subCommServiceAvg)) { log.error("查询街道下属社区服务能力得分平均值为空"); - //todo return; } else if (subCommServiceAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE); @@ -289,7 +284,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); - return; }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index c171f62300..c439df6213 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -37,7 +37,7 @@ public class BatchScoreCalculator { } /** - * 执行计算,以样本的所有指标总得分及明细分数值 + * 执行计算,以样本的所有指标总得分(原始值)及明细分数(归一后的值 不乘以权重)值 * * @param indexInputVOS * @return @@ -56,7 +56,9 @@ public class BatchScoreCalculator { //遍历该指标下的每个数据 for (SampleValue vo : indexValueVOs) { String sampleId = vo.getSampleId(); - BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight).setScale(6, RoundingMode.HALF_UP); + //归一后的值 + BigDecimal normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); + BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); if (result == null) { @@ -67,7 +69,7 @@ public class BatchScoreCalculator { result.setDetails(new ArrayList<>()); scoreCountOfSamples.put(sampleId, result); } - IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), score, idx.getWeight()); + IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), normalizeValue, idx.getWeight()); result.getDetails().add(sampleScore); result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP)); } @@ -76,40 +78,6 @@ public class BatchScoreCalculator { return scoreCountOfSamples; } - /** - * 执行计算,以样本的所有指标总得分 - * - * @param indexInputVOS - * @return - */ - public HashMap getScoreCountOfSampleId(List indexInputVOS) { - - // 每个样本的总得分 - HashMap scoreCountOfSamples = new HashMap<>(); - - for (IndexInputVO idx : indexInputVOS) { - // 每个指标循环一次 - List indexValueVOs = idx.getIndexValueVOs(); - BigDecimal weight = idx.getWeight(); - ScoreCalculator scoreCalculator = idx.getScoreCalculator(); - BigDecimal threshold = idx.getThreshold(); - - for (SampleValue vo : indexValueVOs) { - String sampleId = vo.getSampleId(); - BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight); - if (scoreCountOfSamples.containsKey(sampleId)) { - BigDecimal newScore = scoreCountOfSamples.get(sampleId).add(score).setScale(6, RoundingMode.HALF_UP); - scoreCountOfSamples.put(sampleId, newScore); - } else { - score.setScale(6, RoundingMode.HALF_UP); - scoreCountOfSamples.put(sampleId, score); - } - } - } - - return scoreCountOfSamples; - } - /** * 获取最终样本值 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index b699ec7d6b..f192c1373c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -71,9 +71,9 @@ PARENT_ID parentId, ORG_NAME orgName, SUM(INDEX_TOTAL) / #{monthCount} as indexTotal, - SUM(PARTY_DEV_ABLITY) / #{monthCount} as partyDevAblity, - SUM(SERVICE_ABLITY) / #{monthCount} as serviceAblity, - SUM(GOVERN_ABLITY) / #{monthCount} as governAblity + SUM(PARTY_DEV_ABLITY * PARTY_DEV_WEIGHT) / #{monthCount} as partyDevAblity, + SUM(SERVICE_ABLITY * SERVICE_ABLITY_WEIGHT) / #{monthCount} as serviceAblity, + SUM(GOVERN_ABLITY * GOVERN_ABLITY_WEIGHT) / #{monthCount} as governAblity FROM screen_index_data_monthly WHERE DEL_FLAG = '0' AND YEAR_ID = #{yearId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml index 4caffe8fba..60bebaa7d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenKcNewsTrendMonthlyDao.xml @@ -7,7 +7,6 @@ - @@ -29,7 +28,6 @@ ID, CUSTOMER_ID, MONTH_ID, - READ_COUNT, PARTI_COUNT, DEL_FLAG, REVISION, @@ -43,7 +41,6 @@ (SELECT REPLACE(UUID(), '-', '') AS id), #{customerId}, #{monthId}, - #{item.readCount}, #{item.partiCount}, 0, 0, diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index 15e029b3e6..16549e9b47 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java @@ -170,13 +170,22 @@ public class DemoScoreCal { List indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); - HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + HashMap result = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); + + HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); System.err.println("----------------1----------------"); result.forEach((key, value) -> { System.out.println(key.concat("的得分为:").concat(value.toString())); }); System.err.println("-----------------2---------------"); + + + System.err.println("----------------123123123123----------------"); + result2.forEach((key, value) -> { + System.out.println(key.concat("的得分为:").concat(value.toString())); + }); + System.err.println("-----------------2---------------"); } @@ -235,13 +244,8 @@ public class DemoScoreCal { BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); System.out.println("param:" + JSON.toJSONString(indexInputVOS)); - HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); - System.err.println("----------------1----------------"); - result.forEach((key, value) -> { - System.out.println(key.concat("的得分为:").concat(value.toString())); - }); System.err.println("-----------------2---------------"); System.err.println("----------------11111111----------------"); diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql new file mode 100644 index 0000000000..5114b07688 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.7__add_kongcun_app.sql @@ -0,0 +1,9 @@ +INSERT INTO `epmet_common_service`.`external_customer`(`ID`, `CUSTOMER_NAME`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2fe0065f70ca0e23ce4c26fca5f1d933', '大美孔村', 0, 0, 'APP_USER', '2020-09-15 09:00:57', 'APP_USER', '2020-09-15 09:00:57'); + + +INSERT INTO `epmet_common_service`.`external_app`(`ID`, `APP_NAME`, `CUSTOMER_ID`, `CUSTOMER_TYPE`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `DEL_FLAG`) VALUES ('4733fda58aba5024b776f22f135350df', '孔村数据采集', '2fe0065f70ca0e23ce4c26fca5f1d933', 'external', 0, 'APP_USER', '2020-09-15 09:01:31', 'APP_USER', '2020-09-15 09:01:31', 0); +INSERT INTO `epmet_common_service`.`external_app`(`ID`, `APP_NAME`, `CUSTOMER_ID`, `CUSTOMER_TYPE`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `DEL_FLAG`) VALUES ('5efcfb775125d656f39583b8110a3d7d', '孔村大屏', '2fe0065f70ca0e23ce4c26fca5f1d933', 'external', 0, 'APP_USER', '2020-09-15 09:01:39', 'APP_USER', '2020-09-15 09:01:39', 0); + + +INSERT INTO `epmet_common_service`.`external_app_secret`(`ID`, `APP_ID`, `SECRET`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('362d4fce3311f67edb40b0e5291d37eb', '5efcfb775125d656f39583b8110a3d7d', '657cd46d385a4c2ba6d9355aee24654ac3951deab7e6436e91201561b94969b5', 0, 0, 'APP_USER', '2020-09-15 09:01:39', 'APP_USER', '2020-09-15 09:01:39'); +INSERT INTO `epmet_common_service`.`external_app_secret`(`ID`, `APP_ID`, `SECRET`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('7853487c79dab384b4c681d734d9eb3a', '4733fda58aba5024b776f22f135350df', '61224b4d747f4853b9551fe078b90b2355f72c3256a14bdb8faac4a4d7ed68a0', 0, 0, 'APP_USER', '2020-09-15 09:01:31', 'APP_USER', '2020-09-15 09:01:31'); diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java new file mode 100644 index 0000000000..9b5d049284 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DataStatsProcessPenddingCalService.java @@ -0,0 +1,9 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +public interface DataStatsProcessPenddingCalService { + + Result processPenddingCal(); + +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java new file mode 100644 index 0000000000..55381b40b0 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DataStatsProcessPenddingCalServiceImpl.java @@ -0,0 +1,19 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.DataStatsProcessPenddingCalService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class DataStatsProcessPenddingCalServiceImpl implements DataStatsProcessPenddingCalService { + + @Autowired + private DataStatisticalOpenFeignClient feignClient; + + @Override + public Result processPenddingCal() { + return feignClient.processPenddingCalculate(); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java new file mode 100644 index 0000000000..b02396846c --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataStatsProcessPenddingCalTask.java @@ -0,0 +1,26 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.DataStatsProcessPenddingCalService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("dataStatsProcessPenddingCalTask") +public class DataStatsProcessPenddingCalTask implements ITask { + + @Autowired + private DataStatsProcessPenddingCalService dataStatsProcessPenddingCalService; + + @Override + public void run(String params) { + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行,参数为:{}", params); + Result result = dataStatsProcessPenddingCalService.processPenddingCal(); + if (result.success()){ + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行定时任务执行成功"); + }else { + log.debug("DataStatsProcessPenddingCalTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 48fd117891..4d88329d42 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -230,9 +230,11 @@ cs.del_flag = 0 AND cs.enable_flag = 'enable' AND - - cs.user_id = #{userId} - + ( + + cs.user_id = #{userId} + + )