mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-11 16:51:53 +08:00
code review:营销活动+订单
This commit is contained in:
@@ -36,7 +36,6 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.AFTER_SALE_NOT_FOUND;
|
||||
|
||||
@Tag(name = "管理后台 - 售后订单")
|
||||
@RestController
|
||||
@@ -77,9 +76,11 @@ public class TradeAfterSaleController {
|
||||
public CommonResult<TradeAfterSaleDetailRespVO> getOrderDetail(@RequestParam("id") Long id) {
|
||||
// 查询订单
|
||||
TradeAfterSaleDO afterSale = afterSaleService.getAfterSale(id);
|
||||
if (afterSale == null) {
|
||||
return success(null, AFTER_SALE_NOT_FOUND.getMsg());
|
||||
}
|
||||
// TODO @puhui999:这里建议改成,如果为 null,直接返回 success null;主要查询操作,尽量不要有非空的提示哈;交给前端处理;
|
||||
// if (afterSale == null) {
|
||||
// return success(null, AFTER_SALE_NOT_FOUND.getMsg());
|
||||
// }
|
||||
|
||||
// 查询订单
|
||||
TradeOrderDO order = tradeOrderQueryService.getOrder(afterSale.getOrderId());
|
||||
// 查询订单项
|
||||
|
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||
|
||||
@Tag(name = "管理后台 - 交易订单")
|
||||
@RestController
|
||||
@@ -68,9 +67,11 @@ public class TradeOrderController {
|
||||
public CommonResult<TradeOrderDetailRespVO> getOrderDetail(@RequestParam("id") Long id) {
|
||||
// 查询订单
|
||||
TradeOrderDO order = tradeOrderQueryService.getOrder(id);
|
||||
if (order == null) {
|
||||
return success(null, ORDER_NOT_FOUND.getMsg());
|
||||
}
|
||||
// TODO @puhui999:这里建议改成,如果为 null,直接返回 success null;主要查询操作,尽量不要有非空的提示哈;交给前端处理;
|
||||
// if (order == null) {
|
||||
// return success(null, ORDER_NOT_FOUND.getMsg());
|
||||
// }
|
||||
|
||||
// 查询订单项
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
|
||||
// orderLog
|
||||
|
@@ -33,7 +33,6 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||
|
||||
@Tag(name = "用户 App - 交易订单")
|
||||
@RestController
|
||||
@@ -82,9 +81,10 @@ public class AppTradeOrderController {
|
||||
public CommonResult<AppTradeOrderDetailRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
// 查询订单
|
||||
TradeOrderDO order = tradeOrderQueryService.getOrder(getLoginUserId(), id);
|
||||
if (order == null) {
|
||||
return success(null, ORDER_NOT_FOUND.getMsg());
|
||||
}
|
||||
// TODO @puhui999:这里建议改成,如果为 null,直接返回 success null;主要查询操作,尽量不要有非空的提示哈;交给前端处理;
|
||||
// if (order == null) {
|
||||
// return success(null, ORDER_NOT_FOUND.getMsg());
|
||||
// }
|
||||
|
||||
// 查询订单项
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(order.getId());
|
||||
|
@@ -50,6 +50,7 @@ public class AppTradeOrderSettlementReqVO {
|
||||
private Long seckillActivityId;
|
||||
|
||||
// ========== 拼团活动相关字段 ==========
|
||||
// TODO @puhui999:是不是拼团记录的编号哈?
|
||||
@Schema(description = "拼团活动编号", example = "1024")
|
||||
private Long combinationActivityId;
|
||||
|
||||
@@ -57,6 +58,7 @@ public class AppTradeOrderSettlementReqVO {
|
||||
private Long combinationHeadId;
|
||||
|
||||
// ========== 砍价活动相关字段 ==========
|
||||
// TODO @puhui999:是不是砍价记录的编号哈?
|
||||
@Schema(description = "砍价活动编号", example = "123")
|
||||
private Long bargainActivityId;
|
||||
|
||||
|
@@ -15,6 +15,7 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Repository
|
||||
public class TradeOrderNoRedisDAO {
|
||||
|
||||
public static final String TRADE_ORDER_NO_PREFIX = "O";
|
||||
|
||||
@Resource
|
||||
|
@@ -561,6 +561,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO @puhui999:考虑事务性
|
||||
public void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO) {
|
||||
// 校验交易订单
|
||||
TradeOrderDO order = validateOrderExists(reqVO.getId());
|
||||
@@ -571,6 +572,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
throw exception(ORDER_UPDATE_PRICE_FAIL_EQUAL);
|
||||
}
|
||||
|
||||
// TODO @puhui999:应该是按照 payPrice 分配;并且要考虑取余问题;payPrice 也要考虑,item 里的
|
||||
List<TradeOrderItemDO> itemDOs = tradeOrderItemMapper.selectListByOrderId(order.getId());
|
||||
// TradeOrderItemDO 需要做 adjustPrice 的分摊
|
||||
int price = reqVO.getAdjustPrice() / itemDOs.size();
|
||||
@@ -578,8 +580,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
item.setAdjustPrice(price);
|
||||
});
|
||||
// 更新 TradeOrderItem
|
||||
// TODO @puhui999:不要整个对象去更新哈;应该 new 一下;
|
||||
tradeOrderItemMapper.updateBatch(itemDOs);
|
||||
// 更新订单
|
||||
// TODO @puhui999:要考虑多次修改价格,不能单单的 payPrice + 价格;
|
||||
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||
update.setPayPrice(update.getPayPrice() + update.getAdjustPrice());
|
||||
// TODO @芋艿:改价时,赠送的积分,要不要做改动???
|
||||
|
Reference in New Issue
Block a user