diff --git a/buyer-api/src/main/java/cn/lili/controller/member/FootprintController.java b/buyer-api/src/main/java/cn/lili/controller/member/FootprintController.java index 256603f93..e5de7c6be 100644 --- a/buyer-api/src/main/java/cn/lili/controller/member/FootprintController.java +++ b/buyer-api/src/main/java/cn/lili/controller/member/FootprintController.java @@ -5,6 +5,7 @@ import cn.lili.common.vo.ResultMessage; import cn.lili.modules.member.service.FootprintService; import cn.lili.modules.search.entity.dos.EsGoodsIndex; +import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -34,7 +35,7 @@ public class FootprintController { @ApiOperation(value = "分页获取") @GetMapping - public ResultMessage> getByPage(PageVO page) { + public ResultMessage> getByPage(PageVO page) { return ResultUtil.data(footprintService.footPrintPage(page)); } diff --git a/common-api/src/main/java/cn/lili/controller/common/SiteController.java b/common-api/src/main/java/cn/lili/controller/common/SiteController.java new file mode 100644 index 000000000..70b323283 --- /dev/null +++ b/common-api/src/main/java/cn/lili/controller/common/SiteController.java @@ -0,0 +1,33 @@ +package cn.lili.controller.common; + +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.system.entity.enums.SettingEnum; +import cn.lili.modules.system.service.SettingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 滑块验证码接口 + * + * @author Chopper + * @since 2020/11/26 15:41 + */ +@Slf4j +@RestController +@RequestMapping("/common/common/site") +@Api(tags = "系统基础接口") +public class SiteController { + + @Autowired + private SettingService settingService; + + @ApiOperation(value = "获取系统基础信息") + @GetMapping + public ResultMessage getFileList() { + return ResultUtil.data(settingService.get(SettingEnum.BASE_SETTING.name())); + } +} diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/OnlineMemberStatistics.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/OnlineMemberStatistics.java index 8cffcd84b..1afdac4cb 100644 --- a/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/OnlineMemberStatistics.java +++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/OnlineMemberStatistics.java @@ -56,10 +56,12 @@ public void execute() { Calendar finalCalendar = calendar; - AtomicReference lastNum = new AtomicReference<>(1); + AtomicReference lastNum = new AtomicReference<>(0); onlineMemberVOS = onlineMemberVOS.stream() .filter(onlineMemberVO -> { - lastNum.set(onlineMemberVO.getNum()); + if (onlineMemberVO.getDate().before(finalCalendar.getTime())) { + lastNum.set(onlineMemberVO.getNum()); + } return onlineMemberVO.getDate().after(finalCalendar.getTime()); }) .collect(Collectors.toList()); diff --git a/framework/src/main/java/cn/lili/common/utils/StringUtils.java b/framework/src/main/java/cn/lili/common/utils/StringUtils.java index f3ae80e19..bf9df5b64 100644 --- a/framework/src/main/java/cn/lili/common/utils/StringUtils.java +++ b/framework/src/main/java/cn/lili/common/utils/StringUtils.java @@ -147,6 +147,20 @@ public static String appendIfNotContain(String str, String appendStr, String oth return str.concat(appendStr); } + /** + * 切割字符串 + * + * @param str 字符串 + * @param length 长度 + * @return 处理后的字符串 + */ + public static String sub(String str, Integer length) { + if (str.length() < length) { + return str; + } + return str.substring(0, length); + } + /** * 过滤特殊字符串 * diff --git a/framework/src/main/java/cn/lili/modules/member/mapper/FootprintMapper.java b/framework/src/main/java/cn/lili/modules/member/mapper/FootprintMapper.java index 6638d6181..f65c731ba 100644 --- a/framework/src/main/java/cn/lili/modules/member/mapper/FootprintMapper.java +++ b/framework/src/main/java/cn/lili/modules/member/mapper/FootprintMapper.java @@ -18,17 +18,6 @@ * @since 2020-02-25 14:10:16 */ public interface FootprintMapper extends BaseMapper { - - /** - * 获取用户足迹的SkuId分页 - * - * @param page 分页 - * @param queryWrapper 查询条件 - * @return 用户足迹的SkuId分页 - */ - @Select("select sku_id from li_foot_print ${ew.customSqlSegment} ") - List footprintSkuIdList(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper); - /** * 删除超过100条后的记录 * diff --git a/framework/src/main/java/cn/lili/modules/member/service/FootprintService.java b/framework/src/main/java/cn/lili/modules/member/service/FootprintService.java index fc5d8ca31..3005ce967 100644 --- a/framework/src/main/java/cn/lili/modules/member/service/FootprintService.java +++ b/framework/src/main/java/cn/lili/modules/member/service/FootprintService.java @@ -3,6 +3,7 @@ import cn.lili.common.vo.PageVO; import cn.lili.modules.member.entity.dos.FootPrint; import cn.lili.modules.search.entity.dos.EsGoodsIndex; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -44,7 +45,7 @@ public interface FootprintService extends IService { * @param pageVO 分页 * @return 会员浏览历史列表 */ - List footPrintPage(PageVO pageVO); + IPage footPrintPage(PageVO pageVO); /** * 获取当前会员的浏览记录数量 diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/FootprintServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/FootprintServiceImpl.java index 0fea8a253..d5b315b82 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/FootprintServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/FootprintServiceImpl.java @@ -9,7 +9,9 @@ import cn.lili.modules.search.service.EsGoodsSearchService; import cn.lili.mybatis.util.PageUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +21,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * 会员浏览历史业务层实现 @@ -29,9 +32,7 @@ @Service public class FootprintServiceImpl extends ServiceImpl implements FootprintService { - /** - * es商品业务层 - */ + @Autowired private EsGoodsSearchService esGoodsSearchService; @@ -74,20 +75,35 @@ public boolean deleteByIds(List ids) { } @Override - public List footPrintPage(PageVO pageVO) { + public IPage footPrintPage(PageVO pageVO) { LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(FootPrint::getMemberId, UserContext.getCurrentUser().getId()); lambdaQueryWrapper.eq(FootPrint::getDeleteFlag, false); - lambdaQueryWrapper.orderByDesc(FootPrint::getUpdateTime); - List skuIdList = this.baseMapper.footprintSkuIdList(PageUtil.initPage(pageVO), lambdaQueryWrapper); - if (!skuIdList.isEmpty()) { - List list = esGoodsSearchService.getEsGoodsBySkuIds(skuIdList); + lambdaQueryWrapper.orderByDesc(FootPrint::getCreateTime); + IPage footPrintPages = this.page(PageUtil.initPage(pageVO), lambdaQueryWrapper); + + + //定义结果 + IPage esGoodsIndexIPage = new Page(); + + if (footPrintPages.getRecords() == null || footPrintPages.getRecords().isEmpty()) { + return esGoodsIndexIPage; + } else { + List list = esGoodsSearchService.getEsGoodsBySkuIds( + footPrintPages.getRecords().stream().map(item -> { + return item.getSkuId(); + }).collect(Collectors.toList())); //去除为空的商品数据 list.removeIf(Objects::isNull); - return list; + + esGoodsIndexIPage.setPages(footPrintPages.getPages()); + esGoodsIndexIPage.setRecords(list); + esGoodsIndexIPage.setTotal(footPrintPages.getTotal()); + esGoodsIndexIPage.setSize(footPrintPages.getSize()); + esGoodsIndexIPage.setCurrent(footPrintPages.getCurrent()); + return esGoodsIndexIPage; } - return Collections.emptyList(); } @Override diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/StoreFlowServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/StoreFlowServiceImpl.java index 3a1e6c8b8..dfe3e1af5 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/StoreFlowServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/StoreFlowServiceImpl.java @@ -76,18 +76,16 @@ public void payOrder(String orderSn) { List orderItems = orderItemService.getByOrderSn(orderSn); //根据订单编号获取订单数据 Order order = orderService.getBySn(orderSn); - //如果查询到多条支付记录,打印日志 - if (order.getPayStatus().equals(PayStatusEnum.PAID.name())) { - log.error("订单[{}]检测到重复付款,请处理", orderSn); - } - //获取订单促销类型,如果为促销订单则获取促销商品并获取结算价 String orderPromotionType = order.getOrderPromotionType(); + //循环子订单记录流水 for (OrderItem item : orderItems) { StoreFlow storeFlow = new StoreFlow(); BeanUtil.copyProperties(item, storeFlow); + //去掉orderitem的时间。 + storeFlow.setCreateTime(null); //入账 storeFlow.setId(SnowFlake.getIdStr()); storeFlow.setFlowType(FlowTypeEnum.PAY.name()); @@ -102,24 +100,28 @@ public void payOrder(String orderSn) { storeFlow.setOrderPromotionType(item.getPromotionType()); //格式化订单价格详情 PriceDetailDTO priceDetailDTO = JSONUtil.toBean(item.getPriceDetail(), PriceDetailDTO.class); - //站点优惠券佣金比例 + //站点优惠券比例=最大比例(100)-店铺承担比例 storeFlow.setSiteCouponPoint(CurrencyUtil.sub(100,priceDetailDTO.getSiteCouponPoint())); //平台优惠券 使用金额 storeFlow.setSiteCouponPrice(priceDetailDTO.getSiteCouponPrice()); //站点优惠券佣金(站点优惠券承担金额=优惠券金额 * (站点承担比例/100)) storeFlow.setSiteCouponCommission(CurrencyUtil.mul(storeFlow.getSiteCouponPrice(),CurrencyUtil.div(storeFlow.getSiteCouponPoint(),100))); - //计算平台佣金 - storeFlow.setCommissionPrice(item.getPriceDetailDTO().getPlatFormCommission()); - //订单流水金额 + /** + * @TODO 计算平台佣金 + */ + //店铺流水金额=goodsPrice(商品总金额(商品原价))+ freightPrice(配送费) - discountPrice(优惠金额) - couponPrice(优惠券金额) + updatePrice(订单修改金额) storeFlow.setFinalPrice(item.getPriceDetailDTO().getFlowPrice()); + //平台收取交易佣金=(flowPrice(流水金额) * platFormCommissionPoint(平台佣金比例))/100 + storeFlow.setCommissionPrice(item.getPriceDetailDTO().getPlatFormCommission()); + //单品分销返现支出 storeFlow.setDistributionRebate(item.getPriceDetailDTO().getDistributionCommission()); + //最终结算金额=flowPrice(流水金额) - platFormCommission(平台收取交易佣金) - distributionCommission(单品分销返现支出) storeFlow.setBillPrice(item.getPriceDetailDTO().getBillPrice()); //兼容为空,以及普通订单操作 if (CharSequenceUtil.isNotEmpty(orderPromotionType)) { if (orderPromotionType.equals(OrderPromotionTypeEnum.NORMAL.name())) { //普通订单操作 - } //如果为砍价活动,填写砍价结算价 else if (orderPromotionType.equals(OrderPromotionTypeEnum.KANJIA.name())) { diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/params/dto/CashierParam.java b/framework/src/main/java/cn/lili/modules/payment/kit/params/dto/CashierParam.java index 577cd13c3..4bdfcbe5d 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/params/dto/CashierParam.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/params/dto/CashierParam.java @@ -18,6 +18,8 @@ @ToString public class CashierParam { + static Long MAX_DETAIL_LENGTH = 30L; + @ApiModelProperty(value = "价格") private Double price; @@ -47,6 +49,6 @@ public String getDetail() { if (StringUtils.isEmpty(detail)) { return "清单详细"; } - return StringUtils.filterSpecialChart(detail); + return StringUtils.filterSpecialChart(StringUtils.sub(detail, 30)); } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/model/UnifiedOrderModel.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/model/UnifiedOrderModel.java index 25d5a3ca2..52aeff506 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/model/UnifiedOrderModel.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/model/UnifiedOrderModel.java @@ -1,5 +1,7 @@ package cn.lili.modules.payment.kit.plugin.wechat.model; +import cn.hutool.json.JSONUtil; +import cn.lili.common.utils.StringUtils; import lombok.Data; import lombok.experimental.Accessors; @@ -42,6 +44,7 @@ public class UnifiedOrderModel { * 商品描述 */ private String description; + /** * 商户订单号 */ @@ -82,6 +85,7 @@ public class UnifiedOrderModel { * 场景信息 */ private SceneInfo scene_info; + } diff --git a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewServiceImpl.java b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewServiceImpl.java index f1263659b..5d824068c 100644 --- a/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/PlatformViewServiceImpl.java @@ -131,7 +131,7 @@ private List initData(List source) { calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); - calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - statisticsProperties.getOnlineMember() - 1); + calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - statisticsProperties.getOnlineMember()); //循环填充数据 for (int i = 0; i < statisticsProperties.getOnlineMember(); i++) { calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) + 1); diff --git a/manager-api/src/main/java/cn/lili/controller/other/ArticleManagerController.java b/manager-api/src/main/java/cn/lili/controller/other/ArticleManagerController.java index ea8e22ab6..d9372124a 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/ArticleManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/ArticleManagerController.java @@ -42,6 +42,14 @@ public ResultMessage
get(@PathVariable String id) { return ResultUtil.data(articleService.getById(id)); } + @ApiOperation(value = "根据类型查看文章") + @ApiImplicitParam(name = "type", value = "文章类型", required = true, dataType = "String", paramType = "path") + @GetMapping(value = "/type/{type}") + public ResultMessage
getByType(@PathVariable String type) { + + return ResultUtil.data(articleService.customGetByType(type)); + } + @ApiOperation(value = "分页获取") @ApiImplicitParams({ @ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),