Bladeren bron

店铺资质定时任务优化,优化更新bug,优化资质被清空的bug

yjwang 1 maand geleden
bovenliggende
commit
4dea8a1bab

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

@@ -234,4 +234,17 @@ public interface FsStoreScrmMapper
      * 店铺审核
      * **/
     Integer auditStore(FsStoreScrm FsStoreScrm);
+
+    /**
+     * 修改店铺管理
+     *
+     * @param FsStoreScrm 店铺管理
+     * @return 结果
+     */
+    public int updateFsStoreInfo(FsStoreScrm FsStoreScrm);
+
+    /**
+     * 自动失效过期资格6个月
+     * **/
+    void updateExpiredStoreStatus();
 }

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

@@ -252,7 +252,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
             log.error("获取diff出错", e);
         }
         fsStore.setQualificationUpdateTime(LocalDate.now());
-        int updateRowNum = fsStoreMapper.updateFsStore(fsStore);
+        int updateRowNum = fsStoreMapper.updateFsStoreInfo(fsStore);
         //信息发布
         if(updateRowNum > 0){
             applicationEventPublisher.publishEvent(fsStore);
@@ -507,6 +507,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
             //更新商铺状态】
             fsStoreMapper.batchUpdateStoreStatusById(storeIds);
         }
+        fsStoreMapper.updateExpiredStoreStatus();
         log.info("定时任务店铺资质过期更新状态--------------------------end");
     }
 

+ 1 - 1
fs-service/src/main/resources/mapper/hisStore/FsPlatformProductScrmMapper.xml

@@ -315,7 +315,7 @@
 
     <select id="productNameExist" resultType="java.lang.Boolean">
         select count(product_id)
