|
@@ -1,13 +1,13 @@
|
|
|
package com.miaxis.test;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.miaxis.TwzdApplication;
|
|
|
-import com.miaxis.common.constant.Constants;
|
|
|
-import com.miaxis.common.utils.StringUtils;
|
|
|
+import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
|
import com.miaxis.question.mapper.QuestionInfoMapper;
|
|
|
import com.miaxis.question.vo.QuestionInfoExcelTypeVo;
|
|
|
import com.miaxis.question.vo.QuestionInfoExcelVo;
|
|
|
+import com.miaxis.user.service.IUserInfoService;
|
|
|
import com.miaxis.wx.service.IWxForeverCodeService;
|
|
|
import com.miaxis.wx.service.impl.WxGzhServiceImpl;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
@@ -23,7 +23,6 @@ import javax.annotation.Resource;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@ActiveProfiles("prod")
|
|
|
@SpringBootTest(classes = TwzdApplication.class)
|
|
@@ -47,44 +46,29 @@ public class NormalTest {
|
|
|
@Resource
|
|
|
RedisTemplate redisTemplate;
|
|
|
|
|
|
+ @Resource
|
|
|
+ IUserInfoService userInfoService;
|
|
|
+
|
|
|
|
|
|
@Value("${app.appid}")
|
|
|
private String appid;
|
|
|
|
|
|
@Value("${app.appSecret}")
|
|
|
private String secret;
|
|
|
-
|
|
|
- public String getGzhToken() {
|
|
|
- String token = "";
|
|
|
- Integer expiresIn;
|
|
|
- if (redisTemplate.hasKey(Constants.GZH_MESSAGE_TOKEN)){
|
|
|
- token = (String)redisTemplate.opsForValue().get(Constants.GZH_MESSAGE_TOKEN);
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(token)){
|
|
|
- String result = wxSendService.getAccessToken("client_credential",appid,secret);
|
|
|
- JSONObject json = JSONObject.parseObject(result);
|
|
|
- token = json.getString("access_token");
|
|
|
- expiresIn = json.getIntValue("expires_in");
|
|
|
- if (expiresIn <= 0){
|
|
|
- expiresIn = 7000;
|
|
|
- }
|
|
|
-
|
|
|
- redisTemplate.opsForValue().set(Constants.GZH_MESSAGE_TOKEN,token,expiresIn, TimeUnit.SECONDS);
|
|
|
+ @Test
|
|
|
+ public void getGzhToken() {
|
|
|
+ //查询该用户的销售类型
|
|
|
+ String fromUserName ="ovKTX50v7OAEPI_ERofpUvrNQCJU";
|
|
|
+ UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("openid", fromUserName));
|
|
|
+ //查询该用户的上级
|
|
|
+ UserInfo upUserInfo = userInfoService.getUpUserInfo(fromUserName);
|
|
|
+ //当用户销售类型为 普通用户(含驾校分成) 并且他的父级不是代理商(含驾校分成)时,则需要填写驾校信息,且未填写驾校信息时
|
|
|
+ if (userInfo.getSaleType() ==1 && upUserInfo.getSaleType()!=3 && userInfo.getSchoolName() == null ){
|
|
|
+ System.out.println("进来了");
|
|
|
}
|
|
|
-
|
|
|
- return token;
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void test11() throws Exception {
|
|
|
- //获取用户信息
|
|
|
- String userInfoResult = wxSendService.userInfo(this.getGzhToken(), "ovKTX5-FKLF6_sgTtCIXpG_lz3PY", "zh_CN");
|
|
|
- JSONObject jsonObj = JSONObject.parseObject(userInfoResult);
|
|
|
- System.out.println(jsonObj);
|
|
|
-// String content = "k3vvps";
|
|
|
-// WxForeverCode wxForeverCode = wxForeverCodeService.getOne(new QueryWrapper<WxForeverCode>().eq("code", content).isNull("openid"));
|
|
|
-// System.out.println(11);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
@Test
|