|
|
@@ -2,6 +2,7 @@ package com.ylx.massage.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.Duration;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
@@ -1059,4 +1060,82 @@ public class MaTechnicianServiceImpl extends ServiceImpl<MaTechnicianMapper, MaT
|
|
|
maTechnicianMapper.update(null, update);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 后台待审核页面审核通过商户。
|
|
|
+ *
|
|
|
+ * @param id 商户ID
|
|
|
+ * @param dto 待审核通过参数
|
|
|
+ * @param loginUser 当前登录用户
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int approvePendingMerchantAudit(Integer id, MaTechnicianPendingAuditSubmitDTO dto, LoginUser loginUser) {
|
|
|
+ if (id == null) {
|
|
|
+ throw new ServiceException("商户ID不能为空");
|
|
|
+ }
|
|
|
+ if (dto == null) {
|
|
|
+ throw new ServiceException("审核参数不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String idCardFront = checkRequiredFileUrl(dto.getIdCardFront(), "身份证正面加密图片");
|
|
|
+ String idCardBack = checkRequiredFileUrl(dto.getIdCardBack(), "身份证反面加密图片");
|
|
|
+ String healthCertificate = checkRequiredFileUrl(dto.getHealthCertificate(), "健康证加密图片");
|
|
|
+ String qualificationCertificate = checkRequiredFileUrl(dto.getQualificationCertificate(), "资格证加密图片");
|
|
|
+ checkRequiredExpirationDate(dto.getIdCardExpirationDate(), "身份证到期时间");
|
|
|
+ checkRequiredExpirationDate(dto.getHealthCertificateExpirationDate(), "健康证到期时间");
|
|
|
+ checkRequiredExpirationDate(dto.getQualificationCertificateExpirationDate(), "资格证到期时间");
|
|
|
+
|
|
|
+ String auditRemark = dto.getAuditRemark() == null ? "" : dto.getAuditRemark().trim();
|
|
|
+ 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("商户不存在或已删除");
|
|
|
+ }
|
|
|
+ if (!Integer.valueOf(AUDIT_WAIT_REVIEW).equals(existsMerchant.getAuditStatus())) {
|
|
|
+ throw new ServiceException("当前商户不是待审核状态,不能审核通过");
|
|
|
+ }
|
|
|
+
|
|
|
+ MaTechnician maTechnician = new MaTechnician();
|
|
|
+ maTechnician.setId(id);
|
|
|
+ /*maTechnician.setIdCard(String.join(",", idCardFront, idCardBack));
|
|
|
+ maTechnician.setHealthCertificate(healthCertificate);
|
|
|
+ maTechnician.setQualificationCertificate(qualificationCertificate);*/
|
|
|
+ maTechnician.setIdCardExpirationDate(dto.getIdCardExpirationDate());
|
|
|
+ maTechnician.setHealthCertificateExpirationDate(dto.getHealthCertificateExpirationDate());
|
|
|
+ maTechnician.setQualificationCertificateExpirationDate(dto.getQualificationCertificateExpirationDate());
|
|
|
+ maTechnician.setAuditStatus(AUDIT_APPROVED);
|
|
|
+ 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.approvePendingMerchantAuditById(maTechnician);
|
|
|
+ if (rows <= 0) {
|
|
|
+ throw new ServiceException("待审核商户审核通过失败");
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String checkRequiredFileUrl(String value, String fieldName) {
|
|
|
+ if (StringUtils.isBlank(value)) {
|
|
|
+ throw new ServiceException(fieldName + "不能为空");
|
|
|
+ }
|
|
|
+ return value.trim();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkRequiredExpirationDate(LocalDate value, String fieldName) {
|
|
|
+ if (value == null) {
|
|
|
+ throw new ServiceException(fieldName + "不能为空");
|
|
|
+ }
|
|
|
+ if (value.isBefore(LocalDate.now())) {
|
|
|
+ throw new ServiceException(fieldName + "不能早于当前日期");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|