Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
zxc 5 years ago
parent
commit
ff2d947c90
  1. 44
      epmet-auth/pom.xml
  2. 11
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  3. 6
      epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java
  4. 42
      epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java
  5. 5
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  6. 28
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  7. 17
      epmet-auth/src/main/resources/bootstrap.yml
  8. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java
  9. 10
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java
  10. 64
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  11. 7
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
  12. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
  13. 25
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java
  14. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
  15. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  16. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  17. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
  18. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  19. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  20. 50
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  21. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
  22. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml
  23. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

44
epmet-auth/pom.xml

@ -200,9 +200,15 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--第三方平台,酒城e通--> <!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain> <thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey> <thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret> <thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -249,9 +255,15 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--第三方平台,酒城e通--> <!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain> <thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey> <thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret> <thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -293,9 +305,15 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--第三方平台,酒城e通--> <!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain> <thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey> <thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret> <thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties> </properties>
</profile> </profile>
@ -341,9 +359,11 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--第三方平台,酒城e通--> <!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.domain> <thirdplat.jcet.c.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.c.domain>
<thirdplat.jcet.appkey>2cy0a9lA</thirdplat.jcet.appkey> <thirdplat.jcet.c.appkey>2cy0a9lA</thirdplat.jcet.c.appkey>
<thirdplat.jcet.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.appsecret> <thirdplat.jcet.c.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.c.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

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

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.SsoEnteOrgFormDTO; import com.epmet.dto.form.SsoEnteOrgFormDTO;
import com.epmet.dto.form.SsoLoginFormDTO; import com.epmet.dto.form.SsoLoginFormDTO;
import com.epmet.dto.form.SsoWorkLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO; import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
@ -37,9 +38,9 @@ public class SsoController {
* @date 2021/1/18 下午4:59 * @date 2021/1/18 下午4:59
*/ */
@PostMapping("resi/login") @PostMapping("resi/login")
public Result<SsoLoginResultDTO> ssoLogin(@RequestBody SsoLoginFormDTO formDTO) { public Result<SsoLoginResultDTO> ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(formDTO)); return new Result<SsoLoginResultDTO>().ok(ssoService.ssoResiLogin(formDTO));
} }
/** /**
@ -58,7 +59,7 @@ public class SsoController {
public Result<ThirdPlatUserInfo> testssoLogin() { public Result<ThirdPlatUserInfo> testssoLogin() {
ThirdPlatUserInfo userInfoByTicket = null; ThirdPlatUserInfo userInfoByTicket = null;
try { try {
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -71,8 +72,8 @@ public class SsoController {
* @Description 1ticket自动登录获取内部token * @Description 1ticket自动登录获取内部token
**/ **/
@PostMapping("work/login") @PostMapping("work/login")
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){ public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoWorkLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); ValidatorUtils.validateEntity(formDTO, SsoWorkLoginFormDTO.SsoLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO)); return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO));
} }

6
epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java

