Browse Source

fixed 源码质量提升修改

fushengqian 1 month ago
parent
commit
ffe98fd1b9

+ 10 - 0
fuint-application/src/main/java/com/fuint/common/service/StoreService.java

@@ -86,6 +86,16 @@ public interface StoreService extends IService<MtStore> {
      * */
     List<MtStore> queryStoresByParams(Map<String, Object> params) throws BusinessCheckException;
 
+    /**
+     * 获取我的店铺列表
+     *
+     * @param merchantId 商户ID
+     * @param storeId 店铺ID
+     * @param status 状态
+     * @return
+     * */
+    List<MtStore> getMyStoreList(Integer merchantId, Integer storeId, String status) throws BusinessCheckException;
+
     /**
      * 根据距离远近查找店铺
      *

+ 2 - 5
fuint-application/src/main/java/com/fuint/common/service/impl/MerchantServiceImpl.java

@@ -170,8 +170,7 @@ public class MerchantServiceImpl extends ServiceImpl<MtMerchantMapper, MtMerchan
      */
     @Override
     public MtMerchant queryMerchantByName(String name) {
-        MtMerchant mtMerchant = mtMerchantMapper.queryMerchantByName(name);
-        return mtMerchant;
+        return mtMerchantMapper.queryMerchantByName(name);
     }
 
     /**
@@ -277,8 +276,6 @@ public class MerchantServiceImpl extends ServiceImpl<MtMerchantMapper, MtMerchan
         }
 
         lambdaQueryWrapper.orderByAsc(MtMerchant::getStatus).orderByDesc(MtMerchant::getId);
-        List<MtMerchant> dataList = mtMerchantMapper.selectList(lambdaQueryWrapper);
-
-        return dataList;
+        return mtMerchantMapper.selectList(lambdaQueryWrapper);
     }
 }

+ 13 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/StoreServiceImpl.java

@@ -362,6 +362,19 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
         return mtStoreMapper.selectList(lambdaQueryWrapper);
     }
 
+    /**
+     * 获取我的店铺列表
+     *
+     * @param merchantId 商户ID
+     * @param storeId 店铺ID
+     * @param status 状态
+     * @return
+     * */
+    @Override
+    public List<MtStore> getMyStoreList(Integer merchantId, Integer storeId, String status) {
+        return mtStoreMapper.getMyStoreList(merchantId, storeId, status);
+    }
+
     /**
      * 根据距离远近获取店铺列表
      *

+ 3 - 3
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java

@@ -154,6 +154,9 @@ public class BackendAccountController extends BaseController {
         }
         result.put("roles", roles);
 
+        List<MtStore> stores = storeService.getMyStoreList(accountInfo.getMerchantId(),accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
+        result.put("stores", stores);
+
         Map<String, Object> params = new HashMap<>();
         params.put("status", StatusEnum.ENABLED.getKey());
         if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
@@ -162,9 +165,6 @@ public class BackendAccountController extends BaseController {
         if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
             params.put("merchantId", accountInfo.getMerchantId());
         }
-        List<MtStore> stores = storeService.queryStoresByParams(params);
-        result.put("stores", stores);
-
         List<MtMerchant> merchants = merchantService.queryMerchantByParams(params);
         result.put("merchants", merchants);
 

+ 2 - 12
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBookCateController.java

@@ -96,21 +96,11 @@ public class BackendBookCateController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<MtBookCate> paginationResponse = bookCateService.queryBookCateListByPagination(paginationRequest);
 
-        Map<String, Object> paramsStore = new HashMap<>();
-        paramsStore.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            paramsStore.put("storeId", accountInfo.getStoreId().toString());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            paramsStore.put("merchantId", accountInfo.getMerchantId());
-        }
-
-        List<MtStore> storeList = storeService.queryStoresByParams(paramsStore);
-        String imagePath = settingService.getUploadBasePath();
+        List<MtStore> storeList = storeService.getMyStoreList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
 
         Map<String, Object> result = new HashMap<>();
         result.put("dataList", paginationResponse);
-        result.put("imagePath", imagePath);
+        result.put("imagePath", settingService.getUploadBasePath());
         result.put("storeList", storeList);
 
         return getSuccessResult(result);

+ 2 - 12
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBookItemController.java

@@ -114,17 +114,7 @@ public class BackendBookItemController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<BookItemDto> paginationResponse = bookItemService.queryBookItemListByPagination(paginationRequest);
 
-        Map<String, Object> paramsStore = new HashMap<>();
-        paramsStore.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            paramsStore.put("storeId", accountInfo.getStoreId().toString());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            paramsStore.put("merchantId", accountInfo.getMerchantId());
-        }
-
-        List<MtStore> storeList = storeService.queryStoresByParams(paramsStore);
-        String imagePath = settingService.getUploadBasePath();
+        List<MtStore> storeList = storeService.getMyStoreList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
 
         // 预约状态列表
         List<ParamDto> bookStatusList = BookStatusEnum.getBookStatusList();
@@ -141,7 +131,7 @@ public class BackendBookItemController extends BaseController {
 
         Map<String, Object> result = new HashMap<>();
         result.put("dataList", paginationResponse);
-        result.put("imagePath", imagePath);
+        result.put("imagePath", settingService.getUploadBasePath());
         result.put("storeList", storeList);
         result.put("bookStatusList", bookStatusList);
         result.put("cateList", cateList);

+ 3 - 17
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCateController.java

@@ -110,19 +110,10 @@ public class BackendCateController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<GoodsCateDto> paginationResponse = cateService.queryCateListByPagination(paginationRequest);
 
-        Map<String, Object> paramsStore = new HashMap<>();
-        paramsStore.put("status", StatusEnum.ENABLED.getKey());
-        if (storeId != null && storeId > 0) {
-            paramsStore.put("storeId", storeId.toString());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            paramsStore.put("merchantId", accountInfo.getMerchantId());
-        }
-        List<MtStore> storeList = storeService.queryStoresByParams(paramsStore);
-        String imagePath = settingService.getUploadBasePath();
+        List<MtStore> storeList = storeService.getMyStoreList(accountInfo.getMerchantId(), storeId, StatusEnum.ENABLED.getKey());
 
         Map<String, Object> result = new HashMap<>();
-        result.put("imagePath", imagePath);
+        result.put("imagePath", settingService.getUploadBasePath());
         result.put("storeList", storeList);
         result.put("paginationResponse", paginationResponse);
 
@@ -156,12 +147,7 @@ public class BackendCateController extends BaseController {
         cate.setOperator(operator);
         cate.setId(id);
         cate.setStatus(status);
-
-        try {
-            cateService.updateCate(cate);
-        } catch (BusinessCheckException e) {
-            return getFailureResult(201, e.getMessage() == null ? "操作失败" : e.getMessage());
-        }
+        cateService.updateCate(cate);
 
         return getSuccessResult(true);
     }

+ 1 - 9
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendPrinterController.java

@@ -109,15 +109,7 @@ public class BackendPrinterController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<MtPrinter> paginationResponse = printerService.queryPrinterListByPagination(paginationRequest);
 
-        Map<String, Object> paramsStore = new HashMap<>();
-        paramsStore.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            paramsStore.put("storeId", accountInfo.getStoreId().toString());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            paramsStore.put("merchantId", accountInfo.getMerchantId());
-        }
-        List<MtStore> storeList = storeService.queryStoresByParams(paramsStore);
+        List<MtStore> storeList = storeService.getMyStoreList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
 
         Map<String, Object> result = new HashMap<>();
         result.put("paginationResponse", paginationResponse);

+ 2 - 0
fuint-repository/src/main/java/com/fuint/repository/mapper/MtStoreMapper.java

@@ -25,4 +25,6 @@ public interface MtStoreMapper extends BaseMapper<MtStore> {
 
     void deleteStoreByMerchant(@Param("merchantId") Integer merchantId);
 
+    List<MtStore> getMyStoreList(@Param("merchantId") Integer merchantId, @Param("storeId") Integer storeId, @Param("status") String status);
+
 }

+ 13 - 0
fuint-repository/src/main/resources/mapper/MtStoreMapper.xml

@@ -34,4 +34,17 @@
     <update id="deleteStoreByMerchant">
         update mt_store set STATUS = 'D' where MERCHANT_ID = #{merchantId}
     </update>
+
+    <select id="getMyStoreList" resultType="com.fuint.repository.model.MtStore">
+        select * from mt_store t where t.SATTUS != 'D'
+        <if test="merchantId != null and merchantId != ''">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            AND t.ID = #{storeId}
+        </if>
+        <if test="status != null and status != ''">
+            AND t.SATTUS = #{status}
+        </if>
+    </select>
 </mapper>