From e7fb45b949dff8bf0cb311bf8640ed5db4d1734f Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 18 Jan 2022 16:45:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=95=B0=E5=AD=97=E7=A4=BE=E5=8C=BA?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E9=83=A8=E7=BD=B2=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/DataStatisticalOpenFeignClient.java | 11 ++ ...ataStatisticalOpenFeignClientFallBack.java | 5 + .../controller/ShiBeiICJobController.java | 101 ++++++++++++++++++ .../task/IcPrivateDeploySupportTask.java | 31 ++++++ 4 files changed, 148 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcPrivateDeploySupportTask.java 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 dab2edf301..69feca31d5 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 @@ -353,4 +353,15 @@ public interface DataStatisticalOpenFeignClient { */ @PostMapping("/data/stats/demand/volunteer/daily") Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId); + + /** + * desc: 市北私有化部署需要 支持的任务之一 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2022/1/18 4:37 下午 + */ + @PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus") + Result userPointAndProjectStatus(@RequestBody ExtractOriginFormDTO formDTO); } 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 56fea9c03f..5ace88fac3 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 @@ -339,4 +339,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result statsVolunteerDemandServicesDaily(String customerId) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId); } + + @Override + public Result userPointAndProjectStatus(ExtractOriginFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java new file mode 100644 index 0000000000..3963c5f579 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java @@ -0,0 +1,101 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +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.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.service.StatsProjectService; +import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * desc:市北数字社区 单独部署 job入口 【用户积分排名及项目状态数据】 + */ +@RequestMapping("shibeiICJob") +@RestController +@Slf4j +public class ShiBeiICJobController { + @Autowired + private ScreenGrassrootsGovernDataAbsorptionService screenGrassrootsGovernDataAbsorptionService; + @Autowired + private StatsProjectService statsProjectService; + @Autowired + private RedisUtils redisUtils; + + @PostMapping("userPointAndProjectStatus") + public Result userPointAndProjectStatus(@RequestBody ExtractOriginFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())){ + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空"); + } + long start = System.currentTimeMillis(); + Set result = new LinkedHashSet<>(); + if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { + List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); + daysBetween.forEach(d -> { + this.extractUserPointData(formDTO.getCustomerId(), d); + this.agencyProjectStats(formDTO.getCustomerId(), formDTO.getDateId()); + result.add(d); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus"), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + }); + } else { + if (StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE)); + } + this.extractUserPointData(formDTO.getCustomerId(), formDTO.getDateId()); + this.agencyProjectStats(formDTO.getCustomerId(), formDTO.getDateId()); + result.add(formDTO.getDateId()); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus"), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + } + long end = System.currentTimeMillis(); + long l = (end - start) / 1000; + return new Result().ok("userPointAndProjectStatus耗时" + l + "s"); + } + + /** + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + private Result agencyProjectStats(String customerId, String dateId) { + try { + if (StringUtils.isNotBlank(dateId)) { + dateId = DateUtils.format(DateUtils.parseDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + } + StatsFormDTO formDTO = new StatsFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setDate(dateId); + + statsProjectService.agencyProjectStats(formDTO); + } catch (Exception e) { + log.error("市北-项目状态数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + return new Result(); + } + + private void extractUserPointData(String customerId, String dateId) { + try { + //基层治理 - 热心市民 screen_party_user_rank_data + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); + } catch (Exception e) { + log.error("市北-热心市民/党员得分数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcPrivateDeploySupportTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcPrivateDeploySupportTask.java new file mode 100644 index 0000000000..80dc22febb --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcPrivateDeploySupportTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数字社区私有化部署 任务之一还有【autoEvaluateDemandTask,statsDemandTask,dailyStatisticalVoteTask】 + */ +@Slf4j +@Component("icPrivateDeploySupportTask") +public class IcPrivateDeploySupportTask implements ITask { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public void run(String params) { + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(formDTO); + log.info("IcPrivateDeploySupportTask excute end,param:{},result:{}",params,result); + } +} From 6b9804fa6a4ae889a6c294f0f399ace6cbda2c4c Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 21 Jan 2022 09:47:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?heart=20=E6=B2=A1=E6=9C=89=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 35b4f1802b..71c790afe2 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -487,6 +487,7 @@ epmet: - /gov/voice/** - /resi/voice/** - /epmet/point/** + - /heart/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: From 0f3c05f8d71e1fd6d0a1b4b0a5fe48e57038fe8e Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 21 Jan 2022 10:09:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?point=20=E9=85=8D=E7=BD=AE=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index cacebb80f6..c8c245b15a 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -486,7 +486,7 @@ epmet: - /data/aggregator/** - /gov/voice/** - /resi/voice/** - - /epmet/point/** + - /point/** - /heart/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) From 39cbf31b83686d56f18037f6af6707093fe8780d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 21 Jan 2022 10:43:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AE=AE=E9=A2=98=E4=BA=BA=E5=8F=96=E6=88=90=E8=AF=9D=E9=A2=98?= =?UTF-8?q?=E4=BA=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/IssueServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index edc3a74476..1e970897f2 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -94,7 +94,7 @@ public class IssueServiceImpl implements IssueService { issueDetailResult.setTopicInfo(topicInfoDTOResult == null ? new TopicInfoDTO() : topicInfoDTOResult); } - /*if("branch".equals(topicInfoDTOResult.getGroupType())){//支部小组话题发起人显示真实姓名 + if (null != topicInfoDTOResult && "branch".equals(topicInfoDTOResult.getGroupType())) {//支部小组话题发起人显示真实姓名 List userIdList = new ArrayList<>(); userIdList.add(issueResult.getUserId()); Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); @@ -118,8 +118,8 @@ public class IssueServiceImpl implements IssueService { IssueInitiatorResultDTO initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO).getData(); issueDetailResult.setIssueInitiator(initiatorResult == null ? HallConstat.NULL_CHARACTER_STRING : initiatorResult.getIssueInitiator()); } - }*/ - issueDetailResult.setIssueInitiator(topicInfoDTOResult.getPublishedUser()); + } + //issueDetailResult.setIssueInitiator(topicInfoDTOResult.getPublishedUser()); //判断是否投票 CheckVoteFormDTO formDTO = new CheckVoteFormDTO();