|
|
|
@ -10,6 +10,7 @@ import com.hai.common.security.UserCenter; |
|
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
import com.hai.entity.HighDiscountAgentCode; |
|
|
|
|
import com.hai.entity.HighDiscountUserRel; |
|
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@ -41,6 +43,7 @@ public class DiscountController { |
|
|
|
|
@Resource |
|
|
|
|
private HighDiscountUserRelService discountUserRelService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询用户优惠券列表") |
|
|
|
@ -104,60 +107,6 @@ public class DiscountController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/useUserDiscount",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "使用优惠券") |
|
|
|
|
public ResponseData useUserDiscount(@RequestParam(name = "userDiscountId", required = true) Long userDiscountId) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); |
|
|
|
|
if (userInfoModel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
|
|
|
|
} |
|
|
|
|
HighDiscountUserRel rel = discountUserRelService.getRelById(userDiscountId); |
|
|
|
|
if (rel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券"); |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(rel); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getUserDiscountDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/cancelUserDiscount",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "取消使用优惠券") |
|
|
|
|
public ResponseData cancelUserDiscount(@RequestParam(name = "userDiscountId", required = true) Long userDiscountId) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); |
|
|
|
|
if (userInfoModel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
|
|
|
|
} |
|
|
|
|
HighDiscountUserRel rel = discountUserRelService.getRelById(userDiscountId); |
|
|
|
|
if (rel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券"); |
|
|
|
|
} |
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put("id", rel.getId()); |
|
|
|
|
param.put("userId", rel.getUserId()); |
|
|
|
|
param.put("discountId", rel.getDiscountId()); |
|
|
|
|
param.put("discountName", rel.getDiscountName()); |
|
|
|
|
param.put("discountType", rel.getDiscountType()); |
|
|
|
|
param.put("discountCondition", rel.getDiscountCondition()); |
|
|
|
|
param.put("discountPrice", rel.getDiscountPrice()); |
|
|
|
|
param.put("receiveTime", rel.getCreateTime()); |
|
|
|
|
param.put("status", rel.getStatus()); |
|
|
|
|
return ResponseMsgUtil.success(param); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getUserDiscountDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryUserDiscountList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询用户优惠券列表") |
|
|
|
@ -192,6 +141,40 @@ public class DiscountController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/hzfUserDiscountUse",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "【惠支付】优惠券使用") |
|
|
|
|
public ResponseData hzfUserDiscountUse(@RequestParam(name = "userDiscountId", required = true) Long userDiscountId, |
|
|
|
|
@RequestParam(name = "userPhone", required = true) String userPhone) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
discountUserRelService.hzfUserDiscountUse(userDiscountId, userPhone); |
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getUserDiscountDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/hzfUserDiscountReturn",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "【惠支付】优惠券退款") |
|
|
|
|
public ResponseData hzfUserDiscountReturn(@RequestParam(name = "userDiscountId", required = true) Long userDiscountId, |
|
|
|
|
@RequestParam(name = "userPhone", required = true) String userPhone) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
discountUserRelService.hzfUserDiscountReturn(userDiscountId, userPhone); |
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getUserDiscountDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryHzfDiscountList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询【惠支付】优惠列表") |
|
|
|
|