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

20200106 代码重构禁止跨表查询

上级 5c56ec32
流水线 #20185 已失败 于阶段
in 0 second
...@@ -120,6 +120,12 @@ ...@@ -120,6 +120,12 @@
<version>1.0.1</version> <version>1.0.1</version>
</dependency> </dependency>
<dependency>
<groupId>com.pica.cloud.patient</groupId>
<artifactId>pica-cloud-smartcontract-client</artifactId>
<version>1.0.9</version>
</dependency>
<dependency> <dependency>
<groupId>com.pica.cloud.permission</groupId> <groupId>com.pica.cloud.permission</groupId>
<artifactId>pica-cloud-permission-client</artifactId> <artifactId>pica-cloud-permission-client</artifactId>
......
package com.pica.cloud.account.account.server.entity; //package com.pica.cloud.account.account.server.entity;
//
import java.util.Date; //import java.util.Date;
//
public class AgreementLogEntity { //public class AgreementLogEntity {
private Long id; // private Long id;
//
private Long doctor_id; // private Long doctor_id;
//
private Integer agreement_type; // private Integer agreement_type;
//
private String version; // private String version;
//
private Integer delete_flag; // private Integer delete_flag;
//
private Long created_id; // private Long created_id;
//
private Date created_time; // private Date created_time;
//
private Long modified_id; // private Long modified_id;
//
private Date modified_time; // private Date modified_time;
//
public Long getId() { // public Long getId() {
return id; // return id;
} // }
//
public void setId(Long id) { // public void setId(Long id) {
this.id = id; // this.id = id;
} // }
//
public Long getDoctor_id() { // public Long getDoctor_id() {
return doctor_id; // return doctor_id;
} // }
//
public void setDoctor_id(Long doctor_id) { // public void setDoctor_id(Long doctor_id) {
this.doctor_id = doctor_id; // this.doctor_id = doctor_id;
} // }
//
public Integer getAgreement_type() { // public Integer getAgreement_type() {
return agreement_type; // return agreement_type;
} // }
//
public void setAgreement_type(Integer agreement_type) { // public void setAgreement_type(Integer agreement_type) {
this.agreement_type = agreement_type; // this.agreement_type = agreement_type;
} // }
//
public String getVersion() { // public String getVersion() {
return version; // return version;
} // }
//
public void setVersion(String version) { // public void setVersion(String version) {
this.version = version == null ? null : version.trim(); // this.version = version == null ? null : version.trim();
} // }
//
public Integer getDelete_flag() { // public Integer getDelete_flag() {
return delete_flag; // return delete_flag;
} // }
//
public void setDelete_flag(Integer delete_flag) { // public void setDelete_flag(Integer delete_flag) {
this.delete_flag = delete_flag; // this.delete_flag = delete_flag;
} // }
//
public Long getCreated_id() { // public Long getCreated_id() {
return created_id; // return created_id;
} // }
//
public void setCreated_id(Long created_id) { // public void setCreated_id(Long created_id) {
this.created_id = created_id; // this.created_id = created_id;
} // }
//
public Date getCreated_time() { // public Date getCreated_time() {
return created_time; // return created_time;
} // }
//
public void setCreated_time(Date created_time) { // public void setCreated_time(Date created_time) {
this.created_time = created_time; // this.created_time = created_time;
} // }
//
public Long getModified_id() { // public Long getModified_id() {
return modified_id; // return modified_id;
} // }
//
public void setModified_id(Long modified_id) { // public void setModified_id(Long modified_id) {
this.modified_id = modified_id; // this.modified_id = modified_id;
} // }
//
public Date getModified_time() { // public Date getModified_time() {
return modified_time; // return modified_time;
} // }
//
public void setModified_time(Date modified_time) { // public void setModified_time(Date modified_time) {
this.modified_time = modified_time; // this.modified_time = modified_time;
} // }
} //}
\ No newline at end of file \ No newline at end of file
package com.pica.cloud.account.account.server.entity; //package com.pica.cloud.account.account.server.entity;
//
import java.util.Date; //import java.util.Date;
//
/** ///**
* @author andong // * @author andong
* @create 2019/11/18 // * @create 2019/11/18
*/ // */
public class PProtocolLog { //public class PProtocolLog {
//
private Integer id; // private Integer id;
//
private String userId; // private String userId;
//
private Integer protocolId; // private Integer protocolId;
//
private Short status; // private Short status;
//
private Integer type; // private Integer type;
//
private Integer userType; // private Integer userType;
//
private Integer deleteFlag; // private Integer deleteFlag;
//
private Integer createdId; // private Integer createdId;
//
private Date createdTime; // private Date createdTime;
//
private Integer modifiedId; // private Integer modifiedId;
//
private Date modifiedTime; // private Date modifiedTime;
//
public Integer getId() { // public Integer getId() {
return id; // return id;
} // }
//
public void setId(Integer id) { // public void setId(Integer id) {
this.id = id; // this.id = id;
} // }
//
public String getUserId() { // public String getUserId() {
return userId; // return userId;
} // }
//
public void setUserId(String userId) { // public void setUserId(String userId) {
this.userId = userId; // this.userId = userId;
} // }
//
public Integer getProtocolId() { // public Integer getProtocolId() {
return protocolId; // return protocolId;
} // }
//
public void setProtocolId(Integer protocolId) { // public void setProtocolId(Integer protocolId) {
this.protocolId = protocolId; // this.protocolId = protocolId;
} // }
//
public Short getStatus() { // public Short getStatus() {
return status; // return status;
} // }
//
public void setStatus(Short status) { // public void setStatus(Short status) {
this.status = status; // this.status = status;
} // }
//
public Integer getType() { // public Integer getType() {
return type; // return type;
} // }
//
public void setType(Integer type) { // public void setType(Integer type) {
this.type = type; // this.type = type;
} // }
//
public Integer getUserType() { // public Integer getUserType() {
return userType; // return userType;
} // }
//
public void setUserType(Integer userType) { // public void setUserType(Integer userType) {
this.userType = userType; // this.userType = userType;
} // }
//
public Integer getDeleteFlag() { // public Integer getDeleteFlag() {
return deleteFlag; // return deleteFlag;
} // }
//
public void setDeleteFlag(Integer deleteFlag) { // public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag; // this.deleteFlag = deleteFlag;
} // }
//
public Integer getCreatedId() { // public Integer getCreatedId() {
return createdId; // return createdId;
} // }
//
public void setCreatedId(Integer createdId) { // public void setCreatedId(Integer createdId) {
this.createdId = createdId; // this.createdId = createdId;
} // }
//
public Date getCreatedTime() { // public Date getCreatedTime() {
return createdTime; // return createdTime;
} // }
//
public void setCreatedTime(Date createdTime) { // public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime; // this.createdTime = createdTime;
} // }
//
public Integer getModifiedId() { // public Integer getModifiedId() {
return modifiedId; // return modifiedId;
} // }
//
public void setModifiedId(Integer modifiedId) { // public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId; // this.modifiedId = modifiedId;
} // }
//
public Date getModifiedTime() { // public Date getModifiedTime() {
return modifiedTime; // return modifiedTime;
} // }
//
public void setModifiedTime(Date modifiedTime) { // public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime; // this.modifiedTime = modifiedTime;
} // }
} //}
...@@ -13,18 +13,18 @@ import org.springframework.stereotype.Component; ...@@ -13,18 +13,18 @@ import org.springframework.stereotype.Component;
* author:crs * author:crs
* Description:记录doctor修改记录日志 * Description:记录doctor修改记录日志
*/ */
@JobHandler(value = "PermissionRoleLogHandler") //@JobHandler(value = "PermissionRoleLogHandler")
@Component //@Component
public class PermissionRoleLogHandler extends IJobHandler { //public class PermissionRoleLogHandler extends IJobHandler {
//
@Autowired // @Autowired
private PermissionDoctorRoleMapper permissionDoctorRoleMapper; // private PermissionDoctorRoleMapper permissionDoctorRoleMapper;
//
@Override // @Override
public ReturnT<String> execute(String s) throws Exception { // public ReturnT<String> execute(String s) throws Exception {
XxlJobLogger.log("permissionRoleLogRecord start-----"); // XxlJobLogger.log("permissionRoleLogRecord start-----");
Integer rows = permissionDoctorRoleMapper.updatePermissionModifyRecord(); // Integer rows = permissionDoctorRoleMapper.updatePermissionModifyRecord();
XxlJobLogger.log("permissionLogRecord end-----"+rows); // XxlJobLogger.log("permissionLogRecord end-----"+rows);
return SUCCESS; // return SUCCESS;
} // }
} //}
...@@ -3,27 +3,27 @@ package com.pica.cloud.account.account.server.mapper; ...@@ -3,27 +3,27 @@ package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AgreementEntity; import com.pica.cloud.account.account.server.entity.AgreementEntity;
public interface AgreementEntityMapper { //public interface AgreementEntityMapper {
int deleteByPrimaryKey(Long id); // int deleteByPrimaryKey(Long id);
//
int insert(AgreementEntity record); // int insert(AgreementEntity record);
//
int insertSelective(AgreementEntity record); // int insertSelective(AgreementEntity record);
//
AgreementEntity selectByPrimaryKey(Long id); // AgreementEntity selectByPrimaryKey(Long id);
//
/** // /**
* 根据协议类型查询协议 // * 根据协议类型查询协议
* // *
* @param agreementType // * @param agreementType
* @return // * @return
*/ // */
Integer selectByType(int agreementType); // Integer selectByType(int agreementType);
//
//
int updateByPrimaryKeySelective(AgreementEntity record); // int updateByPrimaryKeySelective(AgreementEntity record);
//
int updateByPrimaryKeyWithBLOBs(AgreementEntity record); // int updateByPrimaryKeyWithBLOBs(AgreementEntity record);
//
int updateByPrimaryKey(AgreementEntity record); // int updateByPrimaryKey(AgreementEntity record);
} //}
\ No newline at end of file \ No newline at end of file
package com.pica.cloud.account.account.server.mapper; //package com.pica.cloud.account.account.server.mapper;
//
//
import com.pica.cloud.account.account.server.entity.AgreementLogEntity; //import com.pica.cloud.account.account.server.entity.AgreementLogEntity;
import com.pica.cloud.account.account.server.entity.PProtocolLog; //import com.pica.cloud.account.account.server.entity.PProtocolLog;
//
public interface AgreementLogEntityMapper { //public interface AgreementLogEntityMapper {
int deleteByPrimaryKey(Long id); // int deleteByPrimaryKey(Long id);
//
int insert(AgreementLogEntity record); // int insert(AgreementLogEntity record);
//
int insertSelective(AgreementLogEntity record); // int insertSelective(AgreementLogEntity record);
//
AgreementLogEntity selectByPrimaryKey(Long id); // AgreementLogEntity selectByPrimaryKey(Long id);
//
int updateByPrimaryKeySelective(AgreementLogEntity record); // int updateByPrimaryKeySelective(AgreementLogEntity record);
//
int updateByPrimaryKey(AgreementLogEntity record); // int updateByPrimaryKey(AgreementLogEntity record);
//
Integer getLatestProtocolId(int type); // Integer getLatestProtocolId(int type);
//
int insertProtocolLog(PProtocolLog record); // int insertProtocolLog(PProtocolLog record);
//
int updateSignNum(Integer id); // int updateSignNum(Integer id);
} //}
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,10 @@ import com.pica.cloud.account.account.server.enums.AccountTypeEnum; ...@@ -7,7 +7,10 @@ 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.exception.AccountException;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils; 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.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.*; import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.AccountMapper;
import com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper;
import com.pica.cloud.account.account.server.mapper.AgreementLogEntityMapper;
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.service.RegisterService; 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.AESUtil;
...@@ -16,14 +19,16 @@ import com.pica.cloud.account.account.server.util.ExecutorServiceUtils; ...@@ -16,14 +19,16 @@ import com.pica.cloud.account.account.server.util.ExecutorServiceUtils;
import com.pica.cloud.account.account.server.util.TokenUtils; import com.pica.cloud.account.account.server.util.TokenUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants; import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils; import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient; import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.patient.smartcontract.client.AgreementLogClient;
import com.pica.cloud.patient.smartcontract.common.dto.PProtocolLog;
import com.pica.cloud.permission.permission.client.UseRoleClient; import com.pica.cloud.permission.permission.client.UseRoleClient;
import com.pica.cloud.permission.permission.entity.PUserRole; import com.pica.cloud.permission.permission.entity.PUserRole;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -61,11 +66,14 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -61,11 +66,14 @@ public class RegisterServiceImpl implements RegisterService {
// @Autowired // @Autowired
// private QueueProducer queueProducer; // private QueueProducer queueProducer;
@Autowired // @Autowired
private AgreementEntityMapper agreementEntityMapper; // private AgreementEntityMapper agreementEntityMapper;
// @Autowired
// private AgreementLogEntityMapper agreementLogEntityMapper;
@Autowired @Autowired
private AgreementLogEntityMapper agreementLogEntityMapper; private AgreementLogClient agreementLogClient;
@Autowired @Autowired
...@@ -135,7 +143,7 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -135,7 +143,7 @@ public class RegisterServiceImpl implements RegisterService {
account.setLastLoginTime(currentTime); account.setLastLoginTime(currentTime);
account.setRegisterSource(sourceType); account.setRegisterSource(sourceType);
account.setPassword(password); account.setPassword(password);
if (!StringUtils.isBlank(password)){ if (!StringUtils.isBlank(password)) {
account.setEntireFlag(3); account.setEntireFlag(3);
} }
accountMapper.insertSelective(account); accountMapper.insertSelective(account);
...@@ -152,7 +160,7 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -152,7 +160,7 @@ public class RegisterServiceImpl implements RegisterService {
result.setToken(newToken); result.setToken(newToken);
result.setUserId(userId); result.setUserId(userId);
result.setEntireFlag(1); result.setEntireFlag(1);
result.setDoctorId(EncryptUtils.encryptContent(userId+"", EncryptConstants.ENCRYPT_TYPE_ID)); result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
result.setMobile(mobile); result.setMobile(mobile);
/* ByteArrayOutputStream bos = new ByteArrayOutputStream(); /* ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos); DataOutputStream dos = new DataOutputStream(bos);
...@@ -181,12 +189,13 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -181,12 +189,13 @@ public class RegisterServiceImpl implements RegisterService {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER); throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER);
} }
} else { } else {
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER); throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER);
} }
} }
/** /**
* 异步处理用户角色 * 异步处理用户角色
*
* @param userId * @param userId
*/ */
private void processRoleMap(Long userId) { private void processRoleMap(Long userId) {
...@@ -306,8 +315,11 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -306,8 +315,11 @@ public class RegisterServiceImpl implements RegisterService {
// privateAgreementLogEntity.setDelete_flag(1); // privateAgreementLogEntity.setDelete_flag(1);
// agreementLogEntityMapper.insert(privateAgreementLogEntity); // agreementLogEntityMapper.insert(privateAgreementLogEntity);
Integer protocolId = 0;
Integer protocolId = agreementLogEntityMapper.getLatestProtocolId(2); //获取最新用户协议ID PicaResponse picaResponse = agreementLogClient.getLatestProtocolId(2);//获取最新用户协议ID
if (picaResponse != null) {
protocolId = (Integer) picaResponse.getData();
}
PProtocolLog log = new PProtocolLog(); PProtocolLog log = new PProtocolLog();
log.setUserId(userId.toString()); log.setUserId(userId.toString());
log.setProtocolId(protocolId); log.setProtocolId(protocolId);
...@@ -316,14 +328,17 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -316,14 +328,17 @@ public class RegisterServiceImpl implements RegisterService {
log.setStatus((short) 1); log.setStatus((short) 1);
log.setCreatedId(userId.intValue()); log.setCreatedId(userId.intValue());
log.setModifiedId(userId.intValue()); log.setModifiedId(userId.intValue());
agreementLogEntityMapper.insertProtocolLog(log); agreementLogClient.insertProtocolLog(log);
agreementLogEntityMapper.updateSignNum(protocolId); //更新用户协议签署数量 agreementLogClient.updateSignNum(protocolId); //更新用户协议签署数量
protocolId = agreementLogEntityMapper.getLatestProtocolId(3); //获取最新隐私协议ID PicaResponse picaResponseType = agreementLogClient.getLatestProtocolId(3); //获取最新隐私协议ID
if (picaResponseType != null) {
protocolId = (Integer) picaResponseType.getData();
}
log.setProtocolId(protocolId); log.setProtocolId(protocolId);
log.setType(3); log.setType(3);
agreementLogEntityMapper.insertProtocolLog(log); agreementLogClient.insertProtocolLog(log);
agreementLogEntityMapper.updateSignNum(protocolId); //更新隐私协议签署数量 agreementLogClient.updateSignNum(protocolId); //更新隐私协议签署数量
}); });
} }
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册