Skip to content

Commit

Permalink
Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop i…
Browse files Browse the repository at this point in the history
…nto feature/pg
  • Loading branch information
LeiGaoRobot committed May 19, 2022
2 parents f2b327c + 7fccbc2 commit fafe3c0
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -34,7 +35,7 @@ public class FootprintController {

@ApiOperation(value = "分页获取")
@GetMapping
public ResultMessage<List<EsGoodsIndex>> getByPage(PageVO page) {
public ResultMessage<IPage<EsGoodsIndex>> getByPage(PageVO page) {
return ResultUtil.data(footprintService.footPrintPage(page));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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<Object> getFileList() {
return ResultUtil.data(settingService.get(SettingEnum.BASE_SETTING.name()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ public void execute() {

Calendar finalCalendar = calendar;

AtomicReference<Integer> lastNum = new AtomicReference<>(1);
AtomicReference<Integer> 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());
Expand Down
14 changes: 14 additions & 0 deletions framework/src/main/java/cn/lili/common/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
* 过滤特殊字符串
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
* @since 2020-02-25 14:10:16
*/
public interface FootprintMapper extends BaseMapper<FootPrint> {

/**
* 获取用户足迹的SkuId分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 用户足迹的SkuId分页
*/
@Select("select sku_id from li_foot_print ${ew.customSqlSegment} ")
List<String> footprintSkuIdList(IPage<String> page, @Param(Constants.WRAPPER) Wrapper<FootPrint> queryWrapper);

/**
* 删除超过100条后的记录
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,7 +45,7 @@ public interface FootprintService extends IService<FootPrint> {
* @param pageVO 分页
* @return 会员浏览历史列表
*/
List<EsGoodsIndex> footPrintPage(PageVO pageVO);
IPage<EsGoodsIndex> footPrintPage(PageVO pageVO);

/**
* 获取当前会员的浏览记录数量
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,6 +21,7 @@
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* 会员浏览历史业务层实现
Expand All @@ -29,9 +32,7 @@
@Service
public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint> implements FootprintService {

/**
* es商品业务层
*/

@Autowired
private EsGoodsSearchService esGoodsSearchService;

Expand Down Expand Up @@ -74,20 +75,35 @@ public boolean deleteByIds(List<String> ids) {
}

@Override
public List<EsGoodsIndex> footPrintPage(PageVO pageVO) {
public IPage<EsGoodsIndex> footPrintPage(PageVO pageVO) {

LambdaQueryWrapper<FootPrint> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(FootPrint::getMemberId, UserContext.getCurrentUser().getId());
lambdaQueryWrapper.eq(FootPrint::getDeleteFlag, false);
lambdaQueryWrapper.orderByDesc(FootPrint::getUpdateTime);
List<String> skuIdList = this.baseMapper.footprintSkuIdList(PageUtil.initPage(pageVO), lambdaQueryWrapper);
if (!skuIdList.isEmpty()) {
List<EsGoodsIndex> list = esGoodsSearchService.getEsGoodsBySkuIds(skuIdList);
lambdaQueryWrapper.orderByDesc(FootPrint::getCreateTime);
IPage<FootPrint> footPrintPages = this.page(PageUtil.initPage(pageVO), lambdaQueryWrapper);


//定义结果
IPage<EsGoodsIndex> esGoodsIndexIPage = new Page<EsGoodsIndex>();

if (footPrintPages.getRecords() == null || footPrintPages.getRecords().isEmpty()) {
return esGoodsIndexIPage;
} else {
List<EsGoodsIndex> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,16 @@ public void payOrder(String orderSn) {
List<OrderItem> 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());
Expand All @@ -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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
@ToString
public class CashierParam {

static Long MAX_DETAIL_LENGTH = 30L;

@ApiModelProperty(value = "价格")
private Double price;

Expand Down Expand Up @@ -47,6 +49,6 @@ public String getDetail() {
if (StringUtils.isEmpty(detail)) {
return "清单详细";
}
return StringUtils.filterSpecialChart(detail);
return StringUtils.filterSpecialChart(StringUtils.sub(detail, 30));
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -42,6 +44,7 @@ public class UnifiedOrderModel {
* 商品描述
*/
private String description;

/**
* 商户订单号
*/
Expand Down Expand Up @@ -82,6 +85,7 @@ public class UnifiedOrderModel {
* 场景信息
*/
private SceneInfo scene_info;

}


Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private List<OnlineMemberVO> initData(List<OnlineMemberVO> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public ResultMessage<Article> 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<Article> getByType(@PathVariable String type) {

return ResultUtil.data(articleService.customGetByType(type));
}

@ApiOperation(value = "分页获取")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),
Expand Down

0 comments on commit fafe3c0

Please sign in to comment.