流程测试

master
river 4 years ago
parent 22818d0ffa
commit 25b3c960c5
  1. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgComplianceInvestigationMapper.java
  2. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgComplianceInvestigationResponse.java
  3. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgLoanCommitteeConsiderResponse.java
  4. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgWorkConferenceResponse.java
  5. 1
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgComplianceInvestigationService.java
  6. 20
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgAssetsInvestigationServiceImpl.java
  7. 58
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgComplianceInvestigationServiceImpl.java
  8. 19
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgLoanCommitteeConsiderServiceImpl.java
  9. 16
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java
  10. 11
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgComplianceInvestigationMapper.xml
  11. 65
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java
  12. 2
      dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java

@ -51,6 +51,8 @@ public interface DgComplianceInvestigationMapper extends BaseMapper<DgCompliance
Integer getOperationStatusByBusinessId(@Param("businessId") Integer businessId, @Param("roleId") Integer roleId);
Integer getAuditStatusByBusinessId(@Param("businessId") Integer businessId);
DgComplianceInvestigation queryDgComplianceInvestigation(Integer iid);
Boolean insertWorkConferenceConsider(@Param("wcc") DgWorkConferenceConsider dgWorkConferenceConsider);
@ -70,4 +72,6 @@ public interface DgComplianceInvestigationMapper extends BaseMapper<DgCompliance
Boolean updateWorkConferenceConsider(@Param("businessId") Integer businessId, @Param("roleId") Integer roleId,
@Param("auditStatus") Integer auditStatus, @Param("operationStatus") Integer operationStatus);
String getAuditProcessLatestNameByBusinessId(@Param("businessId") Integer businessId);
}

