selectMonthScoreList(MonthScoreListFormDTO formDTO);
}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java
new file mode 100644
index 0000000000..0c7a7a7f65
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.datareport.dao.fact;
+
+import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
+import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 社区相关分数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-09-02
+ */
+@Mapper
+public interface FactIndexCommunityScoreDao {
+
+ /**
+ * @param formDTO
+ * @Description 分别查询社区过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ * @author sun
+ */
+ LinkedList selectCommunityAblityIndex(AblityIndexFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 查询社区级组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
+ * @author sun
+ */
+ List selectCommunityScoreList(ScoreListFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 分别查询社区过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ * @author sun
+ */
+ LinkedList selectCommunityMonthScoreList(MonthScoreListFormDTO formDTO);
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java
new file mode 100644
index 0000000000..c5153b0933
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.datareport.dao.fact;
+
+import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO;
+import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 网格相关分值记录表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-09-02
+ */
+@Mapper
+public interface FactIndexGridScoreDao {
+
+ /**
+ * @param formDTO
+ * @Description 分别查网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ * @author sun
+ */
+ LinkedList selectGridAblityIndex(AblityIndexFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 分别查网格某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
+ * @author sun
+ */
+ List selectGridScoreList(ScoreListFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 分别查网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ * @author sun
+ */
+ LinkedList selectGridMonthScoreList(MonthScoreListFormDTO formDTO);
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
new file mode 100644
index 0000000000..8900171322
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.datareport.dao.fact;
+
+import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO;
+import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 网格相关分值记录表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-09-02
+ */
+@Mapper
+public interface FactIndexGridSubScoreDao {
+
+ /**
+ * @param formDTO
+ * @Description 查询网格某月份某项能力对应的各项指标
+ * @author sun
+ */
+ List selectGridAblityList(AblityListFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 查询网格层级某项能力对应的一项指标过去12个月份数据
+ * @author sun
+ */
+ LinkedList selectGridMonthAblityList(MonthAblityListFormDTO formDTO);
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java
new file mode 100644
index 0000000000..893820cf1c
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.datareport.dao.fact;
+
+import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 评价指标字典
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-09-02
+ */
+@Mapper
+public interface IndexDictDao {
+
+ /**
+ * @param
+ * @Description 查询指标字典表是百分比类型的数据
+ * @author sun
+ */
+ List selectList();
+
+ /**
+ * @param
+ * @Description 根据indexCode查询指标字典表具体数据
+ * @author sun
+ */
+ IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode);
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
index d633b94ea2..eee423ca41 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
@@ -1,6 +1,5 @@
package com.epmet.datareport.service.evaluationindex.screen;
-import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
@@ -14,12 +13,12 @@ import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
public interface AgencyService {
/**
- * @Description 1、组织机构树
* @param
+ * @Description 1、组织机构树 只返回 is_display = '1'的
* @author zxc
* @date 2020/8/18 2:04 下午
*/
- TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam);
+ TreeResultDTO tree(String customerId);
/**
* @Description 2、组织区域查询
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
index a7742172d9..3485770cc2 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
@@ -46,14 +46,14 @@ public interface IndexService {
List subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO);
/**
- * 5、下级部门指数排行(安宁数据段用)
+ * 5、按月或年 下级组织指数排行
*
* @param formDTO
* @return java.util.List
* @Author zhangyong
* @Date 09:38 2020-09-08
**/
- List anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO);
+ List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO);
/**
* desc:获取该客户下网格排行
@@ -62,4 +62,18 @@ public interface IndexService {
* @return
*/
List selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 组织月度指数得分
+ * @author sun
+ */
+ IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 先进排行-先进支部排行
+ * @author sun
+ */
+ List advancedBranchRank(AdvancedBranchRankFormDTO formDTO);
}
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 d17df56ba1..480601a129 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,6 +1,5 @@
package com.epmet.datareport.service.evaluationindex.screen;
-import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
@@ -22,32 +21,28 @@ import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO;
public interface KcScreenService {
/**
- * @param externalAppRequestParam
* @Description 首页-平台各类总数
* @author sun
*/
- HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam);
+ HomepageSummaryResultDTO homepageSummary(String customerId);
/**
- * @param externalAppRequestParam
* @Description 公益互助-各类总数汇总
* @author sun
*/
- HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam);
+ HeartSummaryResultDTO heartSummary(String customerId);
/**
- * @param externalAppRequestParam
* @Description 公益互助-公益活动次数
* @author sun
*/
- HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam);
+ HeartActcounttrendResultDTO heartActcounttrend(String customerId);
/**
- * @param externalAppRequestParam
* @Description 公益互助-志愿者画像
* @author sun
*/
- HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam);
+ HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId);
/**
* @param formDTO
@@ -67,25 +62,22 @@ public interface KcScreenService {
/**
- * @param externalAppRequestParam
* @Description 邻里党群-各类总数
* @author sun
*/
- GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam);
+ GroupSummaryResultDTO groupSummary(String customerId);
/**
- * @param externalAppRequestParam
* @Description 邻里党群-话题参与趋势
* @author sun
*/
- GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam);
+ GroupPartitopictrendResultDTO groupPartitopictrend(String customerId);
/**
- * @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
- GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam);
+ GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId);
/**
* @param formDTO
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java
new file mode 100644
index 0000000000..f5e2428f09
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenUserService.java
@@ -0,0 +1,30 @@
+package com.epmet.datareport.service.evaluationindex.screen;
+
+import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
+import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
+
+import java.util.List;
+
+/**
+ * 数据改版
+ *
+ * @author sun
+ */
+public interface ScreenUserService {
+
+ /**
+ * @param formDTO
+ * @Description 热心市民积分排行列表
+ * @author sun
+ */
+ List userPointRank(UserPointRankFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @Description 党员(指标得分)排行
+ * @author sun
+ */
+ List partIndexScroeRank(PartIndexScroeRankFormDTO formDTO);
+}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
index 6d6632dbdf..104e941333 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
@@ -1,8 +1,8 @@
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.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
@@ -12,7 +12,7 @@ import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -42,25 +42,24 @@ public class AgencyServiceImpl implements AgencyService {
*/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
- public TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam) {
+ public TreeResultDTO tree(String customerId) {
// 1. 查询客户根组织ID
- String customerId = externalAppRequestParam.getCustomerId();
-
- // 验签关闭,customerId无法获取,暂时写死
- if(StringUtils.isBlank(customerId)){
- customerId = "b09527201c4409e19d1dbc5e3c3429a1";
- }
- TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId);
- if (null == rootAgency){
- return new TreeResultDTO();
+ TreeResultDTO rootAgency = null;
+ try {
+ rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId);
+ if (null == rootAgency) {
+ return new TreeResultDTO();
+ }
+ } catch (TooManyResultsException e) {
+ throw new RenException("根组织结构数据有误");
}
List centerMark = this.getCenterMark(rootAgency.getCenterMarkA());
rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark);
- if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){
+ if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)) {
List treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue());
rootAgency.setChildren(treeResultDTOS);
- }else {
+ } else {
List departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue()));
rootAgency.setChildren(departmentList);
}
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
index d750c1ee03..7afd0f4362 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
@@ -108,18 +108,17 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
//保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE;
- while(null == latest && time > NumConstant.ONE)
- {
- time --;
- monthId = dateUtils.getPreviousMonthIdByDest(null,monthId);
- latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
- }
+ while (null == latest && time > NumConstant.ONE) {
+ time--;
+ monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
+ latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId);
+ }
- if(null == latest) return new PublicPartiProfileResultDTO();
- PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest,PublicPartiProfileResultDTO.class);
- result.setMonthIncr(convertPercentStr(latest.getMonthIncr(),NumConstant.ZERO));
- result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth(),NumConstant.ZERO));
- result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth(),NumConstant.ZERO));
+ if (null == latest) return new PublicPartiProfileResultDTO();
+ PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class);
+ result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO));
+ result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO));
+ result.setIssueCompareLatestMonth(convertPercentStr(latest.getIssueCompareLatestMonth().abs(), NumConstant.ZERO));
return result;
}
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 7777739c0c..872210194d 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
@@ -2,23 +2,27 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao;
import com.epmet.datareport.service.evaluationindex.screen.IndexService;
-import com.epmet.datareport.utils.DateUtils;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.commons.lang3.StringUtils;
+import org.jsoup.helper.DataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import org.springframework.util.unit.DataUnit;
import java.math.BigDecimal;
+import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -39,7 +43,7 @@ public class IndexServiceImpl implements IndexService {
@Autowired
private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl;
@Autowired
- private DateUtils dateUtils;
+ private com.epmet.datareport.utils.DateUtils dateUtils;
/**
* @Description 1、年度平均指数
@@ -204,16 +208,20 @@ public class IndexServiceImpl implements IndexService {
return subAgencyIndexRankResultDTOS;
}
- @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
- public List anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO) {
+ public List getSubAgencyIndexRank(SubAgencyIndexRankYMFormDTO formDTO) {
List subAgencyIndexRankResultDTOS = new ArrayList<>();
- if (ScreenConstant.YEAR_ID.equals(formDTO.getType())){
+ if (ScreenConstant.YEAR_ID.equals(formDTO.getType())) {
// 年 指数排行
subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectAnNingSubAgencyIndexYearlyRank(formDTO);
- } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())){
+ } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())) {
// 月(上一个月) 指数排行
- subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectAnNingSubAgencyIndexMonthlyRank(formDTO);
+ if (StringUtils.isBlank(formDTO.getMonthId())) {
+ String monthId = com.epmet.commons.tools.utils.DateUtils.format(com.epmet.commons.tools.utils.DateUtils.addDateMonths(new Date(), -1), "yyyyMMdd");
+ formDTO.setMonthId(monthId);
+ }
+ subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyOrGridIndexMonthlyRank(formDTO);
subAgencyIndexRankResultDTOS.forEach(rank -> {
rank.setPartyDevAbility(getRound(rank.getPartyDevAbility()));
rank.setGovernAbility(getRound(rank.getGovernAbility()));
@@ -254,4 +262,71 @@ public class IndexServiceImpl implements IndexService {
BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP);
return Double.valueOf(b.toString());
}
+
+ /**
+ * @param formDTO
+ * @Description 组织月度指数得分
+ * @author sun
+ */
+ @Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
+ public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) {
+ //screen_index_data_monthly 根据组织id和月份获取月度指标得分
+ //1.大屏接口 orgType和monthId字段不传值,默认查询上一个月数据
+ if(null==formDTO.getMonthId()||"".equals(formDTO.getMonthId())){
+ formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
+ }
+ //2.根据组织或网格Id以及月份Id查询各项月度指数得分
+ IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO);
+ if (null == resultDTO) {
+ return resultDTO;
+ }
+
+ //3.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比
+ NumberFormat nf = NumberFormat.getPercentInstance();
+ nf.setMaximumFractionDigits(1);
+
+ BigDecimal num1 = new BigDecimal(resultDTO.getParty()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
+ resultDTO.setPartyDevAbility(num1);
+ resultDTO.setPartyDevAbilityWeight(nf.format(Double.parseDouble(resultDTO.getPartyDevAbilityWeight())));
+ BigDecimal num2 = new BigDecimal(resultDTO.getGovern()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
+ resultDTO.setGovernAbility(num2);
+ resultDTO.setGovernAbilityWeight(nf.format(Double.parseDouble(resultDTO.getGovernAbilityWeight())));
+ BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
+ resultDTO.setServiceAbility(num3);
+ resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight())));
+ Double db = num1.doubleValue() + num2.doubleValue() + num3.doubleValue();
+ BigDecimal num = new BigDecimal(db.toString()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
+ resultDTO.setTotalScore(num);
+
+ return resultDTO;
+ }
+
+ /**
+ * @param formDTO
+ * @Description 先进排行-先进支部排行
+ * @author sun
+ */
+ @Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
+ public List advancedBranchRank(AdvancedBranchRankFormDTO formDTO) {
+ //根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据
+ //1.级联查询组织下所有网格的先进支部排行数据,按总指数降序
+ formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
+ List list = screenIndexDataMonthlyDao.selectRankList(formDTO);
+ //2.遍历数据,小数保留一位小数,百分数添加百分号
+ NumberFormat nf = NumberFormat.getPercentInstance();
+ nf.setMaximumFractionDigits(1);
+ list.forEach(l->{
+ BigDecimal num = new BigDecimal(l.getTotalScore()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
+ l.setScroe(num);
+ BigDecimal num1 = new BigDecimal(l.getSatisfactionRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
+ l.setSatisfactionRatio(num1 + "%");
+ BigDecimal num2 = new BigDecimal(l.getClosedProjectRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
+ l.setClosedProjectRatio(num2 + "%");
+ });
+
+ return list;
+ }
+
}
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 b82d6b654f..6a84e531d7 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,7 +1,6 @@
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.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
@@ -99,37 +98,34 @@ public class KcScreenServiceImpl implements KcScreenService {
private ScreenKcNewsRankDao screenKcNewsRankDao;
/**
- * @param externalAppRequestParam
* @Description 首页-平台各类总数
* @author sun
*/
@Override
- public HomepageSummaryResultDTO homepageSummary(ExternalAppRequestParam externalAppRequestParam) {
- return screenKcPlatformSummaryDailyDao.selectSummaryDaily(externalAppRequestParam.getCustomerId());
+ public HomepageSummaryResultDTO homepageSummary(String customerId) {
+ return screenKcPlatformSummaryDailyDao.selectSummaryDaily(customerId);
}
/**
- * @param externalAppRequestParam
* @Description 公益互助-各类总数汇总
* @author sun
*/
@Override
- public HeartSummaryResultDTO heartSummary(ExternalAppRequestParam externalAppRequestParam) {
- return screenKcActSummaryDailyDao.selectHeartSummary(externalAppRequestParam.getCustomerId());
+ public HeartSummaryResultDTO heartSummary(String customerId) {
+ return screenKcActSummaryDailyDao.selectHeartSummary(customerId);
}
/**
- * @param externalAppRequestParam
* @Description 公益互助-公益活动次数
* @author sun
*/
@Override
- public HeartActcounttrendResultDTO heartActcounttrend(ExternalAppRequestParam externalAppRequestParam) {
+ public HeartActcounttrendResultDTO heartActcounttrend(String customerId) {
HeartActcounttrendResultDTO resultDTO = new HeartActcounttrendResultDTO();
LinkedList xAxis = new LinkedList<>();
LinkedList actCountDataList = new LinkedList<>();
//1.按客户查询最近十二个月数据
- List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId());
+ List list = screenKcActTrendMonthlyDao.selectActTrendMonthly(customerId);
//2.倒序遍历封装数据
for (int i = list.size() - 1; i >= 0; i--) {
xAxis.add(list.get(i).getMonthId());
@@ -142,16 +138,15 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
- * @param externalAppRequestParam
* @Description 公益互助-志愿者画像
* @author sun
*/
@Override
- public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(ExternalAppRequestParam externalAppRequestParam) {
+ public HeartVolunteerportrayalResultDTO heartVolunteerportrayal(String customerId) {
HeartVolunteerportrayalResultDTO resultDTO = new HeartVolunteerportrayalResultDTO();
GenderDistributionResultDTO genderDistribution = new GenderDistributionResultDTO();
//1.根据客户Id查询最近日期志愿者统计数据
- AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(externalAppRequestParam.getCustomerId());
+ AgeDistributionResultDTO ageDistribution = screenKcVolunteerSummaryDailyDao.selectVolunteerSummaryDaily(customerId);
//2.封装数据并返回
if (null == ageDistribution) {
resultDTO.setAgeDistribution(new AgeDistributionResultDTO());
@@ -219,14 +214,13 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
- * @param externalAppRequestParam
* @Description 邻里党群-各类总数
* @author sun
*/
@Override
- public GroupSummaryResultDTO groupSummary(ExternalAppRequestParam externalAppRequestParam) {
+ public GroupSummaryResultDTO groupSummary(String customerId) {
//1.按客户查询最近一天各网格各项数据的汇总值
- GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(externalAppRequestParam.getCustomerId());
+ GroupSummaryResultDTO resultDTO = screenKcGroupSummaryGridDailyDao.selectGroupSummaryDaily(customerId);
if (null == resultDTO) {
return new GroupSummaryResultDTO();
}
@@ -246,17 +240,16 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
- * @param externalAppRequestParam
* @Description 邻里党群-话题参与趋势
* @author sun
*/
@Override
- public GroupPartitopictrendResultDTO groupPartitopictrend(ExternalAppRequestParam externalAppRequestParam) {
+ public GroupPartitopictrendResultDTO groupPartitopictrend(String customerId) {
GroupPartitopictrendResultDTO resultDTO = new GroupPartitopictrendResultDTO();
LinkedList xAxis = new LinkedList<>();
LinkedList actCountDataList = new LinkedList<>();
//1.按客户查询最近十二个月所有网格汇总数据
- List list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(externalAppRequestParam.getCustomerId());
+ List list = screenKcTopicTrendGridMonthlyDao.selectActTrendMonthly(customerId);
//2.倒序遍历封装数据
for (int i = list.size() - 1; i >= 0; i--) {
xAxis.add(list.get(i).getMonthId());
@@ -269,17 +262,16 @@ public class KcScreenServiceImpl implements KcScreenService {
}
/**
- * @param externalAppRequestParam
* @Description 邻里党群-社群数量排名
* @author sun
*/
@Override
- public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(ExternalAppRequestParam externalAppRequestParam) {
+ public GroupGridgroupcountrankResultDTO groupGridgroupcountrank(String customerId) {
GroupGridgroupcountrankResultDTO resultDTO = new GroupGridgroupcountrankResultDTO();
LinkedList gridNameDataList = new LinkedList<>();
LinkedList groupCountDataList = new LinkedList<>();
//1.按日期降序,查询客户最近一天所有网格数据,按每个网格的社区总数降序排列
- LinkedList list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(externalAppRequestParam.getCustomerId());
+ LinkedList list = screenKcGroupSummaryGridDailyDao.selectGridDailyList(customerId);
//2.封装数据
list.forEach(l -> {
gridNameDataList.add(l.getGridName());
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java
new file mode 100644
index 0000000000..7721876c58
--- /dev/null
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenUserServiceImpl.java
@@ -0,0 +1,62 @@
+package com.epmet.datareport.service.evaluationindex.screen.impl;
+
+import com.epmet.commons.dynamic.datasource.annotation.DataSource;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.constant.DataSourceConstant;
+import com.epmet.datareport.constant.FactConstant;
+import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
+import com.epmet.datareport.service.evaluationindex.screen.ScreenUserService;
+import com.epmet.evaluationindex.screen.dto.form.PartIndexScroeRankFormDTO;
+import com.epmet.evaluationindex.screen.dto.form.UserPointRankFormDTO;
+import com.epmet.evaluationindex.screen.dto.result.PartIndexScroeRankResultDTO;
+import com.epmet.evaluationindex.screen.dto.result.UserPointRankListResultDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 数据改版
+ *
+ * @author sun
+ */
+@Service
+@DataSource(DataSourceConstant.EVALUATION_INDEX)
+public class ScreenUserServiceImpl implements ScreenUserService {
+
+ @Autowired
+ private ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
+
+ /**
+ * @param formDTO
+ * @Description 热心市民积分排行列表
+ * @author sun
+ */
+ @Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
+ public List userPointRank(UserPointRankFormDTO formDTO) {
+ //1.参数校验
+ if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) {
+ throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType()));
+ }
+ //2.查询组织下居民积分排行,按积分值降序 screen_party_user_rank_data
+ return screenPartyUserRankDataDao.selectAgencyUserPointList(formDTO);
+ }
+
+ /**
+ * @param formDTO
+ * @Description 党员(指标得分)排行
+ * @author sun
+ */
+ @Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
+ public List partIndexScroeRank(PartIndexScroeRankFormDTO formDTO) {
+ //1.参数校验
+ if (!FactConstant.AGENCY.equals(formDTO.getOrgType()) && !FactConstant.GRID.equals(formDTO.getOrgType())) {
+ throw new RenException(String.format("入参格式错误,错误的组织或网格类型:%s", formDTO.getOrgType()));
+ }
+ //2.查询组织下党员的积分排行 screen_party_user_rank_data
+ return screenPartyUserRankDataDao.selectPartymemberPointList(formDTO);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
index 52a9fe1d7a..d4543b4aa7 100644
--- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
+++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
@@ -2,24 +2,26 @@ package com.epmet.datareport.service.fact.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
-import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
-import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao;
-import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao;
-import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao;
+import com.epmet.datareport.dao.fact.*;
import com.epmet.datareport.service.fact.FactIndexService;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
/**
* 数据改版api
@@ -39,7 +41,15 @@ public class FactIndexServiceImpl implements FactIndexService {
@Autowired
private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao;
@Autowired
+ private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
+ @Autowired
private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao;
+ @Autowired
+ private FactIndexGridScoreDao factIndexGridScoreDao;
+ @Autowired
+ private FactIndexGridSubScoreDao factIndexGridSubScoreDao;
+ @Autowired
+ private IndexDictDao indexDictDao;
/**
* @param formDTO
@@ -48,44 +58,105 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List ablityIndex(AblityIndexFormDTO formDTO) {
- LinkedList resultDTO = new LinkedList<>();
- //分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序
- //1.查询组织过去12个月党建能力指标
- //LinkedList djList = factIndexAgencyScoreDao.;
- LinkedList djList = null;
- //2.查询组织过去12个月治理能力指标
- LinkedList zlList = null;
- //3.查询组织过去12个月服务能力指标
- LinkedList fwList = null;
- //4.遍历计算每个月能力指数
+ LinkedList resultList = new LinkedList<>();
+ LinkedList list = new LinkedList<>();
+ LinkedList djList = new LinkedList<>();
+ LinkedList zlList = new LinkedList<>();
+ LinkedList fwList = new LinkedList<>();
+ //1.计算所查月份前12个月的monthId
+ formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
+ //2.根据类型判断是查询组织数据还是网格数据
+ //组织层级数据
+ if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
+ //3.根据组织Id查询组织信息
+ CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
+ if (null == agency) {
+ //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //4.根据组织级别判断查询哪类数据表
+ //区县级、乡镇街道级
+ if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
+ //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分数据
+ list = factIndexAgencyScoreDao.selectAblityIndex(formDTO);
+
+ //社区级
+ } else if ("community".equals(agency.getLevel())) {
+ //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ list = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO);
+ } else {
+ //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //网格层级数据
+ } else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
+ //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分数据
+ list = factIndexGridScoreDao.selectGridAblityIndex(formDTO);
+ } else {
+ throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
+ }
+ if (list.size() < NumConstant.ONE) {
+ return resultList;
+ }
+
+ //6.遍历计算每个月能力指数
LinkedList nlList = new LinkedList<>();
- for (int i = 0; i < djList.size(); i++) {
- AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
- nldto.setIndexTotal(djList.get(i).getIndexTotal() + zlList.get(i).getIndexTotal() + fwList.get(i).getIndexTotal());
- nldto.setAgencyScore(djList.get(i).getAgencyScore() + zlList.get(i).getAgencyScore() + fwList.get(i).getAgencyScore());
- nldto.setSubAgencyScore(djList.get(i).getSubAgencyScore() + zlList.get(i).getSubAgencyScore() + fwList.get(i).getSubAgencyScore());
- nldto.setMonthId(djList.get(i).getMonthId());
- nlList.add(nldto);
+ String monthId = list.get(0).getMonthId();
+ Double dl = 0.0;
+ for (AblityIndexResultDTO.ScoreListResultDTO l : list) {
+ if (l.getMonthId().equals(monthId)) {
+ dl += l.getIndexTotal();
+ } else {
+ AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
+ double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
+ nldto.setIndexTotal(num1);
+ nldto.setMonthId(monthId);
+ nlList.add(nldto);
+ monthId = l.getMonthId();
+ dl = l.getIndexTotal();
+ }
+ if (FactConstant.DJNL.equals(l.getIndexCode())) {
+ djList.add(l);
+ } else if (FactConstant.ZLNL.equals(l.getIndexCode())) {
+ zlList.add(l);
+ } else if (FactConstant.FWNL.equals(l.getIndexCode())) {
+ fwList.add(l);
+ }
}
- //5.封装数据并返回
+ //把最后一个月的能力指标数据放入集合
+ AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO();
+ double num1 = new BigDecimal(dl).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
+ nldto.setIndexTotal(num1);
+ nldto.setMonthId(monthId);
+ nlList.add(nldto);
+
+ //7.封装数据并返回
AblityIndexResultDTO nl = new AblityIndexResultDTO();
nl.setIndexCode(FactConstant.NLZB);
- nl.setScoreList(djList);
- resultDTO.add(nl);
+ nl.setScoreList(nlList);
+ if (null != nlList) {
+ resultList.add(nl);
+ }
AblityIndexResultDTO dj = new AblityIndexResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
- resultDTO.add(dj);
+ if (null != djList) {
+ resultList.add(dj);
+ }
AblityIndexResultDTO zl = new AblityIndexResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
- zl.setScoreList(djList);
- resultDTO.add(zl);
+ zl.setScoreList(zlList);
+ if (null != zlList) {
+ resultList.add(zl);
+ }
AblityIndexResultDTO fw = new AblityIndexResultDTO();
fw.setIndexCode(FactConstant.FWNL);
- fw.setScoreList(djList);
- resultDTO.add(fw);
+ fw.setScoreList(fwList);
+ if (null != fwList) {
+ resultList.add(fw);
+ }
- return resultDTO;
+ return resultList;
}
/**
@@ -95,13 +166,39 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List scoreList(ScoreListFormDTO formDTO) {
- //1.查询当前组织某一月份党建能力对应的总分、本级分、下级分
- formDTO.setIndexCode(FactConstant.DJNL);
- ScoreListResultDTO dj = factIndexAgencyScoreDao.selectScore(formDTO);
- //2.查询当前组织某一月份治理能力对应的总分、本级分、下级分
- //3.查询当前组织某一月份服务能力对应的总分、本级分、下级分
+ List resultList = new LinkedList<>();
+ //1.根据类型判断是查询组织数据还是网格数据
+ //组织层级数据
+ if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
+ //2.根据组织Id查询组织信息
+ CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
+ if (null == agency) {
+ //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //3.根据组织级别判断查询哪类数据表
+ //区县级、乡镇街道级
+ if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
+ //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
+ resultList = factIndexAgencyScoreDao.selectScoreList(formDTO);
+ //社区级
+ } else if ("community".equals(agency.getLevel())) {
+ //3-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
+ resultList = factIndexCommunityScoreDao.selectCommunityScoreList(formDTO);
+ } else {
+ //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+
+ //4.网格层级数据
+ } else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
+ //4-1.查询当前组织某一月份党建能力、治理能力、服务能力对应的总分、本级分、下级分
+ resultList = factIndexGridScoreDao.selectGridScoreList(formDTO);
+ } else {
+ throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
+ }
- return null;
+ return resultList;
}
/**
@@ -111,7 +208,74 @@ public class FactIndexServiceImpl implements FactIndexService {
*/
@Override
public List monthScoreList(MonthScoreListFormDTO formDTO) {
- return null;
+ LinkedList resultList = new LinkedList<>();
+ LinkedList list = new LinkedList<>();
+ LinkedList djList = new LinkedList<>();
+ LinkedList zlList = new LinkedList<>();
+ LinkedList fwList = new LinkedList<>();
+ //1.计算所查月份前12个月的monthId
+ formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
+ //2.根据类型判断是查询组织数据还是网格数据
+ //组织层级数据
+ if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
+ //3.根据组织Id查询组织信息
+ CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
+ if (null == agency) {
+ //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //4.根据组织级别判断查询哪类数据表
+ //区县级、乡镇街道级
+ if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
+ //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ list = factIndexAgencyScoreDao.selectMonthScoreList(formDTO);
+
+ //社区级
+ } else if ("community".equals(agency.getLevel())) {
+ //4-1.查询过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ list = factIndexCommunityScoreDao.selectCommunityMonthScoreList(formDTO);
+ } else {
+ //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //网格层级数据
+ } else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
+ //5.查询网格过去12个月党建能力、治理能力、服务能力每月总分、本级得分、下级得分数据
+ list = factIndexGridScoreDao.selectGridMonthScoreList(formDTO);
+ } else {
+ throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
+ }
+
+ //5.封装数据并返回
+ for (MonthScoreListResultDTO.ScoreListResultDTO l : list) {
+ if (FactConstant.DJNL.equals(l.getIndexCode())) {
+ djList.add(l);
+ } else if (FactConstant.ZLNL.equals(l.getIndexCode())) {
+ zlList.add(l);
+ } else if (FactConstant.FWNL.equals(l.getIndexCode())) {
+ fwList.add(l);
+ }
+ }
+ MonthScoreListResultDTO dj = new MonthScoreListResultDTO();
+ dj.setIndexCode(FactConstant.DJNL);
+ dj.setScoreList(djList);
+ if (null != djList) {
+ resultList.add(dj);
+ }
+ MonthScoreListResultDTO zl = new MonthScoreListResultDTO();
+ zl.setIndexCode(FactConstant.ZLNL);
+ zl.setScoreList(zlList);
+ if (null != zlList) {
+ resultList.add(zl);
+ }
+ MonthScoreListResultDTO fw = new MonthScoreListResultDTO();
+ fw.setIndexCode(FactConstant.FWNL);
+ fw.setScoreList(fwList);
+ if (null != fwList) {
+ resultList.add(fw);
+ }
+
+ return resultList;
}
/**
@@ -122,30 +286,61 @@ public class FactIndexServiceImpl implements FactIndexService {
@Override
public List ablityList(AblityListFormDTO formDTO) {
List resultList = new ArrayList<>();
- //按月份查询当前组织各项指标数据 fact_index_agency_sub_score
- //1.根据组织Id查询组织信息
- CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId());
- if (null == agency) {
- throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getAgencyId()));
- }
- //2.根据组织级别拼接查询条件,判断查询不同数据表
- //区县级、乡镇街道级
- if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
- if ("district".equals(agency.getLevel())) {
- formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
- } else {
- formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode());
+ //1.根据类型判断是查询组织数据还是网格数据
+ //组织层级数据
+ if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
+ //2.根据组织Id查询组织信息
+ CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
+ if (null == agency) {
+ //throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
}
- resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO);
+ //3.根据组织级别拼接查询条件,判断查询不同数据表
+ //区县级、乡镇街道级
+ if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
+ if ("district".equals(agency.getLevel())) {
+ formDTO.setAllParentIndexCode(FactConstant.QUAN_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
+ } else {
+ formDTO.setAllParentIndexCode(FactConstant.JIE_DAO_XIANG_GUAN + ":" + formDTO.getIndexCode());
+ }
+ resultList = factIndexAgencySubScoreDao.selectAblityList(formDTO);
- //社区级
- } else if ("community".equals(agency.getLevel())) {
- formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
- resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO);
+ //社区级
+ } else if ("community".equals(agency.getLevel())) {
+ formDTO.setAllParentIndexCode(FactConstant.SHE_QU_XIANG_GUAN + ":" + formDTO.getIndexCode());
+ resultList = factIndexCommunitySubScoreDao.selectCommunityAblityList(formDTO);
+ } else {
+ //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //网格层级数据
+ } else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
+ //4.查询网格层级各项能力对应指标数据
+ formDTO.setAllParentIndexCode(FactConstant.WANG_GE_XIANG_GUAN + ":" + formDTO.getIndexCode());
+ resultList = factIndexGridSubScoreDao.selectGridAblityList(formDTO);
} else {
- throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId()));
+ throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
- //3.调用方法判断各项指标是数字指标还是百分比指标 //TODO
+
+ //4.查询指标字典表数据
+ List list = indexDictDao.selectList();
+ //5.遍历数据,判断数据类型并处理
+ resultList.forEach(result -> {
+ list.stream().filter(dto -> dto.getIndexCode().equals(result.getKey())).forEach(l -> {
+ result.setShowType(l.getValueType());
+ //小数类型,四舍五入保留小数点后一位
+ if (FactConstant.DECIMAL.equals(l.getValueType())) {
+ BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
+ result.setValue(num.toString());
+ }
+ //百分数类型,四舍五入保留小数点后一位并转成百分比
+ if (FactConstant.PERCENT.equals(l.getValueType())) {
+ BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
+ result.setValue(num + "%");
+ }
+ });
+ });
+
return resultList;
}
@@ -159,28 +354,61 @@ public class FactIndexServiceImpl implements FactIndexService {
LinkedList resultList = new LinkedList<>();
//1.计算所查月份前12个月的monthId
formDTO.setStartMonthId(getDate(formDTO.getMonthId()));
- //2.根据组织Id查询组织信息
- CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId());
- if (null == agency) {
- throw new RenException(String.format("查询到组织信息失败,组织Id:%s", formDTO.getAgencyId()));
+ //2.根据类型判断是查询组织数据还是网格数据
+ //组织层级数据
+ if (FactConstant.AGENCY.equals(formDTO.getOrgType())) {
+ //3.根据组织Id查询组织信息
+ CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getOrgId());
+ if (null == agency) {
+ //throw new RenException(String.format("查询组织信息失败,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //4.根据组织级别拼接查询条件,判断查询不同数据表
+ //区县级、乡镇街道级
+ if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
+ resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO);
+ //社区级
+ } else if ("community".equals(agency.getLevel())) {
+ resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO);
+ } else {
+ //throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getOrgId()));
+ return resultList;
+ }
+ //网格层级数据
+ } else if (FactConstant.GRID.equals(formDTO.getOrgType())) {
+ //5.查询网格层级某项能力对应的一项指标过去12个月份数据
+ resultList = factIndexGridSubScoreDao.selectGridMonthAblityList(formDTO);
+ } else {
+ throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
- //3.根据组织级别拼接查询条件,判断查询不同数据表
- //区县级、乡镇街道级
- if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) {
- resultList = factIndexAgencySubScoreDao.selectMonthAblityList(formDTO);
+ //6.查询指标字典表具体数据
+ IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey());
+ if (null == dictDTO) {
+ throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey()));
+ }
- //社区级
- } else if ("community".equals(agency.getLevel())) {
- resultList = factIndexCommunitySubScoreDao.selectCommunityMonthAblityList(formDTO);
- } else {
- throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId()));
+ //7.遍历数据,判断数据类型并处理
+ //小数或百分数类型,四舍五入保留小数点后一位
+ if (FactConstant.DECIMAL.equals(dictDTO.getValueType()) || FactConstant.PERCENT.equals(dictDTO.getValueType())) {
+ resultList.forEach(result -> {
+ BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP);
+ result.setAblity(num.toString());
+ });
}
- //3.调用方法判断各项指标是数字指标还是百分比指标//TODO
+
return resultList;
}
+ /**
+ * @param newDate
+ * @Description 计算monthId对应一年前的monthId
+ * @author sun
+ */
public String getDate(String newDate) {
+ if (!validDateEffecitive(newDate)) {
+ throw new RenException(String.format("monthId格式错误,monthId:%s", newDate));
+ }
String date = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
try {
@@ -194,14 +422,41 @@ public class FactIndexServiceImpl implements FactIndexService {
return date;
}
+ /**
+ * @param newDate
+ * @Description 校验日期格式是否正确
+ * @author sun
+ */
+ public boolean validDateEffecitive(String newDate) {
+ //yyyy-MM-dd格式
+ //String DATE_REGEX = "^([1-9]\\d{3}-)(([0]{0,1}[1-9]-)|([1][0-2]-))(([0-3]{0,1}[0-9]))$";
+ //yyyymm格式
+ String DATE_REGEX = "^([1-9]\\d{3})(([0]{0,1}[1-9])|([1][0-2]))$";
+ boolean matches = Pattern.matches(DATE_REGEX, newDate);
+ if (!matches) {
+ return matches;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
+ //设置日期格式转的严谨性
+ sdf.setLenient(false);
+ try {
+ sdf.parse(newDate);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return matches;
+ }
+
/**
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List peerComparison(PeerComparisonFormDTO formDTO) {
- //1.根据组织Id的上级组织Id查询同级组织对应类型的得分排名(查询最近一个月数据)
+ //1.根据组织或网格Id的上级组织Id查询同级组织或网格对应类型的得分排名(查询最近一个月数据)
List resultList = screenIndexDataMonthlyDao.selectScoreList(formDTO);
return resultList;
}
@@ -212,6 +467,7 @@ public class FactIndexServiceImpl implements FactIndexService {
* @author sun
*/
@Override
+ @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) {
RootAgencyResultDTO resultDTO = new RootAgencyResultDTO();
//1.根据agencyId查询是否为根级组织
diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
index d3ebec947d..34d40361e4 100644
--- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml
@@ -140,4 +140,12 @@ pagehelper:
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
- secret: @dingTalk.robot.secret@
\ No newline at end of file
+ secret: @dingTalk.robot.secret@
+
+
+jwt:
+ token:
+ #秘钥
+ secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]
+ #token有效时长,默认7天,单位秒
+ expire: 604800
\ No newline at end of file
diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
index 4ecea63f0a..484abef720 100644
--- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
+++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml
@@ -3,8 +3,66 @@
-