瀏覽代碼

Merge remote-tracking branch 'origin/ScrmStores' into ScrmStores

吴树波 1 周之前
父節點
當前提交
3831dd804e

+ 11 - 0
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -46,6 +46,7 @@ import com.fs.his.service.*;
 import com.fs.his.service.impl.FsPackageOrderServiceImpl;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.FsSubOrderResultVO;
+import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.im.dto.*;
 import com.fs.im.service.IImService;
 import com.fs.qw.domain.QwCompany;
@@ -165,6 +166,9 @@ public class Task {
     @Autowired
     private IFastgptEventLogTotalService fastgptEventLogTotalService;
 
+    @Autowired
+    private IFsStoreScrmService fsStoreScrmService;
+
     //统计ai事件埋点
     public void eventLogTotals() {
         // 判断是否是凌晨 00:00 - 00:59
@@ -844,6 +848,13 @@ public class Task {
         System.out.println(msgResponseDTO);
     }
 
+
+    /**
+     * 商铺资质定过期,状态定时任务
+     * **/
+    public void merchantQualificationExpiryCheck(){
+        fsStoreScrmService.merchantQualificationExpiryCheck();
+    }
 //    @Autowired
 //    private FsStoreMapper fsStoreMapper;
 //    @Autowired

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

@@ -186,7 +186,7 @@ public interface FsStoreProductScrmMapper
             "<if test = 'maps.isStores != null and maps.isStores == 1   '>"+
             "inner join fs_store_scrm fs on fs.store_id = p.store_id and fs.is_audit = 1 " +
             "</if>" +
-            "where p.is_del=0 and p.is_show=1  and p.is_audit = '1'" +
+            "where p.is_del=0 and p.is_show=1  and p.is_audit = '1' and fs.status = '1'" +
             "<if test = 'maps.productName != null and  maps.productName !=\"\"    '> " +
             "and (p.product_name like CONCAT('%',#{maps.productName},'%')  or p.keyword like concat('%',#{maps.productName},'%') ) " +
             "</if>" +

+ 12 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreScrmMapper.java

@@ -117,4 +117,16 @@ public interface FsStoreScrmMapper
      * **/
     @Select("SELECT * FROM fs_store_scrm WHERE store_id=#{storeId}")
     FsStoreDetailsScrmVo selectStoreInfoByStoreId(@Param("storeId") Long storeId);
+
+    /**
+     * 获取商铺资质过期证书信息
+     * @return list
+     * **/
+    List<Long> getStoreQualificationExpiredInfo();
+
+    /**
+     * 批量更新店偶状态
+     * @param storeIds 店铺id
+     * **/
+    void batchUpdateStoreStatusById(@Param("storeIds") List<Long> storeIds);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreScrmInfoParam.java

@@ -112,6 +112,11 @@ public class FsStoreScrmInfoParam extends BaseEntity
 //    /** 经营范围 */
 //    private String businessScope;
 
+    /**
+     *营业执照是否长期有效(1长期有效、0非长期有效)
+     **/
+    private Byte isBusinessLicensePermanent;
+
     /** 营业执照图片 */
     private String businessLicense;
 

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

@@ -113,4 +113,9 @@ public interface IFsStoreScrmService
      * @return 结果
      */
     public int updateStoreInfo(FsStoreScrmInfoParam fsStore);
+
+    /**
+     * 商铺资质定过期,状态定时任务
+     * **/
+    public void merchantQualificationExpiryCheck();
 }

+ 49 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -2,6 +2,7 @@ package com.fs.hisStore.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.fs.common.exception.CustomException;
+import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.his.param.FsStoreAuditParam;
@@ -28,6 +29,8 @@ 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.util.*;
 import java.util.stream.Collectors;
 
@@ -140,6 +143,16 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
         } catch (IllegalAccessException e) {
             log.error("获取diff出错", e);
         }
+
+        //验证资质日期是否正常
+        LocalDate today = LocalDate.now(ZoneId.of("Asia/Shanghai"));
+        if(fsStore.getBusinessLicenseExpireEnd().isBefore(today) || fsStore.getDrugLicenseExpiryEnd().isBefore(today)
+                || fsStore.getMedicalDevice2ExpiryEnd().isBefore(today) || fsStore.getMedicalLicenseExpiryEnd().isBefore(today)) {
+            fsStore.setStatus(0);
+        }else {
+            fsStore.setStatus(1);
+        }
+
         return fsStoreMapper.updateFsStore(fsStore);
     }
 
