diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 38fe7a144b..f0932d4bb4 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -200,9 +200,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -249,9 +255,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -293,9 +305,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -341,9 +359,11 @@ - https://jcytc.lzjczl.com:21009 - 2cy0a9lA - 6hU3PQgxLcXr27SE + https://jcytc.lzjczl.com:21009 + 2cy0a9lA + 6hU3PQgxLcXr27SE + + https://epmet-cloud.elinkservice.cn diff --git a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java b/epmet-auth/src/main/java/com/epmet/controller/SsoController.java index 6413ffb82b..6f19f29e62 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java +++ b/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.dto.form.SsoEnteOrgFormDTO; import com.epmet.dto.form.SsoLoginFormDTO; +import com.epmet.dto.form.SsoWorkLoginFormDTO; import com.epmet.dto.form.SsoLoginOperFormDTO; import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -37,9 +38,9 @@ public class SsoController { * @date 2021/1/18 下午4:59 */ @PostMapping("resi/login") - public Result ssoLogin(@RequestBody SsoLoginFormDTO formDTO) { + public Result ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); - return new Result().ok(ssoService.ssoLogin(formDTO)); + return new Result().ok(ssoService.ssoResiLogin(formDTO)); } /** @@ -58,7 +59,7 @@ public class SsoController { public Result testssoLogin() { ThirdPlatUserInfo userInfoByTicket = null; try { - userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); + userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); } catch (Exception e) { e.printStackTrace(); } @@ -71,8 +72,8 @@ public class SsoController { * @Description 1、ticket自动登录获取内部token **/ @PostMapping("work/login") - public Result ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); + public Result ssoWorkLogin(@RequestBody SsoWorkLoginFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, SsoWorkLoginFormDTO.SsoLoginForm.class); return new Result().ok(ssoService.ssoWorkLogin(formDTO)); } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java index 4706061267..d74deaf828 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java +++ b/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 AddUserShowGroup extends CustomerClientShowGroup {} /** - * wxCode + * sso票据,有效期为300秒 */ - @NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class}) - private String ticket; + @NotBlank(message = "ssotoken不能为空",groups = SsoWorkLoginFormDTO.SsoLoginForm.class) + private String token; /** * 手机号 diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java new file mode 100644 index 0000000000..32ff9aa00b --- /dev/null +++ b/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; +} diff --git a/epmet-auth/src/main/java/com/epmet/service/SsoService.java b/epmet-auth/src/main/java/com/epmet/service/SsoService.java index 4514230228..4cc9c93ba7 100644 --- a/epmet-auth/src/main/java/com/epmet/service/SsoService.java +++ b/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.SsoLoginFormDTO; import com.epmet.dto.form.SsoLoginOperFormDTO; +import com.epmet.dto.form.SsoWorkLoginFormDTO; import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -18,14 +19,14 @@ public interface SsoService { * @author zxc * @date 2021/1/18 下午4:59 */ - SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO); + SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO); /** * @param formDTO * @Author sun * @Description 1、ticket自动登录获取内部token **/ - UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO); + UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO); /** * @param formDTO diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index f15b892217..3f77b56af1 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -74,6 +75,9 @@ public class SsoServiceImpl implements SsoService { @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Value("${epmet.third.urlPrefix}") + private String epmetThirdUrlPrefix; + /** * @Description 0、入口:得到token * @Param formDTO @@ -81,8 +85,9 @@ public class SsoServiceImpl implements SsoService { * @date 2021/1/18 下午4:59 */ @Override - public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) { + public SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO) { String customerId = getCustomerId(formDTO.getAppId()); + //String customerId = "3a4f923665a7a07701bcb311aac9a156"; String userId = ""; Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); @@ -97,7 +102,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getCUserInfoByTicket(formDTO.getTicket()); } catch (Exception e) { throw new RenException(e.getMessage()); } @@ -139,7 +144,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); String apiService = platformEnum.getApiService(); AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService); - thirdUser = apiServiceImpl.getUserInfoByTicket(formDTO.getThirdToken()); + thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken()); } catch (RenException e) { throw new RenException(e.getCode(), e.getMessage()); } catch (Exception e) { @@ -229,7 +234,7 @@ public class SsoServiceImpl implements SsoService { */ public String getCustomerId(String appId){ 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(); log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data); JSONObject toResult = JSON.parseObject(data); @@ -255,10 +260,11 @@ public class SsoServiceImpl implements SsoService { * @Description 1、ticket自动登录获取内部token **/ @Override - public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) { + public UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO) { //1.根据appId查询客户id String customerId = getCustomerId(formDTO.getAppId()); + //String customerId = "3a4f923665a7a07701bcb311aac9a156"; //2.客户Id换取第三方apiService,根据ticket换取华为Id Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); @@ -271,7 +277,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken()); } catch (Exception e) { throw new RenException(e.getMessage()); } @@ -353,7 +359,7 @@ public class SsoServiceImpl implements SsoService { int expire = jwtTokenProperties.getExpire(); GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); - govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setClient(LoginConstant.CLIENT_APP); govTokenDto.setUserId(staffLatestAgency.getStaffId()); govTokenDto.setOpenId(userInfo.getOpenId()); govTokenDto.setSessionKey(""); @@ -479,21 +485,21 @@ public class SsoServiceImpl implements SsoService { //2.客户Id换取第三方apiService,根据ticket换取华为Id Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId())); 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())) { - throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); + throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); } ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken()); } catch (Exception e) { throw new RenException(e.getMessage()); } if (null == userInfo){ throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), - "【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); + "【SSO enterOrg】调用第三方平台查询用户信息失败,用户信息为空"); } //3、记录staff_wechat,并记录用户激活状态,激活时间 diff --git a/epmet-auth/src/main/resources/bootstrap.yml b/epmet-auth/src/main/resources/bootstrap.yml index 25b9a31702..e35f4a83b8 100644 --- a/epmet-auth/src/main/resources/bootstrap.yml +++ b/epmet-auth/src/main/resources/bootstrap.yml @@ -136,12 +136,21 @@ shutdown: # 调用第三方平台相关参数 thirdplat: - jcet: - domain: @thirdplat.jcet.domain@ - appkey: @thirdplat.jcet.appkey@ - appsecret: @thirdplat.jcet.appsecret@ + jcetCend: + domain: @thirdplat.jcet.c.domain@ + appkey: @thirdplat.jcet.c.appkey@ + appsecret: @thirdplat.jcet.c.appsecret@ + jcetGend: + domain: @thirdplat.jcet.g.domain@ + appkey: @thirdplat.jcet.g.appkey@ + appsecret: @thirdplat.jcet.g.appsecret@ pyld: domain: https://epmet-ext9.elinkservice.cn/platform appId: 7a5aec009ba4eba8e254ee64fe3775e1 appKey: 14faef9af508d1c253b720ea5a43f9de appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595 + +epmet: +# third服务的相关配置 + third: + urlPrefix: @epmet.third.urlprefix@ \ No newline at end of file diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java index 43b27e385b..1b874efc82 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java @@ -20,7 +20,7 @@ public class DemoApp { //ssoToken.setSsoToken("wxz"); SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); - ssoTicket.setSsoTicket("wxz"); + ssoTicket.setSsoTicket("ssoTicket-jGOAW66udmRtUWBKgs3q7k1w7prGxd5I"); int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length; diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java index 150d99b2da..aa59cf52ef 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java @@ -19,7 +19,15 @@ public abstract class AbstractApiService { * @return * @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 解析请求结果 diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java index 7dd811425d..f499156947 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java +++ b/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.constants.JcetConstants; 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.properties.JcetThirdplatProps; import com.epmet.commons.thirdplat.properties.ThirdplatProps; @@ -16,20 +17,20 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -@Service public class JcetApiService extends AbstractApiService { Logger logger = LoggerFactory.getLogger(getClass()); - private JcetThirdplatProps jcetThirdplatProps; + private JcetThirdplatProps jcetThirdplatCendProps; + private JcetThirdplatProps jcetThirdplatGendProps; public JcetApiService(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 * @date 2021.01.19 10:26 */ - @Override - public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException { + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException { logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket); @@ -47,12 +47,12 @@ public class JcetApiService extends AbstractApiService { SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); ssoTicket.setSsoTicket(ticket); - String domain = jcetThirdplatProps.getDomain(); + String domain = jcetThirdplatCendProps.getDomain(); Result result = HttpClientManager.getInstance().sendPost( domain.concat(JcetConstants.URL_GET_USER_BY_TICKET), domain.startsWith("https://"), JSON.toJSONString(ssoTicket), - getHeaders(ssoTicket)); + getHeaders(JSON.toJSONString(ssoTicket).getBytes("utf-8").length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret())); try { logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); @@ -61,7 +61,7 @@ public class JcetApiService extends AbstractApiService { } logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); - JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class); + JcetCUserInfoResultDTO resultDTO = parseResult(result, JcetCUserInfoResultDTO.class); ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); userInfo.setOpenId(resultDTO.getId()); @@ -70,6 +70,38 @@ public class JcetApiService extends AbstractApiService { return userInfo; } + @Override + public ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception { + + logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口开始>>>>>>>>>>>>"); + logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口入参 ticket:{}", token); + + HashMap params = new HashMap<>(); + params.put("ssoToken",token); + + String domain = jcetThirdplatGendProps.getDomain(); + Result 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 * @Description 通过token获取用户信息 @@ -98,19 +130,17 @@ public class JcetApiService extends AbstractApiService { /** * 获取请求所需要的头信息 * - * @param contentObject * @return * @throws UnsupportedEncodingException */ - private Map getHeaders(Object contentObject) throws UnsupportedEncodingException { - int bodyLength = JSON.toJSONString(contentObject).getBytes(StandardCharsets.UTF_8).length; + private Map getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException { Map headers = new HashMap(); long timestamp = System.currentTimeMillis(); - headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp)); - headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey()); - String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength; - headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret())); + headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, timestamp); + headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, appKey); + String encryptContent = appKey + timestamp + bodyLength; + headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, appSecret)); return headers; } diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java index 958fd8b1bb..b5307c2951 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java +++ b/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(); } + @Override + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception { + return null; + } + /** * @return * @Description 通过第三方平台ticket获取用户信息 @@ -47,7 +52,7 @@ public class PyldApiService extends AbstractApiService { * @date 2021.01.19 10:26 */ @Override - public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) { + public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) { logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java similarity index 91% rename from epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java rename to epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java index 8c025e5b9b..765126025d 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java +++ b/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; @Data -public class JcetUserInfoResultDTO { +public class JcetCUserInfoResultDTO { private String id; /** * 用户名称 diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java new file mode 100644 index 0000000000..24f2faf27c --- /dev/null +++ b/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; +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java index 4c9b46b9e0..441d1f0839 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java +++ b/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 @ConfigurationProperties(prefix = "thirdplat") public class ThirdplatProps { - /** - * 泸州 酒城e通 - */ - private JcetThirdplatProps jcet; + + // C端 + private JcetThirdplatProps jcetCend; + + // G端 + private JcetThirdplatProps jcetGend; + /** * 平阴联动指挥平台 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index fe48e711e7..2481664829 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -349,7 +349,7 @@ public class HttpClientManager { } } - public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) { + public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) { try { URIBuilder builder = new URIBuilder(url); @@ -364,7 +364,9 @@ public class HttpClientManager { httpGet.setConfig(requestConfig); if (null != headerMap){ headerMap.forEach((k,v) -> { - httpGet.addHeader(k,v); + if (StringUtils.isNotBlank(k)) { + httpGet.addHeader(k, v == null ? null : v.toString()); + } }); } return execute(httpGet, isHttps); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index 5e0d0585be..bc00d9e97b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/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 { * @date 2021/1/15 下午4:23 */ List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType); + List selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType); /** * @Description 区下级街道得分平均值 @@ -91,6 +92,7 @@ public interface AgencyScoreDao extends BaseDao { * @date 2021/1/18 上午9:09 */ List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength); + List selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List orgIds); /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java index a22317c371..cc35dbb875 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java +++ b/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 { * @date 2021/1/18 上午9:31 */ List selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); + List selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index f61e21f2ad..44eeb11fa6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/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 selectAgencyByCustomer(@Param("customerId")String customerId); List selectAgencyByAreaCode(String areaCode); + + /** + * @Description 根据areaCode查询下级组织 + * @Param areaCode + * @author zxc + * @date 2021/3/9 上午9:41 + */ + List selectAgencyByParentAreaCode(@Param("areaCode") String areaCode); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 592c114fd4..5ea39f0d4c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/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.CalculateCommonFormDTO; import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; +import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; @@ -604,10 +605,11 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); //党建能力平均值 indexDetailList.forEach(detail -> { if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { - List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),orgInfos.stream().map(o -> o.getOrgId()).collect(Collectors.toList())); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { @@ -629,7 +631,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } else { // 区名义发文数量 - List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX); + List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubNotSelf(monthId,form.getCustomerAreaCode(),NumConstant.SIX); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -682,9 +684,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { - List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); +// List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List 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++) { if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ 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())){ - List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSubNotSelf(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); for (int i = 0; i < deptScoreAvgList.size(); i++) { if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ deptScoreAvgList.remove(deptScoreAvgList.get(i)); @@ -762,10 +767,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); detailListByParentCode.forEach(detail -> { String indexCode = detail.getIndexCode(); if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { - List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); +// List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List 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++) { if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ subStreetAvgList.remove(subStreetAvgList.get(i)); @@ -815,7 +822,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict String customerId = form.getCustomerId(); String monthId = form.getMonthId(); List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_LEVEL); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSubSelf(form.getCustomerAreaCode(),monthId, IndexCalConstant.DISTRICT_LEVEL); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index 6ba1ac05cf..c082758802 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -142,6 +142,7 @@ WHERE fias.del_flag = 0 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.AREA_CODE != #{areaCode} AND fias.MONTH_ID = #{monthId} AND fias.data_type = #{dataType} AND fias.IS_TOTAL = "0" @@ -159,7 +160,7 @@ fics.year_id, ROUND(AVG( fics.score ),6) AS score, fics.customer_id, - PARENT_AGENCY_ID AS parentId + fics.PARENT_AGENCY_ID AS parentId FROM fact_index_agency_score fics LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID @@ -172,4 +173,51 @@ AND fics.DATA_TYPE = #{dataType} GROUP BY fics.parent_agency_id + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml index d5f2e9b8a0..f0dc795c8e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml @@ -172,4 +172,25 @@ AND fidc.index_code = #{indexCode} GROUP BY fidc.agency_id + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 9ce69d1128..c0f9e6e261 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/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 WHERE 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} + + +