Browse Source

热心市民排行接口修改

master
yinzuomei 5 years ago
parent
commit
179e2d69a4
  1. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java
  2. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  3. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java
  4. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  5. 27
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java
  6. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml
  7. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  8. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java

@ -21,4 +21,9 @@ public class ParymemberFormDTO implements Serializable {
*/ */
@NotBlank(message = "机关ID不能为空",groups = {Parymember.class}) @NotBlank(message = "机关ID不能为空",groups = {Parymember.class})
private String agencyId; private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
*/
private String areaCode;
} }

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

@ -73,4 +73,6 @@ public interface ScreenPartyUserRankDataDao{
List<PartIndexScroeRankResultDTO> selectPartymemberPointList(PartIndexScroeRankFormDTO formDTO); List<PartIndexScroeRankResultDTO> selectPartymemberPointList(PartIndexScroeRankFormDTO formDTO);
List<PartyUserPointResultDTO> selectPartymemberPointOrderByAreaCode(@Param("areaCode") String areaCode); List<PartyUserPointResultDTO> selectPartymemberPointOrderByAreaCode(@Param("areaCode") String areaCode);
List<UserPointResultDTO> selectUserPointOrderByAreaCode(@Param("areaCode") String areaCode);
} }

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

@ -22,6 +22,8 @@ import com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 * 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数
* *
@ -57,4 +59,5 @@ public interface ScreenUserTotalDataDao {
**/ **/
int selectAvgIssue(@Param("agencyId")String agencyId); int selectAvgIssue(@Param("agencyId")String agencyId);
PartymemberPercentResultDTO selectAgencyPartymemberPercentByIds(@Param("orgIds") List<String> orgIds);
} }

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

@ -18,6 +18,7 @@ import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO;
import com.epmet.evaluationindex.screen.dto.result.*; import com.epmet.evaluationindex.screen.dto.result.*;
import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,6 +37,7 @@ import java.util.stream.Collectors;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/8/18 10:20 * @date 2020/8/18 10:20
*/ */
@Slf4j
@Service @Service
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
@ -73,7 +75,13 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
param.setTopNum(NumConstant.FIVE); param.setTopNum(NumConstant.FIVE);
} }
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); PageHelper.startPage(NumConstant.ONE,param.getTopNum());
List<UserPointResultDTO> userPointList = screenPartyUserRankDataDao.selectUserPointOrder(param.getAgencyId()); List<UserPointResultDTO> userPointList = new ArrayList<>();
if(StringUtils.isNotBlank(param.getAreaCode())){
log.info("热心市民积分排行按照areaCode查询"+param.getAreaCode());
userPointList=screenPartyUserRankDataDao.selectUserPointOrderByAreaCode(param.getAreaCode());
}else{
userPointList=screenPartyUserRankDataDao.selectUserPointOrder(param.getAgencyId());
}
UserPointRankResultDTO result = new UserPointRankResultDTO(); UserPointRankResultDTO result = new UserPointRankResultDTO();
result.setNameData(userPointList.stream().map(UserPointResultDTO::getName).collect(Collectors.toList())); result.setNameData(userPointList.stream().map(UserPointResultDTO::getName).collect(Collectors.toList()));
result.setPointsData(userPointList.stream().map(UserPointResultDTO::getPoint).collect(Collectors.toList())); result.setPointsData(userPointList.stream().map(UserPointResultDTO::getPoint).collect(Collectors.toList()));

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