@@ -200,7 +213,21 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
     @Transactional
     public int updateFsStoreAudit(FsStoreAuditParam fsStore) {
 
-        fsStoreMapper.updateFsStoreAudit(fsStore.getStoreId(),fsStore.getIsAudit());
+        FsStoreScrm fsStoreScrm=fsStoreMapper.selectFsStoreByStoreId(fsStore.getStoreId());
+        if(fsStoreScrm == null){
+            throw new ServiceException("操作失败,审核店铺数据不存在!");
+        }
+        FsStoreScrm updateStore=new FsStoreScrm();
+        updateStore.setStoreId(fsStore.getStoreId());
+        updateStore.setIsAudit(fsStore.getIsAudit());
+        if(fsStoreScrm.getStatus() == 0){
+            LocalDate today = LocalDate.now(ZoneId.of("Asia/Shanghai"));
+            if(fsStoreScrm.getBusinessLicenseExpireEnd().isAfter(today) && fsStoreScrm.getDrugLicenseExpiryEnd().isAfter(today)
+                    && fsStoreScrm.getMedicalDevice2ExpiryEnd().isAfter(today) && fsStoreScrm.getMedicalLicenseExpiryEnd().isAfter(today)) {
+                updateStore.setStatus(1);
+            }
+        }
+        fsStoreMapper.updateFsStore(updateStore);
         //更新日志
         storeAuditLogUtil.addAudit(fsStore.getStoreId(),fsStore.getReason(),fsStore.getAttachImage());
         return 1;
@@ -336,9 +363,30 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
         FsStoreScrm updateStore = new FsStoreScrm();
         BeanUtils.copyProperties(fsStore, updateStore);
         updateStore.setUpdateTime(DateUtils.getNowDate());
+        //验证资质日期是否正常
+        LocalDate today = LocalDate.now(ZoneId.of("Asia/Shanghai"));
+        if(fsStore.getBusinessLicenseExpireEnd().isBefore(today) || fsStore.getDrugLicenseExpiryEnd().isBefore(today)
+                || fsStore.getMedicalDevice2ExpiryEnd().isBefore(today) || fsStore.getMedicalLicenseExpiryEnd().isBefore(today)) {
+            updateStore.setStatus(0);
+        }else {
+            updateStore.setStatus(1);
+        }
+
         return fsStoreMapper.updateFsStore(updateStore);
     }
 
+    @Override
+    public void merchantQualificationExpiryCheck() {
+        log.info("定时任务店铺资质过期更新状态--------------------------start{}");
+        //获取资质过期商铺
+        List<Long> storeIds = fsStoreMapper.getStoreQualificationExpiredInfo();
+        if(!storeIds.isEmpty()){
+            //更新商铺状态】
+            fsStoreMapper.batchUpdateStoreStatusById(storeIds);
+        }
+        log.info("定时任务店铺资质过期更新状态--------------------------end{}");
+    }
+
     /**
      * 获取两个对象的所有差异字段(基于旧对象的所有字段,以新对象字段值为准进行对比)
      * 只要新旧值不同就视为差异

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

@@ -445,6 +445,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test='config.isAudit == "1" '>
         and fsp.is_audit = '1'
         </if>
+        <if test='config.isStores == "1" '>
+            AND fs.status = '1'
+        </if>
         and fsp.is_best=1 and fsp.is_display=1 order by fsp.sort desc,fsp.product_id desc
     </select>
     <select id="bulkCopyFsStoreProductByIds" resultMap="FsStoreProductResult">

+ 20 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreScrmMapper.xml

@@ -415,4 +415,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     )
             )
     </select>
+
+    <select id="getStoreQualificationExpiredInfo" resultType="Long">
+        SELECT
+        store_id
+        FROM
+        fs_store_scrm
+        WHERE
+        `status` = 1
+        AND (business_license_expire_end &lt; CURDATE() AND is_business_license_permanent != 1)
+        OR drug_license_expiry_end &lt; CURDATE()
+        OR medical_device2_expiry_end &lt; CURDATE()
+        OR medical_license_expiry_end &lt; CURDATE()
+    </select>
+
+    <update id="batchUpdateStoreStatusById">
+        update fs_store_scrm set `status` = 0 WHERE store_id IN
+        <foreach collection="storeIds" item="item" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </update>
 </mapper>