Browse Source

Merge remote-tracking branch 'origin/dev_pyscreen' into dev_temp

master
yinzuomei 5 years ago
parent
commit
8b20103db9
  1. 2
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  2. 10
      epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java
  3. 3
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  4. 2
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  5. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
  6. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java
  7. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java
  8. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java
  9. 47
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  10. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java
  11. 8
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml
  12. 39
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml
  13. 29
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

2
epmet-auth/src/main/java/com/epmet/controller/SsoController.java

@ -51,7 +51,7 @@ public class SsoController {
@PostMapping("oper/third/login") @PostMapping("oper/third/login")
public Result<UserTokenResultDTO> thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) { public Result<UserTokenResultDTO> thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class); ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.thirdLoginOper(formDTO)); return new Result<UserTokenResultDTO>().ok(ssoService.thirdLoginOperWork(formDTO));
} }
@PostMapping("test") @PostMapping("test")

10
epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java

@ -3,17 +3,15 @@ package com.epmet.dto.form;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2021/1/18 下午4:43 * @DateTime 2021/1/18 下午4:43
*/ */
@Data @Data
public class SsoLoginOperFormDTO extends LoginCommonFormDTO implements Serializable { public class SsoLoginOperFormDTO extends LoginCommonFormDTO {
private static final long serialVersionUID = -4215746830030486659L;
private static final long serialVersionUID = 8711491709544498082L;
public interface ThirdPlatformLoginForm { public interface ThirdPlatformLoginForm {
} }
@ -25,10 +23,10 @@ public class SsoLoginOperFormDTO extends LoginCommonFormDTO implements Serializa
private String thirdToken; private String thirdToken;
/** /**
* 上游系统token * 上游系统标识
* *
* @see com.epmet.enums.ThirdPlatformEnum * @see com.epmet.enums.ThirdPlatformEnum
*/ */
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) @NotBlank(message = "平台标识不能为空", groups = {ThirdPlatformLoginForm.class})
private String platform; private String platform;
} }

3
epmet-auth/src/main/java/com/epmet/service/SsoService.java

@ -33,6 +33,7 @@ public interface SsoService {
* @Description 4自动进入组织-返回token * @Description 4自动进入组织-返回token
**/ **/
UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO); UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO);
/** /**
* desc: sso登陆运营端 * desc: sso登陆运营端
* *
@ -41,5 +42,5 @@ public interface SsoService {
* @author LiuJanJun * @author LiuJanJun
* @date 2021/2/24 1:28 下午 * @date 2021/2/24 1:28 下午
*/ */
UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO); UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO);
} }

2
epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java

@ -133,7 +133,7 @@ public class SsoServiceImpl implements SsoService {
} }
@Override @Override
public UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO) { public UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO) {
ThirdPlatUserInfo thirdUser; ThirdPlatUserInfo thirdUser;
try { try {
ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform());

11
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java

@ -22,6 +22,12 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* desc: 平阴联动指挥平台sso登陆服务类 接入文档http://note.youdao.com/noteshare?id=167ad65365f9eccf7925e8c2629d2021&sub=555AE50510344CB5AACD5C06B9AA3B3B
*
* @author LiuJanJun
* @date 2021/2/25 1:43 下午
*/
@Service @Service
public class PyldApiService extends AbstractApiService { public class PyldApiService extends AbstractApiService {
@ -59,9 +65,7 @@ public class PyldApiService extends AbstractApiService {
buildHeaders()); buildHeaders());
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
PyldUserInfoResultDTO resultDTO = this.parseResult(result); PyldUserInfoResultDTO resultDTO = this.parseResult(result);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
@ -71,7 +75,6 @@ public class PyldApiService extends AbstractApiService {
} }
/** /**
* 构建请求头信息 * 构建请求头信息
* *
@ -117,6 +120,4 @@ public class PyldApiService extends AbstractApiService {
} }
return userInfo; return userInfo;
} }
} }

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java

@ -8,10 +8,7 @@ import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO;
import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO;
import com.epmet.evaluationindex.screen.dto.result.*; import com.epmet.evaluationindex.screen.dto.result.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;

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

@ -39,4 +39,16 @@ public interface ScreenPublicPartiTotalDataDao{
* @date 2020.08.20 16:00 * @date 2020.08.20 16:00
**/ **/
List<PublicPartiRankResultDTO> selectPublicPartiTotal(@Param("agencyId") String agencyId); List<PublicPartiRankResultDTO> selectPublicPartiTotal(@Param("agencyId") String agencyId);
/**
* @Description 根据areaCode查询公众参与各类总数
* @param areaCode
* @return
* @author wangc
* @date 2020.08.20 16:00
**/
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode,
@Param("customerId")String customerId,
@Param("list")List<String> subCustomers);
} }

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

@ -42,6 +42,18 @@ public interface ScreenUserJoinDao {
**/ **/
UserJoinIndicatorGrowthRateResultDTO selectUserJoinData(@Param("agencyId") String agencyId, @Param("monthId")String monthId); UserJoinIndicatorGrowthRateResultDTO selectUserJoinData(@Param("agencyId") String agencyId, @Param("monthId")String monthId);
/**
* @Description 根据地区码查询用户参与数据
* @param areaCode
* @return
* @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);
/** /**
* @Description 查询月度用户参与数据 * @Description 查询月度用户参与数据
* @param agencyId * @param agencyId

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

@ -3,16 +3,20 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.*; import com.epmet.datareport.dao.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService; import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService;
import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.DateUtils;
import com.epmet.datareport.utils.ModuleConstant; import com.epmet.datareport.utils.ModuleConstant;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO;
import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO;
import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; 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.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
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;
@ -48,6 +52,10 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
private ScreenGovernRankDataDao screenGovernRankDataDao; private ScreenGovernRankDataDao screenGovernRankDataDao;
@Autowired @Autowired
private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao; private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao;
@Autowired
private OperCrmOpenFeignClient crmClient;
@Autowired
private ScreenCustomerAgencyDao agencyDao;
/** /**
* @Description 1热心市民积分排行 * @Description 1热心市民积分排行
@ -110,15 +118,26 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override @Override
public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) {
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
List<String> subCustomers;
if(null == crmResp || !crmResp.success()) {subCustomers = null ;}
else {subCustomers = crmResp.getData();}
String monthId = dateUtils.getCurrentMonthId(); String monthId = dateUtils.getCurrentMonthId();
UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), 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 = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); latest = CollectionUtils.isEmpty(subCustomers) ?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId,
subCustomers,agencyInfo.getCustomerId());
} }
if (null == latest) return new PublicPartiProfileResultDTO(); if (null == latest) return new PublicPartiProfileResultDTO();
@ -146,8 +165,18 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
if(NumConstant.ZERO == param.getTopNum()){ if(NumConstant.ZERO == param.getTopNum()){
param.setTopNum(NumConstant.MAX); param.setTopNum(NumConstant.MAX);
} }
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()); PageHelper.startPage(NumConstant.ONE,param.getTopNum());
List<PublicPartiRankResultDTO> result = screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()); List<PublicPartiRankResultDTO> result =
CollectionUtils.isEmpty(subCustomers) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode(),agencyInfo.getCustomerId(),
subCustomers);
if(null == result) { if(null == result) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -254,6 +283,18 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
return percentStr.concat(ModuleConstant.SYMBOL_PERCENT); return percentStr.concat(ModuleConstant.SYMBOL_PERCENT);
} }
/**
* @Description 通过agencyId获取机关信息
* @param agencyId
* @return java.lang.String
* @author wangc
* @date 2021.02.25 13:46
*/
private ScreenCustomerAgencyDTO agencyInfo(String agencyId){
ScreenCustomerAgencyDTO agencyInfo = agencyDao.selectByAgencyId(agencyId);
if(null == agencyInfo) throw new RenException("获取Agency信息失败");
return agencyInfo;
}
} }

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

@ -74,10 +74,11 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
areaCode = agencyInfo.getAreaCode(); areaCode = agencyInfo.getAreaCode();
} }
Result<List<String>> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); Result<List<String>> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId);
if(null == crmResponse || !crmResponse.success()){ List<String> subCustomers;
throw new RenException("获取子客户列表失败"); if(null == crmResponse || !crmResponse.success())
} {subCustomers = null;}
List<String> subCustomers = crmResponse.getData(); else
{subCustomers = crmResponse.getData();}
FineExampleResultDTO fineExampleResultDTO; FineExampleResultDTO fineExampleResultDTO;
if(CollectionUtils.isEmpty(subCustomers)) if(CollectionUtils.isEmpty(subCustomers))
fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());

8
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -55,9 +55,11 @@
data.del_flag = '0' data.del_flag = '0'
AND data.org_type = 'agency' AND data.org_type = 'agency'
AND agency.area_code LIKE concat(#{areaCode},'%') AND agency.area_code LIKE concat(#{areaCode},'%')
<foreach collection="list" item="subId" open="AND ( agency.customer_id = #{customerId} OR " separator=" OR " close=" )"> <if test=" null != list and list.size() > 0">
agency.customer_id = #{subId} <foreach collection="list" item="subId" open="AND ( data.customer_id = #{customerId} OR " separator=" OR " close=" )">
</foreach> data.customer_id = #{subId}
</foreach>
</if>
ORDER BY data.data_end_time DESC ORDER BY data.data_end_time DESC
LIMIT 1 LIMIT 1
</select> </select>

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

@ -31,4 +31,43 @@
totalData.PROJECT_TOTAL desc totalData.PROJECT_TOTAL desc
</select> </select>
<!-- 查询公众参与各类总数 -->
<select id="selectPublicPartiTotalByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.PublicPartiRankResultDTO">
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
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'
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
</select>
</mapper> </mapper>

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

@ -24,6 +24,35 @@
AND MONTH_ID = #{monthId} AND MONTH_ID = #{monthId}
</select> </select>
<!-- 根据地区码查询用户参与数据 -->
<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
FROM
screen_user_join data
LEFT JOIN
screen_customer_agency agency
ON data.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>
</select>
<!-- 查询用户参与月度数据 --> <!-- 查询用户参与月度数据 -->
<select id="selectUserJoinDataMonthly" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinMonthlyResultDTO"> <select id="selectUserJoinDataMonthly" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinMonthlyResultDTO">
<!-- 字段完全对不上 --> <!-- 字段完全对不上 -->

Loading…
Cancel
Save