| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.WxOrderCouponPressVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.enums.EnumCouponChannelStatus; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| @@ -270,5 +271,43 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("砍价订单-分页列表接口") | |||
| @GetMapping("pressOrderList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData pressOrderList(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | |||
| // c端用户应该只能看到自己的订单 | |||
| if (wxOrder == null) wxOrder = new WxOrder(); | |||
| WxCUser user = getUser(); | |||
| wxOrder.setcUserId(user.getId()); | |||
| wxOrder.setSortColumns(WxOrder.Field.CreateDate_DESC); | |||
| final PageInfo<WxOrderCouponPressVo> page = wxOrderService.listPressVoAsPage(wxOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("砍价订单-详情接口") | |||
| @GetMapping("pressOrderDetail") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "Long", paramType = "query", required = true) | |||
| }) | |||
| public ResultData pressOrderDetail(Long orderId) { | |||
| // c端用户应该只能看到自己的订单细节 | |||
| WxOrder wxOrder = new WxOrder(); | |||
| Long id = 0L; | |||
| try { | |||
| id = Long.valueOf(orderId); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("parse orderId failed"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常"); | |||
| } | |||
| wxOrder.setId(id); | |||
| wxOrder.setcUserId(getUser().getId()); | |||
| WxOrderCouponPressVo orderCouponPressVo = wxOrderService.detailPressVo(wxOrder); | |||
| if (orderCouponPressVo == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| return new ResultData(orderCouponPressVo); | |||
| } | |||
| } | |||
| @@ -38,17 +38,8 @@ public class WxPressOrderController extends BaseController { | |||
| @Autowired | |||
| WxOrderPressService wxOrderPressService; | |||
| // 砍价列表 - couponchannel | |||
| @ApiOperation("砍价订单-分页列表接口") | |||
| @GetMapping("pressOrderist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData pressOrderist(Integer pageNum, Integer pageSize) { | |||
| WxCUser user = getUser(); | |||
| return new ResultData(); | |||
| } | |||
| // 砍价列表 - /api/wxCouponChannel/list | |||
| // 砍价订单 - /api/order/pressOrderList | |||
| @ApiOperation("我的砍价-分页列表接口") | |||
| @GetMapping("pressCouponList") | |||
| @@ -60,14 +51,11 @@ public class WxPressOrderController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| // 发起砍价 | |||
| // 发起砍价 - /api/order/save | |||
| @ApiOperation("砍价详情") | |||
| @PostMapping("pressOrderDetail") | |||
| public ResultData pressOrderDetail() { | |||
| WxCUser user = getUser(); | |||
| return new ResultData(); | |||
| } | |||
| // 砍价券详情 | |||
| // 券包详情 | |||
| @ApiOperation("参与砍价") | |||
| @PostMapping("pressOrderJoin") | |||
| @@ -0,0 +1,171 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.WxOrderPress; | |||
| import java.util.List; | |||
| public class WxOrderCouponPressVo extends WxOrder { | |||
| /** 券ID-产品ID将来的产品都会放在coupon表里**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券包中券ID",name="couponOrderId") | |||
| private Long couponOrderId; | |||
| /** 0: 未使用 1: 已核销 2:已过期 3:已退款**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="0: 未使用 1: 已核销 2:已过期 3:已退款",name="couponOrderStatus") | |||
| private Integer couponOrderStatus; | |||
| /**券类型信息 */ | |||
| /**商户id**/ | |||
| /**券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,7.类储值卡,8.砍价券,9.团购券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,7.类储值卡,8.砍价券,9.团购券)",name="couponType") | |||
| private Integer couponType; | |||
| /**封面图**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
| private String coverImg; | |||
| /**券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| /**副标题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||
| private String subTitle; | |||
| /**售价(适用于类型2,3,4,5)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | |||
| private Integer salePrice; | |||
| /**使用条件金额(适用于类型1,2,3,4)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="使用条件金额(适用于类型1,2,3,4)",name="usePrice") | |||
| private Integer usePrice; | |||
| /**面额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | |||
| private Integer price; | |||
| /**单位**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||
| private Integer unit; | |||
| /**须知**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
| private String detail; | |||
| /**购买须知**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||
| private String remark; | |||
| /**砍价/团购限制人数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="砍价/团购限制人数",name="pressLimitNum") | |||
| private Integer pressLimitNum; | |||
| /**砍价信息列表*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户列表",name="orderPressList") | |||
| private List<WxOrderPress> orderPressList; | |||
| public Long getCouponOrderId() { | |||
| return couponOrderId; | |||
| } | |||
| public void setCouponOrderId(Long couponOrderId) { | |||
| this.couponOrderId = couponOrderId; | |||
| } | |||
| public Integer getCouponOrderStatus() { | |||
| return couponOrderStatus; | |||
| } | |||
| public void setCouponOrderStatus(Integer couponOrderStatus) { | |||
| this.couponOrderStatus = couponOrderStatus; | |||
| } | |||
| public Integer getCouponType() { | |||
| return couponType; | |||
| } | |||
| public void setCouponType(Integer couponType) { | |||
| this.couponType = couponType; | |||
| } | |||
| public String getCoverImg() { | |||
| return coverImg; | |||
| } | |||
| public void setCoverImg(String coverImg) { | |||
| this.coverImg = coverImg; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String title) { | |||
| this.title = title; | |||
| } | |||
| public String getSubTitle() { | |||
| return subTitle; | |||
| } | |||
| public void setSubTitle(String subTitle) { | |||
| this.subTitle = subTitle; | |||
| } | |||
| public Integer getSalePrice() { | |||
| return salePrice; | |||
| } | |||
| public void setSalePrice(Integer salePrice) { | |||
| this.salePrice = salePrice; | |||
| } | |||
| public Integer getUsePrice() { | |||
| return usePrice; | |||
| } | |||
| public void setUsePrice(Integer usePrice) { | |||
| this.usePrice = usePrice; | |||
| } | |||
| public Integer getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(Integer price) { | |||
| this.price = price; | |||
| } | |||
| public Integer getUnit() { | |||
| return unit; | |||
| } | |||
| public void setUnit(Integer unit) { | |||
| this.unit = unit; | |||
| } | |||
| @Override | |||
| public String getDetail() { | |||
| return detail; | |||
| } | |||
| @Override | |||
| public void setDetail(String detail) { | |||
| this.detail = detail; | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String remark) { | |||
| this.remark = remark; | |||
| } | |||
| public Integer getPressLimitNum() { | |||
| return pressLimitNum; | |||
| } | |||
| public void setPressLimitNum(Integer pressLimitNum) { | |||
| this.pressLimitNum = pressLimitNum; | |||
| } | |||
| public List<WxOrderPress> getOrderPressList() { | |||
| return orderPressList; | |||
| } | |||
| public void setOrderPressList(List<WxOrderPress> orderPressList) { | |||
| this.orderPressList = orderPressList; | |||
| } | |||
| } | |||
| @@ -38,4 +38,9 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| Long queryOrderForMerchantCount(Map<String,Object> params); | |||
| Long queryOrderForSum(Map<String,Object> params); | |||
| /**砍价*/ | |||
| List<WxOrderCouponPressVo> findListOfPress(WxOrder wxOrder); | |||
| WxOrderCouponPressVo selectDetailOfPress(WxOrder wxOrder); | |||
| } | |||
| @@ -8,7 +8,7 @@ import com.iformall.domain.po.WxOrderPress; | |||
| public interface WxOrderPressMapper extends CommonMapper<WxOrderPress, Long> { | |||
| List<WxOrderPress> findList(WxOrderPress wxOrderPress); | |||
| List<WxOrderPress> findPressList(Map paramMap); | |||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxOrderCouponPressVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.domain.vo.WxOrderQueryVo; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| @@ -148,5 +149,10 @@ public interface WxOrderService { | |||
| Map<String,Object> queryOrderSummary(String tenantId); | |||
| /** | |||
| * 砍价订单 | |||
| */ | |||
| PageInfo<WxOrderCouponPressVo> listPressVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize); | |||
| WxOrderCouponPressVo detailPressVo(WxOrder record); | |||
| } | |||
| @@ -7,10 +7,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.domain.vo.WxOrderPayVo; | |||
| import com.iformall.domain.vo.WxOrderQueryVo; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -1140,4 +1137,15 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| } | |||
| /** 砍价 */ | |||
| @Override | |||
| public PageInfo<WxOrderCouponPressVo> listPressVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfPress(record)); | |||
| } | |||
| @Override | |||
| public WxOrderCouponPressVo detailPressVo(WxOrder record) { | |||
| return wxOrderMapper.selectDetailOfPress(record); | |||
| } | |||
| } | |||
| @@ -551,5 +551,95 @@ | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <resultMap id="PressVoResultMap" type="com.iformall.domain.vo.WxOrderCouponPressVo"> | |||
| <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="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <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="order_status" jdbcType="INTEGER" property="orderStatus"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="press_end_date" jdbcType="TIMESTAMP" property="pressEndDate"/> | |||
| <result column="press_current_num" jdbcType="INTEGER" property="pressCurrentNum"/> | |||
| <result column="press_current_value" jdbcType="INTEGER" property="pressCurrentValue"/> | |||
| <result column="coupon_type" jdbcType="INTEGER" property="couponType"/> | |||
| <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="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId"/> | |||
| <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus"/> | |||
| <collection column="{orderId=order_number}" property="orderPressList" | |||
| ofType="com.iformall.domain.po.WxOrderPress" | |||
| javaType="java.util.List" | |||
| select="com.iformall.mapper.WxOrderPressMapper.findPressList" > | |||
| </collection> | |||
| </resultMap> | |||
| <sql id="allOrderPressListColumns"> | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status, | |||
| o.create_date,o.update_date,o.press_end_date,o.press_current_num,o.press_current_value, | |||
| c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.press_limit_num | |||
| </sql> | |||
| <sql id="allOrderPressDetailColumns"> | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status, | |||
| o.create_date,o.update_date,o.press_end_date,o.press_current_num,o.press_current_value, | |||
| c.type as coupon_type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,c.press_limit_num, | |||
| co.id as coupon_order_id,co.coupon_order_status | |||
| </sql> | |||
| <select id="findListOfPress" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap"> | |||
| select | |||
| <include refid="allCUserOrderListColumns"/> | |||
| 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 c.type == 7 | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test="orderStatus != null"> | |||
| AND o.order_status = #{orderStatus} | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="selectDetailOfPress" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap"> | |||
| select | |||
| <include refid="allOrderPressDetailColumns"/> | |||
| FROM wx_order o | |||
| left join wx_coupon c ON o.product_id = c.id | |||
| left join wx_coupon_order co on o.id = co.order_id | |||
| where o.product_id = c.id | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test="id != null"> | |||
| and o.id = #{id} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -43,6 +43,12 @@ | |||
| select <include refid="allColumns" /> from wx_order_press | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findPressList" parameterType="com.iformall.domain.po.WxOrderPress" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> | |||
| from wx_order_press | |||
| where order_id = #{orderId} | |||
| </select> | |||