Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
10e8120314
19 files changed
+150
-117
No files matched your search
@@ -233,6 +233,7 @@ CREATE TABLE hard_after_sale_car
|
||||
product_name varchar(128) NOT NULL COMMENT '商品名',
|
||||
product_pic varchar(256) NOT NULL COMMENT '商品图片',
|
||||
product_price bigint NOT NULL COMMENT '商品价格',
|
||||
product_nature varchar(64) DEFAULT NULL COMMENT '商品性质',
|
||||
product_count int NOT NULL COMMENT '数量',
|
||||
product_weight decimal(10, 2) COMMENT '重量',
|
||||
total_price bigint COMMENT '总价(分)',
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public enum HardOrderStatusEnum {
|
||||
);
|
||||
}
|
||||
|
||||
public static HardOrderStatusEnum valueOfByType(Integer type) {
|
||||
public static HardOrderStatusEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
+5
@@ -68,6 +68,11 @@ public enum HardPayTypeEnum {
|
||||
CSXFK
|
||||
);
|
||||
|
||||
// 简单支付(没有购物车)
|
||||
public static final List<HardPayTypeEnum> isSimplePayList = List.of(
|
||||
WALLET_QR_CODE_SCAN
|
||||
);
|
||||
|
||||
public static HardPayTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
|
||||
+9
-7
@@ -3,6 +3,8 @@ package com.bsd.pjcloud.hard.api.vo.order;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class HardDeptTotalVo {
|
||||
|
||||
@@ -13,7 +15,7 @@ public class HardDeptTotalVo {
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "批量充值金额")
|
||||
private Long walletPrice = 0L;
|
||||
private BigDecimal walletPrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "批量充值次数")
|
||||
private Long walletCount = 0L;
|
||||
@@ -25,37 +27,37 @@ public class HardDeptTotalVo {
|
||||
private Long walletReduceCount = 0L;
|
||||
|
||||
@Schema(description = "退还各自食堂金额")
|
||||
private Long walletReturnCanteenPrice = 0L;
|
||||
private BigDecimal walletReturnCanteenPrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "退还各自食堂次数")
|
||||
private Long walletReturnCanteenCount = 0L;
|
||||
|
||||
@Schema(description = "单次充值金额")
|
||||
private Long walletOncePrice = 0L;
|
||||
private BigDecimal walletOncePrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "单次充值次数")
|
||||
private Long walletOnceCount = 0L;
|
||||
|
||||
@Schema(description = "单次扣减金额")
|
||||
private Long walletOnceReducePrice = 0L;
|
||||
private BigDecimal walletOnceReducePrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "单次扣减次数")
|
||||
private Long walletOnceReduceCount = 0L;
|
||||
|
||||
@Schema(description = "消费金额")
|
||||
private Long orderPayPrice = 0L;
|
||||
private BigDecimal orderPayPrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "消费次数")
|
||||
private Long orderPayCount = 0L;
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
private Long orderRefundPrice = 0L;
|
||||
private BigDecimal orderRefundPrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "退款次数")
|
||||
private Long orderRefundCont = 0L;
|
||||
|
||||
@Schema(description = "盈利金额")
|
||||
private Long orderProfitPrice = 0L;
|
||||
private BigDecimal orderProfitPrice = BigDecimal.ZERO;
|
||||
|
||||
@Schema(description = "盈利次数")
|
||||
private Long orderProfitCont = 0L;
|
||||
|
||||
+2
-3
@@ -23,7 +23,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -106,7 +105,7 @@ public class HardAfterSaleController {
|
||||
|
||||
@PostMapping(value = "/admin-refund")
|
||||
@Operation(summary = "后台退款")
|
||||
@Idempotent(expireTime = 10, info = "正在退款中,请勿重复操作")
|
||||
@Idempotent(expireTime = 5, info = "正在退款中,请勿重复操作")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_adminRefund')")
|
||||
public R<Boolean> adminRefund(@RequestBody HardAdminRefundDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
@@ -115,7 +114,7 @@ public class HardAfterSaleController {
|
||||
|
||||
@PostMapping(value = "/admin-reinforce-refund")
|
||||
@Operation(summary = "后台强化退款")
|
||||
@Idempotent(expireTime = 10, info = "正在退款中,请勿重复操作")
|
||||
@Idempotent(expireTime = 5, info = "正在退款中,请勿重复操作")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_adminRefund')")
|
||||
public R<Boolean> adminReinforceRefund(@RequestBody HardAdminRefundReinforceDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
|
||||
+2
-4
@@ -81,11 +81,9 @@ public class HardCarController {
|
||||
@GetMapping("/order-id")
|
||||
@Operation(summary = "根据订单id查询购物车")
|
||||
public R<Page<HardCarVo>> orderId(@ParameterObject Page page, @RequestParam Long orderId) {
|
||||
if (ObjectUtil.isEmpty(orderId)) {
|
||||
R.ok(null);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(orderId)) R.ok(null);
|
||||
HardOrderEntity order = hardOrderService.getById(orderId);
|
||||
if (ObjectUtil.isEmpty(order) || ObjectUtil.isEmpty(order.getParentCarId())) return null;
|
||||
if (ObjectUtil.isEmpty(order) || ObjectUtil.isEmpty(order.getParentCarId())) return R.ok(null);
|
||||
HardCarDto dto = new HardCarDto();
|
||||
dto.setParentCarId(order.getParentCarId());
|
||||
return R.ok(hardCarService.pageJoin(page, dto));
|
||||
|
||||
+15
-47
@@ -427,75 +427,43 @@ public class HardOrderTotalController {
|
||||
lineNumber++;
|
||||
// 批量充值
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletPrice())) {
|
||||
walletPriceSum = walletPriceSum.add(BigDecimal.valueOf(v.getWalletPrice()));
|
||||
v.setWalletPrice(BigDecimal.valueOf(v.getWalletPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletCount())) {
|
||||
walletCountSum = walletCountSum.add(BigDecimal.valueOf(v.getWalletCount()));
|
||||
v.setWalletCount(BigDecimal.valueOf(v.getWalletCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
walletPriceSum = walletPriceSum.add(v.getWalletPrice());
|
||||
v.setWalletPrice(v.getWalletPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
// 批量扣减
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReducePrice())) {
|
||||
walletReducePriceSum = walletReducePriceSum.add(BigDecimal.valueOf(v.getWalletReducePrice()));
|
||||
v.setWalletReducePrice(BigDecimal.valueOf(v.getWalletReducePrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReduceCount())) {
|
||||
walletReduceCountSum = walletReduceCountSum.add(BigDecimal.valueOf(v.getWalletReduceCount()));
|
||||
v.setWalletReduceCount(BigDecimal.valueOf(v.getWalletReduceCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
// 单次充值
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletOncePrice())) {
|
||||
walletOncePriceSum = walletOncePriceSum.add(BigDecimal.valueOf(v.getWalletOncePrice()));
|
||||
v.setWalletOncePrice(BigDecimal.valueOf(v.getWalletOncePrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletOnceCount())) {
|
||||
walletOnceCountSum = walletOnceCountSum.add(BigDecimal.valueOf(v.getWalletOnceCount()));
|
||||
v.setWalletOnceCount(BigDecimal.valueOf(v.getWalletOnceCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
walletOncePriceSum = walletOncePriceSum.add(v.getWalletOncePrice());
|
||||
v.setWalletOncePrice(v.getWalletOncePrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
// 单次扣减
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletOnceReducePrice())) {
|
||||
walletOnceReducePriceSum = walletOnceReducePriceSum.add(BigDecimal.valueOf(v.getWalletOnceReducePrice()));
|
||||
v.setWalletOnceReducePrice(BigDecimal.valueOf(v.getWalletOnceReducePrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
walletOnceReducePriceSum = walletOnceReducePriceSum.add(v.getWalletOnceReducePrice());
|
||||
v.setWalletOnceReducePrice(v.getWalletOnceReducePrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletOnceReduceCount())) {
|
||||
walletOnceReduceCountSum = walletOnceReduceCountSum.add(BigDecimal.valueOf(v.getWalletOnceReduceCount()));
|
||||
v.setWalletOnceReduceCount(BigDecimal.valueOf(v.getWalletOnceReduceCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
//
|
||||
// 消费金额
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayPrice())) {
|
||||
orderPayPriceSum = orderPayPriceSum.add(BigDecimal.valueOf(v.getOrderPayPrice()));
|
||||
v.setOrderPayPrice(BigDecimal.valueOf(v.getOrderPayPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayCount())) {
|
||||
orderPayCountSum = orderPayCountSum.add(BigDecimal.valueOf(v.getOrderPayCount()));
|
||||
v.setOrderPayCount(BigDecimal.valueOf(v.getOrderPayCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
orderPayPriceSum = orderPayPriceSum.add(v.getOrderPayPrice());
|
||||
v.setOrderPayPrice(v.getOrderPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
//
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderRefundPrice())) {
|
||||
orderRefundPriceSum = orderRefundPriceSum.add(BigDecimal.valueOf(v.getOrderRefundPrice()));
|
||||
v.setOrderRefundPrice(BigDecimal.valueOf(v.getOrderRefundPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderRefundCont())) {
|
||||
orderRefundContSum = orderRefundContSum.add(BigDecimal.valueOf(v.getOrderRefundCont()));
|
||||
v.setOrderRefundCont(BigDecimal.valueOf(v.getOrderRefundCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
orderRefundPriceSum = orderRefundPriceSum.add(v.getOrderRefundPrice());
|
||||
v.setOrderRefundPrice(v.getOrderRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
//
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderProfitPrice())) {
|
||||
orderProfitPriceSum = orderProfitPriceSum.add(BigDecimal.valueOf(v.getOrderProfitPrice()));
|
||||
v.setOrderProfitPrice(BigDecimal.valueOf(v.getOrderProfitPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderProfitCont())) {
|
||||
orderProfitContSum = orderProfitContSum.add(BigDecimal.valueOf(v.getOrderProfitCont()));
|
||||
v.setOrderProfitCont(BigDecimal.valueOf(v.getOrderProfitCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
orderProfitPriceSum = orderProfitPriceSum.add(v.getOrderProfitPrice());
|
||||
v.setOrderProfitPrice(v.getOrderProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
// 退还各自食堂金额
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReturnCanteenPrice())) {
|
||||
walletReturnCanteenPriceSum = walletReturnCanteenPriceSum.add(BigDecimal.valueOf(v.getWalletReturnCanteenPrice()));
|
||||
v.setWalletReturnCanteenPrice(BigDecimal.valueOf(v.getWalletReturnCanteenPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReturnCanteenCount())) {
|
||||
walletReturnCanteenCountSum = walletReturnCanteenCountSum.add(BigDecimal.valueOf(v.getWalletReturnCanteenCount()));
|
||||
v.setWalletReturnCanteenCount(BigDecimal.valueOf(v.getWalletReturnCanteenCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
walletReturnCanteenPriceSum = walletReturnCanteenPriceSum.add(v.getWalletReturnCanteenPrice());
|
||||
v.setWalletReturnCanteenPrice(v.getWalletReturnCanteenPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
// 批量充值
|
||||
map.put("walletPriceSum", walletPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
|
||||
+42
-26
@@ -515,10 +515,10 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
.content(HardSaleStatusEnum.COMPLETE.getContent())
|
||||
.build();
|
||||
hardAfterSaleLogMapper.insert(saveLogObj);
|
||||
// 执行退款
|
||||
getSelf().refund(saveObj.getId());
|
||||
// 退库存
|
||||
hardOrderService.fastenerInventory(order, YesNoEnum.NO);
|
||||
// 执行退款
|
||||
getSelf().refund(saveObj.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -528,26 +528,38 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean adminReinforceRefund(HardAdminRefundReinforceDto dto, PjcloudUser user) {
|
||||
if (ObjectUtil.isEmpty(dto.getCarList())) throw new RuntimeException("退款商品列表不能为空");
|
||||
// 校验订单是否可以退款
|
||||
HardOrderVo order = validateOrderCanRefund(dto.getOrderId());
|
||||
// 校验订单购物车是否支持退款
|
||||
validateOrderCarCanRefund(order, dto.getCarList());
|
||||
|
||||
// 判断是否快速支付
|
||||
HardPayTypeEnum hardPayType = HardPayTypeEnum.valueOfByType(order.getPayType());
|
||||
if (ObjectUtil.isEmpty(hardPayType)) throw new RuntimeException("订单类型错误");
|
||||
// 如果是简单支付(没有购物车)的支付方式就直接返回
|
||||
boolean isSimplePayList = HardPayTypeEnum.isSimplePayList.contains(hardPayType);
|
||||
if (!isSimplePayList) {
|
||||
if (ObjectUtil.isEmpty(dto.getCarList())) throw new RuntimeException("退款商品列表不能为空");
|
||||
// 校验订单购物车是否支持退款
|
||||
validateOrderCarCanRefund(order, dto.getCarList());
|
||||
}
|
||||
|
||||
// 添加售后订单
|
||||
HardAfterSaleEntity saveObj = BeanUtils.toBean(dto, HardAfterSaleEntity.class);
|
||||
String refundCode = "hard_" + order.getId();
|
||||
|
||||
// 计算退款金额
|
||||
List<HardCreateCarDto> computerCarList = dto.getCarList().stream().map((item) -> {
|
||||
HardCreateCarDto entity = new HardCreateCarDto();
|
||||
entity.setParentCarId(item.getParentCarId());
|
||||
entity.setProductId(item.getProductId());
|
||||
entity.setProductNature(HardProductNatureEnum.valueOfByType(item.getProductNature()));
|
||||
entity.setProductCount(item.getProductCount());
|
||||
entity.setProductWeight(item.getProductWeight());
|
||||
return entity;
|
||||
}).toList();
|
||||
int refundPrice = hardCarService.computerCarTotalPrice(HardTypeEnum.valueOfByType(order.getSysType()), HardOrderTypeEnum.valueOfByType(order.getOrderType()), computerCarList);
|
||||
int refundPrice = order.getPayPrice();
|
||||
if (!isSimplePayList) {
|
||||
List<HardCreateCarDto> computerCarList = dto.getCarList().stream().map((item) -> {
|
||||
HardCreateCarDto entity = new HardCreateCarDto();
|
||||
entity.setParentCarId(item.getParentCarId());
|
||||
entity.setProductId(item.getProductId());
|
||||
entity.setProductNature(HardProductNatureEnum.valueOfByType(item.getProductNature()));
|
||||
entity.setProductCount(item.getProductCount());
|
||||
entity.setProductWeight(item.getProductWeight());
|
||||
return entity;
|
||||
}).toList();
|
||||
refundPrice = hardCarService.computerCarTotalPrice(HardTypeEnum.valueOfByType(order.getSysType()), HardOrderTypeEnum.valueOfByType(order.getOrderType()), computerCarList);
|
||||
}
|
||||
|
||||
saveObj.setType(HardSaleTypeEnum.AFTER_SALE.getType());
|
||||
saveObj.setStatus(HardSaleStatusEnum.COMPLETE.getStatus());
|
||||
@@ -560,7 +572,9 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
saveObj.setAuditReason("后台退款");
|
||||
baseMapper.insert(saveObj);
|
||||
// 添加退款购物车
|
||||
hardAfterSaleCarService.create(dto.getCarList(), order, saveObj);
|
||||
if (!isSimplePayList) {
|
||||
hardAfterSaleCarService.create(dto.getCarList(), order, saveObj);
|
||||
}
|
||||
// 添加售后进度
|
||||
HardAfterSaleLogEntity saveLogObj = HardAfterSaleLogEntity.builder()
|
||||
.afterSaleId(saveObj.getId())
|
||||
@@ -571,18 +585,20 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
.content(HardSaleStatusEnum.COMPLETE.getContent())
|
||||
.build();
|
||||
hardAfterSaleLogMapper.insert(saveLogObj);
|
||||
// 退库存
|
||||
if (!isSimplePayList) {
|
||||
List<HardCarEntity> carList = dto.getCarList().stream().map((item) ->
|
||||
HardCarEntity.builder()
|
||||
.productId(item.getProductId())
|
||||
.productCount(item.getProductCount())
|
||||
.productWeight(item.getProductWeight())
|
||||
.productNature(item.getProductName())
|
||||
.build()
|
||||
).toList();
|
||||
hardOrderService.fastenerInventory(order, carList, YesNoEnum.NO);
|
||||
}
|
||||
// 执行退款
|
||||
getSelf().refund(saveObj.getId());
|
||||
// 退库存
|
||||
List<HardCarEntity> carList = dto.getCarList().stream().map((item) ->
|
||||
HardCarEntity.builder()
|
||||
.productId(item.getProductId())
|
||||
.productCount(item.getProductCount())
|
||||
.productWeight(item.getProductWeight())
|
||||
.productNature(item.getProductName())
|
||||
.build()
|
||||
).toList();
|
||||
hardOrderService.fastenerInventory(order, carList, YesNoEnum.NO);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+41
-4
@@ -58,6 +58,7 @@ import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteShopSkuService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteShopSpuService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService;
|
||||
import com.bsd.pjcloud.supermarket.dto.SkuStockChangeDTO;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.supermarket.entity.ShopSkuEntity;
|
||||
import com.bsd.pjcloud.supermarket.vo.app.ShopSpuDetailAppVo;
|
||||
@@ -99,9 +100,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 订单表
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2025-01-05 16:46:25
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@@ -939,7 +937,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
item.setIncrCount(weight);
|
||||
}
|
||||
return item;
|
||||
}).filter(v -> ObjectUtil.isNotEmpty(v.getIncrCount()) && v.getIncrCount() > 0).toList();
|
||||
}).filter(v -> ObjectUtil.isNotEmpty(v.getIncrCount()) && ObjectUtil.notEqual(v.getIncrCount(), 0.0)).toList();
|
||||
dto.setItems(list);
|
||||
R updateSkuStockRes = supermarketSpuService.updateSpuStock(dto);
|
||||
if (updateSkuStockRes.getCode() != 0) {
|
||||
@@ -949,7 +947,46 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
// 线上
|
||||
if (ObjectUtil.equals(HardOrderTypeEnum.RESERVE, orderTypeEnum)) {
|
||||
SkuStockChangeDTO dto = new SkuStockChangeDTO();
|
||||
List<SkuStockChangeDTO.Item> list = carList.stream().map(v -> {
|
||||
SkuStockChangeDTO.Item item = new SkuStockChangeDTO.Item();
|
||||
item.setId(v.getProductId());
|
||||
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
|
||||
// 按数量
|
||||
int prouctCount = v.getProductCount();
|
||||
// 如果退款购物车数组里有,就用退款购物车的数量
|
||||
if (ObjectUtil.isNotEmpty(refundCarList)) {
|
||||
HardCarEntity refundCarTarget = refundCarList.stream().filter(i -> ObjectUtil.equals(i.getProductId(), v.getProductId())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotEmpty(refundCarTarget) && ObjectUtil.isNotEmpty(refundCarTarget.getProductCount())) {
|
||||
prouctCount = refundCarTarget.getProductCount();
|
||||
}
|
||||
}
|
||||
double count = BigDecimal.valueOf(prouctCount).multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
item.setIncrCount(count);
|
||||
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
|
||||
// 按重量
|
||||
BigDecimal productWeight = v.getProductWeight();
|
||||
// 如果退款购物车数组里有,就用退款购物车的数量
|
||||
if (ObjectUtil.isNotEmpty(refundCarList)) {
|
||||
HardCarEntity refundCarTarget = refundCarList.stream().filter(i -> ObjectUtil.equals(i.getProductId(), v.getProductId())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotEmpty(refundCarTarget) && ObjectUtil.isNotEmpty(refundCarTarget.getProductCount())) {
|
||||
productWeight = refundCarTarget.getProductWeight();
|
||||
}
|
||||
}
|
||||
double weight = productWeight.multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
item.setIncrCount(weight);
|
||||
}
|
||||
return item;
|
||||
}).filter(v -> ObjectUtil.isNotEmpty(v.getIncrCount()) && ObjectUtil.notEqual(v.getIncrCount(), 0.0)).toList();
|
||||
dto.setItems(list);
|
||||
R<Boolean> updateSkuStockRes = remoteShopSkuService.deductStock(dto);
|
||||
if (updateSkuStockRes.getCode() != 0) {
|
||||
log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
throw new RuntimeException(CarErrorMsg + "错误");
|
||||
}
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-9
@@ -472,13 +472,12 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
if (ObjectUtil.isNotEmpty(walletBatchList)) {
|
||||
walletBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletPrice(i.getSum());
|
||||
v.setWalletPrice(BigDecimal.valueOf(i.getSum()));
|
||||
v.setWalletCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletReduceList)) {
|
||||
walletReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
// v.setWalletReducePrice(i.getSum());
|
||||
v.setWalletReducePrice(Math.abs(i.getSum()));
|
||||
v.setWalletReduceCount(i.getCount());
|
||||
});
|
||||
@@ -486,32 +485,31 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
// 退还各自食堂
|
||||
if (ObjectUtil.isNotEmpty(walletRetrunCanteenList)) {
|
||||
walletRetrunCanteenList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletReturnCanteenPrice(Math.abs(i.getSum()));
|
||||
v.setWalletReturnCanteenPrice(BigDecimal.valueOf(Math.abs(i.getSum())));
|
||||
v.setWalletReturnCanteenCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceBatchList)) {
|
||||
walletOnceBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletOncePrice(i.getSum());
|
||||
v.setWalletOncePrice(BigDecimal.valueOf(i.getSum()));
|
||||
v.setWalletOnceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceReduceList)) {
|
||||
walletOnceReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
// v.setWalletOnceReducePrice(i.getSum());
|
||||
v.setWalletOnceReducePrice(Math.abs(i.getSum()));
|
||||
v.setWalletOnceReducePrice(BigDecimal.valueOf(Math.abs(i.getSum())));
|
||||
v.setWalletOnceReduceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(payList)) {
|
||||
payList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderPayPrice(i.getSum());
|
||||
v.setOrderPayPrice(BigDecimal.valueOf(i.getSum()));
|
||||
v.setOrderPayCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderRefundPrice(i.getSum());
|
||||
v.setOrderRefundPrice(BigDecimal.valueOf(i.getSum()));
|
||||
v.setOrderRefundCont(i.getCount());
|
||||
});
|
||||
}
|
||||
@@ -520,7 +518,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
// 流水金额
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayPrice())) {
|
||||
v.setOrderProfitPrice(v.getOrderPayPrice() - v.getOrderRefundPrice());
|
||||
v.setOrderProfitPrice(v.getOrderPayPrice().subtract(v.getOrderRefundPrice()));
|
||||
}
|
||||
// 流水次数
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayCount())) {
|
||||
|
||||
Binary file not shown.
+7
@@ -145,6 +145,13 @@ public class WalletTransactionController {
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询复杂查询(无权限)", description = "分页查询复杂查询(无权限)")
|
||||
@GetMapping("/public/page-join")
|
||||
public R publicPageJoin(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, null));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_view')")
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ public class MchManageController {
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch")
|
||||
public R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds, @RequestParam MerchantTypeEnum mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMch(deptIds, mchType);
|
||||
MchManageVo mchManage = mchManageService.getFirstMch(deptIds, List.of(mchType));
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class MchManageController {
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch-by-dept-id")
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, mchType);
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, List.of(mchType));
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
|
||||
+2
-2
@@ -37,9 +37,9 @@ public interface MchManageService extends IService<MchManageEntity> {
|
||||
|
||||
MchManageVo getByDeptId(Long deptId, MerchantTypeEnum type);
|
||||
|
||||
MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType);
|
||||
MchManageVo getFirstMch(List<Long> deptIds, List<MerchantTypeEnum> mchTypeList);
|
||||
|
||||
MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType);
|
||||
MchManageVo getFirstMchByDeptId(Long deptId, List<MerchantTypeEnum> mchTypeList);
|
||||
|
||||
/**
|
||||
* 刷新商户二维码
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
public void createAndActiveCard(WalletManageEntity wallet) {
|
||||
if (ObjectUtil.isEmpty(wallet) || ObjectUtil.isNotEmpty(wallet.getCardNumber())) return;
|
||||
// 查询用户所属于的商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(wallet.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(wallet.getDeptId(), List.of(MerchantTypeEnum.CANTEEN));
|
||||
if (ObjectUtil.isEmpty(mch)) return;
|
||||
LambdaQueryWrapper<WalletActiveEntity> wrapper = new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.isNull(WalletActiveEntity::getUserId)
|
||||
|
||||
+2
-2
@@ -489,7 +489,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
);
|
||||
// 修改钱包冻结开卡商户
|
||||
// 查询用户所属于的食堂商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId(), List.of(MerchantTypeEnum.CANTEEN));
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
walletActiveService.update(new LambdaUpdateWrapper<WalletActiveEntity>()
|
||||
.set(WalletActiveEntity::getMerchantId, mch.getId())
|
||||
@@ -552,7 +552,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(WalletManageVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
R<List<SysUser>> userList = userService.getInnerUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class MchDeptServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptEn
|
||||
item.setDeptId(v.getDeptId());
|
||||
// 查询所属的商户
|
||||
try {
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
|
||||
if (ObjectUtil.isEmpty(mch)) continue;
|
||||
item.setMchId(mch.getId());
|
||||
} catch (Exception e) {
|
||||
|
||||
+8
-6
@@ -278,16 +278,18 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType) {
|
||||
public MchManageVo getFirstMch(List<Long> deptIds, List<MerchantTypeEnum> mchTypeList) {
|
||||
List<String> mchTypeStrList = mchTypeList.stream().map(MerchantTypeEnum::getType).toList();
|
||||
|
||||
List<MchManageEntity> merchantList = baseMapper.selectList(new LambdaQueryWrapper<MchManageEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(mchType), MchManageEntity::getTypes, mchType.getType())
|
||||
.in(ObjectUtil.isNotEmpty(mchTypeList), MchManageEntity::getTypes, mchTypeStrList)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(merchantList)) return null;
|
||||
for (Long id : deptIds) {
|
||||
for (MchManageEntity merchant : merchantList) {
|
||||
if (ObjectUtil.equals(merchant.getDeptId(), id)) {
|
||||
if (ObjectUtil.isNotEmpty(mchType)) {
|
||||
if (ObjectUtil.equals(merchant.getTypes(), mchType.getType())) {
|
||||
if (ObjectUtil.isNotEmpty(mchTypeStrList)) {
|
||||
if (mchTypeStrList.contains(merchant.getTypes())) {
|
||||
return BeanUtils.toBean(merchant, MchManageVo.class);
|
||||
}
|
||||
} else {
|
||||
@@ -300,13 +302,13 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType) {
|
||||
public MchManageVo getFirstMchByDeptId(Long deptId, List<MerchantTypeEnum> mchTypeList) {
|
||||
List<SysDept> parentDeptIdList = remoteDeptService.getParentDeptList(deptId).getData();
|
||||
if (ObjectUtil.isEmpty(parentDeptIdList)) {
|
||||
return null;
|
||||
}
|
||||
List<Long> deptIds = parentDeptIdList.stream().map(SysDept::getDeptId).toList();
|
||||
return getFirstMch(deptIds, mchType);
|
||||
return getFirstMch(deptIds, mchTypeList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
public void syncAllDept(Long deptId, Boolean isDel) {
|
||||
MchManageDto dto = new MchManageDto();
|
||||
if (ObjectUtil.isNotEmpty(deptId)) {
|
||||
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId, MerchantTypeEnum.CANTEEN);
|
||||
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId, List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
|
||||
if (ObjectUtil.isNotEmpty(mchManageVo)) {
|
||||
dto.setDeptId(mchManageVo.getDeptId());
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
log.error("|{}|syncAllUserGroup用户没有自动创建钱包权限|{}|", TAG, JSONUtil.toJsonStr(v));
|
||||
continue;
|
||||
}
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
|
||||
// 查询是在商户下
|
||||
if (ObjectUtil.isEmpty(mch)) {
|
||||
log.error("|{}|syncAllUserGroup用户部门商户id为空WalletManageVo|{}|", TAG, JSONUtil.toJsonStr(v));
|
||||
|
||||
Reference in new issue
Block a user