@ -15,10 +15,10 @@ public class SsoEnteOrgFormDTO implements Serializable {
public interface AddUserInternalGroup {} public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {} public interface AddUserShowGroup extends CustomerClientShowGroup {}
/** /**
* wxCode * sso票据有效期为300秒
*/ */
@NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class}) @NotBlank(message = "ssotoken不能为空",groups = SsoWorkLoginFormDTO.SsoLoginForm.class)
private String ticket; private String token;
/** /**
* 手机号 * 手机号

42
epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:43
*/
@Data
public class SsoWorkLoginFormDTO implements Serializable {
private static final long serialVersionUID = -6543952487970013031L;
public interface SsoLoginForm{}
/**
* sso票据有效期为300秒
*/
@NotBlank(message = "ssotoken不能为空",groups = SsoLoginForm.class)
private String token;
/**
* 三方平台应用AppId
*/
@NotBlank(message = "三方平台应用AppId不能为空",groups = SsoLoginForm.class)
private String appId;
/**
* app类型 resi居民段gov工作端
*/
@NotBlank(message = "app不能为空",groups = SsoLoginForm.class)
private String app;
/**
* app居民段app工作端
*/
@NotBlank(message = "client不能为空",groups = SsoLoginForm.class)
private String client;
}

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

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.dto.form.SsoEnteOrgFormDTO; import com.epmet.dto.form.SsoEnteOrgFormDTO;
import com.epmet.dto.form.SsoLoginFormDTO; import com.epmet.dto.form.SsoLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO; import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.form.SsoWorkLoginFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
@ -18,14 +19,14 @@ public interface SsoService {
* @author zxc * @author zxc
* @date 2021/1/18 下午4:59 * @date 2021/1/18 下午4:59
*/ */
SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO); SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO);
/** /**
* @param formDTO * @param formDTO
* @Author sun * @Author sun
* @Description 1ticket自动登录获取内部token * @Description 1ticket自动登录获取内部token
**/ **/
UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO); UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO);
/** /**
* @param formDTO * @param formDTO

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

@ -30,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -74,6 +75,9 @@ public class SsoServiceImpl implements SsoService {
@Autowired @Autowired
private EpmetUserFeignClient epmetUserFeignClient; private EpmetUserFeignClient epmetUserFeignClient;
@Value("${epmet.third.urlPrefix}")
private String epmetThirdUrlPrefix;
/** /**
* @Description 0入口得到token * @Description 0入口得到token
* @Param formDTO * @Param formDTO
@ -81,8 +85,9 @@ public class SsoServiceImpl implements SsoService {
* @date 2021/1/18 下午4:59 * @date 2021/1/18 下午4:59
*/ */
@Override @Override
public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) { public SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO) {
String customerId = getCustomerId(formDTO.getAppId()); String customerId = getCustomerId(formDTO.getAppId());
//String customerId = "3a4f923665a7a07701bcb311aac9a156";
String userId = ""; String userId = "";
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
@ -97,7 +102,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatUserInfo userInfo; ThirdPlatUserInfo userInfo;
try { try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); userInfo = apiService.getCUserInfoByTicket(formDTO.getTicket());
} catch (Exception e) { } catch (Exception e) {
throw new RenException(e.getMessage()); throw new RenException(e.getMessage());
} }
@ -139,7 +144,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform());
String apiService = platformEnum.getApiService(); String apiService = platformEnum.getApiService();
AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService); AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService);
thirdUser = apiServiceImpl.getUserInfoByTicket(formDTO.getThirdToken()); thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken());
} catch (RenException e) { } catch (RenException e) {
throw new RenException(e.getCode(), e.getMessage()); throw new RenException(e.getCode(), e.getMessage());
} catch (Exception e) { } catch (Exception e) {
@ -229,7 +234,7 @@ public class SsoServiceImpl implements SsoService {
*/ */
public String getCustomerId(String appId){ public String getCustomerId(String appId){
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/"; String customerMsgUrl = epmetThirdUrlPrefix + "/api/third/customermp/getcustomermsg/";
String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData(); String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData();
log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data); log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data);
JSONObject toResult = JSON.parseObject(data); JSONObject toResult = JSON.parseObject(data);
@ -255,10 +260,11 @@ public class SsoServiceImpl implements SsoService {
* @Description 1ticket自动登录获取内部token * @Description 1ticket自动登录获取内部token
**/ **/
@Override @Override
public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) { public UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO) {
//1.根据appId查询客户id //1.根据appId查询客户id
String customerId = getCustomerId(formDTO.getAppId()); String customerId = getCustomerId(formDTO.getAppId());
//String customerId = "3a4f923665a7a07701bcb311aac9a156";
//2.客户Id换取第三方apiService,根据ticket换取华为Id //2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
@ -271,7 +277,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatUserInfo userInfo; ThirdPlatUserInfo userInfo;
try { try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken());
} catch (Exception e) { } catch (Exception e) {
throw new RenException(e.getMessage()); throw new RenException(e.getMessage());
} }
@ -353,7 +359,7 @@ public class SsoServiceImpl implements SsoService {
int expire = jwtTokenProperties.getExpire(); int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto(); GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV); govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP); govTokenDto.setClient(LoginConstant.CLIENT_APP);
govTokenDto.setUserId(staffLatestAgency.getStaffId()); govTokenDto.setUserId(staffLatestAgency.getStaffId());
govTokenDto.setOpenId(userInfo.getOpenId()); govTokenDto.setOpenId(userInfo.getOpenId());
govTokenDto.setSessionKey(""); govTokenDto.setSessionKey("");
@ -479,21 +485,21 @@ public class SsoServiceImpl implements SsoService {
//2.客户Id换取第三方apiService,根据ticket换取华为Id //2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId())); Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId()));
if (!apiServiceResult.success()) { if (!apiServiceResult.success()) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
} }
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) { if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
} }
ThirdPlatUserInfo userInfo; ThirdPlatUserInfo userInfo;
try { try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken());
} catch (Exception e) { } catch (Exception e) {
throw new RenException(e.getMessage()); throw new RenException(e.getMessage());
} }
if (null == userInfo){ if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); "【SSO enterOrg】调用第三方平台查询用户信息失败,用户信息为空");
} }
//3、记录staff_wechat,并记录用户激活状态,激活时间 //3、记录staff_wechat,并记录用户激活状态,激活时间