-        from fs_platform_product_scrm p where p.product_name = #{productName}
+        from fs_platform_product_scrm p where 1=1 AND (p.product_name = #{productName} AND p.product_name != '-')
         <if test="commonName != null and commonName != ''">
             or (p.common_name = #{commonName} AND p.common_name != '-')
         </if>

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

@@ -1045,7 +1045,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="productNameExist" resultType="java.lang.Boolean">
        select count(*) from fs_store_product_scrm
-       where store_id = #{storeId} and  (product_name = #{productName} or common_name = #{commonName})
+       where store_id = #{storeId} and  ((product_name = #{productName} AND product_name != '-') or (common_name = #{commonName} AND common_name != '-'))
     </select>
 
 

+ 115 - 13
fs-service/src/main/resources/mapper/hisStore/FsStoreScrmMapper.xml

@@ -447,19 +447,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reportUrl !=null ">report_url = #{reportUrl}, </if>
             <if test="filingUrl !=null ">filing_url = #{filingUrl}, </if>
             <if test="permStatus !=null ">perm_status = #{permStatus}, </if>
-            medical_device2 = #{medicalDevice2} ,
-            medical_device2_business_scope = #{medicalDevice2BusinessScope} ,
-            medical_device2_code = #{medicalDevice2Code} ,
-            medical_device2_expiry_start = #{medicalDevice2ExpiryStart} ,
-            medical_device2_expiry_end = #{medicalDevice2ExpiryEnd} ,
-            medical_device3 = #{medicalDevice3} ,
-            medical_device3_expiry_start = #{medicalDevice3ExpiryStart} ,
-            medical_device3_expiry_end = #{medicalDevice3ExpiryEnd} ,
-            medical_device3_code = #{medicalDevice3Code} ,
-            medical_device3_business_scope = #{medicalDevice3BusinessScope},
-            food_license = #{foodLicense} ,
-            food_license_expiry_start = #{foodLicenseExpiryStart} ,
-            food_license_expiry_end = #{foodLicenseExpiryEnd} ,
         </trim>
         where store_id = #{storeId}
     </update>
@@ -965,5 +952,120 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <update id="updateFsStoreInfo" parameterType="FsStoreScrm">
+        update fs_store_scrm
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="cityIds != null">city_ids = #{cityIds},</if>
+            <if test="storeName != null">store_name = #{storeName},</if>
+            <if test="descs != null">descs = #{descs},</if>
+            <if test="logoUrl != null">logo_url = #{logoUrl},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="lng != null">lng = #{lng},</if>
+            <if test="lat != null">lat = #{lat},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="licenseImages != null">license_images = #{licenseImages},</if>
+            <if test="productCount != null">product_count = #{productCount},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="salesCount != null">sales_count = #{salesCount},</if>
+            <if test="balance != null">balance = #{balance},</if>
+            <if test="totalMoney != null">total_money = #{totalMoney},</if>
+            <if test="isAudit != null">is_audit = #{isAudit},</if>
+            <if test="account != null">account = #{account},</if>
+            <if test="password != null">password = #{password},</if>
+            <if test="shippingType != null">shipping_type = #{shippingType},</if>
+            <if test="brokerageType != null">brokerage_type = #{brokerageType},</if>
+            <if test="brokerageRate != null">brokerage_rate = #{brokerageRate},</if>
+            <if test="fullName != null">full_name = #{fullName},</if>
+            <if test="refundPhone != null">refund_phone = #{refundPhone},</if>
+            <if test="refundAddress != null">refund_address = #{refundAddress},</if>
+            <if test="refundConsignee != null">refund_consignee = #{refundConsignee},</if>
+            <if test="deliveryType != null">delivery_type = #{deliveryType},</if>
+            <if test="sendPhone != null">send_phone = #{sendPhone},</if>
+            <if test="enterpriseAddress !=null and enterpriseAddress !=''"> enterprise_address = #{enterpriseAddress} ,</if>
+            <if test="legalPersonName !=null and legalPersonName !=''"> legal_person_name = #{legalPersonName} ,</if>
+            <if test="unifiedSocialCreditCode !=null and unifiedSocialCreditCode !=''"> unified_social_credit_code = #{unifiedSocialCreditCode} ,</if>
+            <if test="businessScope !=null and businessScope !=''"> business_scope = #{businessScope} ,</if>
+            <if test="selectableProductTypes !=null and selectableProductTypes !=''"> selectable_product_types = #{selectableProductTypes} ,</if>
+            <if test="businessLicense !=null and businessLicense !=''"> business_license = #{businessLicense} ,</if>
+            <if test="businessLicenseExpireStart !=null "> business_license_expire_start = #{businessLicenseExpireStart} ,</if>
+            <if test="businessLicenseExpireEnd !=null "> business_license_expire_end = #{businessLicenseExpireEnd} ,</if>
+            <if test="drugLicense !=null and drugLicense !=''"> drug_license = #{drugLicense} ,</if>
+            <if test="drugLicenseExpiryStart !=null "> drug_license_expiry_start = #{drugLicenseExpiryStart} ,</if>
+            <if test="drugLicenseExpiryEnd !=null "> drug_license_expiry_end = #{drugLicenseExpiryEnd} ,</if>
+            <if test="medicalDevice1 !=null and medicalDevice1 !=''"> medical_device1 = #{medicalDevice1} ,</if>
+            <if test="medicalDevice1ExpiryStart !=null "> medical_device1_expiry_start = #{medicalDevice1ExpiryStart} ,</if>
+            <if test="medicalDevice1ExpiryEnd !=null "> medical_device1_expiry_end = #{medicalDevice1ExpiryEnd} ,</if>
+            <if test="medicalLicense !=null and medicalLicense !=''"> medical_license = #{medicalLicense} ,</if>
+            <if test="medicalLicenseExpiryStart !=null "> medical_license_expiry_start = #{medicalLicenseExpiryStart} ,</if>
+            <if test="medicalLicenseExpiryEnd !=null "> medical_license_expiry_end = #{medicalLicenseExpiryEnd} ,</if>
+            <if test="isBusinessLicensePermanent !=null ">is_business_license_permanent = #{isBusinessLicensePermanent}, </if>
+            <if test="settlementAgreement !=null ">settlement_agreement = #{settlementAgreement} , </if>
+            <if test="settlementAgreementStart !=null ">settlement_agreement_start = #{settlementAgreementStart} , </if>
+            <if test="settlementAgreementEnd !=null ">settlement_agreement_end = #{settlementAgreementEnd} , </if>
+            <if test="qualityAssuranceAgreement !=null ">quality_assurance_agreement = #{qualityAssuranceAgreement} , </if>
+            <if test="qualityAssuranceAgreementStart !=null ">quality_assurance_agreement_start = #{qualityAssuranceAgreementStart} , </if>
+            <if test="qualityAssuranceAgreementEnd !=null ">quality_assurance_agreement_end = #{qualityAssuranceAgreementEnd} , </if>
+            <if test="otherSpecialQualification !=null ">other_special_qualification = #{otherSpecialQualification} , </if>
+            <if test="otherSpecialQualificationStart !=null ">other_special_qualification_start = #{otherSpecialQualificationStart} , </if>
+            <if test="otherSpecialQualificationEnd !=null ">other_special_qualification_end = #{otherSpecialQualificationEnd} , </if>
+            <if test="businessCode !=null ">business_code=#{businessCode} , </if>
+            <if test="drugCode !=null ">drug_code=#{drugCode} , </if>
+            <if test="medicalDevice1Code !=null ">medical_device1_code=#{medicalDevice1Code} , </if>
+            <if test="foodCode !=null ">food_code=#{foodCode} , </if>
+            <if test="medicalCode !=null ">medical_code=#{medicalCode} , </if>
+            <if test="otherSpecialQualificationCode !=null ">other_special_qualification_code=#{otherSpecialQualificationCode} , </if>
+            <if test="qualityAssuranceAgreementCode !=null ">quality_assurance_agreement_code=#{qualityAssuranceAgreementCode} , </if>
+            <if test="settlementAgreementCode !=null ">settlement_agreement_code=#{settlementAgreementCode} , </if>
+            <if test="isMedicalDevice1ExpiryPermanent !=null ">is_medical_device1_expiry_permanent=#{isMedicalDevice1ExpiryPermanent} , </if>
+            <if test="isDrugLicensePermanent !=null ">is_drug_license_permanent = #{isDrugLicensePermanent}, </if>
+            <if test="isMedicalDevice2ExpiryPermanent !=null ">is_medical_device2_expiry_permanent = #{isMedicalDevice2ExpiryPermanent} , </if>
+            <if test="isMedicalDevice3ExpiryPermanent !=null ">is_medical_device3_expiry_permanent = #{isMedicalDevice3ExpiryPermanent} , </if>
+            <if test="isFoodLicenseExpiryPermanent !=null ">is_food_license_expiry_permanent = #{isFoodLicenseExpiryPermanent} , </if>
+            <if test="isMedicalLicenseExpiryPermanent !=null ">is_medical_license_expiry_permanent = #{isMedicalLicenseExpiryPermanent} , </if>
+            <if test="qualificationUpdateTime !=null ">qualification_update_time = #{qualificationUpdateTime} , </if>
+            <if test="titleNameOne !=null ">title_name_one = #{titleNameOne} , </if>
+            <if test="titleNameTwo !=null ">title_Name_two = #{titleNameTwo} , </if>
+            <if test="titleNameThree !=null ">title_Name_three = #{titleNameThree} , </if>
+            <if test="isEffectivePermanent1 !=null ">is_effective_permanent1 = #{isEffectivePermanent1} , </if>
+            <if test="isEffectivePermanent2 !=null ">is_effective_permanent2 = #{isEffectivePermanent2} , </if>
+            <if test="isEffectivePermanent3 !=null ">is_effective_permanent3 = #{isEffectivePermanent3} , </if>
+            <if test="settlementAgreementFileName !=null ">settlement_agreement_file_name = #{settlementAgreementFileName} , </if>
+            <if test="qualityAssuranceAgreementFileName !=null ">quality_assurance_agreement_fileName = #{qualityAssuranceAgreementFileName} , </if>
+            <if test="otherSpecialQualificationFileName !=null ">other_special_qualification_fileName = #{otherSpecialQualificationFileName} , </if>
+            <if test="drugLicenseBusinessScope !=null ">drug_license_business_scope = #{drugLicenseBusinessScope} , </if>
+            <if test="foodLicenseBusinessScope !=null ">food_license_business_scope = #{foodLicenseBusinessScope} , </if>
+            <if test="drugScopeHasFrozen !=null ">drug_scope_has_frozen = #{drugScopeHasFrozen}, </if>
+            <if test="reportUrl !=null ">report_url = #{reportUrl}, </if>
+            <if test="filingUrl !=null ">filing_url = #{filingUrl}, </if>
+            <if test="permStatus !=null ">perm_status = #{permStatus}, </if>
+            medical_device2 = #{medicalDevice2} ,
+            medical_device2_business_scope = #{medicalDevice2BusinessScope} ,
+            medical_device2_code = #{medicalDevice2Code} ,
+            medical_device2_expiry_start = #{medicalDevice2ExpiryStart} ,
+            medical_device2_expiry_end = #{medicalDevice2ExpiryEnd} ,
+            medical_device3 = #{medicalDevice3} ,
+            medical_device3_expiry_start = #{medicalDevice3ExpiryStart} ,
+            medical_device3_expiry_end = #{medicalDevice3ExpiryEnd} ,
+            medical_device3_code = #{medicalDevice3Code} ,
+            medical_device3_business_scope = #{medicalDevice3BusinessScope},
+            food_license = #{foodLicense} ,
+            food_license_expiry_start = #{foodLicenseExpiryStart} ,
+            food_license_expiry_end = #{foodLicenseExpiryEnd} ,
+        </trim>
+        where store_id = #{storeId}
+    </update>
 
+    <update id="updateExpiredStoreStatus">
+        UPDATE fs_store_scrm SET `status` = 0 WHERE store_id IN (SELECT * FROM (SELECT
+        f.store_id
+        FROM
+        fs_store_scrm f
+        WHERE
+        f.`status` = 1
+        AND f.is_audit IN (-1, 1 )
+        AND f.qualification_update_time IS NOT NULL
+        AND DATE_ADD( f.qualification_update_time, INTERVAL 6 MONTH ) &lt; CURDATE())a)
+    </update>
 </mapper>