修改订单、商品模块
This commit is contained in:
parent
049e4874a6
commit
04b5460cb4
BIN
qrcode/1933713270742081537.png
Normal file
BIN
qrcode/1933713270742081537.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 435 B |
BIN
qrcode/1935226754499760129.png
Normal file
BIN
qrcode/1935226754499760129.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 410 B |
@ -121,6 +121,9 @@ public class ProductVO extends BaseAudit {
|
||||
@Schema(description = "销量")
|
||||
private String sales;
|
||||
|
||||
@Schema(description = "商品类型 1.团购;->2.拼团;3->秒杀")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "配送方式 1->到店核销;2->自提;3->配送;")
|
||||
private Integer distribution;
|
||||
|
||||
|
@ -81,6 +81,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="query.nameLike != null and query.nameLike != ''">
|
||||
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')
|
||||
</if>
|
||||
<if test="query.outProductId != null">
|
||||
AND p.out_product_id = #{query.outProductId}
|
||||
</if>
|
||||
<if test="query.publishStatus != null">
|
||||
AND p.publish_status = #{query.publishStatus}
|
||||
</if>
|
||||
|
@ -99,7 +99,6 @@ public class OrderController extends BaseController {
|
||||
@Log(title = "订单表", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public R add(@RequestBody Order order) {
|
||||
order.setWithdrawStatus(1);
|
||||
return service.insert(order);
|
||||
}
|
||||
|
||||
@ -148,7 +147,7 @@ public class OrderController extends BaseController {
|
||||
@Tag(name ="订单日志")
|
||||
@GetMapping("/log/{orderId}")
|
||||
public R log(@PathVariable Long orderId){
|
||||
return R.ok(service.log(orderId));
|
||||
return R.ok (service.log(orderId));
|
||||
}
|
||||
|
||||
@Tag(name ="订单解密")
|
||||
|
@ -125,6 +125,9 @@ public class OrderBo {
|
||||
@Schema(description = "提现状态:1->等待转账;2->转帐中;3->转账成功;4->转账失败")
|
||||
private Integer withdrawStatus;
|
||||
|
||||
@Schema(description = "买家手机号")
|
||||
private String memberPhoneEncrypted;
|
||||
|
||||
public Wrapper<Order> toWrapper() {
|
||||
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
@ -180,4 +180,8 @@ public class Order extends BaseAudit {
|
||||
|
||||
@Schema(description = "配送方式 1->到店核销;2->自提;3->配送;")
|
||||
private Integer distribution;
|
||||
|
||||
@Schema(description = "核销码")
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class OrderOperateHistory extends BaseAudit {
|
||||
@Excel(name = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
private Integer orderStatus;
|
||||
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Excel(name = "备注")
|
||||
private String note;
|
||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "后台订单详情对象")
|
||||
public class ManagerOrderDetailVO {
|
||||
public class ManagerOrderDetailVO {
|
||||
@Schema(description = "订单id")
|
||||
private Long orderId;
|
||||
|
||||
|
@ -33,10 +33,14 @@ public class OrderOperateHistoryVO extends BaseAudit {
|
||||
private String operateMan;
|
||||
|
||||
/** 订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单 */
|
||||
@Schema(description = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
@Schema(description = "修改后的订 单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
@Excel(name = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
private Integer orderStatus;
|
||||
|
||||
@Schema(description = "原来的订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
@Excel(name = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
private Integer status;
|
||||
|
||||
/** 备注 */
|
||||
@Schema(description = "备注")
|
||||
@Excel(name = "备注")
|
||||
|
@ -204,5 +204,8 @@ public class OrderVO extends BaseAudit {
|
||||
@Schema(description = "配送方式 1->到店核销;2->自提;3->配送;")
|
||||
private Integer distribution;
|
||||
|
||||
@Schema(description = "核销码")
|
||||
private String code;
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.wzj.soopin.order.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@ -31,15 +30,14 @@ import com.wzj.soopin.order.mapper.OrderMapper;
|
||||
import com.wzj.soopin.order.mapper.OrderOperateHistoryMapper;
|
||||
import com.wzj.soopin.order.service.OrderService;
|
||||
import com.wzj.soopin.order.service.VerificationCodeService;
|
||||
import com.wzj.soopin.order.utils.PageUtil;
|
||||
import com.wzj.soopin.order.utils.SecurityUtils;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.event.Constants;
|
||||
import org.dromara.common.core.utils.PhoneUtils;
|
||||
import org.dromara.system.domain.SysOperLog;
|
||||
import org.dromara.system.domain.SysTenant;
|
||||
import org.dromara.system.mapper.SysOperLogMapper;
|
||||
import org.dromara.system.mapper.SysTenantMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -104,13 +102,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
* @return 订单表
|
||||
*/
|
||||
public ManagerOrderDetailVO selectById(Long id) {
|
||||
// 1. 原有订单查询逻辑保持不变
|
||||
|
||||
Order order = orderMapper.selectById(id);
|
||||
if (order == null){
|
||||
throw new RuntimeException("查不到订单信息");
|
||||
}
|
||||
|
||||
// 2. 原有VO封装逻辑保持不变
|
||||
ManagerOrderDetailVO managerOrderDetailVO = new ManagerOrderDetailVO();
|
||||
//封装订单信息
|
||||
managerOrderDetailVO.setOrderId(id);
|
||||
@ -139,12 +136,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
managerOrderAddressVo.setName(order.getReceiverName());
|
||||
managerOrderDetailVO.setAddressInfo(managerOrderAddressVo);
|
||||
|
||||
// 3. 原有会员查询逻辑保持不变
|
||||
Member member = memberMapper.selectById(order.getMemberId());
|
||||
managerOrderDetailVO.setUserName(member.getNickname());
|
||||
managerOrderDetailVO.setUserPhone(member.getPhoneHidden());
|
||||
|
||||
// 4. 新增租户信息查询(完全独立新增,不影响原有逻辑)
|
||||
if (order.getTenantId() != null) {
|
||||
SysTenant tenant = sysTenantMapper.selectOne(
|
||||
new QueryWrapper<SysTenant>()
|
||||
@ -157,7 +152,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 原有商品查询逻辑保持不变
|
||||
QueryWrapper<OrderItem> qw = new QueryWrapper<>();
|
||||
qw.eq("order_id", order.getId());
|
||||
List<OrderItem> orderItemList = orderItemMapper.selectList(qw);
|
||||
@ -232,6 +226,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
public R<Order> insert(Order order) {
|
||||
order.setCreateTime(LocalDateTime.now());
|
||||
order.setWithdrawStatus(1);
|
||||
order.setStatus(6);
|
||||
int insert = orderMapper.insert(order);
|
||||
if (insert>1){
|
||||
return R.fail("订单创建失败");
|
||||
@ -424,29 +419,35 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
|
||||
/**
|
||||
* 根据订单id查询订单操作日志
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @return 结果
|
||||
*/
|
||||
public List<SysOperLog> log(Long orderId) {
|
||||
// LambdaQueryWrapper<OrderOperateHistory> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(OrderOperateHistory::getOrderId, orderId);
|
||||
// wrapper.in(OrderOperateHistory::getOrderStatus, Arrays.asList(0, 1, 2, 3, 4));
|
||||
// wrapper.orderByDesc(OrderOperateHistory::getCreateTime);
|
||||
// List<OrderOperateHistory> historyList = orderOperateHistoryMapper.selectList(wrapper);
|
||||
// return historyList;
|
||||
public List<OrderOperateHistoryVO> log(Long orderId) {
|
||||
// 查询订单操作历史记录
|
||||
LambdaQueryWrapper<OrderOperateHistory> historyWrapper = new LambdaQueryWrapper<>();
|
||||
historyWrapper.eq(OrderOperateHistory::getOrderId, orderId);
|
||||
historyWrapper.orderByDesc(OrderOperateHistory::getCreateTime);
|
||||
List<OrderOperateHistory> historyList = orderOperateHistoryMapper.selectList(historyWrapper);
|
||||
|
||||
LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysOperLog::getTitle, "订单表")
|
||||
.eq(SysOperLog::getOperatorType, 1)
|
||||
.select(
|
||||
SysOperLog::getTitle,
|
||||
SysOperLog::getBusinessType,
|
||||
SysOperLog::getOperName,
|
||||
SysOperLog::getDeptName,
|
||||
SysOperLog::getStatus,
|
||||
SysOperLog::getOperTime
|
||||
);
|
||||
return sysOperLogMapper.selectList(wrapper);
|
||||
// 关联查询订单状态
|
||||
LambdaQueryWrapper<Order> orderWrapper = new LambdaQueryWrapper<>();
|
||||
orderWrapper.select(Order::getId, Order::getStatus);
|
||||
orderWrapper.eq(Order::getId, orderId);
|
||||
Order order = orderMapper.selectOne(orderWrapper);
|
||||
|
||||
// 转换为VO对象
|
||||
List<OrderOperateHistoryVO> voList = new ArrayList<>();
|
||||
Integer orderStatus = order != null ? order.getStatus() : null;
|
||||
|
||||
for (OrderOperateHistory history : historyList) {
|
||||
OrderOperateHistoryVO vo = new OrderOperateHistoryVO();
|
||||
BeanUtils.copyProperties(history, vo);
|
||||
vo.setStatus(orderStatus);
|
||||
voList.add(vo);
|
||||
}
|
||||
|
||||
return voList;
|
||||
}
|
||||
|
||||
public R decryptPhone(Long orderId) {
|
||||
@ -496,7 +497,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
.map(OrderVO::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 根据订单id查询订单详情(oms_order_item表)
|
||||
// 根据订单id查询订单详情
|
||||
QueryWrapper<OrderItem> orderItemQueryWrapper = new QueryWrapper<>();
|
||||
orderItemQueryWrapper.in("order_id", orderIds);
|
||||
List<OrderItem> orderItemList = orderItemMapper.selectList(orderItemQueryWrapper);
|
||||
@ -515,7 +516,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
skuQueryWrapper.in("id", skuIds);
|
||||
List<Sku> skuList = skuMapper.selectList(skuQueryWrapper);
|
||||
|
||||
// 按照sku_id分组pms_sku数据
|
||||
Map<Long, Sku> skuMapById = skuList.stream()
|
||||
.collect(Collectors.toMap(Sku::getId, sku -> sku));
|
||||
|
||||
|
@ -53,6 +53,8 @@ public class VerificationCodeServiceImpl extends ServiceImpl<VerificationCodesM
|
||||
// 生成唯一核销码
|
||||
String codeValue = generateUniqueCode();
|
||||
|
||||
order.setCode(codeValue);
|
||||
|
||||
// 核销码过期时间(7天后过期)
|
||||
LocalDateTime expireTime = LocalDateTime.now().plusDays(7);
|
||||
|
||||
|
@ -295,8 +295,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="query.memberId != null and query.memberId != ''">
|
||||
AND o.member_id LIKE CONCAT('%', #{query.memberId}, '%')
|
||||
</if>
|
||||
<if test="query.memberPhoneEncrypted != null and query.memberPhoneEncrypted != ''">
|
||||
AND um.phone_encrypted LIKE CONCAT('%', #{query.memberPhoneEncrypted}, '%')
|
||||
</if>
|
||||
<if test="query.receiverPhone != null and query.receiverPhone != ''">
|
||||
AND o.receiver_phone LIKE CONCAT('%', #{receiverPhone}, '%')
|
||||
AND o.receiver_phone LIKE CONCAT('%', #{query.receiverPhone}, '%')
|
||||
</if>
|
||||
<if test="query.status != null and query.status != ''">
|
||||
AND o.status LIKE CONCAT('%', #{query.status}, '%')
|
||||
@ -305,10 +308,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND o.type LIKE CONCAT('%', #{query.type}, '%')
|
||||
</if>
|
||||
<if test="query.withdrawStatus != null and query.withdrawStatus != ''">
|
||||
AND o.withdraw_status LIKE CONCAT('%', #{withdrawStatus}, '%')
|
||||
AND o.withdraw_status LIKE CONCAT('%', #{query.withdrawStatus}, '%')
|
||||
</if>
|
||||
<if test="query.aftersaleStatus != null and query.aftersaleStatus != ''">
|
||||
AND o.aftersale_status LIKE CONCAT('%', #{aftersaleStatus}, '%')
|
||||
AND o.aftersale_status LIKE CONCAT('%', #{query.aftersaleStatus}, '%')
|
||||
</if>
|
||||
<if test="query.startTime != null">
|
||||
AND o.create_time >= #{query.startTime, jdbcType=TIMESTAMP}
|
||||
|
Loading…
x
Reference in New Issue
Block a user