Jelajahi Sumber

日志优化

yjwang 1 Minggu lalu
induk
melakukan
46fe9ef37b

+ 2 - 2
fs-admin/src/main/java/com/fs/hisStore/FsStoreSCRMController.java

@@ -108,9 +108,9 @@ public class FsStoreSCRMController extends BaseController
     @PreAuthorize("@ss.hasPermi('store:store:remove')")
     @Log(title = "店铺管理", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{storeIds}")
-    public AjaxResult remove(@PathVariable Long[] storeIds)
+    public R remove(@PathVariable Long[] storeIds)
     {
-        return toAjax(fsStoreService.deleteFsStoreByStoreIds(storeIds));
+        return fsStoreService.deleteFsStoreByStoreIds(storeIds);
     }
 
     /**

+ 2 - 2
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreProductScrmController.java

@@ -188,8 +188,8 @@ public class FsStoreProductScrmController extends BaseController {
     @Log(title = "商品管理", businessType = BusinessType.DELETE, isStoreLog = true,
             logParamExpression = "#p0.length>1?new String[]{'商品','批量删除商品信息'}: new String[]{'商品','删除商品信息'}")
     @DeleteMapping("/{productIds}")
-    public AjaxResult remove(@PathVariable Long[] productIds) {
-        return toAjax(fsStoreProductService.deleteFsStoreProductByIds(productIds));
+    public R remove(@PathVariable Long[] productIds) {
+        return fsStoreProductService.deleteFsStoreProductByIds(productIds);
     }
 
 

+ 3 - 2
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreScrmController.java

@@ -141,9 +141,10 @@ public class FsStoreScrmController extends BaseController
     @PreAuthorize("@ss.hasPermi('his:store:remove')")
     @Log(title = "店铺管理", businessType = BusinessType.DELETE,logParam = {"店铺","删除店铺信息"},isStoreLog = true)
 	@DeleteMapping("/{storeIds}")
-    public AjaxResult remove(@PathVariable Long[] storeIds)
+    public R remove(@PathVariable Long[] storeIds)
     {
-        return toAjax(fsStoreService.deleteFsStoreByStoreIds(storeIds));
+
+        return fsStoreService.deleteFsStoreByStoreIds(storeIds);
     }
 
     /**

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

@@ -456,4 +456,9 @@ public class FsStoreScrm extends BaseEntity {
      **/
     private Byte isMedicalLicenseExpiryPermanent;
 
+    /**
+     * 资质更新日期6个月提醒
+     * **/
+    private LocalDate qualificationUpdateTime;
+
 }

+ 26 - 0
fs-service/src/main/java/com/fs/hisStore/dto/FsStoreProductScrmInfoDTO.java

@@ -0,0 +1,26 @@
+package com.fs.hisStore.dto;
+
+import lombok.Data;
+
+@Data
+public class FsStoreProductScrmInfoDTO {
+    /**
+     * 店铺id
+     */
+    private Long storeId;
+
+    /**
+     * 店铺名称
+     */
+    private String storeName;
+
+    /**
+     * 商品id
+     */
+    private Long productId;
+
+    /**
+     * 商品名称
+     */
+    private String productName;
+}

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

@@ -8,6 +8,7 @@ import com.fs.his.vo.FsStoreProductListSVO;
 import com.fs.his.vo.OptionsVO;
 import com.fs.hisStore.config.MedicalMallConfig;
 import com.fs.hisStore.domain.FsStoreProductRuleScrm;
+import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.param.FsStoreCartCountParam;
 import com.fs.statis.dto.ModifyMoreDTO;
 import com.fs.hisStore.domain.FsStoreProductScrm;
@@ -609,4 +610,11 @@ public interface FsStoreProductScrmMapper
      * @return
      */
     List<String> getProductNoticeInfo(@Param("storeId") Long storeId);
+
+    /**
+     * 获取店铺产品信息
+     * @param ids 商品ID
+     * @return
+     * **/
+    List<FsStoreProductScrmInfoDTO> getStoreInfo(@Param("ids") Long[] ids);
 }

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

@@ -1,6 +1,7 @@
 package com.fs.hisStore.mapper;
 
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.vo.FsStoreDetailsScrmVo;
 import com.fs.hisStore.vo.FsStoreRecommendListVO;
 import com.fs.hisStore.vo.FsStoreScrmVO;
