chenjiahe
2021-11-09 2f5b030b8510c7cbf6ef71d6d3f4be2fbf0e3202
新增token接口
1 文件已重命名
1个文件已删除
6个文件已修改
141 ■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/Rsa.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/config/CustomParameter.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/AccountTokenController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/EmployeeLoginController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/interceptor/UserInterceptor.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/application-local.properties 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/application-prod.properties 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/resources/rsa.properties 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/Rsa.java
@@ -7,7 +7,7 @@
public class Rsa {
    public static void main(String[] args) {
       System.out.println(AesUtil.aesEncryp("a574ceedb661970cd2f057f8df05c473"));
       System.out.println(AesUtil.aesEncryp("8d6899f042059a83531c6cfed9a6b38f"));
        //配置文件数据加密
phi_platform_user/src/main/java/com/hx/phip/config/CustomParameter.java
File was renamed from phi_platform_user/src/main/java/com/hx/phip/config/RsaParameter.java
@@ -8,16 +8,19 @@
 * 企业微信和小程序配置
 */
@Component
@PropertySource(value = "classpath:rsa.properties", encoding = "UTF-8")
public class RsaParameter {
public class CustomParameter {
    /**RSA账号*/
    @Value("${rsa.appId}")
    private String appId;
    /**企业微信id*/
    /**RSA秘钥*/
    @Value("${rsa.privatekey}")
    private String privatekey;
    /**平台模式*/
    @Value("${platform.pattern}")
    private String platformPattern;
    public RsaParameter() {
    public CustomParameter() {
    }
@@ -37,4 +40,11 @@
        this.privatekey = privatekey;
    }
    public String getPlatformPattern() {
        return platformPattern;
    }
    public void setPlatformPattern(String platformPattern) {
        this.platformPattern = platformPattern;
    }
}
phi_platform_user/src/main/java/com/hx/phip/controller/AccountTokenController.java
@@ -5,6 +5,7 @@
import com.hx.mp.util.CorpMpUtil;
import com.hx.phip.common.wx.corp.WeiXinCorpMpUtil;
import com.hx.phip.common.wx.corp.WeiXinMpUtil;
import com.hx.phip.config.CustomParameter;
import com.hx.phip.entity.AccountToken;
import com.hx.phip.model.ApplyParameter;
import com.hx.phip.model.SysParameter;
@@ -13,8 +14,7 @@
import com.hx.util.DateUtil;
import com.hx.util.HttpServletRequestUtil;
import com.hx.util.StringUtils;
import com.hx.util.corp.entity.WeiXinInfo;
import com.hx.util.rsa.RSAUtil;
import com.platform.constants.PlatformPattern;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import com.platform.resultTool.PlatformResult;
@@ -24,7 +24,7 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Calendar;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -38,6 +38,9 @@
@RestController
@RequestMapping("/account_token")
public class AccountTokenController extends BaseController {
    @Resource
    private CustomParameter customParameter;
    /**获取企业通讯录token*/
    @RequestMapping(value = "/communi/get_token",method = RequestMethod.POST)
@@ -63,6 +66,10 @@
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"corpId is required");
        }
        if(!PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"成产环境获取TOKEN");
        }
        //获取应用数据
        ApplyParameter applyParameter = ApplyParameterTool.getCommunition(accountToken.getCorpId(),commonService);
        if(applyParameter == null){
@@ -73,7 +80,6 @@
        if(sysParameter == null){
            throw new PlatTipsException(PlatformCode.ERROR_SYSTEM,"服务错误"+ SystemCode.ERROR_GET_CORP_TOKEN);
        }
        Map<String,Object> data = new HashMap<>();
        data.put("access_token",sysParameter.getParamValue());
@@ -106,6 +112,10 @@
        if (StringUtils.isEmpty(accountToken.getCorpId())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"corpId is required");
        }
        if(!PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"成产环境获取TOKEN");
        }
        //获取应用数据
@@ -155,6 +165,10 @@
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"mpId is required");
        }
        if(!PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"成产环境获取TOKEN");
        }
        //获取应用数据
        ApplyParameter applyParameter = ApplyParameterTool.getApplyParameter(accountToken.getCorpId(),accountToken.getMpId(),commonService);
        if(applyParameter == null){
@@ -198,6 +212,10 @@
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"mpId is required");
        }
        if(!PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"成产环境获取TOKEN");
        }
        //获取应用数据
        ApplyParameter applyParameter = ApplyParameterTool.getMpParameter(accountToken.getMpId(),commonService);
        if(applyParameter == null){
phi_platform_user/src/main/java/com/hx/phip/controller/EmployeeLoginController.java
@@ -333,14 +333,15 @@
        }
        //获取openId
        net.sf.json.JSONObject oauthObj = MPWeixinBaseUtil.getJscode2session(applyParameter.getMpAppId(),applyParameter.getMpSecretKey(),employeeQrLogin.getCode());
        net.sf.json.JSONObject oauthObj = MPWeixinBaseUtil.getJscode2session(applyParameter.getMpAppId(),AesUtil.aesDecryp(applyParameter.getMpSecretKey()),employeeQrLogin.getCode());
        String errcode = oauthObj.optString("errcode", "");// 有错误的时候才有
        String openId = oauthObj.optString("openid", "");
        //String session_key = oauthObj.optString("session_key");
        //String unionid = oauthObj.optString("unionid", "");
        if(!"0".equals(errcode)){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"解析code获取用户信息失");
        if(StringUtils.noNull(errcode)){
            logger.error("企业员工-网页登录(普通小程序):"+oauthObj.toString());
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"解析code获取用户信息失败");
        }
        //获取token
phi_platform_user/src/main/java/com/hx/phip/interceptor/UserInterceptor.java
@@ -1,7 +1,7 @@
package com.hx.phip.interceptor;
import com.hx.common.BaseController;
import com.hx.phip.config.RsaParameter;
import com.hx.phip.config.CustomParameter;
import com.platform.resultTool.PlatformCode;
import com.platform.resultTool.PlatformResult;
import com.platform.verification.VerificationTool;
@@ -29,7 +29,7 @@
    private static Logger logger = LoggerFactory.getLogger(UserInterceptor.class.getName());
    @Resource
    private RsaParameter rsaParameter;
    private CustomParameter rsaParameter;
    /**设置拦截的位置
     * 拦截要校验的包
phi_platform_user/src/main/resources/application-local.properties
@@ -77,3 +77,31 @@
spring.redis.timeout=5000
# set database
spring.redis.database= 9
platform.pattern = test
#appId
rsa.appId = 99sdfa5454a4f5asd4f55saf4
#\u5C0F\u7A0B\u5E8F\u5728\u4F01\u4E1A\u5FAE\u4FE1\u7684\u5E94\u7528\u79D8\u94A5\uFF08HIS\u52A9\u624B\u5C0F\u7A0B\u5E8F\uFF09
rsa.privatekey = MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDNxEbL2XJWJykr6GOtOdkkdauW\
OL3xCw+4WXtvIZQ5ghRxxWm9i5jKHHrZ0gZNxuLpTEvnRIRqaU3ntWenlT7xkgQlgzW01Te7pjdG\
tH+sEY2mMFWnpM/IcrsJI5lBvrkQoSDH/Zu0UZNhDQHRaZ6XrKXGWal68coll8Ul8fJ8HcCpaeqJ\
+Q/W0cAH60WuF3Ly5BcR9eshqK+n8i7ssUU535HSHKCeOJrYSy2fRv1lEOsWDpTTmXfEGbwzHKsB\
4sScBzuvVXvFECsQVyXGaJzL9M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iEpFoCWGqyYoCZqwdanlKy1bhSPd8K5nIDj0uv3LPPuXj3BkGwKpV7GA\
ZyDJAoGBAJJuG2gOJKOanKnRU190RzMxzunYbgVJN/sUofvGMfyJGg3kYT9X+xm7It4GGGOV6bYU\
9n3HwKT5RmkboaoMQesefCQ/qz+wgbfoivudzzV3o41HgH3yD5V98g45SmxCgxndxswjR0Yiia5q\
0dEpK65zWEXTvLLpeyhiXZmtiVCA
phi_platform_user/src/main/resources/application-prod.properties
@@ -63,7 +63,6 @@
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
#redis\uFFFD\uFFFD\uFFFD\uFFFD
# Redis\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05B7
spring.redis.host=r-bp16fgy4t2giny01ovpd.redis.rds.aliyuncs.com
@@ -72,4 +71,32 @@
# Redis\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uB8E8\u012C\uFFFD\uFFFD\u03AA\uFFFD\u0563\uFFFD
spring.redis.password=ENC(1rHggH3Vt6IgY2rAuHyBZb4aabOCAoOroQM5eYoT6so=)
# \uFFFD\uFFFD\uFFFD\u04F3\uFFFD\u02B1\u02B1\uFFFD\u48E8\uFFFD\uFFFD\uFFFD\uB8E9
spring.redis.timeout=1000
spring.redis.timeout=1000
platform.pattern = prod
#appId
rsa.appId = 99sdfa5454a4f5asd4f55saf4
#\u5C0F\u7A0B\u5E8F\u5728\u4F01\u4E1A\u5FAE\u4FE1\u7684\u5E94\u7528\u79D8\u94A5\uFF08HIS\u52A9\u624B\u5C0F\u7A0B\u5E8F\uFF09
rsa.privatekey = MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDNxEbL2XJWJykr6GOtOdkkdauW\
OL3xCw+4WXtvIZQ5ghRxxWm9i5jKHHrZ0gZNxuLpTEvnRIRqaU3ntWenlT7xkgQlgzW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