|
@@ -4,10 +4,15 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qs.mp.admin.domain.Coupon;
|
|
|
+import com.qs.mp.admin.domain.CouponChannel;
|
|
|
import com.qs.mp.admin.domain.CouponTicket;
|
|
|
+import com.qs.mp.admin.domain.Goods;
|
|
|
+import com.qs.mp.admin.domain.GoodsSku;
|
|
|
import com.qs.mp.admin.domain.param.CouponParam;
|
|
|
import com.qs.mp.admin.domain.param.GoodsParam;
|
|
|
import com.qs.mp.admin.domain.vo.CouponVO;
|
|
|
+import com.qs.mp.admin.domain.vo.GoodsVO;
|
|
|
+import com.qs.mp.admin.service.ICouponChannelService;
|
|
|
import com.qs.mp.admin.service.ICouponService;
|
|
|
import com.qs.mp.admin.service.ICouponTicketService;
|
|
|
import com.qs.mp.common.constant.UserConstants;
|
|
@@ -24,10 +29,14 @@ import ma.glasnost.orika.MapperFacade;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collector;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -52,6 +61,9 @@ public class CouponMgrController extends BaseApiController {
|
|
|
|
|
|
@Autowired
|
|
|
private ICouponTicketService couponTicketService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICouponChannelService couponChannelService;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysUserService userService;
|
|
@@ -75,7 +87,46 @@ public class CouponMgrController extends BaseApiController {
|
|
|
list = couponService.list(queryWrapper);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取代金券详情信息
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/detail")
|
|
|
+ public AjaxResult getCouponDetail(@RequestBody JSONObject jsonObject) {
|
|
|
+ String couponId = jsonObject.getString("couponId");
|
|
|
+ if (StringUtils.isBlank(couponId)){
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ Coupon coupon = couponService.getById(couponId);
|
|
|
+ if(null == coupon || StringUtils.isBlank(coupon.getCouponId())) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ CouponVO couponVO = new CouponVO();
|
|
|
+ BeanUtils.copyProperties(coupon, couponVO);
|
|
|
+ // 查询盲票限制列表
|
|
|
+ List<CouponTicket> ticketList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<CouponTicket> ticketQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ ticketQueryWrapper.eq(CouponTicket::getCouponId, coupon.getCouponId());
|
|
|
+ ticketQueryWrapper.orderByDesc(CouponTicket::getCreatedTime);
|
|
|
+ ticketList = couponTicketService.list(ticketQueryWrapper);
|
|
|
+ if(null != ticketList && ticketList.size() > 0) {
|
|
|
+ couponVO.setBoxIdList(ticketList.stream().map(CouponTicket::getBoxId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ // 查询门店限制列表
|
|
|
+ List<CouponChannel> channelList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<CouponChannel> channelQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ channelQueryWrapper.eq(CouponChannel::getCouponId, coupon.getCouponId());
|
|
|
+ channelQueryWrapper.orderByDesc(CouponChannel::getCreatedTime);
|
|
|
+ channelList = couponChannelService.list(channelQueryWrapper);
|
|
|
+ if(null != channelList && channelList.size() > 0) {
|
|
|
+ couponVO.setChannelIdList(channelList.stream().map(CouponChannel::getChannelId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ return AjaxResult.success(couponVO);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 新增代金券信息
|