Commit c584e28e by XiaHou

微信扫码登录相关代码提交

parent ae04051b
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version> <version>2.0.0</version>
</dependency> </dependency>
<!-- 打包成war包必备 --> <!-- 打包成war包必备 -->
<!--<dependency>--> <!--<dependency>-->
...@@ -226,6 +226,12 @@ ...@@ -226,6 +226,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<!--微信支付相关sdk-->
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>0.0.3</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
......
...@@ -120,6 +120,13 @@ public class Constants { ...@@ -120,6 +120,13 @@ public class Constants {
public static final String SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL="SMS_173406381"; public static final String SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL="SMS_173406381";
/** /**
* 短信类型:5:验证码登录
*/
public static final int SMS_TYPE_MOBILELOGIN = 5;
public static final String SMS_TYPE_MOBILELOGIN_VALUE="SMS_153815090";
public static final String SMS_TYPE_MOBILELOGIN_VALUE_INTERNATIONAL="SMS_173406384";
/**
* 提现类型 1:咖啡豆 * 提现类型 1:咖啡豆
*/ */
public static final Integer WITHDRAW_TYPE_BEANS = 1; public static final Integer WITHDRAW_TYPE_BEANS = 1;
......
...@@ -5,6 +5,7 @@ import com.hwstudio.antaile.entity.AtlMemorial; ...@@ -5,6 +5,7 @@ import com.hwstudio.antaile.entity.AtlMemorial;
import com.hwstudio.antaile.entity.AtlTime; import com.hwstudio.antaile.entity.AtlTime;
import com.hwstudio.antaile.service.*; import com.hwstudio.antaile.service.*;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.*; import com.hwstudio.antaile.vo.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -573,4 +574,6 @@ public class AtlTimeController extends BaseController { ...@@ -573,4 +574,6 @@ public class AtlTimeController extends BaseController {
public JsonResult selectRandomAtlTime( ) { public JsonResult selectRandomAtlTime( ) {
return JsonResult.success("获取时光纪详情成功", this.atlTimeService.selectRandomAtlTime()); return JsonResult.success("获取时光纪详情成功", this.atlTimeService.selectRandomAtlTime());
} }
} }
...@@ -7,6 +7,7 @@ import io.swagger.annotations.Api; ...@@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
/** /**
...@@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
* @Date 2021/5/17 * @Date 2021/5/17
* description: * description:
*/ */
@RestController @Controller
@RequestMapping(value = "/wx") @RequestMapping(value = "/wx")
@Api(tags = "用户相关接口") @Api(tags = "用户相关接口")
@CrossOrigin(origins = "*",maxAge = 3600) @CrossOrigin(origins = "*",maxAge = 3600)
...@@ -25,18 +26,27 @@ public class AtlWxController extends BaseController{ ...@@ -25,18 +26,27 @@ public class AtlWxController extends BaseController{
@RequestMapping(value = "getQrcodeUrl",method = RequestMethod.GET) @RequestMapping(value = "getQrcodeUrl",method = RequestMethod.GET)
@ApiOperation("获取二维码链接地址") @ApiOperation("获取二维码链接地址")
@ResponseBody
public JsonResult getQrcodeUrl() { public JsonResult getQrcodeUrl() {
return this.atlWxService.getQrcodeUrl(); return this.atlWxService.getQrcodeUrl();
} }
@RequestMapping(value = "getQrcodeAndState",method = RequestMethod.GET) @RequestMapping(value = "getQrcodeAndState",method = RequestMethod.GET)
@ApiOperation("微信二维码回调地址") @ApiOperation("微信二维码回调地址")
@ResponseBody
public JsonResult getQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) { public JsonResult getQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) {
return this.atlWxService.getAccessToken(code,state ); return this.atlWxService.getAccessToken(code,state );
} }
@RequestMapping(value = "getQrcodeAndState",method = RequestMethod.POST) @RequestMapping(value = "returnQrcodeAndState",method = RequestMethod.GET)
@ApiOperation("重定向:返回微信Code与state")
public String returnQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) {
return "redirect:https://www.atl-life.com/#/bindPage?code="+code+"&state="+state;
}
@RequestMapping(value = "insertAtlUserByWxLogin",method = RequestMethod.POST)
@ApiOperation("新用户微信扫码登录,绑定手机号密码") @ApiOperation("新用户微信扫码登录,绑定手机号密码")
@ResponseBody
public JsonResult insertAtlUserByWxLogin(@ApiParam(value = "传入对象") @RequestBody WxInsertUserParam wxInsertUserParam) { public JsonResult insertAtlUserByWxLogin(@ApiParam(value = "传入对象") @RequestBody WxInsertUserParam wxInsertUserParam) {
return this.atlWxService.insertAtlUserByWxLogin(wxInsertUserParam); return this.atlWxService.insertAtlUserByWxLogin(wxInsertUserParam);
} }
......
package com.hwstudio.antaile.controller; package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.LoginUserDto; import com.hwstudio.antaile.dto.LoginUserDto;
import com.hwstudio.antaile.dto.VerifyCodeLogin;
import com.hwstudio.antaile.service.AtlUserService; import com.hwstudio.antaile.service.AtlUserService;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.RedisUtil; import com.hwstudio.antaile.utils.RedisUtil;
...@@ -8,6 +9,7 @@ import com.hwstudio.antaile.vo.LoginUserVo; ...@@ -8,6 +9,7 @@ import com.hwstudio.antaile.vo.LoginUserVo;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
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;
...@@ -39,6 +41,14 @@ public class LoginController{ ...@@ -39,6 +41,14 @@ public class LoginController{
return JsonResult.success("请求成功", loginUserDto); return JsonResult.success("请求成功", loginUserDto);
} }
@RequestMapping(value="/verifyCodeLogin")
@ApiOperation(value = "手机号验证码登录", httpMethod = "POST")
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = LoginUserDto.class))
public JsonResult verifyCodeLogin(@ApiParam(value = "传入对象") @RequestBody VerifyCodeLogin verifyCodeLogin) throws Exception{
return atlUserService.verifyCodeLogin(verifyCodeLogin);
}
@RequestMapping(value="/appletLogin") @RequestMapping(value="/appletLogin")
@ApiOperation(value = "小程序登录", httpMethod = "POST", notes = "手机号+密码登录,成功后返回token,在需要登录的接口头部加入此token", response = JsonResult.class) @ApiOperation(value = "小程序登录", httpMethod = "POST", notes = "手机号+密码登录,成功后返回token,在需要登录的接口头部加入此token", response = JsonResult.class)
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = LoginUserDto.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = LoginUserDto.class))
......
...@@ -42,7 +42,7 @@ public class RegisterController { ...@@ -42,7 +42,7 @@ public class RegisterController {
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "pwd", value = "密码", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "pwd", value = "密码", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "nickName", value = "昵称", required = true, dataType = "string", paramType = "query") @ApiImplicitParam(name = "nickName", value = "昵称", required = false, dataType = "string", paramType = "query")
}) })
public JsonResult registerMobile(String mobile, String pwd, String verifyCode, String nickName) { public JsonResult registerMobile(String mobile, String pwd, String verifyCode, String nickName) {
registerService.registerMobile(mobile, pwd, verifyCode, nickName); registerService.registerMobile(mobile, pwd, verifyCode, nickName);
......
...@@ -38,7 +38,7 @@ public class SmsController { ...@@ -38,7 +38,7 @@ public class SmsController {
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = JsonResult.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = JsonResult.class))
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "type", value = "类型:1:注册", required = true, dataType = "int", paramType = "query") @ApiImplicitParam(name = "type", value = "类型:1:注册 3:修改登录密码 4:绑定手机号 5:验证码登录", required = true, dataType = "int", paramType = "query")
}) })
public JsonResult sendVerifyCode(String mobile, Integer type) { public JsonResult sendVerifyCode(String mobile, Integer type) {
smsService.sendVerifyCode(mobile, type); smsService.sendVerifyCode(mobile, type);
......
...@@ -39,4 +39,8 @@ public class LoginUserDto { ...@@ -39,4 +39,8 @@ public class LoginUserDto {
private String officeOpendId; private String officeOpendId;
private String appletOpenId; private String appletOpenId;
@ApiModelProperty(value = "网站应用openId")
private String webappOpenId;
@ApiModelProperty(value = "微信unionid")
private String unionid;
} }
package com.hwstudio.antaile.dto; package com.hwstudio.antaile.dto;
import com.hwstudio.antaile.utils.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -15,4 +16,6 @@ public class OfficialWebsiteAtlTimeParam implements Serializable { ...@@ -15,4 +16,6 @@ public class OfficialWebsiteAtlTimeParam implements Serializable {
@ApiModelProperty(value = "是否首页推荐 0-否 1-是") @ApiModelProperty(value = "是否首页推荐 0-否 1-是")
private Integer isCommend; private Integer isCommend;
@ApiModelProperty(value = "分页对象,不传递不分页")
private Page page;
} }
package com.hwstudio.antaile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/5/25
* description:
*/
@Data
public class VerifyCodeLogin implements Serializable {
@ApiModelProperty(value = "手机号")
private String mobilePhone;
@ApiModelProperty(value = "验证码")
private String verifyCode;
}
...@@ -8,57 +8,62 @@ import java.util.Date; ...@@ -8,57 +8,62 @@ import java.util.Date;
@Data @Data
public class AtlUser implements Serializable{ public class AtlUser implements Serializable{
@ApiModelProperty(value = "用户id")
private Long id; private Long id;
@ApiModelProperty(value = "昵称")
private String nickName; private String nickName;
@ApiModelProperty(value = "真实姓名")
private String realName; private String realName;
@ApiModelProperty(value = "手机号")
private String mobilePhone; private String mobilePhone;
@ApiModelProperty(value = "登录密码")
private String loginPassword; private String loginPassword;
@ApiModelProperty(value = "支付密码")
private String payPassword; private String payPassword;
@ApiModelProperty(value = "微信openId")
private String openId; private String openId;
@ApiModelProperty(value = "头像")
private String avaterImageUrl; private String avaterImageUrl;
@ApiModelProperty(value = "云空间使用次数")
private Integer cloudSpaceUsage; private Integer cloudSpaceUsage;
@ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "创建人")
private Integer createBy; private Integer createBy;
@ApiModelProperty(value = "创建时间")
private String createTime; private String createTime;
@ApiModelProperty(value = "修改人")
private Integer updateBy; private Integer updateBy;
@ApiModelProperty(value = "修改时间")
private String updateTime; private String updateTime;
@ApiModelProperty(value = "状态 1-启用 2-禁用")
private Integer state; private Integer state;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer sex; private Integer sex;
@ApiModelProperty(value = "生日")
private Date birthday; private Date birthday;
@ApiModelProperty(value = "1:公历 2:农历")
private String birthdayType; private String birthdayType;
@ApiModelProperty(value = "个性签名")
private String signature; private String signature;
@ApiModelProperty(value = "最后登录时间")
private Date loginDate; private Date loginDate;
@ApiModelProperty(value = "推送用户标识id")
private String clientId; private String clientId;
@ApiModelProperty(value = "是否系统消息提醒 0:否 1:是")
private String isSysPush; private String isSysPush;
@ApiModelProperty(value = "是否社交消息提醒 0:否 1:是")
private String isScPush; private String isScPush;
@ApiModelProperty(value = "是否提醒消息提醒 0:否 1:是")
private String isRemPush; private String isRemPush;
@ApiModelProperty(value = "公众号openId")
private String officeOpenId; private String officeOpenId;
@ApiModelProperty(value = "微信accessToken")
private String accessToken; private String accessToken;
@ApiModelProperty(value = "小程序openId")
private String appletOpenId; private String appletOpenId;
@ApiModelProperty(value = "网站应用openId")
private String webappOpenId;
@ApiModelProperty(value = "微信unionid")
private String unionid;
} }
\ No newline at end of file
package com.hwstudio.antaile.mapper; package com.hwstudio.antaile.mapper;
import com.hwstudio.antaile.entity.AtlAd;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public interface AtlAdMapper { public interface AtlAdMapper {
int deleteByPrimaryKey(Long id);
int insert(AtlAd record); List<Map<String, Object>> getShowAd(@Param("type") Integer type);
int insertSelective(AtlAd record);
AtlAd selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AtlAd record);
int updateByPrimaryKey(AtlAd record);
List<Map<String,Object>> getShowAd(@Param("type") Integer type);
} }
\ No newline at end of file
...@@ -4,7 +4,6 @@ import com.hwstudio.antaile.dto.AtlUserInfoDto; ...@@ -4,7 +4,6 @@ import com.hwstudio.antaile.dto.AtlUserInfoDto;
import com.hwstudio.antaile.dto.AtlUserPhoneTypeDto; import com.hwstudio.antaile.dto.AtlUserPhoneTypeDto;
import com.hwstudio.antaile.entity.AtlUser; import com.hwstudio.antaile.entity.AtlUser;
import com.hwstudio.antaile.entity.AtlUserPhoneType; import com.hwstudio.antaile.entity.AtlUserPhoneType;
import com.hwstudio.antaile.vo.AtlUserPhoneTypeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -17,13 +16,13 @@ public interface AtlUserMapper { ...@@ -17,13 +16,13 @@ public interface AtlUserMapper {
void registerMobile(AtlUser atlUser); void registerMobile(AtlUser atlUser);
AtlUserInfoDto getUserInfo(@Param("userId")Long userId); AtlUserInfoDto getUserInfo(@Param("userId") Long userId);
void updateUser(AtlUser atlUser); void updateUser(AtlUser atlUser);
void updatePushStatus(AtlUser atlUser); void updatePushStatus(AtlUser atlUser);
AtlUser getAtlUserInfo(@Param("userId")Long userId); AtlUser getAtlUserInfo(@Param("userId") Long userId);
AtlUser getByOpenId(@Param("openId") String openId); AtlUser getByOpenId(@Param("openId") String openId);
...@@ -31,6 +30,8 @@ public interface AtlUserMapper { ...@@ -31,6 +30,8 @@ public interface AtlUserMapper {
AtlUser getByAppletOpenId(@Param("appletOpenId") String appletOpenId); AtlUser getByAppletOpenId(@Param("appletOpenId") String appletOpenId);
AtlUser getByWebappOpenId(String getByWebappOpenId);
void updatePwd(@Param("pwd") String pwd, @Param("userId") Long userId); void updatePwd(@Param("pwd") String pwd, @Param("userId") Long userId);
void insert(AtlUser atlUser); void insert(AtlUser atlUser);
...@@ -55,5 +56,13 @@ public interface AtlUserMapper { ...@@ -55,5 +56,13 @@ public interface AtlUserMapper {
void updatePhoneType(AtlUserPhoneType atlUserPhoneType); void updatePhoneType(AtlUserPhoneType atlUserPhoneType);
Long getCommentCount(@Param("userId")Long userId); Long getCommentCount(@Param("userId") Long userId);
/**
* 根据手机号 查询一条用户数据
*
* @param mobilePhone
* @return
*/
AtlUser selectOneUserByMobilePhone(String mobilePhone);
} }
\ No newline at end of file
package com.hwstudio.antaile.service; package com.hwstudio.antaile.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -9,6 +10,7 @@ import com.hwstudio.antaile.dto.*; ...@@ -9,6 +10,7 @@ import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.entity.*; import com.hwstudio.antaile.entity.*;
import com.hwstudio.antaile.exception.BusinessException; import com.hwstudio.antaile.exception.BusinessException;
import com.hwstudio.antaile.mapper.*; import com.hwstudio.antaile.mapper.*;
import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.vo.AtlFineVo; import com.hwstudio.antaile.vo.AtlFineVo;
import com.hwstudio.antaile.vo.AtlPrivateVo; import com.hwstudio.antaile.vo.AtlPrivateVo;
...@@ -23,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -23,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* Created by LENOVO on 2019/5/27. * Created by LENOVO on 2019/5/27.
...@@ -793,8 +796,22 @@ public class AtlTimeService { ...@@ -793,8 +796,22 @@ public class AtlTimeService {
* *
* @return * @return
*/ */
public List<OfficialWebsiteAtlTimeVO> selectOfficialWebsiteAtlTime(OfficialWebsiteAtlTimeParam officialWebsiteAtlTimeParam) { public CommonPage<OfficialWebsiteAtlTimeVO> selectOfficialWebsiteAtlTime(OfficialWebsiteAtlTimeParam officialWebsiteAtlTimeParam) {
return this.atlTimeMapper.selectOfficialWebsiteAtlTime(officialWebsiteAtlTimeParam); if (officialWebsiteAtlTimeParam.getPage() != null && officialWebsiteAtlTimeParam.getPage().getPageNum() != null && officialWebsiteAtlTimeParam.getPage().getPageSize() != null) {
PageHelper.startPage(officialWebsiteAtlTimeParam.getPage().getPageNum(), officialWebsiteAtlTimeParam.getPage().getPageSize());
}
List<OfficialWebsiteAtlTimeVO> officialWebsiteAtlTimeVOList = this.atlTimeMapper.selectOfficialWebsiteAtlTime(officialWebsiteAtlTimeParam);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<OfficialWebsiteAtlTimeVO> pageInfo = new PageInfo<>(officialWebsiteAtlTimeVOList);
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<OfficialWebsiteAtlTimeVO> result = new CommonPage<OfficialWebsiteAtlTimeVO>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(officialWebsiteAtlTimeVOList);
return result;
} }
/** /**
......
package com.hwstudio.antaile.service; package com.hwstudio.antaile.service;
import com.github.binarywang.java.emoji.EmojiConverter; import com.github.binarywang.java.emoji.EmojiConverter;
import com.github.pagehelper.util.StringUtil;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.JsonObject; import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.dto.AtlUserInfoDto;
import com.hwstudio.antaile.dto.AtlUserPhoneTypeDto;
import com.hwstudio.antaile.dto.BindingMobileDto;
import com.hwstudio.antaile.dto.LoginUserDto;
import com.hwstudio.antaile.entity.*; import com.hwstudio.antaile.entity.*;
import com.hwstudio.antaile.exception.BusinessException; import com.hwstudio.antaile.exception.BusinessException;
import com.hwstudio.antaile.mapper.*; import com.hwstudio.antaile.mapper.*;
...@@ -21,17 +16,12 @@ import com.hwstudio.antaile.vo.AtlUserPhoneTypeVo; ...@@ -21,17 +16,12 @@ import com.hwstudio.antaile.vo.AtlUserPhoneTypeVo;
import com.hwstudio.antaile.vo.AtlUserUpdateVo; import com.hwstudio.antaile.vo.AtlUserUpdateVo;
import com.hwstudio.antaile.vo.LoginUserVo; import com.hwstudio.antaile.vo.LoginUserVo;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.rmi.MarshalledObject;
import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -202,6 +192,34 @@ public class AtlUserService { ...@@ -202,6 +192,34 @@ public class AtlUserService {
} }
/** /**
* 验证码登录账号
*
* @param verifyCodeLogin
* @return
*/
public JsonResult verifyCodeLogin(VerifyCodeLogin verifyCodeLogin) {
Sms sms = smsMapper.getSmsVerifyCode(verifyCodeLogin.getMobilePhone(), verifyCodeLogin.getVerifyCode(), 5);
if (sms == null) {
throw new BusinessException("验证码错误");
}
//校验手机号是否已经存在过
AtlUser atlUser = this.atlUserMapper.selectOneUserByMobilePhone(verifyCodeLogin.getMobilePhone());
if(atlUser == null){
throw new BusinessException("不存在此手机号");
}
//否则有查询到 就登录成功
LoginUserDto loginUserDto = new LoginUserDto();
String token = UUID.randomUUID().toString();
redisUtil.set(token, atlUser, Long.valueOf(604800));
loginUserDto.setToken(token);
loginUserDto.setAvatarUrl(atlUser.getAvaterImageUrl());
loginUserDto.setNickName(atlUser.getNickName());
loginUserDto.setPhone(atlUser.getMobilePhone());
loginUserDto.setOpenId(atlUser.getOpenId());
return JsonResult.success("登录成功", loginUserDto);
}
/**
* 功能描述: <br>账号密码登录 * 功能描述: <br>账号密码登录
* 〈〉 * 〈〉
* *
...@@ -211,7 +229,7 @@ public class AtlUserService { ...@@ -211,7 +229,7 @@ public class AtlUserService {
*/ */
public JsonResult appletLogin(LoginUserVo loginUserVo) throws Exception { public JsonResult appletLogin(LoginUserVo loginUserVo) throws Exception {
LoginUserDto loginUserDto = new LoginUserDto(); LoginUserDto loginUserDto = new LoginUserDto();
AtlUser atlUser ; AtlUser atlUser;
if ("1".equals(loginUserVo.getIsApplet())) { if ("1".equals(loginUserVo.getIsApplet())) {
JSONObject jsonObject = OpenIdUtil.oauth2GetAppletOpenId(loginUserVo.getWxCode()); JSONObject jsonObject = OpenIdUtil.oauth2GetAppletOpenId(loginUserVo.getWxCode());
if (null != jsonObject.get("errcode")) { if (null != jsonObject.get("errcode")) {
...@@ -224,7 +242,7 @@ public class AtlUserService { ...@@ -224,7 +242,7 @@ public class AtlUserService {
String mobile = atlUser.getMobilePhone(); String mobile = atlUser.getMobilePhone();
if (StringUtils.isNotBlank(mobile)) { if (StringUtils.isNotBlank(mobile)) {
String sendToken = loginUserVo.getToken(); String sendToken = loginUserVo.getToken();
if(StringUtils.isNotBlank(sendToken)){ if (StringUtils.isNotBlank(sendToken)) {
Object obj = redisUtil.get(sendToken); Object obj = redisUtil.get(sendToken);
if (null != obj) { if (null != obj) {
redisUtil.remove(sendToken); redisUtil.remove(sendToken);
...@@ -265,7 +283,7 @@ public class AtlUserService { ...@@ -265,7 +283,7 @@ public class AtlUserService {
String appletOpenId = atlUser.getAppletOpenId(); String appletOpenId = atlUser.getAppletOpenId();
if (StringUtils.isNotBlank(appletOpenId)) { if (StringUtils.isNotBlank(appletOpenId)) {
String sendToken = loginUserVo.getToken(); String sendToken = loginUserVo.getToken();
if(StringUtils.isNotBlank(sendToken)){ if (StringUtils.isNotBlank(sendToken)) {
Object obj = redisUtil.get(sendToken); Object obj = redisUtil.get(sendToken);
if (null != obj) { if (null != obj) {
redisUtil.remove(sendToken); redisUtil.remove(sendToken);
...@@ -285,7 +303,7 @@ public class AtlUserService { ...@@ -285,7 +303,7 @@ public class AtlUserService {
loginUserDto.setOpenId(appletOpenId); loginUserDto.setOpenId(appletOpenId);
} }
} }
return JsonResult.success("登录成功",loginUserDto); return JsonResult.success("登录成功", loginUserDto);
} }
...@@ -415,7 +433,7 @@ public class AtlUserService { ...@@ -415,7 +433,7 @@ public class AtlUserService {
return loginUserDto; return loginUserDto;
} }
public JsonResult bindingAppletMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) throws Exception{ public JsonResult bindingAppletMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) throws Exception {
String appletOpenId = loginUserVo.getOpenId(); String appletOpenId = loginUserVo.getOpenId();
if (!VerificationUtil.isMobile(bindingMobileDto.getMobile())) { if (!VerificationUtil.isMobile(bindingMobileDto.getMobile())) {
throw new BusinessException("手机号无效"); throw new BusinessException("手机号无效");
...@@ -457,7 +475,7 @@ public class AtlUserService { ...@@ -457,7 +475,7 @@ public class AtlUserService {
loginUserDto.setNickName(atlUser.getNickName()); loginUserDto.setNickName(atlUser.getNickName());
loginUserDto.setPhone(atlUser.getMobilePhone()); loginUserDto.setPhone(atlUser.getMobilePhone());
loginUserDto.setOpenId(appletOpenId); loginUserDto.setOpenId(appletOpenId);
return JsonResult.success("绑定成功",loginUserDto); return JsonResult.success("绑定成功", loginUserDto);
} }
public JsonResult bindingOffice(LoginUserVo loginUserVo) throws Exception { public JsonResult bindingOffice(LoginUserVo loginUserVo) throws Exception {
......
...@@ -78,10 +78,10 @@ public class AtlWxService { ...@@ -78,10 +78,10 @@ public class AtlWxService {
return JsonResult.failed("获取accessToken失败:", dataMap); return JsonResult.failed("获取accessToken失败:", dataMap);
} }
//返回了openid等信息 根据openid去查询 如果没有则去新增 //返回了openid等信息 根据openid去查询 如果没有则去新增
AtlUser atlUser = atlUserMapper.getByOpenId(openid); AtlUser atlUser = atlUserMapper.getByWebappOpenId(openid);
//如果是新用户 需要去绑定手机号 和 密码 //如果是新用户 需要去绑定手机号 和 密码
if (atlUser == null) { if (atlUser == null) {
return JsonResult.failed("", dataMap); return JsonResult.failed("未查询到网站应用openId相关数据,需要绑定手机号", dataMap);
} else { } else {
//否则有查询到 就登录成功 //否则有查询到 就登录成功
LoginUserDto loginUserDto = new LoginUserDto(); LoginUserDto loginUserDto = new LoginUserDto();
...@@ -91,7 +91,7 @@ public class AtlWxService { ...@@ -91,7 +91,7 @@ public class AtlWxService {
loginUserDto.setAvatarUrl(atlUser.getAvaterImageUrl()); loginUserDto.setAvatarUrl(atlUser.getAvaterImageUrl());
loginUserDto.setNickName(atlUser.getNickName()); loginUserDto.setNickName(atlUser.getNickName());
loginUserDto.setPhone(atlUser.getMobilePhone()); loginUserDto.setPhone(atlUser.getMobilePhone());
loginUserDto.setOpenId(atlUser.getOpenId()); loginUserDto.setWebappOpenId(atlUser.getOpenId());
return JsonResult.success("登录成功", loginUserDto); return JsonResult.success("登录成功", loginUserDto);
} }
//{"success":true,"status":"200","message":"获取微信登录链接成功","data":"{\"openid\":\"onUQk6gm0ALTXFtddQrikfhmivR0\",\"nickname\":\"夏侯\",\"sex\":1,\"language\":\"zh_CN\",\"city\":\"Xiamen\",\"province\":\"Fujian\",\"country\":\"CN\", //{"success":true,"status":"200","message":"获取微信登录链接成功","data":"{\"openid\":\"onUQk6gm0ALTXFtddQrikfhmivR0\",\"nickname\":\"夏侯\",\"sex\":1,\"language\":\"zh_CN\",\"city\":\"Xiamen\",\"province\":\"Fujian\",\"country\":\"CN\",
...@@ -118,16 +118,31 @@ public class AtlWxService { ...@@ -118,16 +118,31 @@ public class AtlWxService {
if (openid2 == null || openid2.isEmpty()) { if (openid2 == null || openid2.isEmpty()) {
return JsonResult.failed("获取用户信息失败:" + userMap); return JsonResult.failed("获取用户信息失败:" + userMap);
} }
//向数据库写入会员信息 //需要判断是否存在手机号 存在则修改 不存在新增
AtlUser atlUser = this.atlUserMapper.selectOneUserByMobilePhone(wxInsertUserParam.getMobilePhone());
AtlUser insertAtlUser = new AtlUser(); AtlUser insertAtlUser = new AtlUser();
if(atlUser != null){
//修改操作
atlUser.setNickName(userMap.get("nickname") + "");
atlUser.setWebappOpenId(userMap.get("openid") + "");
atlUser.setAvaterImageUrl(userMap.get("headimgurl") + "");
atlUser.setState(1);
atlUser.setSex((Integer) userMap.get("sex"));
atlUser.setMobilePhone(wxInsertUserParam.getMobilePhone());
atlUser.setLoginPassword(DigestUtils.md5Hex(wxInsertUserParam.getLoginPassword()));
this.atlUserMapper.updateUser(atlUser);
}else{
//向数据库写入会员信息
insertAtlUser.setNickName(userMap.get("nickname") + ""); insertAtlUser.setNickName(userMap.get("nickname") + "");
insertAtlUser.setOpenId(userMap.get("openid") + ""); insertAtlUser.setWebappOpenId(userMap.get("openid") + "");
insertAtlUser.setAvaterImageUrl(userMap.get("headimgurl") + ""); insertAtlUser.setAvaterImageUrl(userMap.get("headimgurl") + "");
insertAtlUser.setState(1); insertAtlUser.setState(1);
insertAtlUser.setSex((Integer) userMap.get("sex")); insertAtlUser.setSex((Integer) userMap.get("sex"));
insertAtlUser.setMobilePhone(wxInsertUserParam.getMobilePhone()); insertAtlUser.setMobilePhone(wxInsertUserParam.getMobilePhone());
insertAtlUser.setLoginPassword(DigestUtils.md5Hex(wxInsertUserParam.getLoginPassword())); insertAtlUser.setLoginPassword(DigestUtils.md5Hex(wxInsertUserParam.getLoginPassword()));
this.atlUserMapper.insert(insertAtlUser); this.atlUserMapper.insert(insertAtlUser);
}
//返回对象数据 //返回对象数据
LoginUserDto loginUserDto = new LoginUserDto(); LoginUserDto loginUserDto = new LoginUserDto();
String token = UUID.randomUUID().toString(); String token = UUID.randomUUID().toString();
...@@ -136,7 +151,7 @@ public class AtlWxService { ...@@ -136,7 +151,7 @@ public class AtlWxService {
loginUserDto.setAvatarUrl(insertAtlUser.getAvaterImageUrl()); loginUserDto.setAvatarUrl(insertAtlUser.getAvaterImageUrl());
loginUserDto.setNickName(insertAtlUser.getNickName()); loginUserDto.setNickName(insertAtlUser.getNickName());
loginUserDto.setPhone(insertAtlUser.getMobilePhone()); loginUserDto.setPhone(insertAtlUser.getMobilePhone());
loginUserDto.setOpenId(insertAtlUser.getOpenId()); loginUserDto.setWebappOpenId(insertAtlUser.getOpenId());
return JsonResult.success("绑定手机号登录成功", loginUserDto); return JsonResult.success("绑定手机号登录成功", loginUserDto);
} }
...@@ -162,7 +177,7 @@ public class AtlWxService { ...@@ -162,7 +177,7 @@ public class AtlWxService {
if (wxInsertUserParam.getVerifyCode() == null || wxInsertUserParam.getVerifyCode().isEmpty()) { if (wxInsertUserParam.getVerifyCode() == null || wxInsertUserParam.getVerifyCode().isEmpty()) {
return JsonResult.failed("传入验证码为空"); return JsonResult.failed("传入验证码为空");
} else { } else {
Sms sms = smsMapper.getSmsVerifyCode(wxInsertUserParam.getMobilePhone(), wxInsertUserParam.getVerifyCode(), 1); Sms sms = smsMapper.getSmsVerifyCode(wxInsertUserParam.getMobilePhone(), wxInsertUserParam.getVerifyCode(), 5);
if (sms == null) { if (sms == null) {
throw new BusinessException("验证码错误"); throw new BusinessException("验证码错误");
} }
......
...@@ -96,6 +96,12 @@ public class SmsService { ...@@ -96,6 +96,12 @@ public class SmsService {
templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL; templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL;
} }
break; break;
case Constants.SMS_TYPE_MOBILELOGIN:
templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE;
if(isMatch == false){
templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE_INTERNATIONAL;
}
break;
default: { default: {
throw new BusinessException("参数异常"); throw new BusinessException("参数异常");
} }
......
package com.hwstudio.antaile.utils;
import com.github.pagehelper.PageInfo;
import org.springframework.data.domain.Page;
import java.util.List;
/**
* 分页数据封装类
* Created by macro on 2019/4/19.
*/
public class CommonPage<T> {
private Integer pageNum;
private Integer pageSize;
private Integer totalPage;
private Long total;
private List<T> list;
/**
* 将PageHelper分页后的list转为分页信息
*/
public static <T> CommonPage<T> restPage(List<T> list) {
CommonPage<T> result = new CommonPage<T>();
PageInfo<T> pageInfo = new PageInfo<T>(list);
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(pageInfo.getList());
return result;
}
/**
* 将SpringData分页后的list转为分页信息
*/
public static <T> CommonPage<T> restPage(Page<T> pageInfo) {
CommonPage<T> result = new CommonPage<T>();
result.setTotalPage(pageInfo.getTotalPages());
result.setPageNum(pageInfo.getNumber());
result.setPageSize(pageInfo.getSize());
result.setTotal(pageInfo.getTotalElements());
result.setList(pageInfo.getContent());
return result;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
}
package com.hwstudio.antaile.utils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author chenwf
* @date 2020/4/2
*/
@Data
public class Page {
@ApiModelProperty("页码")
private Integer pageNum;
@ApiModelProperty("页数")
private Integer pageSize;
public Page() {
}
public Page(Integer pageNum, Integer pageSize) {
this.pageNum = pageNum;
this.pageSize = pageSize;
}
}
package com.hwstudio.antaile.utils.wx;
/**
* 域名管理,实现主备域名自动切换
*/
public abstract interface IWXPayDomain {
/**
* 上报域名网络状况
* @param domain 域名。 比如:api.mch.weixin.qq.com
* @param elapsedTimeMillis 耗时
* @param ex 网络请求中出现的异常。
* null表示没有异常
* ConnectTimeoutException,表示建立网络连接异常
* UnknownHostException, 表示dns解析异常
*/
abstract void report(final String domain, long elapsedTimeMillis, final Exception ex);
/**
* 获取域名
* @param config 配置
* @return 域名
*/
abstract DomainInfo getDomain(final WXPayConfig config);
static class DomainInfo{
public String domain; //域名
public boolean primaryDomain; //该域名是否为主域名。例如:api.mch.weixin.qq.com为主域名
public DomainInfo(String domain, boolean primaryDomain) {
this.domain = domain;
this.primaryDomain = primaryDomain;
}
@Override
public String toString() {
return "DomainInfo{" +
"domain='" + domain + '\'' +
", primaryDomain=" + primaryDomain +
'}';
}
}
}
\ No newline at end of file
package com.hwstudio.antaile.utils.wx;
import java.io.InputStream;
public abstract class WXPayConfig {
/**
* 获取 App ID
*
* @return App ID
*/
abstract String getAppID();
/**
* 获取 Mch ID
*
* @return Mch ID
*/
abstract String getMchID();
/**
* 获取 API 密钥
*
* @return API密钥
*/
abstract String getKey();
/**
* 获取商户证书内容
*
* @return 商户证书内容
*/
abstract InputStream getCertStream();
/**
* HTTP(S) 连接超时时间,单位毫秒
*
* @return
*/
public int getHttpConnectTimeoutMs() {
return 6*1000;
}
/**
* HTTP(S) 读数据超时时间,单位毫秒
*
* @return
*/
public int getHttpReadTimeoutMs() {
return 8*1000;
}
/**
* 获取WXPayDomain, 用于多域名容灾自动切换
* @return
*/
abstract IWXPayDomain getWXPayDomain();
/**
* 是否自动上报。
* 若要关闭自动上报,子类中实现该函数返回 false 即可。
*
* @return
*/
public boolean shouldAutoReport() {
return true;
}
/**
* 进行健康上报的线程的数量
*
* @return
*/
public int getReportWorkerNum() {
return 6;
}
/**
* 健康上报缓存消息的最大数量。会有线程去独立上报
* 粗略计算:加入一条消息200B,10000消息占用空间 2000 KB,约为2MB,可以接受
*
* @return
*/
public int getReportQueueMaxSize() {
return 10000;
}
/**
* 批量上报,一次最多上报多个数据
*
* @return
*/
public int getReportBatchSize() {
return 10;
}
}
package com.hwstudio.antaile.utils.wx;
import org.apache.http.client.HttpClient;
/**
* 常量
*/
public class WXPayConstants {
public enum SignType {
MD5, HMACSHA256
}
public static final String DOMAIN_API = "api.mch.weixin.qq.com";
public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
public static final String FAIL = "FAIL";
public static final String SUCCESS = "SUCCESS";
public static final String HMACSHA256 = "HMAC-SHA256";
public static final String MD5 = "MD5";
public static final String FIELD_SIGN = "sign";
public static final String FIELD_SIGN_TYPE = "sign_type";
public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
public static final String USER_AGENT = WXPAYSDK_VERSION +
" (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
public static final String MICROPAY_URL_SUFFIX = "/pay/micropay";
public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
public static final String ORDERQUERY_URL_SUFFIX = "/pay/orderquery";
public static final String REVERSE_URL_SUFFIX = "/secapi/pay/reverse";
public static final String CLOSEORDER_URL_SUFFIX = "/pay/closeorder";
public static final String REFUND_URL_SUFFIX = "/secapi/pay/refund";
public static final String REFUNDQUERY_URL_SUFFIX = "/pay/refundquery";
public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
public static final String REPORT_URL_SUFFIX = "/payitil/report";
public static final String SHORTURL_URL_SUFFIX = "/tools/shorturl";
public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
// sandbox
public static final String SANDBOX_MICROPAY_URL_SUFFIX = "/sandboxnew/pay/micropay";
public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
public static final String SANDBOX_ORDERQUERY_URL_SUFFIX = "/sandboxnew/pay/orderquery";
public static final String SANDBOX_REVERSE_URL_SUFFIX = "/sandboxnew/secapi/pay/reverse";
public static final String SANDBOX_CLOSEORDER_URL_SUFFIX = "/sandboxnew/pay/closeorder";
public static final String SANDBOX_REFUND_URL_SUFFIX = "/sandboxnew/secapi/pay/refund";
public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX = "/sandboxnew/pay/refundquery";
public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
public static final String SANDBOX_REPORT_URL_SUFFIX = "/sandboxnew/payitil/report";
public static final String SANDBOX_SHORTURL_URL_SUFFIX = "/sandboxnew/tools/shorturl";
public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
}
package com.hwstudio.antaile.utils.wx;
import org.w3c.dom.Document;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
/**
* 2018/7/3
*/
public final class WXPayXmlUtil {
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
documentBuilderFactory.setXIncludeAware(false);
documentBuilderFactory.setExpandEntityReferences(false);
return documentBuilderFactory.newDocumentBuilder();
}
public static Document newDocument() throws ParserConfigurationException {
return newDocumentBuilder().newDocument();
}
}
...@@ -73,7 +73,7 @@ spring: ...@@ -73,7 +73,7 @@ spring:
#此处为微信开放平台的相关参数 #此处为微信开放平台的相关参数
appid: wx27928349186b6267 appid: wx27928349186b6267
appSecret: dee9b11ee545bff614abc91ebb042127 appSecret: dee9b11ee545bff614abc91ebb042127
redirectUri: http://31673rv944.51vip.biz/atlApp/wx/getQrcodeAndState redirectUri: https://appapi.antaile.net/wx/returnQrcodeAndState
server: server:
port: 8088 port: 8088
......
...@@ -72,8 +72,26 @@ ...@@ -72,8 +72,26 @@
<if test="birthdayType != null"> <if test="birthdayType != null">
birthday_type = #{birthdayType}, birthday_type = #{birthdayType},
</if> </if>
<if test="state != null">
state = #{state},
</if>
<if test="signature != null"> <if test="signature != null">
signature = #{signature} signature = #{signature},
</if>
<if test="loginDate != null">
login_date = #{loginDate},
</if>
<if test="officeOpenId != null and officeOpenId !=''">
office_open_id = #{officeOpenId},
</if>
<if test="appletOpenId != null and appletOpenId !=''">
applet_open_id = #{appletOpenId},
</if>
<if test="webappOpenId != null and webappOpenId !=''">
webapp_open_id = #{webappOpenId},
</if>
<if test="unionid != null and unionid !='' ">
unionid = #{unionid},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
...@@ -116,6 +134,9 @@ ...@@ -116,6 +134,9 @@
SELECT * FROM atl_user WHERE office_open_id = #{officeOpenId} SELECT * FROM atl_user WHERE office_open_id = #{officeOpenId}
</select> </select>
<select id="getByWebappOpenId" resultType="com.hwstudio.antaile.entity.AtlUser" parameterType="java.lang.String">
SELECT * FROM atl_user WHERE webapp_open_id = #{webappOpenId}
</select>
<update id="updatePwd"> <update id="updatePwd">
UPDATE atl_user SET UPDATE atl_user SET
...@@ -180,15 +201,21 @@ ...@@ -180,15 +201,21 @@
<if test="signature != null"> <if test="signature != null">
signature, signature,
</if> </if>
<if test="signature != null">
signature,
</if>
<if test="loginDate != null"> <if test="loginDate != null">
login_date, login_date,
</if> </if>
<if test="appletOpenId != null"> <if test="officeOpenId != null and officeOpenId !=''">
office_open_id,
</if>
<if test="appletOpenId != null and appletOpenId !=''">
applet_open_id, applet_open_id,
</if> </if>
<if test="webappOpenId != null and webappOpenId !=''">
webapp_open_id,
</if>
<if test="unionid != null and unionid !='' ">
unionid,
</if>
create_time, is_sys_push, is_sc_push, is_rem_push create_time, is_sys_push, is_sc_push, is_rem_push
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -234,9 +261,18 @@ ...@@ -234,9 +261,18 @@
<if test="loginDate != null"> <if test="loginDate != null">
#{loginDate}, #{loginDate},
</if> </if>
<if test="appletOpenId != null"> <if test="officeOpenId != null and officeOpenId !='' ">
#{officeOpenId},
</if>
<if test="appletOpenId != null and appletOpenId !='' ">
#{appletOpenId}, #{appletOpenId},
</if> </if>
<if test="webappOpenId != null and webappOpenId !=''">
#{webappOpenId},
</if>
<if test="unionid != null and unionid !='' ">
#{unionid},
</if>
NOW(), '0', '0', '0' NOW(), '0', '0', '0'
</trim> </trim>
</insert> </insert>
...@@ -343,4 +379,8 @@ ...@@ -343,4 +379,8 @@
where create_user_id = #{userId} where create_user_id = #{userId}
</select> </select>
<select id="selectOneUserByMobilePhone" parameterType="java.lang.String" resultType="com.hwstudio.antaile.entity.AtlUser">
SELECT * FROM atl_user WHERE mobile_phone=#{mobilePhone}
</select>
</mapper> </mapper>
\ No newline at end of file
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