Przeglądaj źródła

商品过期提醒sql优化,处理商品新增异常问题、审核查询接口

yjwang 1 tydzień temu
rodzic
commit
6de787f18f

+ 1 - 1
fs-admin/src/main/java/com/fs/hisStore/FsHisStoreLogController.java

@@ -18,7 +18,7 @@ public class FsHisStoreLogController {
     private IFsHisStoreAuditLogScrmService fsHisStoreLogScrmService;
     @RequestMapping("/{mainId}")
     public R getInfo(@PathVariable("mainId") Long mainId) {
-        List<SysOperLogScrm> sysOperLogScrms = fsHisStoreLogScrmService.selectOperLogByMainId(mainId);
+        List<SysOperLogScrm> sysOperLogScrms = fsHisStoreLogScrmService.selectOperLogByMainId(mainId,"店铺");
         return R.ok().put("data",sysOperLogScrms);
     }
 }

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

@@ -10,6 +10,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.hisStore.facade.FsStore580FacadeService;
+import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.vo.*;
 import com.fs.hospital580.service.Hospital580ScrmService;
 import com.fs.statis.dto.ModifyMoreDTO;
@@ -60,6 +61,9 @@ public class FsStoreProductScrmController extends BaseController {
     @Autowired
     private FsStore580FacadeService fsStore580FacadeService;
 
+    @Autowired
+    private StoreAuditLogUtil storeAuditLogUtil;
+
 
     /**
      * 批量修改商品
@@ -278,4 +282,14 @@ public class FsStoreProductScrmController extends BaseController {
         }
         return R.ok().put("code", 0);
     }
+
+
+    /**
+     * 商品审核日志
+     * */
+    @PreAuthorize("@ss.hasPermi('his:storeProduct:auditLog')")
+    @GetMapping("/auditLog/{storeId}")
+    public R auditLog(@PathVariable Long storeId){
+        return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(storeId,"商品"));
+    }
 }

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

@@ -176,7 +176,7 @@ public class FsStoreScrmController extends BaseController
     @PreAuthorize("@ss.hasPermi('his:store:auditLog')")
     @GetMapping("/auditLog/{storeId}")
     public R auditLog(@PathVariable Long storeId){
-        return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(storeId));
+        return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(storeId,"店铺"));
     }
 
     /**

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

@@ -52,7 +52,7 @@ public interface SysOperLogScrmMapper  extends BaseMapper<SysOperLogScrm>
 
     void insertBatchByIds(@Param("entity") List<SysOperLogScrm> sysOperLogScrm);
     //selectOperLogByMainId
-    List<SysOperLogScrm> selectSotreOperLogByMainId(Long mainId);
+    List<SysOperLogScrm> selectSotreOperLogByMainId(@Param("mainId") Long mainId,@Param("mainType") String mainType);
 
     int updateByIncloudIdStr(SysOperLogScrm operLog);
 }

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

@@ -26,6 +26,6 @@ public interface IFsHisStoreAuditLogScrmService
     /**
      * 根据商品id获取商品审核信息
      * */
-    List<SysOperLogScrm> selectOperLogByMainId(Long productId);
+    List<SysOperLogScrm> selectOperLogByMainId(Long productId, String mainType);
 
 }

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

@@ -48,8 +48,8 @@ public class FsHisStoreAuditLogScrmServiceImpl implements IFsHisStoreAuditLogScr
 
     //selectOperLogByMainId
     @Override
-    public List<SysOperLogScrm> selectOperLogByMainId(Long id) {
-        return sysOperLogScrmMapper.selectSotreOperLogByMainId(id);
+    public List<SysOperLogScrm> selectOperLogByMainId(Long id,String mainType) {
+        return sysOperLogScrmMapper.selectSotreOperLogByMainId(id,mainType);
     }
 
 

+ 2 - 2
fs-service/src/main/java/com/fs/hisStore/utils/StoreAuditLogUtil.java

@@ -35,8 +35,8 @@ public class StoreAuditLogUtil {
         hisStoreAuditLogService.generateOperId();
     }
 
-    public List<SysOperLogScrm> selectOperLogByMainId(Long mainId) {
-        return hisStoreAuditLogService.selectOperLogByMainId(mainId);
+    public List<SysOperLogScrm> selectOperLogByMainId(Long mainId,String mainType) {
+        return hisStoreAuditLogService.selectOperLogByMainId(mainId,mainType);
     }
 
 

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

@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<!-- 根据mainId获取操作日志 -->
 	<select id="selectSotreOperLogByMainId" resultMap="SysOperLogResult">
 		<include refid="selectOperLogVo"/>
-		where main_id = #{mainId} and status = 0 and main_type = '店铺' and business_type = 10
+		where main_id = #{mainId} and status = 0 and main_type = #{mainType} and business_type = 10 ORDER BY oper_time DESC
 	</select>
 
 	<!--updateByIncloudIdStr-->

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

@@ -20,6 +20,7 @@ import com.fs.hisStore.domain.StoreLoginUserScrm;
 import com.fs.hisStore.param.FsStoreProductAddEditParam;
 import com.fs.hisStore.service.IFsStoreProductAttrScrmService;
 import com.fs.hisStore.service.IFsStoreProductScrmService;
+import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.utils.UserUtil;
 import com.fs.hisStore.vo.FsStoreProductListVO;
 import com.fs.store.vo.FsStoreProductStoreExcelVO;
@@ -28,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -51,6 +53,9 @@ public class FsStoreProductScrmController extends BaseController
     @Autowired
     private TokenServiceScrm tokenService;
 
+    @Autowired
+    private StoreAuditLogUtil storeAuditLogUtil;
+
     /**
  * 查询商品列表
  */
@@ -199,4 +204,12 @@ public TableDataInfo list(FsStoreProductScrm fsStoreProduct)
         return fsStoreProductService.addOrEdit(fsStoreProduct);
     }
 
+    /**
+     * 商品审核日志
+     * */
+    @GetMapping("/auditLog")
+    public R auditLog(@RequestParam("productId") String productId){
+        return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(Long.valueOf(productId),"商品"));
+    }
+
 }

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

@@ -18,10 +18,12 @@ import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.domain.StoreLoginUserScrm;
 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.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;
@@ -43,6 +45,9 @@ public class FsStoreScrmController extends BaseController {
     @Autowired
     private TokenServiceScrm tokenService;
 
+    @Autowired
+    private StoreAuditLogUtil storeAuditLogUtil;
+
     /**
      * 查询店铺管理列表
      */
@@ -191,4 +196,14 @@ public class FsStoreScrmController extends BaseController {
         }
         return R.ok().put("code", 0);
     }
+
+
+    /**
+     * 商品审核日志
+     * */
+    @GetMapping("/auditLog")
+    public R auditLog(){
+        StoreLoginUserScrm loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        return R.ok().put("auditLog",storeAuditLogUtil.selectOperLogByMainId(loginUser.getFsStore().getStoreId(),"店铺"));
+    }
 }