dev-discount
袁野 4 years ago
commit 90c55ae99b
  1. 8
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 47
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  3. 143
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  4. 54
      hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java
  5. 19
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapper.java
  6. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelSqlProvider.java
  7. 19
      hai-service/src/main/java/com/hai/dao/HighOrderMapper.java
  8. 28
      hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java
  9. 2
      hai-service/src/main/java/com/hai/dao/SecUserMapperExt.java
  10. 16
      hai-service/src/main/java/com/hai/entity/HighDiscountUserRel.java
  11. 60
      hai-service/src/main/java/com/hai/entity/HighDiscountUserRelExample.java
  12. 32
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  13. 130
      hai-service/src/main/java/com/hai/entity/HighOrderExample.java
  14. 7
      hai-service/src/main/java/com/hai/service/HighDiscountCouponRelService.java
  15. 18
      hai-service/src/main/java/com/hai/service/HighDiscountUserRelService.java
  16. 16
      hai-service/src/main/java/com/hai/service/impl/HighDiscountCouponRelServiceImpl.java
  17. 20
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java
  18. 25
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  19. 4
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -134,6 +134,14 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
} }
// 计算销售截止时间
Calendar salesEndTime = Calendar.getInstance();
salesEndTime.setTime(highCoupon.getSalesEndTime());
salesEndTime.set(Calendar.HOUR_OF_DAY, 23);
salesEndTime.set(Calendar.MINUTE, 59);
salesEndTime.set(Calendar.SECOND, 59);
highCoupon.setSalesEndTime(salesEndTime.getTime());
String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddHHmmss"); //订单号生成 年月日小时分秒 + 5位随机数 String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddHHmmss"); //订单号生成 年月日小时分秒 + 5位随机数
highCoupon.setCouponKey(setCouponKey); highCoupon.setCouponKey(setCouponKey);
highCoupon.setCompanyId(merchant.getCompanyId()); highCoupon.setCompanyId(merchant.getCompanyId());

@ -1,5 +1,6 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -7,6 +8,7 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighDiscount; import com.hai.entity.HighDiscount;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -72,11 +76,19 @@ public class HighDiscountController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
// 计算销售截止时间
Calendar salesEndTime = Calendar.getInstance();
salesEndTime.setTime(highDiscount.getSalesEndTime());
salesEndTime.set(Calendar.HOUR_OF_DAY, 23);
salesEndTime.set(Calendar.MINUTE, 59);
salesEndTime.set(Calendar.SECOND, 59);
highDiscount.setSalesEndTime(salesEndTime.getTime());
highDiscount.setDiscountKey(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
highDiscount.setCompanyId(userInfoModel.getBsCompany().getId()); highDiscount.setCompanyId(userInfoModel.getBsCompany().getId());
highDiscount.setOperatorId(userInfoModel.getSecUser().getId()); highDiscount.setOperatorId(userInfoModel.getSecUser().getId());
highDiscount.setOperatorName(userInfoModel.getSecUser().getUserName()); highDiscount.setOperatorName(userInfoModel.getSecUser().getUserName());
highDiscount.setStatus(1); highDiscount.setStatus(1);
highDiscountService.insertDiscount(highDiscount); highDiscountService.insertDiscount(highDiscount);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -113,11 +125,18 @@ public class HighDiscountController {
log.error("HighDiscountController -> updateDiscount() error!","未找到优惠券信息"); log.error("HighDiscountController -> updateDiscount() error!","未找到优惠券信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_DISCOUNT, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_DISCOUNT, "");
} }
// 计算销售截止时间
Calendar salesEndTime = Calendar.getInstance();
salesEndTime.setTime(highDiscount.getSalesEndTime());
salesEndTime.set(Calendar.HOUR_OF_DAY, 23);
salesEndTime.set(Calendar.MINUTE, 59);
salesEndTime.set(Calendar.SECOND, 59);
discount.setSalesEndTime(salesEndTime.getTime());
discount.setDiscountName(highDiscount.getDiscountName()); discount.setDiscountName(highDiscount.getDiscountName());
discount.setDiscountImg(highDiscount.getDiscountImg()); discount.setDiscountImg(highDiscount.getDiscountImg());
discount.setDiscountCarouselImg(highDiscount.getDiscountCarouselImg()); discount.setDiscountCarouselImg(highDiscount.getDiscountCarouselImg());
discount.setEffectiveDay(highDiscount.getEffectiveDay()); discount.setEffectiveDay(highDiscount.getEffectiveDay());
discount.setSalesEndTime(highDiscount.getSalesEndTime());
highDiscountService.updateDiscount(highDiscount); highDiscountService.updateDiscount(highDiscount);
@ -129,6 +148,29 @@ public class HighDiscountController {
} }
@RequestMapping(value="/updateDiscountStatus",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改优惠券状态")
public ResponseData updateDiscountStatus(@RequestParam(name = "discountId", required = true) Long discountId,
@RequestParam(name = "status", required = true) Integer status) {
try {
// 查询优惠券
HighDiscount discount = highDiscountService.getDiscountById(discountId);
if (discount == null) {
log.error("HighDiscountController -> updateDiscountStatus() error!","未找到优惠券信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_DISCOUNT, "");
}
discount.setStatus(status);
discount.setUpdateTime(new Date());
highDiscountService.updateDiscount(discount);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighDiscountController -> updateDiscountStatus() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDiscountById",method = RequestMethod.GET) @RequestMapping(value="/getDiscountById",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "根据id查询") @ApiOperation(value = "根据id查询")
@ -167,5 +209,4 @@ public class HighDiscountController {
} }
} }
} }