17
epmet-auth/src/main/resources/bootstrap.yml

@ -136,12 +136,21 @@ shutdown:
# 调用第三方平台相关参数 # 调用第三方平台相关参数
thirdplat: thirdplat:
jcet: jcetCend:
domain: @thirdplat.jcet.domain@ domain: @thirdplat.jcet.c.domain@
appkey: @thirdplat.jcet.appkey@ appkey: @thirdplat.jcet.c.appkey@
appsecret: @thirdplat.jcet.appsecret@ appsecret: @thirdplat.jcet.c.appsecret@
jcetGend:
domain: @thirdplat.jcet.g.domain@
appkey: @thirdplat.jcet.g.appkey@
appsecret: @thirdplat.jcet.g.appsecret@
pyld: pyld:
domain: https://epmet-ext9.elinkservice.cn/platform domain: https://epmet-ext9.elinkservice.cn/platform
appId: 7a5aec009ba4eba8e254ee64fe3775e1 appId: 7a5aec009ba4eba8e254ee64fe3775e1
appKey: 14faef9af508d1c253b720ea5a43f9de appKey: 14faef9af508d1c253b720ea5a43f9de
appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595 appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595
epmet:
# third服务的相关配置
third:
urlPrefix: @epmet.third.urlprefix@

2
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java

