Browse Source

update couponOrder

release_toaliyun_real
xhxu 4 years ago
parent
commit
fab0b2348c
5 changed files with 130 additions and 25 deletions
  1. +0
    -14
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  2. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java
  4. +10
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  5. +113
    -9
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml

+ 0
- 14
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java View File

@@ -456,20 +456,6 @@ public class WxOrderController extends BaseController {
wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
final PageInfo<WxOrderCouponVo> page = wxOrderService.listGoodsCAsPage(wxOrder, pageNum, pageSize);

Date now = new Date();
page.getList().stream().forEach(oc->{
if (oc.getValidStartDate() != null && oc.getValidEndDate() != null ) {
if (oc.getValidStartDate().getTime() > now.getTime()) {
oc.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode());
} else if (oc.getValidEndDate().getTime() < now.getTime()) {
oc.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode());
} else {
oc.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode());
}
}
});


return new ResultData(page);
}



+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxOrderCouponVo.java View File

@@ -22,6 +22,11 @@ public class WxOrderCouponVo extends TenantEntity {
@TableField(exist = false)
private Integer validStatus;

@TableField(exist = false)
private Integer level;
@TableField(exist = false)
private List<WxOrderCouponVo> orderCouponVoList;

/** 基础购买到的券信息 */
@io.swagger.annotations.ApiModelProperty(value="订单码;正反向交易保持一致。",name="orderNumber")
private Long orderNumber;


+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumComposeOrder.java View File

@@ -10,7 +10,8 @@ public enum EnumComposeOrder {
SINGLE(0, "单个订单类型,如拼团,砍价"),
ONE_NUMBER_ORDER_BATCH(1, "购物车式组合下单,1个数量1个订单(针对同样产品)"),
MULITY_NUMBER_ORDER_BATCH(2,"购物车式组合下单,多个数量1个订单(针对同样产品)"),
PACKAGECOUPON(3,"券包订单类型")
PACKAGECOUPON(3,"券包订单类型"),
PACKAGECOUPON_SUB(4,"券包子订单类型")
;

public static EnumComposeOrder getEnum(Integer code) {


+ 10
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -2522,7 +2522,16 @@ public class WxOrderServiceImpl implements WxOrderService {

@Override
public PageInfo<WxOrderCouponVo> listGoodsCAsPage(WxOrder record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.listGoodsCAsPage(record));
PageInfo<WxOrderCouponVo> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.listGoodsCAsPage(record));
page.getList().stream().forEach(oc->{
if(oc.getLevel().equals(1)){
record.setComposeOrderId(oc.getComposeOrderId());
record.setOrderStatus(oc.getOrderStatus());
oc.setOrderCouponVoList(wxOrderMapper.findListOfCUser(record));
}
});

return page;
}

private WxCoupon singleOrderCheck(OrderSaveDto orderSaveDto,int productCount,WxCUserBasicInfo wxCUserBasicInfo,EnumPayWay payWay,TenantEntity tenantEntity,int curindex,boolean singleProduct) {


+ 113
- 9
mallinkService/src/main/resources/mapper/WxOrderMapper.xml View File

@@ -299,9 +299,12 @@
</update>
<resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCouponVo">
<resultMap id="CVoListMap" type="com.iformall.domain.vo.WxOrderCouponVo">

<id column="id" jdbcType="BIGINT" property="id"/>

<result column="level" jdbcType="INTEGER" property="level"/>

<result column="order_number" jdbcType="BIGINT" property="orderNumber"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
@@ -348,6 +351,57 @@
<result column="shipping_status" jdbcType="INTEGER" property="shippingStatus"/>
<result column="delivery_info" jdbcType="VARCHAR" property="deliveryInfo"/>

</resultMap>

<resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCouponVo">

<id column="id" jdbcType="BIGINT" property="id"/>
<result column="order_number" jdbcType="BIGINT" property="orderNumber"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
<result column="coupon_channel_id" jdbcType="BIGINT" property="couponChannelId"/>
<result column="product_id" jdbcType="BIGINT" property="productId"/>
<result column="payment_type" jdbcType="INTEGER" property="paymentType"/>
<result column="payment" jdbcType="INTEGER" property="payment"/>
<result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/>
<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="order_status" jdbcType="INTEGER" property="orderStatus"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>

<result column="type" jdbcType="INTEGER" property="type"/>
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="detail" jdbcType="VARCHAR" property="detail"/>
<result column="price" jdbcType="INTEGER" property="price"/>
<result column="tail_price" jdbcType="INTEGER" property="tailPrice"/>
<result column="orig_price" jdbcType="INTEGER" property="origPrice"/>
<result column="unit" jdbcType="INTEGER" property="unit"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
<result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"></result>

<result column="pick_start_date" jdbcType="TIMESTAMP" property="pickStartDate"/>
<result column="pick_end_date" jdbcType="TIMESTAMP" property="pickEndDate"/>

<result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId"/>
<result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus"/>
<result column="send_channel_type" jdbcType="INTEGER" property="sendChannelType" />
<result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>

<result column="compose_order_type" jdbcType="INTEGER" property="composeOrderType" />
<result column="compose_order_id" jdbcType="BIGINT" property="composeOrderId" />

<result column="shipping_type" jdbcType="INTEGER" property="shippingType"/>
<result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/>
<result column="shipping_status" jdbcType="INTEGER" property="shippingStatus"/>
<result column="delivery_info" jdbcType="VARCHAR" property="deliveryInfo"/>

<collection column="{productId=product_id,tenantId=tenant_id}" property="merchantVoList"
ofType="com.iformall.domain.vo.WxMerchantVo"
javaType="java.util.List"
@@ -394,12 +448,17 @@
<if test=" null != sortColumns">order by ${sortColumns}</if>
</select>

<select id="listGoodsCAsPage" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">
select
<include refid="allCUserOrderListColumns"/>
<select id="listGoodsCAsPage" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoListMap">
select * from(

select 0 level,o.compose_order_type,o.compose_order_id,o.order_status,o.create_date,
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.update_date,
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.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,
o.`freight_price`,o.`shipping_type`,o.`shipping_address`
from wx_coupon c,wx_order o
left join wx_coupon_order co on co.order_id = o.id
where o.product_id = c.id and o.order_status in (0,1,2,3,4,5)
where o.product_id = c.id and o.order_status in (0,2)
and o.compose_order_type in (0,3)
and o.compose_order_id = 0
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
@@ -409,13 +468,58 @@
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != composeOrderId ">
and o.`compose_order_id` = #{composeOrderId}
<if test="orderStatus != null">
AND o.order_status = #{orderStatus}
</if>

union all

select 0 level, o.compose_order_type,o.compose_order_id,o.order_status,o.create_date,
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.update_date,
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.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,
o.`freight_price`,o.`shipping_type`,o.`shipping_address`
from wx_coupon c,wx_order o
where o.product_id = c.id and o.order_status in (1,3,4,5)
and o.compose_order_type in (0,1,2,3)
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="orderStatus != null">
AND o.order_status = #{orderStatus}
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>

union all

select 1 level,o.compose_order_type,o.compose_order_id,o.order_status,min(create_date) create_date,
null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,
null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,
null ,null ,null
from wx_order o
where o.order_status in (0,2)
and o.compose_order_type in (1,2)
and o.compose_order_id &gt; 0
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="orderStatus != null">
AND o.order_status = #{orderStatus}
</if>
group by o.compose_order_type,o.compose_order_id

) a
order by a.create_date desc
</select>

<select id="selectDetailOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap">


Loading…
Cancel
Save