Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

master
jianjun 5 years ago
parent
commit
d0779e7577
  1. 4
      epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java
  2. 44
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/GridIndexRankFormDTO.java
  3. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GroupTopicShiftIssueRatioRankResultDTO.java
  4. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  5. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  6. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  7. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcGroupDetailGridDailyDao.java
  8. 48
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/eum/OrgTypeEnum.java
  9. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  10. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java
  11. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  12. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java
  13. 21
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  14. 14
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcGroupDetailGridDailyDao.xml
  15. 16
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java
  16. 1
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppMD5AuthProcessor.java

4
epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java

@ -1,6 +1,7 @@
package com.epmet.commons.extappauth.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -96,7 +97,8 @@ public class ExternalAppRequestAuthAspect {
if (parameters[i].getType() == ExternalAppRequestParam.class) {
ExternalAppRequestParam requestParam = (ExternalAppRequestParam) point.getArgs()[i];
requestParam.setAppId(appId);
requestParam.setCustomerId(authResult.getCustomerId() == null ? customerId : authResult.getCustomerId());
requestParam.setCustomerId(StringUtils.isBlank(authResult.getCustomerId()) ? customerId : authResult.getCustomerId());
logger.info("auth ExternalAppRequestParam:{}", JSON.toJSONString(requestParam));
}
}
}

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

@ -0,0 +1,44 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/20 9:54 上午
*/
@Data
public class GridIndexRankFormDTO implements Serializable {
private static final long serialVersionUID = 7865119038417362515L;
/**
* 机关ID
*/
private String agencyId;
/**
* 默认查询前几名
*/
@NotNull(message = "默认查询名次不能为空")
private Integer topNum;
/**
* 客户I
*/
@NotBlank(message = "客户Id不能为空")
private String customerId;
/**
* 年Id
*/
private String yearId;
/**
* 组织类别 agency组织部门department网格grid
*/
private String orgType;
}

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GroupTopicShiftIssueRatioRankResultDTO.java

@ -22,9 +22,9 @@ public class GroupTopicShiftIssueRatioRankResultDTO implements Serializable {
*/
private String groupName = "";
/**
* 话题数
* 转为议题的话题数
*/
private Integer topicCount = 0;
private Integer shifitIssueCount = 0;
/**
* 群主名称
*/

21
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -1,8 +1,10 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.eum.OrgTypeEnum;
import com.epmet.datareport.service.evaluationindex.screen.IndexService;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
@ -82,15 +84,30 @@ public class IndexController {
/**
* 5下级部门指数排行安宁数据段用
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO>>
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO>>
* @Author zhangyong
* @Date 13:39 2020-09-11
**/
@ExternalAppRequestAuth
@PostMapping("dataclient/subagencyindexrank")
public Result<List<AnNingSubAgencyIndexRankResultDTO>> anNingSubAgencyIndexRank(@RequestBody AnNingSubAgencyIndexRankFormDTO formDTO){
public Result<List<AnNingSubAgencyIndexRankResultDTO>> anNingSubAgencyIndexRank(@RequestBody AnNingSubAgencyIndexRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AnNingSubAgencyIndexRankFormDTO.SubAgencyIndexRank.class);
return new Result<List<AnNingSubAgencyIndexRankResultDTO>>().ok(indexService.anNingSubAgencyIndexRank(formDTO));
}
/**
* @param formDTO
* @Description 4获取该客户下所有网格指标排行
* @author jianjun.liu
* @date 2020/8/20 10:02 上午
*/
@ExternalAppRequestAuth
@PostMapping("gridindexrank")
public Result<List<SubAgencyIndexRankResultDTO>> gridIndexRank(ExternalAppRequestParam extParam, @RequestBody GridIndexRankFormDTO formDTO) {
formDTO.setCustomerId(extParam.getCustomerId());
ValidatorUtils.validateEntity(formDTO);
formDTO.setOrgType(OrgTypeEnum.GRID.getCode());
return new Result<List<SubAgencyIndexRankResultDTO>>().ok(indexService.selectIndexRankByOrgType(formDTO));
}
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java

@ -210,7 +210,7 @@ public class KcScreenController {
/**
* @param externalAppRequestParam
* @Description 邻里党群-话题数量排名
* @Description 邻里党群-话题转化率排名
* @author sun
*/
@ExternalAppRequestAuth

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

@ -18,6 +18,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.AnNingSubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AnNingSubAgencyIndexRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.MonthBarchartResult;
@ -71,4 +72,11 @@ public interface ScreenIndexDataMonthlyDao{
**/
List<AnNingSubAgencyIndexRankResultDTO> selectAnNingSubAgencyIndexMonthlyRank(AnNingSubAgencyIndexRankFormDTO formDTO);
/**
* desc获取网格指标排行
*
* @param formDTO
* @return
*/
List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
}

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

@ -43,7 +43,7 @@ public interface ScreenKcGroupDetailGridDailyDao {
/**
* @param formDTO
* @Description 按客户查询最近一天所有网格数据 再按话题总数降序排列
* @Description 按客户查询最近一天所有网格数据 再按转议题数量降序排列
* @author sun
*/
List<GroupTopicShiftIssueRatioRankResultDTO> selectGroupTopicShiftIssueRatioRankList(GroupTopicShiftIssueRatioRankFormDTO formDTO);

48
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/eum/OrgTypeEnum.java

@ -0,0 +1,48 @@
package com.epmet.datareport.eum;
/**
* 需要组织类型枚举类
*
* @author jianjun liu
* @date 2020-08-26 11:14
**/
public enum OrgTypeEnum {
DEPARTMENT("department", "部门"),
AGENCY("agency", "组织"),
GRID("grid", "网格"),
;
/**
* code
*/
private String code;
/**
* name
*/
private String name;
OrgTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static OrgTypeEnum getEnum(String code) {
OrgTypeEnum[] values = OrgTypeEnum.values();
for (OrgTypeEnum value : values) {
if (code != null && value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -55,4 +55,11 @@ public interface IndexService {
**/
List<AnNingSubAgencyIndexRankResultDTO> anNingSubAgencyIndexRank(AnNingSubAgencyIndexRankFormDTO formDTO);
/**
* desc:获取该客户下网格排行
*
* @param formDTO
* @return
*/
List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
}

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

@ -96,7 +96,7 @@ public interface KcScreenService {
/**
* @param formDTO
* @Description 邻里党群-话题数量排名
* @Description 邻里党群-话题转化率排名
* @author sun
*/
List<GroupTopicShiftIssueRatioRankResultDTO> groupTopicShiftIssueRatioRank(GroupTopicShiftIssueRatioRankFormDTO formDTO);

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

@ -224,13 +224,32 @@ public class IndexServiceImpl implements IndexService {
return subAgencyIndexRankResultDTOS;
}
@Override
public List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO) {
LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE);
int yearId = now.getYear();
formDTO.setYearId(String.valueOf(yearId));
List<SubAgencyIndexRankResultDTO> subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectIndexRankByOrgType(formDTO);
if (CollectionUtils.isEmpty(subAgencyIndexRankResultDTOS)) {
return new ArrayList<>();
}
// 小数四舍五入
subAgencyIndexRankResultDTOS.forEach(indexRank -> {
indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility()));
indexRank.setGovernAbility(getRound(indexRank.getGovernAbility()));
indexRank.setServiceAbility(getRound(indexRank.getServiceAbility()));
indexRank.setTotalIndex(getRound(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility()));
});
return subAgencyIndexRankResultDTOS;
}
/**
* @Description 小数四舍五入
* @param d
* @Description 小数四舍五入
* @author zxc
* @date 2020/9/14 2:01 下午
*/
public Double getRound(Double d){
public Double getRound(Double d) {
BigDecimal bigDecimal = new BigDecimal(d);
BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP);
return Double.valueOf(b.toString());

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

@ -300,21 +300,21 @@ public class KcScreenServiceImpl implements KcScreenService {
public List<GroupUserCountRankResultDTO> groupUserCountRank(GroupUserCountRankFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
//按客户查询最近一天所有网格数据 再按社群总数降序排列
//按客户查询最近一天所有网格数据 再按照群内成员数降序
List<GroupUserCountRankResultDTO> list = screenKcGroupDetailGridDailyDao.selectGroupUserCountRankList(formDTO);
return list;
}
/**
* @param formDTO
* @Description 邻里党群-话题数量排名
* @Description 邻里党群-话题转化率排名
* @author sun
*/
@Override
public List<GroupTopicShiftIssueRatioRankResultDTO> groupTopicShiftIssueRatioRank(GroupTopicShiftIssueRatioRankFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
//按客户查询最近一天所有网格数据 再按话题总数降序排列
//按客户查询最近一天所有网格数据 再按转议题数量降序排列
List<GroupTopicShiftIssueRatioRankResultDTO> list = screenKcGroupDetailGridDailyDao.selectGroupTopicShiftIssueRatioRankList(formDTO);
return list;
}

21
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -84,4 +84,25 @@
</if>
LIMIT #{topNum}
</select>
<select id="selectIndexRankByOrgType"
resultType="com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO">
SELECT
org_name AS NAME,
govern_ablity AS governAbility,
party_dev_ablity AS partyDevAbility,
service_ablity AS serviceAbility
FROM
screen_index_data_yearly
WHERE
del_flag = '0'
<if test="agencyId != null and agencyId != ''">
AND parent_id = #{agencyId}
</if>
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND year_id = #{yearId}
AND ORG_TYPE = #{orgType}
ORDER BY index_total DESC
LIMIT #{topNum}
</select>
</mapper>

14
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcGroupDetailGridDailyDao.xml

@ -5,8 +5,8 @@
<select id="selectGroupUserCountRankList" resultType="com.epmet.evaluationindex.screen.dto.result.GroupUserCountRankResultDTO">
SELECT
grid_id AS "groupId",
grid_name AS "groupName",
group_id AS "groupId",
group_name AS "groupName",
member_count AS "memberCount",
group_leader AS "groupLeader"
FROM
@ -33,10 +33,10 @@
</select>
<select id="selectGroupTopicShiftIssueRatioRankList" resultType="com.epmet.evaluationindex.screen.dto.result.GroupTopicShiftIssueRatioRankResultDTO">
SELECT
grid_id AS "groupId",
grid_name AS "groupName",
topic_count AS "topicCount",
SELECT
group_id AS "groupId",
group_name AS "groupName",
shifit_issue_count AS "shifitIssueCount",
group_leader AS "groupLeader"
FROM
screen_kc_group_detail_grid_daily
@ -57,7 +57,7 @@ SELECT
limit 1
)
ORDER BY
member_count DESC
shifit_issue_count DESC
LIMIT #{pageNo}, #{pageSize}
</select>

16
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java

@ -75,13 +75,23 @@ public class ExtAppJwtTokenUtils {
public static void genToken() {
HashMap<String, Object> claim = new HashMap<>();
claim.put("appId", "acc4ad66c82a7b46e741364b4c62dce2");
claim.put("customerId", "b09527201c4409e19d1dbc5e3c3429a1");
//市北
//String secret = "612d304095c50369c3ef06e490f05779eeb8f19ff16566c73aeafafc5fa01970";
//String appId = "acc4ad66c82a7b46e741364b4c62dce2";
// String customrId = "b09527201c4409e19d1dbc5e3c3429a1";
//孔村
String secret = "657cd46d385a4c2ba6d9355aee24654ac3951deab7e6436e91201561b94969b5";
String appId = "5efcfb775125d656f39583b8110a3d7d";
String customrId = "2fe0065f70ca0e23ce4c26fca5f1d933";
claim.put("customerId", customrId);
claim.put("appId", appId);
claim.put("customerId", customrId);
long ts = System.currentTimeMillis() - 1000 * 60 * 4;
System.out.println("时间戳:" + ts);
claim.put("ts", ts);
String abc = new ExtAppJwtTokenUtils().createToken(claim, "612d304095c50369c3ef06e490f05779eeb8f19ff16566c73aeafafc5fa01970");
String abc = new ExtAppJwtTokenUtils().createToken(claim, secret);
System.out.println(abc);
}

1
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppMD5AuthProcessor.java

@ -15,6 +15,7 @@ public class ExtAppMD5AuthProcessor extends ExtAppAuthProcessor {
private static Logger logger = LoggerFactory.getLogger(ExtAppMD5AuthProcessor.class);
@Override
public ExternalAppAuthResultDTO auth(String appId, String token, Long ts) {
if (ts == null) {
return fillAuthResult(false, "需要传入时间戳参数", null);

Loading…
Cancel
Save