@ -20,7 +20,7 @@ public class DemoApp {
//ssoToken.setSsoToken("wxz"); //ssoToken.setSsoToken("wxz");
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket("wxz"); ssoTicket.setSsoTicket("ssoTicket-jGOAW66udmRtUWBKgs3q7k1w7prGxd5I");
int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length; int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length;

10
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java

@ -19,7 +19,15 @@ public abstract class AbstractApiService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public abstract ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws Exception; public abstract ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception;
/**
* G端用户token获取用户信息
* @param token
* @return
* @throws Exception
*/
public abstract ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception;
/** /**
* @Description 解析请求结果 * @Description 解析请求结果

64
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java

@ -5,7 +5,8 @@ import com.epmet.commons.thirdplat.apiservice.AbstractApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.constants.JcetConstants; import com.epmet.commons.thirdplat.constants.JcetConstants;
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO; import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO;
import com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO; import com.epmet.commons.thirdplat.dto.result.jcet.JcetCUserInfoResultDTO;
import com.epmet.commons.thirdplat.dto.result.jcet.JcetGUserInfoResultDTO;
import com.epmet.commons.thirdplat.encrypt.SignUtils; import com.epmet.commons.thirdplat.encrypt.SignUtils;
import com.epmet.commons.thirdplat.properties.JcetThirdplatProps; import com.epmet.commons.thirdplat.properties.JcetThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps; import com.epmet.commons.thirdplat.properties.ThirdplatProps;
@ -16,20 +17,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Service
public class JcetApiService extends AbstractApiService { public class JcetApiService extends AbstractApiService {
Logger logger = LoggerFactory.getLogger(getClass()); Logger logger = LoggerFactory.getLogger(getClass());
private JcetThirdplatProps jcetThirdplatProps; private JcetThirdplatProps jcetThirdplatCendProps;
private JcetThirdplatProps jcetThirdplatGendProps;
public JcetApiService(ThirdplatProps props) { public JcetApiService(ThirdplatProps props) {
this.thirdplatProps = props; this.thirdplatProps = props;
jcetThirdplatProps = props.getJcet(); jcetThirdplatCendProps = props.getJcetCend();
jcetThirdplatGendProps = props.getJcetGend();
} }
/** /**
@ -38,8 +39,7 @@ public class JcetApiService extends AbstractApiService {
* @author wxz * @author wxz
* @date 2021.01.19 10:26 * @date 2021.01.19 10:26
*/ */
@Override public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
@ -47,12 +47,12 @@ public class JcetApiService extends AbstractApiService {
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket(ticket); ssoTicket.setSsoTicket(ticket);
String domain = jcetThirdplatProps.getDomain(); String domain = jcetThirdplatCendProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendPost( Result<String> result = HttpClientManager.getInstance().sendPost(
domain.concat(JcetConstants.URL_GET_USER_BY_TICKET), domain.concat(JcetConstants.URL_GET_USER_BY_TICKET),
domain.startsWith("https://"), domain.startsWith("https://"),
JSON.toJSONString(ssoTicket), JSON.toJSONString(ssoTicket),
getHeaders(ssoTicket)); getHeaders(JSON.toJSONString(ssoTicket).getBytes("utf-8").length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret()));
try { try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
@ -61,7 +61,7 @@ public class JcetApiService extends AbstractApiService {
} }
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class); JcetCUserInfoResultDTO resultDTO = parseResult(result, JcetCUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setOpenId(resultDTO.getId()); userInfo.setOpenId(resultDTO.getId());
@ -70,6 +70,38 @@ public class JcetApiService extends AbstractApiService {
return userInfo; return userInfo;
} }
@Override
public ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception {
logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口入参 ticket:{}", token);
HashMap<String, Object> params = new HashMap<>();
params.put("ssoToken",token);
String domain = jcetThirdplatGendProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendGet(
domain.concat(JcetConstants.URL_GET_USER_BY_TOKEN),
domain.startsWith("https://"),
params,
getHeaders(0, jcetThirdplatGendProps.getAppkey(), jcetThirdplatGendProps.getAppsecret()));
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
} catch (Exception e) {
//e.printStackTrace();
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetGUserInfoResultDTO resultDTO = parseResult(result, JcetGUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setOpenId(resultDTO.getUid());
userInfo.setName(resultDTO.getName());
userInfo.setMobile(resultDTO.getMobile());
return userInfo;
}
/** /**
* @return * @return
* @Description 通过token获取用户信息 * @Description 通过token获取用户信息
@ -98,19 +130,17 @@ public class JcetApiService extends AbstractApiService {
/** /**
* 获取请求所需要的头信息 * 获取请求所需要的头信息
* *
* @param contentObject
* @return * @return
* @throws UnsupportedEncodingException * @throws UnsupportedEncodingException
*/ */
private Map<String, Object> getHeaders(Object contentObject) throws UnsupportedEncodingException { private Map<String, Object> getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException {
int bodyLength = JSON.toJSONString(contentObject).getBytes(StandardCharsets.UTF_8).length;
Map<String, Object> headers = new HashMap(); Map<String, Object> headers = new HashMap();
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp)); headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, timestamp);
headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey()); headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, appKey);
String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength; String encryptContent = appKey + timestamp + bodyLength;
headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret())); headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, appSecret));
return headers; return headers;
} }

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

