Browse Source

feat(license): 实现AI自动审核经营许可证功能

- 移除LicenseController中重复的WebAudit插入逻辑
- 新增LicenseImgValidate类用于AI审核任务处理
- 在LicenseServiceImpl中集成AI审核调用逻辑
- 优化娱乐经营许可证图片描述文本
- 修复StorePlatformLoginServiceImpl中娱乐许可证过期判断逻辑
- 重构LifeUserOrderMapper中的SQL查询语句,增强可读性与维护性
- 完善食品经营许可证审核状态更新及历史记录管理
- 增加WebAuditMapper注入以支持许可证审核流程记录
zjy 1 tuần trước cách đây
mục cha
commit
740e2657e2

+ 65 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java

@@ -32,7 +32,7 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
 
     LifeUserOrderVo queryUserOrderDetail(@Param("orderId") String orderId,@Param("position") String position);
 
-    @Select("with total_coupon as(\n" +
+    /*    @Select("with total_coupon as(\n" +
             "-- 团购\n" +
             "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
             "from life_group_buy_main lgbm \n" +
@@ -57,12 +57,75 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
             "from life_user_order luo\n" +
             "left join store_info si on si.id = luo.store_id  -- 查询店铺相关 \n" +
             "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
-            "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
+            "left join order_coupon_middle ocm on ocm.order_id = luo.id and ocm.delete_flag = 0\n" +
             "left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
             "left join  store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
             "left join  store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
             "left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
             "left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
+            "${ew.customSqlSegment}")*/
+    @Select("with total_coupon as(\n" +
+            "-- 团购\n" +
+            "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
+            "\tfrom life_group_buy_main lgbm \n" +
+            "\tunion all\n" +
+            "-- 代金券\n" +
+            "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,0 effective_date_type,expiration_date effective_date_value \n" +
+            "\tfrom life_coupon lc \n" +
+            ")\n" +
+            "select \n" +
+            "    luo.id,\n" +
+            "    luo.buy_time,\n" +
+            "    luo.status,\n" +
+            "    luo.price,\n" +
+            "    luo.final_price,\n" +
+            "    luo.user_id,\n" +
+            "    luo.store_id,\n" +
+            "    luo.order_no,\n" +
+            "    luo.pay_time,\n" +
+            "    luo.cancel_time,\n" +
+            "    luo.finish_time,\n" +
+            "    luo.order_str,\n" +
+            "    luo.expert_order_id,\n" +
+            "    luo.order_appraise,\n" +
+            "    -- 店铺表列:用ANY_VALUE包裹(一个订单对应一个店铺,值唯一)\n" +
+            "    ANY_VALUE(si.store_name) as store_name,\n" +
+            "    ANY_VALUE(si.commission_rate) as commission_rate,\n" +
+            "    ANY_VALUE(si.business_section) as store_type,\n" +
+            "    ANY_VALUE(si.store_status) as store_status,\n" +
+            "    ANY_VALUE(si.business_status) as business_status,\n" +
+            "    -- 聚合列:优惠券数量(唯一聚合列,无需处理)\n" +
+            "    count(ocm.coupon_code) as coupon_count,\n" +
+            "    -- 图片表列:用ANY_VALUE包裹(一个优惠券对应一张图片,值唯一)\n" +
+            "    ANY_VALUE(simg.img_url) as img_url,\n" +
+            "    -- 用户表列:用ANY_VALUE包裹(一个订单对应一个用户,值唯一)\n" +
+            "    ANY_VALUE(lu.user_phone) as user_phone,\n" +
+            "    -- 评论状态:用ANY_VALUE包裹(一个订单最多一条评论,值唯一)\n" +
+            "    ANY_VALUE(IF(sc.id is null,false,true)) as hasComment,\n" +
+            "    -- 优惠券CTE列:拆解tc.*为具体列,用ANY_VALUE包裹\n" +
+            "    ANY_VALUE(tc.coupon_id) as coupon_id,\n" +
+            "    ANY_VALUE(tc.coupon_type) as coupon_type,\n" +
+            "    ANY_VALUE(tc.coupon_name) as coupon_name,\n" +
+            "    ANY_VALUE(tc.image_id) as tc_image_id,\n" +
+            "    ANY_VALUE(tc.effective_date_type) as effective_date_type,\n" +
+            "    ANY_VALUE(tc.effective_date_value) as effective_date_value,\n" +
+            "    -- 异常状态标识:用ANY_VALUE包裹\n" +
+            "    ANY_VALUE(CASE\n" +
+            "        WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
+            "        ELSE 0\n" +
+            "    END) AS abnormalStateFlag,\n" +
+            "    -- 折扣券列:用ANY_VALUE包裹(一个订单对应一个折扣券,值唯一)\n" +
+            "    ANY_VALUE(ldc.nominal_value) as nominal_value,\n" +
+            "    ANY_VALUE(ldc.type) as type\n" +
+            "from life_user_order luo\n" +
+            "left join store_info si on si.id = luo.store_id  -- 查询店铺相关 \n" +
+            "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
+            "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
+            "left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
+            "left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
+            "left join store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
+            "left join life_discount_coupon_user ldcu on ldcu.id = luo.quan_id \n" +
+            "left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
             "${ew.customSqlSegment}")
     IPage<LifeUserOrderVo> queryUserOrderList(IPage<LifeUserOrderVo> brandedPage,@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrderVo> lifeUserOrderQueryWrapper);
 

+ 251 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/api/LicenseImgValidate.java

@@ -0,0 +1,251 @@
+package shop.alien.storeplatform.api;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.StoreImg;
+import shop.alien.entity.store.StoreInfo;
+import shop.alien.entity.store.WebAudit;
+import shop.alien.entity.store.dto.StoreInfoDto;
+import shop.alien.entity.storePlatform.StoreLicenseHistory;
+import shop.alien.mapper.*;
+import shop.alien.mapper.storePlantform.StoreLicenseHistoryMapper;
+import shop.alien.storeplatform.service.StoreBusinessService;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author Lhaibo
+ * @date 2025/11/28
+ * @desc: xxl-job
+ * AI调用审核任务
+ * @since 1.0.0
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class LicenseImgValidate {
+
+    // 添加RestTemplate用于HTTP调用
+    private final RestTemplate restTemplate;
+
+    // 第三方接口地址 登录接口URL
+    @Value("${third-party-login.base-url}")
+    private String loginUrl;
+
+    //用户名
+    @Value("${third-party-user-name.base-url}")
+    private String userName;
+
+    //密码
+    @Value("${third-party-pass-word.base-url}")
+    private String passWord;
+
+    // 第三方接口地址 登录接口URL
+    @Value("${third-party-license-expiry.base-url}")
+    private String licenseImgUrl;
+
+
+    private final StoreBusinessService storeBusinessService;
+
+    private final WebAuditMapper webAuditMapper;
+
+    /** 商户证照历史记录数据访问对象 */
+    private final StoreLicenseHistoryMapper licenseHistoryMapper;
+
+    private final StoreImgMapper storeImgMapper;
+
+    /**
+     * AI自动审核任务处理器
+     * <p>
+     * 定时任务方法,用于批量处理用户违规举报记录,通过AI接口进行自动审核。
+     * 主要流程:
+     * 1. 查询所有待处理的用户违规记录
+     * 2. 遍历每条记录,组装审核请求数据
+     * 3. 调用AI审核接口进行自动审核(当前代码中已准备请求体,待实现接口调用)
+     * </p>
+     *
+     * @author Lhaibo
+     * @date 2025/11/28
+     * @since 1.0.0
+     */
+    public void aiCheckLicenseImg(String imgUrl, Integer storeId, int status, Integer id) {
+        log.info("开始执行AI自动审核任务");
+
+        try {
+            log.info("登录Ai服务获取token..." + loginUrl);
+            //构建请求参数
+            MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+            formData.add("username", userName);    // 表单字段 1:用户名
+            formData.add("password", passWord);    // 表单字段 2:密码
+
+            //设置请求头
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
+            ResponseEntity<String> postForEntity = null;
+            try {
+                postForEntity = restTemplate.postForEntity(loginUrl, requestEntity, String.class);
+            } catch (Exception e) {
+                log.error("类:PostMethod 方法:post", e);
+            }
+
+            if (postForEntity != null) {
+                if (postForEntity.getStatusCodeValue() == 200) {
+                    log.info("请求Ai服务登录成功 postForEntity.getBody()\t" + postForEntity.getBody());
+                    String responseBody = postForEntity.getBody();
+                    JSONObject jsonObject = JSONObject.parseObject(responseBody);
+                    JSONObject dataJson = jsonObject.getJSONObject("data");
+                    String accessToken = dataJson.getString("access_token");
+
+                    // 初始化请求体Map
+                    Map<String, Object> requestBody = new HashMap<>();
+
+                    // 设置投诉记录ID
+                    requestBody.put("image_url", imgUrl);
+
+                    HttpHeaders aiHeaders = new HttpHeaders();
+                    aiHeaders.setContentType(MediaType.APPLICATION_JSON);
+                    aiHeaders.set("Authorization", "Bearer " + accessToken);
+
+                    System.out.println(requestBody);
+                    HttpEntity<Map<String, Object>> request = new HttpEntity<>(requestBody, aiHeaders);
+                    ResponseEntity<String> response = null;
+                    try {
+                        response = restTemplate.postForEntity(licenseImgUrl, request, String.class);
+                        log.info("AI自动审核结果:{}", response.getBody());
+                        String licenseResponseBody = response.getBody();
+                        JSONObject licenseJsonObject = JSONObject.parseObject(licenseResponseBody);
+                        JSONObject licenseDataJson = licenseJsonObject.getJSONObject("data");
+                        boolean isValid = licenseDataJson.getBoolean("is_valid");
+                        String reason = licenseDataJson.getString("reason");
+
+                        if (status == 3 || status == 2) {
+                            StoreInfoDto storeInfoDto = new StoreInfoDto();
+                            storeInfoDto.setFoodLicenceReason(reason);
+                            storeInfoDto.setFoodLicenceStatus(isValid ? 1 : 3);
+                            storeInfoDto.setId(storeId);
+                            updatefoodLicenceImageStatus(storeInfoDto, status, id);
+                        }
+
+                    } catch (Exception e) {
+                        log.error("AI自动审核请求异常", e);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("AI自动审核任务执行异常", e);
+        }
+
+        log.info("AI自动审核任务执行完成");
+    }
+
+
+    public R<String> updatefoodLicenceImageStatus(StoreInfoDto storeInfoDto, int status, Integer id) {
+        log.info("StoreInfoController.updatefoodLicenceImageStatus?storeInfoDto={}", storeInfoDto);
+        StoreInfo storeInfo = storeBusinessService.getOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, storeInfoDto.getId()));
+        if (storeInfo != null) {
+            if (storeInfoDto.getFoodLicenceStatus() == 3) {
+                storeInfo.setFoodLicenceReason(storeInfoDto.getFoodLicenceReason());
+                storeInfo.setFoodLicenceStatus(storeInfoDto.getFoodLicenceStatus());
+                boolean flag = storeBusinessService.updateById(storeInfo);
+                if (flag) {
+                    // 审核拒绝时修改提交记录
+                    LambdaUpdateWrapper<StoreLicenseHistory> wrapper = new LambdaUpdateWrapper<>();
+                    wrapper.eq(StoreLicenseHistory::getStoreId, storeInfo.getId());
+                    wrapper.eq(StoreLicenseHistory::getId, id);
+                    wrapper.eq(StoreLicenseHistory::getLicenseStatus, status);
+                    wrapper.set(StoreLicenseHistory::getLicenseExecuteStatus, 3);
+                    wrapper.set(StoreLicenseHistory::getDeleteFlag, 1);
+                    wrapper.set(StoreLicenseHistory::getReasonRefusal, storeInfoDto.getFoodLicenceReason());
+                    licenseHistoryMapper.update(null, wrapper);
+
+                    //待审核状态变为已审核
+                    WebAudit webAudit = webAuditMapper.selectOne(new LambdaQueryWrapper<WebAudit>().eq(WebAudit::getStoreInfoId, storeInfo.getId()).eq(WebAudit::getDeleteFlag, 0).eq(WebAudit::getType, "7"));
+                    if (webAudit != null) {
+                        webAudit.setStatus("1");
+                        webAuditMapper.updateById(webAudit);
+                    }
+                    return R.success("拒绝审核成功");
+                } else {
+                    return R.fail("拒绝审核失败");
+                }
+            }
+            if (status == 2) {
+                storeInfo.setFoodLicenceReason(storeInfoDto.getFoodLicenceReason());
+                storeInfo.setFoodLicenceStatus(storeInfoDto.getFoodLicenceStatus());
+            } else {
+                storeInfo.setEntertainmentLicenceStatus(storeInfoDto.getFoodLicenceStatus());
+                storeInfo.setEntertainmentLicenceReason(storeInfoDto.getFoodLicenceReason());
+            }
+
+            boolean flag = storeBusinessService.updateById(storeInfo);
+            if (flag) {
+                int num = foodLicenceType(storeInfoDto.getId(), status);
+                if (num > 0) {
+                    //待审核状态变为已审核
+                    WebAudit webAudit = webAuditMapper.selectOne(new LambdaQueryWrapper<WebAudit>().eq(WebAudit::getStoreInfoId, storeInfo.getId()).eq(WebAudit::getDeleteFlag, 0).eq(WebAudit::getType, "7"));
+                    if (webAudit != null) {
+                        webAudit.setStatus("1");
+                        webAuditMapper.updateById(webAudit);
+                    }
+                }
+                return R.success("审核通过成功");
+            } else {
+                return R.fail("审核失败");
+            }
+        }
+        return R.fail("审核失败 店铺不存在");
+    }
+
+    public int foodLicenceType(int id, int status) {
+        //删除原合同照片
+        LambdaUpdateWrapper<StoreImg> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        lambdaUpdateWrapper.eq(StoreImg::getStoreId, id);
+        if (status == 2) {
+            lambdaUpdateWrapper.eq(StoreImg::getImgType, 25);
+        } else {
+            lambdaUpdateWrapper.eq(StoreImg::getImgType, 31);
+        }
+        lambdaUpdateWrapper.set(StoreImg::getDeleteFlag,1);
+        storeImgMapper.update(null,lambdaUpdateWrapper);
+        //修改续签合同类型为合同类型
+        List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, id).eq(StoreImg::getImgType, 24));
+        List<Integer> imgList = storeImgList.stream().map(StoreImg::getId).collect(Collectors.toList());
+        LambdaUpdateWrapper<StoreImg> imgLambdaUpdateWrapper = new LambdaUpdateWrapper();
+        imgLambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 25).set(StoreImg::getImgDescription,"经营许可证审核通过图片");
+        int num = storeImgMapper.update(null, imgLambdaUpdateWrapper);
+
+        // 将原来的食品经营许可证历史表数据删除
+        licenseHistoryMapper.delete(new LambdaQueryWrapper<StoreLicenseHistory>()
+                .eq(StoreLicenseHistory::getStoreId,id)
+                .eq(StoreLicenseHistory::getLicenseStatus,status)
+                .eq(StoreLicenseHistory::getLicenseExecuteStatus,1)
+                .eq(StoreLicenseHistory::getDeleteFlag,0));
+
+        // 将新的食品经营许可证历史表数据变为审核通过
+        LambdaUpdateWrapper<StoreLicenseHistory> wrapper1 = new LambdaUpdateWrapper<>();
+        wrapper1.eq(StoreLicenseHistory::getStoreId, id);
+        wrapper1.eq(StoreLicenseHistory::getLicenseStatus, status);
+        wrapper1.eq(StoreLicenseHistory::getLicenseExecuteStatus, 2);
+        wrapper1.eq(StoreLicenseHistory::getDeleteFlag, 0);
+        wrapper1.set(StoreLicenseHistory::getLicenseExecuteStatus, 1);
+        licenseHistoryMapper.update(null, wrapper1);
+        return num;
+    }
+}

