Commit 3dc7a59f by 吕明尚

优惠卷管理增加增加默认值

parent 2927be3b
...@@ -81,12 +81,7 @@ public class SCouponController extends BaseController ...@@ -81,12 +81,7 @@ public class SCouponController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SCoupon sCoupon) public AjaxResult add(@RequestBody SCoupon sCoupon)
{ {
if (StringUtils.isBlank(sCoupon.getRoomType())) {
sCoupon.setRoomType(RoomType.getCodeList());
}
if (StringUtils.isBlank(sCoupon.getStoreType())) {
sCoupon.setStoreType(StoreType.getCodeList());
}
return toAjax(sCouponService.insertSCoupon(sCoupon)); return toAjax(sCouponService.insertSCoupon(sCoupon));
} }
......
...@@ -66,8 +66,10 @@ public class SConsumerCoupon extends BaseEntity ...@@ -66,8 +66,10 @@ public class SConsumerCoupon extends BaseEntity
@Excel(name = "优惠结束(有效)时段") @Excel(name = "优惠结束(有效)时段")
private String couponTimeEnd; private String couponTimeEnd;
/** 优惠券类型(1:折扣券,2,满减券,3:时长券) */ /**
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:套餐劵)") * 优惠券类型(1:折扣券,2,团购券,3:满减券,4:时长券)
*/
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:时长券)")
private Integer couponType; private Integer couponType;
/** 门槛时长 */ /** 门槛时长 */
......
...@@ -57,8 +57,10 @@ public class SCoupon extends BaseEntity ...@@ -57,8 +57,10 @@ public class SCoupon extends BaseEntity
@Excel(name = "房间类型(1:中、2:大、3:豪华包)") @Excel(name = "房间类型(1:中、2:大、3:豪华包)")
private String roomType; private String roomType;
/** 优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额) */ /**
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:套餐劵)") * 优惠券类型(1:折扣券,2,团购券,3:满减券,4:时长券)
*/
@Excel(name = "优惠券类型(1:折扣券,2,团购券,3:满减券,4:时长券)")
private Integer couponType; private Integer couponType;
/** 门槛时长 */ /** 门槛时长 */
...@@ -85,8 +87,10 @@ public class SCoupon extends BaseEntity ...@@ -85,8 +87,10 @@ public class SCoupon extends BaseEntity
@Excel(name = "是否可叠加使用(0:不可叠加,1:可叠加)") @Excel(name = "是否可叠加使用(0:不可叠加,1:可叠加)")
private Integer isOverlay; private Integer isOverlay;
/** 第三方平台类型(1:美团,2,大众点评) */ /**
@Excel(name = "第三方平台类型(1:美团,2,大众点评)") * 第三方平台类型(1:自营,2:美团)
*/
@Excel(name = "第三方平台类型(1:自营,2:美团)")
private Integer platformType; private Integer platformType;
/** 优惠券数量 */ /** 优惠券数量 */
......
package share.system.service.impl; package share.system.service.impl;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import share.common.enums.RoomType;
import share.common.enums.StoreType;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,6 +24,15 @@ public class SCouponServiceImpl implements ISCouponService ...@@ -19,6 +24,15 @@ public class SCouponServiceImpl implements ISCouponService
{ {
@Autowired @Autowired
private SCouponMapper sCouponMapper; private SCouponMapper sCouponMapper;
//默认时长
private static final String DEFAULT_DURATION = "0";
//默认折扣最大时长
private static final String DEFAULT_MAX_DURATION = "999";
//默认优惠开始(有效)时段
private static final String DEFAULT_START_TIME = "00:00";
//默认优惠结束(有效)时段
private static final String DEFAULT_END_TIME = "24:00";
/** /**
* 查询优惠券 * 查询优惠券
...@@ -53,6 +67,16 @@ public class SCouponServiceImpl implements ISCouponService ...@@ -53,6 +67,16 @@ public class SCouponServiceImpl implements ISCouponService
@Override @Override
public int insertSCoupon(SCoupon sCoupon) public int insertSCoupon(SCoupon sCoupon)
{ {
if (StringUtils.isBlank(sCoupon.getRoomType())) {
sCoupon.setRoomType(RoomType.getCodeList());
}
if (StringUtils.isBlank(sCoupon.getStoreType())) {
sCoupon.setStoreType(StoreType.getCodeList());
}
sCoupon.setValidStartTime(DEFAULT_START_TIME);
sCoupon.setValidEndTime(DEFAULT_END_TIME);
sCoupon.setMinDuration(DEFAULT_DURATION);
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setCreateTime(DateUtils.getNowDate()); sCoupon.setCreateTime(DateUtils.getNowDate());
return sCouponMapper.insertSCoupon(sCoupon); return sCouponMapper.insertSCoupon(sCoupon);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment