Commit 0d9671cc by 吕明尚

修改设备日志操作人查询异常

parent 63567dc5
...@@ -410,7 +410,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -410,7 +410,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if (insert > 0) { if (insert > 0) {
//优惠券数量减一 //优惠券数量减一
sCoupon.setNumber(sCoupon.getNumber() - 1); sCoupon.setNumber(sCoupon.getNumber() - 1);
sCouponService.updateSCoupon(sCoupon); sCouponService.updateById(sCoupon);
} }
return insert; return insert;
} }
......
...@@ -142,7 +142,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl ...@@ -142,7 +142,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
wrapper.eq(SCoupon::getTiktokSkuId, sCoupon.getTiktokSkuId()); wrapper.eq(SCoupon::getTiktokSkuId, sCoupon.getTiktokSkuId());
sCouponList = sCouponMapper.selectOne(wrapper); sCouponList = sCouponMapper.selectOne(wrapper);
} }
if (ObjectUtils.isEmpty(sCouponList) || sCouponList.getId().equals(sCoupon.getId())) { if (ObjectUtils.isEmpty(sCouponList) || sCoupon.getId().equals(sCouponList.getId())) {
return sCouponMapper.updateSCoupon(sCoupon); return sCouponMapper.updateSCoupon(sCoupon);
} else { } else {
throw new RuntimeException("该团购已存在"); throw new RuntimeException("该团购已存在");
......
...@@ -117,6 +117,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -117,6 +117,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired @Autowired
private OrderRefundArtificialService orderRefundArtificialService; private OrderRefundArtificialService orderRefundArtificialService;
@Autowired
private RedisUtil redisUtils;
private final static Long FIVE = 5l; private final static Long FIVE = 5l;
...@@ -427,17 +429,39 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -427,17 +429,39 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder.setRefundReason(request.getRefundReason()); sOrder.setRefundReason(request.getRefundReason());
this.updateById(sOrder); this.updateById(sOrder);
} }
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo());
if (sOrder.getOrderType().equals(OrderTypeEnum.RESERVER.getCode())) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId()); queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
queryWrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode()); queryWrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
List<SOrder> list = list(queryWrapper); List<SOrder> list = list(queryWrapper);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list) | sOrder.getStatus().equals(OrderStatusEnum.INUSE.getCode())) {
// 使用中订单断电, 延时3分钟断电 // 使用中订单断电, 延时3分钟断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(),
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180); OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180);
} }
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo()); } else if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo()); //查询续单的前预定单
Date preStartDate = sOrder.getPreStartDate();
//查询预定的结束时间是否在续单的开始时间之后和开始时间加一分钟前
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
queryWrapper.between(SOrder::getEndDate, preStartDate, cn.hutool.core.date.DateUtil.offsetMinute(preStartDate, 1));
SOrder one = getOne(queryWrapper);
if (one.getStatus().equals(OrderStatusEnum.USED.getCode())) {
// 使用中订单断电, 延时3分钟断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(),
OpTypeEnum.CUT_ELECTRIC.getCode(), true, 180);
} else if (one.getStatus().equals(OrderStatusEnum.INUSE.getCode())) {
Map<String, String> map = new HashMap<>();
map.put("orderNo", one.getOrderNo());
map.put("expirationTime", one.getEndDate().toString());
JSONObject jsonObject = new JSONObject(map);
redisUtils.set(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + one.getOrderNo(), jsonObject.toString());
}
}
// 生成退款人工退款记录 // 生成退款人工退款记录
return orderRefundArtificialService.insertOrderRefundArtificial(artificial); return orderRefundArtificialService.insertOrderRefundArtificial(artificial);
} }
......
...@@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topic != null and topic != ''">and t1.topic = #{topic}</if> <if test="topic != null and topic != ''">and t1.topic = #{topic}</if>
<if test="storeId != null">and t4.id = #{storeId}</if> <if test="storeId != null">and t4.id = #{storeId}</if>
<if test="roomId != null">and t3.id = #{roomId}</if> <if test="roomId != null">and t3.id = #{roomId}</if>
<if test="createBy != null and createBy != ''">and t1.create_by = #{createBy}</if>
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
......
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