From 5ea1abc297842faf1500aa159cbfbc1a1d16b80f Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 10 Oct 2025 10:36:15 +0800
Subject: [PATCH] feat(ai): 添加公司知识库和分类字段
---
src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java | 347 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 284 insertions(+), 63 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java
index 59d82e7..ea2ca5e 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java
@@ -14,14 +14,14 @@
import cc.mrbird.febs.mall.service.ApiClothesOrderService;
import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
-import cc.mrbird.febs.mall.vo.clothes.ApiClothesOrderInfoVo;
-import cc.mrbird.febs.mall.vo.clothes.ApiClothesOrderPayVo;
-import cc.mrbird.febs.mall.vo.clothes.ApiMyDraftVo;
+import cc.mrbird.febs.mall.vo.clothes.*;
import cc.mrbird.febs.pay.model.BrandWCPayRequestData;
import cc.mrbird.febs.pay.service.IPayService;
import cc.mrbird.febs.pay.service.IXcxPayService;
import cc.mrbird.febs.rabbit.producter.AgentProducer;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
@@ -65,6 +65,7 @@
private final MallAddressInfoMapper mallAddressInfoMapper;
private final MallMemberCouponMapper mallMemberCouponMapper;
private final MallGoodsCouponMapper mallGoodsCouponMapper;
+ private final MallExpressInfoMapper mallExpressInfoMapper;
private final AgentProducer agentProducer;
private final IXcxPayService iXcxPayService;
@@ -72,6 +73,9 @@
private final MallMemberMapper mallMemberMapper;
private final IApiMallMemberWalletService apiMallMemberWalletService;
private final IMallMoneyFlowService mallMoneyFlowService;
+
+ private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
+ private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
@Override
public FebsResponse myDraft(ApiMyDraftPageDto dto) {
@@ -111,30 +115,50 @@
record.setStatureName(clothesMemberStature.getName());
}
- Long patternId = ObjectUtil.defaultIfNull(record.getPatternId(),0L);
- List<ClothesTypePattern> clothesTypePatterns = clothesTypePatternMapper.selectList(Wrappers.<ClothesTypePattern>lambdaQuery().eq(ClothesTypePattern::getTypeId, typeId));
- if (CollUtil.isNotEmpty(clothesTypePatterns)){
- Set<Long> patternIds = clothesTypePatterns.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet());
- if(CollUtil.isNotEmpty( patternIds) && patternIds.contains(patternId)){
+ BigDecimal totalPatternPrice = BigDecimal.ZERO;
+ List<ClothesPatternRemark> clothesPatternRemarks = clothesPatternRemarkMapper.selectList(
+ Wrappers.lambdaQuery(ClothesPatternRemark.class)
+ .eq(ClothesPatternRemark::getSourceId, record.getId())
+ .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue())
+ );
+ if(CollUtil.isNotEmpty(clothesPatternRemarks)){
+ List<ApiClothesPatternInfoVo> vos = new ArrayList<>();
+ for (ClothesPatternRemark entity : clothesPatternRemarks){
+ Long patternId = entity.getPatternId();
+ ApiClothesPatternInfoVo vo = new ApiClothesPatternInfoVo();
+ vo.setPatternId(patternId);
ClothesPattern clothesPattern = clothesPatternMapper.selectById(patternId);
- if (ObjectUtil.isNotNull(clothesPattern)){
- record.setPatternName(clothesPattern.getName());
- record.setPatternPrice(clothesPattern.getPrice());
- }
+ vo.setPatternName(clothesPattern.getName());
+ vo.setPatternPrice(clothesPattern.getPrice());
+ vo.setPatternRemark(entity.getRemark());
+ vos.add(vo);
+
+ totalPatternPrice = totalPatternPrice.add(clothesPattern.getPrice());
}
+ record.setPatternList(vos);
}
- Long locationId = ObjectUtil.defaultIfNull(record.getLocationId(),0L);
- List<ClothesTypeLocation> clothesTypeLocations = clothesTypeLocationMapper.selectList(Wrappers.<ClothesTypeLocation>lambdaQuery().eq(ClothesTypeLocation::getTypeId, typeId));
- if (CollUtil.isNotEmpty(clothesTypeLocations)){
- Set<Long> locationIds = clothesTypeLocations.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet());
- if(CollUtil.isNotEmpty( locationIds) && locationIds.contains(locationId)){
- ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId);
- if (ObjectUtil.isNotNull(clothesLocation)){
- record.setLocationName(clothesLocation.getName());
- record.setLocationPrice(clothesLocation.getPrice());
- }
+ BigDecimal totalLocationPrice = BigDecimal.ZERO;
+ List<ClothesLocationRemark> clothesLocationRemarks = clothesLocationRemarkMapper.selectList(
+ Wrappers.lambdaQuery(ClothesLocationRemark.class)
+ .eq(ClothesLocationRemark::getSourceId, record.getId())
+ .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue())
+ );
+ if(CollUtil.isNotEmpty(clothesLocationRemarks)){
+ List<ApiClothesLocationInfoVo> vos = new ArrayList<>();
+ for (ClothesLocationRemark entity : clothesLocationRemarks){
+ Long locationId = entity.getLocationId();
+ ApiClothesLocationInfoVo vo = new ApiClothesLocationInfoVo();
+ vo.setLocationId(locationId);
+ ClothesLocation location = clothesLocationMapper.selectById(locationId);
+ vo.setLocationName(location.getName());
+ vo.setLocationPrice(location.getPrice());
+ vo.setLocationRemark(entity.getRemark());
+ vos.add(vo);
+
+ totalLocationPrice = totalLocationPrice.add(location.getPrice());
}
+ record.setLocationList(vos);
}
Long artId = ObjectUtil.defaultIfNull(record.getArtId(),0L);
@@ -164,11 +188,11 @@
}
BigDecimal amount =
- record.getClothPrice()
- .add(record.getLocationPrice())
+ record.getClothPrice()
+ .add(totalPatternPrice)
.add(record.getArtPrice())
.add(record.getSizePrice())
- .add(record.getPatternPrice()).setScale(2, RoundingMode.DOWN);
+ .add(totalLocationPrice).setScale(2, RoundingMode.DOWN);
record.setAmount(amount);
}
}
@@ -186,12 +210,13 @@
ClothesOrderDraft clothesOrderDraft = clothesOrderDraftMapper.selectById(id);
if (ObjectUtil.isNotNull(clothesOrderDraft)){
+ Long draftId = clothesOrderDraft.getId();
+
Long typeId = clothesOrderDraft.getTypeId();
ClothesType clothesType = clothesTypeMapper.selectById(typeId);
record.setTypeId(typeId);
record.setTypeName(clothesType.getName());
record.setTypeImage(clothesType.getImage());
- record.setPatternRemark(clothesOrderDraft.getPatternRemark());
Long sizeId = ObjectUtil.defaultIfNull(clothesOrderDraft.getSizeId(),0L);
List<ClothesTypeSize> clothesTypeSizes = clothesTypeSizeMapper.selectList(Wrappers.<ClothesTypeSize>lambdaQuery().eq(ClothesTypeSize::getTypeId, typeId));
@@ -203,6 +228,7 @@
record.setSizeId(sizeId);
record.setSizeName(clothesSize.getName());
record.setSizePrice(clothesSize.getPrice());
+ record.setSizeImage(clothesSize.getImage());
}
}
}
@@ -214,32 +240,63 @@
record.setStatureName(clothesMemberStature.getName());
}
- Long patternId = ObjectUtil.defaultIfNull(clothesOrderDraft.getPatternId(),0L);
- List<ClothesTypePattern> clothesTypePatterns = clothesTypePatternMapper.selectList(Wrappers.<ClothesTypePattern>lambdaQuery().eq(ClothesTypePattern::getTypeId, typeId));
- if (CollUtil.isNotEmpty(clothesTypePatterns)){
- Set<Long> patternIds = clothesTypePatterns.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet());
- if(CollUtil.isNotEmpty( patternIds) && patternIds.contains(patternId)){
+ BigDecimal totalPatternPrice = BigDecimal.ZERO;
+ List<ClothesPatternRemark> clothesPatternRemarks = clothesPatternRemarkMapper.selectList(
+ Wrappers.lambdaQuery(ClothesPatternRemark.class)
+ .eq(ClothesPatternRemark::getSourceId, draftId)
+ .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue())
+ );
+ if(CollUtil.isNotEmpty(clothesPatternRemarks)){
+ List<ApiClothesPatternInfoVo> vos = new ArrayList<>();
+ for (ClothesPatternRemark entity : clothesPatternRemarks){
+ Long patternId = entity.getPatternId();
+ ApiClothesPatternInfoVo vo = new ApiClothesPatternInfoVo();
+ vo.setPatternId(patternId);
ClothesPattern clothesPattern = clothesPatternMapper.selectById(patternId);
- if (ObjectUtil.isNotNull(clothesPattern)){
- record.setPatternId(patternId);
- record.setPatternName(clothesPattern.getName());
- record.setPatternPrice(clothesPattern.getPrice());
- }
+ vo.setPatternName(clothesPattern.getName());
+ vo.setPatternPrice(clothesPattern.getPrice());
+ vo.setPatternRemark(entity.getRemark());
+ vo.setPatternImage(clothesPattern.getImage());
+ vo.setBoxHeight(clothesPattern.getBoxHeight());
+ vo.setBoxWidth(clothesPattern.getBoxWidth());
+ vo.setLeftPercent(clothesPattern.getLeftPercent());
+ vo.setTopPercent(clothesPattern.getTopPercent());
+
+
+ vos.add(vo);
+
+ totalPatternPrice = totalPatternPrice.add(clothesPattern.getPrice());
}
+ record.setPatternList(vos);
}
- Long locationId = ObjectUtil.defaultIfNull(clothesOrderDraft.getLocationId(),0L);
- List<ClothesTypeLocation> clothesTypeLocations = clothesTypeLocationMapper.selectList(Wrappers.<ClothesTypeLocation>lambdaQuery().eq(ClothesTypeLocation::getTypeId, typeId));
- if (CollUtil.isNotEmpty(clothesTypeLocations)){
- Set<Long> locationIds = clothesTypeLocations.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet());
- if(CollUtil.isNotEmpty( locationIds) && locationIds.contains(locationId)){
- ClothesLocation clothesLocation = clothesLocationMapper.selectById(locationId);
- if (ObjectUtil.isNotNull(clothesLocation)){
- record.setLocationId(locationId);
- record.setLocationName(clothesLocation.getName());
- record.setLocationPrice(clothesLocation.getPrice());
- }
+ BigDecimal totalLocationPrice = BigDecimal.ZERO;
+ List<ClothesLocationRemark> clothesLocationRemarks = clothesLocationRemarkMapper.selectList(
+ Wrappers.lambdaQuery(ClothesLocationRemark.class)
+ .eq(ClothesLocationRemark::getSourceId, draftId)
+ .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.DRAFT.getValue())
+ );
+ if(CollUtil.isNotEmpty(clothesLocationRemarks)){
+ List<ApiClothesLocationInfoVo> vos = new ArrayList<>();
+ for (ClothesLocationRemark entity : clothesLocationRemarks){
+ Long locationId = entity.getLocationId();
+ ApiClothesLocationInfoVo vo = new ApiClothesLocationInfoVo();
+ vo.setLocationId(locationId);
+ ClothesLocation location = clothesLocationMapper.selectById(locationId);
+ vo.setLocationName(location.getName());
+ vo.setLocationPrice(location.getPrice());
+ vo.setLocationRemark(entity.getRemark());
+ vo.setLocationImage(location.getImage());
+
+ vo.setBoxHeight(location.getBoxHeight());
+ vo.setBoxWidth(location.getBoxWidth());
+ vo.setLeftPercent(location.getLeftPercent());
+ vo.setTopPercent(location.getTopPercent());
+ vos.add(vo);
+
+ totalLocationPrice = totalLocationPrice.add(location.getPrice());
}
+ record.setLocationList(vos);
}
Long artId = ObjectUtil.defaultIfNull(clothesOrderDraft.getArtId(),0L);
@@ -252,6 +309,7 @@
record.setArtId(artId);
record.setArtName(clothesArt.getName());
record.setArtPrice(clothesArt.getPrice());
+ record.setArtImage(clothesArt.getImage());
}
}
}
@@ -266,16 +324,17 @@
record.setClothId(clothId);
record.setClothName(clothesCloth.getName());
record.setClothPrice(clothesCloth.getPrice());
+ record.setClothImage(clothesCloth.getImage());
}
}
}
BigDecimal amount =
record.getClothPrice()
- .add(record.getLocationPrice())
+ .add(totalPatternPrice)
.add(record.getArtPrice())
.add(record.getSizePrice())
- .add(record.getPatternPrice()).setScale(2, RoundingMode.DOWN);
+ .add(totalLocationPrice).setScale(2, RoundingMode.DOWN);
record.setAmount(amount);
}
@@ -371,6 +430,7 @@
clothesOrderMapper.insert(orderInfo);
Long orderId = orderInfo.getId();
+
/**
* 创建订单子表
*/
@@ -380,15 +440,17 @@
orderItem.setMemberId(memberId);
orderItem.setOrderId(orderId);
orderItem.setType(item.getType());
+ orderItem.setItemCnt(dto.getCnt());
if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) {
ClothesCloth cloth = clothesClothMapper.selectById(item.getSkuId());
if (ObjectUtil.isNull(cloth)) {
throw new FebsException("请选择布料");
}
+ orderItem.setItemId(cloth.getId());
orderItem.setName(cloth.getName());
orderItem.setPrice(cloth.getPrice());
- orderItem.setItemCnt(item.getCnt());
- orderItem.setAmount(cloth.getPrice().multiply(new BigDecimal(item.getCnt())).setScale(2, RoundingMode.DOWN));
+ orderItem.setItemCnt(orderItem.getItemCnt());
+ orderItem.setAmount(cloth.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
clothesOrderItemMapper.insert(orderItem);
total = total.add(orderItem.getAmount());
@@ -398,9 +460,10 @@
if (ObjectUtil.isNull(size)) {
throw new FebsException("请选择尺寸");
}
+ orderItem.setItemId(size.getId());
orderItem.setName(size.getName());
orderItem.setPrice(size.getPrice());
- orderItem.setItemCnt(item.getCnt());
+ orderItem.setItemCnt(orderItem.getItemCnt());
orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
clothesOrderItemMapper.insert(orderItem);
@@ -411,10 +474,12 @@
if (ObjectUtil.isNull(location)) {
throw new FebsException("请选择图案位置");
}
+ orderItem.setItemId(location.getId());
orderItem.setName(location.getName());
orderItem.setPrice(location.getPrice());
- orderItem.setItemCnt(item.getCnt());
+ orderItem.setItemCnt(orderItem.getItemCnt());
orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
+ orderItem.setRemark(item.getPatternRemark());
clothesOrderItemMapper.insert(orderItem);
total = total.add(orderItem.getAmount());
@@ -424,10 +489,12 @@
if (ObjectUtil.isNull(pattern)) {
throw new FebsException("请选择图案");
}
+ orderItem.setItemId(pattern.getId());
orderItem.setRemark(item.getPatternRemark());
orderItem.setName(pattern.getName());
orderItem.setPrice(pattern.getPrice());
- orderItem.setItemCnt(item.getCnt());
+ orderItem.setItemCnt(orderItem.getItemCnt());
+ orderItem.setRemark(item.getPatternRemark());
orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
clothesOrderItemMapper.insert(orderItem);
@@ -438,9 +505,10 @@
if (ObjectUtil.isNull(art)) {
throw new FebsException("请选择工艺");
}
+ orderItem.setItemId(art.getId());
orderItem.setName(art.getName());
orderItem.setPrice(art.getPrice());
- orderItem.setItemCnt(item.getCnt());
+ orderItem.setItemCnt(orderItem.getItemCnt());
orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
clothesOrderItemMapper.insert(orderItem);
@@ -448,9 +516,13 @@
continue;
} else if (ClothesOrderItemEnum.CUSTOMIZE.getCode() == item.getType()) {
ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(item.getSkuId());
+ if (ObjectUtil.isNull(clothesMemberStature)){
+ throw new FebsException("请选择您的自定义尺码");
+ }
+ orderItem.setItemId(clothesMemberStature.getId());
orderItem.setName(clothesMemberStature.getName());
orderItem.setPrice(BigDecimal.ZERO);
- orderItem.setItemCnt(item.getCnt());
+ orderItem.setItemCnt(orderItem.getItemCnt());
orderItem.setAmount(orderItem.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN));
clothesOrderItemMapper.insert(orderItem);
@@ -460,9 +532,13 @@
throw new FebsException("详情参数错误");
}
}
- /**
- * 计算优惠金额、运费和实际支付金额
- */
+
+ total = total.multiply(new BigDecimal(orderInfo.getGoodsCnt())).setScale(2, RoundingMode.DOWN);
+ orderInfo.setAmount(total);
+
+ /**
+ * 计算优惠金额、运费和实际支付金额
+ */
BigDecimal discountAmount = BigDecimal.ZERO;
MallMemberCoupon mallMemberCoupon = new MallMemberCoupon();
if(ObjectUtil.isNotEmpty(dto.getMemberCouponId())){
@@ -484,13 +560,12 @@
orderInfo.setMemberCouponId(memberCouponId);
}
}
- BigDecimal deliveryAmount = dto.getDeliveryAmount() == null ? BigDecimal.ZERO : dto.getDeliveryAmount();
-
- orderInfo.setAmount(total);
orderInfo.setDiscountAmount(discountAmount);
+
+ BigDecimal deliveryAmount = dto.getDeliveryAmount() == null ? BigDecimal.ZERO : dto.getDeliveryAmount();
orderInfo.setCarriage(deliveryAmount);
- BigDecimal realAmount = total.subtract(discountAmount).add(deliveryAmount);
+ BigDecimal realAmount = total.subtract(discountAmount).add(deliveryAmount).setScale(2, RoundingMode.DOWN);
orderInfo.setRealAmount(realAmount);
clothesOrderMapper.updateById(orderInfo);
@@ -550,6 +625,7 @@
if(
ObjectUtil.isNotNull(clothesOrder)
&& ClothesEnum.DOWN.getCode() == clothesOrder.getDelFlag()
+ && ClothesOrderStatusEnum.CANCEL.getValue() == clothesOrder.getStatus()
){
clothesOrderMapper.update(null,
Wrappers.lambdaUpdate(ClothesOrder.class)
@@ -677,4 +753,149 @@
return new FebsResponse().success().data(apiClothesOrderPayVo).message("支付成功");
}
+ @Override
+ public FebsResponse findOrderList(ApiClothesOrderListVoDto dto) {
+
+ Long memberId = LoginUserUtil.getLoginUser().getId();
+ dto.setMemberId(memberId);
+
+
+ // 创建分页对象,传入当前页和每页大小
+ Page<ApiClothesOrderListVo> page = new Page<>(dto.getPageNow(), dto.getPageSize());
+ // 调用Mapper方法获取活动分页数据
+ Page<ApiClothesOrderListVo> voPage = clothesOrderMapper.selectPageInOrder(page, dto);
+
+ return new FebsResponse().success().data(voPage);
+ }
+
+ @Override
+ public FebsResponse findMarkCnt() {
+ Long memberId = LoginUserUtil.getLoginUser().getId();
+
+ List<Map<String, Integer>> maps = clothesOrderMapper.selectOrderStatusCnt(memberId);
+ Map<Integer, Integer> orderCnt = new HashMap<>();
+ if (CollUtil.isNotEmpty(maps)) {
+ for (Map<String, Integer> map : maps) {
+ orderCnt.put(map.get("status"), map.get("cnt"));
+ }
+ }
+
+ Map<String, Object> result = new HashMap<>();
+ result.put("order", orderCnt);
+ return new FebsResponse().success().data(result);
+ }
+
+
+ private List<ApiClothesOrderItemInfoVo> buildOrderItemInfo(Long id) {
+ List<ApiClothesOrderItemInfoVo> vos = new ArrayList<>();
+ List<ClothesOrderItem> clothesOrderItems = clothesOrderItemMapper.selectList(
+ Wrappers.lambdaQuery(ClothesOrderItem.class)
+ .eq(ClothesOrderItem::getOrderId, id)
+ );
+ if(CollUtil.isNotEmpty(clothesOrderItems)){
+ for (ClothesOrderItem item : clothesOrderItems) {
+ ApiClothesOrderItemInfoVo vo = new ApiClothesOrderItemInfoVo();
+ vo.setName(item.getName());
+ vo.setPrice(item.getPrice());
+ vo.setType(item.getType());
+ vo.setRemark(item.getRemark());
+
+
+ vos.add( vo);
+ }
+ }
+ return vos;
+
+ }
+
+ @Override
+ public FebsResponse orderDetails(Long id) {
+
+ Long memberId = LoginUserUtil.getLoginUser().getId();
+
+ ApiClothesOrderListInfoVo apiClothesOrderListInfoVo = new ApiClothesOrderListInfoVo();
+
+ ClothesOrder clothesOrder = clothesOrderMapper.selectById(id);
+ if(ObjectUtil.isNull(clothesOrder)){
+ throw new FebsException("订单不存在");
+ }
+ apiClothesOrderListInfoVo.setId(clothesOrder.getId());
+ apiClothesOrderListInfoVo.setOrderNo(clothesOrder.getOrderNo());
+ apiClothesOrderListInfoVo.setOrderTime(clothesOrder.getOrderTime());
+ apiClothesOrderListInfoVo.setAmount(clothesOrder.getAmount());
+ apiClothesOrderListInfoVo.setRealAmount(clothesOrder.getRealAmount());
+
+ ClothesType clothesType = clothesTypeMapper.selectById(clothesOrder.getTypeId());
+ if(ObjectUtil.isNotNull(clothesType)){
+ apiClothesOrderListInfoVo.setTypeName(clothesType.getName());
+ apiClothesOrderListInfoVo.setTypeImage(clothesType.getImage());
+ }
+
+ apiClothesOrderListInfoVo.setGoodsCnt(clothesOrder.getGoodsCnt());
+ apiClothesOrderListInfoVo.setPayMethod(clothesOrder.getPayMethod());
+ apiClothesOrderListInfoVo.setStatus(clothesOrder.getStatus());
+
+ apiClothesOrderListInfoVo.setLongitude(clothesOrder.getLongitude());
+ apiClothesOrderListInfoVo.setLatitude(clothesOrder.getLatitude());
+ apiClothesOrderListInfoVo.setName(clothesOrder.getName());
+ apiClothesOrderListInfoVo.setPhone(clothesOrder.getPhone());
+ apiClothesOrderListInfoVo.setAddress(clothesOrder.getAddress());
+
+ MallExpressInfo mallExpressInfo = mallExpressInfoMapper.selectOne(
+ Wrappers.lambdaQuery(MallExpressInfo.class)
+ .eq(MallExpressInfo::getOrderId, clothesOrder.getId())
+ .eq(MallExpressInfo::getOrderNo, clothesOrder.getOrderNo())
+ .last("limit 1")
+ );
+ if(ObjectUtil.isNotNull(mallExpressInfo)){
+ apiClothesOrderListInfoVo.setExpressNo(mallExpressInfo.getExpressNo());
+ apiClothesOrderListInfoVo.setExpressCom(mallExpressInfo.getExpressCom());
+ }
+
+ List<ApiClothesOrderItemInfoVo> items = buildOrderItemInfo(clothesOrder.getId());
+ apiClothesOrderListInfoVo.setItems(items);
+
+ if (OrderStatusEnum.WAIT_PAY.getValue() == clothesOrder.getStatus()) {
+ Date endTime = DateUtil.offsetMinute(clothesOrder.getOrderTime(), 1440);
+
+ long remainTime = DateUtil.between(new Date(), endTime, DateUnit.SECOND, false);
+ apiClothesOrderListInfoVo.setRemainTime(remainTime);
+ }
+ apiClothesOrderListInfoVo.setCarriage(clothesOrder.getCarriage());
+ apiClothesOrderListInfoVo.setRemark(clothesOrder.getRemark());
+ apiClothesOrderListInfoVo.setCommentState(clothesOrder.getCommentState());
+
+ return new FebsResponse().success().data(apiClothesOrderListInfoVo);
+ }
+
+ @Override
+ public FebsResponse confirmOrder(Long id) {
+ MallMember member = LoginUserUtil.getLoginUser();
+
+ ClothesOrder orderInfo =clothesOrderMapper.selectById(id);
+ if(ObjectUtil.isNull(orderInfo)){
+ throw new FebsException("订单不存在");
+ }
+ if (!ObjectUtil.equal(member.getId(), orderInfo.getMemberId())) {
+ throw new FebsException("无权限操作");
+ }
+ if (ClothesEnum.UP.getCode() == orderInfo.getDelFlag()) {
+ throw new FebsException("订单不存在");
+ }
+
+ if (orderInfo.getStatus() != ClothesOrderStatusEnum.WAIT_FINISH.getValue()) {
+ throw new FebsException("订单不是待收货状态");
+ }
+
+ clothesOrderMapper.update(null,
+ Wrappers.lambdaUpdate(ClothesOrder.class)
+ .set(ClothesOrder::getStatus, OrderStatusEnum.FINISH.getValue())
+ .set(ClothesOrder::getDeliveryState, OrderDeliveryStateEnum.DELIVERY_FINISH.getValue())
+ .set(ClothesOrder::getUpdatedTime, new Date())
+ .eq(ClothesOrder::getId, id)
+ .eq(ClothesOrder::getMemberId, member.getId())
+ );
+ return new FebsResponse().success().message("操作成功");
+ }
+
}
--
Gitblit v1.9.1