| @@ -37,6 +37,9 @@ public class WxOrderPress implements Serializable { | |||||
| /**砍价时间*/ | /**砍价时间*/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="砍价时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="砍价时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| /**是否发起人*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否发起人",name="first") | |||||
| private Integer first; | |||||
| @@ -69,8 +69,8 @@ public class WxOrderCouponVo { | |||||
| /* 券类型信息 */ | /* 券类型信息 */ | ||||
| /*商户id**/ | /*商户id**/ | ||||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | |||||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,7.类储值卡,8.砍价券,9.团购券)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,7.类储值卡,8.砍价券,9.团购券)",name="type") | |||||
| private Integer type; | private Integer type; | ||||
| /*封面图**/ | /*封面图**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | ||||
| @@ -3,10 +3,8 @@ package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxOrderPress; | import com.iformall.domain.po.WxOrderPress; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | |||||
| @Data | @Data | ||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class WxOrderPressVo extends WxOrderPress { | public class WxOrderPressVo extends WxOrderPress { | ||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumOrderPressType { | |||||
| FIRST(1,"首次砍价/发起砍价"), | |||||
| NORMAL(0,"非首次砍价") | |||||
| ; | |||||
| public static EnumOrderPressType getEnum(Integer code) { | |||||
| for (EnumOrderPressType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumOrderPressType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxOrderPress; | import com.iformall.domain.po.WxOrderPress; | ||||
| import com.iformall.enums.EnumOrderPressType; | |||||
| import com.iformall.enums.EnumOrderStatus; | import com.iformall.enums.EnumOrderStatus; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| @@ -70,6 +71,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { | |||||
| orderPressQ.setUserId(user.getId()); | orderPressQ.setUserId(user.getId()); | ||||
| int count = wxOrderPressMapper.selectCount(orderPressQ); | int count = wxOrderPressMapper.selectCount(orderPressQ); | ||||
| if(count > 1) { | if(count > 1) { | ||||
| logger.error("用户已参与砍价: " + user.getId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_PRESS_IS_EXIST); | throw new MallinkException(ErrorCode.COUPON_PRESS_IS_EXIST); | ||||
| } | } | ||||
| @@ -82,13 +84,14 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { | |||||
| orderPress.setOrderId(order.getId()); | orderPress.setOrderId(order.getId()); | ||||
| orderPress.setUserId(user.getId()); | orderPress.setUserId(user.getId()); | ||||
| orderPress.setCreateDate(curDate); | orderPress.setCreateDate(curDate); | ||||
| orderPress.setFirst(EnumOrderPressType.NORMAL.getCode()); | |||||
| orderPress.setPressValue(PressUtils.stateLessPressValue(total, left_total, coupon.getPressLimitNum(), order.getPressCurrentNum())); | orderPress.setPressValue(PressUtils.stateLessPressValue(total, left_total, coupon.getPressLimitNum(), order.getPressCurrentNum())); | ||||
| try { | try { | ||||
| // 保存订单 | // 保存订单 | ||||
| wxOrderPressMapper.insertSelective(orderPress); | wxOrderPressMapper.insertSelective(orderPress); | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| logger.error("保存砍价记录Err:" + e.getMessage()); | |||||
| logger.error("保存砍价记录Error:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| @@ -109,7 +112,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { | |||||
| // 保存订单 | // 保存订单 | ||||
| wxOrderMapper.updateByPrimaryKeySelective(orderUpdatePress); | wxOrderMapper.updateByPrimaryKeySelective(orderUpdatePress); | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| logger.error("更新订单Err:" + e.getMessage()); | |||||
| logger.error("更新订单Error:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| } | } | ||||
| @@ -401,6 +401,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| orderPress.setOrderId(orderNumber); | orderPress.setOrderId(orderNumber); | ||||
| orderPress.setUserId(user.getId()); | orderPress.setUserId(user.getId()); | ||||
| orderPress.setCreateDate(curr); | orderPress.setCreateDate(curr); | ||||
| orderPress.setFirst(EnumOrderPressType.FIRST.getCode()); | |||||
| int lPressValue = PressUtils.stateLessPressValue(total, left_total, coupon.getPressLimitNum(), 0); | int lPressValue = PressUtils.stateLessPressValue(total, left_total, coupon.getPressLimitNum(), 0); | ||||
| orderPress.setPressValue(lPressValue); | orderPress.setPressValue(lPressValue); | ||||
| @@ -219,7 +219,7 @@ | |||||
| from wx_coupon c,wx_order o | from wx_coupon c,wx_order o | ||||
| left join wx_coupon_order co on co.order_id = o.id | left join wx_coupon_order co on co.order_id = o.id | ||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | ||||
| where o.product_id = c.id and c.type != 7 and c.type != 8 | |||||
| where o.product_id = c.id and c.type != 7 | |||||
| <if test="cUserId != null"> | <if test="cUserId != null"> | ||||
| and o.c_user_id = #{cUserId} | and o.c_user_id = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -8,10 +8,11 @@ | |||||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | <result column="user_id" jdbcType="BIGINT" property="userId" /> | ||||
| <result column="press_value" jdbcType="INTEGER" property="pressValue" /> | <result column="press_value" jdbcType="INTEGER" property="pressValue" /> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="first" jdbcType="SMALLINT" property="first" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`order_id`,`user_id`,`press_value`,`create_date` | |||||
| `id`,`order_id`,`user_id`,`press_value`,`create_date`,`first` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -55,13 +56,14 @@ | |||||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | <result column="user_id" jdbcType="BIGINT" property="userId" /> | ||||
| <result column="press_value" jdbcType="INTEGER" property="pressValue" /> | <result column="press_value" jdbcType="INTEGER" property="pressValue" /> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="first" jdbcType="SMALLINT" property="first" /> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | ||||
| <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/> | <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allVoColumns"> | <sql id="allVoColumns"> | ||||
| op.`id`,op.`order_id`,op.`user_id`,op.`press_value`,op.`create_date`, | |||||
| op.`id`,op.`order_id`,op.`user_id`,op.`press_value`,op.`create_date`,op.`first`, | |||||
| cu.`nick_name`, cu.`avatar_url` | cu.`nick_name`, cu.`avatar_url` | ||||
| </sql> | </sql> | ||||