@ -53,7 +53,7 @@ public class DgComplianceInvestigationResponse extends BaseRowModel implements S
@ExcelProperty(value = "申请日期", index = 6)
@ApiModelProperty("申请日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
@ExcelProperty(value = "操作状态", index = 7, converter = OperatingStatusConverter.class)

@ -54,7 +54,7 @@ public class DgLoanCommitteeConsiderResponse extends BaseRowModel implements Ser
@ExcelProperty(value = "申请日期" , index = 6)
@ApiModelProperty("申请日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
@ExcelProperty(value = "操作状态" , index = 7 ,converter = OperatingStatusConverter.class)

@ -54,7 +54,7 @@ public class DgWorkConferenceResponse extends BaseRowModel implements Serializab
@ExcelProperty(value = "申请日期", index = 6)
@ApiModelProperty("申请日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
@ExcelProperty(value = "A角", index = 7)

@ -32,4 +32,5 @@ public interface IDgComplianceInvestigationService extends IService<DgCompliance
Boolean excelExport(HttpServletResponse response, List<String> ids);
String getFileUrl(String[] fileUrls);
}

@ -139,16 +139,16 @@ public class DgAssetsInvestigationServiceImpl extends ServiceImpl<DgAssetsInvest
DgAssetsInvestigation assetsInvestigation = this.baseMapper.selectOne(new QueryWrapper<DgAssetsInvestigation>()
.eq("business_id", assetsResponse.getBusinessId()).eq("type", 1));
assetsResponse.setAssetsAmount(assetsInvestigation.getAssetsAmount());
assetsResponse.setAmount(assetsInvestigation.getAmount());
assetsResponse.setAssetsAmount(assetsInvestigation.getAssetsAmount());
assetsResponse.setApplyContent(assetsInvestigation.getApplyContent());
assetsResponse.setAssetsCode(assetsInvestigation.getAssetsCode());
assetsResponse.setAssetsName(assetsInvestigation.getAssetsName());
assetsResponse.setAssetsTime(assetsInvestigation.getAssetsTime());
assetsResponse.setAuditAmount(assetsInvestigation.getAuditAmount());
assetsResponse.setAuditCode(assetsInvestigation.getAuditCode());
assetsResponse.setAuditName(assetsInvestigation.getAuditName());
// assetsResponse.setAssetsAmount(assetsInvestigation.getAssetsAmount());
// assetsResponse.setAmount(assetsInvestigation.getAmount());
// assetsResponse.setAssetsAmount(assetsInvestigation.getAssetsAmount());
// assetsResponse.setApplyContent(assetsInvestigation.getApplyContent());
// assetsResponse.setAssetsCode(assetsInvestigation.getAssetsCode());
// assetsResponse.setAssetsName(assetsInvestigation.getAssetsName());
// assetsResponse.setAssetsTime(assetsInvestigation.getAssetsTime());
// assetsResponse.setAuditAmount(assetsInvestigation.getAuditAmount());
// assetsResponse.setAuditCode(assetsInvestigation.getAuditCode());
// assetsResponse.setAuditName(assetsInvestigation.getAuditName());
//结束---------------------------------------------------------------------
//根据业务id查询评估价值List

@ -74,15 +74,15 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
page = 1;
size = 10;
}
/*String userId = this.getUserId();
String userId = this.getUserId();
// 获取当前登录用户的角色id
String roleIdString = RedisUtil.get("dq:userRole:" + userId);
if (roleIdString == null || roleIdString.length() == 0) {
ExceptionCast.cast(GuaranteeCode.ROLE_IS_NOT);
}
String[] roleIds = roleIdString.split(",");*/
String userId = "1";
String[] roleIds = {"70"};
String[] roleIds = roleIdString.split(",");
/*String userId = "1";
String[] roleIds = {"70"};*/
List<Integer> roleList = new ArrayList<>();
for (String roleId : roleIds) {
roleList.add(Integer.parseInt(roleId));
@ -115,8 +115,8 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
Boolean result = this.getBaseMapper().assign(complianceInvestigation);
if (result) {
// 绑定该条数据的指派操作人(表示指派完成);
// String id = this.getUserId();
String id = "1";
String id = this.getUserId();
/*String id = "1";*/
Boolean result1 = this.getBaseMapper().updateAssign(iid, Integer.parseInt(id), StatusCode.SP_IN_REVIEW, StatusCode.CZ_PROCESSED);
if (result1) {
// 在角色表中插入一条数据,与当前被指派的员工(用户)关联
@ -141,8 +141,8 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
if (iid == null || status == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
//String userId = this.getUserId();
String userId = "1";
String userId = this.getUserId();
// String userId = "1";
// 同意
if (status == 1) {
if (fileUrl == null || fileUrl.length() == 0) {
@ -209,16 +209,16 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
if (iid == null || status == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
// String userId = this.getUserId();
String userId = "1";
String userId = this.getUserId();
// String userId = "1";
Integer operationStatus = this.getBaseMapper().getOperationStatusByBusinessId(
this.getComplianceInvestigation(iid).getBusinessId(), PromptSuccess.FG_JL_ID);
// 1.待处理,表示业务进行到法规经理审核
if (Objects.equals(operationStatus, StatusCode.CZ_ON_HAND)) {
// 查询业务流程表,找出该业务id的最新操作记录的角色id
Integer roleId = 69;
if (roleId.equals(PromptSuccess.DB_A_ID) || roleId.equals(PromptSuccess.DB_B_ID)) {
// 1.1.若为A/B角,表示为驳回数据
// 查询业务流程表,找出该业务id的最新操作记录的角色名称
String roleName = this.getBaseMapper().getAuditProcessLatestNameByBusinessId(this.getComplianceInvestigation(iid).getBusinessId());
if (PromptSuccess.DB_AB_NAME.equals(roleName)) {
// 1.1.若最新操作人为A/B角,表示为驳回给AB角之后直接返回的数据
// 同意
if (status == 1) {
// 改变自己的状态为已处理
@ -281,13 +281,27 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
}
}
} else {
// 1.2.若为C角,表示为非驳回数据
// 1.2.若最新操作人为C角或法规部领导,表示C角调查通过后发送过来的数据或者法规部领导驳回的数据
// 同意
if (status == 1) {
Boolean result = this.getBaseMapper().check(iid, opinion, new Date(),
StatusCode.SP_IN_REVIEW, StatusCode.CZ_PROCESSED, Integer.parseInt(userId));
if (result) {
// 法规经理完成审核,新增一条法规领导审核数据(借用插入一条调查数据的接口)
Integer auditStatus = this.getBaseMapper().getAuditStatusByBusinessId(this.getComplianceInvestigation(iid).getBusinessId());
Boolean result1;
if (StatusCode.SP_REJECT.equals(auditStatus)){
// 表示为法规部领导驳回的数据,先更新审批状态为审核中
Boolean result2 = this.getBaseMapper().updateAuditStatusByBusinessId(this.getComplianceInvestigation(iid).getBusinessId(),
StatusCode.SP_IN_REVIEW);
if (result2) {
// 再更新法规部领导的操作状态为待处理
result1 = this.getBaseMapper().updateToAudit(this.getComplianceInvestigation(iid).getBusinessId(), StatusCode.CZ_ON_HAND,
PromptSuccess.FG_LD_ID);
} else {
result1 = false;
}
} else {
// 表示为C角调查通过后发送过来的数据,法规经理完成审核,新增一条法规领导审核数据(借用插入一条调查数据的接口)
DgComplianceInvestigation complianceInvestigation = this.getComplianceInvestigation(iid);
complianceInvestigation.setUserId(null);
complianceInvestigation.setRoleId(PromptSuccess.FG_LD_ID);
@ -295,7 +309,8 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
complianceInvestigation.setAuditStatus(StatusCode.SP_IN_REVIEW);
complianceInvestigation.setCreateTime(new Date());
complianceInvestigation.setUpdateTime(new Date());
Boolean result1 = this.getBaseMapper().assign(complianceInvestigation);
result1 = this.getBaseMapper().assign(complianceInvestigation);
}
if (result1) {
// 在业务流程表中插入一条法规经理审核成功的数据
return AuditProcessUtil.save(this.getComplianceInvestigation(iid).getBusinessId(), DgApplyAmountInfoController.getAccount(),
@ -362,9 +377,15 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
Integer count = this.getBaseMapper().countWorkConferenceConsider(complianceInvestigation.getBusinessId(), PromptSuccess.GZU_ID);
Boolean result1;
if (count > 0) {
// 工作会该条数据存在,表示是工作会驳回的数据
// 工作会该条数据存在,表示是工作会驳回的数据,现将当前审批状态更新为已审核
Boolean result2 = this.getBaseMapper().updateAuditStatusByBusinessId(complianceInvestigation.getBusinessId(), StatusCode.SP_REVIEWED);
if (result2) {
// 再更新工作会的数据为待处理
result1 = this.getBaseMapper().updateWorkConferenceConsider(complianceInvestigation.getBusinessId(), PromptSuccess.GZU_ID,
StatusCode.SP_IN_REVIEW, StatusCode.CZ_ON_HAND);
} else {
result1 = false;
}
} else {
// 工作会该条数据不存在,表示不是工作会驳回数据,需要新增一条
DgWorkConferenceConsider workConferenceConsider = new DgWorkConferenceConsider();
@ -506,7 +527,6 @@ public class DgComplianceInvestigationServiceImpl extends ServiceImpl<DgComplian
return fileUrl.toString();
}
/**
* 获取当前登录用户信息
*/

@ -71,15 +71,15 @@ public class DgLoanCommitteeConsiderServiceImpl extends ServiceImpl<DgLoanCommit
page = 1;
size = 10;
}
/*String userId = this.getUserId();
String userId = this.getUserId();
// 获取当前登录用户的角色id
String roleIdString = RedisUtil.get("dq:userRole:" + userId);
if (roleIdString == null || roleIdString.length() == 0) {
ExceptionCast.cast(GuaranteeCode.ROLE_IS_NOT);
}
String[] roleIds = roleIdString.split(",");*/
String userId = "1";
String[] roleIds = {"72"};
String[] roleIds = roleIdString.split(",");
/*String userId = "1";
String[] roleIds = {"72"};*/
List<Integer> roleList = new ArrayList<>();
for (String roleId : roleIds) {
roleList.add(Integer.parseInt(roleId));
@ -121,10 +121,18 @@ public class DgLoanCommitteeConsiderServiceImpl extends ServiceImpl<DgLoanCommit
Integer auditStatus = this.getBaseMapper().getAuditStatus(dgLoanCommitteeConsiderRequest.getId());
Boolean result1;
if (StatusCode.SP_REJECT.equals(auditStatus)) {
// 当前贷审会的操作状态为驳回,表示为担保函驳回数据
// 当前贷审会的操作状态为驳回,表示为担保函驳回数据,先改变贷审会的审核状态为已审核
Boolean result2 = this.getBaseMapper().updateAuditStatusByBusinessId(
this.getBaseMapper().getDgLoanCommitteeConsider(dgLoanCommitteeConsiderRequest.getId()).getBusinessId(),
StatusCode.SP_REVIEWED);
if (result2) {
// 再改变担保函的法规部经理的操作状态为待处理,审核状态为审核中
result1 = this.getBaseMapper().updateGuaranteeLetterAssignUser(
this.getBaseMapper().getDgLoanCommitteeConsider(dgLoanCommitteeConsiderRequest.getId()).getBusinessId(),
PromptSuccess.FG_JL_ID, StatusCode.SP_IN_REVIEW, StatusCode.CZ_ON_HAND);
} else {
result1 = false;
}
} else {
// 当前贷审会的操作状态部位驳回,表示不是担保函驳回数据,在担保函表中插入一条数据
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = new DgGuaranteeLetterAssignUser();
@ -140,7 +148,6 @@ public class DgLoanCommitteeConsiderServiceImpl extends ServiceImpl<DgLoanCommit
dgLoanCommitteeConsiderRequest.getId()).getBusinessId(), DgApplyAmountInfoController.getAccount(),
PromptSuccess.DSH_NAME, null, PromptSuccess.DSH_PROCESS_ID);
}
return false;
}
}
// 拒绝

@ -78,15 +78,15 @@ public class DgWorkConferenceConsiderServiceImpl extends ServiceImpl<DgWorkConfe
page = 1;
size = 10;
}
/*String userId = this.getUserId();
String userId = this.getUserId();
// 获取当前登录用户的角色id
String roleIdString = RedisUtil.get("dq:userRole:" + userId);
if (roleIdString == null || roleIdString.length() == 0) {
ExceptionCast.cast(GuaranteeCode.ROLE_IS_NOT);
}
String[] roleIds = roleIdString.split(",");*/
String userId = "1";
String[] roleIds = {"71"};
String[] roleIds = roleIdString.split(",");
/*String userId = "1";
String[] roleIds = {"71"};*/
List<Integer> roleList = new ArrayList<>();
for (String roleId : roleIds) {
roleList.add(Integer.parseInt(roleId));
@ -133,11 +133,11 @@ public class DgWorkConferenceConsiderServiceImpl extends ServiceImpl<DgWorkConfe
if (id == null || status == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
// String userId = this.getUserId();
String userId = "1";
String userId = this.getUserId();
// String userId = "1";
// 同意
if (status == 1) {
if (empNames == null || empNames.size() == 0) {
if (null == empNames || empNames.size() == 0) {
ExceptionCast.cast(GuaranteeCode.WORK_JUDGE_NOT_NULL);
}
// 拼接评委名字
@ -150,7 +150,7 @@ public class DgWorkConferenceConsiderServiceImpl extends ServiceImpl<DgWorkConfe
}
}
Boolean result = this.getBaseMapper().check(id, Integer.parseInt(userId), opinion,
StatusCode.SP_IN_REVIEW, StatusCode.CZ_ON_HAND, new Date(), names.toString());
StatusCode.SP_REVIEWED, StatusCode.CZ_ON_HAND, new Date(), names.toString());
if (result) {
// 在业务流程表中插入一条审议通过的数据
return AuditProcessUtil.save(this.getBaseMapper().getWorkConferenceConsider(id).getBusinessId(), DgApplyAmountInfoController.getAccount(),

@ -101,6 +101,11 @@
SELECT operation_status FROM dg_compliance_investigation WHERE business_id = #{businessId} AND role_id = #{roleId}
</select>
<!-- 根据业务id获取当前数据的审核状态 -->
<select id="getAuditStatusByBusinessId" resultType="integer">
SELECT audit_status FROM dg_compliance_investigation WHERE business_id = #{businessId}
</select>
<!-- 根据id查询合规调查表详情 -->
<select id="queryDgComplianceInvestigation" parameterType="integer" resultType="com.daqing.framework.domain.guarantee.DgComplianceInvestigation">
SELECT file_url AS file,opinion AS opinion
@ -150,4 +155,10 @@
WHERE business_id = #{businessId} AND role_id = #{roleId}
</update>
<!-- 根据业务id获取业务流程表中的最新操作角色名称(dept_name字段) -->
<select id="getAuditProcessLatestNameByBusinessId" parameterType="integer" resultType="string">
SELECT dept_name FROM dg_audit_process WHERE business_id = #{businessId}
AND create_time = (SELECT MAX(create_time) FROM dg_audit_process WHERE business_id = #{businessId})
</select>
</mapper>

@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
@ -43,12 +44,12 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
public EmployeeAndUserVO info() {
String userId = this.getUserId();
EmployeeAndUserVO employeeAndUser = employeeDao.getEmployeeByUserId(Long.parseLong(userId));
if (employeeAndUser == null){
if (employeeAndUser == null) {
return employeeAndUser;
}
if (employeeAndUser.getWechatId() == null || employeeAndUser.getWechatId().length() == 0){
if (employeeAndUser.getWechatId() == null || employeeAndUser.getWechatId().length() == 0) {
employeeAndUser.setWechatId(PromptSuccess.QR_CODE_FAIL);
}else {
} else {
employeeAndUser.setWechatId(PromptSuccess.QR_CODE_BINDING_SUCCESS);
}
return employeeAndUser;
@ -66,16 +67,16 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
employeeAndUserVO.setId(employeeId);
employeeAndUserVO.setUserId(Long.parseLong(userId));
Boolean result = true;
BeanUtils.copyProperties(employeeAndUserVO,employee);
BeanUtils.copyProperties(employeeAndUserVO, employee);
String phoneAccount = this.getBaseMapper().getPhoneAccount(employee.getUserId());
if ((phoneAccount == null || phoneAccount.length() == 0)
&& employeeAndUserVO.getPrimaryPhone() != null
&& employeeAndUserVO.getPrimaryPhone().length() != 0
&& employeeAndUserVO.getPrimaryCode() != null
&& employeeAndUserVO.getPrimaryCode().length() != 0){
&& employeeAndUserVO.getPrimaryCode().length() != 0) {
// 没有绑定手机号,现在绑定
String code = RedisUtil.get(employeeAndUserVO.getPrimaryPhone());
if (code == null || code.length() == 0 || !Objects.equals(employeeAndUserVO.getPrimaryCode(),code)){
if (code == null || code.length() == 0 || !Objects.equals(employeeAndUserVO.getPrimaryCode(), code)) {
ExceptionCast.cast(HrmsCode.USER_PHONE_CODE_MISTAKE);
}
RedisUtil.del(employeeAndUserVO.getPrimaryPhone());
@ -89,20 +90,20 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
&& employeeAndUserVO.getNewPhone().length() != 0
&& employeeAndUserVO.getNewCode() != null
&& employeeAndUserVO.getNewCode().length() != 0
&& phoneAccount != null && phoneAccount.length() != 0){
&& phoneAccount != null && phoneAccount.length() != 0) {
// 更换绑定的手机号
if (!Objects.equals(phoneAccount,employeeAndUserVO.getPrimaryPhone())){
if (!Objects.equals(phoneAccount, employeeAndUserVO.getPrimaryPhone())) {
ExceptionCast.cast(HrmsCode.USER_PRIMARY_PHONE_MISTAKE);
}
String primaryCode = RedisUtil.get(employeeAndUserVO.getPrimaryPhone());
if (primaryCode == null || primaryCode.length() == 0
|| !Objects.equals(primaryCode,employeeAndUserVO.getPrimaryCode())){
|| !Objects.equals(primaryCode, employeeAndUserVO.getPrimaryCode())) {
ExceptionCast.cast(HrmsCode.USER_PRIMARY_CODE_MISTAKE);
}
RedisUtil.del(employeeAndUserVO.getPrimaryPhone());
String newCode = RedisUtil.get(employeeAndUserVO.getNewPhone());
if (newCode == null || newCode.length() == 0
|| !Objects.equals(newCode,employeeAndUserVO.getNewCode())){
|| !Objects.equals(newCode, employeeAndUserVO.getNewCode())) {
ExceptionCast.cast(HrmsCode.USER_NEW_CODE_MISTAKE);
}
RedisUtil.del(employeeAndUserVO.getNewPhone());
@ -116,33 +117,33 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
*/
@Override
public String uploadFile(MultipartFile file) {
if (file == null || file.isEmpty()){
if (file == null || file.isEmpty()) {
ExceptionCast.cast(HrmsCode.USER_FILE_IS_NULL);
}
try {
// 通过获取图片文件的宽度和高度来校验是否为图片文件
BufferedImage image = ImageIO.read(file.getInputStream());
if (image == null || image.getHeight() <= 0 || image.getWidth() <= 0){
if (image == null || image.getHeight() <= 0 || image.getWidth() <= 0) {
ExceptionCast.cast(HrmsCode.USER_FILE_TYPE_MISTAKE);
}
}catch (IOException e){
} catch (IOException e) {
ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL);
}
String filename = file.getOriginalFilename();
if (filename == null){
if (filename == null) {
ExceptionCast.cast(HrmsCode.USER_FILE_TYPE_MISTAKE);
}
String substring = filename.substring(filename.lastIndexOf("."));
String filePrefix = UUID.randomUUID().toString();
// 图片上传绝对路径
String filePath = PromptSuccess.UPLOAD_FILE_PATH+filePrefix+substring;
String filePath = PromptSuccess.UPLOAD_FILE_PATH + filePrefix + substring;
try {
file.transferTo(new File(filePath));
} catch (IOException e) {
ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL);
}
// 图片访问路径
return PromptSuccess.IMAGE_URL_PATH+filePrefix+substring;
return PromptSuccess.IMAGE_URL_PATH + filePrefix + substring;
}
/**
@ -153,27 +154,27 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
public Boolean updatePassword(String primaryPassword, String newPassword, String affirmNewPassword) {
if (primaryPassword == null || primaryPassword.length() == 0
|| newPassword == null || newPassword.length() == 0
|| affirmNewPassword == null || affirmNewPassword.length() == 0){
|| affirmNewPassword == null || affirmNewPassword.length() == 0) {
ExceptionCast.cast(HrmsCode.USER_PASSWORD_NOT_NULL);
}
// 两次输入是否相同
if (!Objects.equals(affirmNewPassword, newPassword)){
if (!Objects.equals(affirmNewPassword, newPassword)) {
ExceptionCast.cast(HrmsCode.USER_PASSWORD_NO_CONSISTENT);
}
// 旧密码是否正确
String userId = this.getUserId();
if (!Objects.equals(Md5Util.md5(primaryPassword + Long.parseLong(userId)),this.getBaseMapper().getPasswordById(Long.parseLong(userId)))){
if (!Objects.equals(Md5Util.md5(primaryPassword + Long.parseLong(userId)), this.getBaseMapper().getPasswordById(Long.parseLong(userId)))) {
ExceptionCast.cast(HrmsCode.USER_PASSWORD_MISTAKE);
}
// 正则校验
if (!newPassword.matches(PromptSuccess.MATCHES_STRING)){
if (!newPassword.matches(PromptSuccess.MATCHES_STRING)) {
ExceptionCast.cast(HrmsCode.USER_PASSWORD_MATCHES);
}
// 是否与账号相同
if (Objects.equals(newPassword,this.getBaseMapper().getAccountById(Long.parseLong(userId)))){
if (Objects.equals(newPassword, this.getBaseMapper().getAccountById(Long.parseLong(userId)))) {
ExceptionCast.cast(HrmsCode.USER_PASSWORD_IS_NO_ACCOUNT);
}
return this.getBaseMapper().updatePassword(Long.parseLong(userId),Md5Util.md5(newPassword + Long.parseLong(userId)));
return this.getBaseMapper().updatePassword(Long.parseLong(userId), Md5Util.md5(newPassword + Long.parseLong(userId)));
}
/**
@ -181,14 +182,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
*/
@Override
public Boolean getVerificationCode(String phone) {
if (phone == null || phone.length() == 0){
if (phone == null || phone.length() == 0) {
ExceptionCast.cast(HrmsCode.USER_PHONE_NOT_NULL);
}
String code = (int)((Math.random() * 9 + 1) * 100000)+ "";
String code = (int) ((Math.random() * 9 + 1) * 100000) + "";
// 发送短信
Boolean result = SendSMS.sendCode(phone,"SMS_204155294",code);
if (result){
RedisUtil.setEx(phone,code,PromptSuccess.OVERDUE_TIME);
Boolean result = SendSMS.sendCode(phone, "SMS_204155294", code);
if (result) {
RedisUtil.setEx(phone, code, PromptSuccess.OVERDUE_TIME);
return true;
}
return false;
@ -200,11 +201,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Transactional
@Override
public Boolean bindingPhoneAccount(String phone, String code) {
if (phone == null || phone.length() == 0 || code == null || code.length() == 0){
if (phone == null || phone.length() == 0 || code == null || code.length() == 0) {
ExceptionCast.cast(HrmsCode.USER_PHONE_OR_CODE_NOT_NULL);
}
if (RedisUtil.get(phone) == null || RedisUtil.get(phone).length() == 0
|| !Objects.equals(code,RedisUtil.get(phone))){
|| !Objects.equals(code, RedisUtil.get(phone))) {
ExceptionCast.cast(HrmsCode.USER_BINDING_FAIL);
}
RedisUtil.del(phone);
@ -218,15 +219,15 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Override
public Boolean cancel() {
String userId = this.getUserId();
return this.getBaseMapper().updateWeChat(Long.parseLong(userId),null);
return this.getBaseMapper().updateWeChat(Long.parseLong(userId), null);
}
/**
* 获取当前登录用户信息
*/
private String getUserId(){
private String getUserId() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("token");
return RedisUtil.get("dq:token:"+token);
return RedisUtil.get("dq:token:" + token);
}
}

@ -91,4 +91,6 @@ public class PromptSuccess {
public static final String GZU_NAME = "工作会"; // 工作会
public static final String DSH_NAME = "贷审会"; // 贷审会
public static final String DB_AB_NAME = "担保部A/B角"; // 担保部A/B角
}

Loading…
Cancel
Save