|
@@ -364,32 +364,39 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int auditMerchantProfile(Integer merchantId, MerchantProfileAuditDTO dto, LoginUser loginUser) {
|
|
public int auditMerchantProfile(Integer merchantId, MerchantProfileAuditDTO dto, LoginUser loginUser) {
|
|
|
|
|
+ // 检查merchantId是否为空
|
|
|
|
|
+ if (merchantId == null) {
|
|
|
|
|
+ throw new ServiceException("商户ID不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 检查dto参数是否为空
|
|
|
|
|
+ if (dto == null) {
|
|
|
|
|
+ throw new ServiceException("审核参数不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 检查商户是否存在
|
|
|
MaTechnician merchant = getExistingMerchant(merchantId);
|
|
MaTechnician merchant = getExistingMerchant(merchantId);
|
|
|
- if (dto != null && (AUDIT_APPROVED == dto.getAuditStatus() || AUDIT_REJECTED == dto.getAuditStatus())) {
|
|
|
|
|
|
|
+ if (merchant == null) {
|
|
|
|
|
+ throw new ServiceException("商户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if ((AUDIT_APPROVED == dto.getAuditStatus() || AUDIT_REJECTED == dto.getAuditStatus())) {
|
|
|
String profileAuditRemark = dto.getAuditRemark() == null ? "" : dto.getAuditRemark().trim();
|
|
String profileAuditRemark = dto.getAuditRemark() == null ? "" : dto.getAuditRemark().trim();
|
|
|
if (AUDIT_REJECTED == dto.getAuditStatus() && StringUtils.isBlank(profileAuditRemark)) {
|
|
if (AUDIT_REJECTED == dto.getAuditStatus() && StringUtils.isBlank(profileAuditRemark)) {
|
|
|
throw new ServiceException("审核驳回时审核备注不能为空");
|
|
throw new ServiceException("审核驳回时审核备注不能为空");
|
|
|
}
|
|
}
|
|
|
if (AUDIT_APPROVED == dto.getAuditStatus()) {
|
|
if (AUDIT_APPROVED == dto.getAuditStatus()) {
|
|
|
checkProfileAuditExpirationDates(dto);
|
|
checkProfileAuditExpirationDates(dto);
|
|
|
|
|
+ // 审核通过所有待审核资料
|
|
|
return approveAllPendingProfile(merchant, dto, profileAuditRemark, loginUser);
|
|
return approveAllPendingProfile(merchant, dto, profileAuditRemark, loginUser);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 审核驳回所有待审核资料
|
|
|
return rejectAllPendingProfile(merchant, profileAuditRemark, loginUser);
|
|
return rejectAllPendingProfile(merchant, profileAuditRemark, loginUser);
|
|
|
}
|
|
}
|
|
|
- if (dto == null) {
|
|
|
|
|
- throw new ServiceException("审核参数不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- checkEnumValue(dto.getAuditStatus(), "审核状态", PROFILE_AUDIT_APPROVED, PROFILE_AUDIT_REJECTED);
|
|
|
|
|
- String auditRemark = dto.getAuditRemark() == null ? "" : dto.getAuditRemark().trim();
|
|
|
|
|
- if (PROFILE_AUDIT_REJECTED == dto.getAuditStatus() && StringUtils.isBlank(auditRemark)) {
|
|
|
|
|
- throw new ServiceException("审核驳回时审核备注不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- if (PROFILE_AUDIT_APPROVED == dto.getAuditStatus() || PROFILE_AUDIT_REJECTED == dto.getAuditStatus()) {
|
|
|
|
|
- throw new ServiceException("审核状态请使用2-审核通过或3-审核驳回");
|
|
|
|
|
- }
|
|
|
|
|
- throw new ServiceException("审核资料类型不正确");
|
|
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查审核通过时,是否填写了身份证到期日期、健康证到期日期、从业资格证到期日期
|
|
|
|
|
+ * @param dto
|
|
|
|
|
+ */
|
|
|
private void checkProfileAuditExpirationDates(MerchantProfileAuditDTO dto) {
|
|
private void checkProfileAuditExpirationDates(MerchantProfileAuditDTO dto) {
|
|
|
if (dto.getIdCardExpirationDate() == null
|
|
if (dto.getIdCardExpirationDate() == null
|
|
|
|| dto.getHealthCertificateExpirationDate() == null
|
|
|| dto.getHealthCertificateExpirationDate() == null
|
|
@@ -398,6 +405,15 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 审核通过所有待审核资料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchant
|
|
|
|
|
+ * @param dto
|
|
|
|
|
+ * @param auditRemark
|
|
|
|
|
+ * @param loginUser
|
|
|
|
|
+ * @return int
|
|
|
|
|
+ */
|
|
|
private int approveAllPendingProfile(MaTechnician merchant, MerchantProfileAuditDTO dto, String auditRemark, LoginUser loginUser) {
|
|
private int approveAllPendingProfile(MaTechnician merchant, MerchantProfileAuditDTO dto, String auditRemark, LoginUser loginUser) {
|
|
|
List<MerchantApplyFile> pendingFiles = listPendingProfileFiles(merchant.getId());
|
|
List<MerchantApplyFile> pendingFiles = listPendingProfileFiles(merchant.getId());
|
|
|
boolean hasPendingText = hasPendingProfileText(merchant);
|
|
boolean hasPendingText = hasPendingProfileText(merchant);
|
|
@@ -408,9 +424,21 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
if (!CollectionUtils.isEmpty(pendingFiles)) {
|
|
if (!CollectionUtils.isEmpty(pendingFiles)) {
|
|
|
rows += approvePendingProfileFiles(merchant.getId(), pendingFiles, auditRemark, loginUser);
|
|
rows += approvePendingProfileFiles(merchant.getId(), pendingFiles, auditRemark, loginUser);
|
|
|
}
|
|
}
|
|
|
|
|
+ //同时修改ma_technician表的审核状态
|
|
|
|
|
+ LambdaUpdateWrapper<MaTechnician> updateWrapper = new LambdaUpdateWrapper<MaTechnician>();
|
|
|
|
|
+ updateWrapper.eq(MaTechnician::getId, merchant.getId()).set(MaTechnician::getAuditStatus, dto.getAuditStatus());
|
|
|
|
|
+ rows += maTechnicianMapper.update(null, updateWrapper);
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 审核驳回所有待审核资料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchant
|
|
|
|
|
+ * @param auditRemark
|
|
|
|
|
+ * @param loginUser
|
|
|
|
|
+ * @return int
|
|
|
|
|
+ */
|
|
|
private int rejectAllPendingProfile(MaTechnician merchant, String auditRemark, LoginUser loginUser) {
|
|
private int rejectAllPendingProfile(MaTechnician merchant, String auditRemark, LoginUser loginUser) {
|
|
|
List<MerchantApplyFile> pendingFiles = listPendingProfileFiles(merchant.getId());
|
|
List<MerchantApplyFile> pendingFiles = listPendingProfileFiles(merchant.getId());
|
|
|
boolean hasPendingText = hasPendingProfileText(merchant);
|
|
boolean hasPendingText = hasPendingProfileText(merchant);
|
|
@@ -424,21 +452,45 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
if (!CollectionUtils.isEmpty(pendingFiles)) {
|
|
if (!CollectionUtils.isEmpty(pendingFiles)) {
|
|
|
rows += rejectPendingProfileFiles(merchant.getId(), auditRemark, loginUser);
|
|
rows += rejectPendingProfileFiles(merchant.getId(), auditRemark, loginUser);
|
|
|
}
|
|
}
|
|
|
|
|
+ //同时修改ma_technician表的审核状态
|
|
|
|
|
+ LambdaUpdateWrapper<MaTechnician> updateWrapper = new LambdaUpdateWrapper<MaTechnician>();
|
|
|
|
|
+ updateWrapper.eq(MaTechnician::getId, merchant.getId()).set(MaTechnician::getAuditStatus, AUDIT_REJECTED);
|
|
|
|
|
+ rows += maTechnicianMapper.update(null, updateWrapper);
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检查商户是否有待审核资料(昵称或简介)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchant
|
|
|
|
|
+ * @return boolean
|
|
|
|
|
+ */
|
|
|
private boolean hasPendingProfileText(MaTechnician merchant) {
|
|
private boolean hasPendingProfileText(MaTechnician merchant) {
|
|
|
return Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeNickNameAuditStatus())
|
|
return Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeNickNameAuditStatus())
|
|
|
|| Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeBriefAuditStatus());
|
|
|| Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeBriefAuditStatus());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取待审核的申请入驻文件资料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchantId
|
|
|
|
|
+ * @return List<MerchantApplyFile>
|
|
|
|
|
+ */
|
|
|
private List<MerchantApplyFile> listPendingProfileFiles(Integer merchantId) {
|
|
private List<MerchantApplyFile> listPendingProfileFiles(Integer merchantId) {
|
|
|
LambdaQueryWrapper<MerchantApplyFile> queryWrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<MerchantApplyFile> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(MerchantApplyFile::getMerchantId, merchantId)
|
|
|
|
|
- .eq(MerchantApplyFile::getAuditStatus, PROFILE_AUDIT_PENDING);
|
|
|
|
|
|
|
+ queryWrapper.eq(MerchantApplyFile::getMerchantId, merchantId).eq(MerchantApplyFile::getAuditStatus, PROFILE_AUDIT_PENDING);
|
|
|
return merchantApplyFileMapper.selectList(queryWrapper);
|
|
return merchantApplyFileMapper.selectList(queryWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 审核通过所有待审核资料(昵称或简介)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchant
|
|
|
|
|
+ * @param dto
|
|
|
|
|
+ * @param auditRemark
|
|
|
|
|
+ * @param loginUser
|
|
|
|
|
+ * @return int
|
|
|
|
|
+ */
|
|
|
private int approveProfileTechnicianInfo(MaTechnician merchant, MerchantProfileAuditDTO dto, String auditRemark, LoginUser loginUser) {
|
|
private int approveProfileTechnicianInfo(MaTechnician merchant, MerchantProfileAuditDTO dto, String auditRemark, LoginUser loginUser) {
|
|
|
LambdaUpdateWrapper<MaTechnician> updateWrapper = Wrappers.lambdaUpdate();
|
|
LambdaUpdateWrapper<MaTechnician> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
updateWrapper.eq(MaTechnician::getId, merchant.getId())
|
|
updateWrapper.eq(MaTechnician::getId, merchant.getId())
|
|
@@ -447,12 +499,15 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
.set(MaTechnician::getQualificationCertificateExpirationDate, dto.getQualificationCertificateExpirationDate())
|
|
.set(MaTechnician::getQualificationCertificateExpirationDate, dto.getQualificationCertificateExpirationDate())
|
|
|
.set(MaTechnician::getUpdateBy, getAuditUserName(loginUser))
|
|
.set(MaTechnician::getUpdateBy, getAuditUserName(loginUser))
|
|
|
.set(MaTechnician::getUpdateTime, DateUtils.getNowDate());
|
|
.set(MaTechnician::getUpdateTime, DateUtils.getNowDate());
|
|
|
|
|
+
|
|
|
|
|
+ // 审核通过昵称
|
|
|
if (Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeNickNameAuditStatus())) {
|
|
if (Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeNickNameAuditStatus())) {
|
|
|
updateWrapper.set(MaTechnician::getTeNickName, merchant.getPendingTeNickName())
|
|
updateWrapper.set(MaTechnician::getTeNickName, merchant.getPendingTeNickName())
|
|
|
.set(MaTechnician::getPendingTeNickName, null)
|
|
.set(MaTechnician::getPendingTeNickName, null)
|
|
|
.set(MaTechnician::getTeNickNameAuditStatus, PROFILE_AUDIT_APPROVED)
|
|
.set(MaTechnician::getTeNickNameAuditStatus, PROFILE_AUDIT_APPROVED)
|
|
|
.set(MaTechnician::getTeNickNameAuditRemark, auditRemark);
|
|
.set(MaTechnician::getTeNickNameAuditRemark, auditRemark);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 审核通过简介
|
|
|
if (Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeBriefAuditStatus())) {
|
|
if (Integer.valueOf(PROFILE_AUDIT_PENDING).equals(merchant.getTeBriefAuditStatus())) {
|
|
|
updateWrapper.set(MaTechnician::getTeBrief, merchant.getPendingTeBrief())
|
|
updateWrapper.set(MaTechnician::getTeBrief, merchant.getPendingTeBrief())
|
|
|
.set(MaTechnician::getPendingTeBrief, null)
|
|
.set(MaTechnician::getPendingTeBrief, null)
|
|
@@ -478,6 +533,15 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
return maTechnicianMapper.update(null, updateWrapper);
|
|
return maTechnicianMapper.update(null, updateWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 审核通过所有待审核文件资料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchantId
|
|
|
|
|
+ * @param pendingFiles
|
|
|
|
|
+ * @param auditRemark
|
|
|
|
|
+ * @param loginUser
|
|
|
|
|
+ * @return int
|
|
|
|
|
+ */
|
|
|
private int approvePendingProfileFiles(Integer merchantId, List<MerchantApplyFile> pendingFiles, String auditRemark, LoginUser loginUser) {
|
|
private int approvePendingProfileFiles(Integer merchantId, List<MerchantApplyFile> pendingFiles, String auditRemark, LoginUser loginUser) {
|
|
|
Set<String> fileTypes = pendingFiles.stream()
|
|
Set<String> fileTypes = pendingFiles.stream()
|
|
|
.map(MerchantApplyFile::getFileType)
|
|
.map(MerchantApplyFile::getFileType)
|
|
@@ -517,6 +581,12 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
return merchantApplyFileMapper.update(null, auditWrapper);
|
|
return merchantApplyFileMapper.update(null, auditWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取存在的商户信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param merchantId
|
|
|
|
|
+ * @return MaTechnician
|
|
|
|
|
+ */
|
|
|
private MaTechnician getExistingMerchant(Integer merchantId) {
|
|
private MaTechnician getExistingMerchant(Integer merchantId) {
|
|
|
if (merchantId == null) {
|
|
if (merchantId == null) {
|
|
|
throw new ServiceException("商户ID不能为空");
|
|
throw new ServiceException("商户ID不能为空");
|
|
@@ -1174,65 +1244,6 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 商户申请入驻提交审核
|
|
|
|
|
- *
|
|
|
|
|
- * @param id
|
|
|
|
|
- * @param dto
|
|
|
|
|
- * @param loginUser
|
|
|
|
|
- * @return int
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public int applyMerchantAudit(Integer id, MaTechnicianAuditSubmitDTO dto, LoginUser loginUser) {
|
|
|
|
|
- if (id == null) {
|
|
|
|
|
- throw new ServiceException("商户ID不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- if (dto == null) {
|
|
|
|
|
- throw new ServiceException("审核参数不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- checkEnumValue(dto.getAuditStatus(), "审核意见", AUDIT_APPROVED, AUDIT_REJECTED);
|
|
|
|
|
- String auditRemark = dto.getAuditRemark() == null ? "" : dto.getAuditRemark().trim();
|
|
|
|
|
- if (dto.getAuditStatus() == AUDIT_REJECTED && StringUtils.isBlank(auditRemark)) {
|
|
|
|
|
- throw new ServiceException("审核驳回时审核备注不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- // 审核通过时,身份证到期日期、健康证到期日期、资格证到期日期不能为空
|
|
|
|
|
- if (dto.getAuditStatus() == AUDIT_APPROVED && (dto.getIdCardExpirationDate() == null || dto.getHealthCertificateExpirationDate() == null || dto.getQualificationCertificateExpirationDate() == null)) {
|
|
|
|
|
- throw new ServiceException("审核通过时,身份证到期日期、健康证到期日期、资格证到期日期不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- if (auditRemark.length() > AUDIT_REMARK_MAX_LENGTH) {
|
|
|
|
|
- throw new ServiceException("审核备注长度不能超过" + AUDIT_REMARK_MAX_LENGTH + "个字符");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- MaTechnician existsMerchant = maTechnicianMapper.selectMerchantById(id);
|
|
|
|
|
- if (existsMerchant == null || !NOT_DELETED.equals(existsMerchant.getIsDelete())) {
|
|
|
|
|
- throw new ServiceException("商户不存在或已删除");
|
|
|
|
|
- }
|
|
|
|
|
- Integer currentAuditStatus = existsMerchant.getAuditStatus();
|
|
|
|
|
- if (currentAuditStatus == null || (currentAuditStatus != 1)) {
|
|
|
|
|
- throw new ServiceException("当前商户申请入驻已审核,不用重复审核");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- MaTechnician maTechnician = new MaTechnician();
|
|
|
|
|
- maTechnician.setId(id);
|
|
|
|
|
- //设置审核状态
|
|
|
|
|
- maTechnician.setAuditStatus(dto.getAuditStatus());
|
|
|
|
|
- maTechnician.setIdCardExpirationDate(dto.getIdCardExpirationDate());
|
|
|
|
|
- maTechnician.setHealthCertificateExpirationDate(dto.getHealthCertificateExpirationDate());
|
|
|
|
|
- maTechnician.setQualificationCertificateExpirationDate(dto.getQualificationCertificateExpirationDate());
|
|
|
|
|
- maTechnician.setAuditRemark(auditRemark);
|
|
|
|
|
- maTechnician.setApproveTime(DateUtils.getNowDate());
|
|
|
|
|
- if (loginUser != null && loginUser.getUser() != null) {
|
|
|
|
|
- maTechnician.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
|
|
- }
|
|
|
|
|
- maTechnician.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
-
|
|
|
|
|
- int rows = maTechnicianMapper.submitMerchantAuditById(maTechnician);
|
|
|
|
|
- if (rows <= 0) {
|
|
|
|
|
- throw new ServiceException("商户申请入驻审核失败");
|
|
|
|
|
- }
|
|
|
|
|
- return rows;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 后台查询商户证照
|
|
* 后台查询商户证照
|
|
|
*
|
|
*
|