|
|
@@ -9,6 +9,7 @@ import com.xuekairui.user.entity.BusinessLicense;
|
|
|
import com.xuekairui.user.entity.User;
|
|
|
import com.xuekairui.user.enums.LicenseStatus;
|
|
|
import com.xuekairui.user.enums.MembershipLevel;
|
|
|
+import com.xuekairui.user.enums.OperationSource;
|
|
|
import com.xuekairui.user.enums.OperationType;
|
|
|
import com.xuekairui.user.enums.OperatorRole;
|
|
|
import com.xuekairui.user.mapper.BusinessLicenseMapper;
|
|
|
@@ -131,6 +132,7 @@ public class BusinessLicenseService {
|
|
|
@Transactional
|
|
|
public void saveOrUpdate(Long userId, BusinessLicenseSaveRequest request) {
|
|
|
BusinessLicense existing = getByUserId(userId);
|
|
|
+ final BusinessLicense targetLicense;
|
|
|
if (existing == null) {
|
|
|
BusinessLicense license = BusinessLicense.builder()
|
|
|
.userId(userId)
|
|
|
@@ -151,6 +153,7 @@ public class BusinessLicenseService {
|
|
|
.showVerifiedBadge(false)
|
|
|
.build();
|
|
|
businessLicenseMapper.insert(license);
|
|
|
+ targetLicense = license;
|
|
|
log.info("用户{}提交入驻信息:id={}", userId, license.getId());
|
|
|
} else {
|
|
|
existing.setStoreName(request.getStoreName());
|
|
|
@@ -174,8 +177,238 @@ public class BusinessLicenseService {
|
|
|
}
|
|
|
existing.setReviewStatus(LicenseStatus.PENDING.name());
|
|
|
businessLicenseMapper.updateById(existing);
|
|
|
+ targetLicense = existing;
|
|
|
log.info("用户{}更新入驻信息:id={}", userId, existing.getId());
|
|
|
}
|
|
|
+
|
|
|
+ // 事务提交后同步客户入驻信息到第三方系统(智价云药店版),失败不阻塞主流程
|
|
|
+ User submitter = userMapper.selectById(userId);
|
|
|
+ if (submitter != null) {
|
|
|
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
+ @Override
|
|
|
+ public void afterCommit() {
|
|
|
+ syncShopResourceToThirdParty(submitter, targetLicense);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // ======================== 运营侧:管理员新增入驻 ========================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 管理员后台新增入驻信息(代客户填写)
|
|
|
+ * <p>
|
|
|
+ * 业务规则:
|
|
|
+ * <ul>
|
|
|
+ * <li>必须选择一个未提交过入驻信息的客户(t_business_license 中无该 userId 记录)</li>
|
|
|
+ * <li>必填基础信息 + 营业执照 + 药品经营许可;二类/三类医疗器械至少上传一个</li>
|
|
|
+ * <li>管理员手动创建的记录状态为 PENDING,需再操作一次审核确认才转为 APPROVED</li>
|
|
|
+ * <li>审核确认通过后赠送 30 天高级会员并同步第三方(由 approve 方法处理)</li>
|
|
|
+ * </ul>
|
|
|
+ *
|
|
|
+ * @param request 入驻信息(含 userId)
|
|
|
+ * @param reviewerId 操作管理员 ID
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public void createByAdmin(BusinessLicenseSaveRequest request, Long reviewerId) {
|
|
|
+ Long userId = request.getUserId();
|
|
|
+ if (userId == null) {
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR, "必须选择一个客户");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验客户存在
|
|
|
+ User submitter = userMapper.selectById(userId);
|
|
|
+ if (submitter == null) {
|
|
|
+ throw new BusinessException(ErrorCode.NOT_FOUND, "客户(ID=" + userId + ")不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验该客户未提交过入驻信息
|
|
|
+ BusinessLicense existing = getByUserId(userId);
|
|
|
+ if (existing != null) {
|
|
|
+ throw new BusinessException(ErrorCode.BUSINESS_ERROR,
|
|
|
+ "该客户已提交过入驻信息,无法重复新增,请使用编辑功能");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验资质必填项
|
|
|
+ validateRequiredQualifications(request);
|
|
|
+
|
|
|
+ // 构建入驻记录,状态为 PENDING,需管理员再操作一次审核确认
|
|
|
+ BusinessLicense license = BusinessLicense.builder()
|
|
|
+ .userId(userId)
|
|
|
+ .storeName(request.getStoreName())
|
|
|
+ .terminalType(request.getTerminalType())
|
|
|
+ .province(request.getProvince())
|
|
|
+ .city(request.getCity())
|
|
|
+ .district(request.getDistrict())
|
|
|
+ .storeAddress(request.getStoreAddress())
|
|
|
+ .contactPerson(request.getContactPerson())
|
|
|
+ .contactPhone(request.getContactPhone())
|
|
|
+ .licenseImageUrl(request.getBusinessLicenseUrl())
|
|
|
+ .drugLicenseUrl(request.getDrugLicenseUrl())
|
|
|
+ .creditCode(request.getCreditCode())
|
|
|
+ .medicalDeviceClass2Url(request.getMedicalDeviceClass2Url())
|
|
|
+ .medicalDeviceClass3Url(request.getMedicalDeviceClass3Url())
|
|
|
+ .reviewStatus(LicenseStatus.PENDING.name())
|
|
|
+ .showVerifiedBadge(false)
|
|
|
+ .syncSource("MANUAL")
|
|
|
+ .status(0)
|
|
|
+ .build();
|
|
|
+ businessLicenseMapper.insert(license);
|
|
|
+ log.info("管理员{}新增入驻信息(待审核确认): licenseId={}, userId={}",
|
|
|
+ reviewerId, license.getId(), userId);
|
|
|
+
|
|
|
+ // 审计日志:管理员新增,记录变更后快照
|
|
|
+ String userName = submitter.getNickname() != null
|
|
|
+ ? submitter.getNickname() : String.valueOf(userId);
|
|
|
+ String storeName = license.getStoreName() != null ? license.getStoreName() : "未知药店";
|
|
|
+ auditLogService.logSuccess(
|
|
|
+ reviewerId != null ? reviewerId : 0L,
|
|
|
+ OperatorRole.ADMIN,
|
|
|
+ OperationType.LICENSE_CREATE,
|
|
|
+ "LICENSE:" + license.getId(),
|
|
|
+ license.getId(),
|
|
|
+ null,
|
|
|
+ Map.of("userId", userId, "userName", userName, "storeName", storeName,
|
|
|
+ "reviewStatus", LicenseStatus.PENDING.name(), "syncSource", "MANUAL"),
|
|
|
+ String.format("管理员新增客户「%s」(药店:%s)的入驻信息,待审核确认", userName, storeName),
|
|
|
+ OperationSource.ADMIN_CREATE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验资质必填项
|
|
|
+ * <p>
|
|
|
+ * 营业执照、药品经营许可必填;二类/三类医疗器械至少上传一个。
|
|
|
+ */
|
|
|
+ private void validateRequiredQualifications(BusinessLicenseSaveRequest request) {
|
|
|
+ if (isBlank(request.getBusinessLicenseUrl())) {
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR, "营业执照图片不能为空");
|
|
|
+ }
|
|
|
+ if (isBlank(request.getDrugLicenseUrl())) {
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR, "药品经营许可证不能为空");
|
|
|
+ }
|
|
|
+ boolean hasClass2 = !isBlank(request.getMedicalDeviceClass2Url());
|
|
|
+ boolean hasClass3 = !isBlank(request.getMedicalDeviceClass3Url());
|
|
|
+ if (!hasClass2 && !hasClass3) {
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR,
|
|
|
+ "必须上传二类或三类医疗器械资质(二选一)");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static boolean isBlank(String s) {
|
|
|
+ return s == null || s.isBlank();
|
|
|
+ }
|
|
|
+
|
|
|
+ // ======================== 运营侧:管理员编辑入驻 ========================
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 管理员编辑入驻信息(可修改客户信息、替换资质图片,保存后即时生效)
|
|
|
+ * <p>
|
|
|
+ * 业务规则:
|
|
|
+ * <ul>
|
|
|
+ * <li>可编辑全部入驻数据(含已审核 APPROVED),不受 PENDING 限制</li>
|
|
|
+ * <li>必填项约束同样生效:营业执照、药品经营许可必填,二类/三类至少一个</li>
|
|
|
+ * <li>资质图片覆盖原内容(非空即覆盖,空值保留原值)</li>
|
|
|
+ * <li>记录变更前/变更后快照,便于追溯</li>
|
|
|
+ * <li>事务提交后同步到第三方系统,失败不阻塞主流程</li>
|
|
|
+ * </ul>
|
|
|
+ *
|
|
|
+ * @param licenseId 入驻信息 ID
|
|
|
+ * @param request 编辑后的入驻信息
|
|
|
+ * @param reviewerId 操作管理员 ID
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public void editByAdmin(Long licenseId, BusinessLicenseSaveRequest request, Long reviewerId) {
|
|
|
+ BusinessLicense license = getById(licenseId);
|
|
|
+ if (license == null) {
|
|
|
+ throw new BusinessException(ErrorCode.NOT_FOUND, "入驻信息记录不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验资质必填项
|
|
|
+ validateRequiredQualifications(request);
|
|
|
+
|
|
|
+ // 变更前快照
|
|
|
+ Map<String, Object> beforeData = buildSnapshot(license);
|
|
|
+
|
|
|
+ Long userId = license.getUserId();
|
|
|
+ User submitter = userMapper.selectById(userId);
|
|
|
+ if (submitter == null) {
|
|
|
+ throw new BusinessException(ErrorCode.NOT_FOUND, "客户(ID=" + userId + ")不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 覆盖更新所有字段(资质图片非空即覆盖)
|
|
|
+ license.setStoreName(request.getStoreName());
|
|
|
+ license.setTerminalType(request.getTerminalType());
|
|
|
+ license.setProvince(request.getProvince());
|
|
|
+ license.setCity(request.getCity());
|
|
|
+ license.setDistrict(request.getDistrict());
|
|
|
+ license.setStoreAddress(request.getStoreAddress());
|
|
|
+ license.setContactPerson(request.getContactPerson());
|
|
|
+ license.setContactPhone(request.getContactPhone());
|
|
|
+ license.setLicenseImageUrl(request.getBusinessLicenseUrl());
|
|
|
+ license.setDrugLicenseUrl(request.getDrugLicenseUrl());
|
|
|
+ if (request.getCreditCode() != null) {
|
|
|
+ license.setCreditCode(request.getCreditCode());
|
|
|
+ }
|
|
|
+ if (request.getMedicalDeviceClass2Url() != null) {
|
|
|
+ license.setMedicalDeviceClass2Url(request.getMedicalDeviceClass2Url());
|
|
|
+ }
|
|
|
+ if (request.getMedicalDeviceClass3Url() != null) {
|
|
|
+ license.setMedicalDeviceClass3Url(request.getMedicalDeviceClass3Url());
|
|
|
+ }
|
|
|
+ license.setReviewerId(reviewerId);
|
|
|
+ license.setReviewTime(LocalDateTime.now());
|
|
|
+ businessLicenseMapper.updateById(license);
|
|
|
+ log.info("管理员{}编辑入驻信息: licenseId={}, userId={}", reviewerId, licenseId, userId);
|
|
|
+
|
|
|
+ // 变更后快照
|
|
|
+ Map<String, Object> afterData = buildSnapshot(license);
|
|
|
+
|
|
|
+ // 事务提交后同步到第三方系统
|
|
|
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
+ @Override
|
|
|
+ public void afterCommit() {
|
|
|
+ syncShopResourceToThirdParty(submitter, license);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 审计日志:管理员编辑,记录变更前/后快照
|
|
|
+ String userName = submitter.getNickname() != null
|
|
|
+ ? submitter.getNickname() : String.valueOf(userId);
|
|
|
+ String storeName = license.getStoreName() != null ? license.getStoreName() : "未知药店";
|
|
|
+ auditLogService.logSuccess(
|
|
|
+ reviewerId != null ? reviewerId : 0L,
|
|
|
+ OperatorRole.ADMIN,
|
|
|
+ OperationType.LICENSE_EDIT,
|
|
|
+ "LICENSE:" + license.getId(),
|
|
|
+ license.getId(),
|
|
|
+ beforeData,
|
|
|
+ afterData,
|
|
|
+ String.format("管理员编辑客户「%s」(药店:%s)的入驻信息", userName, storeName),
|
|
|
+ OperationSource.ADMIN_CREATE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构建入驻信息快照(用于审计日志的变更前/后对比)
|
|
|
+ */
|
|
|
+ private Map<String, Object> buildSnapshot(BusinessLicense license) {
|
|
|
+ Map<String, Object> snapshot = new HashMap<>();
|
|
|
+ snapshot.put("userId", license.getUserId());
|
|
|
+ snapshot.put("storeName", license.getStoreName());
|
|
|
+ snapshot.put("terminalType", license.getTerminalType());
|
|
|
+ snapshot.put("province", license.getProvince());
|
|
|
+ snapshot.put("city", license.getCity());
|
|
|
+ snapshot.put("district", license.getDistrict());
|
|
|
+ snapshot.put("storeAddress", license.getStoreAddress());
|
|
|
+ snapshot.put("contactPerson", license.getContactPerson());
|
|
|
+ snapshot.put("contactPhone", license.getContactPhone());
|
|
|
+ snapshot.put("creditCode", license.getCreditCode());
|
|
|
+ snapshot.put("businessLicenseUrl", license.getLicenseImageUrl());
|
|
|
+ snapshot.put("drugLicenseUrl", license.getDrugLicenseUrl());
|
|
|
+ snapshot.put("medicalDeviceClass2Url", license.getMedicalDeviceClass2Url());
|
|
|
+ snapshot.put("medicalDeviceClass3Url", license.getMedicalDeviceClass3Url());
|
|
|
+ snapshot.put("reviewStatus", license.getReviewStatus());
|
|
|
+ snapshot.put("showVerifiedBadge", license.getShowVerifiedBadge());
|
|
|
+ return snapshot;
|
|
|
}
|
|
|
|
|
|
// ======================== 运营侧:审核操作 ========================
|
|
|
@@ -225,12 +458,18 @@ public class BusinessLicenseService {
|
|
|
} catch (Exception e) {
|
|
|
log.warn("存入入驻审核通过事件失败,不影响主流程: userId={}", userId, e);
|
|
|
}
|
|
|
- // 同步客户入驻信息到第三方系统(智价云药店版),失败不阻塞主流程
|
|
|
- syncShopResourceAfterApproved(submitter, license);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 事务提交后同步客户入驻信息到第三方系统(智价云药店版),失败不阻塞主流程
|
|
|
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
+ @Override
|
|
|
+ public void afterCommit() {
|
|
|
+ syncShopResourceToThirdParty(submitter, license);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 审计日志:审核通过,记录客户信息
|
|
|
String userName = submitter.getNickname() != null
|
|
|
? submitter.getNickname() : String.valueOf(userId);
|
|
|
@@ -243,60 +482,78 @@ public class BusinessLicenseService {
|
|
|
license.getId(),
|
|
|
null,
|
|
|
Map.of("userId", userId, "userName", userName, "storeName", storeName),
|
|
|
- String.format("审核通过客户「%s」(药店:%s)的入驻申请", userName, storeName));
|
|
|
+ String.format("审核通过客户「%s」(药店:%s)的入驻申请", userName, storeName),
|
|
|
+ OperationSource.ADMIN_CREATE);
|
|
|
log.info("入驻审核通过: licenseId={}, userId={}, userName={}, reviewerId={}",
|
|
|
licenseId, userId, userName, reviewerId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 审核通过后同步客户入驻信息到第三方系统(智价云药店版)
|
|
|
+ * 同步客户入驻信息到第三方系统(智价云药店版)
|
|
|
* <p>
|
|
|
* 将客户手机号 + 店铺信息推送到第三方接口,第三方返回该客户的访问令牌。
|
|
|
- * 同步成功后将第三方 user_id 回写到入驻记录的 externalId 字段,并标记 sync_status=SYNCED。
|
|
|
- * 第三方不可用或同步失败时标记 sync_status=SYNC_FAILED,不影响本地审核流程,
|
|
|
- * 后续可通过 sync_status 筛选失败记录进行补推。
|
|
|
+ * 在入驻新增、审核驳回、审核通过三个环节均触发同步,确保第三方实时获取入驻状态变更。
|
|
|
+ * 同步成功后将第三方 user_id 回写到入驻记录的 externalId 字段,并标记 status=1。
|
|
|
+ * 第三方不可用或同步失败时标记 status=2,不影响本地主流程,
|
|
|
+ * 后续可通过 status 筛选失败记录进行补推。
|
|
|
*/
|
|
|
- private void syncShopResourceAfterApproved(User submitter, BusinessLicense license) {
|
|
|
+ private void syncShopResourceToThirdParty(User submitter, BusinessLicense license) {
|
|
|
try {
|
|
|
ShopResourceSyncService.SyncResult result =
|
|
|
shopResourceSyncService.syncShopResource(submitter, license);
|
|
|
if (result != null && result.getUserId() != null) {
|
|
|
license.setExternalId(result.getUserId());
|
|
|
- license.setSyncStatus("SYNCED");
|
|
|
+ license.setStatus(1);
|
|
|
businessLicenseMapper.updateById(license);
|
|
|
log.info("同步客户入驻信息到第三方成功: licenseId={}, externalUserId={}, newUser={}",
|
|
|
license.getId(), result.getUserId(), result.getNewUser());
|
|
|
} else {
|
|
|
- license.setSyncStatus("SYNC_FAILED");
|
|
|
+ license.setStatus(2);
|
|
|
businessLicenseMapper.updateById(license);
|
|
|
- log.warn("同步客户入驻信息到第三方未成功(第三方未返回user_id),标记为SYNC_FAILED: licenseId={}",
|
|
|
+ log.warn("同步客户入驻信息到第三方未成功(第三方未返回user_id),标记为2: licenseId={}",
|
|
|
license.getId());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- license.setSyncStatus("SYNC_FAILED");
|
|
|
+ license.setStatus(2);
|
|
|
businessLicenseMapper.updateById(license);
|
|
|
- log.warn("同步客户入驻信息到第三方失败,标记为SYNC_FAILED,不影响主流程: licenseId={}, error={}",
|
|
|
+ log.warn("同步客户入驻信息到第三方失败,标记为2,不影响主流程: licenseId={}, error={}",
|
|
|
license.getId(), e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 审核驳回
|
|
|
+ * <p>
|
|
|
+ * 业务规则:
|
|
|
+ * <ul>
|
|
|
+ * <li>只能对 PENDING(新提交/未审核通过)的记录驳回,APPROVED 不允许驳回</li>
|
|
|
+ * <li>驳回原因必填</li>
|
|
|
+ * <li>驳回后状态为 REJECTED,客户端/后台客户详情同步移除该条入驻展示</li>
|
|
|
+ * <li>用户可重新上传提交(saveOrUpdate 会将状态改回 PENDING)</li>
|
|
|
+ * <li>记录变更前/后快照,便于追溯</li>
|
|
|
+ * <li>事务提交后同步到第三方系统,失败不阻塞主流程</li>
|
|
|
+ * </ul>
|
|
|
*
|
|
|
* @param licenseId 入驻信息 ID
|
|
|
* @param reviewerId 审核人 ID
|
|
|
- * @param rejectReason 驳回原因
|
|
|
+ * @param rejectReason 驳回原因(必填)
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void reject(Long licenseId, Long reviewerId, String rejectReason) {
|
|
|
+ // 驳回原因必填
|
|
|
+ if (rejectReason == null || rejectReason.isBlank()) {
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR, "驳回原因不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
BusinessLicense license = validateReviewable(licenseId);
|
|
|
|
|
|
- license.setReviewStatus(LicenseStatus.REJECTED.name());
|
|
|
- license.setReviewerId(reviewerId);
|
|
|
- license.setReviewTime(LocalDateTime.now());
|
|
|
- license.setShowVerifiedBadge(false);
|
|
|
- license.setRejectReason(rejectReason);
|
|
|
- businessLicenseMapper.updateById(license);
|
|
|
+ // 审核通过后不允许驳回
|
|
|
+ if (LicenseStatus.APPROVED.name().equals(license.getReviewStatus())) {
|
|
|
+ throw new BusinessException(ErrorCode.BAD_REQUEST, "该入驻信息已审核通过,不允许驳回");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 变更前快照
|
|
|
+ Map<String, Object> beforeData = buildSnapshot(license);
|
|
|
|
|
|
// 提交用户必须存在
|
|
|
Long userId = license.getUserId();
|
|
|
@@ -305,7 +562,17 @@ public class BusinessLicenseService {
|
|
|
throw new BusinessException(ErrorCode.NOT_FOUND, "提交用户(ID=" + userId + ")不存在,无法审核");
|
|
|
}
|
|
|
|
|
|
- // 审计日志:审核驳回,记录客户信息
|
|
|
+ license.setReviewStatus(LicenseStatus.REJECTED.name());
|
|
|
+ license.setReviewerId(reviewerId);
|
|
|
+ license.setReviewTime(LocalDateTime.now());
|
|
|
+ license.setShowVerifiedBadge(false);
|
|
|
+ license.setRejectReason(rejectReason);
|
|
|
+ businessLicenseMapper.updateById(license);
|
|
|
+
|
|
|
+ // 变更后快照
|
|
|
+ Map<String, Object> afterData = buildSnapshot(license);
|
|
|
+
|
|
|
+ // 审计日志:审核驳回,记录变更前/后快照
|
|
|
String userName = submitter.getNickname() != null
|
|
|
? submitter.getNickname() : String.valueOf(userId);
|
|
|
String storeName = license.getStoreName() != null ? license.getStoreName() : "未知药店";
|
|
|
@@ -315,13 +582,21 @@ public class BusinessLicenseService {
|
|
|
OperationType.LICENSE_REJECT,
|
|
|
"LICENSE:" + license.getId(),
|
|
|
license.getId(),
|
|
|
- null,
|
|
|
- Map.of("userId", userId, "userName", userName, "storeName", storeName, "rejectReason",
|
|
|
- rejectReason != null ? rejectReason : ""),
|
|
|
+ beforeData,
|
|
|
+ afterData,
|
|
|
String.format("驳回客户「%s」(药店:%s)的入驻申请,原因:%s",
|
|
|
- userName, storeName, rejectReason != null ? rejectReason : "未填写"));
|
|
|
+ userName, storeName, rejectReason),
|
|
|
+ OperationSource.ADMIN_CREATE);
|
|
|
log.info("入驻审核驳回: licenseId={}, userId={}, userName={}, reviewerId={}, reason={}",
|
|
|
licenseId, userId, userName, reviewerId, rejectReason);
|
|
|
+
|
|
|
+ // 事务提交后同步客户入驻信息到第三方系统(智价云药店版),失败不阻塞主流程
|
|
|
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
|
+ @Override
|
|
|
+ public void afterCommit() {
|
|
|
+ syncShopResourceToThirdParty(submitter, license);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -348,6 +623,8 @@ public class BusinessLicenseService {
|
|
|
@lombok.NoArgsConstructor
|
|
|
@lombok.AllArgsConstructor
|
|
|
public static class BusinessLicenseSaveRequest {
|
|
|
+ /** 客户用户ID(管理员新增时必填,用户自主提交时由 Service 注入) */
|
|
|
+ private Long userId;
|
|
|
private String storeName;
|
|
|
private String terminalType;
|
|
|
private String province;
|