Commit 7289df2a by 吕明尚

修改优惠卷逻辑删除好查询不到的问题导致订单查询异常

parent 5b315375
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import share.system.domain.SConsumerCoupon;
import java.util.List;
/**
* 优惠券领取记录Mapper接口
*
......@@ -63,4 +65,8 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon);
List<SConsumerCoupon> querySConsumerCouponList(SConsumerCoupon sConsumerCoupon);
SConsumerCoupon queryById(Long couponId);
List<SConsumerCoupon> queryByIds(@Param("couponIds") List<Long> couponIds);
}
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SConsumerCoupon;
import share.system.request.CouponRequest;
import java.util.List;
/**
* 优惠券领取记录Service接口
*
......@@ -73,4 +74,8 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
List<SConsumerCoupon> availableCouponList(CouponRequest couponRequest);
int give(SConsumerCoupon sConsumerCoupon);
SConsumerCoupon queryById(Long couponId);
List<SConsumerCoupon> queryByIds(List<Long> couponIds);
}
......@@ -415,6 +415,16 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
return insert;
}
@Override
public SConsumerCoupon queryById(Long couponId) {
return baseMapper.queryById(couponId);
}
@Override
public List<SConsumerCoupon> queryByIds(List<Long> couponIds) {
return baseMapper.queryByIds(couponIds);
}
private void extracted(SConsumerCoupon item, BigDecimal bigDecimal, SRoom byId, BigDecimal subtract, SStore sStore) {
//计算价格
BigDecimal multiply = bigDecimal.multiply(byId.getPrice());
......
......@@ -1039,7 +1039,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo.setManager(store.getManager());
vo.setPhone(store.getPhone());
if (ObjectUtil.isNotEmpty(vo.getCouponId())) {
SConsumerCoupon consumerCoupon = consumerCouponService.getById(vo.getCouponId());
SConsumerCoupon consumerCoupon = consumerCouponService.queryById(vo.getCouponId());
vo.setCouponName(consumerCoupon.getName());
// 判断是否可以退款
vo.setIsRefund(isRefund(vo, consumerCoupon));
......@@ -1244,7 +1244,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
List<Long> packIds = orderList.stream().map(SOrder::getPackId).collect(Collectors.toList());
List<SStore> storeList = storeService.listByIds(storeIds);
List<SRoom> roomList = roomService.listByIds(roomIds);
List<SConsumerCoupon> userCouponList = consumerCouponService.listByIds(couponIds);
List<SConsumerCoupon> userCouponList = consumerCouponService.queryByIds(couponIds);
List<SPack> packList = packService.listByIds(packIds);
orderList.stream().forEach(o -> {
SOrderVo vo = new SOrderVo();
......
......@@ -143,6 +143,17 @@
<if test="consumerId != null ">and consumer_id = #{consumerId}</if>
</where>
</select>
<select id="queryById" resultType="share.system.domain.SConsumerCoupon">
<include refid="selectSConsumerCouponVo"/>
where id = #{id}
</select>
<select id="queryByIds" resultType="share.system.domain.SConsumerCoupon">
<include refid="selectSConsumerCouponVo"/>
where id in
<foreach item="id" collection="couponIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
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