@@ -196,4 +197,17 @@ public interface FsStoreScrmMapper
      * @return 店铺管理集合
      */
     public List<FsStoreScrm> selecStorePageList(FsStoreScrm FsStoreScrm);
+
+    /**
+     * @description: 店铺资质即将到期提示数据
+     * @param: StoreId 店铺id
+     * **/
+    FsStoreScrm qualificationReminder(@Param("storeId") Long storeId);
+
+    /**
+     * 获取店铺产品信息
+     * @param storeIds 店铺id
+     * @return
+     * **/
+    List<FsStoreProductScrmInfoDTO> getStoreInfo(@Param("storeIds") Long[] storeIds);
 }

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

@@ -65,7 +65,7 @@ public interface IFsStoreProductScrmService
      * @param productIds 需要删除的商品ID
      * @return 结果
      */
-    public int deleteFsStoreProductByIds(Long[] productIds);
+    public R deleteFsStoreProductByIds(Long[] productIds);
 
     /**
      * 删除商品信息

+ 9 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreScrmService.java

@@ -1,7 +1,9 @@
 package com.fs.hisStore.service;
 
+import com.fs.common.core.domain.R;
 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.FsStoreDetailsScrmVo;
 import com.fs.hisStore.vo.FsStoreRecommendListVO;
@@ -63,7 +65,7 @@ public interface IFsStoreScrmService
      * @param storeIds 需要删除的店铺管理主键集合
      * @return 结果
      */
-    public int deleteFsStoreByStoreIds(Long[] storeIds);
+    public R deleteFsStoreByStoreIds(Long[] storeIds);
 
     /**
      * 删除店铺管理信息
@@ -129,4 +131,10 @@ public interface IFsStoreScrmService
      * @return
      */
     List<String> queryValidStoreLastInfo(Long storeId);
+
+    /**
+     * 店铺6月到期提醒
+     * @param storeId 店铺id
+     * **/
+    R qualificationReminder(Long storeId);
 }

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

@@ -31,6 +31,7 @@ import com.fs.his.vo.FsStoreProductListSVO;
 import com.fs.his.vo.OptionsVO;
 import com.fs.hisStore.config.MedicalMallConfig;
 import com.fs.hisStore.domain.*;
+import com.fs.hisStore.dto.FsStoreProductScrmInfoDTO;
 import com.fs.hisStore.mapper.*;
 import com.fs.hisStore.param.FsStoreCartCountParam;
 import com.fs.hisStore.service.IFsStoreProductCategoryScrmService;
@@ -223,10 +224,22 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
      * @return 结果
      */
     @Override
-    public int deleteFsStoreProductByIds(Long[] productIds)
+    public R deleteFsStoreProductByIds(Long[] productIds)
     {
         storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
-        return fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
+        StringBuilder sb = new StringBuilder();
+        List<FsStoreProductScrmInfoDTO> storeInfos = fsStoreProductMapper.getStoreInfo(productIds);
+        sb.append("删除成功");
+        if(fsStoreProductMapper.deleteFsStoreProductByIds(productIds) > 0){
+            storeInfos.forEach(storeInfo -> {
+                sb.append("删除店铺ID:").append(storeInfo.getStoreId()).append("-")
+                        .append("删除店铺名称:").append(storeInfo.getStoreName()).append("-")
+                        .append("删除商品ID:").append(storeInfo.getProductId()).append("-")
+                        .append("删除商品名称:").append(storeInfo.getProductName()).append("/");
+
+            });
+        }
+        return R.ok(sb.toString());
     }
 
     /**

+ 33 - 11
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.hisStore.service.impl;
 
 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;
@@ -11,6 +12,7 @@ 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.hisStore.mapper.FsStoreProductScrmMapper;
 import com.fs.hisStore.mapper.FsStoreScrmMapper;
 import com.fs.hisStore.param.FsStoreScrmInfoParam;
@@ -123,6 +125,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         String sequence = generateStoreSequence();
         fsStore.setMerchantId(merchantId);
         fsStore.setStoreSeq(sequence);
+        fsStore.setQualificationUpdateTime(LocalDate.now());
         fsStoreMapper.insertFsStore(fsStore);
         return fsStore.getStoreId();
     }
@@ -205,7 +208,8 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         Boolean isAudit = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
         try {
             if (isAudit != null && isAudit) {
-                if (fsStore.getIsAudit() != null && 1 == fsStore.getIsAudit()) {
+                //驳回修改时,将isAudit设置为0
+                if (fsStore.getIsAudit() != null && (1 == fsStore.getIsAudit() || -1 == fsStore.getIsAudit())) {
                     Map<String, Object> diff = getDiff(oldFsStore, fsStore);
                     Set<String> diff_columns = diff.keySet();
                     JSONArray storeColumns = configUtil.generateConfigByKey("medicalMall.func.switch").getJSONArray("storeColumns");
@@ -225,7 +229,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         } catch (IllegalAccessException e) {
             log.error("获取diff出错", e);
         }
-
+        fsStore.setQualificationUpdateTime(LocalDate.now());
         return fsStoreMapper.updateFsStore(fsStore);
     }
 
@@ -269,9 +273,20 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
      * @return 结果
      */
     @Override
