Merge branch 'master' into Bulbasaur
This commit is contained in:
commit
16498a6850
122
README.md
122
README.md
@ -132,54 +132,92 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
||||
|
||||
##### Java后台
|
||||
|
||||
| 说明 | 框架 |
|
||||
| -------------- | --------------- |
|
||||
| 基础框架 | Spring Boot |
|
||||
| MVC框架 | Spring MVC |
|
||||
| 持久框架 | Mybatis-Plus |
|
||||
| 程序构建 | Maven |
|
||||
| 关系型数据库 | MySQL |
|
||||
| 消息中间件AMQP | RocketMQ |
|
||||
| 缓存 | Redis +MongoDB |
|
||||
| 搜索引擎 | Elasticsearch |
|
||||
| 安全框架 | Spring Security |
|
||||
| 数据库连接池 | Druid |
|
||||
| 数据库分库分表 | sharding |
|
||||
| 定时任务 | xxl-job |
|
||||
| 负载均衡 | Nginx |
|
||||
| 静态资源 | 阿里云OSS |
|
||||
| 短信 | 阿里云短信 |
|
||||
| 日志处理 | Log4j |
|
||||
| 接口规范 | RESTful |
|
||||
| 接口文档 | Swagger |
|
||||
| 认证 | JWT |
|
||||
| 说明 | 框架 | 说明 | |
|
||||
| -------------- | --------------- | -------------- | ------------- |
|
||||
| 基础框架 | Spring Boot | MVC框架 | Spring MVC |
|
||||
| 持久框架 | Mybatis-Plus | 程序构建 | Maven |
|
||||
| 关系型数据库 | MySQL | 消息中间件AMQP | RocketMQ |
|
||||
| 缓存 | Redis +MongoDB | 搜索引擎 | Elasticsearch |
|
||||
| 安全框架 | Spring Security | 数据库连接池 | Druid |
|
||||
| 数据库分库分表 | sharding | 定时任务 | xxl-job |
|
||||
| 负载均衡 | Nginx | 静态资源 | 阿里云OSS |
|
||||
| 短信 | 阿里云短信 | 认证 | JWT |
|
||||
| 日志处理 | Log4j | 接口规范 | RESTful |
|
||||
|
||||
##### 前端-运营后台、店铺后台
|
||||
|
||||
| 说明 | 框架 |
|
||||
| ---------- | ---------- |
|
||||
| 构建工具 | webpack |
|
||||
| JS版本 | ES6 |
|
||||
| 基础JS框架 | Vue.js |
|
||||
| 视频播放器 | Dplayer |
|
||||
| 路由管理 | Vue Router |
|
||||
| 状态管理 | Vuex |
|
||||
| 基础UI库 | iView |
|
||||
| UI界面基于 | iView |
|
||||
| 网络请求 | axios |
|
||||
| CSS预处理 | scss |
|
||||
| 代码检查 | ESLint |
|
||||
| 数据可视化 | AntV g2 |
|
||||
| 地图引擎 | amap |
|
||||
| 说明 | 框架 | 说明 | 框架 |
|
||||
| ---------- | ---------- | ---------- | ------- |
|
||||
| 构建工具 | webpack | JS版本 | ES6 |
|
||||
| 基础JS框架 | Vue.js | 视频播放器 | Dplayer |
|
||||
| 路由管理 | Vue Router | 状态管理 | Vuex |
|
||||
| 基础UI库 | iView | UI界面基于 | iView |
|
||||
| 网络请求 | axios | | |
|
||||
|
||||
##### 前端-移动端
|
||||
|
||||
| 说明 | 架构 |
|
||||
| --------- | ------- |
|
||||
| 基础UI库 | uViewui |
|
||||
| 基础框架 | uni-app |
|
||||
| CSS预处理 | scss |
|
||||
| 地图引擎 | amap |
|
||||
| 说明 | 架构 | 说明 | 架构 |
|
||||
| --------- | ------- | -------- | ------- |
|
||||
| 基础UI库 | uViewui | 基础框架 | uni-app |
|
||||
| CSS预处理 | scss | 地图引擎 | amap |
|
||||
|
||||
### 升级计划
|
||||
|
||||
时间:2021年6月15日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.微信小程序直播
|
||||
2.优惠券活动
|
||||
3.新人赠券
|
||||
4.准确发券
|
||||
5.用户等级
|
||||
6.数据导出
|
||||
7.订单批量
|
||||
8.APP版本升级检测
|
||||
9.积分商城
|
||||
|
||||
功能优化:
|
||||
1.优惠券有效期增加类型:设置领取后*内有效。
|
||||
2.秒杀活动设置为每天开启,需设置秒杀活动开启时间。
|
||||
3.店铺配送模板,配送地区如果选择省份则下方的市级地址不展示。
|
||||
4.店铺配送模板支持,店铺包邮。
|
||||
5.普通商品设置去除卖家承担运费。
|
||||
|
||||
```
|
||||
|
||||
时间:2021年7月15日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.会员权益
|
||||
2.支持用户升级会员
|
||||
3.供求单
|
||||
4.IM:腾讯云智服
|
||||
5.服务商品
|
||||
6.店铺支持订单核销
|
||||
7.店铺自提点
|
||||
功能优化:
|
||||
1.用户分享商城、关注店铺、邀请新用户可获取积分、经验值。
|
||||
```
|
||||
|
||||
时间:2021年8月16日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.微淘功能
|
||||
2.店铺移动端
|
||||
3.店铺发货单
|
||||
```
|
||||
|
||||
时间:2021年9月15日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
增加供应商功能
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 技术亮点
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.service.AppVersionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 买家端,APP版本
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/5/21 11:15 上午
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "买家端,APP版本")
|
||||
@RequestMapping("/buyer/appVersion")
|
||||
public class AppVersionBuyerController {
|
||||
|
||||
@Autowired
|
||||
private AppVersionService appVersionService;
|
||||
|
||||
|
||||
@ApiOperation(value = "获取版本号")
|
||||
@ApiImplicitParam(name = "appType", value = "app类型", required = true, paramType = "path")
|
||||
@GetMapping("/{appType}")
|
||||
public ResultMessage<Object> getAppVersion(@PathVariable String appType) {
|
||||
return ResultUtil.data(appVersionService.getAppVersion(appType));
|
||||
}
|
||||
}
|
@ -149,9 +149,7 @@ ignored:
|
||||
- /buyer/promotion/seckill
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /buyer/appVersion/**
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
|
@ -63,7 +63,7 @@ public class UploadController {
|
||||
if (authUser == null) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException(ResultCode.OSS_NOT_EXIST);
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ ignored:
|
||||
- /buyer/promotion/pointsGoods/**
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /buyer/appVersion/**
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
|
@ -8,6 +8,7 @@ import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.entity.vos.PintuanVO;
|
||||
import cn.lili.modules.promotion.service.*;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@ -34,6 +35,9 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
//Mongo
|
||||
@Autowired
|
||||
private MongoTemplate mongoTemplate;
|
||||
//es
|
||||
@Autowired
|
||||
private EsGoodsIndexService esGoodsIndexService;
|
||||
//满额活动
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
@ -74,6 +78,7 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
if (vo.getPromotionGoodsList() != null && !vo.getPromotionGoodsList().isEmpty()) {
|
||||
for (PromotionGoods promotionGoods : vo.getPromotionGoodsList()) {
|
||||
promotionGoods.setPromotionStatus(PromotionStatusEnum.END.name());
|
||||
esGoodsIndexService.deleteEsGoodsPromotionByPromotionId(promotionGoods.getSkuId(), vo.getId());
|
||||
}
|
||||
}
|
||||
mongoTemplate.save(vo);
|
||||
@ -92,6 +97,7 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
if (vo.getPromotionGoodsList() != null && !vo.getPromotionGoodsList().isEmpty()) {
|
||||
for (PromotionGoods promotionGoods : vo.getPromotionGoodsList()) {
|
||||
promotionGoods.setPromotionStatus(PromotionStatusEnum.END.name());
|
||||
esGoodsIndexService.deleteEsGoodsPromotionByPromotionId(promotionGoods.getSkuId(), vo.getId());
|
||||
}
|
||||
}
|
||||
mongoTemplate.save(vo);
|
||||
@ -110,6 +116,7 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
if (vo.getPromotionGoodsList() != null && !vo.getPromotionGoodsList().isEmpty()) {
|
||||
for (PromotionGoods promotionGoods : vo.getPromotionGoodsList()) {
|
||||
promotionGoods.setPromotionStatus(PromotionStatusEnum.END.name());
|
||||
esGoodsIndexService.deleteEsGoodsPromotionByPromotionId(promotionGoods.getSkuId(), vo.getId());
|
||||
}
|
||||
}
|
||||
mongoTemplate.save(vo);
|
||||
|
@ -35,7 +35,9 @@ public abstract class AbstractDelayQueueMachineFactory {
|
||||
Calendar instance = Calendar.getInstance();
|
||||
instance.add(Calendar.SECOND, time);
|
||||
long delaySeconds = instance.getTimeInMillis() / 1000;
|
||||
return redisUtil.zadd(setDelayQueueName(), delaySeconds, jobId);
|
||||
boolean result = redisUtil.zadd(setDelayQueueName(), delaySeconds, jobId);
|
||||
log.info("redis add delay, key {}, delay time {}", setDelayQueueName(), delaySeconds);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public enum ResultCode {
|
||||
USER_EDIT_SUCCESS(20001, "用户修改成功"),
|
||||
USER_NOT_EXIST(20002, "用户不存在"),
|
||||
USER_NOT_LOGIN(20003, "用户未登录"),
|
||||
USER_AUTH_EXPIRED(20004, "认证过期"),
|
||||
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
|
||||
USER_AUTHORITY_ERROR(20005, "权限不足"),
|
||||
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
|
||||
USER_NAME_EXIST(20007, "该用户名已被注册"),
|
||||
@ -297,7 +297,7 @@ public enum ResultCode {
|
||||
WECHAT_QRCODE_ERROR(80502, "微信二维码生成异常"),
|
||||
WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"),
|
||||
|
||||
|
||||
APP_VERSION_EXIST(80600, "APP版本已存在")
|
||||
;
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
@ -53,39 +53,61 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
|
||||
@Override
|
||||
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
||||
//获取短信配置
|
||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云短信");
|
||||
}
|
||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||
|
||||
//验证码
|
||||
String code = CommonUtil.getRandomNum();
|
||||
|
||||
switch (verificationEnums) {
|
||||
//如果某个模版需要自定义,则在此处进行调整
|
||||
case LOGIN:
|
||||
case REGISTER:
|
||||
case FIND_USER: {
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
// 验证码内容
|
||||
params.put("code", code);
|
||||
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755300");
|
||||
//模版 默认为登录验证
|
||||
String templateCode;
|
||||
|
||||
//如果某个模版需要自定义,则在此处进行调整
|
||||
switch (verificationEnums) {
|
||||
//登录
|
||||
case LOGIN: {
|
||||
templateCode = "SMS_205755300";
|
||||
break;
|
||||
}
|
||||
//注册
|
||||
case REGISTER: {
|
||||
templateCode = "SMS_205755298";
|
||||
break;
|
||||
}
|
||||
//找回密码
|
||||
case FIND_USER: {
|
||||
templateCode = "SMS_205755301";
|
||||
break;
|
||||
}
|
||||
//修改密码
|
||||
case UPDATE_PASSWORD: {
|
||||
Member member = memberService.getById(UserContext.getCurrentUser().getId());
|
||||
if (member == null || StringUtil.isEmpty(member.getMobile())) {
|
||||
return;
|
||||
}
|
||||
String memberMobile = member.getMobile();
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, memberMobile, uuid), code, 300L);
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755297");
|
||||
//更新为用户最新手机号
|
||||
mobile = member.getMobile();
|
||||
templateCode = "SMS_205755297";
|
||||
break;
|
||||
}
|
||||
//如果不是有效的验证码手段,则此处不进行短信操作
|
||||
default:
|
||||
return;
|
||||
}
|
||||
//缓存中写入要验证的信息
|
||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||
//发送短信
|
||||
this.sendSmsCode(smsSetting.getSignName(), mobile, params, templateCode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -309,7 +331,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
*/
|
||||
public com.aliyun.dysmsapi20170525.Client createClient() {
|
||||
try {
|
||||
Setting setting = settingService.getById(SettingEnum.SMS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云短信");
|
||||
}
|
||||
@ -317,11 +339,9 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
|
||||
Config config = new Config();
|
||||
// 您的AccessKey ID
|
||||
//config.accessKeyId = smsSetting.getAccessKeyId();
|
||||
config.accessKeyId = "LTAI4G4deX59EyjpEULaJdsU";
|
||||
config.accessKeyId = smsSetting.getAccessKeyId();
|
||||
// 您的AccessKey Secret
|
||||
//config.accessKeySecret = smsSetting.getAccessSecret();
|
||||
config.accessKeySecret = "BlRBpl7WBman6GYYwLKMiKqMTXFhWf";
|
||||
config.accessKeySecret = smsSetting.getAccessSecret();
|
||||
// 访问的域名
|
||||
config.endpoint = "dysmsapi.aliyuncs.com";
|
||||
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||
|
@ -37,7 +37,7 @@ public class RocketmqTimerTrigger implements TimeTrigger {
|
||||
|
||||
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(executorName, triggerTime, param, uniqueKey, topic);
|
||||
Message<TimeTriggerMsg> message = MessageBuilder.withPayload(timeTriggerMsg).build();
|
||||
|
||||
log.info("延时任务发送信息:{}", message);
|
||||
this.rocketMQTemplate.asyncSend(topic, message, RocketmqSendCallbackBuilder.commonCallback());
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.delayqueue.AbstractDelayQueueMachineFactory;
|
||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||
import cn.lili.common.trigger.model.TimeTriggerMsg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -18,6 +19,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class PromotionDelayQueue extends AbstractDelayQueueMachineFactory {
|
||||
|
||||
@Autowired
|
||||
private TimeTrigger timeTrigger;
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,6 @@ public interface DistributionOrderService extends IService<DistributionOrder> {
|
||||
* @param orderSn 订单编号
|
||||
*/
|
||||
void payOrder(String orderSn);
|
||||
void test(String orderSn);
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
|
@ -2,7 +2,6 @@ package cn.lili.modules.distribution.serviceimpl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.modules.distribution.entity.dos.Distribution;
|
||||
@ -16,9 +15,6 @@ import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dos.StoreFlow;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -84,50 +80,12 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
||||
distributionOrder.setDistributionName(distribution.getMemberName());
|
||||
|
||||
//设置结算天数(解冻日期)
|
||||
Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
||||
DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
||||
// Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
||||
// DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
||||
DateTime dateTime = new DateTime();
|
||||
dateTime.offsetNew(DateField.DAY_OF_MONTH,distributionSetting.getCashDay());
|
||||
distributionOrder.setSettleCycle(dateTime);
|
||||
this.save(distributionOrder);
|
||||
}
|
||||
//如果包含分销商品则记录会员的分销总额
|
||||
if(rebate!=0.0){
|
||||
distributionService.addRebate(rebate,order.getDistributionId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void test(String orderSn) {
|
||||
|
||||
//根据订单编号获取订单数据
|
||||
Order order = orderService.getBySn(orderSn);
|
||||
|
||||
//判断是否为分销订单,如果为分销订单则获取分销佣金
|
||||
if (order.getDistributionId() != null) {
|
||||
//根据订单编号获取有分销金额的店铺流水记录
|
||||
List<StoreFlow> storeFlowList = storeFlowService.list(new LambdaQueryWrapper<StoreFlow>()
|
||||
.eq(StoreFlow::getOrderSn, orderSn)
|
||||
.isNotNull(StoreFlow::getDistributionRebate));
|
||||
Double rebate=0.0;
|
||||
//循环店铺流水记录判断是否包含分销商品
|
||||
//包含分销商品则进行记录分销订单、计算分销总额
|
||||
for (StoreFlow storeFlow : storeFlowList) {
|
||||
rebate=CurrencyUtil.add(rebate,storeFlow.getDistributionRebate());
|
||||
DistributionOrder distributionOrder = new DistributionOrder(storeFlow);
|
||||
distributionOrder.setDistributionId(order.getDistributionId());
|
||||
//分销员信息
|
||||
Distribution distribution = distributionService.getById(order.getDistributionId());
|
||||
distributionOrder.setDistributionName(distribution.getMemberName());
|
||||
|
||||
//设置结算天数(解冻日期)
|
||||
Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
|
||||
DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
|
||||
DateTime dateTime = new DateTime();
|
||||
//默认提现周期一天
|
||||
//默认解冻1天
|
||||
// dateTime.offsetNew(DateField.DAY_OF_MONTH,distributionSetting.getCashDay());
|
||||
dateTime.offsetNew(DateField.DAY_OF_MONTH,1);
|
||||
//dateTime.offsetNew(DateField.DAY_OF_MONTH,distributionSetting.getCashDay());
|
||||
distributionOrder.setSettleCycle(dateTime);
|
||||
this.save(distributionOrder);
|
||||
}
|
||||
@ -138,7 +96,6 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOrder(String orderSn) {
|
||||
this.update(new LambdaUpdateWrapper<DistributionOrder>().eq(DistributionOrder::getOrderSn, orderSn)
|
||||
|
@ -74,7 +74,7 @@ public class AliFileManagerPlugin implements FileManagerPlugin {
|
||||
private OssSetting getSetting() {
|
||||
//如果没有配置,或者没有下次刷新时间,或者下次刷新时间小于当前时间,则从redis 更新一次
|
||||
if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) {
|
||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云OSS存储");
|
||||
}
|
||||
|
@ -122,4 +122,11 @@ public interface GoodsService extends IService<Goods> {
|
||||
* @param quantity 库存数量
|
||||
*/
|
||||
void updateStock(String goodsId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 更新SKU评价数量
|
||||
*
|
||||
* @param goodsId 商品ID
|
||||
*/
|
||||
void updateGoodsCommentNum(String goodsId);
|
||||
}
|
@ -59,7 +59,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
||||
public GoodsGallery getGoodsGallery(String origin) {
|
||||
GoodsGallery goodsGallery = new GoodsGallery();
|
||||
//获取商品系统配置决定是否审核
|
||||
Setting setting = settingService.getById(SettingEnum.GOODS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
|
||||
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
||||
//缩略图
|
||||
String thumbnail = fileManagerPlugin.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.modules.goods.serviceimpl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
@ -23,6 +24,9 @@ import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
|
||||
import cn.lili.modules.goods.entity.vos.GoodsVO;
|
||||
import cn.lili.modules.goods.mapper.GoodsMapper;
|
||||
import cn.lili.modules.goods.service.*;
|
||||
import cn.lili.modules.member.entity.dos.MemberEvaluation;
|
||||
import cn.lili.modules.member.entity.enums.EvaluationGradeEnum;
|
||||
import cn.lili.modules.member.service.MemberEvaluationService;
|
||||
import cn.lili.modules.store.entity.vos.StoreVO;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
@ -73,6 +77,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
//店铺详情
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
@Autowired
|
||||
private MemberEvaluationService memberEvaluationService;
|
||||
//rocketMq
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
@ -80,6 +86,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
|
||||
@Override
|
||||
public void underStoreGoods(String storeId) {
|
||||
this.baseMapper.underStoreGoods(storeId);
|
||||
@ -234,7 +241,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
public Integer goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
|
||||
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
|
||||
|
||||
queryWrapper.eq(Goods::getDeleteFlag,false);
|
||||
queryWrapper.eq(Goods::getDeleteFlag, false);
|
||||
|
||||
if (goodsStatusEnum != null) {
|
||||
queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name());
|
||||
@ -313,6 +320,26 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGoodsCommentNum(String goodsId) {
|
||||
|
||||
//获取商品信息
|
||||
Goods goods = this.getById(goodsId);
|
||||
//修改商品评价数量
|
||||
goods.setCommentNum(goods.getCommentNum() + 1);
|
||||
|
||||
//修改商品好评率
|
||||
LambdaQueryWrapper<MemberEvaluation> goodEvaluationQueryWrapper = new LambdaQueryWrapper<>();
|
||||
goodEvaluationQueryWrapper.eq(MemberEvaluation::getId, goodsId);
|
||||
goodEvaluationQueryWrapper.eq(MemberEvaluation::getGrade, EvaluationGradeEnum.GOOD.name());
|
||||
// 好评数量
|
||||
int highPraiseNum = memberEvaluationService.count(goodEvaluationQueryWrapper);
|
||||
// 好评率
|
||||
double grade = NumberUtil.mul(NumberUtil.div(highPraiseNum, goods.getCommentNum().doubleValue(), 2), 100);
|
||||
goods.setGrade(grade);
|
||||
this.updateById(goods);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品默认图片
|
||||
*
|
||||
|
@ -413,18 +413,15 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
goodsSku.setCommentNum(goodsSku.getCommentNum() != null ? goodsSku.getCommentNum() + 1 : 1);
|
||||
|
||||
// 好评率
|
||||
double grade = NumberUtil.div(highPraiseNum, goodsSku.getCommentNum().doubleValue(), 2) * 100;
|
||||
double grade = NumberUtil.mul(NumberUtil.div(highPraiseNum, goodsSku.getCommentNum().doubleValue(), 2), 100);
|
||||
goodsSku.setGrade(grade);
|
||||
//修改规格
|
||||
this.update(goodsSku);
|
||||
//修改规格索引
|
||||
goodsIndexService.updateIndexCommentNum(goodsSku.getId(), goodsSku.getCommentNum(), (int) highPraiseNum, grade);
|
||||
|
||||
//修改商品评价数量
|
||||
Goods goods = goodsService.getById(goodsSku.getGoodsId());
|
||||
goods.setCommentNum(goods.getCommentNum() + 1);
|
||||
goodsService.updateById(goods);
|
||||
|
||||
//修改商品的评价数量
|
||||
goodsService.updateGoodsCommentNum(goodsSku.getGoodsId());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,8 +441,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
goodsIndexService.addIndex(goodsIndex);
|
||||
} else if (goodsSku.getQuantity() > 0 && esGoodsOld != null) {
|
||||
goodsIndexService.updateIndex(goodsIndex);
|
||||
} else if (goodsSku.getQuantity() <= 0 && esGoodsOld != null) {
|
||||
goodsIndexService.deleteIndexById(goodsSku.getId());
|
||||
}
|
||||
//删除sku缓存
|
||||
cache.remove(GoodsSkuService.getCacheKeys(goodsSku.getId()));
|
||||
|
@ -81,7 +81,7 @@ public class MemberEvaluation extends BaseEntity {
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "评价图片")
|
||||
private String image;
|
||||
private String images;
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "状态 OPEN 正常 ,CLOSE 关闭 ")
|
||||
|
@ -51,21 +51,25 @@ public class NoticeMessageServiceImpl extends ServiceImpl<NoticeMessageTemplateM
|
||||
if (noticeMessageDTO == null) {
|
||||
return;
|
||||
}
|
||||
NoticeMessage noticeMessage = this.getOne(new LambdaQueryWrapper<NoticeMessage>().eq(NoticeMessage::getNoticeNode, noticeMessageDTO.getNoticeMessageNodeEnum().getDescription().trim()));
|
||||
//如果通知类站内信开启的情况下
|
||||
if (noticeMessage != null && noticeMessage.getNoticeStatus().equals(SwitchEnum.OPEN.name())) {
|
||||
MemberNotice memberNotice = new MemberNotice();
|
||||
memberNotice.setMemberId(noticeMessageDTO.getMemberId());
|
||||
memberNotice.setTitle(noticeMessage.getNoticeTitle());
|
||||
memberNotice.setContent(noticeMessage.getNoticeContent());
|
||||
//参数不为空,替换内容
|
||||
if (noticeMessageDTO.getParameter() != null) {
|
||||
memberNotice.setContent(replaceNoticeContent(noticeMessage.getNoticeContent(), noticeMessageDTO.getParameter()));
|
||||
} else {
|
||||
try {
|
||||
NoticeMessage noticeMessage = this.getOne(new LambdaQueryWrapper<NoticeMessage>().eq(NoticeMessage::getNoticeNode, noticeMessageDTO.getNoticeMessageNodeEnum().getDescription().trim()));
|
||||
//如果通知类站内信开启的情况下
|
||||
if (noticeMessage != null && noticeMessage.getNoticeStatus().equals(SwitchEnum.OPEN.name())) {
|
||||
MemberNotice memberNotice = new MemberNotice();
|
||||
memberNotice.setMemberId(noticeMessageDTO.getMemberId());
|
||||
memberNotice.setTitle(noticeMessage.getNoticeTitle());
|
||||
memberNotice.setContent(noticeMessage.getNoticeContent());
|
||||
//参数不为空,替换内容
|
||||
if (noticeMessageDTO.getParameter() != null) {
|
||||
memberNotice.setContent(replaceNoticeContent(noticeMessage.getNoticeContent(), noticeMessageDTO.getParameter()));
|
||||
} else {
|
||||
memberNotice.setContent(noticeMessage.getNoticeContent());
|
||||
}
|
||||
//添加站内信
|
||||
memberNoticeService.save(memberNotice);
|
||||
}
|
||||
//添加站内信
|
||||
memberNoticeService.save(memberNotice);
|
||||
} catch (Exception e) {
|
||||
log.error("站内信发送失败:", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -92,7 +92,11 @@ public class TradeBuilder {
|
||||
tradeDTO.setSkuList(collect);
|
||||
//按照计划进行渲染
|
||||
for (int index : defaultRender) {
|
||||
cartRenderSteps.get(index).render(tradeDTO);
|
||||
try {
|
||||
cartRenderSteps.get(index).render(tradeDTO);
|
||||
} catch (Exception e) {
|
||||
log.error("购物车渲染异常:", e);
|
||||
}
|
||||
}
|
||||
List<CartVO> cartVOList = new ArrayList<>();
|
||||
for (CartVO i : tradeDTO.getCartList()) {
|
||||
|
@ -11,6 +11,7 @@ import cn.lili.modules.store.entity.dto.FreightTemplateChildDTO;
|
||||
import cn.lili.modules.store.entity.enums.FreightTemplateEnum;
|
||||
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
|
||||
import cn.lili.modules.store.service.FreightTemplateService;
|
||||
import com.xkcoding.http.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -43,8 +44,8 @@ public class SkuFreightRender implements CartRenderStep {
|
||||
forSku:
|
||||
for (CartSkuVO cartSkuVO : cartSkuVOS) {
|
||||
String freightTemplateId = cartSkuVO.getGoodsSku().getFreightTemplateId();
|
||||
//如果商品设置卖家承担运费,则跳出计算
|
||||
if (cartSkuVO.getFreightPayer().equals("STORE")) {
|
||||
//如果商品设置卖家承担运费,或者没设置运费,则跳出此商品运费计算
|
||||
if (StringUtil.isEmpty(cartSkuVO.getFreightPayer())||cartSkuVO.getFreightPayer().equals("STORE")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import cn.lili.modules.promotion.entity.dto.PromotionPriceParamDTO;
|
||||
import cn.lili.modules.promotion.entity.dto.StorePromotionPriceDTO;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import cn.lili.modules.promotion.service.PromotionPriceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -27,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -151,29 +151,26 @@ public class SkuPromotionRender implements CartRenderStep {
|
||||
|
||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||
// 根据店铺分配店铺价格计算结果
|
||||
List<StorePromotionPriceDTO> collect = promotionPrice.getStorePromotionPriceList().parallelStream().map(i -> i.getStoreId().equals(cartVO.getStoreId()) ? i : null).collect(Collectors.toList());
|
||||
if (!collect.isEmpty() && collect.get(0) != null) {
|
||||
StorePromotionPriceDTO storePromotionPriceDTO = collect.get(0);
|
||||
Optional<StorePromotionPriceDTO> storePromotionPriceDTOOptional = promotionPrice.getStorePromotionPriceList().parallelStream().filter(i -> i.getStoreId().equals(cartVO.getStoreId())).findAny();
|
||||
if (storePromotionPriceDTOOptional.isPresent()) {
|
||||
StorePromotionPriceDTO storePromotionPriceDTO = storePromotionPriceDTOOptional.get();
|
||||
// 根据商品分配商品结果计算结果
|
||||
this.distributionSkuPromotionPrice(cartVO.getSkuList(), storePromotionPriceDTO);
|
||||
|
||||
if (storePromotionPriceDTO != null) {
|
||||
PriceDetailDTO sSpd = new PriceDetailDTO();
|
||||
PriceDetailVO sPd = new PriceDetailVO();
|
||||
sSpd.setGoodsPrice(storePromotionPriceDTO.getTotalOriginPrice());
|
||||
sSpd.setDiscountPrice(storePromotionPriceDTO.getTotalDiscountPrice());
|
||||
sSpd.setCouponPrice(storePromotionPriceDTO.getTotalCouponPrice());
|
||||
sSpd.setPayPoint(storePromotionPriceDTO.getTotalPoints().intValue());
|
||||
|
||||
sPd.setOriginalPrice(storePromotionPriceDTO.getTotalOriginPrice());
|
||||
sPd.setFinalePrice(storePromotionPriceDTO.getTotalFinalePrice());
|
||||
sPd.setDiscountPrice(storePromotionPriceDTO.getTotalDiscountPrice());
|
||||
sPd.setPayPoint(storePromotionPriceDTO.getTotalPoints().intValue());
|
||||
cartVO.setPriceDetailDTO(sSpd);
|
||||
cartVO.setPriceDetailVO(sPd);
|
||||
cartVO.setWeight(storePromotionPriceDTO.getTotalWeight());
|
||||
}
|
||||
PriceDetailDTO sSpd = new PriceDetailDTO();
|
||||
PriceDetailVO sPd = new PriceDetailVO();
|
||||
sSpd.setGoodsPrice(storePromotionPriceDTO.getTotalOriginPrice());
|
||||
sSpd.setDiscountPrice(storePromotionPriceDTO.getTotalDiscountPrice());
|
||||
sSpd.setCouponPrice(storePromotionPriceDTO.getTotalCouponPrice());
|
||||
sSpd.setPayPoint(storePromotionPriceDTO.getTotalPoints().intValue());
|
||||
|
||||
sPd.setOriginalPrice(storePromotionPriceDTO.getTotalOriginPrice());
|
||||
sPd.setFinalePrice(storePromotionPriceDTO.getTotalFinalePrice());
|
||||
sPd.setDiscountPrice(storePromotionPriceDTO.getTotalDiscountPrice());
|
||||
sPd.setPayPoint(storePromotionPriceDTO.getTotalPoints().intValue());
|
||||
cartVO.setPriceDetailDTO(sSpd);
|
||||
cartVO.setPriceDetailVO(sPd);
|
||||
cartVO.setWeight(storePromotionPriceDTO.getTotalWeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,6 +269,9 @@ public class CartServiceImpl implements CartService {
|
||||
}
|
||||
}
|
||||
cartSkuVOS.removeAll(deleteVos);
|
||||
// 清除选择的优惠券
|
||||
tradeDTO.setPlatformCoupon(null);
|
||||
tradeDTO.setStoreCoupons(null);
|
||||
// 清除添加过的备注
|
||||
tradeDTO.setStoreRemark(null);
|
||||
cache.put(this.getOriginKey(tradeDTO.getCartTypeEnum()), tradeDTO);
|
||||
@ -291,7 +294,7 @@ public class CartServiceImpl implements CartService {
|
||||
|
||||
@Override
|
||||
public TradeDTO getCheckedTradeDTO(CartTypeEnum way) {
|
||||
return tradeBuilder.buildTrade(way);
|
||||
return this.readDTO(way);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -440,7 +443,9 @@ public class CartServiceImpl implements CartService {
|
||||
*/
|
||||
@Override
|
||||
public Long getCartNum(Boolean checked) {
|
||||
//构建购物车
|
||||
TradeDTO tradeDTO = this.getCheckedTradeDTO(CartTypeEnum.CART);
|
||||
//过滤sku列表
|
||||
List<CartSkuVO> collect = tradeDTO.getSkuList().stream().filter(i -> Boolean.FALSE.equals(i.getInvalid())).collect(Collectors.toList());
|
||||
long count = 0L;
|
||||
if (!tradeDTO.getSkuList().isEmpty()) {
|
||||
@ -455,12 +460,17 @@ public class CartServiceImpl implements CartService {
|
||||
|
||||
@Override
|
||||
public void selectCoupon(String couponId, String way, boolean use) {
|
||||
//获取购物车,然后重新写入优惠券
|
||||
CartTypeEnum cartTypeEnum = getCartType(way);
|
||||
TradeDTO tradeDTO = tradeBuilder.buildTrade(cartTypeEnum);
|
||||
TradeDTO tradeDTO = this.readDTO(cartTypeEnum);
|
||||
|
||||
MemberCoupon memberCoupon = memberCouponService.getOne(new LambdaQueryWrapper<MemberCoupon>().eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name()).eq(MemberCoupon::getId, couponId));
|
||||
MemberCoupon memberCoupon =
|
||||
memberCouponService.getOne(
|
||||
new LambdaQueryWrapper<MemberCoupon>()
|
||||
.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name())
|
||||
.eq(MemberCoupon::getId, couponId));
|
||||
if (memberCoupon == null) {
|
||||
throw new ServiceException("当前优惠券可用数量不足");
|
||||
throw new ServiceException(ResultCode.COUPON_EXPIRED);
|
||||
}
|
||||
//使用优惠券 与否
|
||||
if (use && checkCoupon(memberCoupon, tradeDTO)) {
|
||||
@ -534,6 +544,12 @@ public class CartServiceImpl implements CartService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车类型
|
||||
*
|
||||
* @param way
|
||||
* @return
|
||||
*/
|
||||
private CartTypeEnum getCartType(String way) {
|
||||
//默认购物车
|
||||
CartTypeEnum cartTypeEnum = CartTypeEnum.CART;
|
||||
|
@ -117,7 +117,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
||||
promotionMessage,
|
||||
coupon.getStartTime().getTime(), couponVO.getStartTime().getTime(),
|
||||
DelayQueueTools.wrapperUniqueKey(DelayQueueType.PROMOTION, (promotionMessage.getPromotionType() + promotionMessage.getPromotionId())),
|
||||
DateUtil.getDelayTime(coupon.getStartTime().getTime()),
|
||||
DateUtil.getDelayTime(couponVO.getStartTime().getTime()),
|
||||
rocketmqCustomProperties.getPromotionTopic());
|
||||
return couponVO;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class PintuanServiceImpl extends ServiceImpl<PintuanMapper, Pintuan> impl
|
||||
pintuanVO.getStartTime().getTime(),
|
||||
pintuan.getStartTime().getTime(),
|
||||
DelayQueueTools.wrapperUniqueKey(DelayQueueType.PROMOTION, (promotionMessage.getPromotionType() + promotionMessage.getPromotionId())),
|
||||
DateUtil.getDelayTime(pintuan.getStartTime().getTime()),
|
||||
DateUtil.getDelayTime(pintuanVO.getStartTime().getTime()),
|
||||
rocketmqCustomProperties.getPromotionTopic());
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,10 @@ public class PromotionPriceServiceImpl implements PromotionPriceService {
|
||||
if (platformCoupons != null && !platformCoupons.isEmpty()) {
|
||||
// 计算平台优惠券活动
|
||||
couponTotalPrice = CurrencyUtil.add(couponTotalPrice, this.calculationCoupon(platformCoupons, priceDTOList));
|
||||
for (StorePromotionPriceDTO storePromotionPriceDTO : storePromotionPriceList) {
|
||||
Double couponPrice = storePromotionPriceDTO.getGoodsSkuPromotionPriceList().parallelStream().mapToDouble(GoodsSkuPromotionPriceDTO::getCouponPrice).sum();
|
||||
storePromotionPriceDTO.setTotalCouponPrice(couponPrice);
|
||||
}
|
||||
}
|
||||
promotionPrice.setStorePromotionPriceList(storePromotionPriceList);
|
||||
promotionPrice.setTotalCouponPrice(couponTotalPrice);
|
||||
@ -290,17 +294,14 @@ public class PromotionPriceServiceImpl implements PromotionPriceService {
|
||||
// 合计优惠券范围内的所有商品的原价
|
||||
double totalPrice = conformCollect.parallelStream().mapToDouble(GoodsSkuPromotionPriceDTO::getOriginalPrice).sum();
|
||||
|
||||
double discountPrice = 0;
|
||||
// 根据优惠券优惠类型,判断是否满足条件
|
||||
if (CouponTypeEnum.PRICE.name().equals(coupon.getCouponType()) && coupon.getConsumeThreshold() <= totalPrice) {
|
||||
couponTotalPrice = CurrencyUtil.add(couponTotalPrice, coupon.getPrice());
|
||||
discountPrice = coupon.getPrice();
|
||||
} else if (CouponTypeEnum.DISCOUNT.name().equals(coupon.getCouponType())) {
|
||||
double fullRate = coupon.getDiscount() >= 10 ? coupon.getDiscount() / 100 : coupon.getDiscount() / 10;
|
||||
double discountRatePrice = CurrencyUtil.sub(totalPrice, CurrencyUtil.mul(totalPrice, fullRate));
|
||||
|
||||
couponTotalPrice = CurrencyUtil.add(couponTotalPrice, discountRatePrice);
|
||||
discountPrice = discountRatePrice;
|
||||
// 消费限额判断
|
||||
// if (coupon.getConsumeThreshold() >= discountRatePrice) {
|
||||
// couponTotalPrice = CurrencyUtil.add(couponTotalPrice, discountRatePrice);
|
||||
@ -312,14 +313,15 @@ public class PromotionPriceServiceImpl implements PromotionPriceService {
|
||||
}
|
||||
|
||||
// 分配到每个商品的优惠券金额
|
||||
double distributePrice = CurrencyUtil.div(discountPrice, conformCollect.size());
|
||||
for (GoodsSkuPromotionPriceDTO goodsSkuPromotionPriceDTO : conformCollect) {
|
||||
double rate = CurrencyUtil.div(goodsSkuPromotionPriceDTO.getFinalePrice(), totalPrice, 5);
|
||||
double distributeCouponPrice = CurrencyUtil.mul(couponTotalPrice, rate);
|
||||
if (goodsSkuPromotionPriceDTO.getFinalePrice() != null) {
|
||||
goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getFinalePrice(), distributePrice));
|
||||
goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getFinalePrice(), distributeCouponPrice));
|
||||
} else {
|
||||
goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getOriginalPrice(), distributePrice));
|
||||
goodsSkuPromotionPriceDTO.setFinalePrice(CurrencyUtil.sub(goodsSkuPromotionPriceDTO.getOriginalPrice(), distributeCouponPrice));
|
||||
}
|
||||
goodsSkuPromotionPriceDTO.setCouponPrice(distributePrice);
|
||||
goodsSkuPromotionPriceDTO.setCouponPrice(distributeCouponPrice);
|
||||
goodsSkuPromotionPriceDTO.setTotalFinalePrice(CurrencyUtil.mul(goodsSkuPromotionPriceDTO.getFinalePrice(), goodsSkuPromotionPriceDTO.getNumber()));
|
||||
BasePromotion basePromotion = new BasePromotion();
|
||||
basePromotion.setId(coupon.getId());
|
||||
|
@ -105,6 +105,12 @@ public interface EsGoodsIndexService {
|
||||
*/
|
||||
void deleteEsGoodsPromotionIndexByList(List<String> skuIds, PromotionTypeEnum promotionType);
|
||||
|
||||
/**
|
||||
* 删除索引中指定的促销活动id的促销活动
|
||||
* @param skuId 商品skuId
|
||||
* @param promotionId 促销活动Id
|
||||
*/
|
||||
void deleteEsGoodsPromotionByPromotionId(String skuId, String promotionId);
|
||||
/**
|
||||
* 清除所以商品索引的无效促销活动
|
||||
*/
|
||||
|
@ -203,7 +203,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
||||
@Override
|
||||
public void updateEsGoodsIndexAllByList(BasePromotion promotion, String key) {
|
||||
List<EsGoodsIndex> goodsIndices;
|
||||
//如果storeid不为空,则表示是店铺活动
|
||||
//如果storeId不为空,则表示是店铺活动
|
||||
if (promotion.getStoreId() != null) {
|
||||
EsGoodsSearchDTO searchDTO = new EsGoodsSearchDTO();
|
||||
searchDTO.setStoreId(promotion.getStoreId());
|
||||
@ -243,6 +243,41 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEsGoodsPromotionByPromotionId(String skuId, String promotionId) {
|
||||
if (skuId != null) {
|
||||
EsGoodsIndex goodsIndex = findById(skuId);
|
||||
//商品索引不为空
|
||||
if (goodsIndex != null) {
|
||||
this.removePromotionByPromotionId(goodsIndex, promotionId);
|
||||
} else {
|
||||
log.error("更新索引商品促销信息失败!skuId 为 【{}】的索引不存在!", skuId);
|
||||
}
|
||||
} else {
|
||||
for (EsGoodsIndex goodsIndex : this.goodsIndexRepository.findAll()) {
|
||||
this.removePromotionByPromotionId(goodsIndex, promotionId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 从索引中删除指定促销活动id的促销活动
|
||||
*
|
||||
* @param goodsIndex 索引
|
||||
* @param promotionId 促销活动id
|
||||
*/
|
||||
private void removePromotionByPromotionId(EsGoodsIndex goodsIndex, String promotionId) {
|
||||
Map<String, Object> promotionMap = goodsIndex.getPromotionMap();
|
||||
if (promotionMap != null && !promotionMap.isEmpty()) {
|
||||
// 如果存在同类型促销活动删除
|
||||
List<String> collect = promotionMap.keySet().stream().filter(i -> i.split("-")[1].equals(promotionId)).collect(Collectors.toList());
|
||||
collect.forEach(promotionMap::remove);
|
||||
goodsIndex.setPromotionMap(promotionMap);
|
||||
updateIndex(goodsIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有商品索引的无效促销活动
|
||||
*/
|
||||
|
@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.lucene.search.join.ScoreMode;
|
||||
import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.NestedQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
|
||||
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
|
||||
@ -256,7 +257,11 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
private NativeSearchQueryBuilder createSearchQueryBuilder(EsGoodsSearchDTO searchDTO, PageVO pageVo, boolean isAggregation) {
|
||||
NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
|
||||
if (pageVo != null) {
|
||||
Pageable pageable = PageRequest.of(pageVo.getPageNumber(), pageVo.getPageSize());
|
||||
Integer pageNumber = pageVo.getPageNumber() - 1;
|
||||
if (pageNumber < 0) {
|
||||
pageNumber = 0;
|
||||
}
|
||||
Pageable pageable = PageRequest.of(pageNumber, pageVo.getPageSize());
|
||||
//分页
|
||||
nativeSearchQueryBuilder.withPageable(pageable);
|
||||
}
|
||||
@ -336,6 +341,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
String[] props = searchDTO.getProp().split("@");
|
||||
List<String> nameList = new ArrayList<>();
|
||||
List<String> valueList = new ArrayList<>();
|
||||
Map<String, List<String>> valueMap = new HashMap<>();
|
||||
for (String prop : props) {
|
||||
String[] propValues = prop.split("_");
|
||||
String name = propValues[0];
|
||||
@ -346,14 +352,29 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
if (!valueList.contains(value)) {
|
||||
valueList.add(value);
|
||||
}
|
||||
if (isAggregation) {
|
||||
filterBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.termQuery(ATTR_NAME, name), ScoreMode.None));
|
||||
filterBuilder.should(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.termsQuery(ATTR_VALUE, value), ScoreMode.None));
|
||||
// 将同一规格名下的规格值分组
|
||||
if (!valueMap.containsKey(name)) {
|
||||
List<String> values = new ArrayList<>();
|
||||
values.add(value);
|
||||
valueMap.put(name, values);
|
||||
} else {
|
||||
queryBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.termQuery(ATTR_NAME, name), ScoreMode.None));
|
||||
queryBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_VALUE, "*" + value + "*"), ScoreMode.None));
|
||||
valueMap.get(name).add(value);
|
||||
}
|
||||
|
||||
}
|
||||
BoolQueryBuilder usedQueryBuilder;
|
||||
if (isAggregation) {
|
||||
usedQueryBuilder = filterBuilder;
|
||||
} else {
|
||||
usedQueryBuilder = queryBuilder;
|
||||
}
|
||||
// 遍历所有的规格
|
||||
for (Map.Entry<String, List<String>> entry : valueMap.entrySet()) {
|
||||
usedQueryBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_NAME, "*" + entry.getKey() + "*"), ScoreMode.None));
|
||||
BoolQueryBuilder shouldBuilder = QueryBuilders.boolQuery();
|
||||
for (String s : entry.getValue()) {
|
||||
shouldBuilder.should(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_VALUE, "*" + s + "*"), ScoreMode.None));
|
||||
}
|
||||
usedQueryBuilder.must(shouldBuilder);
|
||||
}
|
||||
searchDTO.getNotShowCol().put(ATTR_NAME_KEY, nameList);
|
||||
searchDTO.getNotShowCol().put(ATTR_VALUE_KEY, valueList);
|
||||
|
@ -30,7 +30,7 @@ import java.util.Date;
|
||||
@Table(name = "li_app_version")
|
||||
@TableName("li_app_version")
|
||||
@ApiModel(value = "app版本控制")
|
||||
public class AppVersionDO{
|
||||
public class AppVersion {
|
||||
|
||||
private static final long serialVersionUID = 3034686331756935L;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.lili.modules.system.mapper;
|
||||
|
||||
import cn.lili.modules.system.entity.dos.AppVersionDO;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* app版本控制数据处理层
|
||||
@ -9,6 +10,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 8:01 下午
|
||||
*/
|
||||
public interface AppVersionMapper extends BaseMapper<AppVersionDO> {
|
||||
public interface AppVersionMapper extends BaseMapper<AppVersion> {
|
||||
|
||||
@Select("SELECT * FROM li_app_version WHERE type=#{appType} ORDER BY version_update_date DESC LIMIT 1")
|
||||
AppVersion getLatestVersion(String appType);
|
||||
|
||||
}
|
@ -1,15 +1,27 @@
|
||||
package cn.lili.modules.system.service;
|
||||
|
||||
import cn.lili.modules.system.entity.dos.AppVersionDO;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 物流公司业务层
|
||||
* app版本业务层
|
||||
*
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 8:02 下午
|
||||
*/
|
||||
public interface AppVersionService extends IService<AppVersionDO> {
|
||||
public interface AppVersionService extends IService<AppVersion> {
|
||||
|
||||
/**
|
||||
* 获取当前最新的APP版本
|
||||
* 获取用户的APP类型,返回最新的数据的版本号
|
||||
* @return 最新的APP版本号
|
||||
*/
|
||||
AppVersion getAppVersion(String appType);
|
||||
|
||||
/**
|
||||
* 检测APP版本信息
|
||||
* @param appVersion app版本
|
||||
* @return 是否可添加
|
||||
*/
|
||||
boolean checkAppVersion(AppVersion appVersion);
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
package cn.lili.modules.system.serviceimpl;
|
||||
|
||||
import cn.lili.modules.system.entity.dos.AppVersionDO;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import cn.lili.modules.system.mapper.AppVersionMapper;
|
||||
import cn.lili.modules.system.service.AppVersionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -16,6 +19,19 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersionDO> implements AppVersionService {
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
|
||||
|
||||
@Override
|
||||
public AppVersion getAppVersion(String appType) {
|
||||
return this.baseMapper.getLatestVersion(appType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAppVersion(AppVersion appVersion) {
|
||||
//检测版本是否存在
|
||||
if(null!=this.getOne(new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getVersion,appVersion))){
|
||||
throw new ServiceException(ResultCode.APP_VERSION_EXIST);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
||||
* @throws Exception
|
||||
*/
|
||||
private Traces getOrderTracesByJson(String logisticsId, String expNo) throws Exception {
|
||||
Setting setting = settingService.getById(SettingEnum.KUAIDI_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.KUAIDI_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置快递查询");
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.AppVersionDO;
|
||||
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||
import cn.lili.modules.system.service.AppVersionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -34,34 +34,40 @@ public class AppVersionManagerController {
|
||||
private AppVersionService appVersionService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询app升级消息", response = AppVersionDO.class)
|
||||
@ApiOperation(value = "查询app升级消息", response = AppVersion.class)
|
||||
@GetMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "APP类型", required = true, dataType = "type", paramType = "query")
|
||||
})
|
||||
public ResultMessage<IPage<AppVersionDO>> getByPage(PageVO page, String type) {
|
||||
public ResultMessage<IPage<AppVersion>> getByPage(PageVO page, String type) {
|
||||
return ResultUtil.data(this.appVersionService.page(PageUtil.initPage(page),
|
||||
new QueryWrapper<AppVersionDO>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
|
||||
new QueryWrapper<AppVersion>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "添加app版本信息", response = AppVersionDO.class)
|
||||
@ApiOperation(value = "添加app版本信息", response = AppVersion.class)
|
||||
@PostMapping
|
||||
public ResultMessage<Object> add(@Valid AppVersionDO appVersionDO) {
|
||||
if(this.appVersionService.save(appVersionDO)){
|
||||
return ResultUtil.success();
|
||||
public ResultMessage<Object> add(@Valid AppVersion appVersion) {
|
||||
|
||||
if(this.appVersionService.checkAppVersion(appVersion)){
|
||||
if(this.appVersionService.save(appVersion)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@ApiOperation(value = "修改app版本信息", response = AppVersionDO.class)
|
||||
@ApiOperation(value = "修改app版本信息", response = AppVersion.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> edit(@Valid AppVersionDO appVersionDO, @PathVariable String id) {
|
||||
if(this.appVersionService.updateById(appVersionDO)){
|
||||
return ResultUtil.success();
|
||||
public ResultMessage<Object> edit(@Valid AppVersion appVersion, @PathVariable String id) {
|
||||
|
||||
if(this.appVersionService.checkAppVersion(appVersion)){
|
||||
if(this.appVersionService.updateById(appVersion)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
@ -132,22 +132,6 @@ ignored:
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /buyer/mini-program/**
|
||||
- /buyer/cashier/**
|
||||
- /buyer/pageData/**
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/shop/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/smsLogin
|
||||
- /buyer/members/refresh/*
|
||||
- /buyer/members/refresh**
|
||||
- /buyer/promotion/pintuan
|
||||
- /buyer/promotion/seckill
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /manager/elasticsearch
|
||||
|
@ -132,24 +132,7 @@ ignored:
|
||||
- /MP_verify_qSyvBPhDsPdxvOhC.txt
|
||||
- /weixin/**
|
||||
- /source/**
|
||||
- /buyer/mini-program/**
|
||||
- /buyer/cashier/**
|
||||
- /buyer/pageData/**
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/shop/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/smsLogin
|
||||
- /buyer/members/refresh/*
|
||||
- /buyer/members/refresh**
|
||||
- /buyer/promotion/pintuan
|
||||
- /buyer/promotion/seckill
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /store/login/**
|
||||
- /manager/user/login
|
||||
- /manager/user/refresh/**
|
||||
- /druid/**
|
||||
- /swagger-ui.html
|
||||
- /doc.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user