@ -8,6 +8,7 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCpcBaseDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCpcBaseDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyBranchDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyBranchDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.datareport.service.evaluationindex.screen.GrassrootsPartyDevService; import com.epmet.datareport.service.evaluationindex.screen.GrassrootsPartyDevService;
import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.DateUtils;
import com.epmet.datareport.utils.ModuleConstant; import com.epmet.datareport.utils.ModuleConstant;
@ -50,7 +51,8 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService
private DateUtils dateUtils; private DateUtils dateUtils;
@Autowired @Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient; private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private AgencyService screenCustomerAgencyService;
/** /**
* @Description 1党员基本情况-饼状图概况 * @Description 1党员基本情况-饼状图概况
* @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321324 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321324
@ -62,10 +64,29 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override @Override
public PartymemberPercentResultDTO partymemberBaseInfo(ParymemberFormDTO param) { public PartymemberPercentResultDTO partymemberBaseInfo(ParymemberFormDTO param) {
if(StringUtils.isNotBlank(param.getAreaCode())){
logger.info(String.format("党员基本情况-饼状图概况按照areaCode查询:%s",param.getAreaCode()));
List<String> ids=screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(),param.getAgencyId());
if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(ids)){
PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercentByIds(ids);
if(null == result){
logger.warn("selectAgencyPartymemberPercentByIds is null");
result = new PartymemberPercentResultDTO();
result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO));
return result;
}
if(null == result.getPlatFormTotal() || NumConstant.ZERO == result.getPlatFormTotal()){
result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO));
}else{
result.setPercentInPlatForm(convertPercentStr(new BigDecimal((result.getPartyMemberTotal().doubleValue()/result.getPlatFormTotal().doubleValue()))));
}
return result;
}
logger.warn("当前组织没有下级getNextAgencyIds is empty");
return new PartymemberPercentResultDTO();
}
PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercent(param.getAgencyId()); PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercent(param.getAgencyId());
if(null == result){ if(null == result){
result = new PartymemberPercentResultDTO();
logger.warn("com.epmet.datareport.service.screen.impl.GrassrootsPartyDevServiceImpl.partymemberBaseInfo:未查询出指定agencyId下的党员基础信息数据,agencyId :: {}",param.getAgencyId()); logger.warn("com.epmet.datareport.service.screen.impl.GrassrootsPartyDevServiceImpl.partymemberBaseInfo:未查询出指定agencyId下的党员基础信息数据,agencyId :: {}",param.getAgencyId());
result = new PartymemberPercentResultDTO(); result = new PartymemberPercentResultDTO();
result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO));

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml

@ -32,10 +32,12 @@
ON ( sca.agency_id = md.ORG_ID AND md.del_flag = '0' ) ON ( sca.agency_id = md.ORG_ID AND md.del_flag = '0' )
WHERE SCA.DEL_FLAG='0' WHERE SCA.DEL_FLAG='0'
AND sca.is_display = '1' AND sca.is_display = '1'
<if test="agencyIdList != null and agencyIdList.size() > 0">
AND sca.agency_id in AND sca.agency_id in
<foreach item="agencyId" collection="agencyIdList" open="(" separator="," close=")"> <foreach item="agencyId" collection="agencyIdList" open="(" separator="," close=")">
#{agencyId} #{agencyId}
</foreach> </foreach>
</if>
union union
SELECT SELECT
scg.GRID_ID as orgId, scg.GRID_ID as orgId,
@ -47,9 +49,11 @@
LEFT JOIN screen_party_link_masses_data md LEFT JOIN screen_party_link_masses_data md
ON ( scg.GRID_ID = md.ORG_ID AND md.del_flag = '0' ) ON ( scg.GRID_ID = md.ORG_ID AND md.del_flag = '0' )
WHERE scg.DEL_FLAG='0' WHERE scg.DEL_FLAG='0'
<if test="agencyIdList != null and agencyIdList.size() > 0">
AND scg.GRID_ID in AND scg.GRID_ID in
<foreach item="agencyId" collection="agencyIdList" open="(" separator="," close=")"> <foreach item="agencyId" collection="agencyIdList" open="(" separator="," close=")">
#{agencyId} #{agencyId}
</foreach> </foreach>
</if>
</select> </select>
</mapper> </mapper>

17
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -114,4 +114,21 @@
ORDER BY ORDER BY
m.POINT_TOTAL DESC m.POINT_TOTAL DESC
</select> </select>
<select id="selectUserPointOrderByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.UserPointResultDTO">
SELECT
m.USER_ID,
concat( m.surname, CASE char_length( m.NAME ) WHEN 1 THEN '*' WHEN 2 THEN '**' ELSE '***' END ) AS name,
m.POINT_TOTAL AS point
FROM
screen_party_user_rank_data m
left join screen_customer_grid scg
on(m.GRID_ID=scg.GRID_ID and scg.DEL_FLAG='0')
WHERE
m.DEL_FLAG = '0'
and scg.AREA_CODE like CONCAT(#{areaCode},'%')
ORDER BY
m.POINT_TOTAL DESC
m.user_name
</select>
</mapper> </mapper>

15
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml

@ -15,6 +15,21 @@
AND PARENT_ID = #{agencyId} AND PARENT_ID = #{agencyId}
</select> </select>
<select id="selectAgencyPartymemberPercentByIds" parameterType="map" resultType="com.epmet.evaluationindex.screen.dto.result.PartymemberPercentResultDTO">
SELECT
SUM( PARTY_TOTAL ) AS partyMemberTotal,
SUM( USER_TOTAL ) AS platFormTotal
FROM
screen_user_total_data m
WHERE
DEL_FLAG = '0'
<if test="orgIds != null and orgIds.size() > 0">
AND m.ORG_ID IN
<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
#{orgId}
</foreach>
</if>
</select>
<!-- 查询top区概况 --> <!-- 查询top区概况 -->
<select id="selectTopProfile" resultType="com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO"> <select id="selectTopProfile" resultType="com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO">
SELECT SELECT

Loading…
Cancel
Save