Commit 932d41f0 by 吕明尚

增加根据订单编号查询订单

parent 88cb6cf1
...@@ -63,6 +63,14 @@ public class SOrderController extends BaseController ...@@ -63,6 +63,14 @@ public class SOrderController extends BaseController
} }
/** /**
* 获取订单详细信息
*/
@GetMapping(value = "/orderNo")
public AjaxResult queryByOrderNo(@RequestParam("orderNo") String orderNo) {
return success(sOrderService.selectSOrderByOrderNo(orderNo));
}
/**
* 开门 * 开门
*/ */
@ApiOperation(value = "开门") @ApiOperation(value = "开门")
......
...@@ -134,4 +134,8 @@ public class SOrder extends BaseEntity ...@@ -134,4 +134,8 @@ public class SOrder extends BaseEntity
@TableField(select = false) @TableField(select = false)
private Integer isDelete; private Integer isDelete;
@TableField(exist = false)
private Integer buyType;
} }
...@@ -61,4 +61,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon> ...@@ -61,4 +61,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
public int deleteSConsumerCouponByIds(Long[] ids); public int deleteSConsumerCouponByIds(Long[] ids);
int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon); int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon);
List<SConsumerCoupon> querySConsumerCouponList(SConsumerCoupon sConsumerCoupon);
} }
...@@ -122,4 +122,6 @@ public interface ISOrderService extends IService<SOrder> ...@@ -122,4 +122,6 @@ public interface ISOrderService extends IService<SOrder>
* @return * @return
*/ */
boolean cancel(String orderNo); boolean cancel(String orderNo);
SOrder selectSOrderByOrderNo(String orderNo);
} }
...@@ -60,29 +60,29 @@ public class QPServiceImpl implements QPService { ...@@ -60,29 +60,29 @@ public class QPServiceImpl implements QPService {
//执行验券 //执行验券
// List<TuangouReceiptConsumeResponseEntity> consume = consume(code, count); // List<TuangouReceiptConsumeResponseEntity> consume = consume(code, count);
// consume.forEach(item -> { // consume.forEach(item -> {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon(); SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
//取订单ID,如果为空,则取套餐ID //取订单ID,如果为空,则取套餐ID
sConsumerCoupon.setCouponId(prepare.getDeal_id()); sConsumerCoupon.setCouponId(prepare.getDeal_id());
sConsumerCoupon.setCouponCode(code); sConsumerCoupon.setCouponCode(code);
sConsumerCoupon.setName(prepare.getDeal_title()); sConsumerCoupon.setName(prepare.getDeal_title());
sConsumerCoupon.setCouponType(sCoupon.getCouponType()); sConsumerCoupon.setCouponType(sCoupon.getCouponType());
sConsumerCoupon.setStoreType(sCoupon.getStoreType()); sConsumerCoupon.setStoreType(sCoupon.getStoreType());
sConsumerCoupon.setRoomType(sCoupon.getRoomType()); sConsumerCoupon.setRoomType(sCoupon.getRoomType());
sConsumerCoupon.setMinDuration(sCoupon.getMinDuration()); sConsumerCoupon.setMinDuration(sCoupon.getMinDuration());
sConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration()); sConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration());
sConsumerCoupon.setDuration(sCoupon.getDuration()); sConsumerCoupon.setDuration(sCoupon.getDuration());
sConsumerCoupon.setMinPrice(sCoupon.getMinPrice()); sConsumerCoupon.setMinPrice(sCoupon.getMinPrice());
sConsumerCoupon.setSubPrice(sCoupon.getSubPrice()); sConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
sConsumerCoupon.setSourceType(SourceTypeEnum.CHECK.getCode()); sConsumerCoupon.setSourceType(SourceTypeEnum.CHECK.getCode());
sConsumerCoupon.setPlatformType(PlatformTypeEnum.MEITUAN.getCode()); sConsumerCoupon.setPlatformType(PlatformTypeEnum.MEITUAN.getCode());
sConsumerCoupon.setStartDate(sCoupon.getStartDate()); sConsumerCoupon.setStartDate(sCoupon.getStartDate());
sConsumerCoupon.setEndDate(prepare.getReceiptEndDate()); sConsumerCoupon.setEndDate(prepare.getReceiptEndDate());
sConsumerCoupon.setCouponTimeStart(sCoupon.getValidStartTime()); sConsumerCoupon.setCouponTimeStart(sCoupon.getValidStartTime());
sConsumerCoupon.setCouponTimeEnd(sCoupon.getValidEndTime()); sConsumerCoupon.setCouponTimeEnd(sCoupon.getValidEndTime());
sConsumerCoupon.setCreateBy(String.valueOf(user.getId())); sConsumerCoupon.setCreateBy(String.valueOf(user.getId()));
isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon); isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon);
// }); // });
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -99,7 +99,7 @@ public class QPServiceImpl implements QPService { ...@@ -99,7 +99,7 @@ public class QPServiceImpl implements QPService {
if (byId == null) { if (byId == null) {
throw new RuntimeException("未找到对应的券码"); throw new RuntimeException("未找到对应的券码");
} }
if(StringUtils.isBlank(byId.getCouponCode())){ if (StringUtils.isBlank(byId.getCouponCode())) {
throw new RuntimeException("未找到对应的券码"); throw new RuntimeException("未找到对应的券码");
} }
TuangouReceiptGetConsumedReponseEntity getconsumed = getconsumed(byId.getCouponCode()); TuangouReceiptGetConsumedReponseEntity getconsumed = getconsumed(byId.getCouponCode());
......
...@@ -130,7 +130,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -130,7 +130,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode()); sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode());
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
//查询用户未使用的优惠券 //查询用户未使用的优惠券
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.querySConsumerCouponList(sConsumerCoupon);
//计算时长 //计算时长
BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate()); BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate());
if (CollectionUtils.isEmpty(sConsumerCoupons)) { if (CollectionUtils.isEmpty(sConsumerCoupons)) {
......
...@@ -233,6 +233,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -233,6 +233,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder.setTotalPrice(request.getTotalFee()); sOrder.setTotalPrice(request.getTotalFee());
sOrder.setCouponPrice(request.getCouponFee()); sOrder.setCouponPrice(request.getCouponFee());
sOrder.setPayPrice(request.getPayFee()); sOrder.setPayPrice(request.getPayFee());
sOrder.setBuyType(request.getBuyType());
//设置订单号 //设置订单号
sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue())); sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue()));
sOrder.setConsumerId(user.getId()); sOrder.setConsumerId(user.getId());
...@@ -241,6 +242,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -241,6 +242,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder.setPayStatus(YesNoEnum.no.getIndex()); sOrder.setPayStatus(YesNoEnum.no.getIndex());
sOrder.setStatus(OrderStatusEnum.UNUSED.getCode()); sOrder.setStatus(OrderStatusEnum.UNUSED.getCode());
sOrder.setRefundStatus(RefundStatusEnum.UNREFUND.getCode()); sOrder.setRefundStatus(RefundStatusEnum.UNREFUND.getCode());
sOrder.setPackId(request.getPackId());
//计算订单时长 //计算订单时长
sOrder.setTimeLong(DateUtils.differentHour(sOrder.getPreStartDate(),sOrder.getPreEndDate()).toString()); sOrder.setTimeLong(DateUtils.differentHour(sOrder.getPreStartDate(),sOrder.getPreEndDate()).toString());
if(Objects.nonNull(sOrder.getPackId())&& sOrder.getPackId() != 0){ if(Objects.nonNull(sOrder.getPackId())&& sOrder.getPackId() != 0){
...@@ -380,6 +382,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -380,6 +382,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
} }
@Override @Override
public SOrder selectSOrderByOrderNo(String orderNo) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getOrderNo, orderNo);
return getOne(queryWrapper);
}
@Override
public String openDoor(Long id) { public String openDoor(Long id) {
SOrder sOrder = sOrderMapper.selectSOrderById(id); SOrder sOrder = sOrderMapper.selectSOrderById(id);
if (Objects.isNull(sOrder)) { if (Objects.isNull(sOrder)) {
...@@ -455,7 +464,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -455,7 +464,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
* 计算使用优惠券后的订单金额 * 计算使用优惠券后的订单金额
*/ */
private void computedCouponPrice(ComputedOrderPriceResponse priceResponse, SConsumer user, SConsumerCoupon consumerCoupon){ private void computedCouponPrice(ComputedOrderPriceResponse priceResponse, SConsumer user, SConsumerCoupon consumerCoupon){
if (ObjectUtil.isNull(consumerCoupon) || !consumerCoupon.getCouponId().equals(user.getId())) { if (ObjectUtil.isNull(consumerCoupon) || !consumerCoupon.getConsumerId().equals(user.getId())) {
throw new BaseException("优惠券领取记录不存在!"); throw new BaseException("优惠券领取记录不存在!");
} }
if (CouponStatusEnum.USED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) { if (CouponStatusEnum.USED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) {
......
...@@ -74,6 +74,16 @@ ...@@ -74,6 +74,16 @@
<select id="selectSConsumerCouponConut" resultType="java.lang.Integer"> <select id="selectSConsumerCouponConut" resultType="java.lang.Integer">
select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0 select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0
</select> </select>
<select id="querySConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
<where>
1=1
and is_delete = '0'
and end_date >= NOW()
and use_status = '0'
<if test="consumerId != null ">and consumer_id = #{consumerId}</if>
</where>
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_coupon insert into s_consumer_coupon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment