Ver Fonte

处理处方订单逻辑、处理说明书查看逻辑、店铺订单查询问题

yjwang há 1 semana atrás
pai
commit
7455aaf8fa

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -595,7 +595,7 @@ public interface FsStoreProductScrmMapper
      * @param param 请求参数
      * @return int
      * **/
-    int instructionsViewable(@Param("param") FsStoreCartCountParam param);
+    Integer instructionsViewable(@Param("param") FsStoreCartCountParam param);
 
     /**
      * 获取商品资质提示信息

+ 133 - 124
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -110,7 +110,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 商品
      */
     @Override
-    public FsStoreProductScrm selectFsStoreProductById(Long productId) {
+    public FsStoreProductScrm selectFsStoreProductById(Long productId)
+    {
         return fsStoreProductMapper.selectFsStoreProductById(productId);
     }
 
@@ -121,7 +122,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 商品
      */
     @Override
-    public List<FsStoreProductScrm> selectFsStoreProductList(FsStoreProductScrm fsStoreProduct) {
+    public List<FsStoreProductScrm> selectFsStoreProductList(FsStoreProductScrm fsStoreProduct)
+    {
         return fsStoreProductMapper.selectFsStoreProductList(fsStoreProduct);
     }
 
@@ -132,7 +134,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 结果
      */
     @Override
-    public int insertFsStoreProduct(FsStoreProductScrm fsStoreProduct) {
+    public int insertFsStoreProduct(FsStoreProductScrm fsStoreProduct)
+    {
         fsStoreProduct.setCreateTime(DateUtils.getNowDate());
         fsStoreProductMapper.insertFsStoreProduct(fsStoreProduct);
         storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
@@ -146,7 +149,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 结果
      */
     @Override
-    public int updateFsStoreProduct(FsStoreProductScrm fsStoreProduct) {
+    public int updateFsStoreProduct(FsStoreProductScrm fsStoreProduct)
+    {
         fsStoreProduct.setUpdateTime(DateUtils.getNowDate());
         storeAuditLogUtil.addOperLog(fsStoreProduct.getProductId());
         FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(fsStoreProduct.getProductId());
@@ -157,7 +161,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                     Map<String, Object> diff = getDiff(oldFsStoreProduct, fsStoreProduct);
                     Set<String> diff_columns = diff.keySet();
                     JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
-                    if (com.fs.common.utils.StringUtils.isNotEmpty(productColumns)) {
+                    if(com.fs.common.utils.StringUtils.isNotEmpty(productColumns)){
                         //判断diff_columns是否在productColumns中,不是则将isAudit设置为0
                         for (String column : diff_columns) {
                             if (!productColumns.contains(column)) {
@@ -165,7 +169,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                                 break;
                             }
                         }
-                    } else {
+                    }else{
                         fsStoreProduct.setIsAudit("0");
                     }
                 }
@@ -212,7 +216,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 结果
      */
     @Override
-    public int deleteFsStoreProductByIds(Long[] productIds) {
+    public int deleteFsStoreProductByIds(Long[] productIds)
+    {
         storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
         return fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
     }
@@ -224,7 +229,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 结果
      */
     @Override
-    public int deleteFsStoreProductById(Long productId) {
+    public int deleteFsStoreProductById(Long productId)
+    {
         return fsStoreProductMapper.deleteFsStoreProductById(productId);
     }
 
@@ -233,20 +239,20 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductListVO(fsStoreProduct);
 
         for (FsStoreProductListVO item : fsStoreProductListVOS) {
-            if (StringUtils.isNotBlank(item.getCompanyIds())) {
+            if(StringUtils.isNotBlank(item.getCompanyIds())){
                 List<String> companyNameList = new ArrayList<>();
                 String[] split = item.getCompanyIds().split(",");
 
                 for (String companyId : split) {
-                    if (StringUtils.isNotBlank(companyId)) {
+                    if(StringUtils.isNotBlank(companyId)) {
                         String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
                         companyNameList.add(companyName);
                     }
                 }
-                item.setCompanyName(String.join(",", companyNameList));
+                item.setCompanyName(String.join(",",companyNameList));
             }
             //店铺名称
-            if (StringUtils.isNotEmpty(item.getStoreId()))
+            if(StringUtils.isNotEmpty(item.getStoreId()))
                 item.setStoreName(fsStoreScrmService.selectFsStoreByStoreId(Long.parseLong(item.getStoreId())).getStoreName());
         }
 
@@ -258,7 +264,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         List<FsStoreProductListVO> fsStoreProductListVOS = fsStoreProductMapper.selectFsStoreProductBarCodeListVO(fsStoreProduct);
 
         for (FsStoreProductListVO item : fsStoreProductListVOS) {
-            if (StringUtils.isNotBlank(item.getCompanyIds())) {
+            if(StringUtils.isNotBlank(item.getCompanyIds())){
                 List<String> companyNameList = new ArrayList<>();
                 String[] split = item.getCompanyIds().split(",");
 
@@ -266,14 +272,14 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                     String companyName = companyCacheService.selectCompanyNameById(Long.valueOf(companyId));
                     companyNameList.add(companyName);
                 }
-                item.setCompanyName(String.join(",", companyNameList));
+                item.setCompanyName(String.join(",",companyNameList));
             }
         }
         return fsStoreProductListVOS;
     }
 
     @Override
-    public Map<String, Object> getFormatAttr(Long productId, String jsonStr, Long[] stores) {
+    public Map<String, Object> getFormatAttr(Long productId, String jsonStr,Long[] stores) {
         JSONObject jsonObject = JSON.parseObject(jsonStr);
         Map<String, Object> resultMap = new LinkedHashMap<>(3);
         if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
@@ -339,13 +345,13 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
             valueMap.put("brokerageThree", 0);
             valueMap.put("integral", 0);
             if (productId > 0) {
-                FsStoreProductAttrValueScrm attrValueMap = new FsStoreProductAttrValueScrm();
+                FsStoreProductAttrValueScrm attrValueMap=new FsStoreProductAttrValueScrm();
                 attrValueMap.setProductId(productId);
                 attrValueMap.setSku(sku);
                 List<FsStoreProductAttrValueScrm> values = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueList(attrValueMap);
-                if (values != null && values.size() == 1) {
-                    valueMap.put("id", values.get(0).getId());
-                    valueMap.put("sku", values.get(0).getSku());
+                if (values != null&&values.size()==1) {
+                    valueMap.put("id",values.get(0).getId());
+                    valueMap.put("sku",values.get(0).getSku());
                     valueMap.put("image", values.get(0).getImage());
                     valueMap.put("price", values.get(0).getPrice());
                     valueMap.put("cost", values.get(0).getCost());
@@ -374,9 +380,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Override
     @Transactional
     public R addOrEdit(FsStoreProductAddEditParam param) {
-        ProductAttrCountDto countDto = computedProductCount(param.getValues());
-        FsStoreProductScrm product = new FsStoreProductScrm();
-        BeanUtils.copyProperties(param, product);
+        ProductAttrCountDto countDto=computedProductCount(param.getValues());
+        FsStoreProductScrm product=new FsStoreProductScrm();
+        BeanUtils.copyProperties(param,product);
         product.setPrice(countDto.getMinPrice());
         product.setOtPrice(countDto.getMinOtPrice());
         product.setCost(countDto.getMinCost());
@@ -388,42 +394,35 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         product.setStoreId(storeId);
         product.setIsDrug(param.getIsDrug().toString());
         product.setInstructionManual(param.getInstructionManual());
-        product.setReviewAudit(param.getReviewAudit());
-        product.setQualificationCertificate(param.getQualificationCertificate());
-        if (param.getQualificationCertificateStart() != null) {
-            product.setQualificationCertificateStart(LocalDate.parse(param.getQualificationCertificateStart()));
-        }
-        if (param.getQualificationCertificateEnd() != null) {
-            product.setQualificationCertificateEnd(LocalDate.parse(param.getQualificationCertificateEnd()));
-        }
+
         //获取商品编码
-        if (!param.getValues().isEmpty()) {
-            if (param.getValues().get(0).getBarCode() != null) {
+        if(!param.getValues().isEmpty()){
+            if(param.getValues().get(0).getBarCode() != null){
                 product.setBarCode(param.getValues().get(0).getBarCode());
             }
         }
         //校验店铺资质信息
         //获取店铺
         FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
-        if (store == null || 1 != store.getStatus()) {
+        if(store == null || 1 != store.getStatus()){
             return R.error("店铺不存在或未启用");
-        } else {
+        }else{
             //验证资质
-            switch (product.getProductType()) {
+            switch (product.getProductType()){
                 case 1://非处方
                     break;
                 case 2://处方
-                    if (StringUtils.isEmpty(store.getDrugLicense()) || "".equals(store.getDrugLicense()) || LocalDate.now().isAfter(store.getDrugLicenseExpiryEnd())) {
+                    if(StringUtils.isEmpty(store.getDrugLicense()) || "".equals(store.getDrugLicense()) ||  LocalDate.now().isAfter(store.getDrugLicenseExpiryEnd())){
                         return R.error("店铺药品资质为空或已过期,请完善后再添加");
                     }
                     break;
                 case 3://食品
-                    if (StringUtils.isEmpty(store.getFoodLicense()) || "".equals(store.getFoodLicense()) || LocalDate.now().isAfter(store.getFoodLicenseExpiryEnd())) {
+                    if(StringUtils.isEmpty(store.getFoodLicense()) || "".equals(store.getFoodLicense()) ||  LocalDate.now().isAfter(store.getFoodLicenseExpiryEnd())){
                         return R.error("店铺食品资质为空或已过期,请完善后再添加");
                     }
                     break;
                 case 4://器械
-                    if (StringUtils.isEmpty(store.getMedicalDevice3()) || "".equals(store.getMedicalDevice3()) || LocalDate.now().isAfter(store.getMedicalDevice3ExpiryEnd())) {
+                    if(StringUtils.isEmpty(store.getMedicalDevice3()) || "".equals(store.getMedicalDevice3()) ||  LocalDate.now().isAfter(store.getMedicalDevice3ExpiryEnd())){
                         return R.error("店铺器械资质为空或已过期,请完善后再添加");
                     }
                     break;
@@ -432,11 +431,11 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
             }
         }
 
-        if ("纯正堂".equals(cloudHostProper.getCompanyName())) {
+        if("纯正堂".equals(cloudHostProper.getCompanyName())){
             product.setIsAudit("1");
         }
 
-        if (param.getProductId() != null && param.getProductId() > 0) {
+        if(param.getProductId() != null && param.getProductId() > 0){
             FsStoreProductScrm oldFsStoreProduct = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
             Boolean isAudit = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
             try {
@@ -445,7 +444,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                         Map<String, Object> diff = getDiff(oldFsStoreProduct, product);
                         Set<String> diff_columns = diff.keySet();
                         JSONArray productColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("productColumns");
-                        if (com.fs.common.utils.StringUtils.isNotEmpty(productColumns)) {
+                        if(com.fs.common.utils.StringUtils.isNotEmpty(productColumns)){
                             //判断diff_columns是否在productColumns中,不是则将isAudit设置为0
                             for (String column : diff_columns) {
                                 if (!productColumns.contains(column)) {
@@ -453,7 +452,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                                     break;
                                 }
                             }
-                        } else {
+                        }else{
                             product.setIsAudit("0");
                         }
                     }
@@ -467,14 +466,15 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                         .value("规格")
                         .detail(ListUtil.toList("默认"))
                         .build();
-                List<ProductArrtDTO> items = new ArrayList<>();
+                List<ProductArrtDTO> items=new ArrayList<>();
                 items.add(fromatDetailDto);
                 param.getValues().get(0).setSku("默认");
-                addProductAttr(product.getProductId(), items, param.getValues(), storeId);
+                addProductAttr(product.getProductId(),items,param.getValues(),storeId);
             } else {
-                addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
+                addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
             }
-        } else {
+        }
+        else{
             fsStoreProductMapper.insertFsStoreProduct(product);
         }
         storeAuditLogUtil.addOperLog(product.getProductId());
@@ -483,52 +483,52 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                     .value("规格")
                     .detail(ListUtil.toList("默认"))
                     .build();
-            List<ProductArrtDTO> items = new ArrayList<>();
+            List<ProductArrtDTO> items=new ArrayList<>();
             items.add(fromatDetailDto);
             param.getValues().get(0).setSku("默认");
-            addProductAttr(product.getProductId(), items, param.getValues(), storeId);
+            addProductAttr(product.getProductId(),items,param.getValues(),storeId);
         } else {
-            addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
+            addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
         }
         return R.ok();
     }
 
 
-    private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values, Long storeId) {
+    private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values,Long storeId){
         //清空attr
         fsStoreProductAttrMapper.clear(productId);
         //清空values
         //查出商品属性所有ID;
-        List<FsStoreProductAttrValueScrm> attrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
+        List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
         fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
         //写入attr
-        for (ProductArrtDTO vo : items) {
-            FsStoreProductAttrScrm attr = new FsStoreProductAttrScrm();
+        for(ProductArrtDTO vo:items){
+            FsStoreProductAttrScrm attr=new FsStoreProductAttrScrm();
             attr.setProductId(productId);
             attr.setAttrName(vo.getValue());
             attr.setAttrValues(StringUtils.join(vo.getDetail(), ","));
             fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
         }
-        Map<String, Object> map = new LinkedHashMap<>();
-        map.put("attr", items);
+        Map<String,Object> map = new LinkedHashMap<>();
+        map.put("attr",items);
         // map.put("value",values);
 
-        for (FsStoreProductAttrValueScrm val : values) {
+        for(FsStoreProductAttrValueScrm val: values){
             //更新套餐商品属性ID  获取套餐
-            Long id = val.getId();
-            if (val.getDetail() != null) {
+            Long id=val.getId();
+            if(val.getDetail()!=null){
                 List<String> stringList = new ArrayList<>(val.getDetail().values());
                 Collections.sort(stringList);
-                val.setSku(StrUtil.join(",", stringList));
+                val.setSku(StrUtil.join(",",stringList));
             }
             val.setProductId(productId);
             val.setStoreId(storeId);
             fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
-            if (attrValues != null && attrValues.size() > 0) {
-                for (FsStoreProductAttrValueScrm attrValue : attrValues) {
-                    if (attrValue.getId().equals(id)) {
-                        fsStoreProductGroupMapper.updateProducts(attrValue.getId(), val.getId());
-                        fsStoreProductPackageMapper.updateProducts(attrValue.getId(), val.getId());
+            if(attrValues!=null&&attrValues.size()>0){
+                for(FsStoreProductAttrValueScrm attrValue:attrValues){
+                    if(attrValue.getId().equals(id)){
+                        fsStoreProductGroupMapper.updateProducts(attrValue.getId(),val.getId());
+                        fsStoreProductPackageMapper.updateProducts(attrValue.getId(),val.getId());
                     }
                 }
             }
@@ -708,8 +708,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     }
 
 
+
     private ProductAttrCountDto computedProductCount(List<FsStoreProductAttrValueScrm> values) {
-        BigDecimal val = new BigDecimal(0);
+        BigDecimal val=new BigDecimal(0);
         //取最小价格
         BigDecimal minPrice = values
                 .stream()
@@ -762,34 +763,35 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     }
 
 
+
     @Override
     public List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(FsStoreProductQueryParam param) {
         SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
         MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
         boolean stores = medicalMallConfig != null && medicalMallConfig.isStores();
-        param.setIsStores(stores ? 1 : 0);
+        param.setIsStores(stores?1:0);
         return fsStoreProductMapper.selectFsStoreProductListQuery(param);
     }
 
     @Override
-    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, String storeId) {
+    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId,String storeId) {
         SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
         MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
-        return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId, storeId, medicalMallConfig);
+        return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId,storeId,medicalMallConfig);
     }
 
     @Override
     public void decProductStock(Long productId, Long productAttrValueId, Integer cartNum) {
         //处理属性sku
-        fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId, cartNum);
-        fsStoreProductMapper.decProductAttrStock(productId, cartNum);
+        fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId,cartNum);
+        fsStoreProductMapper.decProductAttrStock(productId,cartNum);
 
     }
 
     @Override
     public void incProductStock(Long num, Long productId, Long productAttrValueId) {
         //处理属性sku
-        if (productAttrValueId != null) {
+        if (productAttrValueId!=null) {
             attrValueService.incProductAttrStock(num, productId, productAttrValueId);
         }
         //先处理商品库存
@@ -821,7 +823,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count) {
         SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
         MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
-        return fsStoreProductMapper.selectFsStoreProductGoodQuery(count, medicalMallConfig);
+        return fsStoreProductMapper.selectFsStoreProductGoodQuery(count,medicalMallConfig);
     }
 
     @Override
@@ -845,7 +847,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
     @Override
     public Long selectFsStoreProductCount(int type, Long companyId) {
-        return fsStoreProductMapper.selectFsStoreProductCompanyCount(type, companyId);
+        return fsStoreProductMapper.selectFsStoreProductCompanyCount(type,companyId);
     }
 
     @Override
@@ -867,17 +869,19 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Override
     public String importStoreProduct(List<FsStoreProductExportVO> list, boolean updateSupport) {
         storeAuditLogUtil.generateOperId();
-        if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0) {
+        if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0)
+        {
             throw new CustomException("导入商品数据不能为空!");
         }
         int successNum = 0;
         int failureNum = 0;
         StringBuilder successMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
-        for (FsStoreProductExportVO productVO : list) {
-            try {
+        for (FsStoreProductExportVO productVO : list){
+            try
+            {
                 FsStoreProductScrm product = BeanCopyUtils.copy(productVO, FsStoreProductScrm.class);
-                if (product.getBarCode() == null || product.getBarCode() == "") {
+                if (product.getBarCode()==null || product.getBarCode()==""){
                     throw new CustomException("商品编号为空");
                 }
                 this.insertFsStoreProduct(product);
@@ -885,36 +889,36 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                         .value("规格")
                         .detail(ListUtil.toList("默认"))
                         .build();
-                List<ProductArrtDTO> items = new ArrayList<>();
+                List<ProductArrtDTO> items=new ArrayList<>();
                 items.add(formatDetailDto);
                 FsStoreProductAttrValueScrm p = new FsStoreProductAttrValueScrm();
                 p.setProductId(product.getProductId());
                 p.setSku("默认");
                 p.setStock(product.getStock().intValue());
-                if (product.getStock() == null) {
+                if (product.getStock()==null){
                     p.setStock(0);
                 }
                 p.setSales(product.getSales().intValue());
-                if (product.getSales() == null) {
+                if (product.getSales()==null){
                     p.setStock(0);
                 }
                 p.setPrice(product.getPrice());
-                if (product.getPrice() == null) {
+                if (product.getPrice()==null){
                     p.setPrice(new BigDecimal(0));
                 }
                 p.setImage(product.getImage());
                 p.setCost(product.getCost());
-                if (product.getCost() == null) {
+                if (product.getCost()==null){
                     p.setCost(new BigDecimal(0));
                 }
                 p.setBarCode(product.getBarCode());
                 p.setGroupBarCode(product.getBarCode());
                 p.setOtPrice(product.getOtPrice());
-                if (product.getOtPrice() == null) {
+                if (product.getOtPrice()==null){
                     p.setOtPrice(new BigDecimal(0));
                 }
                 p.setWeight(productVO.getWeight());
-                if (productVO.getWeight() == null) {
+                if (productVO.getWeight()==null){
                     p.setWeight(new BigDecimal(0));
                 }
 
@@ -933,18 +937,23 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                 fsStoreProductAttrMapper.insertFsStoreProductAttr(attr);
                 successNum++;
                 successMsg.append("<br/>" + successNum + "、商品 " + product.getProductName() + " 导入成功");
-            } catch (Exception e) {
+            }
+            catch (Exception e)
+            {
 
                 failureNum++;
-                String msg = "<br/>" + failureNum + "、商品 " + productVO.getProductName() + " 导入失败:";
+                String msg = "<br/>" + failureNum + "、商品 " + productVO.getProductName()  + " 导入失败:";
                 failureMsg.append(msg + e.getMessage());
             }
 
         }
-        if (failureNum > 0) {
+        if (failureNum > 0)
+        {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             throw new CustomException(failureMsg.toString());
-        } else {
+        }
+        else
+        {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }
         return successMsg.toString();
@@ -952,7 +961,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
     @Override
     public void batchModify(ModifyMoreDTO modifyMoreDTO) {
-        storeAuditLogUtil.addBatchAuditList(modifyMoreDTO.getProductId(), "", null);
+        storeAuditLogUtil.addBatchAuditList(modifyMoreDTO.getProductId(),"",null);
         fsStoreProductMapper.batchModify(modifyMoreDTO);
     }
 
@@ -972,7 +981,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         StringBuilder failureMsg = new StringBuilder();
 
         //存储商品Id
-        List<Long> jstProductIds = new LinkedList<>();
+        List<Long> jstProductIds=new LinkedList<>();
         for (FsStoreProductExcelVO productVO : productList) {
             try {
 
@@ -1066,17 +1075,17 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                 Integer erpOpen = sysConfig.getErpOpen();
                 if (erpOpen == null || erpOpen == 0) {
                     //不作操作
-                } else {
+                } else{
                     //判断erp类型
                     Integer erpType = sysConfig.getErpType();
                     if (erpType == null) {
                         //不作操作
-                    } else if (erpType == 3) {
+                    }else if (erpType == 3) {
                         ErpGoods params = new ErpGoods();
                         params.setStoreProductId(product.getProductId());
                         //瀚智OMS 维护添加商品
                         hzOMSErpGoodsService.addGoodsScrm(params);
-                    } else if (erpType == 5) {
+                    }else if(erpType == 5){
                         jstProductIds.add(product.getProductId());
                     }
                 }
@@ -1089,7 +1098,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         }
 
         //验证聚水潭商品Id
-        if (!jstProductIds.isEmpty()) {
+        if(!jstProductIds.isEmpty()){
             //同步聚水潭商品
             ErpGoods params = new ErpGoods();
             params.setProductIdList(jstProductIds);
@@ -1132,7 +1141,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Transactional
     public void batchAudit(ProductAuditDTO auditDTO) {
         fsStoreProductMapper.batchAudit(auditDTO);
-        storeAuditLogUtil.addBatchAuditList(auditDTO.getProductIds(), auditDTO.getReason(), auditDTO.getAttachImage());
+        storeAuditLogUtil.addBatchAuditList(auditDTO.getProductIds(),auditDTO.getReason(),auditDTO.getAttachImage());
     }
 
     @Override
@@ -1141,10 +1150,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     }
 
     @Override
-    public List<FsStoreProductActivityListVO> selectFsStoreProductByIdsAudit(String productIds) {
-        SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
+    public List<FsStoreProductActivityListVO> selectFsStoreProductByIdsAudit(String productIds) {SysConfig config = configService.selectConfigByConfigKey("medicalMall.func.switch");
         MedicalMallConfig medicalMallConfig = JSON.parseObject(config.getConfigValue(), MedicalMallConfig.class);
-        return fsStoreProductMapper.selectFsStoreProductByIdsAudit(productIds, medicalMallConfig);
+        return fsStoreProductMapper.selectFsStoreProductByIdsAudit(productIds,medicalMallConfig);
     }
 
     @Override
@@ -1152,10 +1160,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     public R bulkCopyFsStoreProductByIds(Long[] productIds) {
         storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
         List<FsStoreProductScrm> list = fsStoreProductMapper.bulkCopyFsStoreProductByIds(productIds);
-        if (list != null && !list.isEmpty()) {
+        if(list != null && !list.isEmpty()){
             for (FsStoreProductScrm product : list) {
                 List<FsStoreProductAttrValueScrm> param = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(product.getProductId());
-                if (!("益善缘".equals(cloudHostProper.getCompanyName()))) {
+                if(!("益善缘".equals(cloudHostProper.getCompanyName()))) {
                     //获取店铺
                     FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
                     if (store == null || 1 != store.getStatus()) {
@@ -1196,10 +1204,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                             .value("规格")
                             .detail(ListUtil.toList("默认"))
                             .build();
-                    List<ProductArrtDTO> items = new ArrayList<>();
+                    List<ProductArrtDTO> items=new ArrayList<>();
                     items.add(fromatDetailDto);
                     param.get(0).setSku("默认");
-                    addProductAttr(product.getProductId(), items, param, product.getStoreId());
+                    addProductAttr(product.getProductId(),items,param,product.getStoreId());
                 } else {
                     List<FsStoreProductAttrScrm> items = fsStoreProductAttrMapper.selectFsStoreProductAttrByProductId(product.getProductId());
 
@@ -1207,33 +1215,33 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                     fsStoreProductAttrMapper.clear(fsStoreProductId);
                     //清空values
                     //查出商品属性所有ID;
-                    List<FsStoreProductAttrValueScrm> attrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProductId);
+                    List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(fsStoreProductId);
                     fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(fsStoreProductId);
 
                     //写入attr
-                    for (FsStoreProductAttrScrm vo : items) {
+                    for(FsStoreProductAttrScrm vo:items){
                         vo.setProductId(fsStoreProductId);
                         fsStoreProductAttrMapper.insertFsStoreProductAttr(vo);
                     }
-                    Map<String, Object> map = new LinkedHashMap<>();
-                    map.put("attr", items);
+                    Map<String,Object> map = new LinkedHashMap<>();
+                    map.put("attr",items);
                     // map.put("value",values);
 
-                    for (FsStoreProductAttrValueScrm val : param) {
+                    for(FsStoreProductAttrValueScrm val: param){
                         //更新套餐商品属性ID  获取套餐
-                        Long id = val.getId();
-                        if (val.getDetail() != null) {
+                        Long id=val.getId();
+                        if(val.getDetail()!=null){
                             List<String> stringList = new ArrayList<>(val.getDetail().values());
                             Collections.sort(stringList);
-                            val.setSku(StrUtil.join(",", stringList));
+                            val.setSku(StrUtil.join(",",stringList));
                         }
                         val.setProductId(fsStoreProductId);
                         fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(val);
-                        if (attrValues != null && !attrValues.isEmpty()) {
-                            for (FsStoreProductAttrValueScrm attrValue : attrValues) {
-                                if (attrValue.getId().equals(id)) {
-                                    fsStoreProductGroupMapper.updateProducts(attrValue.getId(), val.getId());
-                                    fsStoreProductPackageMapper.updateProducts(attrValue.getId(), val.getId());
+                        if(attrValues!=null && !attrValues.isEmpty()){
+                            for(FsStoreProductAttrValueScrm attrValue:attrValues){
+                                if(attrValue.getId().equals(id)){
+                                    fsStoreProductGroupMapper.updateProducts(attrValue.getId(),val.getId());
+                                    fsStoreProductPackageMapper.updateProducts(attrValue.getId(),val.getId());
                                 }
                             }
                         }
@@ -1252,14 +1260,16 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
     @Override
     public R instructionsViewable(FsStoreCartCountParam param) {
-        //判断商品是否存在
-        FsStoreProductScrm productScrm = fsStoreProductMapper.selectFsStoreProductById(param.getProductId());
-        if (productScrm == null || productScrm.getProductType() == null) {
-            return R.error("商品数据不存在,或类型异常!");
-        } else if (productScrm.getProductType() != 2) {
+        FsStoreProductScrm product = fsStoreProductMapper.selectFsStoreProductById(param.getProductId());
+        if (product == null || product.getProductType() == null) {
+            return R.error("商品数据不存在或类型异常!");
+        }
+        if (product.getProductType() != 2) {
             return R.ok().put("data", true);
         }
-        return R.ok().put("data", fsStoreProductMapper.instructionsViewable(param) > 0);
+        Integer qualifiedCount = fsStoreProductMapper.instructionsViewable(param);
+        boolean isViewable = qualifiedCount != null && qualifiedCount > 0;
+        return R.ok().put("data", isViewable);
     }
 
     @Override
@@ -1269,13 +1279,12 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
     @Override
     public List<Map<String, String>> getStoreProductColumns() {
-        List<Map<String, String>> list = fsStoreProductMapper.getStoreProductColumns();
+        List<Map<String, String> > list = fsStoreProductMapper.getStoreProductColumns();
         List<Map<String, String>> result = new ArrayList<>();
         for (Map<String, String> column : list) {
             Map<String, String> camelCaseColumn = new HashMap<>();
             String columnName = column.get("colName");
-            String camelCaseName = com.fs.common.utils.StringUtils.toCamelCase(columnName);
-            ;
+            String camelCaseName = com.fs.common.utils.StringUtils.toCamelCase(columnName);;
             camelCaseColumn.put("colName", camelCaseName);
             camelCaseColumn.put("colComment", column.get("colComment"));
             result.add(camelCaseColumn);

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

@@ -8,6 +8,7 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.List;
@@ -18,7 +19,7 @@ import java.util.List;
  */
 @Builder
 @Data
-public class FsStoreRecommendListVO
+public class FsStoreRecommendListVO implements Serializable
 {
     private FsStoreScrm store;
     /** 推荐商品列表*/

+ 1 - 2
fs-service/src/main/java/com/fs/hospital580/mapper/Hospital580PrescriptionScrmMapper.java

@@ -19,8 +19,7 @@ import java.util.List;
 public interface Hospital580PrescriptionScrmMapper extends BaseMapper<Hospital580PrescriptionScrmEntity> {
     /**
      * 获24小时的未支付处方信息审核的处方信息
-     * @param twentyFourHoursAgo 过期日期
      * @return list
      * **/
-    List<Hospital580PrescriptionScrmEntity> getExpiredPrescriptionInfo(@Param("twentyFourHoursAgo") String twentyFourHoursAgo);
+    List<Hospital580PrescriptionScrmEntity> getExpiredPrescriptionInfo();
 }

+ 1 - 11
fs-service/src/main/java/com/fs/hospital580/service/impl/Hospital580PrescriptionScrmServiceImpl.java

@@ -37,18 +37,8 @@ public class Hospital580PrescriptionScrmServiceImpl extends ServiceImpl<Hospital
     @Override
     @Transactional
     public void prescriptionInvalid() {
-        // 计算24小时前的时间点
-        LocalDateTime twentyFourHoursAgo = LocalDateTime.now().minusHours(24);
-
-        // 定义格式化器(年月日时分秒)
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-
-        // 格式化时间
-        String formattedTime = twentyFourHoursAgo.format(formatter);
-
         //获取处方信息
-        List<Hospital580PrescriptionScrmEntity> PrescriptionList = baseMapper.getExpiredPrescriptionInfo(formattedTime);
-
+        List<Hospital580PrescriptionScrmEntity> PrescriptionList = baseMapper.getExpiredPrescriptionInfo();
         if(!PrescriptionList.isEmpty()){
             //获取订单信息
            List<Long> orderIds=PrescriptionList.stream().map(Hospital580PrescriptionScrmEntity::getStoreOrderId).collect(Collectors.toList());

+ 5 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1614,6 +1614,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.orderCode != null and  maps.orderCode !=''">
                 and o.order_code like CONCAT('%',#{maps.orderCode},'%')
             </if>
+            <if test="maps.storeId != null">
+                and ssc.store_id = #{maps.storeId}
+            </if>
             <if test="maps.isPayRemain != null">
                 and o.is_pay_remain =#{maps.isPayRemain}
             </if>
@@ -1919,6 +1922,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         sos.id AS orderId
         FROM
         fs_store_order_scrm sos
+        INNER JOIN fs_store_hospital580_prescription_scrm ps ON ps.store_order_id = sos.id
         INNER JOIN fs_store_order_item_scrm sois ON sos.id = sois.order_id
         INNER JOIN fs_store_product_scrm sps ON sps.product_id = sois.product_id
         WHERE
@@ -1926,6 +1930,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach collection="orderIds" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
+        AND ps.audit_status != 2
         AND sps.product_type = 2
         GROUP BY sos.id
     </select>

+ 2 - 2
fs-service/src/main/resources/mapper/hisStore/FsStoreProductScrmMapper.xml

@@ -583,7 +583,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </foreach>
     </select>
 
-    <select id="instructionsViewable" resultType="int">
+    <select id="instructionsViewable" resultType="Integer">
         SELECT
             IFNULL(COUNT(*), 0)
         FROM
@@ -594,9 +594,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
             o.`status` IN (0,1,2,3)
            AND p.product_id = #{param.productId}
-           AND ps.audit_status = 2
 	       AND ps.user_id = #{param.userId}
            AND ps.pid IS NOT NULL
+           AND ps.audit_status = 2
         GROUP BY p.product_id
     </select>
 

+ 1 - 1
fs-service/src/main/resources/mapper/hospital580/Hospital580PrescriptionScrmMapper.xml

@@ -60,7 +60,7 @@
             fs_store_hospital580_prescription_scrm ps
                 LEFT JOIN fs_store_order_scrm sos ON ps.store_order_id = sos.id
         WHERE
-            ps.create_time &lt;= #{twentyFourHoursAgo}
+            TIMESTAMPDIFF(MINUTE, ps.create_time, NOW()) >= 1440
           AND sos.`status` = 0
     </select>
 </mapper>

+ 8 - 8
fs-user-app/src/main/java/com/fs/app/controller/UserController.java

@@ -239,14 +239,14 @@ public class UserController extends  AppBaseController {
     @PostMapping("/registerDoctor")
     public R registerDoctor(@Validated  @RequestBody FsDoctorRegisterParam param, HttpServletRequest request){
         FsDoctor doctor= doctorService.selectFsDoctorByUserId(Long.parseLong(getUserId()));
-        if(doctor!=null){
-            if(doctor.getIsAudit().equals(0)){
-                return R.error(String.format("您已提交申请: %s,等待审核...",doctor.getDoctorName()));
-            }
-            else if(doctor.getIsAudit().equals(1)){
-                return R.error(String.format("您已提交过申请 提交信息: %s",doctor.getDoctorName()));
-            }
-        }
+//        if(doctor!=null){
+//            if(doctor.getIsAudit().equals(0)){
+//                return R.error(String.format("您已提交申请: %s,等待审核...",doctor.getDoctorName()));
+//            }
+//            else if(doctor.getIsAudit().equals(1)){
+//                return R.error(String.format("您已提交过申请 提交信息: %s",doctor.getDoctorName()));
+//            }
+//        }
 
         if(param.getDoctorType().equals(1)){//医生
             if(param.getHospitalId() == null){

+ 5 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/ProductScrmController.java

@@ -313,7 +313,11 @@ public class ProductScrmController extends AppBaseController {
     @ApiOperation("校验说明书查看权限")
     @PostMapping("/instructionsViewable")
     public R instructionsViewable(@RequestBody FsStoreCartCountParam param){
-       Long userId = Long.parseLong(getUserId());
+        String uId=getUserId();
+        if(uId == null){
+            return R.error(401,"请登录小程序!");
+        }
+       Long userId = Long.parseLong(uId);
         if(userId == null){
             return  R.error("操作失败,用户信息不存在!");
         }

+ 22 - 19
fs-user-app/src/main/java/com/fs/app/controller/store/StoreOrderScrmController.java

@@ -9,6 +9,7 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fs.app.annotation.Login;
 import com.fs.app.controller.AppBaseController;
 import com.fs.common.config.FSSysConfig;
@@ -236,7 +237,15 @@ public class StoreOrderScrmController extends AppBaseController {
         else if(order.getStatus()==1||order.getStatus()==2){
             isAfterSales=1;
         }
-        return R.ok().put("isAfterSales",isAfterSales).put("order",order).put("items",list).put("payLimitTime",payLimitTime).put("prescribe",prescribe);
+        Integer prescriptionAuditStatus = 0;
+        //获取580订单状态
+        Hospital580PrescriptionScrmEntity entity = orderScrmService.getOne(new LambdaQueryWrapper<Hospital580PrescriptionScrmEntity>().eq(Hospital580PrescriptionScrmEntity::getStoreOrderId,order.getId()));
+        if(entity != null && entity.getAuditStatus() != null){
+            if(entity.getAuditStatus() == 2){
+                prescriptionAuditStatus = entity.getAuditStatus();
+            }
+        }
+        return R.ok().put("isAfterSales",isAfterSales).put("order",order).put("items",list).put("payLimitTime",payLimitTime).put("prescribe",prescribe).put("prescriptionAuditStatus",prescriptionAuditStatus);
     }
 
     @Login
@@ -1522,26 +1531,20 @@ public class StoreOrderScrmController extends AppBaseController {
         List<Long> orderIds = orders.stream()
                 .map(FsStoreOrderScrm::getId)
                 .collect(Collectors.toList());
-        for (FsStoreOrderScrm order : orders) {
-//                if (prescriptionCountMap.containsKey(BigInteger.valueOf(order.getId())) && order.getPrescribeId() == null) {
-//                    return "处方订单未开具,无法支付!";
-//                }
-            if (order.getIsPrescribe() == 1 && order.getPrescribeId() == null) {
-                return "处方订单未开具,无法支付!";
-            }
-        }
-
-//        Map<Long, Long> prescriptionCountMap = orderService.batchGetPrescriptionDrugCount(orderIds);
-//        if(prescriptionCountMap != null){
-//            for (FsStoreOrderScrm order : orders) {
-//                if (prescriptionCountMap.containsKey(BigInteger.valueOf(order.getId())) && order.getPrescribeId() == null) {
-//                    return "处方订单未开具,无法支付!";
-//                }
-//                if (order.getIsPrescribe() == 1 && order.getPrescribeId() == null) {
-//                    return "处方订单未开具,无法支付!";
-//                }
+//        for (FsStoreOrderScrm order : orders) {
+//            if (order.getIsPrescribe() == 1 && order.getPrescribeId() == null) {
+//                return "处方订单未开具,无法支付!";
 //            }
 //        }
+
+        Map<Long, Long> prescriptionCountMap = orderService.batchGetPrescriptionDrugCount(orderIds);
+        if(prescriptionCountMap != null){
+            for (FsStoreOrderScrm order : orders) {
+                if (prescriptionCountMap.containsKey(BigInteger.valueOf(order.getId()))) {
+                    return "处方订单不是已审核状态,无法支付!";
+                }
+            }
+        }
         return null;
     }
 

+ 2 - 2
fs-user-app/src/main/java/com/fs/app/param/FsDoctorRegisterParam.java

@@ -23,8 +23,8 @@ public class FsDoctorRegisterParam implements Serializable {
     /** 简介 */
     private String introduction;
 
-    /** 擅长领域 */
-    @NotBlank(message = "擅长领域不能为空")
+//    /** 擅长领域 */
+//    @NotBlank(message = "擅长领域不能为空")
     private String speciality;
 
     /** 资格证编号 */