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
* @date 2020.08.20 16:00
**/
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode,
@Param("customerId")String customerId,
@Param("list")List<String> subCustomers);
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode);
}

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
* @date 2020.08.20 15:07
**/
UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId,
@Param("list") List<String> subCustomers,
@Param("customerId")String customerId);
UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId);
/**

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());
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
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();}
String monthId = dateUtils.getCurrentMonthId();
UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ?
UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId,
subCustomers,agencyInfo.getCustomerId());
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
//保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE;
while (null == latest && time > NumConstant.ONE) {
time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
latest = CollectionUtils.isEmpty(subCustomers) ?
latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId,
subCustomers,agencyInfo.getCustomerId());
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
}
if (null == latest) return new PublicPartiProfileResultDTO();
@ -178,28 +176,30 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
* @author wangc
* @date 2020.08.20 15:32
**/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public List<PublicPartiRankResultDTO> publicPartiRank(AgencyAndNumFormDTO param) {
if(null == param.getTopNum()){
if (null == param.getTopNum()) {
param.setTopNum(NumConstant.TWO);
}
if(NumConstant.ZERO == param.getTopNum()){
if (NumConstant.ZERO == param.getTopNum()) {
param.setTopNum(NumConstant.MAX);
}
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()) ;
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
List<String> subCustomers;
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
if(null == crmResp || !crmResp.success()) {subCustomers = null ;}
else {subCustomers = crmResp.getData();}
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
if (null == crmResp || !crmResp.success() || CollectionUtils.isEmpty(crmResp.getData())) {
subCustomers = null;
} else {
subCustomers = crmResp.getData();
}
PageHelper.startPage(NumConstant.ONE, param.getTopNum());
List<PublicPartiRankResultDTO> result =
CollectionUtils.isEmpty(subCustomers) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode(),agencyInfo.getCustomerId(),
subCustomers);
if(null == result) {
CollectionUtils.isEmpty(subCustomers) || StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode());
if (null == result) {
return new ArrayList<>();
}
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
</select>
<!-- -->
<!-- 基层治理-治理能力榜单 多客户版,调用此sql -->
<select id="selectGovernCapacityRatioNew" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO">
SELECT
rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
agency.AGENCY_NAME AS parentAgencyName
rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
pa.AGENCY_NAME AS parentAgencyName
FROM
screen_govern_rank_data rankData
LEFT JOIN screen_customer_agency agency ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0'
screen_govern_rank_data rankData
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
rankData.DEL_FLAG = '0'
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
rankData.PARENT_ID = #{orgId}
</foreach>
)
AND rankData.MONTH_ID = #{monthId}
rankData.DEL_FLAG = '0'
AND rankData.org_id in
<foreach collection="orgIds" item="orgId" open="(" close=")" separator=",">
#{orgId}
</foreach>
AND rankData.MONTH_ID =#{monthId}
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>
</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
SELECT
totalData.ORG_NAME AS NAME,
totalData.REG_USER_TOTAL AS regNum,
totalData.JOIN_USER_TOTAL AS joinNum,
totalData.TOPIC_TOTAL AS topicNum,
totalData.ISSUE_TOTAL AS issueNum,
totalData.PROJECT_TOTAL AS projectNum,
agency.AGENCY_NAME AS parentAgencyName
pa.AGENCY_NAME AS parentAgencyName
FROM
screen_public_parti_total_data totalData
LEFT JOIN
screen_customer_agency agency
ON totalData.PARENT_ID = agency.AGENCY_ID
AND agency.DEL_FLAG = '0'
LEFT JOIN screen_customer_agency agency
ON (totalData.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
totalData.DEL_FLAG = '0'
AND
agency.AREA_CODE like concat(#{areaCode},'%')
<if test=" null != list and list.size() > 0">
<foreach collection="list" item="subId" open="AND ( totalData.customer_id = #{customerId} OR " separator=" OR " close=" )">
totalData.customer_id = #{subId}
</foreach>
</if>
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
totalData.DEL_FLAG = '0'
AND agency.PARENT_AREA_CODE=#{areaCode}
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>

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
avg(data.JOIN_TOTAL) AS total,
ROUND( avg(data.AVG_JOIN), 1 ) AS averageJoin,
avg(data.JOIN_TOTAL_UP_RATE) AS monthIncr,
avg(data.JOIN_TOTAL_UP_FLAG) AS monthTrend,
ROUND(avg(data.AVG_ISSUE), 1) AS averageIssue,
avg(data.AVG_ISSUE_UP_RATE) AS issueCompareLatestMonth,
avg(data.AVG_ISSUE_UP_FLAG) AS issueCompareLatestTrend,
avg(data.AGVG_JOIN_UP_RATE) AS joinCompareLatestMonth,
avg(data.AGVG_JOIN_UP_FLAG) AS joinCompareLatestTrend
SELECT
avg( scj.JOIN_TOTAL ) AS total,
ROUND( avg( scj.AVG_JOIN ), 1 ) AS averageJoin,
avg( scj.JOIN_TOTAL_UP_RATE ) AS monthIncr,
(case when avg( scj.JOIN_TOTAL_UP_RATE ) &gt;0 then 'incr'
when avg( scj.JOIN_TOTAL_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end )as monthTrend,
ROUND( avg( scj.AVG_ISSUE ), 1 ) AS averageIssue,
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
screen_user_join data
LEFT JOIN
screen_customer_agency agency
ON data.org_id = agency.agency_id
screen_user_join scj
LEFT JOIN screen_customer_agency agency ON scj.org_id = agency.agency_id
WHERE
data.DEL_FLAG = '0'
AND data.area_code like concat(#{areaCode},'%')
AND data.MONTH_ID = #{monthId}
<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>
scj.DEL_FLAG = '0'
AND scj.MONTH_ID = #{monthId}
AND agency.PARENT_AREA_CODE =#{areaCode}
</select>

Loading…
Cancel
Save