-    public int deleteFsStoreByStoreIds(Long[] storeIds) {
+    public R deleteFsStoreByStoreIds(Long[] storeIds) {
+        //获取数据
+        List<FsStoreProductScrmInfoDTO> storeInfos = fsStoreMapper.getStoreInfo(storeIds);
         storeAuditLogUtil.addBatchAuditArray(storeIds, null, null);
-        return fsStoreMapper.deleteFsStoreByStoreIds(storeIds);
+        StringBuilder sb = new StringBuilder();
+        sb.append("删除成功");
+        if(fsStoreMapper.deleteFsStoreByStoreIds(storeIds) > 0){
+            storeInfos.forEach(storeInfo -> {
+                sb.append("删除店铺ID:").append(storeInfo.getStoreId()).append("-")
+                        .append("删除店铺:").append(storeInfo.getStoreName()).append("/");
+
+            });
+        }
+        return  R.ok(sb.toString());
     }
 
     /**
@@ -306,7 +321,10 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
                         fsStore.getStoreId(), fsStoreScrm.getBusinessScope(), selectableProductTypes);
             }
         }
-
+        //审核过后更新
+        if(fsStore.getIsAudit() != null && fsStore.getIsAudit() == 1){
+            updateStore.setQualificationUpdateTime(LocalDate.now());
+        }
         fsStoreMapper.updateFsStore(updateStore);
         //更新日志
         storeAuditLogUtil.addAudit(fsStore.getStoreId(), fsStore.getReason(), fsStore.getAttachImage());
@@ -426,12 +444,11 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         Boolean isAuditEnabled = configUtil.generateConfigByKey("medicalMall.func.switch").getBoolean("isAudit");
         try {
             // 仅当开启审核功能时才进行判断
-            if (Boolean.TRUE.equals(isAuditEnabled) && oldFsStore.getIsAudit() == 1) {
-                if (getFullDiff(oldFsStore, fsStore)) {
-                    fsStore.setIsAudit(0);
-                }
-            } else {
-                fsStore.setIsAudit(1);
+            if (Boolean.TRUE.equals(isAuditEnabled) && (oldFsStore.getIsAudit() == 1 || oldFsStore.getIsAudit() == -1)) {
+//                if (getFullDiff(oldFsStore, fsStore)) {
+//                    fsStore.setIsAudit(0);
+//                }
+                fsStore.setIsAudit(0);
             }
         } catch (Exception e) {
             log.error("处理审核状态出错", e);
@@ -460,6 +477,11 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService {
         return fsStoreMapper.queryValidStoreLastInfo(storeId);
     }
 
+    @Override
+    public R qualificationReminder(Long storeId) {
+        return R.ok().put("check",fsStoreMapper.qualificationReminder(storeId) != null);
+    }
+
     /**
      * 获取两个对象的所有差异字段(基于旧对象的所有字段,以新对象字段值为准进行对比)
      * 只要新旧值不同就视为差异

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

@@ -776,4 +776,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.productId != null">AND p.product_id = #{maps.productId}</if>
     </select>
 
+    <select id="getStoreInfo" resultType="com.fs.hisStore.dto.FsStoreProductScrmInfoDTO">
+        SELECT
+            p.product_id productId,
+            p.product_name productName,
+            fss.store_id storeId,
+            fss.store_name storeName
+        FROM
+            fs_store_product_scrm p LEFT JOIN fs_store_scrm fss ON p.store_id = fss.store_id
+        WHERE p.product_id IN <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
+    </select>
+
 </mapper>

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

@@ -204,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isMedicalDevice3ExpiryPermanent !=null ">is_medical_device3_expiry_permanent , </if>
             <if test="isFoodLicenseExpiryPermanent !=null ">is_food_license_expiry_permanent , </if>
             <if test="isMedicalLicenseExpiryPermanent !=null ">is_medical_license_expiry_permanent , </if>
+            <if test="qualificationUpdateTime !=null ">qualification_update_time , </if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="cityIds != null">#{cityIds},</if>
@@ -288,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isMedicalDevice3ExpiryPermanent !=null ">#{isMedicalDevice3ExpiryPermanent} , </if>
             <if test="isFoodLicenseExpiryPermanent !=null ">#{isFoodLicenseExpiryPermanent} , </if>
             <if test="isMedicalLicenseExpiryPermanent !=null ">#{isMedicalLicenseExpiryPermanent} , </if>
+            <if test="qualificationUpdateTime !=null ">#{qualificationUpdateTime} , </if>
         </trim>
     </insert>
 
@@ -374,6 +376,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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>
         </trim>
         where store_id = #{storeId}
     </update>
@@ -901,4 +904,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by store_id desc
     </select>
+
+    <select id="qualificationReminder" resultType="com.fs.hisStore.domain.FsStoreScrm">
+        SELECT
+        store_id
+        FROM
+        fs_store_scrm
+        WHERE
+        store_id = #{storeId}
+        AND `status` = 1
+        AND is_audit IN (- 1, 1 )
+        AND qualification_update_time &lt;= DATE_SUB(CURDATE() , INTERVAL 6 MONTH )
+    </select>
+
+    <select id="getStoreInfo" resultType="com.fs.hisStore.dto.FsStoreProductScrmInfoDTO">
+        SELECT store_id,store_name FROM fs_store_scrm WHERE store_id IN
+        <foreach collection="storeIds" item="item" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
 </mapper>

+ 2 - 2
fs-store/src/main/java/com/fs/hisStore/controller/store/FsStoreProductScrmController.java

@@ -147,10 +147,10 @@ public TableDataInfo list(FsStoreProductScrm fsStoreProduct)
 
     @Log(title = "商品", businessType = BusinessType.DELETE,isStoreLog = true,logParam = {"商品","批量删除商品信息"})
 	@DeleteMapping("/{productIds}")
-    public AjaxResult remove(@PathVariable Long[] productIds)
+    public R remove(@PathVariable Long[] productIds)
     {
 
-        return toAjax(fsStoreProductService.deleteFsStoreProductByIds(productIds));
+        return fsStoreProductService.deleteFsStoreProductByIds(productIds);
     }
 
 

+ 12 - 10
fs-store/src/main/java/com/fs/hisStore/controller/store/FsStoreScrmController.java

@@ -4,14 +4,11 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.exception.base.BaseException;
 import com.fs.common.utils.ServletUtils;
-import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.erp.utils.CommonUtils;
 import com.fs.framework.service.TokenServiceScrm;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.hisStore.domain.FsStoreScrm;
@@ -23,13 +20,8 @@ import com.fs.hisStore.utils.UserUtil;
 import com.fs.hisStore.vo.FsStoreDetailsScrmVo;
 import io.jsonwebtoken.lang.Collections;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Optional;
 
 /**
  * 店铺管理Controller
@@ -150,8 +142,8 @@ public class FsStoreScrmController extends BaseController {
 
     @Log(title = "店铺管理", businessType = BusinessType.DELETE, logParam = {"店铺", "删除店铺信息"}, isStoreLog = true)
     @DeleteMapping("/{storeIds}")
-    public AjaxResult remove(@PathVariable Long[] storeIds) {
-        return toAjax(fsStoreService.deleteFsStoreByStoreIds(storeIds));
+    public R remove(@PathVariable Long[] storeIds) {
+        return fsStoreService.deleteFsStoreByStoreIds(storeIds);
     }
 
     /**
@@ -206,4 +198,14 @@ public class FsStoreScrmController extends BaseController {
         StoreLoginUserScrm loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(loginUser.getFsStore().getStoreId(),"店铺"));
     }
+
+    /**
+     * 店铺资质提醒接口
+     * **/
+    @Log(title = "商家端:商家满6个月证件更换提醒", businessType = BusinessType.OTHER)
+    @GetMapping("/qualificationReminder")
+    public R qualificationReminder(){
+        StoreLoginUserScrm loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        return fsStoreService.qualificationReminder(loginUser.getFsStore().getStoreId());
+    }
 }