+ 0 - 13
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/LicenseController.java

@@ -75,12 +75,6 @@ public class LicenseController {
         log.info("StoreInfoController.uploadfoodLicence?storeImg={}", storeImg);
         int num = licenseService.uploadfoodLicence(storeImg);
         if (num > 0) {
-            WebAudit webAudit = new WebAudit();
-            webAudit.setStoreInfoId(storeImg.getStoreId().toString());
-            webAudit.setType("7");
-            webAudit.setStatus("0");
-            webAudit.setContent("经营许可证");
-            webAuditMapper.insert(webAudit);
             return R.success("食品经营许可证图片添加成功");
         }
         return R.fail("食品经营许可证图片添加失败");
@@ -167,12 +161,6 @@ public class LicenseController {
         log.info("StoreInfoController.uploadEntertainmentLicence?storeImg={}", storeImg);
         int num = licenseService.uploadEntertainmentLicence(storeImg);
         if (num > 0) {
-            WebAudit webAudit = new WebAudit();
-            webAudit.setStoreInfoId(storeImg.getStoreId().toString());
-            webAudit.setType("8");
-            webAudit.setStatus("0");
-            webAudit.setContent("娱乐经营许可证");
-            webAuditMapper.insert(webAudit);
             return R.success("娱乐经营许可证图片添加成功");
         }
         return R.fail("娱乐经营许可证图片添加失败");
@@ -203,7 +191,6 @@ public class LicenseController {
         return R.data(licenseService.getStoreEntertainmentStatus(id));
     }
 
-
 }
 
 

+ 40 - 3
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/LicenseServiceImpl.java

@@ -1,21 +1,27 @@
 package shop.alien.storeplatform.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import shop.alien.entity.result.R;
 import shop.alien.entity.second.vo.StoreImgDTO;
 import shop.alien.entity.store.*;
+import shop.alien.entity.store.dto.StoreInfoDto;
 import shop.alien.entity.store.vo.StoreImgVo;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryDto;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryVO;
 import shop.alien.entity.storePlatform.StoreLicenseHistory;
 import shop.alien.mapper.StoreImgMapper;
 import shop.alien.mapper.StoreInfoMapper;
+import shop.alien.mapper.WebAuditMapper;
 import shop.alien.mapper.storePlantform.StoreLicenseHistoryMapper;
+import shop.alien.storeplatform.api.LicenseImgValidate;
 import shop.alien.storeplatform.service.LicenseService;
+import shop.alien.storeplatform.service.StoreBusinessService;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -45,6 +51,14 @@ public class LicenseServiceImpl implements LicenseService {
 
     private final StoreInfoMapper storeInfoMapper;
 
+    private final WebAuditMapper webAuditMapper;
+
+
+    private final LicenseImgValidate licenseImgValidate;
+
+
+
+
 
     @Override
     public int uploadfoodLicence(StoreImg storeImg) {
@@ -67,7 +81,17 @@ public class LicenseServiceImpl implements LicenseService {
         storeInfo.setFoodLicenceStatus(2);
         storeInfo.setId(storeImg.getStoreId());
         storeInfo.setUpdateFoodLicenceTime(new Date());
-        return storeInfoMapper.updateById(storeInfo);
+        int num = storeInfoMapper.updateById(storeInfo);
+
+        WebAudit webAudit = new WebAudit();
+        webAudit.setStoreInfoId(storeImg.getStoreId().toString());
+        webAudit.setType("7");
+        webAudit.setStatus("0");
+        webAudit.setContent("经营许可证");
+        webAuditMapper.insert(webAudit);
+
+        licenseImgValidate.aiCheckLicenseImg(storeImg.getImgUrl(), storeImg.getStoreId(), 2, licenseHistory.getId());
+        return num;
     }
 
     /**
@@ -456,7 +480,7 @@ public class LicenseServiceImpl implements LicenseService {
     public int uploadEntertainmentLicence(StoreImg storeImg) {
         storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,32).eq(StoreImg::getStoreId,storeImg.getStoreId()));
         storeImg.setImgType(32);
-        storeImg.setImgDescription("经营许可证审核通过前图片");
+        storeImg.setImgDescription("娱乐经营许可证审核通过前图片");
         storeImgMapper.insert(storeImg);
 
 
@@ -474,7 +498,19 @@ public class LicenseServiceImpl implements LicenseService {
         storeInfo.setEntertainmentLicenceStatus(2);
         storeInfo.setId(storeImg.getStoreId());
         storeInfo.setUpdateEntertainmentLicenceTime(new Date());
-        return storeInfoMapper.updateById(storeInfo);
+        int num = storeInfoMapper.updateById(storeInfo);
+
+        // 更新状态
+        WebAudit webAudit = new WebAudit();
+        webAudit.setStoreInfoId(storeImg.getStoreId().toString());
+        webAudit.setType("8");
+        webAudit.setStatus("0");
+        webAudit.setContent("娱乐经营许可证");
+        webAuditMapper.insert(webAudit);
+
+        // AI审核
+        licenseImgValidate.aiCheckLicenseImg(storeImg.getImgUrl(), storeImg.getStoreId(), 3, licenseHistory.getId());
+        return num;
     }
 
     /**
@@ -548,5 +584,6 @@ public class LicenseServiceImpl implements LicenseService {
         }
         return map;
     }
+
 }
 

+ 1 - 1
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformLoginServiceImpl.java

@@ -219,7 +219,7 @@ public class StorePlatformLoginServiceImpl extends ServiceImpl<StoreUserMapper,
                 if (storeInfo.getFoodLicenceExpirationTime().compareTo(new Date()) < 0) {
                     jsonObject.put("foodLicenceExpirationTime", 0);
                 }
-                if (storeInfo.getEntertainmentLicenceExpirationTime() != null && storeInfo.getEntertainmentLicenceExpirationTime().compareTo(new Date()) < 0) {
+                if (storeInfo.getEntertainmentLicenceExpirationTime() != null && storeInfo.getEntertainmentLicenceExpirationTime().compareTo(new Date()) > 0) {
                     jsonObject.put("entertainmentLicenceExpirationTime", 0);
                 }
             }