提交 07abcab8 编写于 作者: dong.an's avatar dong.an

微信登录

上级 6e1f6e82
......@@ -3,6 +3,7 @@ package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.DoctorEntity;
import org.apache.ibatis.annotations.Param;
public interface DoctorMapper {
/**
......@@ -53,4 +54,19 @@ public interface DoctorMapper {
int insertSelective(Doctor record);
int updateByPrimaryKey(Doctor record);
/**
* 绑定微信
* @param acctId
* @param unionId
* @return
*/
int bindWeChat(@Param("acctId") int acctId, @Param("unionId") String unionId);
/**
* 解绑微信
* @param acctId
* @return
*/
int unbindWeChat(@Param("acctId") int acctId);
}
\ No newline at end of file
......@@ -30,4 +30,17 @@ public interface DoctorService {
* @param doctor 新的医生数据
*/
void addDoctorInfo(Doctor doctor, Integer userId);
/**
* doctor绑定微信
* @param acctId
* @param unionId
*/
void bindWeChat(int acctId, String unionId);
/**
* doctor解绑微信
* @param acctId
*/
void unbindWeChat(int acctId);
}
......@@ -91,4 +91,16 @@ public class DoctorServiceImpl implements DoctorService {
doctor.setDeleteFlag(1);
doctorMapper.insertSelective(doctor);
}
@Override
@Transactional
public void bindWeChat(int acctId, String unionId) {
doctorMapper.bindWeChat(acctId, unionId);
}
@Override
@Transactional
public void unbindWeChat(int acctId) {
doctorMapper.unbindWeChat(acctId);
}
}
......@@ -14,6 +14,7 @@ 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.req.AccountReq;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.RegisterService;
import com.pica.cloud.account.account.server.util.AccountUtils;
......@@ -28,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
......@@ -62,6 +64,9 @@ public class LoginServiceImpl implements LoginService {
@Autowired
private AccountUtils accountUtils;
@Autowired
private DoctorService doctorService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient redisClient;
......@@ -227,11 +232,16 @@ public class LoginServiceImpl implements LoginService {
}
@Override
@Transactional
public void unbindWeChat(Integer acctId) {
accountUnionMapper.updateUnbindByAcctId(acctId);
if (doubleWritingMode) {
doctorService.unbindWeChat(acctId);
}
}
@Override
@Transactional
public void bindWeChat(BaseRequest request) {
WeChatEntity weChatEntity = WeChatUtils.getAuthorizationInfo(appId, appSecret, request.getWeChatCode());
Map map = new HashMap();
......@@ -245,6 +255,9 @@ public class LoginServiceImpl implements LoginService {
processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType());
}
processAccountUnion(request.getAccId(), unionId);
if (doubleWritingMode) {
doctorService.bindWeChat(request.getAccId(), unionId);
}
}
/**
......
......@@ -982,4 +982,16 @@
acct_id = #{acctId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="bindWeChat">
update p_doctor
set unionid = #{unionId}
where acct_id = #{acctId}
</update>
<update id="unbindWeChat">
update p_doctor
set unionid = ''
where acct_id = #{acctId}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册