| | |
| | | @Autowired |
| | | private ShopProductAttributeDao shopProductAttributeDao; |
| | | |
| | | @RequestMapping("/getByCode/{shopId}/{attrCode}") |
| | | @RequestMapping("/getByCode/{attrCode}") |
| | | @ResponseBody |
| | | public AjaxResult getProductAttributeByCode(@PathVariable("shopId") Long shopId, @PathVariable("attrCode") String attrCode){ |
| | | public AjaxResult getProductAttributeByCode(@PathVariable("attrCode") String attrCode){ |
| | | |
| | | if(!StringUtils.isNotBlank(attrCode)){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL,"属性编码不能为空"); |
| | |
| | | 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.setAbleScorePay(ShopProduct.PAYFOR_SCORE); |
| | | shopProduct.setCompanyId(HostInterceptor.getCompanyId()); |
| | | List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct); |
| | | shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId()))); |
| | |
| | | @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) { |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "查询微商城购物车数量", notes = "") |
| | | @PostMapping(value = "/getUserCartCount/{shopId}/{cartType}") |
| | | @PostMapping(value = "/getUserCartCount/{shopId}") |
| | | public |
| | | @ResponseBody |
| | | AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) { |
| | | AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId(),cartType); |
| | | Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId()); |
| | | if (userCartCount == null) { |
| | | userCartCount = 0; |
| | | } |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "保存失败"); |
| | | } |
| | | int userCartCount = shoppingCartDao.selectUserCartCount(shoppingCart.getShopId(), |
| | | loginUser.getOpenId(),shoppingCart.getCartType()); |
| | | loginUser.getOpenId()); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功"); |
| | | result.putInMap("userCartCount", userCartCount); |
| | | return result; |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}/{cartType}") |
| | | @PostMapping("/updateCartAllSelected/{shopId}/{isSelected}") |
| | | @ResponseBody |
| | | public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected, |
| | | @PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) { |
| | | @PathVariable("shopId") Long shopId) { |
| | | BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected,cartType); |
| | | shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | public class ShopProduct extends EntityDTOExt { |
| | | /** |
| | | * 可用积分 |
| | | */ |
| | | public static final int PAYFOR_SCORE =1; |
| | | /** |
| | | * 不用积分 |
| | | */ |
| | | public static final int NOT_PAYFOR_SCORE =2; |
| | | |
| | | /** |
| | | * 卖场-微商城 |
| | | */ |
| | | public static final int MALL_MICRO =1; |
| | | /** |
| | | * 卖场-积分商城 |
| | | */ |
| | | public static final int MALL_SCORE=2; |
| | | /** |
| | | * 可分销 |
| | | */ |
| | |
| | | private String imgMobile; |
| | | |
| | | /** |
| | | * 上架卖场 1 微商城,2 积分商城 |
| | | * 是否可用积分支付 1是,2不是 |
| | | */ |
| | | private Integer mallType; |
| | | private Integer ableScorePay; |
| | | |
| | | |
| | | /** |
| | |
| | | * 用户是否选中 1选中 2未选中 |
| | | */ |
| | | private Integer isSelected; |
| | | /** |
| | | * 购物车类型 1微商城 2积分商城 |
| | | */ |
| | | private Integer cartType; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return shopCoupons; |
| | | } |
| | | |
| | | public Integer getCartType() { |
| | | return cartType; |
| | | } |
| | | |
| | | public void setCartType(Integer cartType) { |
| | | this.cartType = cartType; |
| | | } |
| | | } |
| | |
| | | |
| | | public ShopShoppingCart selectBuyLimit(@Param("cartProductId") Integer cartProductId,@Param("cartSkuId") Integer cartSkuId); |
| | | |
| | | public Integer selectUserCartCount(@Param("shopId")Long shopId, @Param("openId")String openId,@Param("cartType") Integer cartType); |
| | | public Integer selectUserCartCount(@Param("shopId")Long shopId, @Param("openId")String openId); |
| | | |
| | | public int updateAllSelected(@Param("openId") String openId, @Param("shopId") Long shopId, @Param("isSelected") Integer isSelected,@Param("cartType") Integer cartType); |
| | | public int updateAllSelected(@Param("openId") String openId, @Param("shopId") Long shopId, @Param("isSelected") Integer isSelected); |
| | | |
| | | /** |
| | | * 删除用户选中的购物车明细 |
| | |
| | | |
| | | ALTER TABLE `shop_product` |
| | | ADD COLUMN `score_category_id` bigint(20) NULL COMMENT '积分商城分类ID' AFTER `company_id`, |
| | | ADD COLUMN `able_sales` int(2) NULL COMMENT '是否为分销产品' AFTER `score_category_id`, |
| | | ADD COLUMN `mall_type` int(2) NULL COMMENT '上架卖场' AFTER `able_sales`; |
| | | ADD COLUMN `able_sales` int(2) NULL COMMENT '是否为分销产品1是2不是' AFTER `score_category_id`, |
| | | ADD COLUMN `able_score_pay` int(2) NULL COMMENT '是否可用积分支付1是2不是' AFTER `able_sales`; |
| | | |
| | | update shop_product set mall_type=1; |
| | | update shop_product set able_score_pay=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; |
| | | |
| | |
| | | <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="ableScorePay" column="able_score_pay"/> |
| | | <result property="ableSales" column="able_sales"/> |
| | | <result property="scoreCategoryId" column="score_category_id"/> |
| | | |
| | |
| | | <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="ableScorePay" column="able_score_pay"/> |
| | | <result property="ableSales" column="able_sales"/> |
| | | <result property="scoreCategoryId" column="score_category_id"/> |
| | | </resultMap> |
| | |
| | | service_time, |
| | | shop_ids, |
| | | company_id, |
| | | mall_type, |
| | | able_score_pay, |
| | | able_sales, |
| | | score_category_id |
| | | |
| | |
| | | #{item.serviceTime}, |
| | | #{item.shopIds}, |
| | | #{item.companyId}, |
| | | #{item.mallType}, |
| | | #{item.ableScorePay}, |
| | | #{item.ableSales}, |
| | | #{item.scoreCategoryId} |
| | | |
| | |
| | | and a.company_id = #{record.companyId} |
| | | </if> |
| | | |
| | | <if test="record.mallType != null and record.mallType !='' "> |
| | | and a.mall_type = #{record.mallType} |
| | | <if test="record.ableScorePay != null and record.ableScorePay !='' "> |
| | | and a.able_score_pay = #{record.ableScorePay} |
| | | </if> |
| | | <if test="record.ableSales != null and record.ableSales !='' "> |
| | | and a.able_sales = #{record.ableSales} |
| | |
| | | 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 test="record.ableScorePay != null and record.ableScorePay !='' "> |
| | | and a.able_score_pay = #{record.ableScorePay} |
| | | </if> |
| | | <if test="record.ableSales != null and record.ableSales !='' "> |
| | | and a.able_sales = #{record.ableSales} |
| | |
| | | <if test="_parameter.containsKey('ableSales')"> |
| | | able_sales = #{ableSales}, |
| | | </if> |
| | | <if test="_parameter.containsKey('mallType')"> |
| | | mall_type = #{mallType}, |
| | | <if test="_parameter.containsKey('ableScorePay')"> |
| | | able_score_pay = #{ableScorePay}, |
| | | </if> |
| | | |
| | | |
| | |
| | | shop_ids = #{record.shopIds}, |
| | | </if> |
| | | |
| | | <if test="record.mallType != null and record.mallType !='' "> |
| | | mall_type = #{record.mallType}, |
| | | <if test="record.ableScorePay != null and record.ableScorePay !='' "> |
| | | able_score_pay = #{record.ableScorePay}, |
| | | </if> |
| | | <if test="record.ableSales != null and record.ableSales !='' "> |
| | | able_sales = #{record.ableSales}, |
| | |
| | | a.marked_price, |
| | | b.attr_full_path, |
| | | a.couponId, |
| | | a.mall_type, |
| | | a.able_score_pay, |
| | | 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, |
| | |
| | | a.marked_price, |
| | | a.service_time, |
| | | a.couponId, |
| | | a.mall_type, |
| | | a.able_score_pay, |
| | | 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 |
| | |
| | | a.marked_price, |
| | | b.attr_full_path, |
| | | a.couponId, |
| | | a.mall_type, |
| | | a.able_score_pay, |
| | | a.able_sales, |
| | | a.score_category_id, |
| | | a.service_time, |
| | |
| | | b.attr_full_path, |
| | | a.service_time, |
| | | a.couponId, |
| | | a.mall_type, |
| | | a.able_score_pay, |
| | | 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, |
| | |
| | | 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 test="record.ableScorePay != null and record.ableScorePay !='' "> |
| | | and a.able_score_pay = #{record.ableScorePay} |
| | | </if> |
| | | <if test="record.ableSales != null and record.ableSales !='' "> |
| | | and a.able_sales = #{record.ableSales} |
| | |
| | | is_special_price, |
| | | marked_price, |
| | | couponId, |
| | | a.mall_type, |
| | | a.able_score_pay, |
| | | a.able_sales, |
| | | a.score_category_id, |
| | | (SELECT SUM(s.stock) from shop_sku s where s.p_id = a.id) as stockNum, |
| | |
| | | <result property="isSelected" column="isSelected" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | <result property="companyId" column="company_id" /> |
| | | <result property="cartType" column="cart_type" /> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | <result property="isSelected" column="isSelected" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | <result property="companyId" column="company_id" /> |
| | | <result property="cartType" column="cart_type" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | cart_number, |
| | | isSelected, |
| | | shop_id, |
| | | company_id, |
| | | cart_type |
| | | company_id |
| | | |
| | | </sql> |
| | | |
| | |
| | | #{item.cartNumber}, |
| | | #{item.isSelected}, |
| | | #{item.shopId}, |
| | | #{item.companyId}, |
| | | #{item.cartType} |
| | | #{item.companyId} |
| | | |
| | | </sql> |
| | | |
| | |
| | | and c.company_id = #{record.companyId} |
| | | </if> |
| | | |
| | | <if test="record.cartType != null and record.cartType !='' "> |
| | | and c.cart_type = #{record.cartType} |
| | | </if> |
| | | |
| | | </if> |
| | | |
| | |
| | | |
| | | <update id="updateAllSelected" > |
| | | |
| | | update shop_shopping_cart set isSelected = #{isSelected} where shop_id=#{shopId} and cart_user_id=#{openId} and cart_type=#{cartType} |
| | | update shop_shopping_cart set isSelected = #{isSelected} where shop_id=#{shopId} and cart_user_id=#{openId} |
| | | |
| | | </update> |
| | | |
| | |
| | | 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> |
| | | |
| | |
| | | <select id="selectUserCartCount" resultType="java.lang.Integer" > |
| | | select sum(cart_number) from shop_shopping_cart c |
| | | LEFT JOIN shop_product p on p.id = c.cart_product_id |
| | | where c.shop_Id=#{shopId} and p.del_flag = 2 and cart_user_id=#{openId} and cart_type=#{cartType}; |
| | | where c.shop_Id=#{shopId} and p.del_flag = 2 and cart_user_id=#{openId} |
| | | </select> |
| | | |
| | | <!-- 根据id 锁表查询--> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">上架卖场 |
| | | <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> |
| | | <select th:field="${obj.ableScorePay}" class="form-control select2 " size="1" |
| | | name="ableScorePay" |
| | | id="ableScorePay" style="width: 100%"> |
| | | <option value="2" th:selected="${obj.ableScorePay == '2'}">不可抵扣</option> |
| | | <option value="1" th:selected="${obj.ableScorePay == '1'}">可抵扣</option> |
| | | </option> |
| | | </select> |
| | | </div> |
| | |
| | | type="text" class="form-control"> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="control-label">上架卖场</label> |
| | | <label class="control-label">积分抵扣</label> |
| | | <select style="width:100px;" class="form-control select2" size="1" |
| | | name="mallType" > |
| | | name="ableScorePay" > |
| | | <option value="">请选择</option> |
| | | <option value="1">微商城</option> |
| | | <option value="2">积分商城</option> |
| | | <option value="1">可抵扣</option> |
| | | <option value="2">不可抵扣</option> |
| | | </select> |
| | | </div> |
| | | <div class="form-group"> |
| | |
| | | <tr> |
| | | <th data-checkbox="true"></th> |
| | | <th data-formatter="MGrid.indexfn" data-align="center">序号</th> |
| | | <th data-field="mallType" data-align="center" data-formatter="mallType">上架卖场</th> |
| | | <th data-field="ableScorePay" data-align="center" data-formatter="ableScorePay">积分抵扣</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> |
| | |
| | | }); |
| | | } |
| | | |
| | | function mallType(value, row, index) { |
| | | function ableScorePay(value, row, index) { |
| | | var html = ""; |
| | | if (value ==1) { |
| | | html="微商城" |
| | | html="可抵扣" |
| | | }else{ |
| | | html="积分商城" |
| | | html="不可抵扣" |
| | | } |
| | | return html; |
| | | } |