ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/Shop.java
@@ -309,6 +309,12 @@ @TableField("subscribe") private Integer subscribe; /** * 修改价格权限(0=关,1=开) */ @TableField("modify_price_permission") private Integer modifyPricePermission; @Override protected Serializable pkVal() { ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java
@@ -1,5 +1,6 @@ package com.ruoyi.goods.controller.business; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.security.utils.SecurityUtils; @@ -8,8 +9,12 @@ import com.ruoyi.goods.domain.dto.MgtSelectGoodsPageDto; import com.ruoyi.goods.domain.vo.MerGoodsPageVo; import com.ruoyi.goods.service.goods.GoodsService; import com.ruoyi.goods.service.goods.ShopGoodsService; import com.ruoyi.system.api.domain.dto.MerBaseDto; import com.ruoyi.system.api.domain.poji.goods.ShopGoods; import com.ruoyi.system.api.domain.poji.shop.Shop; import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo; import com.ruoyi.system.api.service.RemoteShopService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.RequestBody; @@ -31,19 +36,41 @@ @RestController @RequestMapping("/mer/goods") public class MerGoodsController { @Resource private GoodsService goodsService; @Resource private RemoteShopService remoteShopService; @Resource private ShopGoodsService shopGoodsService; @RequestMapping(value = "/pageMerShopGoods", method = RequestMethod.POST) @ApiOperation(value = "分页获取商户商品列表") @ApiOperation(value = "分页获取商户商品列表【2.0】") public R<Page<MerGoodsPageVo>> pageMerShopGoods(@RequestBody MerGoodsPageDto merGoodsPageDto) { Long userId = SecurityUtils.getUserId(); Page<MerGoodsPageVo> page = new Page<>(); page.setSize(merGoodsPageDto.getPageSize()); page.setCurrent(merGoodsPageDto.getPageNum()); page.setOptimizeCountSql(false); List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMerShopGoods(page,merGoodsPageDto); List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMerShopGoods(page, merGoodsPageDto); Shop shop = remoteShopService.getShop(merGoodsPageDto.getShopId()).getData(); Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); merGoodsPageVoList.forEach(merGoodsPageVo -> { ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(belongShop.getShopId(), merGoodsPageVo.getGoodsId()); //后台开启经销商统一售价,且经销商设置了统一售价,加盟商不能修改价格 if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { merGoodsPageVo.setModifyPricePermission(0); merGoodsPageVo.setIsUnifiedPrice(1); merGoodsPageVo.setUnifiedPrice(shopGoods.getSalesPrice()); merGoodsPageVo.setUnifiedServerNum(shopGoods.getServiceNum()); } else { merGoodsPageVo.setModifyPricePermission(1); merGoodsPageVo.setIsUnifiedPrice(0); } }); return R.ok(page.setRecords(merGoodsPageVoList)); } @@ -53,16 +80,26 @@ List<MerGoodsPageVo> merGoodsPageVoList = goodsService.listMerCycleGoods(merBaseDto.getShopId()); return R.ok(merGoodsPageVoList); } @RequestMapping(value = "/editMerShopGoods", method = RequestMethod.POST) @ApiOperation(value = "编辑商户商品价格") @ApiOperation(value = "编辑商户商品价格【2.0】") public R editMerShopGoods(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) { Long userId = SecurityUtils.getUserId(); merShopGoodsEditDto.setUserId(userId); goodsService.editMerShopGoods(merShopGoodsEditDto); return R.ok(); } @RequestMapping(value = "/cancelUniformPrice", method = RequestMethod.POST) @ApiOperation(value = "取消统一售价【2.0】") public R cancelUniformPrice(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) { shopGoodsService.remove(new LambdaUpdateWrapper<ShopGoods>().eq(ShopGoods::getShopId, merShopGoodsEditDto.getShopId()) .eq(ShopGoods::getGoodsId, merShopGoodsEditDto.getGoodsId())); return R.ok(); } @RequestMapping(value = "/pageMerSelectGoods", method = RequestMethod.POST) @ApiOperation(value = "分页获取商品选择列表") public R<Page<MgtSelectGoodsPageVo>> pageMerSelectGoods(@RequestBody MgtSelectGoodsPageDto mgtSelectGoodsPageDto) { @@ -70,7 +107,7 @@ page.setSize(mgtSelectGoodsPageDto.getPageSize()); page.setCurrent(mgtSelectGoodsPageDto.getPageNum()); page.setOptimizeCountSql(false); List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page,mgtSelectGoodsPageDto); List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page, mgtSelectGoodsPageDto); return R.ok(page.setRecords(mgtSelectGoodsPageVos)); } } ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/MerGoodsPageVo.java
@@ -31,27 +31,39 @@ @ApiModelProperty(value = "商品图片") private String goodsPicture; @ApiModelProperty(value = "商品类型1周期2服务3体验4单品") private Integer goodsType; @ApiModelProperty(value = "商品调理问题") private String goodsNurses; @ApiModelProperty(value = "商品建议售价") @JsonSerialize(using = ToStringSerializer.class) private BigDecimal suggestSalesPrice;; private BigDecimal suggestSalesPrice; @ApiModelProperty(value = "商品售价") @JsonSerialize(using = ToStringSerializer.class) private BigDecimal salesPrice;; @ApiModelProperty(value="周期次数标记0否1是") private BigDecimal salesPrice; @ApiModelProperty(value = "周期次数标记0否1是") private Integer cycleNumFlag; @ApiModelProperty(value = "商品默认服务次数") private Integer defaultServiceNum;; private Integer defaultServiceNum; @ApiModelProperty(value = "服务次数") private Integer serviceNum;; private Integer serviceNum; @ApiModelProperty(value = "加盟商修改价格权限(0=关,1=开)") private Integer modifyPricePermission; @ApiModelProperty("是否设置统一售价(0=否,1=是)") private Integer isUnifiedPrice; @ApiModelProperty("统一售价") private BigDecimal unifiedPrice; @ApiModelProperty("统一服务次数") private Integer unifiedServerNum; } ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
@@ -9,7 +9,6 @@ import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.common.security.utils.CodeFactoryUtil; import com.ruoyi.goods.domain.dto.*; import com.ruoyi.system.api.domain.poji.activity.Activity; import com.ruoyi.goods.domain.pojo.goods.GoodsTotal; import com.ruoyi.goods.domain.vo.*; import com.ruoyi.goods.mapper.goods.GoodsMapper; @@ -25,14 +24,17 @@ import com.ruoyi.system.api.domain.dto.MerGoodsPriceListDto; import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; import com.ruoyi.system.api.domain.dto.MgtClassNumDto; import com.ruoyi.system.api.domain.poji.activity.Activity; import com.ruoyi.system.api.domain.poji.activity.ActivityGoods; import com.ruoyi.system.api.domain.poji.config.SysClassification; import com.ruoyi.system.api.domain.poji.goods.Goods; import com.ruoyi.system.api.domain.poji.goods.GoodsFile; import com.ruoyi.system.api.domain.poji.goods.ShopGoods; import com.ruoyi.system.api.domain.poji.shop.Shop; import com.ruoyi.system.api.domain.vo.MerGoodsPriceListVo; import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo; import com.ruoyi.system.api.service.RemoteConfigService; import com.ruoyi.system.api.service.RemoteShopService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -66,26 +68,30 @@ @Resource private RemoteConfigService remoteConfigService; @Resource private GoodsTotalService goodsTotalService; @Resource private ActivityService activityService; @Resource private ActivityRecordService activityRecordService; @Resource private RemoteShopService remoteShopService; /** * @description 获取推荐商品列表 * @param page shopId * @return List<AppSimpleGoodsVo> * @author jqs34 * @date 2023/6/4 16:27 */ * @param page shopId * @return List<AppSimpleGoodsVo> * @description 获取推荐商品列表 * @author jqs34 * @date 2023/6/4 16:27 */ @Override public List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId){ List<AppSimpleGoodsVo> appSimpleGoodsVoList = goodsMapper.pageRecommendGoods(page,shopId); public List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId) { List<AppSimpleGoodsVo> appSimpleGoodsVoList = goodsMapper.pageRecommendGoods(page, shopId); return appSimpleGoodsVoList; } @@ -178,10 +184,21 @@ BeanUtils.copyProperties(goods, appGoodsInfoVo); //商户定制价格 ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(appGoodsInfoGetDto.getShopId(),goods.getGoodsId()); if(shopGoods!=null){ if (shopGoods != null) { appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice()); appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum()); } else { //经销商定制价格 Shop shop = remoteShopService.getShop(appGoodsInfoGetDto.getShopId()).getData(); Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); shopGoods = shopGoodsService.getByShopIdAndGoodsId(belongShop.getShopId(), goods.getGoodsId()); if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice()); appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum()); } } GoodsTotal goodsTotal = goodsTotalService.getById(goods.getGoodsId()); appGoodsInfoVo.setSalesNum(goodsTotal.getBuyNumCount()); //活动商品判断 @@ -265,25 +282,35 @@ return merGoodsPageVoList; } /** * 修改商户商品 * * @param merShopGoodsEditDto */ @Override public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto){ public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto) { Shop shop = remoteShopService.getShop(merShopGoodsEditDto.getShopId()).getData(); if (2 == shop.getShopType()) { Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(shop.getBelongShopId(), merShopGoodsEditDto.getGoodsId()); if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { throw new ServiceException("经销商开启了统一价格管理"); } } Goods goods = this.getById(merShopGoodsEditDto.getGoodsId()); if(merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice())<0){ throw new ServiceException(AppErrorConstant.SALESPRICE_MIN+goods.getMininumPrice().toString()+"元"); if (merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice()) < 0) { throw new ServiceException(AppErrorConstant.SALESPRICE_MIN + goods.getMininumPrice().toString() + "元"); } //商户定制价格 ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(merShopGoodsEditDto.getShopId(),goods.getGoodsId()); if(shopGoods!=null){ ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(merShopGoodsEditDto.getShopId(), goods.getGoodsId()); if (shopGoods != null) { shopGoods.setSalesPrice(merShopGoodsEditDto.getSalePrice()); shopGoods.setServiceNum(merShopGoodsEditDto.getServiceNum()); shopGoods.setUpdateTime(new Date()); shopGoods.setUpdateUserId(merShopGoodsEditDto.getUserId()); }else{ } else { shopGoods = new ShopGoods(); shopGoods.setDelFlag(0); shopGoods.setShopId(merShopGoodsEditDto.getShopId()); ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/business/MerCouponController.java
@@ -72,16 +72,16 @@ } @RequestMapping(value = "/getMerCouponVo", method = RequestMethod.POST) @ApiOperation(value = "商户获取优惠券编辑信息") @ApiOperation(value = "商户获取优惠券编辑信息【2.0】") public R<MerCouponGetVo> getMerCouponVo(@RequestBody MerBaseGetDto merBaseGetDto) { Long userId = SecurityUtils.getUserId(); merBaseGetDto.setUserId(userId); MerCouponGetVo couponGetVo = couponService.getMerCouponVo(merBaseGetDto); return R.ok(couponGetVo); } @RequestMapping(value = "/editMerCoupon", method = RequestMethod.POST) @ApiOperation(value = "商户编辑优惠券") @ApiOperation(value = "商户编辑优惠券【2.0】") public R editMerCoupon(@RequestBody MerCouponEditDto merCouponEditDto) { Long userId = SecurityUtils.getUserId(); merCouponEditDto.setUserId(userId); ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MerCouponEditDto.java
@@ -27,7 +27,7 @@ @ApiModelProperty(value="优惠券名称") private String couponName; @ApiModelProperty(value = "发送类型1.手动领取2.指定发放") @ApiModelProperty(value = "发送类型1.手动领取2.指定发放3.抽奖领取") private Integer sendType; @ApiModelProperty(value = "发送对象2.全部用户3.会员用户4非会员用户5自定义") ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponGetVo.java
@@ -29,7 +29,7 @@ @ApiModelProperty(value="优惠券名称") private String couponName; @ApiModelProperty(value = "发送类型1.手动领取2.指定发放") @ApiModelProperty(value = "发送类型1.手动领取2.指定发放3.抽奖领取") private Integer sendType; @ApiModelProperty(value = "发送对象2.全部用户3.会员用户4非会员用户5自定义") ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponPageVo.java
@@ -22,7 +22,7 @@ @ApiModelProperty(value="优惠券名称") private String couponName; @ApiModelProperty(value="优惠券类型1.满减2.折扣3.代金4.商品") @ApiModelProperty(value = "优惠券类型1.满减2.折扣3.代金4.商品") private Integer couponType; @ApiModelProperty(value = "使用限制") ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java
@@ -1124,9 +1124,9 @@ CouponTotal couponTotal; if(StringUtils.isNotBlank(merCouponEditDto.getCouponId())){ coupon = this.getById(merCouponEditDto.getCouponId()); if(coupon.getAuditStatus()!=3){ throw new ServiceException(AppErrorConstant.COUPON_AUDIT_EDIT); } // if(coupon.getAuditStatus()!=3){ // throw new ServiceException(AppErrorConstant.COUPON_AUDIT_EDIT); // } couponRelUserService.deleteCouponRelByCouponId(coupon.getCouponId()); couponRelGoodsService.deleteCouponRelByCouponId(coupon.getCouponId()); coupon.setCouponStatus(1); ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -181,6 +181,7 @@ if(shop!=null&&shop.getShopStatus()!=1){ throw new ServiceException(AppErrorConstant.SHOP_CLOSED); } Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); // 初始化订单对象 AppSureOrderVo appSureOrderVo = new AppSureOrderVo(); // 初始化订单商品列表 @@ -266,6 +267,14 @@ ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); if (shopGoods != null) { goodsPrice = shopGoods.getSalesPrice(); } else { //经销商定制价格 appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); appShopGoodsGetDto.setShopId(belongShop.getShopId()); shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { goodsPrice = shopGoods.getSalesPrice(); } } appSureOrderGoodsVo.setGoodsPrice(goodsPrice); buyNumBig = BigDecimal.valueOf(buyNum); @@ -449,6 +458,16 @@ ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); if (shopGoods != null) { goodsPrice = shopGoods.getSalesPrice(); } else { //经销商定制价格 Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); appShopGoodsGetDto = new AppShopGoodsGetDto(); appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); appShopGoodsGetDto.setShopId(belongShop.getShopId()); shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { goodsPrice = shopGoods.getSalesPrice(); } } appPanicBuyVo.setGoodsPrice(goodsPrice); buyNumBig = BigDecimal.valueOf(buyNum); @@ -588,6 +607,18 @@ if (shopGoods != null) { goodsPrice = shopGoods.getSalesPrice(); serviceNum = shopGoods.getServiceNum(); } else { //经销商定制价格 Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData(); Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData(); appShopGoodsGetDto = new AppShopGoodsGetDto(); appShopGoodsGetDto.setGoodsId(goods.getGoodsId()); appShopGoodsGetDto.setShopId(belongShop.getShopId()); shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); if (1 == belongShop.getModifyPricePermission() && null != shopGoods) { goodsPrice = shopGoods.getSalesPrice(); serviceNum = shopGoods.getServiceNum(); } } appSureOrderGoodsVo.setGoodsPrice(goodsPrice); // 计算商品总价