提交 f4e9e4f9 编写于 作者: rushui.chen's avatar rushui.chen

20191128 解决冲突

流水线 #17902 已失败 于阶段
in 0 second
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId> <artifactId>pica-cloud-account-client</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
<name>pica-cloud-account-client</name> <name>pica-cloud-account-client</name>
<packaging>jar</packaging> <packaging>jar</packaging>
......
package com.pica.cloud.account.account.client;
import com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author andong
* @create 2019/7/19
*/
@FeignClient(name = "13201-pica-cloud-account")
public interface CaptchaClient {
@GetMapping("/account/account/acknowledge")
PicaResponse<Boolean> acknowledge(@RequestParam("captchaToken") String captchaToken,
@RequestParam("captchaAnswer") String captchaAnswer);
}
...@@ -168,6 +168,11 @@ ...@@ -168,6 +168,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
package com.pica.cloud.account.account.server; package com.pica.cloud.account.account.server;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.EncryptEntity; import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest; import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.req.PatientReq;
import com.pica.cloud.account.account.server.util.AESUtil; import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.RSAUtil; import com.pica.cloud.account.account.server.util.RSAUtil;
import org.springframework.boot.autoconfigure.SpringBootApplication;
public class Test { public class Test {
...@@ -79,20 +76,36 @@ public class Test { ...@@ -79,20 +76,36 @@ public class Test {
// String encryptEntity1Json = JSONObject.toJSONString(encryptEntity1); // String encryptEntity1Json = JSONObject.toJSONString(encryptEntity1);
// System.out.println(encryptEntity1Json); // System.out.println(encryptEntity1Json);
System.out.println("--------------------登录接口-------------"); // System.out.println("--------------------登录接口-------------");
//<<<<<<< HEAD
String publicKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB"; String publicKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB";
BaseRequest login = new BaseRequest(); // BaseRequest login = new BaseRequest();
login.setMobile("13024112588"); // login.setMobile("13024112588");
login.setPassword("d0dcbf0d12a6b1e7fbfa2ce5848f3eff"); // login.setPassword("d0dcbf0d12a6b1e7fbfa2ce5848f3eff");
String con = JSONObject.toJSONString(login); //=======
//
String contentResult = AESUtil.aesEncrypt(con, "YCPQPx4qpQjEjDea"); // BaseRequest login = new BaseRequest();
// login.setMobile("13024112588");
String keyResult = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey); // login.setPassword("d0dcbf0d12a6b1e7fbfa2ce5848f3eff"); //qq123456
EncryptEntity encryptTest = new EncryptEntity(); //>>>>>>> dev-sensitive-20191112
encryptTest.setContent(contentResult); // String con = JSONObject.toJSONString(login);
encryptTest.setKey(keyResult); // //通过十六位随机数对参数明文进行加密 contentResult
System.out.println(JSONObject.toJSONString(encryptTest)); // String contentResult = AESUtil.aesEncrypt(con, "YCPQPx4qpQjEjDea"); //十六位随机数
//
//<<<<<<< HEAD
// String contentResult = AESUtil.aesEncrypt(con, "YCPQPx4qpQjEjDea");
//
// String keyResult = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
//=======
// String publicKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB";
// //拿到RAS公钥,对上面的随机数进行加密
// String keyResult = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
//
//>>>>>>> dev-sensitive-20191112
// EncryptEntity encryptTest = new EncryptEntity();
// encryptTest.setContent(contentResult);
// encryptTest.setKey(keyResult);
// System.out.println(JSONObject.toJSONString(encryptTest));
System.out.println("--------------------修改密码接口-------------"); System.out.println("--------------------修改密码接口-------------");
BaseRequest changePwd = new BaseRequest(); BaseRequest changePwd = new BaseRequest();
...@@ -197,8 +210,6 @@ public class Test { ...@@ -197,8 +210,6 @@ public class Test {
changeMobileEntity.setKey(changeMobileKey); changeMobileEntity.setKey(changeMobileKey);
changeMobileEntity.setContent(changeMobileContent); changeMobileEntity.setContent(changeMobileContent);
System.out.println(JSONObject.toJSONString(changeMobileEntity)); System.out.println(JSONObject.toJSONString(changeMobileEntity));
} }
......
...@@ -34,14 +34,14 @@ public class CaptchaController { ...@@ -34,14 +34,14 @@ public class CaptchaController {
return PicaResponse.toResponse(captchaToken); return PicaResponse.toResponse(captchaToken);
} }
/*
@ApiOperation("校验图形验证码") @ApiOperation("校验图形验证码")
@GetMapping("/acknowledge") @GetMapping("/acknowledge")
public PicaResponse<Boolean> acknowledge(@ApiParam("token") @RequestParam("token") String token, public PicaResponse<Boolean> acknowledge(@ApiParam("captchaToken") @RequestParam("captchaToken") String captchaToken,
@ApiParam("answer") @RequestParam("answer") String answer) { @ApiParam("captchaAnswer") @RequestParam("captchaAnswer") String captchaAnswer) {
boolean valid = captchaService.acknowledge(token, answer); boolean valid = captchaService.acknowledge(captchaToken, captchaAnswer);
return PicaResponse.toResponse(valid); return PicaResponse.toResponse(valid);
} }
*/
} }
package com.pica.cloud.account.account.server.controller; package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.RSAUtil; import com.pica.cloud.account.account.server.util.RSAUtil;
import com.pica.cloud.foundation.entity.PicaResponse; import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -7,6 +8,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -7,6 +8,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
...@@ -27,4 +30,17 @@ public class CipherController { ...@@ -27,4 +30,17 @@ public class CipherController {
return PicaResponse.toResponse(rsaPublicKey); return PicaResponse.toResponse(rsaPublicKey);
} }
/**
* todo:上线前需要注释掉
* @param key
* @return
* @throws Exception
*/
@ApiOperation("解密操作")
@GetMapping(value = "/cipher/decrypt")
public PicaResponse<String> decryptPublicKey(@RequestParam String key) throws Exception {
return PicaResponse.toResponse(RSAUtil.decrypt(key, AESUtil.privateKey));
}
} }
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Api(description = "登录资源") @Api(description = "登录资源")
...@@ -120,16 +121,18 @@ public class LoginController extends AccountBaseController { ...@@ -120,16 +121,18 @@ public class LoginController extends AccountBaseController {
@PostMapping("/login/wechat/bind") @PostMapping("/login/wechat/bind")
public PicaResponse bindWeChat(@RequestBody EncryptEntity entity) throws Exception { public PicaResponse bindWeChat(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class); BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setAccId(super.getAcctId()); long doctorId = super.getDoctorIdByToken();
loginService.bindWeChat(request); String nickname = loginService.bindWeChat(doctorId, request);
return PicaResponse.toResponse(); Map<String, String> map = new HashMap();
map.put("nickname", nickname);
return PicaResponse.toResponse(map);
} }
@ApiOperation("微信解除绑定接口") @ApiOperation("微信解除绑定接口")
@PutMapping("/login/wechat/unbind") @PutMapping("/login/wechat/unbind")
public PicaResponse unbindWeChat() { public PicaResponse unbindWeChat() {
Integer acctId = super.getAcctId(); long doctorId = super.getDoctorIdByToken();
loginService.unbindWeChat(acctId); loginService.unbindWeChat(doctorId);
return PicaResponse.toResponse(); return PicaResponse.toResponse();
} }
......
package com.pica.cloud.account.account.server.entity; package com.pica.cloud.account.account.server.entity;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.pica.cloud.account.account.server.util.AESUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -14,14 +15,16 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -14,14 +15,16 @@ import io.swagger.annotations.ApiModelProperty;
public class LoginResult { public class LoginResult {
@ApiModelProperty("token") @ApiModelProperty("token")
private String token; private String token;
@ApiModelProperty("用户id") @ApiModelProperty("用户id,已经加密处理")
private Long userId; private String userId;
@ApiModelProperty("是否绑定") @ApiModelProperty("是否绑定")
private String bindFlag; private String bindFlag;
@ApiModelProperty("联合登录id") @ApiModelProperty("联合登录id")
private String unionId; private String unionId;
@ApiModelProperty("是否完善过信息,1.信息未补全, 2信息已补全,3已补全密码") @ApiModelProperty("是否完善过信息,1.信息未补全, 2信息已补全,3已补全密码")
private int entireFlag; private int entireFlag;
@ApiModelProperty("未加密手机号")
private String mobile;
public String getToken() { public String getToken() {
return token; return token;
...@@ -31,12 +34,12 @@ public class LoginResult { ...@@ -31,12 +34,12 @@ public class LoginResult {
this.token = token; this.token = token;
} }
public Long getUserId() { public String getUserId() {
return userId; return userId;
} }
public void setUserId(Long userId) { public void setUserId(String userId) {
this.userId = userId; this.userId = AESUtil.encryptV0(userId);
} }
public String getBindFlag() { public String getBindFlag() {
...@@ -62,4 +65,12 @@ public class LoginResult { ...@@ -62,4 +65,12 @@ public class LoginResult {
public void setEntireFlag(int entireFlag) { public void setEntireFlag(int entireFlag) {
this.entireFlag = entireFlag; this.entireFlag = entireFlag;
} }
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
} }
...@@ -25,7 +25,8 @@ public enum AccountExceptionEnum { ...@@ -25,7 +25,8 @@ public enum AccountExceptionEnum {
PICA_PARAMS_ERROR("216517", "传递参数有误"), PICA_PARAMS_ERROR("216517", "传递参数有误"),
PICA_SYSCODE_RETRY("216518", "请X秒后重试"), PICA_SYSCODE_RETRY("216518", "请X秒后重试"),
PICA_NOT_EXIST("216519", "该用户不存在"), PICA_NOT_EXIST("216519", "该用户不存在"),
PICA_REGISTER_FAIL("216520", "注册失败"); PICA_REGISTER_FAIL("216520", "注册失败"),
PICA_WECHAT_CODE_ERROR("216521", "微信登录授权code不正确");
private String code; private String code;
......
...@@ -25,5 +25,6 @@ public class AccountRepeatDataJob extends IJobHandler { ...@@ -25,5 +25,6 @@ public class AccountRepeatDataJob extends IJobHandler {
accountInfoDetailMapper.processAccountRepeatData(); accountInfoDetailMapper.processAccountRepeatData();
XxlJobLogger.log("AccountRepeatDataJob"); XxlJobLogger.log("AccountRepeatDataJob");
return SUCCESS; return SUCCESS;
} }
} }
...@@ -92,4 +92,6 @@ public interface DoctorMapper { ...@@ -92,4 +92,6 @@ public interface DoctorMapper {
* @return * @return
*/ */
//Long selectDoctorIdByMobile(String mobile); //Long selectDoctorIdByMobile(String mobile);
Integer getAcctIdByDoctorId(long id);
} }
\ No newline at end of file
...@@ -39,9 +39,9 @@ public interface LoginService { ...@@ -39,9 +39,9 @@ public interface LoginService {
/** /**
* 解除绑定 * 解除绑定
* *
* @param acctId 账户id * @param doctorId 账户id
*/ */
void unbindWeChat(Integer acctId); void unbindWeChat(long doctorId);
/** /**
...@@ -49,7 +49,7 @@ public interface LoginService { ...@@ -49,7 +49,7 @@ public interface LoginService {
* *
* @param request 参数模型 * @param request 参数模型
*/ */
void bindWeChat(BaseRequest request); String bindWeChat(long doctorId, BaseRequest request);
PICAPDoctor queryDoctor(long doctorId); PICAPDoctor queryDoctor(long doctorId);
} }
...@@ -122,7 +122,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -122,7 +122,8 @@ public class LoginServiceImpl implements LoginService {
String newToken = tokenUtils.generateToken(account); String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult(); LoginResult result = new LoginResult();
result.setToken(newToken); result.setToken(newToken);
result.setUserId(userId.longValue()); result.setUserId(userId+"");
result.setMobile(mobile);
if (productType == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) { if (productType == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
result.setEntireFlag(doctorInfo.getEntireFlag()); result.setEntireFlag(doctorInfo.getEntireFlag());
} }
...@@ -170,7 +171,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -170,7 +171,8 @@ public class LoginServiceImpl implements LoginService {
String newToken = tokenUtils.generateToken(account); String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult(); LoginResult result = new LoginResult();
result.setToken(newToken); result.setToken(newToken);
result.setUserId(userId); result.setUserId(userId+"");
result.setMobile(baseRequest.getMobile());
//是否完善过个人信息(云鹊医app才需要) //是否完善过个人信息(云鹊医app才需要)
if (baseRequest.getProductType() == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) { if (baseRequest.getProductType() == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue()); Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue());
...@@ -179,7 +181,6 @@ public class LoginServiceImpl implements LoginService { ...@@ -179,7 +181,6 @@ public class LoginServiceImpl implements LoginService {
//记录登录日志 //记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(), LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode()); loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
;
picaLogUtils.info(entity); picaLogUtils.info(entity);
return result; return result;
} }
...@@ -187,6 +188,9 @@ public class LoginServiceImpl implements LoginService { ...@@ -187,6 +188,9 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
public LoginResult loginByWeChat(BaseRequest request) { public LoginResult loginByWeChat(BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode()); WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
if (weChatEntity == null || StringUtils.isEmpty(weChatEntity.getOpenid()) || StringUtils.isEmpty(weChatEntity.getAccess_token())) {
throw new PicaException(AccountExceptionEnum.PICA_WECHAT_CODE_ERROR.getCode(), AccountExceptionEnum.PICA_WECHAT_CODE_ERROR.getMessage());
}
//todo:微信登录获取个人信息 //todo:微信登录获取个人信息
Map map = new HashMap(); Map map = new HashMap();
map.put("access_token", weChatEntity.getAccess_token()); map.put("access_token", weChatEntity.getAccess_token());
...@@ -209,8 +213,13 @@ public class LoginServiceImpl implements LoginService { ...@@ -209,8 +213,13 @@ public class LoginServiceImpl implements LoginService {
String newToken = tokenUtils.generateToken(account); String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult(); LoginResult result = new LoginResult();
result.setToken(newToken); result.setToken(newToken);
result.setUserId(userId); result.setUserId(userId+"");
result.setBindFlag(AccountTypeEnum.BIND_STATUS_SUCCESS.getCode()+""); result.setBindFlag(AccountTypeEnum.BIND_STATUS_SUCCESS.getCode()+"");
if (request.getProductType() == AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()) {
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(userId);
result.setEntireFlag(doctor.getEntire_flag());
result.setMobile(AESUtil.decryptV0(doctor.getMobile_phone()));
}
return result; return result;
} else { } else {
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId); AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
...@@ -233,10 +242,9 @@ public class LoginServiceImpl implements LoginService { ...@@ -233,10 +242,9 @@ public class LoginServiceImpl implements LoginService {
result = registerService.register(request); result = registerService.register(request);
if (doubleWritingMode) { if (doubleWritingMode) {
//双写模式下,要在doctor表存储unionId //双写模式下,要在doctor表存储unionId
if (result.getUserId()!=null) { if (result.getUserId()!=null) {
Doctor doctor = new Doctor(); Doctor doctor = new Doctor();
doctor.setId(result.getUserId().intValue()); doctor.setId(Integer.parseInt(result.getUserId()));
doctor.setUnionid(request.getUnionId()); doctor.setUnionid(request.getUnionId());
doctorInfoMapper.updateByPrimaryKeySelective(doctor); doctorInfoMapper.updateByPrimaryKeySelective(doctor);
} }
...@@ -244,6 +252,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -244,6 +252,7 @@ public class LoginServiceImpl implements LoginService {
} else { } else {
result = processLogin(request, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_WE_CHAT.getCode()); result = processLogin(request, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_WE_CHAT.getCode());
} }
result.setMobile(request.getMobile());
AccountInfoEntity accountInfo = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile())); AccountInfoEntity accountInfo = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile()));
Integer acctId = accountInfo.getId(); Integer acctId = accountInfo.getId();
processAccountUnion(acctId, request.getUnionId()); processAccountUnion(acctId, request.getUnionId());
...@@ -252,7 +261,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -252,7 +261,8 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
@Transactional @Transactional
public void unbindWeChat(Integer acctId) { public void unbindWeChat(long doctorId) {
Integer acctId = doctorInfoMapper.getAcctIdByDoctorId(doctorId);
accountUnionMapper.updateUnbindByAcctId(acctId); accountUnionMapper.updateUnbindByAcctId(acctId);
if (doubleWritingMode) { if (doubleWritingMode) {
doctorService.unbindWeChat(acctId); doctorService.unbindWeChat(acctId);
...@@ -261,7 +271,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -261,7 +271,7 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
@Transactional @Transactional
public void bindWeChat(BaseRequest request) { public String bindWeChat(long doctorId, BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode()); WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
Map map = new HashMap(); Map map = new HashMap();
map.put("access_token", weChatEntity.getAccess_token()); map.put("access_token", weChatEntity.getAccess_token());
...@@ -272,8 +282,12 @@ public class LoginServiceImpl implements LoginService { ...@@ -272,8 +282,12 @@ public class LoginServiceImpl implements LoginService {
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId); AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
if (entity == null) { if (entity == null) {
processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType()); processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType());
} else {
updateWechatInfoUser(entity, weChatUserInfoEntity);
} }
processAccountUnion(request.getAccId(), unionId); Integer acctId = doctorInfoMapper.getAcctIdByDoctorId(doctorId);
processAccountUnion(acctId, unionId);
return weChatUserInfoEntity.getNickname();
} }
/** /**
...@@ -325,6 +339,16 @@ public class LoginServiceImpl implements LoginService { ...@@ -325,6 +339,16 @@ public class LoginServiceImpl implements LoginService {
accountWeChatInfoMapper.insertSelective(accountWeChatInfoEntity); accountWeChatInfoMapper.insertSelective(accountWeChatInfoEntity);
} }
private void updateWechatInfoUser(AccountWeChatInfoEntity entity, WeChatUserInfoEntity weChatUserInfoEntity) {
String nickname = weChatUserInfoEntity.getNickname();
if (StringUtils.isNotEmpty(nickname) && !nickname.equals(entity.getNickname())) {
AccountWeChatInfoEntity info = new AccountWeChatInfoEntity();
info.setId(entity.getId());
info.setNickname(nickname);
accountWeChatInfoMapper.updateByPrimaryKeySelective(info);
}
}
public PICAPDoctor queryDoctor(long doctorId) { public PICAPDoctor queryDoctor(long doctorId) {
PICAPDoctor doctor = doctorInfoMapper.queryDoctor(doctorId); PICAPDoctor doctor = doctorInfoMapper.queryDoctor(doctorId);
if (doctor == null) { if (doctor == null) {
......
...@@ -147,8 +147,9 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -147,8 +147,9 @@ public class RegisterServiceImpl implements RegisterService {
String newToken = tokenUtils.generateToken(account); String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult(); LoginResult result = new LoginResult();
result.setToken(newToken); result.setToken(newToken);
result.setUserId(userId); result.setUserId(userId+"");
result.setEntireFlag(1); result.setEntireFlag(1);
result.setMobile(mobile);
/* ByteArrayOutputStream bos = new ByteArrayOutputStream(); /* ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos); DataOutputStream dos = new DataOutputStream(bos);
try { try {
......
package com.pica.cloud.account.account.server.starter;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created on 2019/11/6 15:39
* author:crs
* Description:配置式job
*/
@Configuration
public class JobExecutorConfiguration {
private Logger logger = LoggerFactory.getLogger(JobExecutorConfiguration.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean(initMethod = "start", destroyMethod = "destroy")
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info("pica-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
}
...@@ -168,7 +168,11 @@ public class AESUtil { ...@@ -168,7 +168,11 @@ public class AESUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String KEY="zJJ$c5md3$yuuhWW"; String KEY="zJJ$c5md3$yuuhWW";
System.out.println("-------------加密---------"); System.out.println("-------------加密---------");
<<<<<<< HEAD
String content = "13671795786"; String content = "13671795786";
=======
String content = "13916000001";
>>>>>>> dev-sensitive-20191112
System.out.println("加密前:" + content); System.out.println("加密前:" + content);
System.out.println("加密密钥和解密密钥:" + KEY); System.out.println("加密密钥和解密密钥:" + KEY);
...@@ -179,32 +183,11 @@ public class AESUtil { ...@@ -179,32 +183,11 @@ public class AESUtil {
System.out.println("解密后:" + decrypt); System.out.println("解密后:" + decrypt);
//请求参数解密处理 //请求参数解密处理
// String encrypt="DC7Sc7ydClKJztuIz/E/5fXuQ8hqdr4W8mxL/XACtqT2wzK3jBiRXnoPOvR9lANIinXInrdbY5rCIwTiI9DeWFiwPP7cSF0cjnQOY11oJLjVg9qV9VZQXbFyDYVhRv8bbto5hD4evryzbdPTq6A23fD5LmXFYnWKdbSzZfFUl/w="; // String key="Vi/4mtanXFW8huqyNi5/XMRWzTkMVFkHCDE53g49ye4AqUsaiKbINdmkFD+g+RyKeS2tEb+6ELukic3GCtZd0wT4iNzK9YVZoMDFQ9JaZwMn0HXSefnSGociozj5hRXHaim3oOuufRKmtJw372rVg4DEVuGLaIpBzdB5wNlaTbY=";
// String decrypt = RSAUtil.decrypt(encrypt,privateKey); // String decrypt = RSAUtil.decrypt(key,privateKey);
// System.out.println(decrypt); // System.out.println(decrypt);
// //System.out.println("YCPQPx4qpQjEjDea"); // String content="lz8KLqk3rWsNLgMxCpuWOb0fQm3s4z6Oej67dYGu5cY=";
// String content="z9zZyUYwKkYy08l0s1qH9CSnoNnXZbbhHVbAUwGIsOXKPGeTkZFnbL1HYJQXBdKqGzKZt8E5lDzdTGUiUVkkK8GO27fsSrRMewY5T6ndSuo=";
// String result = AESUtil.aesDecrypt(content, decrypt); // String result = AESUtil.aesDecrypt(content, decrypt);
// System.out.println(result); // System.out.println(result);
} }
} }
...@@ -69,6 +69,7 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler ...@@ -69,6 +69,7 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler
### xxl-job log retention days ### xxl-job log retention days
xxl.job.executor.logretentiondays=-1 xxl.job.executor.logretentiondays=-1
pica.cloud.message.url=https://dev-sc.yunqueyi.com/message pica.cloud.message.url=https://dev-sc.yunqueyi.com/message
......
...@@ -66,4 +66,5 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler ...@@ -66,4 +66,5 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler
xxl.job.executor.logretentiondays=-1 xxl.job.executor.logretentiondays=-1
pica.cloud.message.url=https://sc.yunqueyi.com/message pica.cloud.message.url=https://sc.yunqueyi.com/message
...@@ -51,10 +51,17 @@ spring.rabbitmq.username=appuser ...@@ -51,10 +51,17 @@ spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost spring.rabbitmq.virtual-host=account-register-vhost
<<<<<<< HEAD
# Job config begin # Job config begin
# 控制器地址:服务启动自动注册到控制器中 # 控制器地址:服务启动自动注册到控制器中
xxl.job.admin.addresses=http://192.168.110.133:7899/job xxl.job.admin.addresses=http://192.168.110.133:7899/job
=======
# Job config begin
# 控制器地址:服务启动自动注册到控制器中
xxl.job.admin.addresses=http://192.168.110.133:7899/job
>>>>>>> dev-sensitive-20191112
#执行器命名规则job-exec-<申请Port> #执行器命名规则job-exec-<申请Port>
xxl.job.executor.appname=job-exec-7906 xxl.job.executor.appname=job-exec-7906
xxl.job.executor.ip= xxl.job.executor.ip=
...@@ -68,4 +75,6 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler ...@@ -68,4 +75,6 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler
### xxl-job log retention days ### xxl-job log retention days
xxl.job.executor.logretentiondays=-1 xxl.job.executor.logretentiondays=-1
pica.cloud.message.url=https://test1-sc.yunqueyi.com/message pica.cloud.message.url=https://test1-sc.yunqueyi.com/message
...@@ -50,3 +50,20 @@ spring.rabbitmq.port=5672 ...@@ -50,3 +50,20 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username=appuser spring.rabbitmq.username=appuser
spring.rabbitmq.password=AqLfvyWOvLQEUzdI spring.rabbitmq.password=AqLfvyWOvLQEUzdI
spring.rabbitmq.virtual-host=account-register-vhost spring.rabbitmq.virtual-host=account-register-vhost
# Job config begin
# 控制器地址:服务启动自动注册到控制器中
xxl.job.admin.addresses=http://192.168.110.124:7899/job
#执行器命名规则job-exec-<申请Port>
xxl.job.executor.appname=job-exec-7906
xxl.job.executor.ip=
xxl.job.executor.port=7906
### xxl-job, access token
xxl.job.accessToken=
### 确保改目录可写/opt/xxl-job-logs/jobhandler
xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler
### xxl-job log retention days
xxl.job.executor.logretentiondays=-1
...@@ -54,6 +54,7 @@ spring.rabbitmq.virtual-host=account-register-vhost ...@@ -54,6 +54,7 @@ spring.rabbitmq.virtual-host=account-register-vhost
# Job config begin # Job config begin
# 控制器地址:服务启动自动注册到控制器中 # 控制器地址:服务启动自动注册到控制器中
xxl.job.admin.addresses=http://192.168.110.141:7899/job xxl.job.admin.addresses=http://192.168.110.141:7899/job
#执行器命名规则job-exec-<申请Port> #执行器命名规则job-exec-<申请Port>
xxl.job.executor.appname=job-exec-7906 xxl.job.executor.appname=job-exec-7906
xxl.job.executor.ip= xxl.job.executor.ip=
...@@ -67,4 +68,6 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler ...@@ -67,4 +68,6 @@ xxl.job.executor.logpath=/opt/xxl-job-logs/jobhandler
### xxl-job log retention days ### xxl-job log retention days
xxl.job.executor.logretentiondays=-1 xxl.job.executor.logretentiondays=-1
pica.cloud.message.url=https://uat-sc.yunqueyi.com/message pica.cloud.message.url=https://uat-sc.yunqueyi.com/message
spring.profiles.active=uat spring.profiles.active=dev
\ No newline at end of file \ No newline at end of file
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId} update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
</update> </update>
<update id="processAccountRepeatData">
update account_info set delete_flag=2, modified_id=101432928, modified_time=now() where id in (select id from (select pd.id from account_info pd
inner JOIN (SELECT mobile_phone,MIN(id) as id FROM account_info WHERE delete_flag=1 and mobile_phone is not null GROUP BY mobile_phone having count(*)>1) inn
on pd.id != inn.id and pd.mobile_phone = inn.mobile_phone) ttt);
</update>
<!--逻辑删除用户--> <!--逻辑删除用户-->
<update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer"> <update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer">
update account_info set delete_flag=2,modified_time=now(), modified_id=#{acctId} where id=#{acctId} update account_info set delete_flag=2,modified_time=now(), modified_id=#{acctId} where id=#{acctId}
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from account_union from account_union
where union_id = #{unionId} where union_id = #{unionId} and delete_flag = 1
limit 1
</select> </select>
<!--解除绑定关系--> <!--解除绑定关系-->
......
...@@ -40,11 +40,12 @@ ...@@ -40,11 +40,12 @@
</select> </select>
<!--通过UnionId获取微信信息--> <!--通过UnionId获取微信信息-->
<select id="selectByUnionId" resultMap="BaseResultMap" parameterType="java.lang.Integer"> <select id="selectByUnionId" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from account_wechat_info from account_wechat_info
where unionid = #{id} where unionid = #{id} and delete_flag = 1
limit 1
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
......
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
update p_doctor set delete_flag=2, modify_id=101432928, modify_time=now() where id in (select id from (select pd.id from p_doctor pd update p_doctor set delete_flag=2, modify_id=101432928, modify_time=now() where id in (select id from (select pd.id from p_doctor pd
inner JOIN (SELECT mobile_phone,MIN(id) as id FROM p_doctor WHERE delete_flag=1 and mobile_phone is not null GROUP BY mobile_phone having count(*)>1) inn inner JOIN (SELECT mobile_phone,MIN(id) as id FROM p_doctor WHERE delete_flag=1 and mobile_phone is not null GROUP BY mobile_phone having count(*)>1) inn
on pd.id != inn.id and pd.mobile_phone = inn.mobile_phone) ttt); on pd.id != inn.id and pd.mobile_phone = inn.mobile_phone) ttt);
</update> </update>
...@@ -1026,4 +1028,8 @@ ...@@ -1026,4 +1028,8 @@
FROM p_doctor aa FROM p_doctor aa
where aa.id = #{doctorId} and aa.delete_flag = 1 where aa.id = #{doctorId} and aa.delete_flag = 1
</select> </select>
<select id="getAcctIdByDoctorId" resultType="java.lang.Integer" parameterType="java.lang.Long">
select acct_id from p_doctor where id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册