Merge branch 'master' into qiuqiu
This commit is contained in:
commit
0e7a4ee06c
@ -177,7 +177,7 @@ public enum CachePrefix {
|
|||||||
/**
|
/**
|
||||||
* 店铺管理员角色权限对照表
|
* 店铺管理员角色权限对照表
|
||||||
*/
|
*/
|
||||||
SHOP_URL_ROLE,
|
STORE_URL_ROLE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机验证标识
|
* 手机验证标识
|
||||||
@ -449,7 +449,12 @@ public enum CachePrefix {
|
|||||||
/**
|
/**
|
||||||
* 文章
|
* 文章
|
||||||
*/
|
*/
|
||||||
ARTICLE_CACHE
|
ARTICLE_CACHE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺分类
|
||||||
|
*/
|
||||||
|
STORE_CATEGORY
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,6 +338,7 @@ public enum ResultCode {
|
|||||||
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
|
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
|
||||||
STORE_NOT_OPEN(50004, "该会员未开通店铺"),
|
STORE_NOT_OPEN(50004, "该会员未开通店铺"),
|
||||||
STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
|
STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
|
||||||
|
STORE_CLOSE_ERROR(50006, "店铺关闭,请联系管理员"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算单
|
* 结算单
|
||||||
|
@ -2,6 +2,7 @@ package cn.lili.modules.distribution.serviceimpl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.utils.CurrencyUtil;
|
import cn.lili.common.utils.CurrencyUtil;
|
||||||
import cn.lili.common.utils.PageUtil;
|
import cn.lili.common.utils.PageUtil;
|
||||||
import cn.lili.modules.distribution.entity.dos.Distribution;
|
import cn.lili.modules.distribution.entity.dos.Distribution;
|
||||||
@ -13,8 +14,12 @@ import cn.lili.modules.distribution.service.DistributionOrderService;
|
|||||||
import cn.lili.modules.distribution.service.DistributionService;
|
import cn.lili.modules.distribution.service.DistributionService;
|
||||||
import cn.lili.modules.order.order.entity.dos.Order;
|
import cn.lili.modules.order.order.entity.dos.Order;
|
||||||
import cn.lili.modules.order.order.entity.dos.StoreFlow;
|
import cn.lili.modules.order.order.entity.dos.StoreFlow;
|
||||||
|
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
||||||
import cn.lili.modules.order.order.service.OrderService;
|
import cn.lili.modules.order.order.service.OrderService;
|
||||||
import cn.lili.modules.order.order.service.StoreFlowService;
|
import cn.lili.modules.order.order.service.StoreFlowService;
|
||||||
|
import cn.lili.modules.system.entity.dos.Setting;
|
||||||
|
import cn.lili.modules.system.entity.dto.DistributionSetting;
|
||||||
|
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@ -56,6 +61,13 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.查看订单是否为分销订单
|
||||||
|
* 2.查看店铺流水计算分销总佣金
|
||||||
|
* 3.修改分销员的分销总金额、可提现金额
|
||||||
|
*
|
||||||
|
* @param orderSn 订单编号
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void payOrder(String orderSn) {
|
public void payOrder(String orderSn) {
|
||||||
|
|
||||||
@ -68,11 +80,11 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
|||||||
List<StoreFlow> storeFlowList = storeFlowService.list(new LambdaQueryWrapper<StoreFlow>()
|
List<StoreFlow> storeFlowList = storeFlowService.list(new LambdaQueryWrapper<StoreFlow>()
|
||||||
.eq(StoreFlow::getOrderSn, orderSn)
|
.eq(StoreFlow::getOrderSn, orderSn)
|
||||||
.isNotNull(StoreFlow::getDistributionRebate));
|
.isNotNull(StoreFlow::getDistributionRebate));
|
||||||
Double rebate=0.0;
|
Double rebate = 0.0;
|
||||||
//循环店铺流水记录判断是否包含分销商品
|
//循环店铺流水记录判断是否包含分销商品
|
||||||
//包含分销商品则进行记录分销订单、计算分销总额
|
//包含分销商品则进行记录分销订单、计算分销总额
|
||||||
for (StoreFlow storeFlow : storeFlowList) {
|
for (StoreFlow storeFlow : storeFlowList) {
|
||||||
rebate=CurrencyUtil.add(rebate,storeFlow.getDistributionRebate());
|
rebate = CurrencyUtil.add(rebate, storeFlow.getDistributionRebate());
|
||||||
DistributionOrder distributionOrder = new DistributionOrder(storeFlow);
|
DistributionOrder distributionOrder = new DistributionOrder(storeFlow);
|
||||||
distributionOrder.setDistributionId(order.getDistributionId());
|
distributionOrder.setDistributionId(order.getDistributionId());
|
||||||
//分销员信息
|
//分销员信息
|
||||||
@ -80,26 +92,59 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
|||||||
distributionOrder.setDistributionName(distribution.getMemberName());
|
distributionOrder.setDistributionName(distribution.getMemberName());
|
||||||
|
|
||||||
//设置结算天数(解冻日期)
|
//设置结算天数(解冻日期)
|
||||||
// Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
||||||
// DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
||||||
DateTime dateTime = new DateTime();
|
DateTime dateTime = new DateTime();
|
||||||
//默认解冻1天
|
//默认解冻1天
|
||||||
// dateTime.offsetNew(DateField.DAY_OF_MONTH,distributionSetting.getCashDay());
|
dateTime.offsetNew(DateField.DAY_OF_MONTH, distributionSetting.getCashDay());
|
||||||
dateTime.offsetNew(DateField.DAY_OF_MONTH,1);
|
|
||||||
distributionOrder.setSettleCycle(dateTime);
|
distributionOrder.setSettleCycle(dateTime);
|
||||||
this.save(distributionOrder);
|
this.save(distributionOrder);
|
||||||
}
|
}
|
||||||
//如果包含分销商品则记录会员的分销总额
|
//如果包含分销商品则记录会员的分销总额
|
||||||
if(rebate!=0.0){
|
if (rebate != 0.0) {
|
||||||
distributionService.addRebate(rebate,order.getDistributionId());
|
distributionService.addRebate(rebate, order.getDistributionId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.获取订单判断是否为已付款的分销订单
|
||||||
|
* 2.查看店铺流水记录分销佣金
|
||||||
|
* 3.修改分销员的分销总金额、可提现金额
|
||||||
|
*
|
||||||
|
* @param orderSn 订单编号
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cancelOrder(String orderSn) {
|
public void cancelOrder(String orderSn) {
|
||||||
|
//根据订单编号获取订单数据
|
||||||
|
Order order = orderService.getBySn(orderSn);
|
||||||
|
|
||||||
|
//判断是否为已付款的分销订单,则获取分销佣金
|
||||||
|
if (order.getDistributionId() != null && order.getPayStatus().equals(PayStatusEnum.PAID.name())) {
|
||||||
|
|
||||||
|
//根据订单编号获取有分销金额的店铺流水记录
|
||||||
|
List<DistributionOrder> distributionOrderList = this.list(new LambdaQueryWrapper<DistributionOrder>()
|
||||||
|
.eq(DistributionOrder::getOrderSn, orderSn));
|
||||||
|
|
||||||
|
//分销金额
|
||||||
|
Double rebate = 0.0;
|
||||||
|
|
||||||
|
//包含分销商品则进行记录分销订单、计算分销总额
|
||||||
|
for (DistributionOrder distributionOrder : distributionOrderList) {
|
||||||
|
rebate = CurrencyUtil.add(rebate, distributionOrder.getRebate());
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果包含分销商品则记录会员的分销总额
|
||||||
|
if (rebate != 0.0) {
|
||||||
|
distributionService.addRebate(CurrencyUtil.sub(0, rebate), order.getDistributionId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改分销订单的状态
|
||||||
this.update(new LambdaUpdateWrapper<DistributionOrder>().eq(DistributionOrder::getOrderSn, orderSn)
|
this.update(new LambdaUpdateWrapper<DistributionOrder>().eq(DistributionOrder::getOrderSn, orderSn)
|
||||||
.set(DistributionOrder::getDistributionOrderStatus, DistributionOrderStatusEnum.CANCEL.name()));
|
.set(DistributionOrder::getDistributionOrderStatus, DistributionOrderStatusEnum.CANCEL.name()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -117,18 +162,15 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
|||||||
//已提交无法重复提交
|
//已提交无法重复提交
|
||||||
//如果未结算则将分销订单取消
|
//如果未结算则将分销订单取消
|
||||||
//如果已结算则创建退款分销订单
|
//如果已结算则创建退款分销订单
|
||||||
if(distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.CANCEL.name())){
|
if (distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.CANCEL.name())) {
|
||||||
return ;
|
return;
|
||||||
} else if(distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.WAIT_BILL.name())){
|
} else if (distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.WAIT_BILL.name())) {
|
||||||
this.update(new LambdaUpdateWrapper<DistributionOrder>().eq(DistributionOrder::getOrderItemSn, storeFlow.getOrderItemSn())
|
this.update(new LambdaUpdateWrapper<DistributionOrder>()
|
||||||
|
.eq(DistributionOrder::getOrderItemSn, storeFlow.getOrderItemSn())
|
||||||
.set(DistributionOrder::getDistributionOrderStatus, DistributionOrderStatusEnum.CANCEL.name()));
|
.set(DistributionOrder::getDistributionOrderStatus, DistributionOrderStatusEnum.CANCEL.name()));
|
||||||
}else{
|
} else {
|
||||||
//创建分销退款订单
|
|
||||||
DistributionOrder backDistributionOrder = new DistributionOrder();
|
|
||||||
|
|
||||||
this.save(backDistributionOrder);
|
|
||||||
//修改分销员提成金额
|
//修改分销员提成金额
|
||||||
distributionService.subCanRebate(CurrencyUtil.sub(0,storeFlow.getDistributionRebate()),distributionOrder.getDistributionId());
|
distributionService.subCanRebate(CurrencyUtil.sub(0, storeFlow.getDistributionRebate()), distributionOrder.getDistributionId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
|||||||
map.put("promotionMap", goodsIndex.getPromotionMap());
|
map.put("promotionMap", goodsIndex.getPromotionMap());
|
||||||
|
|
||||||
//获取参数信息
|
//获取参数信息
|
||||||
if(goodsVO.getGoodsParamsDTOList().size()>0){
|
if (goodsVO.getGoodsParamsDTOList() != null && goodsVO.getGoodsParamsDTOList().size() > 0) {
|
||||||
map.put("goodsParamsDTOList",goodsVO.getGoodsParamsDTOList());
|
map.put("goodsParamsDTOList", goodsVO.getGoodsParamsDTOList());
|
||||||
}
|
}
|
||||||
|
|
||||||
//记录用户足迹
|
//记录用户足迹
|
||||||
@ -628,7 +628,9 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
|||||||
if (spec.getValue() != null && StringUtils.isNotEmpty(spec.getValue().toString())) {
|
if (spec.getValue() != null && StringUtils.isNotEmpty(spec.getValue().toString())) {
|
||||||
thumbnail = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getThumbnail();
|
thumbnail = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getThumbnail();
|
||||||
small = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getSmall();
|
small = goodsGalleryService.getGoodsGallery(images.get(0).get("url")).getSmall();
|
||||||
} else {
|
}
|
||||||
|
} else {
|
||||||
|
if (spec.getValue() != null) {
|
||||||
//设置商品名称
|
//设置商品名称
|
||||||
goodsName.append(" ").append(spec.getValue());
|
goodsName.append(" ").append(spec.getValue());
|
||||||
//规格简短信息
|
//规格简短信息
|
||||||
|
@ -145,7 +145,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||||||
if (member.getHaveStore()) {
|
if (member.getHaveStore()) {
|
||||||
Store store = storeService.getById(member.getStoreId());
|
Store store = storeService.getById(member.getStoreId());
|
||||||
if (!store.getStoreDisable().equals(StoreStatusEnum.OPEN.name())) {
|
if (!store.getStoreDisable().equals(StoreStatusEnum.OPEN.name())) {
|
||||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
throw new ServiceException(ResultCode.STORE_CLOSE_ERROR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||||
|
@ -41,7 +41,7 @@ public interface OrderMapper extends BaseMapper<Order> {
|
|||||||
|
|
||||||
@Select("SELECT o.sn,o.create_time,o.member_name,o.consignee_name,o.consignee_mobile,o.consignee_address_path,o.consignee_detail," +
|
@Select("SELECT o.sn,o.create_time,o.member_name,o.consignee_name,o.consignee_mobile,o.consignee_address_path,o.consignee_detail," +
|
||||||
"o.payment_method, o.logistics_name,o.freight_price,o.goods_price,o.discount_price,o.flow_price,oi.goods_name,oi.num," +
|
"o.payment_method, o.logistics_name,o.freight_price,o.goods_price,o.discount_price,o.flow_price,oi.goods_name,oi.num," +
|
||||||
"o.remark,o.order_status,o.pay_status,o.deliver_status,o.need_receipt,o.store_name FROM li_order_item oi INNER JOIN li_order o ON oi.order_sn=o.sn")
|
"o.remark,o.order_status,o.pay_status,o.deliver_status,o.need_receipt,o.store_name FROM li_order_item oi INNER JOIN li_order o ON oi.order_sn=o.sn ${ew.customSqlSegment}")
|
||||||
List<OrderExportDTO> queryExportOrder(@Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);
|
List<OrderExportDTO> queryExportOrder(@Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);
|
||||||
|
|
||||||
@Select("select * from li_order ${ew.customSqlSegment} ")
|
@Select("select * from li_order ${ew.customSqlSegment} ")
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.trigger.message.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.utils.DateUtil;
|
|
||||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||||
import cn.lili.modules.promotion.entity.dos.*;
|
import cn.lili.modules.promotion.entity.dos.*;
|
||||||
import cn.lili.modules.promotion.entity.enums.*;
|
import cn.lili.modules.promotion.entity.enums.*;
|
||||||
@ -17,7 +17,6 @@ import cn.lili.modules.search.service.EsGoodsIndexService;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
@ -365,8 +364,17 @@ public class PromotionServiceImpl implements PromotionService {
|
|||||||
this.throwPromotionException(promotionTypeEnum, promotionMessage.getPromotionId(), promotionMessage.getPromotionStatus());
|
this.throwPromotionException(promotionTypeEnum, promotionMessage.getPromotionId(), promotionMessage.getPromotionStatus());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//修改活动状态
|
||||||
seckill.setPromotionStatus(promotionMessage.getPromotionStatus());
|
seckill.setPromotionStatus(promotionMessage.getPromotionStatus());
|
||||||
result = this.seckillService.update(promotionMessage.updateWrapper());
|
result = this.seckillService.update(promotionMessage.updateWrapper());
|
||||||
|
|
||||||
|
//判断参与活动的商品是否为空,如果为空则返回
|
||||||
|
if(seckill.getSeckillApplyList()==null){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环秒杀商品数据,将数据按照时间段进行存储
|
||||||
for (SeckillApply seckillApply : seckill.getSeckillApplyList()) {
|
for (SeckillApply seckillApply : seckill.getSeckillApplyList()) {
|
||||||
if (seckillApply.getPromotionApplyStatus().equals(PromotionApplyStatusEnum.PASS.name())) {
|
if (seckillApply.getPromotionApplyStatus().equals(PromotionApplyStatusEnum.PASS.name())) {
|
||||||
//下一个时间,默认为当天结束时间
|
//下一个时间,默认为当天结束时间
|
||||||
@ -383,12 +391,12 @@ public class PromotionServiceImpl implements PromotionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Seckill seckill1 = JSONUtil.toBean(JSONUtil.toJsonStr(seckill), Seckill.class);
|
Seckill seckill1 = JSONUtil.toBean(JSONUtil.toJsonStr(seckill), Seckill.class);
|
||||||
String format = cn.hutool.core.date.DateUtil.format(seckill.getStartTime(), DateUtil.STANDARD_DATE_FORMAT);
|
String format = DateUtil.format(seckill.getStartTime(), cn.lili.common.utils.DateUtil.STANDARD_DATE_FORMAT);
|
||||||
DateTime parseStartTime = cn.hutool.core.date.DateUtil.parse((format + " " + seckillApply.getTimeLine()), "yyyy-MM-dd HH");
|
DateTime parseStartTime = DateUtil.parse((format + " " + seckillApply.getTimeLine()), "yyyy-MM-dd HH");
|
||||||
DateTime parseEndTime = cn.hutool.core.date.DateUtil.parse((format + " " + nextHour), "yyyy-MM-dd HH");
|
DateTime parseEndTime = DateUtil.parse((format + " " + nextHour), "yyyy-MM-dd HH");
|
||||||
//如果是当天最后的时间段则设置到当天结束时间的59分59秒
|
//如果是当天最后的时间段则设置到当天结束时间的59分59秒
|
||||||
if (nextHour == seckillApply.getTimeLine()) {
|
if (nextHour == seckillApply.getTimeLine()) {
|
||||||
parseEndTime = cn.hutool.core.date.DateUtil.parse((format + " " + nextHour + ":59:59"), DateUtil.STANDARD_FORMAT);
|
parseEndTime = DateUtil.parse((format + " " + nextHour + ":59:59"), cn.lili.common.utils.DateUtil.STANDARD_FORMAT);
|
||||||
}
|
}
|
||||||
seckill1.setStartTime(parseStartTime);
|
seckill1.setStartTime(parseStartTime);
|
||||||
//当时商品的秒杀活动活动结束时间为下个时间段的开始
|
//当时商品的秒杀活动活动结束时间为下个时间段的开始
|
||||||
|
@ -19,6 +19,7 @@ import cn.lili.modules.promotion.entity.dos.Seckill;
|
|||||||
import cn.lili.modules.promotion.entity.dos.SeckillApply;
|
import cn.lili.modules.promotion.entity.dos.SeckillApply;
|
||||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||||
import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum;
|
import cn.lili.modules.promotion.entity.enums.PromotionTypeEnum;
|
||||||
|
import cn.lili.modules.promotion.entity.enums.SeckillApplyStatusEnum;
|
||||||
import cn.lili.modules.promotion.entity.vos.SeckillSearchParams;
|
import cn.lili.modules.promotion.entity.vos.SeckillSearchParams;
|
||||||
import cn.lili.modules.promotion.entity.vos.SeckillVO;
|
import cn.lili.modules.promotion.entity.vos.SeckillVO;
|
||||||
import cn.lili.modules.promotion.mapper.SeckillMapper;
|
import cn.lili.modules.promotion.mapper.SeckillMapper;
|
||||||
@ -111,6 +112,17 @@ public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
//清除演示数据
|
||||||
|
|
||||||
|
List<Seckill> seckillList=list();
|
||||||
|
for (Seckill seckill: seckillList) {
|
||||||
|
this.timeTrigger.delete(TimeExecuteConstant.PROMOTION_EXECUTOR,
|
||||||
|
seckill.getStartTime().getTime(),
|
||||||
|
DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.PROMOTION, (PromotionTypeEnum.SECKILL.name() + seckill.getId())),
|
||||||
|
rocketmqCustomProperties.getPromotionTopic());
|
||||||
|
this.removeById(seckill.getId());
|
||||||
|
}
|
||||||
|
|
||||||
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
||||||
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
||||||
for (int i=1;i<=30;i++){
|
for (int i=1;i<=30;i++){
|
||||||
@ -124,6 +136,9 @@ public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> impl
|
|||||||
|
|
||||||
SeckillVO seckillVO=new SeckillVO();
|
SeckillVO seckillVO=new SeckillVO();
|
||||||
BeanUtil.copyProperties(seckill,seckillVO);
|
BeanUtil.copyProperties(seckill,seckillVO);
|
||||||
|
|
||||||
|
seckillVO.setSeckillApplyStatus(SeckillApplyStatusEnum.NOT_APPLY.name());
|
||||||
|
seckillVO.setSeckillApplyList(null);
|
||||||
//检查秒杀活动参数
|
//检查秒杀活动参数
|
||||||
checkSeckillParam(seckillVO, seckill.getStoreId());
|
checkSeckillParam(seckillVO, seckill.getStoreId());
|
||||||
//保存到MYSQL中
|
//保存到MYSQL中
|
||||||
|
@ -22,13 +22,6 @@ public interface StoreGoodsLabelService extends IService<StoreGoodsLabel> {
|
|||||||
*/
|
*/
|
||||||
List<StoreGoodsLabelVO> listByStoreId(String storeId);
|
List<StoreGoodsLabelVO> listByStoreId(String storeId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前店铺的店铺分类列表
|
|
||||||
*
|
|
||||||
* @return 店铺分类列表
|
|
||||||
*/
|
|
||||||
List<StoreGoodsLabel> listByStore();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加商品分类
|
* 添加商品分类
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.lili.modules.store.serviceimpl;
|
package cn.lili.modules.store.serviceimpl;
|
||||||
|
|
||||||
|
import cn.lili.common.cache.Cache;
|
||||||
|
import cn.lili.common.cache.CachePrefix;
|
||||||
import cn.lili.common.security.AuthUser;
|
import cn.lili.common.security.AuthUser;
|
||||||
import cn.lili.common.security.context.UserContext;
|
import cn.lili.common.security.context.UserContext;
|
||||||
|
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||||
import cn.lili.modules.store.entity.dos.StoreGoodsLabel;
|
import cn.lili.modules.store.entity.dos.StoreGoodsLabel;
|
||||||
import cn.lili.modules.store.entity.vos.StoreGoodsLabelVO;
|
import cn.lili.modules.store.entity.vos.StoreGoodsLabelVO;
|
||||||
import cn.lili.modules.store.mapper.StoreGoodsLabelMapper;
|
import cn.lili.modules.store.mapper.StoreGoodsLabelMapper;
|
||||||
@ -10,10 +13,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,11 +31,21 @@ import java.util.List;
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMapper, StoreGoodsLabel> implements StoreGoodsLabelService {
|
public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMapper, StoreGoodsLabel> implements StoreGoodsLabelService {
|
||||||
|
|
||||||
|
//缓存
|
||||||
|
@Autowired
|
||||||
|
private Cache cache;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoreGoodsLabelVO> listByStoreId(String storeId) {
|
public List<StoreGoodsLabelVO> listByStoreId(String storeId) {
|
||||||
//TODO 从缓存获取店铺商品分类列表
|
|
||||||
|
//从缓存中获取店铺分类
|
||||||
|
if (cache.hasKey(CachePrefix.STORE_CATEGORY.getPrefix() + storeId + "tree")) {
|
||||||
|
return (List<StoreGoodsLabelVO>) cache.get(CachePrefix.CATEGORY.getPrefix() + "tree");
|
||||||
|
}
|
||||||
|
|
||||||
List<StoreGoodsLabel> list = list(storeId);
|
List<StoreGoodsLabel> list = list(storeId);
|
||||||
List<StoreGoodsLabelVO> storeGoodsLabelVOList = new ArrayList<>();
|
List<StoreGoodsLabelVO> storeGoodsLabelVOList = new ArrayList<>();
|
||||||
|
|
||||||
//循环列表判断是否为顶级,如果为顶级获取下级数据
|
//循环列表判断是否为顶级,如果为顶级获取下级数据
|
||||||
list.stream()
|
list.stream()
|
||||||
.filter(storeGoodsLabel -> storeGoodsLabel.getLevel() == 0)
|
.filter(storeGoodsLabel -> storeGoodsLabel.getLevel() == 0)
|
||||||
@ -43,15 +58,55 @@ public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMappe
|
|||||||
storeGoodsLabelVO.setChildren(storeGoodsLabelVOChildList);
|
storeGoodsLabelVO.setChildren(storeGoodsLabelVOChildList);
|
||||||
storeGoodsLabelVOList.add(storeGoodsLabelVO);
|
storeGoodsLabelVOList.add(storeGoodsLabelVO);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//调整店铺分类排序
|
||||||
|
storeGoodsLabelVOList.sort(new Comparator<StoreGoodsLabelVO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(StoreGoodsLabelVO o1, StoreGoodsLabelVO o2) {
|
||||||
|
return o1.getSortOrder().compareTo(o2.getSortOrder());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (storeGoodsLabelVOList.size() != 0) {
|
||||||
|
cache.put(CachePrefix.CATEGORY.getPrefix() + storeId + "tree", storeGoodsLabelVOList);
|
||||||
|
}
|
||||||
return storeGoodsLabelVOList;
|
return storeGoodsLabelVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoreGoodsLabel> listByStore() {
|
public StoreGoodsLabel addStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
||||||
//获取当前登录商家账号
|
//获取当前登录商家账号
|
||||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||||
//返回列表
|
storeGoodsLabel.setStoreId(tokenUser.getStoreId());
|
||||||
return list(tokenUser.getId());
|
//保存店铺分类
|
||||||
|
this.save(storeGoodsLabel);
|
||||||
|
//清除缓存
|
||||||
|
removeCache(storeGoodsLabel.getStoreId());
|
||||||
|
return storeGoodsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StoreGoodsLabel editStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
||||||
|
//修改当前店铺的商品分类
|
||||||
|
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||||
|
LambdaUpdateWrapper<StoreGoodsLabel> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
||||||
|
lambdaUpdateWrapper.eq(StoreGoodsLabel::getStoreId, tokenUser.getStoreId());
|
||||||
|
lambdaUpdateWrapper.eq(StoreGoodsLabel::getId, storeGoodsLabel.getId());
|
||||||
|
//修改店铺分类
|
||||||
|
this.update(storeGoodsLabel, lambdaUpdateWrapper);
|
||||||
|
//清除缓存
|
||||||
|
removeCache(storeGoodsLabel.getStoreId());
|
||||||
|
return storeGoodsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeStoreGoodsLabel(String storeLabelId) {
|
||||||
|
|
||||||
|
//删除店铺分类
|
||||||
|
this.removeById(storeLabelId);
|
||||||
|
|
||||||
|
//清除缓存
|
||||||
|
removeCache(UserContext.getCurrentUser().getStoreId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,28 +121,10 @@ public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMappe
|
|||||||
return this.baseMapper.selectList(queryWrapper);
|
return this.baseMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public StoreGoodsLabel addStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
* 清除缓存
|
||||||
//获取当前登录商家账号
|
*/
|
||||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
private void removeCache(String storeId) {
|
||||||
storeGoodsLabel.setStoreId(tokenUser.getStoreId());
|
cache.remove(CachePrefix.CATEGORY.getPrefix() + storeId + "tree");
|
||||||
this.save(storeGoodsLabel);
|
|
||||||
return storeGoodsLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StoreGoodsLabel editStoreGoodsLabel(StoreGoodsLabel storeGoodsLabel) {
|
|
||||||
//修改当前店铺的商品分类
|
|
||||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
|
||||||
LambdaUpdateWrapper<StoreGoodsLabel> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
||||||
lambdaUpdateWrapper.eq(StoreGoodsLabel::getStoreId, tokenUser.getStoreId());
|
|
||||||
lambdaUpdateWrapper.eq(StoreGoodsLabel::getId, storeGoodsLabel.getId());
|
|
||||||
this.update(storeGoodsLabel, lambdaUpdateWrapper);
|
|
||||||
return storeGoodsLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeStoreGoodsLabel(String storeLabelId) {
|
|
||||||
this.removeById(storeLabelId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface StoreLogisticsMapper extends BaseMapper<StoreLogistics> {
|
public interface StoreLogisticsMapper extends BaseMapper<StoreLogistics> {
|
||||||
|
|
||||||
@Select("SELECT l.* FROM li_logistics l RIGHT JOIN li_store_logistics sl ON l.id=sl.logistics_id WHERE sl.store_id=#{storeId}")
|
@Select("SELECT l.* FROM li_logistics l RIGHT JOIN li_store_logistics sl ON l.id=sl.logistics_id WHERE sl.store_id=#{storeId} AND l.disabled='OPEN'")
|
||||||
List<StoreLogisticsVO> getSelectedStoreLogistics(String storeId);
|
List<StoreLogisticsVO> getSelectedStoreLogistics(String storeId);
|
||||||
|
|
||||||
@Select("SELECT l.name FROM li_logistics l RIGHT JOIN li_store_logistics sl ON l.id=sl.logistics_id WHERE sl.store_id=#{storeId}")
|
@Select("SELECT l.name FROM li_logistics l RIGHT JOIN li_store_logistics sl ON l.id=sl.logistics_id WHERE sl.store_id=#{storeId} AND l.disabled='OPEN'")
|
||||||
List<String> getSelectedStoreLogisticsName(String storeId);
|
List<String> getSelectedStoreLogisticsName(String storeId);
|
||||||
|
|
||||||
@Select("SELECT *, ( SELECT sl.id FROM li_store_logistics sl WHERE l.id = sl.logistics_id AND sl.store_id=#{storeId} ) AS selected FROM li_logistics l;")
|
@Select("SELECT *, ( SELECT sl.id FROM li_store_logistics sl WHERE l.id = sl.logistics_id AND sl.store_id=#{storeId} ) AS selected FROM li_logistics l AND l.disabled='OPEN';")
|
||||||
List<StoreLogisticsVO> getStoreLogistics(String storeId);
|
List<StoreLogisticsVO> getStoreLogistics(String storeId);
|
||||||
|
|
||||||
}
|
}
|
@ -61,14 +61,6 @@ public class CategoryManagerController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation(value = "添加商品分类")
|
@ApiOperation(value = "添加商品分类")
|
||||||
public ResultMessage<Category> saveCategory(@Valid Category category) {
|
public ResultMessage<Category> saveCategory(@Valid Category category) {
|
||||||
|
|
||||||
//不能添加重复的分类名称
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setName(category.getName());
|
|
||||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
|
||||||
if (StringUtils.isNotEmpty(list)) {
|
|
||||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
|
||||||
}
|
|
||||||
//非顶级分类
|
//非顶级分类
|
||||||
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
||||||
Category parent = categoryService.getById(category.getParentId());
|
Category parent = categoryService.getById(category.getParentId());
|
||||||
@ -90,15 +82,7 @@ public class CategoryManagerController {
|
|||||||
public ResultMessage<Category> updateCategory(@Valid CategoryVO category) {
|
public ResultMessage<Category> updateCategory(@Valid CategoryVO category) {
|
||||||
Category catTemp = categoryService.getById(category.getId());
|
Category catTemp = categoryService.getById(category.getId());
|
||||||
if (catTemp == null) {
|
if (catTemp == null) {
|
||||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||||
}
|
|
||||||
//不能添加重复的分类名称
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setName(category.getName());
|
|
||||||
category1.setId(category.getId());
|
|
||||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
|
||||||
if (StringUtils.isNotEmpty(list)) {
|
|
||||||
throw new ServiceException(ResultCode.CATEGORY_NAME_IS_EXIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
categoryService.updateCategory(category);
|
categoryService.updateCategory(category);
|
||||||
|
@ -53,8 +53,8 @@ public class ArticleManagerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "添加文章")
|
@ApiOperation(value = "添加文章")
|
||||||
@PostMapping
|
@PostMapping(consumes = "application/json", produces = "application/json")
|
||||||
public ResultMessage<Article> save(@Valid Article article) {
|
public ResultMessage<Article> save(@RequestBody Article article) {
|
||||||
article.setType(ArticleEnum.OTHER.name());
|
article.setType(ArticleEnum.OTHER.name());
|
||||||
articleService.save(article);
|
articleService.save(article);
|
||||||
return ResultUtil.data(article);
|
return ResultUtil.data(article);
|
||||||
@ -62,8 +62,8 @@ public class ArticleManagerController {
|
|||||||
|
|
||||||
@ApiOperation(value = "修改文章")
|
@ApiOperation(value = "修改文章")
|
||||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||||
@PutMapping("update/{id}")
|
@PutMapping(value = "update/{id}", consumes = "application/json", produces = "application/json")
|
||||||
public ResultMessage<Article> update(@Valid Article article, @PathVariable("id") String id) {
|
public ResultMessage<Article> update(@RequestBody Article article, @PathVariable("id") String id) {
|
||||||
article.setId(id);
|
article.setId(id);
|
||||||
return ResultUtil.data(articleService.updateArticle(article));
|
return ResultUtil.data(articleService.updateArticle(article));
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,6 @@ ALTER TABLE li_distribution ADD settlement_bank_account_num varchar ( 200 );
|
|||||||
ALTER TABLE li_distribution ADD settlement_bank_branch_name varchar ( 200 );
|
ALTER TABLE li_distribution ADD settlement_bank_branch_name varchar ( 200 );
|
||||||
|
|
||||||
/** 文章分类添加默认值**/
|
/** 文章分类添加默认值**/
|
||||||
ALTER TABLE li_article_category alter column sort set default 0;
|
ALTER TABLE li_article_category alter column sort set default 0;
|
||||||
|
/** 添加分销提现菜单**/
|
||||||
|
INSERT INTO `lilishop`.`li_menu`(`id`, `create_by`, `create_time`, `delete_flag`, `update_by`, `update_time`, `description`, `front_route`, `icon`, `level`, `name`, `parent_id`, `path`, `sort_order`, `title`, `front_component`) VALUES (1410862675914764290, 'admin', '2021-07-02 15:27:29', b'0', 'admin', '2021-07-02 15:27:45', 'null', 'distribution/distributionCash', '', 2, 'distributionCash', '1374173575405109248', 'distributionCash', 5.00, '分销提现', 'null');
|
Loading…
x
Reference in New Issue
Block a user