Przeglądaj źródła

Merge branch 'sit' into release_lutong_bug

lutong 2 miesięcy temu
rodzic
commit
b86f9b06c3

+ 29 - 60
alien-entity/src/main/resources/mapper/StoreInfoMapper.xml

@@ -5,68 +5,43 @@
 <mapper namespace="shop.alien.mapper.StoreInfoMapper">
 
     <!--
-        门店证照查询
-        证照类型与状态、提交时间、到期时间映射关系:
-          - img_type = 14: 营业执照
-          - img_type = 35: 其他资质证明
+        门店证照查询(存档审计)
+        以 store_license_history 为驱动表,展示所有上传记录
+        证照类型映射:license_status 1→营业执照(img_type=14)  2→其他资质证明(img_type=35)
+        审核状态:license_execute_status 1→审核通过  2→审核中  3→审核拒绝
     -->
     <select id="getStoreLicensePage"
             resultType="shop.alien.entity.store.vo.StoreLicenseInfoVo">
         SELECT
             CASE
-                WHEN si.img_type = 14 THEN '营业执照'
-                WHEN si.img_type = 35 THEN '其他资质证明'
+                WHEN slh.license_status = 1 THEN '营业执照'
+                WHEN slh.license_status = 2 THEN '其他资质证明'
                 ELSE ''
             END AS img_description,
-            si.img_type AS img_type,
+            CASE
+                WHEN slh.license_status = 1 THEN 14
+                WHEN slh.license_status = 2 THEN 35
+                ELSE 0
+            END AS img_type,
             s.id AS id,
             s.store_name AS store_name,
             s.store_tel AS store_tel,
             su.name AS name,
-            si.img_url,
+            slh.img_url,
             s.business_section_name,
             s.business_classify_name,
             s.business_types_name,
+            slh.license_execute_status AS states,
+            slh.created_time AS submit_date,
             CASE
-                WHEN si.img_type = 14 THEN s.business_license_status
-                WHEN si.img_type = 35 THEN slh.license_execute_status
-                ELSE ''
-            END AS states,
-            CASE
-                WHEN si.img_type = 14 THEN s.update_business_license_time
-                WHEN si.img_type = 35 THEN slh.created_time
-                ELSE NULL
-            END AS submit_date,
-            CASE
-                WHEN si.img_type = 14 THEN s.business_license_expiration_time
-                WHEN si.img_type = 35 THEN NULL
+                WHEN slh.license_status = 1 THEN s.business_license_expiration_time
                 ELSE NULL
             END AS expiration_time,
