Browse Source

新增测试testwxcode

dev
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> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools-wx-mp</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId> <artifactId>epmet-user-client</artifactId>
@ -160,10 +166,10 @@
<nacos.ip/> <nacos.ip/>
<!--公众号配置--> <!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId> <wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret> <wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token> <wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> <wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置--> <!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId> <resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret> <resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret>
@ -197,10 +203,10 @@
<nacos.ip/> <nacos.ip/>
<!--公众号配置--> <!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId> <wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret> <wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token> <wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> <wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置--> <!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId> <resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret> <resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret>
@ -234,10 +240,10 @@
<nacos.ip/> <nacos.ip/>
<!--公众号配置--> <!--公众号配置-->
<wx.mp.configs.appId>wxe73d1ecd13b5e9fb</wx.mp.configs.appId> <wx.mp.configs.appId>wxcb6ce2ed0c5ae54c</wx.mp.configs.appId>
<wx.mp.configs.secret>87c9f99e2ea5b695c79e8f5388789959</wx.mp.configs.secret> <wx.mp.configs.secret>c7f74941ee97fa9b2e1065772d34c397</wx.mp.configs.secret>
<wx.mp.configs.token>111</wx.mp.configs.token> <wx.mp.configs.token>12345678Yzm</wx.mp.configs.token>
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> <wx.mp.configs.aesKey>jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3</wx.mp.configs.aesKey>
<!--居民端小程序配置--> <!--居民端小程序配置-->
<resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId> <resi.wx.ma.appId>wx07674c23af51b521</resi.wx.ma.appId>
<resi.wx.ma.secret>a2fd0d29b007cbbcf8c8dda8c693d99b</resi.wx.ma.secret> <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.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.PublicUserLoginService;
import com.epmet.service.PaUserLoginService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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 * @date 2020/7/8 18:29
*/ */
@RestController @RestController
@RequestMapping("pa") @RequestMapping("publicuser")
public class PaUserLoginController { public class PublicUserLoginController {
@Autowired @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); ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO=paUserLoginService.loginByWxCode(formDTO); Map map = publicUserLoginService.loginByWxCode(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO); 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; package com.epmet.service;
import com.epmet.dto.form.PaWxCodeFormDTO; 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 * @author yinzuomei@elink-cn.com
* @date 2020/7/8 18:31 * @date 2020/7/8 18:31
*/ */
public interface PaUserLoginService { public interface PublicUserLoginService {
UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO); 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.commons.tools.exception.RenException;
import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.PublicUserLoginService;
import com.epmet.service.PaUserLoginService;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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 * @date 2020/7/8 18:31
*/ */
@Service @Service
public class PaUserLoginServiceImpl implements PaUserLoginService { public class PublicUserLoginServiceImpl implements PublicUserLoginService {
private static final Logger logger = LoggerFactory.getLogger(PaUserLoginServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(PublicUserLoginServiceImpl.class);
@Autowired @Autowired
private WxMpService wxMpService; private WxMpService wxMpService;
@Override @Override
public UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO) { public Map loginByWxCode(PaWxCodeFormDTO formDTO) {
WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode()); WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode());
return null; Map map =new HashMap();
map.put("微信用户信息",wxMpUser);
return map;
} }
private WxMpUser getWxMpUser(String wxCode) { private WxMpUser getWxMpUser(String wxCode) {
Loading…
Cancel
Save