@ -40,6 +40,11 @@ public class PyldApiService extends AbstractApiService {
pyldThirdplatProps = props.getPyld(); pyldThirdplatProps = props.getPyld();
} }
@Override
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception {
return null;
}
/** /**
* @return * @return
* @Description 通过第三方平台ticket获取用户信息 * @Description 通过第三方平台ticket获取用户信息
@ -47,7 +52,7 @@ public class PyldApiService extends AbstractApiService {
* @date 2021.01.19 10:26 * @date 2021.01.19 10:26
*/ */
@Override @Override
public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) { public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) {
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken);

2
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java → epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java

@ -3,7 +3,7 @@ package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data; import lombok.Data;
@Data @Data
public class JcetUserInfoResultDTO { public class JcetCUserInfoResultDTO {
private String id; private String id;
/** /**
* 用户名称 * 用户名称

25
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
public class JcetGUserInfoResultDTO {
private String uid;
/**
* 手机号码
*/
private String mobile;
/**
* 姓名
*/
private String name;
/**
* 账号
*/
private String account;
/**
* 用户编码
*/
private String code;
}

11
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java

@ -6,10 +6,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data @Data
@ConfigurationProperties(prefix = "thirdplat") @ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps { public class ThirdplatProps {
/**
* 泸州 酒城e通 // C端
*/ private JcetThirdplatProps jcetCend;
private JcetThirdplatProps jcet;
// G端
private JcetThirdplatProps jcetGend;
/** /**
* 平阴联动指挥平台 * 平阴联动指挥平台
*/ */

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java

@ -349,7 +349,7 @@ public class HttpClientManager {
} }
} }
public Result<String> sendGet(String url, boolean isHttps, Map<String, Object> params, Map<String,String> headerMap) { public Result<String> sendGet(String url, boolean isHttps, Map<String, Object> params, Map<String, Object> headerMap) {
try { try {
URIBuilder builder = new URIBuilder(url); URIBuilder builder = new URIBuilder(url);
@ -364,7 +364,9 @@ public class HttpClientManager {
httpGet.setConfig(requestConfig); httpGet.setConfig(requestConfig);
if (null != headerMap){ if (null != headerMap){
headerMap.forEach((k,v) -> { headerMap.forEach((k,v) -> {
httpGet.addHeader(k,v); if (StringUtils.isNotBlank(k)) {
httpGet.addHeader(k, v == null ? null : v.toString());
}
}); });
} }
return execute(httpGet, isHttps); return execute(httpGet, isHttps);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java

@ -71,6 +71,7 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @date 2021/1/15 下午4:23 * @date 2021/1/15 下午4:23
*/ */
List<AgencyScoreDTO> selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType); List<AgencyScoreDTO> selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType);
List<AgencyScoreDTO> selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType);
/** /**
* @Description 区下级街道得分平均值 * @Description 区下级街道得分平均值
@ -91,6 +92,7 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @date 2021/1/18 上午9:09 * @date 2021/1/18 上午9:09
*/ */
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength); List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength);
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List<String> orgIds);
/** /**

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java

@ -77,6 +77,7 @@ public interface DeptScoreDao extends BaseDao<DeptScoreEntity> {
* @date 2021/1/18 上午9:31 * @date 2021/1/18 上午9:31
*/ */
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/** /**
* @return int * @return int

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -194,4 +194,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
List<ScreenProjectOrgDailyDTO> selectAgencyByCustomer(@Param("customerId")String customerId); List<ScreenProjectOrgDailyDTO> selectAgencyByCustomer(@Param("customerId")String customerId);
List<ScreenProjectOrgDailyDTO> selectAgencyByAreaCode(String areaCode); List<ScreenProjectOrgDailyDTO> selectAgencyByAreaCode(String areaCode);
/**
* @Description 根据areaCode查询下级组织
* @Param areaCode
* @author zxc
* @date 2021/3/9 上午9:41
*/
List<ScreenProjectOrgDailyDTO> selectAgencyByParentAreaCode(@Param("areaCode") String areaCode);
} }

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java

@ -23,6 +23,7 @@ import com.epmet.dto.indexcal.AgencyCalResultDTO;
import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO;
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO;
import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity;
@ -604,10 +605,11 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
} }
List<IndexInputVO> indexInputVOS = new ArrayList<>(); List<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>(); Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
//党建能力平均值 //党建能力平均值
indexDetailList.forEach(detail -> { indexDetailList.forEach(detail -> {
if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),orgInfos.stream().map(o -> o.getOrgId()).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
} else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) {
@ -629,7 +631,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
} }
} else { } else {
// 区名义发文数量 // 区名义发文数量
List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX); List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubNotSelf(monthId,form.getCustomerAreaCode(),NumConstant.SIX);
if (CollectionUtils.isEmpty(publishArticleCountList)) { if (CollectionUtils.isEmpty(publishArticleCountList)) {
log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL);
} else { } else {
@ -682,9 +684,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
} }
List<IndexInputVO> indexInputVOS = new ArrayList<>(); List<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>(); Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
detailListByParentCode.forEach(detail -> { detailListByParentCode.forEach(detail -> {
if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); // List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),orgInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()));
log.info(districtGovernAvgList.toString());
for (int i = 0; i < districtGovernAvgList.size(); i++) { for (int i = 0; i < districtGovernAvgList.size(); i++) {
if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
districtGovernAvgList.remove(districtGovernAvgList.get(i)); districtGovernAvgList.remove(districtGovernAvgList.get(i));
@ -710,7 +715,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}); });
} }
} else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){
List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSubNotSelf(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode());
for (int i = 0; i < deptScoreAvgList.size(); i++) { for (int i = 0; i < deptScoreAvgList.size(); i++) {
if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
deptScoreAvgList.remove(deptScoreAvgList.get(i)); deptScoreAvgList.remove(deptScoreAvgList.get(i));
@ -762,10 +767,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
} }
List<IndexInputVO> indexInputVOS = new ArrayList<>(); List<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>(); Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
detailListByParentCode.forEach(detail -> { detailListByParentCode.forEach(detail -> {
String indexCode = detail.getIndexCode(); String indexCode = detail.getIndexCode();
if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) {
List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); // List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),orgInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()));
for (int i = 0; i < subStreetAvgList.size(); i++) { for (int i = 0; i < subStreetAvgList.size(); i++) {
if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
subStreetAvgList.remove(subStreetAvgList.get(i)); subStreetAvgList.remove(subStreetAvgList.get(i));
@ -815,7 +822,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
String customerId = form.getCustomerId(); String customerId = form.getCustomerId();
String monthId = form.getMonthId(); String monthId = form.getMonthId();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_LEVEL); List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSubSelf(form.getCustomerAreaCode(),monthId, IndexCalConstant.DISTRICT_LEVEL);
detailListByParentCode.forEach(detail -> { detailListByParentCode.forEach(detail -> {
agencyScoreList.forEach(community -> { agencyScoreList.forEach(community -> {
if (detail.getIndexCode().equals(community.getIndexCode())) { if (detail.getIndexCode().equals(community.getIndexCode())) {

50
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

@ -142,6 +142,7 @@
WHERE WHERE
fias.del_flag = 0 fias.del_flag = 0
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND sca.AREA_CODE != #{areaCode}
AND fias.MONTH_ID = #{monthId} AND fias.MONTH_ID = #{monthId}
AND fias.data_type = #{dataType} AND fias.data_type = #{dataType}
AND fias.IS_TOTAL = "0" AND fias.IS_TOTAL = "0"
@ -159,7 +160,7 @@
fics.year_id, fics.year_id,
ROUND(AVG( fics.score ),6) AS score, ROUND(AVG( fics.score ),6) AS score,
fics.customer_id, fics.customer_id,
PARENT_AGENCY_ID AS parentId fics.PARENT_AGENCY_ID AS parentId
FROM FROM
fact_index_agency_score fics fact_index_agency_score fics
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID
@ -172,4 +173,51 @@
AND fics.DATA_TYPE = #{dataType} AND fics.DATA_TYPE = #{dataType}
GROUP BY fics.parent_agency_id GROUP BY fics.parent_agency_id
</select> </select>
<select id="selectAgencyScoreAvgByOrgIds" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fics.agency_id AS agencyId,
fics.month_id AS monthId,
fics.quarter_id AS quarterId,
fics.year_id AS yearId,
ROUND(AVG( fics.score ),6) AS score,
fics.customer_id AS customerId,
fics.PARENT_AGENCY_ID AS parentId
FROM
fact_index_agency_score fics
WHERE
fics.del_flag = '0'
AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode}
AND (
<foreach collection="orgIds" item="org" separator=" or ">
fics.agency_id = #{org}
</foreach>
)
GROUP BY AGENCY_ID
</select>
<select id="selectAgencyScoreInfoExistsSubSelf" resultType="com.epmet.dto.indexcal.AgencyScoreDTO">
SELECT
fias.CUSTOMER_ID,
fias.AGENCY_ID,
fias.MONTH_ID,
fias.QUARTER_ID,
fias.YEAR_ID,
fias.SCORE,
fias.INDEX_CODE,
fias.PARENT_AGENCY_ID
FROM
fact_index_agency_score fias
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fias.AGENCY_ID
WHERE
fias.del_flag = 0
AND sca.AREA_CODE = #{areaCode}
AND fias.MONTH_ID = #{monthId}
AND fias.IS_TOTAL = "0"
AND (fias.INDEX_CODE = "zhilinengli"
OR fias.INDEX_CODE = "dangjiannengli"
OR fias.INDEX_CODE = "fuwunengli")
</select>
</mapper> </mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml

@ -172,4 +172,25 @@
AND fidc.index_code = #{indexCode} AND fidc.index_code = #{indexCode}
GROUP BY fidc.agency_id GROUP BY fidc.agency_id
</select> </select>
<select id="selectGovernDeptScoreAvgExistsSubNotSelf" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fidc.agency_id,
fidc.month_id,
fidc.quarter_id,
fidc.year_id,
AVG( fidc.score ) AS score,
fidc.customer_id,
sca.pid AS parentId
FROM
fact_index_dept_score fidc
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fidc.AGENCY_ID
WHERE
fidc.del_flag = '0'
AND fidc.IS_TOTAL = '0'
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND sca.AREA_CODE != #{areaCode}
AND fidc.month_id = #{monthId}
AND fidc.index_code = #{indexCode}
GROUP BY fidc.agency_id
</select>
</mapper> </mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml

@ -163,8 +163,7 @@
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID
WHERE WHERE
pm.del_flag = '0' pm.del_flag = '0'
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE = #{areaCode}
AND sca.AREA_CODE != #{areaCode}
AND pm.month_id = #{monthId} AND pm.month_id = #{monthId}
</select> </select>
<select id="selectPublishArticleCountMapbyAreaCodeNotSelf" resultType="java.util.Map"> <select id="selectPublishArticleCountMapbyAreaCodeNotSelf" resultType="java.util.Map">

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -390,4 +390,18 @@
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
and sca.AREA_CODE like CONCAT(#{areaCode},'%') and sca.AREA_CODE like CONCAT(#{areaCode},'%')
</select> </select>
<!-- 根据areaCode查询下级组织 -->
<select id="selectAgencyByParentAreaCode" resultType="com.epmet.dto.screen.ScreenProjectOrgDailyDTO">
SELECT
sca.CUSTOMER_ID,
sca.AGENCY_ID AS orgId,
sca.PID,
sca.PIDS,
sca.`LEVEL` AS orgType,
sca.AREA_CODE
FROM screen_customer_agency sca
WHERE DEL_FLAG = 0
and sca.PARENT_AREA_CODE = #{areaCode}
</select>
</mapper> </mapper>

Loading…
Cancel
Save