-            CASE
-                WHEN si.img_type = 14 THEN s.business_license_reason
-                WHEN si.img_type = 35 THEN slh.reason_refusal
-                ELSE NULL
-            END AS expiration_reason
-        FROM store_info s
-                 LEFT JOIN store_img si
-                           ON s.id = si.store_id
-                               AND si.img_type IN (14, 35)
-                               AND si.delete_flag = 0
-                 LEFT JOIN store_user su ON s.id = su.store_id
-                 LEFT JOIN (
-                     SELECT slh.store_id, slh.license_execute_status, slh.created_time, slh.reason_refusal, slh.img_url
-                     FROM store_license_history slh
-                     INNER JOIN (
-                         SELECT store_id, MAX(created_time) AS max_time
-                         FROM store_license_history
-                         WHERE license_status = 2 AND delete_flag = 0
-                         GROUP BY store_id
-                     ) slh2 ON slh.store_id = slh2.store_id 
-                             AND slh.created_time = slh2.max_time
-                     WHERE slh.license_status = 2 AND slh.delete_flag = 0
-                 ) slh ON s.id = slh.store_id AND si.img_type = 35
-        WHERE s.delete_flag = 0
-            AND si.img_type IS NOT NULL
+            slh.reason_refusal AS expiration_reason
+        FROM store_license_history slh
+                 INNER JOIN store_info s ON slh.store_id = s.id AND s.delete_flag = 0
+                 LEFT JOIN store_user su ON s.id = su.store_id AND su.delete_flag = 0
+        WHERE slh.delete_flag = 0
         <if test="storeName != null and storeName != ''">
             AND s.store_name LIKE CONCAT('%', #{storeName}, '%')
         </if>
@@ -79,28 +54,22 @@
         <if test="businessSection != null and businessSection != ''">
             AND s.business_section = #{businessSection}
         </if>
-        <if test="imgType != null">
-            AND si.img_type = #{imgType}
+        <if test="imgType != null and imgType == 14">
+            AND slh.license_status = 1
+        </if>
+        <if test="imgType != null and imgType == 35">
+            AND slh.license_status = 2
         </if>
         <if test="states != null and states != ''">
-            AND (
-                (si.img_type = 14 AND s.business_license_status = #{states})
-                OR (si.img_type = 35 AND slh.license_execute_status = #{states})
-            )
+            AND slh.license_execute_status = #{states}
         </if>
         <if test="startSubmitDate != null and startSubmitDate != ''">
-            AND (
-                (si.img_type = 14 AND s.update_business_license_time &gt;= #{startSubmitDate})
-                OR (si.img_type = 35 AND slh.created_time &gt;= #{startSubmitDate})
-            )
+            AND slh.created_time &gt;= #{startSubmitDate}
         </if>
         <if test="endSubmitDate != null and endSubmitDate != ''">
-            AND (
-                (si.img_type = 14 AND s.update_business_license_time &lt;= #{endSubmitDate})
-                OR (si.img_type = 35 AND slh.created_time &lt;= #{endSubmitDate})
-            )
+            AND slh.created_time &lt;= #{endSubmitDate}
         </if>
-        ORDER BY submit_date DESC, s.store_name ASC
+        ORDER BY slh.created_time DESC, s.store_name ASC
     </select>
 
 </mapper>

+ 3 - 31
alien-store/src/main/java/shop/alien/store/controller/AliController.java

@@ -10,12 +10,8 @@ import org.springframework.web.multipart.MultipartFile;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.StoreAliPayLog;
-import shop.alien.entity.store.StoreInfo;
-import shop.alien.entity.store.StoreUser;
 import shop.alien.store.service.AliService;
 import shop.alien.store.service.LifeUserService;
-import shop.alien.store.service.StoreInfoService;
-import shop.alien.store.service.StoreUserService;
 import shop.alien.store.util.ali.AliApi;
 import shop.alien.store.util.ali.AliSms;
 import shop.alien.util.ali.AliOSSUtil;
@@ -26,10 +22,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * @author ssk
@@ -57,12 +50,8 @@ public class AliController {
 
     private final AliApi aliApi;
 
-    private final StoreUserService storeUserService;
-
     private final LifeUserService lifeUserService;
 
-    private final StoreInfoService storeInfoService;
-
     @ApiOperation("阿里回调")
     @ApiOperationSupport(order = 1)
     @GetMapping("/notify")
@@ -83,32 +72,15 @@ public class AliController {
         String normalizedName = name == null ? null : name.trim();
         String normalizedIdCard = idCard == null ? null : idCard.trim().toUpperCase();
         log.info("AliController.getIdInfo?name={}&idCard={}", normalizedName, normalizedIdCard);
-        int size = 0;
         if (appType == 0) {
             // 根据身份证查询未注销用户:同一身份证只能实名一个账号
-            size = lifeUserService.count(new LambdaQueryWrapper<LifeUser>()
+            int size = lifeUserService.count(new LambdaQueryWrapper<LifeUser>()
                     .eq(LifeUser::getIdCard, normalizedIdCard)
                     .eq(LifeUser::getLogoutFlag, 0));
-        } else {
-            // 根据身份证查询已入驻或审核中的商家:同一身份证只能实名一个账号
-            List<StoreUser> storeUserList = storeUserService
-                    .list(new LambdaQueryWrapper<StoreUser>()
-                            .eq(StoreUser::getIdCard, normalizedIdCard));
-            List<Integer> storeIds = storeUserList.stream()
-                    .map(StoreUser::getStoreId)
-                    .filter(Objects::nonNull)
-                    .collect(Collectors.toList());
-            if (!storeIds.isEmpty()) {
-                size = storeInfoService
-                        .list(new LambdaQueryWrapper<StoreInfo>()
-                                .in(StoreInfo::getId, storeIds)
-                                .notIn(StoreInfo::getStoreApplicationStatus, 2))
-                        .size();
+            if (size > 0) {
+                return R.fail("该身份证已实名认证过");
             }
         }
-        if (size > 0) {
-            return R.fail("该身份证已实名认证过");
-        }
         if (aliPayConfig.getIdInfo(normalizedName, normalizedIdCard)) {
             return R.success("身份验证成功");
         }

+ 113 - 6
alien-store/src/main/java/shop/alien/store/controller/StoreCuisineController.java

@@ -155,14 +155,13 @@ public class StoreCuisineController {
             // 执行AI审核
             if (StringUtils.isNotEmpty(textContent.toString()) || imageUrls.size() > 0) {
                 AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(textContent.toString(), imageUrls);
-                boolean allPassed = (auditResult != null);
                 
                 LambdaUpdateWrapper<StoreCuisine> auditUpdateWrapper = new LambdaUpdateWrapper<>();
                 auditUpdateWrapper.eq(StoreCuisine::getId, savedCuisine.getId());
                 auditUpdateWrapper.set(StoreCuisine::getRejectionReason, null);
                 auditUpdateWrapper.set(StoreCuisine::getAuditTime, new Date());
                 
-                if (allPassed) {
+                if (auditResult.isPassed()) {
                     // 审核通过 审核状态为1 上架状态为1 已上架
                     auditUpdateWrapper.set(StoreCuisine::getStatus, 1);
                     auditUpdateWrapper.set(StoreCuisine::getShelfStatus, 1);
@@ -198,10 +197,118 @@ public class StoreCuisineController {
     @PostMapping("/updateCuisineCombo")
     public R<String> updateCuisineCombo(@RequestBody CuisineComboDto cuisineComboDto) {
         log.info("StoreCuisineController.updateCuisineCombo?dto={}", cuisineComboDto);
-        if (storeCuisineService.updateCuisineCombo(cuisineComboDto)) {
+        
+        // 参数验证
+        if (cuisineComboDto == null) {
+            log.error("修改美食套餐或单品失败:参数不能为空");
+            return R.fail("参数不能为空");
+        }
+        
+        // 校验ID不能为空
+        if (cuisineComboDto.getId() == null) {
+            log.error("修改美食套餐或单品失败:ID不能为空");
+            return R.fail("ID不能为空");
+        }
+        
+        try {
+            // 更新数据
+            boolean updateResult = storeCuisineService.updateCuisineCombo(cuisineComboDto);
+            if (!updateResult) {
+                log.error("修改美食套餐或单品失败:更新操作返回false");
+                return R.fail("修改失败");
+            }
+            
+            // 查询更新后的记录
+            StoreCuisine updatedCuisine = storeCuisineService.getById(cuisineComboDto.getId());
+            if (updatedCuisine == null) {
+                log.error("修改美食套餐或单品失败:更新后查询不到数据,ID={}", cuisineComboDto.getId());
+                return R.fail("修改失败:数据更新异常");
+            }
+            
+            // 将状态置为"审核中"(0)
+            LambdaUpdateWrapper<StoreCuisine> auditingWrapper = new LambdaUpdateWrapper<>();
+            auditingWrapper.eq(StoreCuisine::getId, updatedCuisine.getId());
+            auditingWrapper.set(StoreCuisine::getStatus, 0);
+            auditingWrapper.set(StoreCuisine::getRejectionReason, null);
+            auditingWrapper.set(StoreCuisine::getAuditTime, new Date());
+            storeCuisineMapper.update(null, auditingWrapper);
+            
+            // 组装 AI 审核文本和图片
+            StringBuilder textContent = new StringBuilder();
+            if (StringUtils.isNotEmpty(cuisineComboDto.getName())) {
+                textContent.append(cuisineComboDto.getName()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getDetailContent())) {
+                textContent.append(cuisineComboDto.getDetailContent()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getDescription())) {
+                textContent.append(cuisineComboDto.getDescription()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getDishReview())) {
+                textContent.append(cuisineComboDto.getDishReview()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getExtraNote())) {
+                textContent.append(cuisineComboDto.getExtraNote()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getReserveRule())) {
+                textContent.append(cuisineComboDto.getReserveRule()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(cuisineComboDto.getUsageRule())) {
+                textContent.append(cuisineComboDto.getUsageRule()).append(" ");
+            }
+
+            List<String> imageUrls = new ArrayList<>();
+
+            if (StringUtils.isNotEmpty(cuisineComboDto.getImages())) {
+                String[] urls = cuisineComboDto.getImages().split(",");
+                for (String url : urls) {
+                    if (StringUtils.isNotEmpty(url.trim())) {
+                        String trimmedUrl = url.trim();
+                        imageUrls.add(trimmedUrl);
+                    }
+                }
+            }
+
+            if (StringUtils.isNotEmpty(cuisineComboDto.getImageContent())) {
+                String[] urls = cuisineComboDto.getImageContent().split(",");
+                for (String url : urls) {
+                    if (StringUtils.isNotEmpty(url.trim())) {
+                        String trimmedUrl = url.trim();
+                        imageUrls.add(trimmedUrl);
+                    }
+                }
+            }
+
+            // 执行AI审核
+            if (StringUtils.isNotEmpty(textContent.toString()) || imageUrls.size() > 0) {
+                AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(textContent.toString(), imageUrls);
+//                boolean allPassed = (auditResult != null);
+                
+                LambdaUpdateWrapper<StoreCuisine> auditUpdateWrapper = new LambdaUpdateWrapper<>();
+                auditUpdateWrapper.eq(StoreCuisine::getId, updatedCuisine.getId());
+                auditUpdateWrapper.set(StoreCuisine::getRejectionReason, null);
+                auditUpdateWrapper.set(StoreCuisine::getAuditTime, new Date());
+                
+                if (auditResult.isPassed()) {
+                    // 审核通过 审核状态为1 上架状态为1 已上架
+                    auditUpdateWrapper.set(StoreCuisine::getStatus, 1);
+                    auditUpdateWrapper.set(StoreCuisine::getShelfStatus, 1);
+                    log.info("AI审核通过,ID: {}", updatedCuisine.getId());
+                } else {
+                    // 审核拒绝 审核状态为2 上架状态为0 没有上下架状态
+                    auditUpdateWrapper.set(StoreCuisine::getStatus, 2);
+                    auditUpdateWrapper.set(StoreCuisine::getShelfStatus, 0);
+                    log.info("AI审核拒绝,ID: {}", updatedCuisine.getId());
+                }
+                storeCuisineMapper.update(null, auditUpdateWrapper);
+            }
+            
             return R.success("修改成功");
+            
+        } catch (Exception e) {
+            log.error("修改美食套餐或单品异常", e);
+            return R.fail("修改失败:" + e.getMessage());
         }
-        return R.fail("修改失败");
     }
 
     @ApiOperation("获取所有美食单品名称,用于添加套餐")
@@ -325,7 +432,7 @@ public class StoreCuisineController {
             if(null==origin){
                 queryWrapper.eq(StoreCuisine::getShelfStatus, 1);
             }else if(origin == 0){
-                queryWrapper.in(StoreCuisine::getShelfStatus, 1,2);
+                queryWrapper.in(StoreCuisine::getShelfStatus, 0,1,2);
             }
             else{
                 queryWrapper.eq(StoreCuisine::getShelfStatus, origin);
@@ -377,7 +484,7 @@ public class StoreCuisineController {
             if(null==origin){
                 queryWrapper.eq(StorePrice::getShelfStatus, 1);
             }else if(origin == 0){
-                queryWrapper.in(StorePrice::getShelfStatus, 1,2);
+                queryWrapper.in(StorePrice::getShelfStatus, 0,1,2);
             }
             else{
                 queryWrapper.eq(StorePrice::getShelfStatus, origin);

+ 107 - 16
alien-store/src/main/java/shop/alien/store/controller/StorePriceController.java

@@ -188,14 +188,14 @@ public class StorePriceController {
             // 执行AI审核
             if (StringUtils.isNotEmpty(textContent.toString()) || imageUrls.size() > 0) {
                 AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(textContent.toString(), imageUrls);
-                boolean allPassed = (auditResult != null);
+//                boolean allPassed = (auditResult != null);
                 
                 LambdaUpdateWrapper<StorePrice> auditUpdateWrapper = new LambdaUpdateWrapper<>();
                 auditUpdateWrapper.eq(StorePrice::getId, savedPrice.getId());
                 auditUpdateWrapper.set(StorePrice::getRejectionReason, null);
                 auditUpdateWrapper.set(StorePrice::getAuditTime, new Date());
                 
-                if (allPassed) {
+                if (auditResult.isPassed()) {
                     // 审核通过 审核状态为1 上架状态为1 已上架
                     auditUpdateWrapper.set(StorePrice::getStatus, 1);
                     auditUpdateWrapper.set(StorePrice::getShelfStatus, 1);
@@ -232,27 +232,118 @@ public class StorePriceController {
     public R<String> update(@RequestBody StorePrice storePrice) {
         log.info("StorePriceController.update?storePrice={}", storePrice);
         
+        // 参数验证
+        if (storePrice == null) {
+            log.error("修改通用价目失败:参数不能为空");
+            return R.fail("参数不能为空");
+        }
+        
         // 校验ID不能为空
         if (storePrice.getId() == null) {
             log.error("修改通用价目失败:ID不能为空");
             return R.fail("ID不能为空");
         }
         
-        // 检查记录是否存在
-        StorePrice existingPrice = storePriceService.getById(storePrice.getId());
-        if (existingPrice == null) {
-            log.error("修改通用价目失败:ID={} 的记录不存在", storePrice.getId());
-            return R.fail("记录不存在,无法修改");
-        }
-        
-        // 执行更新
-        boolean result = storePriceService.updateById(storePrice);
-        if (result) {
+        try {
+            // 检查记录是否存在
+            StorePrice existingPrice = storePriceService.getById(storePrice.getId());
+            if (existingPrice == null) {
+                log.error("修改通用价目失败:ID={} 的记录不存在", storePrice.getId());
+                return R.fail("记录不存在,无法修改");
+            }
+            
+            // 执行更新
+            boolean updateResult = storePriceService.updateById(storePrice);
+            if (!updateResult) {
+                log.error("修改通用价目失败:ID={},更新操作返回false", storePrice.getId());
+                return R.fail("修改失败,请检查数据是否正确");
+            }
+            
+            // 查询更新后的记录
+            StorePrice updatedPrice = storePriceService.getById(storePrice.getId());
+            if (updatedPrice == null) {
+                log.error("修改通用价目失败:更新后查询不到数据,ID={}", storePrice.getId());
+                return R.fail("修改失败:数据更新异常");
+            }
+            
+            // 将状态置为"审核中"(0)
+            LambdaUpdateWrapper<StorePrice> auditingWrapper = new LambdaUpdateWrapper<>();
+            auditingWrapper.eq(StorePrice::getId, updatedPrice.getId());
+            auditingWrapper.set(StorePrice::getStatus, 0);
+            auditingWrapper.set(StorePrice::getRejectionReason, null);
+            auditingWrapper.set(StorePrice::getAuditTime, new Date());
+            storePriceMapper.update(null, auditingWrapper);
+            
+            // 组装 AI 审核文本和图片
+            StringBuilder textContent = new StringBuilder();
+            if (StringUtils.isNotEmpty(storePrice.getName())) {
+                textContent.append(storePrice.getName()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(storePrice.getDetailContent())) {
+                textContent.append(storePrice.getDetailContent()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(storePrice.getExtraNote())) {
+                textContent.append(storePrice.getExtraNote()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(storePrice.getReserveRule())) {
+                textContent.append(storePrice.getReserveRule()).append(" ");
+            }
+            if (StringUtils.isNotEmpty(storePrice.getUsageRule())) {
+                textContent.append(storePrice.getUsageRule()).append(" ");
+            }
+
+            List<String> imageUrls = new ArrayList<>();
+
+            if (StringUtils.isNotEmpty(storePrice.getImages())) {
+                String[] urls = storePrice.getImages().split(",");
+                for (String url : urls) {
+                    if (StringUtils.isNotEmpty(url.trim())) {
+                        String trimmedUrl = url.trim();
+                        imageUrls.add(trimmedUrl);
+                    }
+                }
+            }
+
+            if (StringUtils.isNotEmpty(storePrice.getImageContent())) {
+                String[] urls = storePrice.getImageContent().split(",");
+                for (String url : urls) {
+                    if (StringUtils.isNotEmpty(url.trim())) {
+                        String trimmedUrl = url.trim();
+                        imageUrls.add(trimmedUrl);
+                    }
+                }
+            }
+
+            // 执行AI审核
+            if (StringUtils.isNotEmpty(textContent.toString()) || imageUrls.size() > 0) {
+                AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(textContent.toString(), imageUrls);
+//                boolean allPassed = (auditResult != null);
+                
+                LambdaUpdateWrapper<StorePrice> auditUpdateWrapper = new LambdaUpdateWrapper<>();
+                auditUpdateWrapper.eq(StorePrice::getId, updatedPrice.getId());
+                auditUpdateWrapper.set(StorePrice::getRejectionReason, null);
+                auditUpdateWrapper.set(StorePrice::getAuditTime, new Date());
+                
+                if (auditResult.isPassed()) {
+                    // 审核通过 审核状态为1 上架状态为1 已上架
+                    auditUpdateWrapper.set(StorePrice::getStatus, 1);
+                    auditUpdateWrapper.set(StorePrice::getShelfStatus, 1);
+                    log.info("AI审核通过,ID: {}", updatedPrice.getId());
+                } else {
+                    // 审核拒绝 审核状态为2 上架状态为0 没有上下架状态
+                    auditUpdateWrapper.set(StorePrice::getStatus, 2);
+                    auditUpdateWrapper.set(StorePrice::getShelfStatus, 0);
+                    log.info("AI审核拒绝,ID: {}", updatedPrice.getId());
+                }
+                storePriceMapper.update(null, auditUpdateWrapper);
+            }
+            
             return R.success("修改成功");
+            
+        } catch (Exception e) {
+            log.error("修改通用价目异常", e);
+            return R.fail("修改失败:" + e.getMessage());
         }
-        
-        log.error("修改通用价目失败:ID={},更新操作返回false", storePrice.getId());
-        return R.fail("修改失败,请检查数据是否正确");
     }
 
     @TrackEvent(
@@ -361,7 +452,7 @@ public class StorePriceController {
         if(null==origin){
             queryWrapper.eq(StorePrice::getShelfStatus, 1);
         }else if(origin==0){
-            queryWrapper.in(StorePrice::getShelfStatus, 1,2);
+            queryWrapper.in(StorePrice::getShelfStatus, 0,1,2);
         }else{
             queryWrapper.eq(StorePrice::getShelfStatus, origin);
         }

+ 13 - 5
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -482,11 +482,19 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
         wrapper.eq(CommonRating::getIsShow, 1);
         List<CommonRating> commonRatings = commonRatingMapper.selectList(wrapper);
         List<Long> collect = commonRatings.stream().map(x -> x.getId()).collect(Collectors.toList());
-        // 查询没有回复的评价数量
-        wrapper.eq(CommonRating::getDeleteFlag,0);
-        wrapper.ge(CommonRating::getScore,0.5);
-        wrapper.le(CommonRating::getScore,2.5);
-        Integer noReplyCount = commonRatingMapper.getRatingWithNoReply(wrapper);
+        // 查询没有回复的差评数量(使用新 wrapper,避免复用导致条件累积问题)
+        // 注意:因为 deleteFlag 字段有 @TableLogic 注解,LambdaQueryWrapper.eq() 对该字段可能失效
+        // 而 getRatingWithNoReply 是自定义 XML 查询,不会自动补充逻辑删除条件
+        // 所以这里使用 .apply() 直接写 SQL 条件,确保 delete_flag = 0 生效
+        LambdaQueryWrapper<CommonRating> noReplyWrapper = new LambdaQueryWrapper<>();
+        noReplyWrapper.eq(CommonRating::getBusinessId, businessId);
+        noReplyWrapper.eq(CommonRating::getBusinessType, businessType);
+        noReplyWrapper.eq(CommonRating::getAuditStatus, 1);
+        noReplyWrapper.eq(CommonRating::getIsShow, 1);
+        noReplyWrapper.apply("delete_flag = 0");
+        noReplyWrapper.ge(CommonRating::getScore, 0.5);
+        noReplyWrapper.le(CommonRating::getScore, 2.5);
+        Integer noReplyCount = commonRatingMapper.getRatingWithNoReply(noReplyWrapper);
 
         // 如果为空直接返回
         Map<String, Object> ratingCount = new HashMap<>();

+ 15 - 25
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -4261,32 +4261,22 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                                                          String endSubmitDate) {
         IPage<StoreLicenseInfoVo> page = new Page<>(pageNum, pageSize);
         IPage<StoreLicenseInfoVo> storeLicensePage = storeInfoMapper.getStoreLicensePage(page, storeName, storeContact, storeTel, businessSection, imgType, states, startSubmitDate, endSubmitDate);
+        // 所有记录统一来自 store_license_history,状态值为 license_execute_status: 1-审核通过, 2-审核中, 3-审核拒绝
         for (StoreLicenseInfoVo record : storeLicensePage.getRecords()) {
-            if(record.getStates() != null){
-                if(record.getImgType() != null && record.getImgType() == 35){
-                    // 其他资质证明:直接使用状态值描述
-                    // license_execute_status: 1-审核通过, 2-审核中, 3-审核拒绝
-                    switch (record.getStates().toString()) {
-                        case "1":
-                            record.setStatesName("审核通过");
-                            break;
-                        case "2":
-                            record.setStatesName("审核中");
-                            break;
-                        case "3":
-                            record.setStatesName("审核拒绝");
-                            break;
-                        default:
-                            record.setStatesName("未知");
-                            break;
-                    }
-                } else {
-                    // 营业执照:从字典表获取状态名称
-                    StoreDictionary storeDictionary = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, record.getStates())
-                            .eq(StoreDictionary::getTypeName, "foodLicenceStatus"));
-                    if(storeDictionary != null){
-                        record.setStatesName(storeDictionary.getDictDetail());
-                    }
+            if (record.getStates() != null) {
+                switch (record.getStates().toString()) {
+                    case "1":
+                        record.setStatesName("审核通过");
+                        break;
+                    case "2":
+                        record.setStatesName("审核中");
+                        break;
+                    case "3":
+                        record.setStatesName("审核拒绝");
+                        break;
+                    default:
+                        record.setStatesName("未知");
+                        break;
                 }
             }
         }