Commit 68eb2767 authored by liuyang's avatar liuyang

update

parent dac969ef
......@@ -2,6 +2,7 @@ package com.qiankun.controller.mdp;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.qiankun.annotation.Auth;
import com.qiankun.config.WxMaConfiguration;
......@@ -9,15 +10,13 @@ import com.qiankun.config.WxMaProperties;
import com.qiankun.entity.User;
import com.qiankun.service.UserService;
import com.qiankun.utils.JwtTokenUtil;
import com.qiankun.vo.PaperIdLoginVo;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.ResourceBundle;
......@@ -39,7 +38,7 @@ public class MdpController {
@Auth(verifyLogin = false,verifyURL = false)
@RequestMapping(value = "/login",method = RequestMethod.GET)
public Map<String,Object> login(@RequestParam String code){
public Map<String,Object> login(@RequestParam String code) throws Exception {
if (StringUtils.isBlank(code)) {
return null;
}
......@@ -66,7 +65,27 @@ public class MdpController {
return result;
} catch (WxErrorException e) {
this.logger.error(e.getMessage(), e);
return null;
throw new Exception(e.getMessage(),e);
}
}
@Auth(verifyLogin = false,verifyURL = false)
@RequestMapping(value ="/loginByPaperId",method = RequestMethod.POST)
public Map<String,Object> loginByPaperId(@RequestBody PaperIdLoginVo vo){
User user = userService.findByPaperId(vo.getPaperId(),vo.getPaperType());
Map<String,Object> result = Maps.newConcurrentMap();
if (user == null){
result.put("isExist",false);
}else {
if (!user.getName().equals(vo.getName())){
result.put("errorMsg","姓名与库中信息不符,请核实后重新提交");
}else {
user.setOpenid(vo.getOpenid());
userService.save(user);
result.put("userInfo",user);
}
result.put("isExist",true);
}
return result;
}
}
......@@ -7,6 +7,8 @@ import com.qiankun.pages.IPageList;
public interface UserDao extends IDao<User, String> {
User findByPaperId(String paperId, String paperType);
IPageList<User> findUserPage(String searchStr, String role, String order, String sort, Hints hints);
User login(String userName, String password);
......
......@@ -27,6 +27,7 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
private static final String VALIDATE_PWD = " from User where id = ? and pwd = ? and isRemove=false";
private static final String FIND_BY_OPENID = "from User where openid = ?";
private static final String FIND_BY_PAPERID = "from User where paperId = ? and paperType = ?";
@Override
public Boolean validateUserExistByPaperId(String paperId) {
......@@ -112,4 +113,9 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
public User findByOpenid(String openid) {
return findUnique(FIND_BY_OPENID,new Hints(),openid);
}
@Override
public User findByPaperId(String paperId, String paperType) {
return findUnique(FIND_BY_PAPERID,new Hints(),paperId,paperType);
}
}
......@@ -58,4 +58,8 @@ public class UserService {
public User findByOpenid(String openid){
return userDao.findByOpenid(openid);
}
public User findByPaperId(String paperId, String paperType) {
return userDao.findByPaperId(paperId,paperType);
}
}
package com.qiankun.vo;
public class PaperIdLoginVo {
private String paperType;
private String paperId;
private String name;
private String openid;
public String getPaperType() {
return paperType;
}
public void setPaperType(String paperType) {
this.paperType = paperType;
}
public String getPaperId() {
return paperId;
}
public void setPaperId(String paperId) {
this.paperId = paperId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
}
#file_path=D:/file/
#file_path=/Users/liuyang/work/argus_work/tjmdp/udata
file_path=/var/tjmdp/udata
file_path=/Users/liuyang/work/argus_work/tjmdp/udata
#file_path=/var/tjmdp/udata
account=admin
......@@ -12,7 +12,9 @@ rainbowplan.token=
rainbowplan.aesKey=
rainbowplan.msgDataFormat=JSON
tjmdp.appid=wx77f58984e50cbc08
tjmdp.secret=6e6e00e5c01216c2464a8771cb9bdfca
tjmdp.secret=69ea7217fc5cee04f274c872a86be5e7
#tjmdp.appid=wx7289ed9f69379a53
#tjmdp.secret=89be603cffcc97535c97596b36aacf10
tjmdp.token=
tjmdp.aesKey=
tjmdp.msgDataFormat=JSON
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment