From a5c67e27c22831e54e0a4b9eb22166368d446673 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Thu, 18 Mar 2021 15:27:03 +0800
Subject: [PATCH] 积分商城1
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java | 65 ++++++
zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html | 36 ++
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml | 16 +
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml | 27 ++
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml | 85 ++++++++
zq-erp/src/main/resources/config/db/increment/推广员.sql | 7
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java | 8
zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java | 18 +
/dev/null | 141 --------------
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java | 3
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java | 4
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java | 6
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java | 2
zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java | 27 ++
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java | 2
zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html | 103 ++++++++--
18 files changed, 360 insertions(+), 194 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java
deleted file mode 100644
index c7e50a8..0000000
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopShoppingCartAction.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.matrix.system.shopXcx.action;
-
-import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.constance.SystemMessageCode;
-import com.matrix.core.pojo.PaginationVO;
-import com.matrix.core.tools.ModelUtils;
-import com.matrix.core.tools.StringUtils;
-import com.matrix.core.constance.SystemErrorCode;
-import com.matrix.core.anotations.RemoveRequestToken;
-import com.matrix.system.common.bean.SysUsers;
-import com.matrix.system.hive.action.util.QueryUtil;
-import com.matrix.system.shopXcx.dao.ShopShoppingCartDao;
-import org.springframework.stereotype.Controller;
-import com.matrix.core.exception.GlobleException;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import com.matrix.core.anotations.SaveRequestToken;
-import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.tools.WebUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-import java.util.Map;
-import com.matrix.system.shopXcx.bean.ShopShoppingCart;
-import org.springframework.web.servlet.ModelAndView;
-
-/**
- * @description 购物车
- * @author jiangyouyao
- * @date 2019-06-12 19:09
- */
-@Controller
-@RequestMapping(value = "admin/shopShoppingCart")
-public class ShopShoppingCartAction {
-
- @Autowired
- private ShopShoppingCartDao shopShoppingCartDao;
-
- //记录编辑前的值Before_Edit_Value
- public static final String BEV="ShopShoppingCart_BEV";
-
-
- /**
- * 列表显示
- */
- @RequestMapping(value = "/showList")
- public @ResponseBody AjaxResult showList(ShopShoppingCart shopShoppingCart, PaginationVO pageVo) {
- QueryUtil.setQueryLimitCom(shopShoppingCart);
- List<ShopShoppingCart> dataList = shopShoppingCartDao.selectInPage(shopShoppingCart, pageVo);
- AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList,
- shopShoppingCartDao.selectTotalRecord(shopShoppingCart));
- return result;
- }
-
- /**
- * 新增
- */
- @RemoveRequestToken
- @RequestMapping(value = "/addShopShoppingCart")
- public @ResponseBody AjaxResult addShopShoppingCart(ShopShoppingCart shopShoppingCart) {
- SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
- shopShoppingCart.setCreateBy(user.getSuName());
- shopShoppingCart.setUpdateBy(user.getSuName());
- shopShoppingCart.setCompanyId(user.getCompanyId());
- int i=shopShoppingCartDao.insert(shopShoppingCart);
- if(i > 0){
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.ADD_SUCCES, "购物车");
- }else {
- throw new GlobleException(SystemErrorCode.DATA_ADD_FAIL);
- }
- }
-
-
-
-
-
- /**
- * 修改
- */
- @RemoveRequestToken
- @RequestMapping(value = "/modifyShopShoppingCart")
- public @ResponseBody AjaxResult modifyShopShoppingCart(ShopShoppingCart newShopShoppingCart) {
- ShopShoppingCart oldShopShoppingCart = WebUtil.getSessionAttribute(BEV);
- int i = 0;
- Map<String, Object> modifyMap = null;
- try {
- if (!ModelUtils.isModified(oldShopShoppingCart, newShopShoppingCart)) {
- i = MatrixConstance.DML_SUCCESSS;
- }
- modifyMap = ModelUtils.comparePojo2Map(oldShopShoppingCart, newShopShoppingCart);
- } catch (Exception e) {
- throw new GlobleException(SystemErrorCode.DATA_UPDATE_FAIL, e, newShopShoppingCart);
- }
- if (modifyMap.size() > 0) {
- modifyMap.put("cartId", oldShopShoppingCart.getCartId());
- shopShoppingCartDao.updateByMap(modifyMap);
- }
- i = MatrixConstance.DML_SUCCESSS;
- WebUtil.removeSessionAttribute(BEV);
- if (i > 0) {
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.UPDATE_SUCCES, "购物车");
- } else {
- throw new GlobleException(SystemErrorCode.DATA_UPDATE_FAIL);
- }
- }
-
-
-
-
- /**
- * 进入修改界面
- */
- @SaveRequestToken
- @RequestMapping(value = "/editForm")
- public ModelAndView editForm(Integer id) {
- ShopShoppingCart shopShoppingCart = new ShopShoppingCart();
- ModelAndView modelAndView = new ModelAndView("admin/shopShoppingCart-form");
- if (id != null) {
- shopShoppingCart = shopShoppingCartDao.selectById(id);
- WebUtil.setSessionAttribute(BEV, shopShoppingCart);
- }
- modelAndView.addObject("obj",shopShoppingCart);
- return modelAndView;
- }
-
-
- /**
- * 删除
- */
- @RequestMapping(value = "/del")
- public @ResponseBody AjaxResult del(String keys) {
- List<String> ids = StringUtils.strToCollToString(keys, ",");
- int i = shopShoppingCartDao.deleteByIds(ids);
- if (i > 0) {
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, SystemMessageCode.DELETE_SUCCES, i);
- } else {
- throw new GlobleException(SystemErrorCode.DATA_DELETE_FAIL);
- }
- }
-
-}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
index 7c7577a..00e55eb 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
@@ -97,7 +97,7 @@
AjaxResult calculationCartOrder(@RequestBody AddShopOrderPOJO addShopOrderPOJO) throws Exception {
BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); //计算购物车中物品的优惠信息
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId());
+ List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId(),ShopShoppingCart.CAR_TYPE_MICRO);
//取出购物车中选中的产品
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
index b89cac9..611820b 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesProductAction.java
@@ -5,7 +5,6 @@
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.shopXcx.api.dto.SaleProductDto;
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;
@@ -47,14 +46,13 @@
})
public AjaxResult getShopProductShowList(@RequestBody @Validated SaleProductDto saleProductDto) {
ShopProduct shopProduct=new ShopProduct();
-
- ShopProductAttribute fxsc = shopProductAttributeDao.selectByCode("fxsc", HostInterceptor.getCompanyId());
shopProduct.setLimit(saleProductDto.getPageSize());
shopProduct.setOffset((saleProductDto.getPageNum()-1)* saleProductDto.getPageSize());
+ shopProduct.setCategoryId(saleProductDto.getCategoryId());
shopProduct.setDelFlag(AppConstance.DATA_USEABLE);
shopProduct.setStatus(AppConstance.IS_PUTAWAY);
+ shopProduct.setAbleSales(ShopProduct.ABLE_SALES);
shopProduct.setCompanyId(HostInterceptor.getCompanyId());
- shopProduct.setAttrs(fxsc.getAttrId()+"");
List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopProducts);
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..20318d0
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxScoreProductAction.java
@@ -0,0 +1,65 @@
+package com.matrix.system.shopXcx.api.action;
+
+import com.matrix.core.pojo.AjaxResult;
+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.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;
+
+ @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.setAbleSales(ShopProduct.NOT_ABLE_SALES);
+ shopProduct.setMallType(ShopProduct.MALL_SCORE);
+ shopProduct.setCompanyId(HostInterceptor.getCompanyId());
+ List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
+ shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
+ return AjaxResult.buildSuccessInstance(shopProducts);
+ }
+
+
+
+
+
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
index 3e3e4d5..00154cd 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopProduct.java
@@ -146,7 +146,7 @@
@ResponseBody
public AjaxResult getShopProductShowList(@RequestBody ShopProduct shopProduct) {
List<ShopProduct> shopProducts = null;
-
+ shopProduct.setMallType(ShopProduct.MALL_MICRO);
//查询是否匹配优惠条件
ShopCoupon shopCoupon = shopCouponDao.getCouponByTitle(shopProduct.getTitle(),HostInterceptor.getCompanyId());
if (shopCoupon != null && shopProduct.getOffset() < 1) {
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
index 1afabd6..f2e72e4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
@@ -75,7 +75,7 @@
@PostMapping("/findShoppingCart")
@ResponseBody
public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) {
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(shoppingCart.getShopId());
+ List<ShopCartVo> cartList = shoppingCartService.findUserCartList(shoppingCart.getShopId(),ShopShoppingCart.CAR_TYPE_MICRO);
AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, cartList, cartList.size());
ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
result.putInMap("billTotal", shopCartBill.getBillTotal().stripTrailingZeros().toPlainString());
@@ -136,6 +136,7 @@
shoppingCart.setCreateBy(loginUser.getOpenId());
shoppingCart.setUpdateBy(loginUser.getOpenId());
shoppingCart.setCartUserId(loginUser.getOpenId());
+ shoppingCart.setCartType(ShopShoppingCart.CAR_TYPE_MICRO);
ShopShoppingCart shoppCartLimt = shoppingCartDao.selectBuyLimit(shoppingCart.getCartProductId(),
shoppingCart.getCartSkuId());
// Integer buyLimitNum = 0;
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java
new file mode 100644
index 0000000..7cbc20e
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/ScoreProductDto.java
@@ -0,0 +1,18 @@
+package com.matrix.system.shopXcx.api.dto;
+
+import com.matrix.core.pojo.BasePageQueryDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "ScoreProductDto", description = "积分产品查询参数接收类")
+public class ScoreProductDto extends BasePageQueryDto {
+
+ @ApiModelProperty(value = "产品分类", example = "1")
+ private Integer scoreCategoryId;
+
+
+
+
+}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
index 5180721..4cb582a 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java
@@ -79,10 +79,10 @@
* @return
* @param shopId
*/
- public List<ShopCartVo> findUserCartList(Long shopId) {
+ public List<ShopCartVo> findUserCartList(Long shopId,Integer cartType) {
BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
String userId = loginUser.getOpenId();
- List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shopId,userId);
+ List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shopId,userId,cartType);
List<ShopCartVo> cartList = buildShopCart(list);
return cartList;
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
index dce9db6..cc29acd 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
@@ -134,7 +134,7 @@
}
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId());
+ List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId(),ShopShoppingCart.CAR_TYPE_MICRO);
//购物车不能为空
if (CollectionUtils.isEmpty(cartList)) {
return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择您需要购买的产品");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
index 7259104..f8c275e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopShoppingCart.java
@@ -14,7 +14,16 @@
*/
public class ShopShoppingCart extends EntityDTOExt {
@Extend
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+ /**
+ *购物车类型-微商城
+ */
+ public static final int CAR_TYPE_MICRO =1;
+ /**
+ *购物车类型-积分商城
+ */
+ public static final int CAR_TYPE_SCORE=2;
+
/**
@@ -50,6 +59,12 @@
* 用户是否选中 1选中 2未选中
*/
private Integer isSelected;
+ /**
+ * 购物车类型 1微商城 2积分商城
+ */
+ private Integer cartType;
+
+
/**
* 门店id
@@ -324,6 +339,12 @@
public List<ShopCoupon> getShopCoupons() {
return shopCoupons;
}
-
-
+
+ public Integer getCartType() {
+ return cartType;
+ }
+
+ public void setCartType(Integer cartType) {
+ this.cartType = cartType;
+ }
}
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
index 89ac208..5d5b051 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopSku.java
@@ -256,6 +256,14 @@
this.goodsName = goodsName;
}
+ public Integer getScorePrice() {
+ return scorePrice;
+ }
+
+ public void setScorePrice(Integer scorePrice) {
+ this.scorePrice = scorePrice;
+ }
+
@Override
public boolean equals(Object obj) {
//这里以name为判定标准。
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
index bc4a432..29c7691 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
@@ -36,7 +36,7 @@
public ShopShoppingCart selectById(Integer cartId);
- public List<ShopShoppingCart> selectByCartUserId(@Param("shopId")Long shopId, @Param("cartUserId") String cartUserId);
+ public List<ShopShoppingCart> selectByCartUserId(@Param("shopId")Long shopId, @Param("cartUserId") String cartUserId,@Param("cartType") Integer cartType);
public ShopShoppingCart selectForUpdate(Integer cartId);
diff --git "a/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql" "b/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
index 1659c34..59a86bc 100644
--- "a/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
+++ "b/zq-erp/src/main/resources/config/db/increment/\346\216\250\345\271\277\345\221\230.sql"
@@ -191,5 +191,12 @@
ADD COLUMN `able_sales` int(2) NULL COMMENT '是否为分销产品' AFTER `score_category_id`,
ADD COLUMN `mall_type` int(2) NULL COMMENT '上架卖场' AFTER `able_sales`;
+update shop_product set mall_type=1;
+update shop_product set able_sales=2;
+ALTER TABLE `shop_shopping_cart`
+ ADD COLUMN `cart_type` int(2) NOT NULL COMMENT '购物车类型 1微商城 2积分商城' AFTER `company_id`;
+
+
+update shop_shopping_cart set cart_type=1;
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
index 3de8984..405abca 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
@@ -42,7 +42,9 @@
<result property="couponId" column="couponId"></result>
<result property="serviceTime" column="service_time"></result>
<result property="companyId" column="company_id"/>
-
+ <result property="mallType" column="mall_type"/>
+ <result property="ableSales" column="able_sales"/>
+ <result property="scoreCategoryId" column="score_category_id"/>
<association property="shopCoupon" select="com.matrix.system.shopXcx.dao.ShopCouponDao.selectById"
column="{id=couponId}"></association>
@@ -82,6 +84,9 @@
<result property="couponId" column="couponId"></result>
<result property="serviceTime" column="service_time"></result>
<result property="companyId" column="company_id"/>
+ <result property="mallType" column="mall_type"/>
+ <result property="ableSales" column="able_sales"/>
+ <result property="scoreCategoryId" column="score_category_id"/>
</resultMap>
<sql id="columns">
@@ -115,7 +120,11 @@
is_service,
service_time,
shop_ids,
- company_id
+ company_id,
+ mall_type,
+ able_sales,
+ score_category_id
+
</sql>
<!-- 属性sql -->
@@ -150,7 +159,11 @@
#{item.isService},
#{item.serviceTime},
#{item.shopIds},
- #{item.companyId}
+ #{item.companyId},
+ #{item.mallType},
+ #{item.ableSales},
+ #{item.scoreCategoryId}
+
</sql>
<!-- where sql -->
<sql id="where_sql">
@@ -239,6 +252,15 @@
and a.company_id = #{record.companyId}
</if>
+ <if test="record.mallType != null and record.mallType !='' ">
+ and a.mall_type = #{record.mallType}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
</if>
@@ -313,6 +335,17 @@
and b.attr_full_path like concat('%/',#{record.attrs},'/%')
</if>
+
+ <if test="record.mallType != null and record.mallType !='' ">
+ and a.mall_type = #{record.mallType}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
+
</if>
@@ -420,6 +453,16 @@
<if test="_parameter.containsKey('companyId')">
company_id = #{companyId},
</if>
+ <if test="_parameter.containsKey('scoreCategoryId')">
+ score_category_id = #{scoreCategoryId},
+ </if>
+ <if test="_parameter.containsKey('ableSales')">
+ able_sales = #{ableSales},
+ </if>
+ <if test="_parameter.containsKey('mallType')">
+ mall_type = #{mallType},
+ </if>
+
</set>
WHERE id=#{id}
@@ -502,6 +545,15 @@
shop_ids = #{record.shopIds},
</if>
+ <if test="record.mallType != null and record.mallType !='' ">
+ mall_type = #{record.mallType},
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ able_sales = #{record.ableSales},
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ score_category_id = #{record.scoreCategoryId},
+ </if>
</set>
WHERE id=#{record.id}
@@ -590,6 +642,9 @@
a.marked_price,
b.attr_full_path,
a.couponId,
+ a.mall_type,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum,
GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid
from shop_product a left join shop_product_attr_ref b on a.id = b.p_id
@@ -630,6 +685,9 @@
a.marked_price,
a.service_time,
a.couponId,
+ a.mall_type,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum
from shop_product a
where a.id in (${productIds}) and shop_ids=#{shopId}
@@ -667,6 +725,9 @@
a.marked_price,
b.attr_full_path,
a.couponId,
+ a.mall_type,
+ a.able_sales,
+ a.score_category_id,
a.service_time,
(SELECT ROUND(SUM(ss.stock),2) from shop_sku ss where ss.p_id = a.id) as stockNum,
GROUP_CONCAT(DISTINCT(s.atrid) order by a.id SEPARATOR ',') atrid
@@ -732,6 +793,9 @@
b.attr_full_path,
a.service_time,
a.couponId,
+ a.mall_type,
+ a.able_sales,
+ a.score_category_id,
(SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum,
(SELECT COUNT(p.com_id) from shop_product_comment p where p.product_id=a.id and p.del_flag=2 and p.com_audit_status=1 and p.com_score=5) as comment
from shop_product a
@@ -773,6 +837,18 @@
<if test="(record.shopIds!=null and record.shopIds!='') or (record.shopIds!='' and record.shopIds==0) ">
and find_in_set(#{record.shopIds}, a.shop_ids)
</if>
+
+ <if test="record.mallType != null and record.mallType !='' ">
+ and a.mall_type = #{record.mallType}
+ </if>
+ <if test="record.ableSales != null and record.ableSales !='' ">
+ and a.able_sales = #{record.ableSales}
+ </if>
+ <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
+ and a.score_category_id = #{record.scoreCategoryId}
+ </if>
+
+
</where>
GROUP BY a.id
<if test="record.queryType != null and record.queryType == 1">
@@ -830,6 +906,9 @@
is_special_price,
marked_price,
couponId,
+ a.mall_type,
+ a.able_sales,
+ a.score_category_id,
(SELECT SUM(s.stock) from shop_sku s where s.p_id = a.id) as stockNum,
(SELECT ROUND(SUM(s.stock),2) from shop_sku s where s.p_id = a.id) as stockNum,
shop_ids
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
index 8e59026..1b65878 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
@@ -27,6 +27,7 @@
<result property="isSelected" column="isSelected" />
<result property="shopId" column="shop_id" />
<result property="companyId" column="company_id" />
+ <result property="cartType" column="cart_type" />
</resultMap>
@@ -44,6 +45,8 @@
<result property="isSelected" column="isSelected" />
<result property="shopId" column="shop_id" />
<result property="companyId" column="company_id" />
+ <result property="cartType" column="cart_type" />
+
</resultMap>
<!-- 字段sql -->
@@ -59,7 +62,9 @@
cart_number,
isSelected,
shop_id,
- company_id
+ company_id,
+ cart_type
+
</sql>
<!-- 属性sql -->
@@ -75,7 +80,9 @@
#{item.cartNumber},
#{item.isSelected},
#{item.shopId},
- #{item.companyId}
+ #{item.companyId},
+ #{item.cartType}
+
</sql>
<!-- where sql -->
@@ -121,6 +128,10 @@
<if test="record.companyId != null and record.companyId !='' ">
and c.company_id = #{record.companyId}
+ </if>
+
+ <if test="record.cartType != null and record.cartType !='' ">
+ and c.cart_type = #{record.cartType}
</if>
</if>
@@ -334,6 +345,7 @@
and p.STATUS = 1
and p.del_flag = 2
and c.cart_user_id = #{cartUserId}
+ and c.cart_type = #{cartType}
order by c.create_time desc
</select>
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
index 1c85265..ede83bf 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopSkuDao.xml
@@ -24,6 +24,7 @@
<result property="shopId" column="shop_id"/>
<result property="sealesPrice" column="seales_price"/>
<result property="invitationPrice" column="invitation_price"/>
+ <result property="scorePrice" column="score_price"/>
@@ -50,6 +51,7 @@
<result property="shopId" column="shop_id"/>
<result property="sealesPrice" column="seales_price"/>
<result property="invitationPrice" column="invitation_price"/>
+ <result property="scorePrice" column="score_price"/>
</resultMap>
<!-- 字段sql -->
@@ -72,7 +74,9 @@
stock_code,
shop_id,
seales_price,
-invitation_price
+invitation_price,
+ score_price
+
</sql>
<!-- 属性sql -->
@@ -95,7 +99,9 @@
#{item.stockCode},
#{item.shopId},
#{item.sealesPrice},
- #{item.invitationPrice}
+ #{item.invitationPrice},
+ #{item.scorePrice}
+
</sql>
@@ -136,6 +142,13 @@
<if test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) ">
and shop_id = #{record.shopId}
</if>
+
+ <if test="(record.scorePrice!=null and record.scorePrice!='') or (record.scorePrice!='' and record.scorePrice==0) ">
+ and score_price = #{record.scorePrice}
+ </if>
+
+
+
</if>
</sql>
@@ -202,6 +215,12 @@
<if test="_parameter.containsKey('sealesPrice')">
seales_price = #{sealesPrice},
</if>
+
+ <if test="_parameter.containsKey('scorePrice')">
+ score_price = #{scorePrice},
+ </if>
+
+
</set>
WHERE id=#{id}
</update>
@@ -252,6 +271,10 @@
invitation_price = #{record.invitationPrice},
</if>
+ <if test="record.scorePrice != null ">
+ score_price = #{record.scorePrice},
+ </if>
+
</set>
WHERE id=#{record.id}
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
index dec22fc..3d20568 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
@@ -42,7 +42,7 @@
<div class="panel-heading">基本信息</div>
<div class="panel-body">
<div class="form-group">
- <label class="col-sm-2 control-label">分类ID
+ <label class="col-sm-2 control-label">产品分类
<span class="text-danger">*</span>
</label>
<div class="col-sm-4">
@@ -69,6 +69,40 @@
maxLength="1000" dataType="*"
th:value="${obj.briefIntroduction}" nullmsg="产品简介不能为空">
</div>
+ <label class="col-sm-2 control-label">是否可分销
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select th:field="${obj.ableSales}" class="form-control select2 " size="1"
+ name="ableSales"
+ id="ableSales" style="width: 100%">
+ <option value="1" th:selected="${obj.ableSales == '1'}">可分销</option>
+ <option value="2" th:selected="${obj.ableSales == '2'}">不可分销</option>
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-2 control-label">上架卖场
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select th:field="${obj.mallType}" class="form-control select2 " size="1"
+ name="mallType"
+ id="mallType" style="width: 100%">
+ <option value="1" th:selected="${obj.mallType == '1'}">微商城</option>
+ <option value="2" th:selected="${obj.mallType == '2'}">积分商城</option>
+ </option>
+ </select>
+ </div>
+ <label class="col-sm-2 control-label">积分商城分类
+ <span class="text-danger">*</span>
+ </label>
+ <div class="col-sm-4">
+ <select class="form-control select2 " size="1" name="scoreCategoryId"
+ id="scoreCategoryId" style="width: 100%">
+ </select>
+ </div>
</div>
<div class="form-group">
@@ -87,14 +121,7 @@
dataType="n" nullmsg="展示销量不能为空"
th:value="${obj.dsVolume}" errormsg="请填写数字">
</div>
- <!--<label class="col-sm-2 control-label">运费
- <span class="text-danger">*</span>
- </label>
- <div class="col-sm-4">
- <input autocomplete="off" type="text" class="form-control" name="carriage"
- maxLength="250" datatype="*"
- th:value="${obj.carriage}" nullmsg="运费不能为空">
- </div>-->
+
</div>
<div class="form-group">
<label class="col-sm-2 control-label">限购数量
@@ -226,11 +253,12 @@
<th>规格图片地址<span class="text-danger">*</span></th>
<th>库存<span class="text-danger">*</span></th>
<th>价格<span class="text-danger">*</span></th>
- <th>积分</th>
+ <th>消费可得积分</th>
<th>关联ERP产品</th>
<th>排序</th>
<th>推广提成</th>
<th>邀请提成</th>
+ <th>兑换所需积分</th>
<th>操作</th>
</tr>
</table>
@@ -395,6 +423,9 @@
});
$(function () {
initSeclect("#parentId",[[${obj.categoryId}]]);
+ initScoreSeclect("#scoreCategoryId",[[${obj.scoreCategoryId}]]);
+
+
initAttrSeclect("#attrIds");
$("#mobileDetails").html(obj.mobileDetails);
$("#pcDetails").html(obj.pcDetails);
@@ -538,6 +569,10 @@
if (invitationPrice == null || typeof invitationPrice == 'undefined') {
invitationPrice = "";
}
+ var scorePrice = shopSkus[c].scorePrice;
+ if (scorePrice == null || typeof scorePrice == 'undefined') {
+ scorePrice = "";
+ }
var html=
@@ -554,6 +589,7 @@
+'<td><input autocomplete="off" type="text" class="form-control" value="'+sort+'" name=""></td>'
+'<td><input autocomplete="off" type="text" class="form-control" value="'+sealesPrice+'" name=""></td>'
+'<td><input autocomplete="off" type="text" class="form-control" value="'+invitationPrice+'" name=""></td>'
+ +'<td><input autocomplete="off" type="text" class="form-control" value="'+scorePrice+'" name=""></td>'
+'<td><i class="fa fa-trash form-control-static" onclick="delThis(\''+trId+'\')"></i></td>'
+'</tr>';
$("#skutable").find("tbody").append(html);
@@ -668,6 +704,22 @@
});
});
}
+ //初始化分积分商城分类ID
+ function initScoreSeclect(seler, def) {
+ $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=jfsccpfl&status=1",
+ function (loj) {
+ $(seler).createSelectTree(
+ loj.attr("result").rows,
+ {
+ id: "attrId",
+ parent: "parentId",
+ value: "attrName",
+ append: false,
+ defaultValue: def,
+ defaultHtml: ''
+ });
+ });
+ }
//添加图片节点
function addImgTr() {
@@ -724,68 +776,72 @@
if (i != 0) {
var tds = $(this).find("td");
var length = tds.length - 1;
- var id = tds.eq(length - 10).find("input").val();
+ var id = tds.eq(length - 11).find("input").val();
if(id == null){
id ="";
}
sku.id = id;
//规格名称
- var name = tds.eq(length - 9).find("input").val();
+ var name = tds.eq(length - 10).find("input").val();
if(name == null){
name = "";
}
sku.name = name;
//图片地址
- var path = tds.eq(length - 8).find("img").attr("src");
+ var path = tds.eq(length - 9).find("img").attr("src");
if(path == null){
path = "";
}
sku.imgPath = path;
//库存
- var stock = tds.eq(length - 7).find("input").val();
+ var stock = tds.eq(length - 8).find("input").val();
if(stock == ""){
stock = 0;
}
sku.stock = stock;
//价格
- var price = tds.eq(length -6).find("input").val();
+ var price = tds.eq(length -7).find("input").val();
if(price == ""){
price =0;
}
sku.price = price;
//积分
- var score = tds.eq(length - 5).find("input").val();
+ var score = tds.eq(length - 6).find("input").val();
if(score == ""){
score = 0;
}
sku.score = score;
//品种编码
- var stockCode = tds.eq(length - 4).find("input").val();
+ var stockCode = tds.eq(length - 5).find("input").val();
if(stockCode == null || typeof stockCode == 'undefined'){
stockCode = '';
}
sku.stockCode = stockCode;
//排序
- var sort = tds.eq(length - 3).find("input").val();
+ var sort = tds.eq(length - 4).find("input").val();
if(sort == ""){
sort = 0;
}
sku.sort = sort;
//推广提成
- var sealesPrice = tds.eq(length - 2).find("input").val();
+ var sealesPrice = tds.eq(length - 3).find("input").val();
sku.sealesPrice = sealesPrice;
//邀请提成
- var invitationPrice = tds.eq(length - 1).find("input").val();
+ var invitationPrice = tds.eq(length - 2).find("input").val();
sku.invitationPrice = invitationPrice;
+
+ //兑换所需积分
+ var scorePrice = tds.eq(length - 1).find("input").val();
+ sku.scorePrice = scorePrice;
skus.push(sku);
}
@@ -793,6 +849,7 @@
return skus;
}
+
/*验证sku表格中的参数*/
function getSkusValues() {
@@ -803,7 +860,7 @@
if (i != 0) {
var tds = $(this).find("td");
var length = tds.length - 1;
- var name = tds.eq(length - 9).find("input").val();
+ var name = tds.eq(length - 10).find("input").val();
if(name == ""){
layer.msg("请填写规格名称",{
icon : 2,
@@ -821,7 +878,7 @@
return false;
}
- var stock = tds.eq(length -7).find("input").val();
+ var stock = tds.eq(length -8).find("input").val();
if(stock == ""){
layer.msg("请填写库存",{
icon : 2,
@@ -830,7 +887,7 @@
flag = true;
return false;
}
- var price = tds.eq(length - 6).find("input").val();
+ var price = tds.eq(length - 7 ).find("input").val();
if(price == ""){
layer.msg("请填写价格",{
icon : 2,
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
index a7e7d16..e07f5e5 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-list.html
@@ -35,10 +35,18 @@
<input autocomplete="off" id="search-text" name="title" placeholder="输入查询关键词"
type="text" class="form-control">
</div>
-
+ <div class="form-group">
+ <label class="control-label">上架卖场</label>
+ <select style="width:100px;" class="form-control select2" size="1"
+ name="mallType" >
+ <option value="">请选择</option>
+ <option value="1">微商城</option>
+ <option value="2">积分商城</option>
+ </select>
+ </div>
<div class="form-group">
<label class="control-label">是否上架</label>
- <select style="width:200px;" class="form-control select2" size="1"
+ <select style="width:100px;" class="form-control select2" size="1"
name="status"
id="status">
<option value="">请选择</option>
@@ -47,10 +55,10 @@
</select>
</div>
<div class="form-group">
- <label class="control-label">是否为服务</label>
- <select style="width:200px;" class="form-control select2" size="1"
- name="isService"
- id="isService">
+ <label class="control-label">是否可分销</label>
+ <select style="width:100px;" class="form-control select2" size="1"
+ name="ableSales"
+ id="ableSales">
<option value="">请选择</option>
<option value="1">是</option>
<option value="2">否</option>
@@ -114,12 +122,12 @@
<tr>
<th data-checkbox="true"></th>
<th data-formatter="MGrid.indexfn" data-align="center">序号</th>
- <th data-field="id" data-align="center">产品ID</th>
+ <th data-field="mallType" data-align="center" data-formatter="mallType">上架卖场</th>
<th data-field="title" data-align="center">产品名称</th>
<th data-field="imgMobile" data-align="center" data-formatter="MGrid.getImage">产品图片</th>
<th data-field="attrValues" data-align="center" data-formatter="formatAttr">产品属性</th>
<th data-field="price" data-align="center">价格</th>
- <th data-field="score" data-align="center">积分</th>
+ <th data-field="scorePrice" data-align="center">兑换所需积分</th>
<th data-field="status" data-align="center" data-formatter="isStatus">是否上架</th>
<th data-field="rsVolume" data-align="center">真实销量</th>
@@ -275,7 +283,7 @@
//初始化属性下拉选
function initAttrsSeclect(seler, def) {
console.log(1);
- $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl",
+ $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=productColumn",
function (loj) {
$(seler).createSelectTree(
loj.attr("result").rows,
@@ -290,6 +298,16 @@
});
}
+ function mallType(value, row, index) {
+ var html = "";
+ if (value ==1) {
+ html="微商城"
+ }else{
+ html="积分商城"
+ }
+ return html;
+ }
+
/**
* 格式化属性
*/
--
Gitblit v1.9.1