| @@ -241,6 +241,7 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| wxOrder.setCUserId(memberId); | |||
| wxOrder.updateTenantInfo(getTenantInfo()); | |||
| WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| if (wxOrderCVo == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| @@ -299,6 +300,7 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| wxOrder.setCUserId(memberId); | |||
| wxOrder.updateTenantInfo(getTenantInfo()); | |||
| WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| if (wxOrderCVo == null){ | |||
| wxOrderCVo = new WxOrderCouponVo(); | |||
| @@ -506,6 +508,7 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| wxOrder.setCUserId(memberId); | |||
| wxOrder.updateTenantInfo(getTenantInfo()); | |||
| List<WxOrderCouponVo> wxOrders = wxOrderService.goodsDetailCUserVo(wxOrder); | |||
| if (wxOrders == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.common.SortColumn; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| @@ -181,7 +182,7 @@ public class WxOrderCouponVo extends TenantEntity { | |||
| this.parentOrderId = o.getParentOrderId(); | |||
| } | |||
| public void initByCoupon(WxCoupon c) { | |||
| public void initByCoupon(WxCoupon c,boolean hasDetail) { | |||
| this.setType(c.getType()); | |||
| this.setCoverImg(c.getCoverImg()); | |||
| this.setTitle(c.getTitle()); | |||
| @@ -196,6 +197,20 @@ public class WxOrderCouponVo extends TenantEntity { | |||
| this.setValidEndDate(c.getValidEndDate()); | |||
| this.setPickStartDate(c.getPickStartDate()); | |||
| this.setPickEndDate(c.getPickEndDate()); | |||
| if (hasDetail) { | |||
| this.setDetail(c.getDetail()); | |||
| this.setRemark(c.getRemark()); | |||
| this.setGiftList(c.getGiftList()); | |||
| this.setSupportTransfer(c.getSupportTransfer()); | |||
| this.setSubsidyNum(c.getSubsidyNum()); | |||
| } | |||
| } | |||
| public void initByCouponOrder(WxCouponOrder couponOrder) { | |||
| this.setCouponOrderId(couponOrder.getId()); | |||
| this.setCouponOrderStatus(couponOrder.getCouponOrderStatus()); | |||
| this.setShippingStatus(couponOrder.getShippingStatus()); | |||
| this.setDeliveryInfo(couponOrder.getDeliveryInfo()); | |||
| } | |||
| } | |||
| @@ -30,7 +30,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<WxOrder> findListOfUnpaidGroupOrderByDate(Map dateMap); | |||
| List<WxOrder> findListOfCUser(WxOrder wxOrder); | |||
| List<WxOrderCouponVo> selectDetailOfCUser(WxOrder wxOrder); | |||
| List<WxOrder> selectDetailOfCUser(WxOrder wxOrder); | |||
| /** B端收银台(收款码支付) */ | |||
| Map dayMicroPayAmountList(Map dateMap); | |||
| @@ -1925,7 +1925,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| if (null != o.getProductId()) { | |||
| WxCoupon c = couponMap.get(o.getProductId()); | |||
| if (null != c) { | |||
| vo.initByCoupon(c); | |||
| vo.initByCoupon(c,false); | |||
| } | |||
| if (hasMerchant) { | |||
| vo.setMerchantVoList(wxMerchantService.findMerchantListByProduct(tenantEntity, o.getProductId(), false)); | |||
| @@ -1942,8 +1942,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| public WxOrderCouponVo detailCUserVo(WxOrder record) { | |||
| List<WxOrderCouponVo> list = wxOrderMapper.selectDetailOfCUser(record); | |||
| if (list.size() > 0) { | |||
| List<WxOrderCouponVo> list = toWxOrderCouponVoList(record,wxOrderMapper.selectDetailOfCUser(record)); | |||
| if (null != list && list.size() > 0) { | |||
| WxOrderCouponVo wxOrderCouponVo = list.get(0); | |||
| if(EnumCouponType.COUPON_GIFT.getCode().equals(wxOrderCouponVo.getType())){ | |||
| WxCoupon coupon = new WxCoupon(); | |||
| @@ -1961,7 +1961,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| public List<WxOrderCouponVo> goodsDetailCUserVo(WxOrder record) { | |||
| List<WxOrderCouponVo> list = wxOrderMapper.selectDetailOfCUser(record); | |||
| List<WxOrderCouponVo> list = toWxOrderCouponVoList(record,wxOrderMapper.selectDetailOfCUser(record)); | |||
| if(list != null && list.size() > 0){ | |||
| for (WxOrderCouponVo wxOrderCouponVo:list) { | |||
| if(EnumCouponType.COUPON_GIFT.getCode().equals(wxOrderCouponVo.getType())){ | |||
| @@ -1977,6 +1977,36 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| return list; | |||
| } | |||
| private List<WxOrderCouponVo> toWxOrderCouponVoList(TenantEntity tenantEntity,List<WxOrder> orderList) { | |||
| if (null == orderList || orderList.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| List<WxOrderCouponVo> voList = new ArrayList<WxOrderCouponVo>(); | |||
| for (int i = 0 ; i < orderList.size();i++) { | |||
| WxOrder order = orderList.get(i); | |||
| WxOrderCouponVo vo = new WxOrderCouponVo(); | |||
| vo.initByOrder(order); | |||
| WxCoupon couponQ = new WxCoupon(); | |||
| couponQ.updateTenantInfo(tenantEntity); | |||
| couponQ.setId(order.getProductId()); | |||
| WxCoupon coupon = wxCouponMapper.findSimpleDetail(couponQ); | |||
| if (null != coupon ) { | |||
| vo.initByCoupon(coupon, true); | |||
| } | |||
| WxCouponOrder couponOrderQ = new WxCouponOrder(); | |||
| couponOrderQ.updateTenantInfo(tenantEntity); | |||
| couponOrderQ.setOrderId(order.getId()); | |||
| List<WxCouponOrder> couponOrderList = wxCouponOrderMapper.findList(couponOrderQ); | |||
| if (null != couponOrderList && couponOrderList.size() > 0 ) { | |||
| WxCouponOrder couponOrder = wxCouponOrderMapper.findDetailOfCUser(couponOrderList.get(0).getId(), tenantEntity.getTenantId()); | |||
| vo.initByCouponOrder(couponOrder); | |||
| } | |||
| voList.add(vo); | |||
| } | |||
| return voList; | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @@ -343,7 +343,7 @@ | |||
| <select id="findSimpleDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select c.id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date, | |||
| c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type | |||
| c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.gift_list,c.support_transfer,c.subsidy_num | |||
| from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId} | |||
| </select> | |||