From 95f9ea7eb339c36cade6c67d0385c49ec2d81477 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Wed, 14 Apr 2021 19:39:45 +0800
Subject: [PATCH] Merge branch 'score_shop' into api_score_meger

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java
new file mode 100644
index 0000000..ebdc64d
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java
@@ -0,0 +1,72 @@
+package com.matrix.system.shopXcx.api.action;
+
+import com.matrix.core.pojo.AjaxResult;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.system.common.constance.AppConstance;
+import com.matrix.system.common.interceptor.HostInterceptor;
+import com.matrix.system.shopXcx.api.dto.SaleProductDto;
+import com.matrix.system.shopXcx.api.dto.ScoreProductDto;
+import com.matrix.system.shopXcx.bean.ShopProduct;
+import com.matrix.system.shopXcx.bean.ShopProductAttribute;
+import com.matrix.system.shopXcx.dao.ShopProductAttributeDao;
+import com.matrix.system.shopXcx.dao.ShopProductDao;
+import com.matrix.system.shopXcx.dao.ShopSkuDao;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author jyy
+ * @date 2021-03-10
+ **/
+@Api(tags = "积分商品类")
+@RestController
+@RequestMapping(value = "/wxapi/scoreProduct")
+public class WxScoreProductAction {
+
+    @Autowired
+    private ShopProductDao shopProductDao;
+
+    @Autowired
+    private ShopSkuDao shopSkuDao;
+
+    @Autowired
+    ShopProductAttributeDao shopProductAttributeDao;
+
+    @ApiOperation(value = "查询积分商品", notes = "")
+    @PostMapping(value = "/getScoreProductList")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "ok", response=SaleProductDto.class)
+    })
+    public AjaxResult getShopProductShowList(@RequestBody @Validated ScoreProductDto scoreProductDto) {
+        ShopProduct shopProduct=new ShopProduct();
+        shopProduct.setLimit(scoreProductDto.getPageSize());
+        shopProduct.setOffset((scoreProductDto.getPageNum()-1)* scoreProductDto.getPageSize());
+        shopProduct.setScoreCategoryId(scoreProductDto.getScoreCategoryId());
+        shopProduct.setDelFlag(AppConstance.DATA_USEABLE);
+        shopProduct.setStatus(AppConstance.IS_PUTAWAY);
+        shopProduct.setAbleScorePay(ShopProduct.PAYFOR_SCORE);
+        shopProduct.setCompanyId(HostInterceptor.getCompanyId());
+        //根据属性查询
+        if(StringUtils.isNotBlank(scoreProductDto.getAttrCode())){
+            ShopProductAttribute jfscrmtj = shopProductAttributeDao.selectByCode("jfscrmtj", HostInterceptor.getCompanyId());
+            if(jfscrmtj!=null){
+                shopProduct.setAttrs(jfscrmtj.getAttrId()+"");
+            }
+        }
+        List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
+        shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
+        return AjaxResult.buildSuccessInstance(shopProducts);
+    }
+
+
+}

--
Gitblit v1.9.1