|
|
@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; |
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.entity.BsMer; |
|
|
|
import com.hfkj.entity.BsMer; |
|
|
|
import com.hfkj.entity.BsRebateActivity; |
|
|
|
import com.hfkj.entity.BsRebateActivity; |
|
|
@ -70,12 +71,12 @@ public class BsRebateActivityController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的活动类型"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的活动类型"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 优惠类型
|
|
|
|
// 优惠类型
|
|
|
|
RebateActivityPreferentialTypeEnum preferentialType = RebateActivityPreferentialTypeEnum.getDataByNumber(body.getInteger("activityType")); |
|
|
|
RebateActivityPreferentialTypeEnum preferentialType = RebateActivityPreferentialTypeEnum.getDataByNumber(body.getInteger("preferentialType")); |
|
|
|
if (preferentialType == null) { |
|
|
|
if (preferentialType == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠类型"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠类型"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 满减条件
|
|
|
|
// 满减条件
|
|
|
|
if (preferentialType.getNumber().equals(RebateActivityPreferentialTypeEnum.type3.getNumber()) |
|
|
|
if (preferentialType.getNumber().equals(RebateActivityPreferentialTypeEnum.type2.getNumber()) |
|
|
|
&& body.getBigDecimal("condition") == null) { |
|
|
|
&& body.getBigDecimal("condition") == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "满减类型未设置满减条件"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "满减类型未设置满减条件"); |
|
|
|
} |
|
|
|
} |
|
|
@ -139,7 +140,7 @@ public class BsRebateActivityController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的活动类型"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的活动类型"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 优惠类型
|
|
|
|
// 优惠类型
|
|
|
|
RebateActivityPreferentialTypeEnum preferentialType = RebateActivityPreferentialTypeEnum.getDataByNumber(body.getInteger("activityType")); |
|
|
|
RebateActivityPreferentialTypeEnum preferentialType = RebateActivityPreferentialTypeEnum.getDataByNumber(body.getInteger("preferentialType")); |
|
|
|
if (preferentialType == null) { |
|
|
|
if (preferentialType == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠类型"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠类型"); |
|
|
|
} |
|
|
|
} |
|
|
@ -165,7 +166,6 @@ public class BsRebateActivityController { |
|
|
|
if (!activity.getStatus().equals(RebateActivityStatusEnum.status1.getNumber())) { |
|
|
|
if (!activity.getStatus().equals(RebateActivityStatusEnum.status1.getNumber())) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前活动状态无法修改"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前活动状态无法修改"); |
|
|
|
} |
|
|
|
} |
|
|
|
activity.setActivityNo(System.currentTimeMillis()+""); |
|
|
|
|
|
|
|
activity.setActivityType(activityType.getNumber()); |
|
|
|
activity.setActivityType(activityType.getNumber()); |
|
|
|
activity.setPreferentialType(preferentialType.getNumber()); |
|
|
|
activity.setPreferentialType(preferentialType.getNumber()); |
|
|
|
activity.setPrice(body.getBigDecimal("price")); |
|
|
|
activity.setPrice(body.getBigDecimal("price")); |
|
|
@ -250,6 +250,7 @@ public class BsRebateActivityController { |
|
|
|
if (activity == null) { |
|
|
|
if (activity == null) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
activity.setEndTimeStr(DateUtil.date2String(activity.getEndTime(), "yyyy-MM-dd")); |
|
|
|
activity.setActivityAccount(rebateActivityAccountService.getAccountByActivityNo(activityNo)); |
|
|
|
activity.setActivityAccount(rebateActivityAccountService.getAccountByActivityNo(activityNo)); |
|
|
|
return ResponseMsgUtil.success(activity); |
|
|
|
return ResponseMsgUtil.success(activity); |
|
|
|
|
|
|
|
|
|
|
|