更新了商品类别
This commit is contained in:
parent
583c3f5007
commit
9082882cab
|
@ -277,7 +277,7 @@ public class CouponController {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端用户查看优惠券
|
* 小程序端用户根据状态查看优惠券
|
||||||
* @param commonStringRequest 优惠券状态
|
* @param commonStringRequest 优惠券状态
|
||||||
* @return 当前用户拥有的优惠券列表
|
* @return 当前用户拥有的优惠券列表
|
||||||
*/
|
*/
|
||||||
|
@ -396,6 +396,7 @@ public class CouponController {
|
||||||
Long userId = loginUser.getId();
|
Long userId = loginUser.getId();
|
||||||
QueryWrapper<UserCoupon> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<UserCoupon> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("userId", userId);
|
queryWrapper.eq("userId", userId);
|
||||||
|
queryWrapper.eq("status", "可用");
|
||||||
List<UserCoupon> userCouponList = userCouponService.list(queryWrapper);
|
List<UserCoupon> userCouponList = userCouponService.list(queryWrapper);
|
||||||
userCouponList = userCouponList.stream().filter(userCoupon -> userCoupon.getCouponVO().getStatus().equals("可用")).toList();
|
userCouponList = userCouponList.stream().filter(userCoupon -> userCoupon.getCouponVO().getStatus().equals("可用")).toList();
|
||||||
|
|
||||||
|
|
|
@ -484,9 +484,10 @@ public class GoodController {
|
||||||
ServiceGoodVO serviceGoodVO = new ServiceGoodVO();
|
ServiceGoodVO serviceGoodVO = new ServiceGoodVO();
|
||||||
BeanUtils.copyProperties(good, serviceGoodVO);
|
BeanUtils.copyProperties(good, serviceGoodVO);
|
||||||
Long goodVOId = serviceGoodVO.getId();
|
Long goodVOId = serviceGoodVO.getId();
|
||||||
|
// 获取预约日期表和预约时间段表合并的结果集
|
||||||
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOList = appointmentDateService.queryAppointmentDateDetailById(goodVOId);
|
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOList = appointmentDateService.queryAppointmentDateDetailById(goodVOId);
|
||||||
List<AppointmentDateVO> appointmentDateVOList = new ArrayList<>();
|
List<AppointmentDateVO> appointmentDateVOList = new ArrayList<>();
|
||||||
// 封装预约日期和预约时间段
|
// 封装服务类商品的预约日期和预约时间段
|
||||||
Map<Long, List<TimePeriodVO>> timeMap = new HashMap<>();
|
Map<Long, List<TimePeriodVO>> timeMap = new HashMap<>();
|
||||||
Map<Long, AppointmentDateVO> dateMap = new HashMap<>();
|
Map<Long, AppointmentDateVO> dateMap = new HashMap<>();
|
||||||
for (AppointmentDateTimePeriodVO appointmentDateTimePeriodVO : appointmentDateTimePeriodVOList) {
|
for (AppointmentDateTimePeriodVO appointmentDateTimePeriodVO : appointmentDateTimePeriodVOList) {
|
||||||
|
@ -510,7 +511,23 @@ public class GoodController {
|
||||||
Set<Long> dateIds = dateMap.keySet();
|
Set<Long> dateIds = dateMap.keySet();
|
||||||
for (Long dateId : dateIds) {
|
for (Long dateId : dateIds) {
|
||||||
AppointmentDateVO appointmentDateVO = dateMap.get(dateId);
|
AppointmentDateVO appointmentDateVO = dateMap.get(dateId);
|
||||||
|
// 筛序掉已过期的预约日期
|
||||||
|
String specificDate = appointmentDateVO.getSpecificDate();
|
||||||
|
String today = DateUtil.today();
|
||||||
|
int result = DateUtil.compare(DateUtil.parse(specificDate), DateUtil.parse(today));
|
||||||
|
if (result < 0) continue;
|
||||||
List<TimePeriodVO> timePeriodVOList = timeMap.get(dateId);
|
List<TimePeriodVO> timePeriodVOList = timeMap.get(dateId);
|
||||||
|
if (result == 0) {
|
||||||
|
timePeriodVOList = timePeriodVOList.stream().filter(timePeriodVO -> {
|
||||||
|
String startTime = timePeriodVO.getTimeSlot().split("-")[0];
|
||||||
|
String currentTime = DateUtil.format(DateUtil.date(), "HH:mm");
|
||||||
|
|
||||||
|
Date startDate = DateUtil.parse(startTime, "HH:mm");
|
||||||
|
Date currentDate = DateUtil.parse(currentTime, "HH:mm");
|
||||||
|
return startDate.after(currentDate);
|
||||||
|
}).toList();
|
||||||
|
if (timePeriodVOList.isEmpty()) continue;
|
||||||
|
}
|
||||||
appointmentDateVO.setTimePeriodVOList(timePeriodVOList);
|
appointmentDateVO.setTimePeriodVOList(timePeriodVOList);
|
||||||
appointmentDateVOList.add(appointmentDateVO);
|
appointmentDateVOList.add(appointmentDateVO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ public class OrderController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private GoodService goodService;
|
private GoodService goodService;
|
||||||
|
|
||||||
|
@ -86,11 +85,11 @@ public class OrderController {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户通过购物车创建订单
|
* 小程序端用户创建常规类商品购物车订单
|
||||||
*/
|
*/
|
||||||
@PostMapping("/add/cart")
|
@PostMapping("/add/cart")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Operation(summary = "用户通过购物车创建订单", description = "参数:购物车订单创建请求体,权限:所有人,方法名:addCartOrder")
|
@Operation(summary = "小程序端用户创建常规类商品购物车订单", description = "参数:购物车订单创建请求体,权限:所有人,方法名:addCartOrder")
|
||||||
public BaseResponse<Long> addCartOrder(@RequestBody CartOrderAddRequest cartOrderAddRequest, HttpServletRequest request) {
|
public BaseResponse<Long> addCartOrder(@RequestBody CartOrderAddRequest cartOrderAddRequest, HttpServletRequest request) {
|
||||||
if (cartOrderAddRequest == null) {
|
if (cartOrderAddRequest == null) {
|
||||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||||
|
@ -99,7 +98,6 @@ public class OrderController {
|
||||||
User loginUser = userService.getLoginUser(request);
|
User loginUser = userService.getLoginUser(request);
|
||||||
Long userId = loginUser.getId();
|
Long userId = loginUser.getId();
|
||||||
|
|
||||||
|
|
||||||
// 封装成订单创建请求体
|
// 封装成订单创建请求体
|
||||||
OrderMainInfoAddRequest orderMainInfoAddRequest = new OrderMainInfoAddRequest();
|
OrderMainInfoAddRequest orderMainInfoAddRequest = new OrderMainInfoAddRequest();
|
||||||
BeanUtils.copyProperties(cartOrderAddRequest, orderMainInfoAddRequest);
|
BeanUtils.copyProperties(cartOrderAddRequest, orderMainInfoAddRequest);
|
||||||
|
@ -158,19 +156,32 @@ public class OrderController {
|
||||||
orderMainInfoAddRequest.setOrderItemMainInfoAddRequestList(orderItemMainInfoAddRequestList);
|
orderMainInfoAddRequest.setOrderItemMainInfoAddRequestList(orderItemMainInfoAddRequestList);
|
||||||
// 创建通用订单(常规类和服务类商品)
|
// 创建通用订单(常规类和服务类商品)
|
||||||
Long orderId = orderService.createCommonOrder(orderMainInfoAddRequest, userId, true, cartIds);
|
Long orderId = orderService.createCommonOrder(orderMainInfoAddRequest, userId, true, cartIds);
|
||||||
|
|
||||||
|
// 延迟检查订单状态信息
|
||||||
|
MultiDelayMessage<Long> msg = new MultiDelayMessage<>(orderId,
|
||||||
|
10000L, 10000L, 10000L, 15000L, 15000L, 30000L, 30000L, 60000L, 60000L, 120000L, 300000L, 600000L, 600000L);
|
||||||
|
// 10000L, 10000L, 10000L, 15000L, 15000L, 30000L, 30000L, 60000L, 60000L, 120000L, 300000L, 600000L, 600000L
|
||||||
|
int delayValue = msg.removeNextDelay().intValue();
|
||||||
|
rabbitTemplate.convertAndSend(MqConstant.DELAY_EXCHANGE,
|
||||||
|
MqConstant.DELAY_ORDER_ROUTING_KEY, msg, message -> {
|
||||||
|
// 添加延迟消息属性
|
||||||
|
message.getMessageProperties().setDelay(delayValue);
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
|
||||||
return ResultUtils.success(orderId);
|
return ResultUtils.success(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端创建用户订单
|
* 小程序端用户创建常规类商品订单
|
||||||
* @param orderMainInfoAddRequest 订单创建请求体
|
* @param orderMainInfoAddRequest 订单创建请求体
|
||||||
* @return 是否创建成功
|
* @return 是否创建成功
|
||||||
*/
|
*/
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Operation(summary = "小程序端创建用户订单", description = "参数:订单创建请求体,权限:所有人,方法名:addOrder")
|
@Operation(summary = "小程序端用户创建常规类商品订单", description = "参数:订单创建请求体,权限:所有人,方法名:addOrder")
|
||||||
public BaseResponse<Long> addOrder(@RequestBody OrderMainInfoAddRequest orderMainInfoAddRequest, HttpServletRequest request) {
|
public BaseResponse<Long> addOrder(@RequestBody OrderMainInfoAddRequest orderMainInfoAddRequest, HttpServletRequest request) {
|
||||||
if (orderMainInfoAddRequest == null) {
|
if (orderMainInfoAddRequest == null) {
|
||||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||||
|
@ -203,7 +214,7 @@ public class OrderController {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询所有订单(包括订单明细)
|
* Web端管理员分页查询订单
|
||||||
* @param orderQueryRequest 订单查询请求体
|
* @param orderQueryRequest 订单查询请求体
|
||||||
* @return 订单列表信息
|
* @return 订单列表信息
|
||||||
*/
|
*/
|
||||||
|
@ -224,13 +235,29 @@ public class OrderController {
|
||||||
BeanUtils.copyProperties(order, orderVO);
|
BeanUtils.copyProperties(order, orderVO);
|
||||||
return orderVO;
|
return orderVO;
|
||||||
}).toList();
|
}).toList();
|
||||||
orderVOS.forEach(orderVO -> {
|
|
||||||
|
|
||||||
|
// 封装map集合(键:订单id, 值:订单明细列表)
|
||||||
|
Map<Long, List<OrderItems>> map = new HashMap<>();
|
||||||
|
List<OrderItems> orderItemsList = orderItemService.list();
|
||||||
|
for (OrderItems orderItems : orderItemsList) {
|
||||||
|
Long orderId = orderItems.getOrderId();
|
||||||
|
|
||||||
|
List<OrderItems> orderItemsArrayList = map.get(orderId);
|
||||||
|
if (orderItemsArrayList == null) {
|
||||||
|
orderItemsArrayList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
orderItemsArrayList.add(orderItems);
|
||||||
|
map.put(orderId, orderItemsArrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (OrderVO orderVO : orderVOS) {
|
||||||
Long id = orderVO.getId();
|
Long id = orderVO.getId();
|
||||||
QueryWrapper<OrderItems> queryWrapper = new QueryWrapper<>();
|
List<OrderItems> orderItemsTempList = map.get(id);
|
||||||
queryWrapper.eq("orderId", id);
|
orderVO.setOrderItemList(orderItemsTempList);
|
||||||
List<OrderItems> list = orderItemService.list(queryWrapper);
|
}
|
||||||
orderVO.setOrderItemList(list);
|
|
||||||
});
|
|
||||||
Page<OrderVO> orderVOPage = new Page<>();
|
Page<OrderVO> orderVOPage = new Page<>();
|
||||||
orderVOPage.setRecords(orderVOS);
|
orderVOPage.setRecords(orderVOS);
|
||||||
orderVOPage.setTotal(page.getTotal());
|
orderVOPage.setTotal(page.getTotal());
|
||||||
|
|
|
@ -53,11 +53,6 @@ public class AppointmentDate implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -57,10 +57,6 @@ public class TimePeriod implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -17,9 +17,6 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
@TableName(value = "user")
|
@TableName(value = "user")
|
||||||
@Data
|
@Data
|
||||||
//@Builder
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@NoArgsConstructor
|
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class UserCoupon implements Serializable {
|
||||||
private CouponVO couponVO;
|
private CouponVO couponVO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,6 @@ public class UserCouponVO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
<select id="queryAppointmentDateDetail" resultType="com.cultural.heritage.model.vo.appointment.AppointmentDateTimePeriodVO">
|
<select id="queryAppointmentDateDetail" resultType="com.cultural.heritage.model.vo.appointment.AppointmentDateTimePeriodVO">
|
||||||
select a.id, a.specificDate, a.isAvailable, a.goodId, t.id timePeriodId, t.timeSlot, t.minNumber, t.maxNumber
|
select a.id, a.specificDate, a.isAvailable, a.goodId, t.id timePeriodId, t.timeSlot, t.minNumber, t.maxNumber
|
||||||
from appointment_date a, time_period t
|
from appointment_date a, time_period t
|
||||||
where a.id = t.appointmentDateId and a.isDelete = 0 and t.isDelete = 0
|
where a.id = t.appointmentDateId
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="queryAppointmentDateDetailById" resultType="com.cultural.heritage.model.vo.appointment.AppointmentDateTimePeriodVO">
|
<select id="queryAppointmentDateDetailById" resultType="com.cultural.heritage.model.vo.appointment.AppointmentDateTimePeriodVO">
|
||||||
select a.id, a.specificDate, a.isAvailable, goodId, t.id timePeriodId, t.timeSlot, t.minNumber, t.maxNumber
|
select a.id, a.specificDate, a.isAvailable, goodId, t.id timePeriodId, t.timeSlot, t.minNumber, t.maxNumber
|
||||||
from appointment_date a, time_period t
|
from appointment_date a, time_period t
|
||||||
where a.id = t.appointmentDateId and a.isDelete = 0 and t.isDelete = 0 and a.goodId = #{goodId}
|
where a.id = t.appointmentDateId and a.goodId = #{goodId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user