@ -14,10 +14,7 @@ import com.hai.entity.*;
import com.hai.model.HighCouponModel; import com.hai.model.HighCouponModel;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighCouponCodeService; import com.hai.service.*;
import com.hai.service.HighCouponService;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -29,9 +26,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -57,6 +53,12 @@ public class HighOrderController {
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private HighDiscountCouponRelService highDiscountCouponRelService;
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;
@ -96,6 +98,20 @@ public class HighOrderController {
log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
} }
// 校验优惠券是否可用
if (highOrder.getMemDiscountId() != null) {
List<HighDiscountCouponRel> discountCouponRelList = highDiscountCouponRelService.getRelByCoupon(coupon.getId());
if (discountCouponRelList.size() > 0) {
List<HighDiscountCouponRel> collect = discountCouponRelList.stream().filter(o -> o.getDiscountId().equals(highOrder.getMemDiscountId())).collect(Collectors.toList());
if (collect == null || collect.size() == 0) {
log.error("HighOrderController --> addOrder() error!", "无法使用优惠券");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法使用优惠券");
}
}
}
// 是否到底限购数量 // 是否到底限购数量
if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) {
log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); log.error("HighOrderController --> addOrder() error!", "已达到限购数量");
@ -137,11 +153,58 @@ public class HighOrderController {
totalPrice = totalPrice.add(childOrder.getTotalPrice()); totalPrice = totalPrice.add(childOrder.getTotalPrice());
} }
// 是否使用了优惠券
if (highOrder.getMemDiscountId() != null) {
// 卡优惠券信息
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId());
if (rel == null || rel.getStatus() != 1) {
log.error("HighOrderController --> addOrder() error!", "优惠券状态错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券状态错误");
}
highOrder.setMemDiscountName(rel.getHighDiscount().getDiscountName());
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 1) {
// 如果订单总额 小于 满减价格
if (highOrder.getTotalPrice().compareTo(rel.getHighDiscount().getDiscountCondition()) > 1) {
log.error("HighOrderController --> addOrder() error!", "订单未达到满减额度");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+rel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券");
}
// 订单总额 - 满减额度
BigDecimal total = highOrder.getTotalPrice().subtract(rel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (total.compareTo(new BigDecimal("0")) == -1) {
highOrder.setTotalPrice(new BigDecimal("0"));
} else {
highOrder.setTotalPrice(total);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 2) {
// 订单总额 - 满减额度
BigDecimal total = highOrder.getTotalPrice().subtract(rel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (total.compareTo(new BigDecimal("0")) == -1) {
highOrder.setTotalPrice(new BigDecimal("0"));
} else {
highOrder.setTotalPrice(total);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 3) {
// 折扣除100
BigDecimal discountPrice = rel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("100"));
// 订单总额 * 折扣
BigDecimal total = highOrder.getTotalPrice().multiply(discountPrice);
highOrder.setTotalPrice(total);
}
}
highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
highOrder.setMemId(userInfoModel.getHighUser().getId()); highOrder.setMemId(userInfoModel.getHighUser().getId());
highOrder.setMemName(userInfoModel.getHighUser().getName()); highOrder.setMemName(userInfoModel.getHighUser().getName());
highOrder.setMemPhone(userInfoModel.getHighUser().getPhone()); highOrder.setMemPhone(userInfoModel.getHighUser().getPhone());
highOrder.setTotalPrice(totalPrice);
highOrder.setPayPrice(totalPrice); highOrder.setPayPrice(totalPrice);
highOrder.setCreateTime(new Date()); highOrder.setCreateTime(new Date());
highOrder.setOrderStatus(1); highOrder.setOrderStatus(1);
@ -156,7 +219,6 @@ public class HighOrderController {
} }
} }
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET) @RequestMapping(value = "/getOrderById", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "根据id查询订单详情") @ApiOperation(value = "根据id查询订单详情")
@ -171,6 +233,68 @@ public class HighOrderController {
} }
} }
/*
@RequestMapping(value = "/calculateOrder", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "计算订单详情")
public ResponseData calculateOrder(@RequestParam(name = "orderId", required = true) Long orderId,
@RequestParam(name = "userDiscountId", required = false) Long userDiscountId) {
try {
HighOrder order = highOrderService.getOrderById(orderId);
if (order != null && userDiscountId != null) {
// 卡优惠券信息
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(userDiscountId);
order.setMemDiscountId(userDiscountId);
order.setMemDiscountName(rel.getHighDiscount().getDiscountName());
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 1) {
// 如果订单总额 小于 满减价格
if (order.getTotalPrice().compareTo(rel.getHighDiscount().getDiscountCondition()) > 1) {
log.error("HighOrderController --> addOrder() error!", "订单未达到满减额度");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+rel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券");
}
// 订单总额 - 满减额度
BigDecimal totalPrice = order.getTotalPrice().subtract(rel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (totalPrice.compareTo(new BigDecimal("0")) == -1) {
order.setTotalPrice(new BigDecimal("0"));
} else {
order.setTotalPrice(totalPrice);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 2) {
// 订单总额 - 满减额度
BigDecimal totalPrice = order.getTotalPrice().subtract(rel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (totalPrice.compareTo(new BigDecimal("0")) == -1) {
order.setTotalPrice(new BigDecimal("0"));
} else {
order.setTotalPrice(totalPrice);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (rel.getHighDiscount().getDiscountType() == 3) {
// 折扣除100
BigDecimal discountPrice = rel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("100"));
// 订单总额 * 折扣
BigDecimal totalPrice = order.getTotalPrice().multiply(discountPrice);
order.setTotalPrice(totalPrice);
}
}
return ResponseMsgUtil.success(order);
} catch (Exception e) {
log.error("HighOrderController --> cancelOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
*/
@RequestMapping(value = "/cancelOrder", method = RequestMethod.GET) @RequestMapping(value = "/cancelOrder", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "取消订单") @ApiOperation(value = "取消订单")
@ -187,7 +311,6 @@ public class HighOrderController {
} }
} }
@RequestMapping(value = "/getUserOrderList", method = RequestMethod.GET) @RequestMapping(value = "/getUserOrderList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取用户订单") @ApiOperation(value = "获取用户订单")

