提交 7022fdae 编写于 作者: zhehao.chen's avatar zhehao.chen

Merge branch 'release' into 'master'

Release

See merge request !73
流水线 #36606 已失败 于阶段
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId>
<version>1.0.4.5</version>
<version>1.0.5.1</version>
<name>pica-cloud-account-client</name>
<packaging>jar</packaging>
......@@ -28,7 +28,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.9</version>
<version>1.0.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
......
package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.account.account.common.resp.DoctorUnionResp;
import com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -32,4 +33,8 @@ public interface AccountInfoClient {
@GetMapping(value = "/account/account/innerDoctors")
PicaResponse<List<Integer>> getDoctorsByInnerOrg();
@GetMapping(value = "/account/info/doctor/union")
PicaResponse<DoctorUnionResp> getDoctorByUnionid( @RequestParam(value = "unionid") String unionid);
}
......@@ -34,5 +34,6 @@ public interface RegisterClient {
@PostMapping(value = "/account/shop/acct")
PicaResponse<Map<String,Integer>> shopRegister(@RequestBody ShopAcctInitReq shopAcctInitReq, @RequestHeader(value = "token") String token);
@PostMapping("/account/account/login-register/v1")
PicaResponse<LoginResult> loginRegister(@RequestBody EncryptEntity entity);
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.9</version>
<version>1.0.2.0</version>
<name>pica-cloud-account-common</name>
<packaging>jar</packaging>
......
......@@ -2,9 +2,13 @@ package com.pica.cloud.account.account.common.req.circle;
public class DiyAcctInit {
private String userName;
private String userName; //真实姓名
private String decryMobile;
private String decryMobile; //明文手机
private String card; //明文 身份证
private String nativePlace; //身份证地址 可以为空
public String getUserName() {
return userName;
......@@ -21,4 +25,20 @@ public class DiyAcctInit {
public void setDecryMobile(String decryMobile) {
this.decryMobile = decryMobile;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card;
}
public String getNativePlace() {
return nativePlace;
}
public void setNativePlace(String nativePlace) {
this.nativePlace = nativePlace;
}
}
......@@ -4,6 +4,8 @@ import java.util.List;
public class DiyAcctInitReq {
private String code;
private List<String> decryMobileList;
private List<DiyAcctInit> diyAcctInitList;
......@@ -23,4 +25,12 @@ public class DiyAcctInitReq {
public void setDecryMobileList(List<String> decryMobileList) {
this.decryMobileList = decryMobileList;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.pica.cloud.account.account.common.resp;
import io.swagger.annotations.ApiModel;
/**
* 根据医生unionid查询医生是否存在
* @author wangxinxu
* @create 2020/12/28
*/
@ApiModel
public class DoctorUnionResp {
private Integer doctorId;
private Integer status;
public Integer getDoctorId() {
return doctorId;
}
public void setDoctorId(Integer doctorId) {
this.doctorId = doctorId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
......@@ -151,7 +151,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.9</version>
<version>1.0.2.0</version>
</dependency>
<dependency>
......@@ -226,7 +226,7 @@
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-proof-client</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
......@@ -253,6 +253,11 @@
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-message-client</artifactId>
<version>1.0.6-SNAPSHOT</version>
</dependency>
</dependencies>
<dependencyManagement>
......
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.account.account.common.resp.DoctorUnionResp;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.account.account.server.service.AccountInfoService;
import com.pica.cloud.account.account.server.service.WechatService;
......@@ -8,7 +9,6 @@ import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.service.starter.interceptor.EnabledLoginValidate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -66,4 +66,11 @@ public class AccountInfoController extends AccountBaseController {
return PicaResponse.toResponse(wechatService.getAccountWechatInfoBatch(docIds));
}
@ApiOperation(value = "根据unionid查看个人认证信息")
@GetMapping(value = "/doctor/union", produces = "application/json;charset=UTF-8")
public PicaResponse<DoctorUnionResp> getDoctorByUnionid(@RequestParam(value = "unionid") String unionid) {
DoctorUnionResp personalInfoDto = wechatService.getDoctorByUnionid(unionid);
return PicaResponse.toResponse(personalInfoDto);
}
}
......@@ -225,7 +225,7 @@ public class AutoCodeController extends AccountBaseController {
public PicaResponse getJigsawCode(@RequestBody EncryptEntity entity,
HttpServletRequest req) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
return PicaResponse.toResponse(authCodeService.getJigsawCode(req, super.getSourceType(), request.getMobile()));
return PicaResponse.toResponse(authCodeService.getJigsawCode(req, super.getSourceType(), request.getMobile(), request.getJigsawVersion()));
}
@ApiOperation("微信获取验证码")
......
......@@ -42,4 +42,10 @@ public class CircleUserController {
return PicaResponse.toResponse(circleAccountService.createDiyAccount(diyAcctInitReq));
}
@PostMapping("/acct/registerAndCertify")
@EnabledLoginValidate
public PicaResponse<List<Integer>> registerAndCertify(@RequestBody DiyAcctInitReq diyAcctInitReq) {
return PicaResponse.toResponse(circleAccountService.registerAndCertify(diyAcctInitReq));
}
}
......@@ -4,6 +4,7 @@ import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.req.DoctorReq;
import com.pica.cloud.account.account.server.req.RevertAcctsReq;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AccountUtils;
......@@ -60,6 +61,15 @@ public class DoctorController extends AccountBaseController {
return PicaResponse.toResponse();
}
@ApiOperation("注册完新用户 完善信息接口")
@PutMapping(value = "/register/welcome", produces = "application/json;charset=utf-8")
@EnabledLoginValidate
public PicaResponse registerWelcome(@RequestBody DoctorReq doctorReq) {
doctorReq.setId(fetchPicaUser().getId());
doctorService.registerWelcome(doctorReq);
return PicaResponse.toResponse();
}
/**
* 当前医生是哪个admin账户添加的
*
......
package com.pica.cloud.account.account.server.controller;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.AesBean.AesAuthCodeReq;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.entity.LogLoginAes;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.enums.SourceTypeEnum;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.req.OneClickLoginReq;
import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.LoginV1Service;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.account.account.server.util.RSAUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@Api(description = "登录注册相关接口 v1.0")
@RestController
@RequestMapping("v1/login")
public class LoginV1Controller extends AccountBaseController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private LoginV1Service loginV1Service;
@Autowired
private LoginService loginService;
@ApiOperation(value = "app端手机号码一键登录 v1")
@PostMapping("one_click")
public PicaResponse<LoginResult> oneClickLogin(@RequestBody AesAuthCodeReq aesReq) throws Exception {
EncryptEntity entity = new EncryptEntity();
entity.setKey(aesReq.getKey());
entity.setContent(aesReq.getContent());
OneClickLoginReq req = CryptoUtil.decrypt(entity, OneClickLoginReq.class);
req.setProductType(super.getProductType());
req.setSourceType(super.getSourceType());
req.setLoginIp(super.getIpAddr());
req.setUserTokenTourist(super.getUserTokenTourist());
logger.info("one-click req:{}", JSONObject.toJSONString(req));
LoginResult oneClickLoginResultVo = loginV1Service.oneClickLoginV1(req);
return PicaResponse.toResponse(oneClickLoginResultVo);
}
@ApiOperation(value = "手机号统一校验")
@PostMapping("/unifiedVerification")
public PicaResponse unifiedVerification(@RequestBody AesAuthCodeReq req) throws Exception {
EncryptEntity entity = new EncryptEntity();
entity.setKey(req.getKey());
entity.setContent(req.getContent());
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setSourceType(super.getSourceType());
logger.info("v1/login/unifiedVerification:{}", JSONObject.toJSONString(request));
loginV1Service.mobileValidate(request);
return PicaResponse.toResponse();
}
/**
* 密码登录接口(app、H5、web --> v1)
*
* @param authCodeReq
* @return
* @throws Exception
*/
@ApiOperation("密码登录接口")
@PostMapping("/password")
public PicaResponse<LoginResult> v1LoginPassword(@RequestBody AesAuthCodeReq authCodeReq) throws Exception {
EncryptEntity entity = new EncryptEntity();
entity.setKey(authCodeReq.getKey());
entity.setContent(authCodeReq.getContent());
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setProductType(super.getProductType());
Integer sourceType = super.getSourceType();
request.setSourceType(sourceType == null ? 0 : sourceType);
request.setLoginIp(super.getIpAddr());
request.setUserTokenTourist(super.getUserTokenTourist());
AccountUtils.checkMobilePhone(request.getMobile());
AccountUtils.checkPassword(request.getPassword());
LoginResult login = loginV1Service.v1LoginPassword(request);
if (SourceTypeEnum.SAAS.getCode().equals(sourceType)) {
login.setDoctorId("");
} else {
login.setUserId(null);
}
return PicaResponse.toResponse(login);
}
}
......@@ -24,6 +24,12 @@ public class Account {
@ApiModelProperty("认证状态 1未认证,2认证中,3认证通过,4认证不通过,5验证码认证,6 重新认证中,7 重新认证失败")
private Integer status;
private Integer certifyStatus;
private String nation;
private String nativePlace;
private String avatarImageUrl;
private String email;
......@@ -69,6 +75,30 @@ public class Account {
private Date birthday;
public String getNativePlace() {
return nativePlace;
}
public void setNativePlace(String nativePlace) {
this.nativePlace = nativePlace;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public Integer getCertifyStatus() {
return certifyStatus;
}
public void setCertifyStatus(Integer certifyStatus) {
this.certifyStatus = certifyStatus;
}
public Long getId() {
return id;
}
......
......@@ -34,6 +34,17 @@ public class AesAuthCodeReq {
*/
private String content;
// 是否需要校验该设备登录的手机号
private Boolean checkFlag = false;
public Boolean getCheckFlag() {
return checkFlag;
}
public void setCheckFlag(Boolean checkFlag) {
this.checkFlag = checkFlag;
}
public Integer getBizType() {
return bizType;
}
......
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class LogOneChlickCheck {
private Integer id;
private String deviceToken;
private String lastMobilePhone;
private String currMobilePhone;
private Boolean usedShanyan;
private String keepBack;
private Byte deleteFlag;
private Integer createdId;
private Date createdTime;
private Integer modifiedId;
private Date modifiedTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDeviceToken() {
return deviceToken;
}
public void setDeviceToken(String deviceToken) {
this.deviceToken = deviceToken == null ? null : deviceToken.trim();
}
public String getLastMobilePhone() {
return lastMobilePhone;
}
public void setLastMobilePhone(String lastMobilePhone) {
this.lastMobilePhone = lastMobilePhone == null ? null : lastMobilePhone.trim();
}
public String getCurrMobilePhone() {
return currMobilePhone;
}
public void setCurrMobilePhone(String currMobilePhone) {
this.currMobilePhone = currMobilePhone == null ? null : currMobilePhone.trim();
}
public Boolean getUsedShanyan() {
return usedShanyan;
}
public void setUsedShanyan(Boolean usedShanyan) {
this.usedShanyan = usedShanyan;
}
public String getKeepBack() {
return keepBack;
}
public void setKeepBack(String keepBack) {
this.keepBack = keepBack == null ? null : keepBack.trim();
}
public Byte getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Byte deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
}
\ No newline at end of file
......@@ -30,6 +30,45 @@ public class LoginResult {
@ApiModelProperty("accountinfo表主键id")
private Integer acctId;
private Boolean checkStatus = true;
private String suggestMessage;
private String differentMessage;
private String lastMobile;
public String getLastMobile() {
return lastMobile;
}
public void setLastMobile(String lastMobile) {
this.lastMobile = lastMobile;
}
public Boolean getCheckStatus() {
return checkStatus;
}
public void setCheckStatus(Boolean checkStatus) {
this.checkStatus = checkStatus;
}
public String getSuggestMessage() {
return suggestMessage;
}
public void setSuggestMessage(String suggestMessage) {
this.suggestMessage = suggestMessage;
}
public String getDifferentMessage() {
return differentMessage;
}
public void setDifferentMessage(String differentMessage) {
this.differentMessage = differentMessage;
}
public String getToken() {
return token;
......
......@@ -67,6 +67,9 @@ public enum AccountExceptionEnum {
PAT_QUERY_MAX("216558","查询参数过多"),
PICA_PASSWORD_RESET("216559", "您尚未设置密码,请退出登录后使用密码方式登录进行密码设置"),
MOBILE_NOT_REGISTER("216560", "手机号{mobile}尚未注册"),
PARAMS_BIZ_TYPE_EMPTY("216561", "参数bizType不能为空"),
PROOF_GET_FAIL("216562", "网络出了点问题,请稍后重试"),
xxx_xxx("","");
......
......@@ -27,6 +27,8 @@ public interface AccountMapper {
//根据手机号获取账号
Account getByMobilePhone(@Param("mobilePhone") String mobilePhone);
Account getByCard(@Param("card") String card);
//根据微信unionid获取账号
Account getByUnionid(@Param("unionid") String unionid);
......
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.common.resp.DoctorUnionResp;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.DoctorEntity;
import com.pica.cloud.account.account.server.entity.PICAPDoctor;
import com.pica.cloud.account.account.server.model.WechatInfoDto;
import org.apache.ibatis.annotations.Param;
......@@ -119,5 +119,7 @@ public interface DoctorMapper {
List<Integer> getDoctorsByInnerOrg(List<String> list);
DoctorUnionResp getDoctorByAcctId(Long acctId);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.LogOneChlickCheck;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface LogOneChlickCheckMapper {
int deleteByPrimaryKey(Integer id);
int insert(LogOneChlickCheck record);
int insertSelective(LogOneChlickCheck record);
LogOneChlickCheck selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(LogOneChlickCheck record);
int updateByPrimaryKey(LogOneChlickCheck record);
int insertOne(LogOneChlickCheck record);
}
\ No newline at end of file
......@@ -54,6 +54,16 @@ public class BaseRequest {
private Integer imageW;
@ApiModelProperty("用户本地token")
private String userTokenTourist;
@ApiModelProperty("拼图version")
private String jigsawVersion;
public String getJigsawVersion() {
return jigsawVersion;
}
public void setJigsawVersion(String jigsawVersion) {
this.jigsawVersion = jigsawVersion;
}
public String getUserTokenTourist() {
return userTokenTourist;
......
package com.pica.cloud.account.account.server.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class DoctorReq {
private Integer id;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("科室")
private String department;
@ApiModelProperty("职称")
private String title;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
......@@ -17,6 +17,27 @@ public class OneClickLoginReq {
private String userTokenTourist;
// 是否需要校验该设备登录的手机号
private Boolean checkFlag = false;
private String deviceToken;
public String getDeviceToken() {
return deviceToken;
}
public void setDeviceToken(String deviceToken) {
this.deviceToken = deviceToken;
}
public Boolean getCheckFlag() {
return checkFlag;
}
public void setCheckFlag(Boolean checkFlag) {
this.checkFlag = checkFlag;
}
public String getLoginIp() {
return loginIp;
}
......
......@@ -22,7 +22,7 @@ public interface AuthCodeService {
int validateJigsawCode(HttpServletRequest request, BaseRequest req);
JigsawCodeModel getJigsawCode(HttpServletRequest request, Integer sourceType, String mobile);
JigsawCodeModel getJigsawCode(HttpServletRequest request, Integer sourceType, String mobile, String jigsawVersion);
}
......@@ -24,4 +24,7 @@ public interface CircleAccountService {
Map<String,Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq);
// 注册 并且 实名认证用户,临时接口 todo
List<Integer> registerAndCertify(DiyAcctInitReq diyAcctInitReq);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.req.DoctorReq;
import java.util.List;
......@@ -26,6 +27,8 @@ public interface DoctorService {
*/
void modifyDoctorInfo(Doctor doctor,Long doctorId);
int registerWelcome(DoctorReq doctorReq);
/**
* 修改医生信息
*
......
......@@ -100,4 +100,5 @@ public interface LoginService {
int insertLoginAesLog(LogLoginAes aes);
LoginResult loginQRCode(BaseRequest request);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.LoginResult;
import com.pica.cloud.account.account.server.req.OneClickLoginReq;
import com.pica.cloud.account.account.server.req.BaseRequest;
public interface LoginV1Service {
LoginResult oneClickLoginV1(OneClickLoginReq req);
void mobileValidate(BaseRequest request);
LoginResult v1LoginPassword(BaseRequest request);
void insertLog(Integer userId, String currMobilePhone, String deviceToken, String keepBack);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.common.resp.DoctorUnionResp;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.foundation.utils.entity.PicaUser;
......@@ -12,4 +13,6 @@ public interface WechatService {
Map<Integer,String> getAccountWechatInfoBatch(List<Integer> docIds);
DoctorUnionResp getDoctorByUnionid(String unionid);
}
......@@ -287,7 +287,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
* @Return com.pica.cloud.account.account.server.model.JigsawCodeModel
*/
@Override
public JigsawCodeModel getJigsawCode(HttpServletRequest request, Integer sourceType, String mobile) {
public JigsawCodeModel getJigsawCode(HttpServletRequest request, Integer sourceType, String mobile, String jigsawVersion) {
if(!SourceTypeEnum.H5.getCode().equals(sourceType)) {
logger.error("getJigsawCode-h5 sourceType error");
throw new PicaWarnException(PicaResultCode.PARAM_IS_INVALID.code(), PicaResultCode.PARAM_IS_INVALID.message());
......@@ -304,12 +304,19 @@ public class AuthCodeServiceImpl implements AuthCodeService {
String key = Constants.JIGSAW_CODE_KEY.replace("{mobile}", mobile);
if (needCheck > 0) {
try {
if(null != jigsawVersion && jigsawVersion.equals("v1")){
// 新版获取 拼图(指定公司背景图)
picResp = sliderImageService.getPicV1();
}else {
picResp = sliderImageService.getPic();
}
logger.info("getJigsawCode-getPic-code:{}", picResp.getCode());
} catch (Exception e) {
logger.error("getJigsawCode-sliderImageService.getPic invoke exception", e.getMessage());
logger.error("getJigsawCode-getPic-code invoke exception:{}", e.getMessage());
// 记录该手机号调用接口获取拼图时接口报错
cacheClient.set(key, 100, Constants.JIGSAW_CODE_EXPIRE_SECONDS);
throw new PicaWarnException(AccountExceptionEnum.PROOF_GET_FAIL.getCode(),
AccountExceptionEnum.PROOF_GET_FAIL.getMessage());
}
if (Objects.nonNull(picResp)) {
if (!PicaResultCode.SUCCESS.code().equals(picResp.getCode())) {
......
......@@ -14,6 +14,8 @@ import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.account.account.server.service.CircleAccountService;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -21,10 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -50,24 +51,24 @@ public class CircleAccountServiceImpl implements CircleAccountService {
List<CircleAcctInit> circleAcctInits = circleAcctInitReq.getCircleAcctInitList();
List<Integer> savedIds = new ArrayList<>();
try {
for(CircleAcctInit acct : circleAcctInits){
for (CircleAcctInit acct : circleAcctInits) {
Account dbAcct = accountMapper.getByMobilePhone(acct.getEncryMobile()); //获取医生表账号信息
if(null == dbAcct){
if (null == dbAcct) {
Account account = new Account();
account.setName(acct.getUserName());
account.setNickname(acct.getUserName());
account.setMobilePhone(acct.getEncryMobile());
account.setRegisterSource(circleAcctInitReq.getRegisterSource());
accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
accountService.createAccount(account, AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
savedIds.add(account.getId().intValue());
logger.info("createCircleAccount insert {}",account.getId().intValue());
}else {
logger.info("createCircleAccount insert {}", account.getId().intValue());
} else {
savedIds.add(dbAcct.getId().intValue());
logger.info("createCircleAccount exist {}",dbAcct.getId().intValue());
logger.info("createCircleAccount exist {}", dbAcct.getId().intValue());
}
}
}catch (Exception e){
logger.error("createCircleAccount error:{}",e.getMessage());
} catch (Exception e) {
logger.error("createCircleAccount error:{}", e.getMessage());
throw e;
}
......@@ -79,44 +80,44 @@ public class CircleAccountServiceImpl implements CircleAccountService {
logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq));
List<Integer> savedIds = new ArrayList<>();
try {
if(CollectionUtils.isNotEmpty(diyAcctInitReq.getDecryMobileList())){
for(String decryMobile : diyAcctInitReq.getDecryMobileList()){
if (CollectionUtils.isNotEmpty(diyAcctInitReq.getDecryMobileList())) {
for (String decryMobile : diyAcctInitReq.getDecryMobileList()) {
String encryMobile = EncryptUtils.encryptContent(decryMobile, EncryptConstants.ENCRYPT_TYPE_MOBILE);
Account dbAcct = accountMapper.getByMobilePhone(encryMobile); //获取医生表账号信息
if(null == dbAcct){
if (null == dbAcct) {
Account account = new Account();
account.setMobilePhone(encryMobile);
account.setRegisterSource(5); //admin
accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
accountService.createAccount(account, AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
savedIds.add(account.getId().intValue());
logger.info("createDiyAccount insert {}",account.getId().intValue());
}else {
logger.info("createDiyAccount insert {}", account.getId().intValue());
} else {
savedIds.add(dbAcct.getId().intValue());
logger.info("createDiyAccount exist {}",dbAcct.getId().intValue());
logger.info("createDiyAccount exist {}", dbAcct.getId().intValue());
}
}
}else {
if(CollectionUtils.isNotEmpty(diyAcctInitReq.getDiyAcctInitList())){
for(DiyAcctInit acctInit : diyAcctInitReq.getDiyAcctInitList()){
} else {
if (CollectionUtils.isNotEmpty(diyAcctInitReq.getDiyAcctInitList())) {
for (DiyAcctInit acctInit : diyAcctInitReq.getDiyAcctInitList()) {
String encryMobile = EncryptUtils.encryptContent(acctInit.getDecryMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
Account dbAcct = accountMapper.getByMobilePhone(encryMobile); //获取医生表账号信息
if(null == dbAcct){
if (null == dbAcct) {
Account account = new Account();
account.setName(acctInit.getUserName());
account.setMobilePhone(encryMobile);
account.setRegisterSource(5); //admin
accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
accountService.createAccount(account, AccountTypeEnum.PRODUCT_TYPE_ECO_LIVE.getCode());
savedIds.add(account.getId().intValue());
logger.info("createDiyAccount insert {}",account.getId().intValue());
}else {
logger.info("createDiyAccount insert {}", account.getId().intValue());
} else {
savedIds.add(dbAcct.getId().intValue());
logger.info("createDiyAccount exist {}",dbAcct.getId().intValue());
logger.info("createDiyAccount exist {}", dbAcct.getId().intValue());
}
}
}
}
}catch (Exception e){
logger.error("createDiyAccount error:{}",e.getMessage());
} catch (Exception e) {
logger.error("createDiyAccount error:{}", e.getMessage());
throw e;
}
......@@ -124,38 +125,221 @@ public class CircleAccountServiceImpl implements CircleAccountService {
}
@Override
public Map<String,Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq) {
Map<String,Integer> rtnMap = new HashMap();
public Map<String, Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq) {
Map<String, Integer> rtnMap = new HashMap();
logger.info("createShopAccount:{}", JSONObject.toJSONString(shopAcctInitReq));
List<ShopAcctInit> shopAcctInits = shopAcctInitReq.getShopAcctInitList();
// List<Integer> savedIds = new ArrayList<>();
try {
for(ShopAcctInit acct : shopAcctInits){
for (ShopAcctInit acct : shopAcctInits) {
String encryMobile = EncryptUtils.encryptContent(acct.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
Account dbAcct = accountMapper.getByMobilePhone(encryMobile); //获取医生表账号信息
if(null == dbAcct){
if (null == dbAcct) {
Account account = new Account();
account.setName(acct.getUserName());
account.setNickname(acct.getUserName());
account.setMobilePhone(encryMobile);
account.setRegisterSource(shopAcctInitReq.getRegisterSource());
accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode());
accountService.createAccount(account, AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode());
// savedIds.add(account.getId().intValue());
logger.info("createShopAccount insert {}",account.getId().intValue());
rtnMap.put(acct.getMobile(),account.getId().intValue());
}else {
logger.info("createShopAccount insert {}", account.getId().intValue());
rtnMap.put(acct.getMobile(), account.getId().intValue());
} else {
// savedIds.add(dbAcct.getId().intValue());
logger.info("createShopAccount exist {}",dbAcct.getId().intValue());
rtnMap.put(acct.getMobile(),dbAcct.getId().intValue());
logger.info("createShopAccount exist {}", dbAcct.getId().intValue());
rtnMap.put(acct.getMobile(), dbAcct.getId().intValue());
}
}
}catch (Exception e){
logger.error("createShopAccount error:{}",e.getMessage());
} catch (Exception e) {
logger.error("createShopAccount error:{}", e.getMessage());
throw e;
}
return rtnMap;
}
@Transactional
@Override
public List<Integer> registerAndCertify(DiyAcctInitReq diyAcctInitReq) {
if(!diyAcctInitReq.getCode().equals("618")){
return null;
}
logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq));
List<Integer> savedIds = new ArrayList<>();
Map<Integer,DiyAcctInit> idCardMap = new HashMap<>();
try {
if (CollectionUtils.isNotEmpty(diyAcctInitReq.getDiyAcctInitList())) {
for (DiyAcctInit acctInit : diyAcctInitReq.getDiyAcctInitList()) {
if(!checkIdNum(acctInit.getCard())){
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号格式错误:" + acctInit.getCard());
}
String encryMobile = EncryptUtils.encryptContent(acctInit.getDecryMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
Account dbAcct = accountMapper.getByMobilePhone(encryMobile); //获取医生表账号信息
if (null == dbAcct) {
// 未注册时 注册用户
Account account = new Account();
account.setName(acctInit.getUserName()); // 真实姓名
account.setMobilePhone(encryMobile);
account.setRegisterSource(5); //admin
accountService.createAccount(account, AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode());
savedIds.add(account.getId().intValue());
idCardMap.put(account.getId().intValue(), acctInit); // 使用入参的card
logger.info("createDiyAccount insert {}", account.getId().intValue());
} else {
savedIds.add(dbAcct.getId().intValue());
idCardMap.put(dbAcct.getId().intValue(), acctInit); // 使用入参的card
logger.info("createDiyAccount exist {}", dbAcct.getId().intValue());
}
}
}
} catch (Exception e) {
logger.error("registerAndCertify error:{}", e.getMessage());
throw e;
}
// 对这批医生进行实名认证状态更新;
for(Integer id : savedIds){
try {
// check 身份证号是否已被他人使用
String encryCard = EncryptUtils.encryptContent(idCardMap.get(id).getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO);
logger.info(encryCard);
Account accountCard = accountMapper.getByCard(encryCard);
String encryMobile = EncryptUtils.encryptContent(idCardMap.get(id).getDecryMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
if(accountCard != null && !accountCard.getMobilePhone().equals(encryMobile)){
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号已被使用:" + idCardMap.get(id).getCard());
}
Account doctor = accountMapper.selectById(id);
boolean updateFlag = false;
if(doctor.getStatus() != null && doctor.getStatus() != 3){
doctor.setStatus(3);
updateFlag = true;
}
if(doctor.getCertifyStatus() != null && doctor.getCertifyStatus() != 3){
doctor.setCertifyStatus(3);
updateFlag = true;
}
if(!updateFlag){
continue;
}
doctor.setName(idCardMap.get(id).getUserName());
doctor.setNation("1");
Map map = getBirthdayAgeSex(idCardMap.get(id).getCard());
doctor.setSex(Integer.parseInt(map.get("sex").toString()));
doctor.setBirthday(getDateByStr(map.get("birthday").toString()));
doctor.setCard(encryCard);
doctor.setModifyId(Long.valueOf(134));
doctor.setNativePlace("接口导入");
accountMapper.updateByIdSelective(doctor);
} catch (NumberFormatException e) {
logger.error("registerAndCertify update error:{}", e.getMessage());
}
}
return savedIds;
}
public static void main(String[] args) {
Map map =getBirthdayAgeSex("310115198210277251");
System.out.println(map);
}
public static Date getDateByStr(String dateStr) {
try {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.parse(dateStr);
} catch (Exception e) {
logger.error("getDateByStr error:{}", e);
return new Date();
}
}
public static Map<String, String> getBirthdayAgeSex(String idCardNo) {
String birthday = "";
String age = "";
String sexCode = "";
int year = Calendar.getInstance().get(Calendar.YEAR);
char[] number = idCardNo.toCharArray();
boolean flag = true;
if (number.length == 15) {
for (int x = 0; x < number.length; x++) {
if (!flag){
return new HashMap<String, String>();
}
flag = Character.isDigit(number[x]);
}
} else if (number.length == 18) {
for (int x = 0; x < number.length - 1; x++) {
if (!flag){
return new HashMap<String, String>();
}
flag = Character.isDigit(number[x]);
}
}
if (flag && idCardNo.length() == 15) {
birthday = "19" + idCardNo.substring(6, 8) + "-"
+ idCardNo.substring(8, 10) + "-"
+ idCardNo.substring(10, 12);
sexCode = Integer.parseInt(idCardNo.substring(idCardNo.length() - 3, idCardNo.length())) % 2 == 0 ? "0" : "1";
age = (year - Integer.parseInt("19" + idCardNo.substring(6, 8))) + "";
} else if (flag && idCardNo.length() == 18) {
birthday = idCardNo.substring(6, 10) + "-"
+ idCardNo.substring(10, 12) + "-"
+ idCardNo.substring(12, 14);
sexCode = Integer.parseInt(idCardNo.substring(idCardNo.length() - 4, idCardNo.length() - 1)) % 2 == 0 ? "0" : "1";
age = (year - Integer.parseInt(idCardNo.substring(6, 10))) + "";
}
Map<String, String> map = new HashMap<String, String>();
map.put("birthday", birthday);
map.put("age", age);
map.put("sex", sexCode);
return map;
}
public static boolean checkIdNum(String cellValue) {
// 身份证校验
String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
boolean matches = cellValue.matches(regularExpression);
if (matches) {
if (cellValue.length() == 18) {
try {
char[] charArray = cellValue.toCharArray();
//前十七位加权因子
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
//这是除以11后,可能产生的11位余数对应的验证码
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
int sum = 0;
for (int i = 0; i < idCardWi.length; i++) {
int current = Integer.parseInt(String.valueOf(charArray[i]));
int count = current * idCardWi[i];
sum += count;
}
char idCardLast = charArray[17];
int idCardMod = sum % 11;
if (idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase())) {
matches = true;
} else {
System.out.println("身份证最后一位:" + String.valueOf(idCardLast).toUpperCase() +
"错误,正确的应该是:" + idCardY[idCardMod].toUpperCase());
matches = false;
}
} catch (Exception e) {
logger.error("checkIdNum", e);
}
}
}
return matches;
}
}
......@@ -8,11 +8,13 @@ import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.*;
import com.pica.cloud.account.account.server.req.DoctorReq;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaWarnException;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
......@@ -91,6 +93,30 @@ public class DoctorServiceImpl implements DoctorService {
accountInfoDetailMapper.updateByPrimaryKeySelective(accountInfoEntity);
}
@Override
public int registerWelcome(DoctorReq doctorReq) {
logger.info("registerWelcome req:{}", JSONObject.toJSONString(doctorReq));
Doctor doctor = doctorMapper.selectByPrimaryKey(doctorReq.getId());
if (null == doctor) {
throw new PicaWarnException(AccountExceptionEnum.PICA_PARAMS_ERROR.getCode(),
AccountExceptionEnum.PICA_PARAMS_ERROR.getMessage());
}
/*if(StringUtil.isNotNull(doctorReq.getDepartment())){
doctor.setDepartment(doctorReq.getDepartment());
}
if(StringUtil.isNotNull(doctorReq.getTitle())){
doctor.setTitle(doctorReq.getTitle());
}*/
if (StringUtil.isNotNull(doctorReq.getName())) {
doctor.setName(doctorReq.getName());
doctor.setModifyTime(new Date());
doctor.setModifyId(doctorReq.getId());
return doctorMapper.updateByPrimaryKeySelective(doctor);
}
return 0;
}
@Transactional
@Override
public void deleteDoctorInfo(Integer id, Long modifyId) {
......@@ -211,15 +237,15 @@ public class DoctorServiceImpl implements DoctorService {
@Override
public List<Integer> getDoctorsByInnerOrg() {
String ids = cacheClient.get(Constants.INNER_ORG_IDS);
if(StringUtil.isEmpty(ids)){
if (StringUtil.isEmpty(ids)) {
List<Integer> dbIds = doctorMapper.getDoctorsByInnerOrg(null);
String arrStr = "";
for(Integer i : dbIds){
for (Integer i : dbIds) {
arrStr = arrStr + i + ",";
}
cacheClient.setex(Constants.INNER_ORG_IDS,arrStr,3600);
cacheClient.setex(Constants.INNER_ORG_IDS, arrStr, 3600);
return dbIds;
}else {
} else {
List<Integer> rtnIds = Arrays.asList(ids.split(",")).stream().filter(s -> !"".equals(s)).map(s -> Integer.parseInt(s)).collect(Collectors.toList());
return rtnIds;
}
......
package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.enums.SourceTypeEnum;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.mapper.LogOneChlickCheckMapper;
import com.pica.cloud.account.account.server.model.OneClickProcessor;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.req.OneClickLoginReq;
import com.pica.cloud.account.account.server.service.LoginV1Service;
import com.pica.cloud.account.account.server.service.RegisterService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.IntactUtil;
import com.pica.cloud.account.account.server.util.TokenUtils;
import com.pica.cloud.foundation.completeness.client.utils.IntactUtils;
import com.pica.cloud.foundation.completeness.contract.constants.CommonConstants;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.entity.PicaWarnException;
import com.pica.cloud.foundation.message.client.EquipmentService;
import com.pica.cloud.foundation.message.common.req.DeviceReq;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class LoginV1ServiceImpl implements LoginV1Service {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private RegisterService registerService;
@Autowired
private OneClickProcessor oneClickProcessor;
@Autowired
private IntactUtil intactUtil;
@Autowired
private AccountUtils accountUtils;
@Autowired
private TokenUtils tokenUtils;
@Autowired
private DoctorMapper doctorInfoMapper;
@Autowired
private AccountLogUtils picaLogUtils;
@Autowired
private AccountInfoDetailMapper accountInfoMapper;
@Autowired
private ICacheClient cacheClient;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Qualifier("accountThreadPool")
@Autowired
private ThreadPoolTaskExecutor poolTaskExecutor;
@Autowired
private LogOneChlickCheckMapper logOneChlickCheckMapper;
@Autowired
private EquipmentService equipmentService;
/**
* 新版一键登录
*
* @param req
* @return
*/
@Override
public LoginResult oneClickLoginV1(OneClickLoginReq req) {
QueryMobileEntity queryMobileEntity = oneClickProcessor.tokenExchangeMobile(req.getToken(), req.getSourceType());
if (queryMobileEntity == null || StringUtils.isBlank(queryMobileEntity.getMobile()) || !ValidateUtils.isMobile(queryMobileEntity.getMobile())) {
logger.error("oneClickLoginV1 闪验获取出错-queryMobileEntity:{}", JSONObject.toJSONString(queryMobileEntity));
throw new PicaException(PicaResultCode.INTERFACE_INVOKE_EXCEPTION.code(), "获取手机号失败!");
}
queryMobileEntity.setSourceType(req.getSourceType());
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(queryMobileEntity.getMobile()));
BaseRequest baseRequest = new BaseRequest();
baseRequest.setMobile(queryMobileEntity.getMobile());
baseRequest.setSourceType(req.getSourceType());
baseRequest.setProductType(req.getProductType());
baseRequest.setLoginIp(req.getLoginIp());
baseRequest.setUserTokenTourist(req.getUserTokenTourist());
LoginResult result;
if (accountInfoEntity == null) {
//说明是注册功能
result = registerService.register(baseRequest, queryMobileEntity);
} else {
String deviceToken = req.getDeviceToken();
logger.info("oneClickLoginV1-用户传入的deviceToken为{}", JSONObject.toJSONString(baseRequest));
if (StringUtils.isEmpty(deviceToken)) {
throw new PicaException(PicaResultCode.PARAM_IS_BLANK.code(), PicaResultCode.PARAM_IS_BLANK.message());
}
// 根据deviceToken获取该设备上一次登录的手机号
Integer userId = getUserId(deviceToken);
logger.info("oneClickLoginV1-该设备上次登录的用户id为:{}", userId);
logger.info("oneClickLoginV1-accountInfoEntity, {}", JSONObject.toJSONString(accountInfoEntity));
if (req.getCheckFlag()) {
// 直接登录,不需要校验手机号(点击了继续一键登录)
logger.info("oneClickLoginV1-用户直接登录, {}", JSONObject.toJSONString(baseRequest));
result = processLoginV1(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_ONE_CLICK.getCode(), queryMobileEntity);
// 记录继续一键登录日志
Map<String, String> param = new HashMap();
param.put("req", JSONObject.toJSONString(req));
param.put("queryMobileEntity", JSONObject.toJSONString(queryMobileEntity));
param.put("accountInfoEntity", JSONObject.toJSONString(accountInfoEntity));
param.put("baseRequest", JSONObject.toJSONString(baseRequest));
poolTaskExecutor.execute(() -> insertLog(userId, queryMobileEntity.getMobile(), deviceToken, param.toString()));
} else {
// 第一次点"一键登录"接口,需要比对上次登录的手机号与这次是否一样
if (userId == null) {
// 直接登录
result = processLoginV1(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_ONE_CLICK.getCode(), queryMobileEntity);
} else {
// 根据userId获取手机号
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(userId);
if (doctor == null || StringUtils.isEmpty(doctor.getMobile_phone())) {
// 医生被删掉了,直接登录
result = processLoginV1(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_ONE_CLICK.getCode(), queryMobileEntity);
} else {
String mobilePhone = doctor.getMobile_phone();
mobilePhone = EncryptUtils.decryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY);
if (queryMobileEntity.getMobile().equals(mobilePhone)) {
// 手机号匹配,直接登录
result = processLoginV1(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_ONE_CLICK.getCode(), queryMobileEntity);
} else {
// 该设备本次登录手机号与上次登录手机号不是同一手机号,需用户进行确认
result = new LoginResult();
result.setCheckStatus(false);
result.setSuggestMessage("为保证学习记录完整,建议使用同一手机号进行登录");
result.setLastMobile(mobilePhone);
String begin = mobilePhone.substring(0, 3);
String end = mobilePhone.substring(7, 11);
String last = begin + "****" + end;
String differentMessage = "当前设备上次使用" + last + "登录";
result.setDifferentMessage(differentMessage);
}
}
}
}
}
return result;
}
@Override
public void insertLog(Integer userId, String currMobilePhone, String deviceToken, String keepBack) {
logger.info("oneClickLoginV1-继续一键登录日志入库");
// 获取上一次登录的手机号
String lastMobilePhone = "";
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(userId);
if (doctor != null) {
lastMobilePhone = doctor.getMobile_phone();
}
// 加密当前手机号
currMobilePhone = EncryptUtils.encryptContent(currMobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
LogOneChlickCheck logOneChlickCheck = new LogOneChlickCheck();
logOneChlickCheck.setCreatedId(99999999);
logOneChlickCheck.setModifiedId(99999999);
Date now = new Date();
logOneChlickCheck.setCreatedTime(now);
logOneChlickCheck.setModifiedTime(now);
logOneChlickCheck.setCurrMobilePhone(currMobilePhone);
logOneChlickCheck.setLastMobilePhone(lastMobilePhone);
logOneChlickCheck.setDeleteFlag((byte) 1);
logOneChlickCheck.setUsedShanyan(true);
logOneChlickCheck.setDeviceToken(deviceToken);
logOneChlickCheck.setKeepBack(keepBack);
logger.info("oneClickLoginV1-继续一键登录日志入库,{}", JSONObject.toJSONString(logOneChlickCheck));
logOneChlickCheckMapper.insertOne(logOneChlickCheck);
logger.info("oneClickLoginV1-继续一键登录日志入库完成");
}
private Integer getUserId(String deviceToken) {
Integer userId = null;
try {
DeviceReq req = new DeviceReq();
req.setDeviceToken(deviceToken);
PicaResponse<Integer> response= equipmentService.getUserIdByDeviceToken(req);
userId = response.getData();
} catch (Exception e) {
// 防止message服务出问题影响一键登录流程
logger.error("getUserId-调用message服务出错!");
e.printStackTrace();
}
return userId;
}
private LoginResult processLoginV1(BaseRequest baseRequest, Integer acctId, Integer loginType, QueryMobileEntity queryMobileEntity) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo, "processLoginV1", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
Date currentTime = new Date();
Long userId = accountUtils.getUserIdByAcctId(baseRequest.getProductType(), acctId);
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(baseRequest.getMobile());
account.setRegisterSource(baseRequest.getSourceType());
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setMobile(baseRequest.getMobile());
result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
//是否完善过个人信息(云鹊医app才需要)
if (baseRequest.getProductType() != AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue());
result.setEntireFlag(doctorEntity.getEntireFlag());
}
//记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode(), newToken, 1, baseRequest.getUserTokenTourist());
if (queryMobileEntity != null) {
entity.setQueryMobileEntity(queryMobileEntity);
}
picaLogUtils.info(entity);
intactUtil.sendIntact(batchNo, "processLoginV1", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
return result;
}
/**
* 手机号 统一check
*
* @param request
*/
@Override
public void mobileValidate(BaseRequest request) {
Integer bizType = request.getBizType();
String mobile = request.getMobile();
Integer sourceType = request.getSourceType();
if (null == bizType) {
logger.info("bizType is null");
throw new PicaWarnException(AccountExceptionEnum.PARAMS_BIZ_TYPE_EMPTY.getCode(),
AccountExceptionEnum.PARAMS_BIZ_TYPE_EMPTY.getMessage());
}
// 手机号规则校验
if (StringUtils.isNotEmpty(mobile) &&
!ValidateUtils.isMobile(mobile)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_REG_FALSE.getCode(),
AccountExceptionEnum.PICA_MOBILE_REG_FALSE.getMessage());
}
if (bizType.equals(3)) {
// 账户密码登录-step1-check mobile
// 手机号是否注册
AccountInfoEntity accountInfo = accountInfoMapper.selectByMobile(AESUtil.encryptV0(mobile));
if (accountInfo == null) {
throw new PicaWarnException(AccountExceptionEnum.MOBILE_NOT_REGISTER.getCode(),
AccountExceptionEnum.MOBILE_NOT_REGISTER.getMessage().replace("{mobile}", mobile));
}
// 手机号是否设置了密码
if (StringUtils.isEmpty(accountInfo.getPassword())) {
if (sourceType != null && SourceTypeEnum.H5.getCode().equals(sourceType)) {
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD_H5.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD_H5.getMessage());
} else {
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getMessage().replace("{mobile}", mobile));
}
}
}
}
/**
* v1 账户密码登录
*
* @param request
* @return
*/
@Override
public LoginResult v1LoginPassword(BaseRequest request) {
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo, "v1LoginPassword", CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "request:" + JSON.toJSONString(request));
String mobile = request.getMobile();
Integer sourceType = request.getSourceType();
String encrypt = AESUtil.encryptV0(mobile);
AccountInfoEntity accountInfoEntity = accountInfoMapper.selectByMobile(encrypt);
Doctor doctorInfo = doctorInfoMapper.getDoctorInfoByMobile(encrypt);
if (null == accountInfoEntity || null == doctorInfo) {
intactUtil.sendIntact(batchNo, "v1LoginPassword", CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "手机号" + mobile + "尚未注册");
throw new PicaWarnException(AccountExceptionEnum.MOBILE_NOT_REGISTER.getCode(),
AccountExceptionEnum.MOBILE_NOT_REGISTER.getMessage().replace("{mobile}", mobile));
} else {
String oldPwd = accountInfoEntity.getPassword();
String password = request.getPassword();
// db中账户 未设置密码
if (StringUtils.isEmpty(oldPwd)) {
if (sourceType != null && SourceTypeEnum.H5.getCode().equals(sourceType)) {
intactUtil.sendIntact(batchNo, "v1LoginPassword", CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD_H5.getMessage());
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD_H5.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD_H5.getMessage());
} else {
intactUtil.sendIntact(batchNo, "v1LoginPassword", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getMessage().replace("{mobile}", mobile));
throw new PicaException(AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getMessage()
.replace("{mobile}", mobile));
}
}
// 判断账号是否已锁
checkMobileIsLocked(mobile, sourceType, batchNo, "v1LoginPassword");
if (!password.equals(oldPwd)) {
//登录密码错误,次数计数、存cache
checkMobileErrorPasswordLogin(mobile, sourceType, batchNo, "v1LoginPassword");
} else {
intactUtil.sendIntact(batchNo, "v1LoginPassword", CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "接下来调用pwdLoginCorrect");
//密码登录-密码正确逻辑
return v1PwdLoginCorrect(request,mobile,doctorInfo);
}
}
return null;
}
/**
* ------------------- private -------------------
*/
/**
* 判断账号是否已锁
*
* @param mobile
*/
private void checkMobileIsLocked(String mobile, Integer sourceType, String batchNo, String batchMethod) {
String lockKey = Constants.ACCOUNT_LOCK_KEY.replace("{mobile}", mobile);
if (cacheClient.exists(lockKey)) {
if (sourceType != null && SourceTypeEnum.H5.getCode().equals(sourceType)) {
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getMessage());
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getMessage());
} else {
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_5.getMessage().replace("{mobile}", mobile));
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_5.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_5.getMessage().replace("{mobile}", mobile));
}
}
}
/**
* @param mobile
* @param sourceType
* @param batchNo
* @param batchMethod
*/
private void checkMobileErrorPasswordLogin(String mobile, Integer sourceType, String batchNo, String batchMethod) {
String lockKey = Constants.ACCOUNT_LOCK_KEY.replace("{mobile}", mobile);
String errorKey = Constants.PWD_ERROR_NUM_KEY.replace("{mobile}", mobile);
if (cacheClient.exists(errorKey)) {
int errorCount = Integer.parseInt(cacheClient.get(errorKey));
errorCount = errorCount + 1;
cacheClient.set(errorKey, errorCount, Constants.PWD_ERROR_NUM_SECONDS);
if (errorCount <= 4) {
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_4.getMessage());
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_4.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_4.getMessage());
} else {
// 设置账号锁定24h
cacheClient.set(lockKey, mobile, Constants.PWD_ERROR_NUM_SECONDS);
if (sourceType != null && SourceTypeEnum.H5.getCode().equals(sourceType)) {
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getMessage());
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_5_H5.getMessage());
} else {
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_5.getMessage().replace("{mobile}", mobile));
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_5.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_5.getMessage().replace("{mobile}", mobile));
}
}
} else {
cacheClient.set(errorKey, 1, Constants.PWD_ERROR_NUM_SECONDS);
intactUtil.sendIntact(batchNo, batchMethod, CommonConstants.INTACT_CONTENT_LOG_STATUS_3,
AccountExceptionEnum.PICA_PWD_MISMATCH_4.getMessage());
throw new PicaException(AccountExceptionEnum.PICA_PWD_MISMATCH_4.getCode(),
AccountExceptionEnum.PICA_PWD_MISMATCH_4.getMessage());
}
}
/**
* @Description 密码登录-密码正确逻辑
*/
private LoginResult v1PwdLoginCorrect(BaseRequest request, String mobile, Doctor doctor) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo, "v1PwdLoginCorrect", CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "baseRequest:" + JSON.toJSONString(request));
Date currentTime = new Date();
Integer acctId = doctor.getAcctId();
int productType = request.getProductType();
int sourceType = request.getSourceType();
Integer userId = doctor.getId();
Account account = new Account();
account.setId(userId.longValue());
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId.longValue());
result.setMobile(mobile);
result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
result.setEntireFlag(doctor.getEntireFlag());
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, productType, sourceType,
AccountTypeEnum.LOGIN_PWD.getCode(), request.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(),
AccountTypeEnum.LOG_TYPE_LOGIN.getCode(), newToken, 1, request.getUserTokenTourist());
picaLogUtils.info(entity);
// 密码登录成功以后,清除错误次数记录
String pwdErrorNum = Constants.PWD_ERROR_NUM_KEY.replace("{mobile}", mobile);
if (cacheClient.exists(pwdErrorNum)) {
cacheClient.del(pwdErrorNum);
}
intactUtil.sendIntact(batchNo, "v1PwdLoginCorrect", CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "baseRequest:" + JSON.toJSONString(request));
return result;
}
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.common.resp.DoctorUnionResp;
import com.pica.cloud.account.account.server.entity.AccountUnionEntity;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.account.account.server.mapper.AccountWeChatInfoMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.model.WechatInfoDto;
import com.pica.cloud.account.account.server.service.AccountUnionService;
import com.pica.cloud.account.account.server.service.WechatService;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import io.swagger.models.auth.In;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
......@@ -28,6 +27,9 @@ public class WechatServiceImpl implements WechatService {
@Autowired
private AccountWeChatInfoMapper weChatInfoMapper;
@Autowired
private AccountUnionService accountUnionService;
@Override
public AccountWeChatInfoEntity getAccountWechatInfo(PicaUser user) {
String unionId = doctorMapper.getUnionIdByDoctorId(user.getId());
......@@ -72,4 +74,14 @@ public class WechatServiceImpl implements WechatService {
return doctorOpenMap;
}
@Override
public DoctorUnionResp getDoctorByUnionid(String unionid){
AccountUnionEntity accountUnionEntity = accountUnionService.selectInfoByUnionId(unionid);
DoctorUnionResp doctorUnionfoModel = new DoctorUnionResp();
if (StringUtil.isNotNull(accountUnionEntity)) {
doctorUnionfoModel = doctorMapper.getDoctorByAcctId(accountUnionEntity.getAcctId());
}
return doctorUnionfoModel;
}
}
......@@ -188,6 +188,8 @@ public class AESUtil {
public static void main(String[] args) throws Exception {
// String content = AESUtil.aesDecrypt(encryptEntity.getContent(),decryptKey);
String KEY="111";
System.out.println("-------------加密---------");
......
......@@ -9,6 +9,7 @@
<!-- <classPathEntry location="/Users/wangyongbo/Downloads/software/mysql-connector-java-5.1.39.jar"/>-->
<!-- <classPathEntry location="D:\programer\reponsitory\maven\mysql\mysql-connector-java\5.1.39\mysql-connector-java-5.1.39.jar"/>-->
<!--<classPathEntry location="E:\mysql_jar/mysql-connector-java-5.1.39.jar"/>-->
<classPathEntry location="/Users/zhoupengcheng/mysql_jar/mysql-connector-java-5.1.49.jar"/>
<context id="tableEntity" targetRuntime="MyBatis3">
<commentGenerator>
......@@ -43,6 +44,7 @@
<!-- <table tableName="account_apple_info" domainObjectName="AccountAppleInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!-- <table tableName="account_pat_family_record" domainObjectName="AccountPatFamilyRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<table tableName="log_one_chlick_check" domainObjectName="LogOneChlickCheck" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
......
......@@ -9,6 +9,8 @@
<result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
<result column="acct_id" jdbcType="INTEGER" property="acctId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="certify_status" jdbcType="INTEGER" property="certifyStatus" />
<result column="nation" jdbcType="VARCHAR" property="nation" />
<result column="avatar_image_url" jdbcType="VARCHAR" property="avatarImageUrl" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="qrcode" jdbcType="VARCHAR" property="qrcode" />
......@@ -34,7 +36,7 @@
</resultMap>
<sql id="Base_Column_List">
id, sex, name, mobile_phone, status, avatar_image_url, email, qrcode, nickname, personal_sign, delete_flag,
id, sex, name, mobile_phone, status, certify_status, nation, avatar_image_url, email, qrcode, nickname, personal_sign, delete_flag,
creat_id, creat_time, modify_id, modify_time, password, info, entire_flag, reg_time, last_login_time,
unionid, register_source, comment, register_type, first_login_time, card, birthday
</sql>
......@@ -213,6 +215,18 @@
<update id="updateByIdSelective" parameterType="com.pica.cloud.account.account.server.entity.Account">
update p_doctor
<set>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="certifyStatus != null">
certify_status = #{certifyStatus,jdbcType=INTEGER},
</if>
<if test="nation != null">
nation = #{nation,jdbcType=VARCHAR},
</if>
<if test="nativePlace != null">
native_place = #{nativePlace,jdbcType=VARCHAR},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
......@@ -307,6 +321,14 @@
limit 1
</select>
<select id="getByCard" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from p_doctor
where card = #{card} and delete_flag = 1
limit 1
</select>
<select id="getHospitalInfoByPage" resultType="map">
select id, hospital_id, hospital,mobile_phone,name,
status, avatar_image_url, email,
......
......@@ -126,7 +126,7 @@
select
<include refid="Base_Column_List"/>
from p_doctor
where id = #{id} and delete_flag=1
where id = #{id} and delete_flag = 1
</select>
<!--删除用户-->
......@@ -1087,5 +1087,10 @@
select id from p_doctor where (hospital like ('云鹊%') or hospital LIKE ('测试%')) and delete_flag = 1;
</select>
<select id="getDoctorByAcctId" resultType="com.pica.cloud.account.account.common.resp.DoctorUnionResp" parameterType="java.lang.Long">
select d.id as doctorId, d.status
from p_doctor d
where d.acct_id = #{acctId} and d.delete_flag = 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.LogOneChlickCheckMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="device_token" property="deviceToken" jdbcType="VARCHAR" />
<result column="last_mobile_phone" property="lastMobilePhone" jdbcType="VARCHAR" />
<result column="curr_mobile_phone" property="currMobilePhone" jdbcType="VARCHAR" />
<result column="used_shanyan" property="usedShanyan" jdbcType="BIT" />
<result column="keep_back" property="keepBack" jdbcType="VARCHAR" />
<result column="delete_flag" property="deleteFlag" jdbcType="TINYINT" />
<result column="created_id" property="createdId" jdbcType="INTEGER" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" />
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, device_token, last_mobile_phone, curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log_one_chlick_check
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log_one_chlick_check
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
insert into log_one_chlick_check (id, device_token, last_mobile_phone,
curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{id,jdbcType=INTEGER}, #{deviceToken,jdbcType=VARCHAR}, #{lastMobilePhone,jdbcType=VARCHAR},
#{currMobilePhone,jdbcType=VARCHAR}, #{usedShanyan,jdbcType=BIT}, #{keepBack,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=TINYINT}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
insert into log_one_chlick_check
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="deviceToken != null" >
device_token,
</if>
<if test="lastMobilePhone != null" >
last_mobile_phone,
</if>
<if test="currMobilePhone != null" >
curr_mobile_phone,
</if>
<if test="usedShanyan != null" >
used_shanyan,
</if>
<if test="keepBack != null" >
keep_back,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createdId != null" >
created_id,
</if>
<if test="createdTime != null" >
created_time,
</if>
<if test="modifiedId != null" >
modified_id,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="deviceToken != null" >
#{deviceToken,jdbcType=VARCHAR},
</if>
<if test="lastMobilePhone != null" >
#{lastMobilePhone,jdbcType=VARCHAR},
</if>
<if test="currMobilePhone != null" >
#{currMobilePhone,jdbcType=VARCHAR},
</if>
<if test="usedShanyan != null" >
#{usedShanyan,jdbcType=BIT},
</if>
<if test="keepBack != null" >
#{keepBack,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=TINYINT},
</if>
<if test="createdId != null" >
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
update log_one_chlick_check
<set >
<if test="deviceToken != null" >
device_token = #{deviceToken,jdbcType=VARCHAR},
</if>
<if test="lastMobilePhone != null" >
last_mobile_phone = #{lastMobilePhone,jdbcType=VARCHAR},
</if>
<if test="currMobilePhone != null" >
curr_mobile_phone = #{currMobilePhone,jdbcType=VARCHAR},
</if>
<if test="usedShanyan != null" >
used_shanyan = #{usedShanyan,jdbcType=BIT},
</if>
<if test="keepBack != null" >
keep_back = #{keepBack,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=TINYINT},
</if>
<if test="createdId != null" >
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
update log_one_chlick_check
set device_token = #{deviceToken,jdbcType=VARCHAR},
last_mobile_phone = #{lastMobilePhone,jdbcType=VARCHAR},
curr_mobile_phone = #{currMobilePhone,jdbcType=VARCHAR},
used_shanyan = #{usedShanyan,jdbcType=BIT},
keep_back = #{keepBack,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=TINYINT},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insertOne" parameterType="com.pica.cloud.account.account.server.entity.LogOneChlickCheck" >
insert into log_one_chlick_check (device_token, last_mobile_phone,
curr_mobile_phone, used_shanyan, keep_back,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{deviceToken,jdbcType=VARCHAR}, #{lastMobilePhone,jdbcType=VARCHAR},
#{currMobilePhone,jdbcType=VARCHAR}, #{usedShanyan,jdbcType=BIT}, #{keepBack,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=TINYINT}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
</mapper>
\ No newline at end of file
// Copyright 2016-2101 Pica.
package pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.App;
import com.pica.cloud.account.account.server.service.LoginV1Service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @ClassName AutoCodeControllerTest
* @Description
* @Author Chongwen.jiang
* @Date 2020/4/3 14:31
* @ModifyDate 2020/4/3 14:31
* @Version 1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest (classes = App.class)
public class OneClickTest {
@Autowired
LoginV1Service loginV1Service;
@Test
public void test() {
loginV1Service.insertLog(1000005511, "13073690113", "161a397c8bc807ed97",
"{baseRequest={\\\"flag\\\":0,\\\"loginIp\\\":\\\"172.25.36.64\\\",\\\"mobile\\\":\\\"13073690113\\\",\\\"productType\\\":1,\\\"sourceType\\\":2,\\\"userTokenTourist\\\":\\\"06388870914559557010\\\"}, accountInfoEntity={\\\"age\\\":0,\\\"createdId\\\":49,\\\"createdTime\\\":1586336527000,\\\"deleteFlag\\\":1,\\\"id\\\":49,\\\"mobilePhone\\\":\\\"N/rge2EqV+KgL+li6YBfag==\\\",\\\"modifiedId\\\":49,\\\"modifiedTime\\\":1606982710000,\\\"name\\\":\\\"\\\",\\\"password\\\":\\\"F6127053CB61F3A162F79C031302EAA9\\\",\\\"regTime\\\":1586336527000,\\\"registerProduct\\\":1,\\\"registerSource\\\":1,\\\"sex\\\":0}, queryMobileEntity={\\\"chargeStatus\\\":1,\\\"code\\\":\\\"200000\\\",\\\"data\\\":{\\\"mobileName\\\":\\\"8A7285AA29407E465B2E89053D32FB2E\\\",\\\"tradeNo\\\":\\\"790607755953070080\\\"},\\\"message\\\":\\\"成功\\\",\\\"mobile\\\":\\\"13073690113\\\",\\\"sourceType\\\":2}, req={\\\"checkFlag\\\":true,\\\"deviceToken\\\":\\\"161a3797c8bc807ed97\\\",\\\"loginIp\\\":\\\"172.25.36.64\\\",\\\"productType\\\":1,\\\"sourceType\\\":2,\\\"token\\\":\\\"A4-PAYG_0uR5Q3IeSPcQaN9mPZs20iUJPGDxQWMcNiipcrrsuN-fkr0R3dZad4_c_o5vMRFIfQo0oJiE5owd6-xN8f71byCQ8FIFuWKnxj_1AvoGrrmXBmYNu4bwA4Cinw247d_42lC6bxPxB9d-Bnl8SqBNdqX3HHWYTCtswZaT9Ig2H-9R6j9vaa4yMo9DX5mAUVJMNMQi58NcbfpcSnxPw==\\\",\\\"userTokenTourist\\\":\\\"06388870914559557010\\\"}}");
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册