Browse Source

新增测试testwxcode

master
yinzuomei 5 years ago
parent
commit
bcbb1dc02c
  1. 30
      epmet-auth/pom.xml
  2. 26
      epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java
  3. 7
      epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java
  4. 16
      epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java

30
epmet-auth/pom.xml

@ -80,6 +80,12 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools-wx-mp</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
@ -160,10 +166,10 @@
<nacos.ip/>
<!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey>
<wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret>
@ -197,10 +203,10 @@
<nacos.ip/>
<!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey>
<wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret>
@ -234,10 +240,10 @@
<nacos.ip/>
<!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey>
<wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret>

26
epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java → epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java

@ -3,14 +3,15 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PaUserLoginService;
import com.epmet.service.PublicUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 描述一下
*
@ -18,17 +19,24 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2020/7/8 18:29
*/
@RestController
@RequestMapping("pa")
public class PaUserLoginController {
@RequestMapping("publicuser")
public class PublicUserLoginController {
@Autowired
private PaUserLoginService paUserLoginService;
private PublicUserLoginService publicUserLoginService;
@PostMapping(value = "/loginbywxcode")
public Result<UserTokenResultDTO> loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) {
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @author yinzuomei
* @description 测试是否能正常解析wxcode
* @Date 2020/7/9 17:00
**/
@PostMapping(value = "/testwxcode")
public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO=paUserLoginService.loginByWxCode(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
Map map = publicUserLoginService.loginByWxCode(formDTO);
return new Result().ok(map);
}
}

7
epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java → epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java

@ -1,7 +1,8 @@
package com.epmet.service;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import java.util.Map;
/**
* 描述一下
@ -9,6 +10,6 @@ import com.epmet.dto.result.UserTokenResultDTO;
* @author yinzuomei@elink-cn.com
* @date 2020/7/8 18:31
*/
public interface PaUserLoginService {
UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO);
public interface PublicUserLoginService {
Map loginByWxCode(PaWxCodeFormDTO formDTO);
}

16
epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java → epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java

@ -2,8 +2,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PaUserLoginService;
import com.epmet.service.PublicUserLoginService;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
@ -14,6 +13,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 描述一下
*
@ -21,16 +23,18 @@ import org.springframework.stereotype.Service;
* @date 2020/7/8 18:31
*/
@Service
public class PaUserLoginServiceImpl implements PaUserLoginService {
private static final Logger logger = LoggerFactory.getLogger(PaUserLoginServiceImpl.class);
public class PublicUserLoginServiceImpl implements PublicUserLoginService {
private static final Logger logger = LoggerFactory.getLogger(PublicUserLoginServiceImpl.class);
@Autowired
private WxMpService wxMpService;
@Override
public UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO) {
public Map loginByWxCode(PaWxCodeFormDTO formDTO) {
WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode());
return null;
Map map =new HashMap();
map.put("微信用户信息",wxMpUser);
return map;
}
private WxMpUser getWxMpUser(String wxCode) {
Loading…
Cancel
Save