提交代码

yy_dev
胡锐 1 year ago
parent 2e55eb832c
commit 9a0f8e853f
  1. 17
      cweb/src/main/java/com/cweb/controller/BsRebateActivityAccountController.java
  2. 9
      cweb/src/main/java/com/cweb/controller/BsRebateActivityController.java
  3. 10
      service/src/main/java/com/hfkj/entity/BsRebateActivity.java
  4. 1
      service/src/main/java/com/hfkj/service/rebate/impl/BsRebateActivityAccountServiceImpl.java

@ -5,6 +5,8 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsRebateActivity;
import com.hfkj.entity.BsRebateActivityAccount;
import com.hfkj.model.ResponseData;
import com.hfkj.service.rebate.BsRebateActivityAccountService;
import com.hfkj.service.rebate.BsRebateActivityService;
@ -17,6 +19,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
/**
* @className: BsRebateActivityController
@ -66,7 +69,19 @@ public class BsRebateActivityAccountController {
if (body == null || StringUtils.isBlank(body.getString("activityNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询活动
BsRebateActivity activity = rebateActivityService.getActivityByNo(body.getString("activityNo"));
if (activity == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动");
}
// 查询活动账户
BsRebateActivityAccount activityAccount = rebateActivityAccountService.getAccountByActivityNo(body.getString("activityNo"));
if (activityAccount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动账户");
}
if (activityAccount.getAmount().compareTo(new BigDecimal("0")) == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "活动账户余额不足");
}
Boolean result = rebateActivityAccountService.recover(body.getString("activityNo"));
if (!result) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "回收余额失败");

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

@ -110,6 +110,16 @@ public class BsRebateActivity implements Serializable {
private String ext3;
private String endTimeStr;
public String getEndTimeStr() {
return endTimeStr;
}
public void setEndTimeStr(String endTimeStr) {
this.endTimeStr = endTimeStr;
}
private BsRebateActivityAccount activityAccount;
public BsRebateActivityAccount getActivityAccount() {

@ -168,6 +168,7 @@ public class BsRebateActivityAccountServiceImpl implements BsRebateActivityAccou
record.setAmountBeforeChange(amountBeforeChange);
record.setAmountAfterChange(amountAfterChange);
record.setObjectType(RebateActivityAccountObjectTypeEnum.type2.getNumber());
record.setObjectId(activity.getId());
record.setObjectContent("活动余额回收");
rebateActivityAccountRecordService.insert(record);

Loading…
Cancel
Save