Browse Source

【酒城e通居民登录】将yml的秘钥相关配置分成2份,c端和g端

dev_shibei_match
wxz 5 years ago
parent
commit
2ec73d7dc2
  1. 36
      epmet-auth/pom.xml
  2. 12
      epmet-auth/src/main/resources/bootstrap.yml
  3. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java
  4. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  5. 6
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java

36
epmet-auth/pom.xml

@ -200,9 +200,13 @@
</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>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -249,9 +253,13 @@
</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>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -293,9 +301,13 @@
</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>
</properties> </properties>
</profile> </profile>
@ -341,9 +353,9 @@
</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>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

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

@ -135,7 +135,11 @@ 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@

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;

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

@ -22,11 +22,13 @@ 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();
} }
/** /**
@ -43,12 +45,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(ssoTicket, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret()));
try { try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
@ -98,15 +100,15 @@ public class JcetApiService extends AbstractApiService {
* @return * @return
* @throws UnsupportedEncodingException * @throws UnsupportedEncodingException
*/ */
private Map<String, String> getHeaders(Object contentObject) throws UnsupportedEncodingException { private Map<String, String> getHeaders(Object contentObject, String appKey, String appSecret) throws UnsupportedEncodingException {
int bodyLength = JSON.toJSONString(contentObject).getBytes("utf-8").length; int bodyLength = JSON.toJSONString(contentObject).getBytes("utf-8").length;
Map<String, String> headers = new HashMap(); Map<String, String> 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, String.valueOf(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;
} }

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

@ -7,6 +7,10 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "thirdplat") @ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps { public class ThirdplatProps {
private JcetThirdplatProps jcet; // C端
private JcetThirdplatProps jcetCend;
// G端
private JcetThirdplatProps jcetGend;
} }

Loading…
Cancel
Save