@ -9,8 +9,12 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountCouponRel;
import com.hai.entity.HighDiscountUserRel;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighDiscountCouponRelService;
import com.hai.service.HighDiscountUserRelService; import com.hai.service.HighDiscountUserRelService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -22,8 +26,11 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -43,6 +50,9 @@ public class HighUserDiscountController {
@Resource @Resource
private HighDiscountUserRelService highDiscountUserRelService; private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private HighDiscountCouponRelService highDiscountCouponRelService;
@RequestMapping(value="/receiveDiscount",method = RequestMethod.POST) @RequestMapping(value="/receiveDiscount",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "用户领取优惠券") @ApiOperation(value = "用户领取优惠券")
@ -59,7 +69,7 @@ public class HighUserDiscountController {
log.error("HighDiscountController -> receiveDiscount() error!", "参数错误"); log.error("HighDiscountController -> receiveDiscount() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
// 领取成功 // 领取
highDiscountUserRelService.receiveDiscount(userInfoModel.getHighUser().getId(), discountAgentId); highDiscountUserRelService.receiveDiscount(userInfoModel.getHighUser().getId(), discountAgentId);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -69,7 +79,7 @@ public class HighUserDiscountController {
} }
} }
@RequestMapping(value="/getUserDiscountList",method = RequestMethod.POST) @RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取用户的优惠券列表") @ApiOperation(value = "获取用户的优惠券列表")
public ResponseData getUserDiscountList(@RequestParam(name = "status", required = false) Integer status, public ResponseData getUserDiscountList(@RequestParam(name = "status", required = false) Integer status,
@ -90,7 +100,45 @@ public class HighUserDiscountController {
return ResponseMsgUtil.success(new PageInfo<>(highDiscountUserRelService.getDiscountList(map))); return ResponseMsgUtil.success(new PageInfo<>(highDiscountUserRelService.getDiscountList(map)));
} catch (Exception e) { } catch (Exception e) {
log.error("HighDiscountController -> receiveDiscount() error!",e); log.error("HighDiscountController -> getUserDiscountList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getUserNormalDiscountList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据卡券,查询【可以使用】优惠券列表")
public ResponseData getDiscountListByCoupon(@RequestParam(name = "couponId", required = true) Long couponId,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
map.put("status", 1);
List<HighDiscountUserRel> list = new ArrayList<>();
// 查询用户的优惠券
List<HighDiscountUserRel> userRels = highDiscountUserRelService.getDiscountList(map);
if (userRels.size() > 0) {
// 查询当前卡券有哪些优惠券
List<HighDiscountCouponRel> discountCouponRelList = highDiscountCouponRelService.getRelByCoupon(couponId);
if (discountCouponRelList.size() > 0) {
for (HighDiscountCouponRel highDiscountCouponRel : discountCouponRelList) {
List<HighDiscountUserRel> collect = userRels.stream().filter(o -> o.getDiscountId().equals(highDiscountCouponRel.getDiscountId())).collect(Collectors.toList());
if (collect != null && collect.size() > 0) {
list.add(collect.get(0));
}
}
}
}
return ResponseMsgUtil.success(list);
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountListByCoupon() error!",e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

@ -40,13 +40,13 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt
@Insert({ @Insert({
"insert into high_discount_user_rel (discount_id, agent_id, ", "insert into high_discount_user_rel (discount_id, agent_id, ",
"user_id, `status`, create_time, ", "user_id, `status`, use_time, ",
"use_end_time, ext_1, ", "create_time, use_end_time, ",
"ext_2, ext_3)", "ext_1, ext_2, ext_3)",
"values (#{discountId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ", "values (#{discountId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{userId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{userId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{useTime,jdbcType=TIMESTAMP}, ",
"#{useEndTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", "#{createTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscountUserRel record); int insert(HighDiscountUserRel record);
@ -62,6 +62,7 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="use_time", property="useTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@ -72,8 +73,8 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt
@Select({ @Select({
"select", "select",
"id, discount_id, agent_id, user_id, `status`, create_time, use_end_time, ext_1, ", "id, discount_id, agent_id, user_id, `status`, use_time, create_time, use_end_time, ",
"ext_2, ext_3", "ext_1, ext_2, ext_3",
"from high_discount_user_rel", "from high_discount_user_rel",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -83,6 +84,7 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="use_time", property="useTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@ -106,6 +108,7 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt
"agent_id = #{agentId,jdbcType=BIGINT},", "agent_id = #{agentId,jdbcType=BIGINT},",
"user_id = #{userId,jdbcType=BIGINT},", "user_id = #{userId,jdbcType=BIGINT},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",
"use_time = #{useTime,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},", "create_time = #{createTime,jdbcType=TIMESTAMP},",
"use_end_time = #{useEndTime,jdbcType=TIMESTAMP},", "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},",

@ -44,6 +44,10 @@ public class HighDiscountUserRelSqlProvider {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
} }
if (record.getUseTime() != null) {
sql.VALUES("use_time", "#{useTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
} }
@ -78,6 +82,7 @@ public class HighDiscountUserRelSqlProvider {
sql.SELECT("agent_id"); sql.SELECT("agent_id");
sql.SELECT("user_id"); sql.SELECT("user_id");
sql.SELECT("`status`"); sql.SELECT("`status`");
sql.SELECT("use_time");
sql.SELECT("create_time"); sql.SELECT("create_time");
sql.SELECT("use_end_time"); sql.SELECT("use_end_time");
sql.SELECT("ext_1"); sql.SELECT("ext_1");
@ -120,6 +125,10 @@ public class HighDiscountUserRelSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
} }
if (record.getUseTime() != null) {
sql.SET("use_time = #{record.useTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
} }
@ -153,6 +162,7 @@ public class HighDiscountUserRelSqlProvider {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("use_time = #{record.useTime,jdbcType=TIMESTAMP}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}"); sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
@ -184,6 +194,10 @@ public class HighDiscountUserRelSqlProvider {
sql.SET("`status` = #{status,jdbcType=INTEGER}"); sql.SET("`status` = #{status,jdbcType=INTEGER}");
} }
if (record.getUseTime() != null) {
sql.SET("use_time = #{useTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
} }

@ -39,7 +39,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into high_order (order_no, mem_id, ", "insert into high_order (order_no, mem_discount_id, ",
"mem_discount_name, mem_id, ",
"mem_name, mem_phone, ", "mem_name, mem_phone, ",
"pay_model, pay_type, ", "pay_model, pay_type, ",
"pay_gold, pay_price, ", "pay_gold, pay_price, ",
@ -49,7 +50,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"cancel_time, finish_time, ", "cancel_time, finish_time, ",
"remarks, ext_1, ext_2, ", "remarks, ext_1, ext_2, ",
"ext_3)", "ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ", "values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ",
"#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ",
"#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ",
"#{payModel,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER}, ", "#{payModel,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER}, ",
"#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ", "#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ",
@ -71,6 +73,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT), @Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR), @Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR), @Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR),
@ -95,15 +99,18 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Select({ @Select({
"select", "select",
"id, order_no, mem_id, mem_name, mem_phone, pay_model, pay_type, pay_gold, pay_price, ", "id, order_no, mem_discount_id, mem_discount_name, mem_id, mem_name, mem_phone, ",
"pay_real_price, pay_serial_no, order_status, total_price, create_time, pay_time, ", "pay_model, pay_type, pay_gold, pay_price, pay_real_price, pay_serial_no, order_status, ",
"cancel_time, finish_time, remarks, ext_1, ext_2, ext_3", "total_price, create_time, pay_time, cancel_time, finish_time, remarks, ext_1, ",
"ext_2, ext_3",
"from high_order", "from high_order",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT), @Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR), @Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR), @Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR),
@ -138,6 +145,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Update({ @Update({
"update high_order", "update high_order",
"set order_no = #{orderNo,jdbcType=VARCHAR},", "set order_no = #{orderNo,jdbcType=VARCHAR},",
"mem_discount_id = #{memDiscountId,jdbcType=BIGINT},",
"mem_discount_name = #{memDiscountName,jdbcType=VARCHAR},",
"mem_id = #{memId,jdbcType=BIGINT},", "mem_id = #{memId,jdbcType=BIGINT},",
"mem_name = #{memName,jdbcType=VARCHAR},", "mem_name = #{memName,jdbcType=VARCHAR},",
"mem_phone = #{memPhone,jdbcType=VARCHAR},", "mem_phone = #{memPhone,jdbcType=VARCHAR},",

@ -32,6 +32,14 @@ public class HighOrderSqlProvider {
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}"); sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
} }
if (record.getMemDiscountId() != null) {
sql.VALUES("mem_discount_id", "#{memDiscountId,jdbcType=BIGINT}");
}
if (record.getMemDiscountName() != null) {
sql.VALUES("mem_discount_name", "#{memDiscountName,jdbcType=VARCHAR}");
}
if (record.getMemId() != null) { if (record.getMemId() != null) {
sql.VALUES("mem_id", "#{memId,jdbcType=BIGINT}"); sql.VALUES("mem_id", "#{memId,jdbcType=BIGINT}");
} }
@ -119,6 +127,8 @@ public class HighOrderSqlProvider {
sql.SELECT("id"); sql.SELECT("id");
} }
sql.SELECT("order_no"); sql.SELECT("order_no");
sql.SELECT("mem_discount_id");
sql.SELECT("mem_discount_name");
sql.SELECT("mem_id"); sql.SELECT("mem_id");
sql.SELECT("mem_name"); sql.SELECT("mem_name");
sql.SELECT("mem_phone"); sql.SELECT("mem_phone");
@ -163,6 +173,14 @@ public class HighOrderSqlProvider {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
} }
if (record.getMemDiscountId() != null) {
sql.SET("mem_discount_id = #{record.memDiscountId,jdbcType=BIGINT}");
}
if (record.getMemDiscountName() != null) {
sql.SET("mem_discount_name = #{record.memDiscountName,jdbcType=VARCHAR}");
}
if (record.getMemId() != null) { if (record.getMemId() != null) {
sql.SET("mem_id = #{record.memId,jdbcType=BIGINT}"); sql.SET("mem_id = #{record.memId,jdbcType=BIGINT}");
} }
@ -249,6 +267,8 @@ public class HighOrderSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("mem_discount_id = #{record.memDiscountId,jdbcType=BIGINT}");
sql.SET("mem_discount_name = #{record.memDiscountName,jdbcType=VARCHAR}");
sql.SET("mem_id = #{record.memId,jdbcType=BIGINT}"); sql.SET("mem_id = #{record.memId,jdbcType=BIGINT}");
sql.SET("mem_name = #{record.memName,jdbcType=VARCHAR}"); sql.SET("mem_name = #{record.memName,jdbcType=VARCHAR}");
sql.SET("mem_phone = #{record.memPhone,jdbcType=VARCHAR}"); sql.SET("mem_phone = #{record.memPhone,jdbcType=VARCHAR}");
@ -282,6 +302,14 @@ public class HighOrderSqlProvider {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}"); sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
} }
if (record.getMemDiscountId() != null) {
sql.SET("mem_discount_id = #{memDiscountId,jdbcType=BIGINT}");
}
if (record.getMemDiscountName() != null) {
sql.SET("mem_discount_name = #{memDiscountName,jdbcType=VARCHAR}");
}
if (record.getMemId() != null) { if (record.getMemId() != null) {
sql.SET("mem_id = #{memId,jdbcType=BIGINT}"); sql.SET("mem_id = #{memId,jdbcType=BIGINT}");
} }

@ -62,9 +62,9 @@ public interface SecUserMapperExt {
" sec_user su " + " sec_user su " +
" WHERE" + " WHERE" +
" STATUS = 1 " + " STATUS = 1 " +
" AND su.`password` = #{password}" +
" AND su.login_name = #{loginName} " + " AND su.login_name = #{loginName} " +
" OR su.telephone = #{loginName} " + " OR su.telephone = #{loginName} " +
" AND su.`password` = #{password}" +
"</script>" "</script>"
}) })
@Results({ @Results({

@ -40,6 +40,11 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser
*/ */
private Integer status; private Integer status;
/**
* 使用时间
*/
private Date useTime;
/** /**
* 创建时间 * 创建时间
*/ */
@ -98,6 +103,14 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser
this.status = status; this.status = status;
} }
public Date getUseTime() {
return useTime;
}
public void setUseTime(Date useTime) {
this.useTime = useTime;
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
@ -155,6 +168,7 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) && (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getUseTime() == null ? other.getUseTime() == null : this.getUseTime().equals(other.getUseTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime())) && (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
@ -171,6 +185,7 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getUseTime() == null) ? 0 : getUseTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode()); result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
@ -190,6 +205,7 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser
sb.append(", agentId=").append(agentId); sb.append(", agentId=").append(agentId);
sb.append(", userId=").append(userId); sb.append(", userId=").append(userId);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", useTime=").append(useTime);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", useEndTime=").append(useEndTime); sb.append(", useEndTime=").append(useEndTime);
sb.append(", ext1=").append(ext1); sb.append(", ext1=").append(ext1);

@ -425,6 +425,66 @@ public class HighDiscountUserRelExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseTimeIsNull() {
addCriterion("use_time is null");
return (Criteria) this;
}
public Criteria andUseTimeIsNotNull() {
addCriterion("use_time is not null");
return (Criteria) this;
}
public Criteria andUseTimeEqualTo(Date value) {
addCriterion("use_time =", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeNotEqualTo(Date value) {
addCriterion("use_time <>", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeGreaterThan(Date value) {
addCriterion("use_time >", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeGreaterThanOrEqualTo(Date value) {
addCriterion("use_time >=", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeLessThan(Date value) {
addCriterion("use_time <", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeLessThanOrEqualTo(Date value) {
addCriterion("use_time <=", value, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeIn(List<Date> values) {
addCriterion("use_time in", values, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeNotIn(List<Date> values) {
addCriterion("use_time not in", values, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeBetween(Date value1, Date value2) {
addCriterion("use_time between", value1, value2, "useTime");
return (Criteria) this;
}
public Criteria andUseTimeNotBetween(Date value1, Date value2) {
addCriterion("use_time not between", value1, value2, "useTime");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;

@ -25,6 +25,16 @@ public class HighOrder implements Serializable {
*/ */
private String orderNo; private String orderNo;
/**
* 用户的优惠券high_discount_user_rel表的id
*/
private Long memDiscountId;
/**
* 用户的优惠券名称
*/
private String memDiscountName;
/** /**
* 用户表ID * 用户表ID
*/ */
@ -139,6 +149,22 @@ public class HighOrder implements Serializable {
this.orderNo = orderNo; this.orderNo = orderNo;
} }
public Long getMemDiscountId() {
return memDiscountId;
}
public void setMemDiscountId(Long memDiscountId) {
this.memDiscountId = memDiscountId;
}
public String getMemDiscountName() {
return memDiscountName;
}
public void setMemDiscountName(String memDiscountName) {
this.memDiscountName = memDiscountName;
}
public Long getMemId() { public Long getMemId() {
return memId; return memId;
} }
@ -305,6 +331,8 @@ public class HighOrder implements Serializable {
HighOrder other = (HighOrder) that; HighOrder other = (HighOrder) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getMemDiscountId() == null ? other.getMemDiscountId() == null : this.getMemDiscountId().equals(other.getMemDiscountId()))
&& (this.getMemDiscountName() == null ? other.getMemDiscountName() == null : this.getMemDiscountName().equals(other.getMemDiscountName()))
&& (this.getMemId() == null ? other.getMemId() == null : this.getMemId().equals(other.getMemId())) && (this.getMemId() == null ? other.getMemId() == null : this.getMemId().equals(other.getMemId()))
&& (this.getMemName() == null ? other.getMemName() == null : this.getMemName().equals(other.getMemName())) && (this.getMemName() == null ? other.getMemName() == null : this.getMemName().equals(other.getMemName()))
&& (this.getMemPhone() == null ? other.getMemPhone() == null : this.getMemPhone().equals(other.getMemPhone())) && (this.getMemPhone() == null ? other.getMemPhone() == null : this.getMemPhone().equals(other.getMemPhone()))
@ -332,6 +360,8 @@ public class HighOrder implements Serializable {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getMemDiscountId() == null) ? 0 : getMemDiscountId().hashCode());
result = prime * result + ((getMemDiscountName() == null) ? 0 : getMemDiscountName().hashCode());
result = prime * result + ((getMemId() == null) ? 0 : getMemId().hashCode()); result = prime * result + ((getMemId() == null) ? 0 : getMemId().hashCode());
result = prime * result + ((getMemName() == null) ? 0 : getMemName().hashCode()); result = prime * result + ((getMemName() == null) ? 0 : getMemName().hashCode());
result = prime * result + ((getMemPhone() == null) ? 0 : getMemPhone().hashCode()); result = prime * result + ((getMemPhone() == null) ? 0 : getMemPhone().hashCode());
@ -362,6 +392,8 @@ public class HighOrder implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", orderNo=").append(orderNo); sb.append(", orderNo=").append(orderNo);
sb.append(", memDiscountId=").append(memDiscountId);
sb.append(", memDiscountName=").append(memDiscountName);
sb.append(", memId=").append(memId); sb.append(", memId=").append(memId);
sb.append(", memName=").append(memName); sb.append(", memName=").append(memName);
sb.append(", memPhone=").append(memPhone); sb.append(", memPhone=").append(memPhone);

@ -256,6 +256,136 @@ public class HighOrderExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMemDiscountIdIsNull() {
addCriterion("mem_discount_id is null");
return (Criteria) this;
}
public Criteria andMemDiscountIdIsNotNull() {
addCriterion("mem_discount_id is not null");
return (Criteria) this;
}
public Criteria andMemDiscountIdEqualTo(Long value) {
addCriterion("mem_discount_id =", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdNotEqualTo(Long value) {
addCriterion("mem_discount_id <>", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdGreaterThan(Long value) {
addCriterion("mem_discount_id >", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdGreaterThanOrEqualTo(Long value) {
addCriterion("mem_discount_id >=", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdLessThan(Long value) {
addCriterion("mem_discount_id <", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdLessThanOrEqualTo(Long value) {
addCriterion("mem_discount_id <=", value, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdIn(List<Long> values) {
addCriterion("mem_discount_id in", values, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdNotIn(List<Long> values) {
addCriterion("mem_discount_id not in", values, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdBetween(Long value1, Long value2) {
addCriterion("mem_discount_id between", value1, value2, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountIdNotBetween(Long value1, Long value2) {
addCriterion("mem_discount_id not between", value1, value2, "memDiscountId");
return (Criteria) this;
}
public Criteria andMemDiscountNameIsNull() {
addCriterion("mem_discount_name is null");
return (Criteria) this;
}
public Criteria andMemDiscountNameIsNotNull() {
addCriterion("mem_discount_name is not null");
return (Criteria) this;
}
public Criteria andMemDiscountNameEqualTo(String value) {
addCriterion("mem_discount_name =", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameNotEqualTo(String value) {
addCriterion("mem_discount_name <>", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameGreaterThan(String value) {
addCriterion("mem_discount_name >", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameGreaterThanOrEqualTo(String value) {
addCriterion("mem_discount_name >=", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameLessThan(String value) {
addCriterion("mem_discount_name <", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameLessThanOrEqualTo(String value) {
addCriterion("mem_discount_name <=", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameLike(String value) {
addCriterion("mem_discount_name like", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameNotLike(String value) {
addCriterion("mem_discount_name not like", value, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameIn(List<String> values) {
addCriterion("mem_discount_name in", values, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameNotIn(List<String> values) {
addCriterion("mem_discount_name not in", values, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameBetween(String value1, String value2) {
addCriterion("mem_discount_name between", value1, value2, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemDiscountNameNotBetween(String value1, String value2) {
addCriterion("mem_discount_name not between", value1, value2, "memDiscountName");
return (Criteria) this;
}
public Criteria andMemIdIsNull() { public Criteria andMemIdIsNull() {
addCriterion("mem_id is null"); addCriterion("mem_id is null");
return (Criteria) this; return (Criteria) this;

@ -47,6 +47,13 @@ public interface HighDiscountCouponRelService {
**/ **/
HighDiscountCouponRel getRelByDiscountCoupon(Long discountId,Long couponId); HighDiscountCouponRel getRelByDiscountCoupon(Long discountId,Long couponId);
/**
* @Author 胡锐
* @Description 根据卡券查询
* @Date 2021/4/4 20:23
**/
List<HighDiscountCouponRel> getRelByCoupon(Long couponId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据优惠券查询 * @Description 根据优惠券查询

@ -15,18 +15,32 @@ public interface HighDiscountUserRelService {
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 领取 * @Description 领取优惠
* @Date 2021/4/4 15:12 * @Date 2021/4/4 15:12
**/ **/
void receiveDiscount(Long userId,Long discountAgentId); void receiveDiscount(Long userId,Long discountAgentId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description * @Description 修改
* @Date 2021/4/4 18:41
**/
void updateDiscountUserRel(HighDiscountUserRel highDiscountUserRel);
/**
* @Author 胡锐
* @Description 根据用户id和优惠券id查询
* @Date 2021/4/4 15:45 * @Date 2021/4/4 15:45
**/ **/
HighDiscountUserRel getRelByUserDiscount(Long userId,Long discountId); HighDiscountUserRel getRelByUserDiscount(Long userId,Long discountId);
/**
* @Author 胡锐
* @Description 根据id查询
* @Date 2021/4/4 18:02
**/
HighDiscountUserRel getRelById(Long id);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 查询优惠券列表 * @Description 查询优惠券列表

@ -53,8 +53,7 @@ public class HighDiscountCouponRelServiceImpl implements HighDiscountCouponRelSe
@Override @Override
public HighDiscountCouponRel getRelByDiscountCoupon(Long discountId, Long couponId) { public HighDiscountCouponRel getRelByDiscountCoupon(Long discountId, Long couponId) {
HighDiscountCouponRelExample example = new HighDiscountCouponRelExample(); HighDiscountCouponRelExample example = new HighDiscountCouponRelExample();
example.createCriteria().andDiscountIdEqualTo(discountId).andCouponIdEqualTo(couponId); example.createCriteria().andDiscountIdEqualTo(discountId).andCouponIdEqualTo(couponId).andStatusEqualTo(1);
List<HighDiscountCouponRel> list = highDiscountCouponRelMapper.selectByExample(example); List<HighDiscountCouponRel> list = highDiscountCouponRelMapper.selectByExample(example);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
return list.get(0); return list.get(0);
@ -62,10 +61,21 @@ public class HighDiscountCouponRelServiceImpl implements HighDiscountCouponRelSe
return null; return null;
} }
@Override
public List<HighDiscountCouponRel> getRelByCoupon(Long couponId) {
HighDiscountCouponRelExample example = new HighDiscountCouponRelExample();
example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1);
List<HighDiscountCouponRel> list = highDiscountCouponRelMapper.selectByExample(example);
for (HighDiscountCouponRel rel : list) {
rel.setHighCoupon(highCouponService.getCouponDetail(rel.getCouponId()));
}
return list;
}
@Override @Override
public List<HighDiscountCouponRel> getRelByDiscount(Long discountId) { public List<HighDiscountCouponRel> getRelByDiscount(Long discountId) {
HighDiscountCouponRelExample example = new HighDiscountCouponRelExample(); HighDiscountCouponRelExample example = new HighDiscountCouponRelExample();
example.createCriteria().andDiscountIdEqualTo(discountId); example.createCriteria().andDiscountIdEqualTo(discountId).andStatusEqualTo(1);;
List<HighDiscountCouponRel> list = highDiscountCouponRelMapper.selectByExample(example); List<HighDiscountCouponRel> list = highDiscountCouponRelMapper.selectByExample(example);
for (HighDiscountCouponRel rel : list) { for (HighDiscountCouponRel rel : list) {
rel.setHighCoupon(highCouponService.getCouponDetail(rel.getCouponId())); rel.setHighCoupon(highCouponService.getCouponDetail(rel.getCouponId()));

@ -75,7 +75,12 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
userRel.setCreateTime(new Date()); userRel.setCreateTime(new Date());
// 计算使用有效期 // 计算使用有效期
Calendar userEndTime = Calendar.getInstance(); Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, rel.getHighDiscount().getEffectiveDay()); userEndTime.add(Calendar.DATE, rel.getHighDiscount().getEffectiveDay());
if (userEndTime.getTime().compareTo(rel.getHighDiscount().getSalesEndTime()) == 1) { if (userEndTime.getTime().compareTo(rel.getHighDiscount().getSalesEndTime()) == 1) {
userRel.setUseEndTime(rel.getHighDiscount().getSalesEndTime()); userRel.setUseEndTime(rel.getHighDiscount().getSalesEndTime());
} else { } else {
@ -85,6 +90,11 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
} }
@Override
public void updateDiscountUserRel(HighDiscountUserRel highDiscountUserRel) {
highDiscountUserRelMapper.updateByPrimaryKey(highDiscountUserRel);
}
@Override @Override
public HighDiscountUserRel getRelByUserDiscount(Long userId, Long discountId) { public HighDiscountUserRel getRelByUserDiscount(Long userId, Long discountId) {
HighDiscountUserRelExample example = new HighDiscountUserRelExample(); HighDiscountUserRelExample example = new HighDiscountUserRelExample();
@ -96,6 +106,16 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
return null; return null;
} }
@Override
public HighDiscountUserRel getRelById(Long id) {
HighDiscountUserRel rel = highDiscountUserRelMapper.selectByPrimaryKey(id);
if(rel != null) {
rel.setHighDiscount(highDiscountService.getDiscountById(rel.getDiscountId()));
rel.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId()));
}
return rel;
}
@Override @Override
public List<HighDiscountUserRel> getDiscountList(Map<String, Object> map) { public List<HighDiscountUserRel> getDiscountList(Map<String, Object> map) {
HighDiscountUserRelExample example = new HighDiscountUserRelExample(); HighDiscountUserRelExample example = new HighDiscountUserRelExample();

@ -57,11 +57,22 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource @Resource
private HighDiscountUserRelMapper highDiscountUserRelMapper; private HighDiscountUserRelMapper highDiscountUserRelMapper;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertOrder(HighOrder highOrder) throws Exception { public void insertOrder(HighOrder highOrder) throws Exception {
highOrderMapper.insert(highOrder); highOrderMapper.insert(highOrder);
// 使用优惠券
if (highOrder.getMemDiscountId() != null) {
HighDiscountUserRel discountUserRel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId());
discountUserRel.setUseTime(new Date()); // 使用时间
discountUserRel.setStatus(2); //状态 0:已过期 1:未使用 2:已使用
highDiscountUserRelService.updateDiscountUserRel(discountUserRel);
}
for (int i = 0; i < highOrder.getHighChildOrderList().size();i++) { for (int i = 0; i < highOrder.getHighChildOrderList().size();i++) {
HighChildOrder childOrder = highOrder.getHighChildOrderList().get(i); HighChildOrder childOrder = highOrder.getHighChildOrderList().get(i);
childOrder.setOrderId(highOrder.getId()); childOrder.setOrderId(highOrder.getId());
@ -81,7 +92,7 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setExt1(list.get(0).getExt1()); childOrder.setExt1(list.get(0).getExt1());
highChildOrderMapper.updateByPrimaryKey(childOrder); highChildOrderMapper.updateByPrimaryKey(childOrder);
if(childOrder.getGiveawayType() == false) { if(!childOrder.getGiveawayType()) {
// 查看是否需要赠送卡卷 // 查看是否需要赠送卡卷
List<HighCouponHandselModel> handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId()); List<HighCouponHandselModel> handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId());
if (handselListByCoupon != null && handselListByCoupon.size() > 0) { if (handselListByCoupon != null && handselListByCoupon.size() > 0) {
@ -156,7 +167,12 @@ public class HighOrderServiceImpl implements HighOrderService {
// 计算使用有效期 // 计算使用有效期
Calendar userEndTime = Calendar.getInstance(); Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, coupon.getRecycleDay()); userEndTime.add(Calendar.DATE, coupon.getRecycleDay());
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) { if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) {
highUserCoupon.setUseEndTime(code.getUseEndTime()); highUserCoupon.setUseEndTime(code.getUseEndTime());
} else { } else {
@ -340,6 +356,13 @@ public class HighOrderServiceImpl implements HighOrderService {
} }
highChildOrder.setChildOrdeStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
} }
if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(new Date());
highDiscountUserRelService.updateDiscountUserRel(rel);
}
updateOrder(order); updateOrder(order);
} }
} }

@ -81,6 +81,10 @@ public class GoodsOrderServiceImpl implements PayService {
// 计算使用有效期 // 计算使用有效期
Calendar userEndTime = Calendar.getInstance(); Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, coupon.getRecycleDay()); userEndTime.add(Calendar.DATE, coupon.getRecycleDay());
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) { if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) {
highUserCoupon.setUseEndTime(code.getUseEndTime()); highUserCoupon.setUseEndTime(code.getUseEndTime());

Loading…
Cancel
Save