|
|
@ -18,6 +18,7 @@ import com.hai.enum_type.ActivityInfoStatus; |
|
|
|
import com.hai.enum_type.ActivityProductType; |
|
|
|
import com.hai.enum_type.ActivityProductType; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
|
|
|
import com.hai.service.HighActivityAwardService; |
|
|
|
import com.hai.service.HighActivityInfoService; |
|
|
|
import com.hai.service.HighActivityInfoService; |
|
|
|
import com.hai.service.HighActivityPartakeRuleService; |
|
|
|
import com.hai.service.HighActivityPartakeRuleService; |
|
|
|
import com.hai.service.HighCouponService; |
|
|
|
import com.hai.service.HighCouponService; |
|
|
@ -52,6 +53,9 @@ public class HighActivityInfoController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighActivityPartakeRuleService highActivityPartakeRuleService; |
|
|
|
private HighActivityPartakeRuleService highActivityPartakeRuleService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private HighActivityAwardService highActivityAwardService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighCouponService highCouponService; |
|
|
|
private HighCouponService highCouponService; |
|
|
|
|
|
|
|
|
|
|
@ -219,4 +223,79 @@ public class HighActivityInfoController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/startActivity",method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "活动开始") |
|
|
|
|
|
|
|
public ResponseData startActivity(@RequestBody JSONObject body) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (body == null || body.getLong("activityId") == null) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询活动信息
|
|
|
|
|
|
|
|
HighActivityInfo activityInfo = highActivityInfoService.getDetailById(body.getLong("activityId")); |
|
|
|
|
|
|
|
if (activityInfo == null) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动信息"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!activityInfo.getStatus().equals(ActivityInfoStatus.status1.getNumber())) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询奖励
|
|
|
|
|
|
|
|
if (highActivityAwardService.getListByActivityId(activityInfo.getId()).size() == 0) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置奖励"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
activityInfo.setStatus(ActivityInfoStatus.status2.getNumber()); |
|
|
|
|
|
|
|
activityInfo.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
highActivityInfoService.updateActivityInfo(activityInfo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighActivityController -> startActivity() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/endActivity",method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "活动结束") |
|
|
|
|
|
|
|
public ResponseData endActivity(@RequestBody JSONObject body) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (body == null || body.getLong("activityId") == null) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询活动信息
|
|
|
|
|
|
|
|
HighActivityInfo activityInfo = highActivityInfoService.getDetailById(body.getLong("activityId")); |
|
|
|
|
|
|
|
if (activityInfo == null) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到活动信息"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!activityInfo.getStatus().equals(ActivityInfoStatus.status2.getNumber())) { |
|
|
|
|
|
|
|
log.error("HighActivityInfoController -> editActivityInfo() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
activityInfo.setStatus(ActivityInfoStatus.status3.getNumber()); |
|
|
|
|
|
|
|
activityInfo.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
highActivityInfoService.updateActivityInfo(activityInfo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighActivityController -> endActivity() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|