Forráskód Böngészése

修复规格问题

Guos 1 napja
szülő
commit
e26dedcda7

+ 50 - 0
fs-common/src/main/java/com/fs/common/enums/LicenseTypeEnum.java

@@ -0,0 +1,50 @@
+package com.fs.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.stream.Stream;
+
+/**
+ * @description:
+ * @author: Guos
+ * @time: 2025/12/8 下午1:39
+ */
+@Getter
+@AllArgsConstructor
+public enum LicenseTypeEnum {
+
+    BUSINESS_LICENSE("businessLicense", "营业执照"),
+    DRUG_LICENSE("drugLicense", "药品经营许可证"),
+    FOOD_LICENSE("foodLicense", "食品经营许可证"),
+    MEDICAL_DEVICE_2("medicalDevice2", "第二类医疗器械经营备案凭证"),
+    MEDICAL_DEVICE_3("medicalDevice3", "第三类医疗器械经营备案凭证"),
+    UNKNOWN("unknown","未知证件");
+
+    private final String code;
+    private final String description;
+
+
+    public static LicenseTypeEnum getType(String code) {
+        return Stream.of(LicenseTypeEnum.values())
+                .filter(p -> p.getCode().equals(code))
+                .findFirst()
+                .orElse(null);
+    }
+
+    // 根据标题匹配枚举
+    public static LicenseTypeEnum matchByDescription(String description) {
+        if (description == null || description.trim().isEmpty()) {
+            return UNKNOWN;
+        }
+        String trimTitle = description.trim();
+        for (LicenseTypeEnum type : values()) {
+            if (trimTitle.contains(type.getDescription())) {
+                return type;
+            }
+        }
+        return UNKNOWN;
+    }
+
+
+}

+ 8 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreScrmService.java

@@ -1,10 +1,12 @@
 package com.fs.hisStore.service;
 
 import com.fs.common.core.domain.R;
+import com.fs.common.utils.txocr.ContainsResult;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.param.FsStoreScrmInfoParam;
+import com.fs.hisStore.vo.CheckLicenseVO;
 import com.fs.hisStore.vo.FsStoreDetailsScrmVo;
 import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import com.fs.hisStore.vo.FsStoreScrmVO;
@@ -137,4 +139,10 @@ public interface IFsStoreScrmService
      * @param storeId 店铺id
      * **/
     R qualificationReminder(Long storeId);
+
+    /**
+     * 所有的证书证件都可以从这里提取
+     * @param checkLicenseVO
+     */
+    ContainsResult checkLicense(CheckLicenseVO checkLicenseVO);
 }

+ 10 - 2
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -532,6 +532,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
             fsStoreProductMapper.insertFsStoreProduct(product);
         }
         storeAuditLogUtil.addOperLog(product.getProductId());
+        //处理多规格
         handleProductAttributes(param, product, storeId);
         return R.ok();
     }
@@ -540,17 +541,24 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         if (param.getSpecType().equals(0)) {
             ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()
                     .value("规格")
-                    .detail(ListUtil.toList("默认"))
+                    .detail(ListUtil.toList(param.getPrescribeSpec()))
                     .build();
             List<ProductArrtDTO> items=new ArrayList<>();
             items.add(fromatDetailDto);
-            param.getValues().get(0).setSku("默认");
+            param.getValues().get(0).setSku("每"+param.getUnitName());
             addProductAttr(product.getProductId(),items, param.getValues(), storeId);
         } else {
             addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
         }
     }
 
+    /**
+     * 添加商品属性
+     * @param productId 商品id
+     * @param items 属性
+     * @param values 属性值
+     * @param storeId 店铺id
+     */
     private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values,Long storeId){
         //清空attr
         fsStoreProductAttrMapper.clear(productId);

+ 23 - 5
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -4,38 +4,38 @@ import com.alibaba.fastjson.JSONArray;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.ServiceException;
-import com.fs.common.exception.base.BaseException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.txocr.ContainsResult;
+import com.fs.common.utils.txocr.TxOcrClient;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.StoreMD5PasswordEncoder;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
+import com.fs.common.enums.LicenseTypeEnum;
 import com.fs.hisStore.mapper.FsStoreProductScrmMapper;
 import com.fs.hisStore.mapper.FsStoreScrmMapper;
 import com.fs.hisStore.param.FsStoreScrmInfoParam;
 import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.util.BusinessScopeProductTypeUtil;
+import com.fs.hisStore.vo.CheckLicenseVO;
 import com.fs.hisStore.vo.FsStoreDetailsScrmVo;
 import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import com.fs.hisStore.vo.FsStoreScrmVO;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeanWrapper;
-import org.springframework.beans.BeanWrapperImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -509,6 +509,24 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         return R.ok().put("data",storeScrm);
     }
 
+    /**
+     * 所有的证书证件都可以从这里提取
+     * @param checkLicenseVO
+     */
+    @Override
+    public ContainsResult checkLicense(CheckLicenseVO checkLicenseVO) {
+        LicenseTypeEnum licenseTypeEnum = LicenseTypeEnum.getType(checkLicenseVO.getLicenseType());
+        if(ObjectUtils.isEmpty(licenseTypeEnum)){
+            throw new ServiceException("证照类型不存在!");
+        }
+        //营业执照从单独的接口,其他的走文档抽取
+        if(licenseTypeEnum.getCode().equals("businessLicense")){
+            return TxOcrClient.isContains(checkLicenseVO.getImageUrl(), null);
+        }else{
+            return TxOcrClient.extractAndWrapResult(checkLicenseVO.getImageUrl(), null);
+        }
+    }
+
     /**
      * 获取两个对象的所有差异字段(基于旧对象的所有字段,以新对象字段值为准进行对比)
      * 只要新旧值不同就视为差异

+ 29 - 0
fs-service/src/main/java/com/fs/hisStore/vo/CheckLicenseVO.java

@@ -0,0 +1,29 @@
+package com.fs.hisStore.vo;
+
+import lombok.Data;
+
+/**
+ * @description:
+ * @author: Guos
+ * @time: 2025/12/8 下午1:30
+ */
+@Data
+public class CheckLicenseVO {
+
+    /**
+     * 店铺id
+     */
+    private Long storeId;
+
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 这里可以采用枚举映射来
+     * com.fs.hisStore.enums.LicenseType
+     */
+    private String licenseType;
+
+}

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/vo/SelectForbiddenKeywordsVo.java

@@ -3,7 +3,7 @@ package com.fs.hisStore.vo;
 import lombok.Data;
 
 /**
- * @description:
+ * @description: 这个类可以和ForbiddenKeywordsVO经行整合(经常变动导致没时间)
  * @author: Guos
  * @time: 2025/12/5 下午2:20
  */

+ 14 - 0
fs-store/src/main/java/com/fs/hisStore/controller/store/FsStoreScrmController.java

@@ -18,9 +18,11 @@ import com.fs.hisStore.param.FsStoreScrmInfoParam;
 import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.utils.UserUtil;
+import com.fs.hisStore.vo.CheckLicenseVO;
 import com.fs.hisStore.vo.FsStoreDetailsScrmVo;
 import io.jsonwebtoken.lang.Collections;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.Assert;
 import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
@@ -43,6 +45,18 @@ public class FsStoreScrmController extends BaseController {
     @Autowired
     private StoreAuditLogUtil storeAuditLogUtil;
 
+    /**
+     * 所有的证书证件都可以从这里提取
+     * @param checkLicenseVO
+     */
+    @PostMapping("/checkLicense")
+    public R checkLicense(@RequestBody CheckLicenseVO checkLicenseVO) {
+        Assert.notNull(checkLicenseVO.getStoreId(), "店铺ID不能为空!");
+        Assert.notNull(checkLicenseVO.getLicenseType(), "证照类型不能为空!");
+        Assert.notNull(checkLicenseVO.getImageUrl(), "证照地址不能为空!");
+        return R.ok().put("data",fsStoreService.checkLicense(checkLicenseVO));
+    }
+
     /**
      * 新增或修改时候校验上传的营业执照是否包含药品零售
      */