|
|
@@ -126,47 +126,6 @@ public class LicenseAuditAsyncService {
|
|
|
log.info("{}证照审核结果,门店ID:{},图片URL:{},is_valid={},expiry_date={},is_expired={},remaining_days={},license_type={}",
|
|
|
licenseTypeName, storeId, imageUrl, isValid, expiryDateStr, isExpired, remainingDays, licenseType);
|
|
|
|
|
|
- // 如果是营业执照,解析并存入到期时间
|
|
|
- if (licenseStatus == 1 && StringUtils.isNotEmpty(expiryDateStr)) {
|
|
|
- try {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date expiryDate = sdf.parse(expiryDateStr);
|
|
|
-
|
|
|
- StoreInfo updateStoreInfo = new StoreInfo();
|
|
|
- updateStoreInfo.setId(storeId);
|
|
|
- updateStoreInfo.setBusinessLicenseExpirationTime(expiryDate);
|
|
|
-
|
|
|
- // 同步更新门店到期时间(expirationTime)
|
|
|
- // 门店到期时间 = min(合同到期时间, 营业执照到期时间)
|
|
|
- // 由于合同到期时间未单独存储,需要根据旧值推断
|
|
|
- StoreInfo currentStore = storeInfoMapper.selectById(storeId);
|
|
|
- if (currentStore != null) {
|
|
|
- Date currentExpiration = currentStore.getExpirationTime();
|
|
|
- Date oldBizExpiration = currentStore.getBusinessLicenseExpirationTime();
|
|
|
- if (currentExpiration != null && oldBizExpiration != null
|
|
|
- && currentExpiration.before(oldBizExpiration)) {
|
|
|
- // 合同到期时间 < 旧营业执照到期时间,说明合同是瓶颈
|
|
|
- // 新的门店到期时间 = min(合同到期时间, 新营业执照到期时间)
|
|
|
- updateStoreInfo.setExpirationTime(
|
|
|
- expiryDate.before(currentExpiration) ? expiryDate : currentExpiration
|
|
|
- );
|
|
|
- } else {
|
|
|
- // 营业执照是瓶颈(或两者相等、或旧值为空)
|
|
|
- // 直接用新的营业执照到期时间更新
|
|
|
- updateStoreInfo.setExpirationTime(expiryDate);
|
|
|
- }
|
|
|
- } else {
|
|
|
- updateStoreInfo.setExpirationTime(expiryDate);
|
|
|
- }
|
|
|
-
|
|
|
- storeInfoMapper.updateById(updateStoreInfo);
|
|
|
- log.info("营业执照到期时间已更新,门店ID:{},营业执照到期:{},门店到期:{}",
|
|
|
- storeId, expiryDateStr, updateStoreInfo.getExpirationTime());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("解析营业执照到期时间失败,门店ID:{},expiryDate:{}", storeId, expiryDateStr, e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// 判断审核结果
|
|
|
boolean needReject = false;
|
|
|
boolean needApprove = false;
|
|
|
@@ -322,8 +281,50 @@ public class LicenseAuditAsyncService {
|
|
|
storeInfoMapper.update(null, new LambdaUpdateWrapper<StoreInfo>()
|
|
|
.eq(StoreInfo::getId, storeId)
|
|
|
.set(StoreInfo::getBusinessLicenseStatus, 1)
|
|
|
+ .set(StoreInfo::getUpdateBusinessLicenseTime, new Date())
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
+ // 审核通过后,解析并存入营业执照到期时间
|
|
|
+ if (StringUtils.isNotEmpty(expiryDateStr)) {
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date expiryDate = sdf.parse(expiryDateStr);
|
|
|
+
|
|
|
+ StoreInfo updateStoreInfo = new StoreInfo();
|
|
|
+ updateStoreInfo.setId(storeId);
|
|
|
+ updateStoreInfo.setBusinessLicenseExpirationTime(expiryDate);
|
|
|
+
|
|
|
+ // 同步更新门店到期时间(expirationTime)
|
|
|
+ // 门店到期时间 = min(合同到期时间, 营业执照到期时间)
|
|
|
+ // 由于合同到期时间未单独存储,需要根据旧值推断
|
|
|
+ StoreInfo currentStore = storeInfoMapper.selectById(storeId);
|
|
|
+ if (currentStore != null) {
|
|
|
+ Date currentExpiration = currentStore.getExpirationTime();
|
|
|
+ Date oldBizExpiration = currentStore.getBusinessLicenseExpirationTime();
|
|
|
+ if (currentExpiration != null && oldBizExpiration != null
|
|
|
+ && currentExpiration.before(oldBizExpiration)) {
|
|
|
+ // 合同到期时间 < 旧营业执照到期时间,说明合同是瓶颈
|
|
|
+ // 新的门店到期时间 = min(合同到期时间, 新营业执照到期时间)
|
|
|
+ updateStoreInfo.setExpirationTime(
|
|
|
+ expiryDate.before(currentExpiration) ? expiryDate : currentExpiration
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 营业执照是瓶颈(或两者相等、或旧值为空)
|
|
|
+ // 直接用新的营业执照到期时间更新
|
|
|
+ updateStoreInfo.setExpirationTime(expiryDate);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ updateStoreInfo.setExpirationTime(expiryDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ storeInfoMapper.updateById(updateStoreInfo);
|
|
|
+ log.info("营业执照到期时间已更新,门店ID:{},营业执照到期:{},门店到期:{}",
|
|
|
+ storeId, expiryDateStr, updateStoreInfo.getExpirationTime());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("解析营业执照到期时间失败,门店ID:{},expiryDate:{}", storeId, expiryDateStr, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 审核通过后,先逻辑删除旧的营业执照记录
|
|
|
LambdaUpdateWrapper<StoreImg> deleteOldImgWrapper = new LambdaUpdateWrapper<>();
|
|
|
deleteOldImgWrapper.eq(StoreImg::getStoreId, storeId)
|