Browse Source

基层治理:公众参与概况、公众参与排行、治理能力榜单3个查询接口bug修改

dev_shibei_match
yinzuomei 5 years ago
parent
commit
af5932ce2c
  1. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java
  2. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java
  3. 38
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  4. 35
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml
  5. 38
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml
  6. 50
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java

@ -48,7 +48,5 @@ public interface ScreenPublicPartiTotalDataDao{
* @author wangc * @author wangc
* @date 2020.08.20 16:00 * @date 2020.08.20 16:00
**/ **/
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode, List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode);
@Param("customerId")String customerId,
@Param("list")List<String> subCustomers);
} }

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java

@ -49,9 +49,7 @@ public interface ScreenUserJoinDao {
* @author wangc * @author wangc
* @date 2020.08.20 15:07 * @date 2020.08.20 15:07
**/ **/
UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId, UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId);
@Param("list") List<String> subCustomers,
@Param("customerId")String customerId);
/** /**

38
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -143,23 +143,21 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
List<String> subCustomers; List<String> subCustomers;
if(null == crmResp || !crmResp.success()) {subCustomers = null ;} if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;}
else {subCustomers = crmResp.getData();} else {subCustomers = crmResp.getData();}
String monthId = dateUtils.getCurrentMonthId(); String monthId = dateUtils.getCurrentMonthId();
UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ? UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId, screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
subCustomers,agencyInfo.getCustomerId());
//保证获取公众参与概率数据的最大可能性 //保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE; int time = NumConstant.TWELVE;
while (null == latest && time > NumConstant.ONE) { while (null == latest && time > NumConstant.ONE) {
time--; time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
latest = CollectionUtils.isEmpty(subCustomers) ? latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId, screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
subCustomers,agencyInfo.getCustomerId());
} }
if (null == latest) return new PublicPartiProfileResultDTO(); if (null == latest) return new PublicPartiProfileResultDTO();
@ -178,28 +176,30 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
* @author wangc * @author wangc
* @date 2020.08.20 15:32 * @date 2020.08.20 15:32
**/ **/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override @Override
public List<PublicPartiRankResultDTO> publicPartiRank(AgencyAndNumFormDTO param) { public List<PublicPartiRankResultDTO> publicPartiRank(AgencyAndNumFormDTO param) {
if(null == param.getTopNum()){ if (null == param.getTopNum()) {
param.setTopNum(NumConstant.TWO); param.setTopNum(NumConstant.TWO);
} }
if(NumConstant.ZERO == param.getTopNum()){ if (NumConstant.ZERO == param.getTopNum()) {
param.setTopNum(NumConstant.MAX); param.setTopNum(NumConstant.MAX);
} }
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()) ; ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
List<String> subCustomers; List<String> subCustomers;
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
if(null == crmResp || !crmResp.success()) {subCustomers = null ;} if (null == crmResp || !crmResp.success() || CollectionUtils.isEmpty(crmResp.getData())) {
else {subCustomers = crmResp.getData();} subCustomers = null;
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); } else {
subCustomers = crmResp.getData();
}
PageHelper.startPage(NumConstant.ONE, param.getTopNum());
List<PublicPartiRankResultDTO> result = List<PublicPartiRankResultDTO> result =
CollectionUtils.isEmpty(subCustomers) ? CollectionUtils.isEmpty(subCustomers) || StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()) screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode(),agencyInfo.getCustomerId(), : screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode());
subCustomers); if (null == result) {
if(null == result) {
return new ArrayList<>(); return new ArrayList<>();
} }
return result; return result;

35
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml

@ -25,28 +25,29 @@
(rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC (rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC
</select> </select>
<!-- --> <!-- 基层治理-治理能力榜单 多客户版,调用此sql -->
<select id="selectGovernCapacityRatioNew" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO"> <select id="selectGovernCapacityRatioNew" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO">
SELECT SELECT
rankData.ORG_NAME AS agencyName, rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO, rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO, rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO, rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO, rankData.SATISFACTION_RATIO,
agency.AGENCY_NAME AS parentAgencyName pa.AGENCY_NAME AS parentAgencyName
FROM FROM
screen_govern_rank_data rankData screen_govern_rank_data rankData
LEFT JOIN screen_customer_agency agency ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0' LEFT JOIN screen_customer_agency agency ON (rankData.org_id = agency.AGENCY_ID AND agency.DEL_FLAG = '0')
left join screen_customer_agency pa on(agency.PARENT_AREA_CODE=pa.AREA_CODE and pa.DEL_FLAG='0')
WHERE WHERE
rankData.DEL_FLAG = '0' rankData.DEL_FLAG = '0'
AND ( AND rankData.org_id in
<foreach collection="orgIds" item="orgId" separator=" OR "> <foreach collection="orgIds" item="orgId" open="(" close=")" separator=",">
rankData.PARENT_ID = #{orgId} #{orgId}
</foreach> </foreach>
) AND rankData.MONTH_ID =#{monthId}
AND rankData.MONTH_ID = #{monthId}
ORDER BY ORDER BY
(rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC (rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,
rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC
</select> </select>
</mapper> </mapper>

38
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml

@ -36,37 +36,31 @@
<!-- 查询公众参与各类总数 --> <!-- 查询公众参与各类总数 -->
<select id="selectPublicPartiTotalByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.PublicPartiRankResultDTO"> <select id="selectPublicPartiTotalByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.PublicPartiRankResultDTO">
SELECT SELECT
totalData.ORG_NAME AS NAME, totalData.ORG_NAME AS NAME,
totalData.REG_USER_TOTAL AS regNum, totalData.REG_USER_TOTAL AS regNum,
totalData.JOIN_USER_TOTAL AS joinNum, totalData.JOIN_USER_TOTAL AS joinNum,
totalData.TOPIC_TOTAL AS topicNum, totalData.TOPIC_TOTAL AS topicNum,
totalData.ISSUE_TOTAL AS issueNum, totalData.ISSUE_TOTAL AS issueNum,
totalData.PROJECT_TOTAL AS projectNum, totalData.PROJECT_TOTAL AS projectNum,
agency.AGENCY_NAME AS parentAgencyName pa.AGENCY_NAME AS parentAgencyName
FROM FROM
screen_public_parti_total_data totalData screen_public_parti_total_data totalData
LEFT JOIN LEFT JOIN screen_customer_agency agency
screen_customer_agency agency ON (totalData.ORG_ID = agency.AGENCY_ID
ON totalData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0')
AND agency.DEL_FLAG = '0' left join screen_customer_agency pa
on(agency.PARENT_AREA_CODE=pa.AREA_CODE and pa.DEL_FLAG='0')
WHERE WHERE
totalData.DEL_FLAG = '0' totalData.DEL_FLAG = '0'
AND AND agency.PARENT_AREA_CODE=#{areaCode}
agency.AREA_CODE like concat(#{areaCode},'%') ORDER BY
<if test=" null != list and list.size() > 0"> (totalData.REG_USER_TOTAL + totalData.JOIN_USER_TOTAL + totalData.TOPIC_TOTAL + totalData.ISSUE_TOTAL + totalData.PROJECT_TOTAL) DESC,
<foreach collection="list" item="subId" open="AND ( totalData.customer_id = #{customerId} OR " separator=" OR " close=" )"> totalData.REG_USER_TOTAL desc,
totalData.customer_id = #{subId} totalData.JOIN_USER_TOTAL desc,
</foreach> totalData.TOPIC_TOTAL desc,
</if> totalData.ISSUE_TOTAL desc,
totalData.PROJECT_TOTAL desc
ORDER BY
(totalData.REG_USER_TOTAL + totalData.JOIN_USER_TOTAL + totalData.TOPIC_TOTAL + totalData.ISSUE_TOTAL + totalData.PROJECT_TOTAL) DESC,
totalData.REG_USER_TOTAL desc,
totalData.JOIN_USER_TOTAL desc,
totalData.TOPIC_TOTAL desc,
totalData.ISSUE_TOTAL desc,
totalData.PROJECT_TOTAL desc
</select> </select>

50
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

@ -26,30 +26,36 @@
<!-- 根据地区码查询用户参与数据 --> <!-- 根据地区码查询用户参与数据 -->
<select id="selectUserJoinDataByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinIndicatorGrowthRateResultDTO"> <select id="selectUserJoinDataByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinIndicatorGrowthRateResultDTO">
SELECT SELECT
avg(data.JOIN_TOTAL) AS total, avg( scj.JOIN_TOTAL ) AS total,
ROUND( avg(data.AVG_JOIN), 1 ) AS averageJoin, ROUND( avg( scj.AVG_JOIN ), 1 ) AS averageJoin,
avg(data.JOIN_TOTAL_UP_RATE) AS monthIncr, avg( scj.JOIN_TOTAL_UP_RATE ) AS monthIncr,
avg(data.JOIN_TOTAL_UP_FLAG) AS monthTrend, (case when avg( scj.JOIN_TOTAL_UP_RATE ) &gt;0 then 'incr'
ROUND(avg(data.AVG_ISSUE), 1) AS averageIssue, when avg( scj.JOIN_TOTAL_UP_RATE ) &lt; 0 then 'decr'
avg(data.AVG_ISSUE_UP_RATE) AS issueCompareLatestMonth, else 'eq'
avg(data.AVG_ISSUE_UP_FLAG) AS issueCompareLatestTrend, end )as monthTrend,
avg(data.AGVG_JOIN_UP_RATE) AS joinCompareLatestMonth, ROUND( avg( scj.AVG_ISSUE ), 1 ) AS averageIssue,
avg(data.AGVG_JOIN_UP_FLAG) AS joinCompareLatestTrend avg( scj.AVG_ISSUE_UP_RATE ) AS issueCompareLatestMonth,
(
case when avg( scj.AVG_ISSUE_UP_RATE )&gt; 0 then 'incr'
when avg( scj.AVG_ISSUE_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end
)as issueCompareLatestTrend,
avg( scj.AGVG_JOIN_UP_RATE ) AS joinCompareLatestMonth,
(
case when avg( scj.AGVG_JOIN_UP_RATE ) &gt; 0 then 'incr'
when avg( scj.AGVG_JOIN_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end
)as joinCompareLatestTrend
FROM FROM
screen_user_join data screen_user_join scj
LEFT JOIN LEFT JOIN screen_customer_agency agency ON scj.org_id = agency.agency_id
screen_customer_agency agency
ON data.org_id = agency.agency_id
WHERE WHERE
data.DEL_FLAG = '0' scj.DEL_FLAG = '0'
AND data.area_code like concat(#{areaCode},'%') AND scj.MONTH_ID = #{monthId}
AND data.MONTH_ID = #{monthId} AND agency.PARENT_AREA_CODE =#{areaCode}
<if test=" null != list and list.size() > 0">
<foreach collection="list" item="sub" open="AND ( data.customer_id = #{customerId} or" separator=" OR " close=")">
data.customerId = #{sub}
</foreach>
</if>
</select> </select>

Loading…
Cancel
Save