master
袁野 6 months ago
parent 8ab08a6941
commit e5a19b4f0f
  1. 2
      bweb/src/main/java/com/bweb/controller/BsUserController.java
  2. 4
      bweb/src/main/java/com/bweb/controller/discount/DiscountController.java
  3. 79
      bweb/src/main/java/com/bweb/controller/discount/DiscountPackageController.java
  4. 75
      cweb/src/main/java/com/cweb/controller/discount/DiscountController.java
  5. 2
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  6. 23
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageDetailsMapper.java
  7. 14
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageDetailsSqlProvider.java
  8. 20
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageRecordMapper.java
  9. 14
      service/src/main/java/com/hfkj/dao/CouponDiscountPackageRecordSqlProvider.java
  10. 16
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageDetails.java
  11. 70
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageDetailsExample.java
  12. 16
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageRecord.java
  13. 70
      service/src/main/java/com/hfkj/entity/CouponDiscountPackageRecordExample.java
  14. 15
      service/src/main/java/com/hfkj/service/discount/CouponDiscountPackageService.java
  15. 2
      service/src/main/java/com/hfkj/service/discount/CouponDiscountService.java
  16. 30
      service/src/main/java/com/hfkj/service/discount/CouponDiscountUserRelService.java
  17. 133
      service/src/main/java/com/hfkj/service/discount/impl/CouponDiscountPackageServiceImpl.java
  18. 2
      service/src/main/java/com/hfkj/service/discount/impl/CouponDiscountServiceImpl.java
  19. 46
      service/src/main/java/com/hfkj/service/discount/impl/CouponDiscountUserRelServiceImpl.java

@ -31,7 +31,7 @@ import java.util.Map;
**/ **/
@Controller @Controller
@RequestMapping(value="/user") @RequestMapping(value="/user")
@Api(value="系统菜单管理") @Api(value="用户管理")
public class BsUserController { public class BsUserController {
private static Logger log = LoggerFactory.getLogger(BsUserController.class); private static Logger log = LoggerFactory.getLogger(BsUserController.class);
@Resource @Resource

@ -125,8 +125,8 @@ public class DiscountController {
@ResponseBody @ResponseBody
@ApiOperation(value = "查询列表") @ApiOperation(value = "查询列表")
public ResponseData getListDiscount(@RequestParam(value = "name" , required = false) String name, public ResponseData getListDiscount(@RequestParam(value = "name" , required = false) String name,
@RequestParam(value = "type" , required = false) Integer type, @RequestParam(value = "type" , required = false) Integer type,
@RequestParam(value = "status" , required = false) Integer status, @RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "pageNum" , required = true) Integer pageNum, @RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { @RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try { try {

@ -1,10 +1,14 @@
package com.bweb.controller.discount; package com.bweb.controller.discount;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
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.security.SessionObject; import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
@ -47,7 +51,9 @@ public class DiscountPackageController {
public ResponseData getDiscountPackageList( public ResponseData getDiscountPackageList(
@RequestParam(name = "title", required = false) String title, @RequestParam(name = "title", required = false) String title,
@RequestParam(name = "key", required = false) String key, @RequestParam(name = "key", required = false) String key,
@RequestParam(name = "status", required = false) Integer status) { @RequestParam(name = "status", required = false) Integer status,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try { try {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
@ -56,7 +62,9 @@ public class DiscountPackageController {
map.put("key" , key); map.put("key" , key);
map.put("status" , status); map.put("status" , status);
return ResponseMsgUtil.success(couponDiscountPackageService.getList(map)); PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(couponDiscountPackageService.getList(map)));
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e); log.error("HighOrderController --> getUserOrderList() error!", e);
@ -86,7 +94,7 @@ public class DiscountPackageController {
@RequestMapping(value = "/editCouponPackageInfo", method = RequestMethod.POST) @RequestMapping(value = "/editCouponPackageInfo", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "新增优惠券包基本信息") @ApiOperation(value = "编辑优惠券包基本信息")
public ResponseData editCouponPackageInfo(@RequestBody CouponDiscountPackage body, HttpServletRequest request) { public ResponseData editCouponPackageInfo(@RequestBody CouponDiscountPackage body, HttpServletRequest request) {
try { try {
@ -112,12 +120,15 @@ public class DiscountPackageController {
} else { } else {
discountPackage = new CouponDiscountPackage(); discountPackage = new CouponDiscountPackage();
discountPackage.setCreatedUserId(userModel.getAccount().getId().intValue()); discountPackage.setCreatedUserId(userModel.getAccount().getId().intValue());
discountPackage.setKey(OrderUtil.generateOrderNo());
discountPackage.setStatus(1); discountPackage.setStatus(1);
discountPackage.setTotalStock(0); discountPackage.setTotalStock(0);
discountPackage.setSurplusStock(0);
discountPackage.setCreatedTime(new Date()); discountPackage.setCreatedTime(new Date());
} }
discountPackage.setSurplusStock(body.getSurplusStock());
discountPackage.setTitle(body.getTitle());
discountPackage.setEffectiveTime(body.getEffectiveTime());
discountPackage.setUpdatedTime(new Date()); discountPackage.setUpdatedTime(new Date());
discountPackage.setUpdatedUserId(userModel.getAccount().getId().intValue()); discountPackage.setUpdatedUserId(userModel.getAccount().getId().intValue());
@ -156,15 +167,23 @@ public class DiscountPackageController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券不存在!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券不存在!");
} }
CouponDiscountPackageDetails details = couponDiscountPackageService.discountPackageDetail(discountPackageDetails.getDiscountPackageId() , discountPackageDetails.getDiscountId());
discountPackageDetails.setStatus(1);
discountPackageDetails.setDiscountName(discount.getName());
discountPackageDetails.setCreatedTime(new Date());
discountPackageDetails.setUpdatedTime(new Date());
couponDiscountPackageService.createDetail(discountPackageDetails); if (details == null) {
discountPackageDetails.setStatus(1);
discountPackageDetails.setDiscountName(discount.getName());
discountPackageDetails.setDiscountImg(discount.getImg());
discountPackageDetails.setCreatedTime(new Date());
discountPackageDetails.setUpdatedTime(new Date());
couponDiscountPackageService.createDetail(discountPackageDetails);
} else {
details.setNum(discountPackageDetails.getNum() + details.getNum());
details.setUpdatedTime(new Date());
couponDiscountPackageService.updateDetail(details);
}
return ResponseMsgUtil.success("新增成功"); return ResponseMsgUtil.success("成功");
} catch (Exception e) { } catch (Exception e) {
log.error("HighAgentController --> insertAgent() error!", e); log.error("HighAgentController --> insertAgent() error!", e);
@ -175,7 +194,7 @@ public class DiscountPackageController {
@RequestMapping(value = "/deleteDetail", method = RequestMethod.GET) @RequestMapping(value = "/deleteDetail", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "删除券包详情") @ApiOperation(value = "删除券包详情")
public ResponseData deleteDetail(@RequestParam(name = "detailId", required = false) Long detailId) { public ResponseData deleteDetail(@RequestParam(name = "detailId", required = false) Integer detailId) {
try { try {
couponDiscountPackageService.deleteDetail(detailId); couponDiscountPackageService.deleteDetail(detailId);
@ -188,6 +207,20 @@ public class DiscountPackageController {
} }
} }
@RequestMapping(value = "/getDetailList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "券包详情列表")
public ResponseData getDetailList(@RequestParam(name = "discountPackageId", required = false) Integer discountPackageId) {
try {
return ResponseMsgUtil.success( couponDiscountPackageService.getDetailList(discountPackageId));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delete", method = RequestMethod.GET) @RequestMapping(value = "/delete", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "删除券包") @ApiOperation(value = "删除券包")
@ -210,7 +243,6 @@ public class DiscountPackageController {
public ResponseData discountPackageAudit(@RequestParam(value = "id" , required = false) Long id) { public ResponseData discountPackageAudit(@RequestParam(value = "id" , required = false) Long id) {
try { try {
CouponDiscountPackage discountPackage = couponDiscountPackageService.queryDetail(id); CouponDiscountPackage discountPackage = couponDiscountPackageService.queryDetail(id);
if (discountPackage.getStatus() == 1) { if (discountPackage.getStatus() == 1) {
@ -230,4 +262,27 @@ public class DiscountPackageController {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value = "/giveDiscountPackage", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "赠送券包")
public ResponseData giveDiscountPackage(@RequestBody JSONObject body) {
try {
if ( body == null
|| body.getInteger("discountPackageId") == null
|| body.getString("phone") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
couponDiscountPackageService.giveDiscountPackage(body.getInteger("discountPackageId") , body.getString("phone"));
return ResponseMsgUtil.success("成功!");
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,75 @@
package com.cweb.controller.discount;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
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.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.CouponDiscount;
import com.hfkj.entity.CouponDiscountGoodsRel;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.discount.DiscountGoodsModel;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.discount.CouponDiscountUserRelService;
import com.hfkj.service.goods.impl.GoodsMsgServiceImpl;
import com.hfkj.service.goods.impl.GoodsSpecsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
@RequestMapping(value="/discount")
@Api(value="优惠券")
public class DiscountController {
private static final Logger log = LoggerFactory.getLogger(DiscountController.class);
@Resource
private UserCenter userCenter;
@Resource
private CouponDiscountUserRelService discountUserRelService;
@RequestMapping(value = "/getListUserDiscount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户优惠券列表")
public ResponseData getListUserDiscount(@RequestParam(value = "status", required = true) Integer status) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String, Object> map = new HashMap<>();
map.put("userId", userSession.getUser().getId());
map.put("status", status);
return ResponseMsgUtil.success(discountUserRelService.getList(map));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -30,6 +30,8 @@ public class DeliveryAddressController {
@Resource @Resource
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private GoodsUserAddressServiceImpl goodsUserAddressService; private GoodsUserAddressServiceImpl goodsUserAddressService;

@ -40,15 +40,15 @@ public interface CouponDiscountPackageDetailsMapper extends CouponDiscountPackag
@Insert({ @Insert({
"insert into coupon_discount_package_details (discount_package_id, discount_id, ", "insert into coupon_discount_package_details (discount_package_id, discount_id, ",
"discount_name, num, ", "discount_name, discount_img, ",
"created_time, updated_time, ", "num, created_time, ",
"`status`, ext_1, ext_2, ", "updated_time, `status`, ",
"ext_3)", "ext_1, ext_2, ext_3)",
"values (#{discountPackageId,jdbcType=INTEGER}, #{discountId,jdbcType=INTEGER}, ", "values (#{discountPackageId,jdbcType=INTEGER}, #{discountId,jdbcType=INTEGER}, ",
"#{discountName,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, ", "#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ",
"#{createdTime,jdbcType=TIMESTAMP}, #{updatedTime,jdbcType=TIMESTAMP}, ", "#{num,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", "#{updatedTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(CouponDiscountPackageDetails record); int insert(CouponDiscountPackageDetails record);
@ -63,6 +63,7 @@ public interface CouponDiscountPackageDetailsMapper extends CouponDiscountPackag
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER), @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER), @Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
@Result(column="num", property="num", jdbcType=JdbcType.INTEGER), @Result(column="num", property="num", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
@ -75,8 +76,8 @@ public interface CouponDiscountPackageDetailsMapper extends CouponDiscountPackag
@Select({ @Select({
"select", "select",
"id, discount_package_id, discount_id, discount_name, num, created_time, updated_time, ", "id, discount_package_id, discount_id, discount_name, discount_img, num, created_time, ",
"`status`, ext_1, ext_2, ext_3", "updated_time, `status`, ext_1, ext_2, ext_3",
"from coupon_discount_package_details", "from coupon_discount_package_details",
"where id = #{id,jdbcType=INTEGER}" "where id = #{id,jdbcType=INTEGER}"
}) })
@ -85,6 +86,7 @@ public interface CouponDiscountPackageDetailsMapper extends CouponDiscountPackag
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER), @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER), @Result(column="discount_id", property="discountId", jdbcType=JdbcType.INTEGER),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR),
@Result(column="num", property="num", jdbcType=JdbcType.INTEGER), @Result(column="num", property="num", jdbcType=JdbcType.INTEGER),
@Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="created_time", property="createdTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="updated_time", property="updatedTime", jdbcType=JdbcType.TIMESTAMP),
@ -109,6 +111,7 @@ public interface CouponDiscountPackageDetailsMapper extends CouponDiscountPackag
"set discount_package_id = #{discountPackageId,jdbcType=INTEGER},", "set discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
"discount_id = #{discountId,jdbcType=INTEGER},", "discount_id = #{discountId,jdbcType=INTEGER},",
"discount_name = #{discountName,jdbcType=VARCHAR},", "discount_name = #{discountName,jdbcType=VARCHAR},",
"discount_img = #{discountImg,jdbcType=VARCHAR},",
"num = #{num,jdbcType=INTEGER},", "num = #{num,jdbcType=INTEGER},",
"created_time = #{createdTime,jdbcType=TIMESTAMP},", "created_time = #{createdTime,jdbcType=TIMESTAMP},",
"updated_time = #{updatedTime,jdbcType=TIMESTAMP},", "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",

@ -40,6 +40,10 @@ public class CouponDiscountPackageDetailsSqlProvider {
sql.VALUES("discount_name", "#{discountName,jdbcType=VARCHAR}"); sql.VALUES("discount_name", "#{discountName,jdbcType=VARCHAR}");
} }
if (record.getDiscountImg() != null) {
sql.VALUES("discount_img", "#{discountImg,jdbcType=VARCHAR}");
}
if (record.getNum() != null) { if (record.getNum() != null) {
sql.VALUES("num", "#{num,jdbcType=INTEGER}"); sql.VALUES("num", "#{num,jdbcType=INTEGER}");
} }
@ -81,6 +85,7 @@ public class CouponDiscountPackageDetailsSqlProvider {
sql.SELECT("discount_package_id"); sql.SELECT("discount_package_id");
sql.SELECT("discount_id"); sql.SELECT("discount_id");
sql.SELECT("discount_name"); sql.SELECT("discount_name");
sql.SELECT("discount_img");
sql.SELECT("num"); sql.SELECT("num");
sql.SELECT("created_time"); sql.SELECT("created_time");
sql.SELECT("updated_time"); sql.SELECT("updated_time");
@ -121,6 +126,10 @@ public class CouponDiscountPackageDetailsSqlProvider {
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}");
} }
if (record.getDiscountImg() != null) {
sql.SET("discount_img = #{record.discountImg,jdbcType=VARCHAR}");
}
if (record.getNum() != null) { if (record.getNum() != null) {
sql.SET("num = #{record.num,jdbcType=INTEGER}"); sql.SET("num = #{record.num,jdbcType=INTEGER}");
} }
@ -161,6 +170,7 @@ public class CouponDiscountPackageDetailsSqlProvider {
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}"); sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}");
sql.SET("discount_id = #{record.discountId,jdbcType=INTEGER}"); sql.SET("discount_id = #{record.discountId,jdbcType=INTEGER}");
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}");
sql.SET("discount_img = #{record.discountImg,jdbcType=VARCHAR}");
sql.SET("num = #{record.num,jdbcType=INTEGER}"); sql.SET("num = #{record.num,jdbcType=INTEGER}");
sql.SET("created_time = #{record.createdTime,jdbcType=TIMESTAMP}"); sql.SET("created_time = #{record.createdTime,jdbcType=TIMESTAMP}");
sql.SET("updated_time = #{record.updatedTime,jdbcType=TIMESTAMP}"); sql.SET("updated_time = #{record.updatedTime,jdbcType=TIMESTAMP}");
@ -190,6 +200,10 @@ public class CouponDiscountPackageDetailsSqlProvider {
sql.SET("discount_name = #{discountName,jdbcType=VARCHAR}"); sql.SET("discount_name = #{discountName,jdbcType=VARCHAR}");
} }
if (record.getDiscountImg() != null) {
sql.SET("discount_img = #{discountImg,jdbcType=VARCHAR}");
}
if (record.getNum() != null) { if (record.getNum() != null) {
sql.SET("num = #{num,jdbcType=INTEGER}"); sql.SET("num = #{num,jdbcType=INTEGER}");
} }

@ -40,15 +40,15 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Insert({ @Insert({
"insert into coupon_discount_package_record (discount_package_title, discount_package_id, ", "insert into coupon_discount_package_record (discount_package_title, discount_package_id, ",
"order_id, child_order_id, ", "order_id, order_no, ",
"serial_no, `type`, ", "child_order_id, serial_no, ",
"user_id, user_phone, ", "`type`, user_id, user_phone, ",
"created_time, `status`, ", "created_time, `status`, ",
"ext_1, ext_2, ext_3)", "ext_1, ext_2, ext_3)",
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=INTEGER}, ", "values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=INTEGER}, ",
"#{orderId,jdbcType=INTEGER}, #{childOrderId,jdbcType=INTEGER}, ", "#{orderId,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, ",
"#{serialNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, ", "#{childOrderId,jdbcType=INTEGER}, #{serialNo,jdbcType=VARCHAR}, ",
"#{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ", "#{type,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ",
"#{createdTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", "#{createdTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@ -65,6 +65,7 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), @Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER), @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER), @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER), @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
@Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR), @Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@ -80,8 +81,9 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Select({ @Select({
"select", "select",
"id, discount_package_title, discount_package_id, order_id, child_order_id, serial_no, ", "id, discount_package_title, discount_package_id, order_id, order_no, child_order_id, ",
"`type`, user_id, user_phone, created_time, `status`, ext_1, ext_2, ext_3", "serial_no, `type`, user_id, user_phone, created_time, `status`, ext_1, ext_2, ",
"ext_3",
"from coupon_discount_package_record", "from coupon_discount_package_record",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -90,6 +92,7 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), @Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER), @Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.INTEGER),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER), @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER), @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.INTEGER),
@Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR), @Result(column="serial_no", property="serialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@ -117,6 +120,7 @@ public interface CouponDiscountPackageRecordMapper extends CouponDiscountPackage
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},", "set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"discount_package_id = #{discountPackageId,jdbcType=INTEGER},", "discount_package_id = #{discountPackageId,jdbcType=INTEGER},",
"order_id = #{orderId,jdbcType=INTEGER},", "order_id = #{orderId,jdbcType=INTEGER},",
"order_no = #{orderNo,jdbcType=VARCHAR},",
"child_order_id = #{childOrderId,jdbcType=INTEGER},", "child_order_id = #{childOrderId,jdbcType=INTEGER},",
"serial_no = #{serialNo,jdbcType=VARCHAR},", "serial_no = #{serialNo,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=INTEGER},", "`type` = #{type,jdbcType=INTEGER},",

@ -40,6 +40,10 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.VALUES("order_id", "#{orderId,jdbcType=INTEGER}"); sql.VALUES("order_id", "#{orderId,jdbcType=INTEGER}");
} }
if (record.getOrderNo() != null) {
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) { if (record.getChildOrderId() != null) {
sql.VALUES("child_order_id", "#{childOrderId,jdbcType=INTEGER}"); sql.VALUES("child_order_id", "#{childOrderId,jdbcType=INTEGER}");
} }
@ -93,6 +97,7 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SELECT("discount_package_title"); sql.SELECT("discount_package_title");
sql.SELECT("discount_package_id"); sql.SELECT("discount_package_id");
sql.SELECT("order_id"); sql.SELECT("order_id");
sql.SELECT("order_no");
sql.SELECT("child_order_id"); sql.SELECT("child_order_id");
sql.SELECT("serial_no"); sql.SELECT("serial_no");
sql.SELECT("`type`"); sql.SELECT("`type`");
@ -136,6 +141,10 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("order_id = #{record.orderId,jdbcType=INTEGER}"); sql.SET("order_id = #{record.orderId,jdbcType=INTEGER}");
} }
if (record.getOrderNo() != null) {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) { if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}"); sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}");
} }
@ -188,6 +197,7 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}"); sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}"); sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=INTEGER}");
sql.SET("order_id = #{record.orderId,jdbcType=INTEGER}"); sql.SET("order_id = #{record.orderId,jdbcType=INTEGER}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}"); sql.SET("child_order_id = #{record.childOrderId,jdbcType=INTEGER}");
sql.SET("serial_no = #{record.serialNo,jdbcType=VARCHAR}"); sql.SET("serial_no = #{record.serialNo,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
@ -220,6 +230,10 @@ public class CouponDiscountPackageRecordSqlProvider {
sql.SET("order_id = #{orderId,jdbcType=INTEGER}"); sql.SET("order_id = #{orderId,jdbcType=INTEGER}");
} }
if (record.getOrderNo() != null) {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
}
if (record.getChildOrderId() != null) { if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{childOrderId,jdbcType=INTEGER}"); sql.SET("child_order_id = #{childOrderId,jdbcType=INTEGER}");
} }

@ -33,6 +33,11 @@ public class CouponDiscountPackageDetails implements Serializable {
*/ */
private String discountName; private String discountName;
/**
* 优惠券图片
*/
private String discountImg;
/** /**
* 数量 * 数量
*/ */
@ -102,6 +107,14 @@ public class CouponDiscountPackageDetails implements Serializable {
this.discountName = discountName; this.discountName = discountName;
} }
public String getDiscountImg() {
return discountImg;
}
public void setDiscountImg(String discountImg) {
this.discountImg = discountImg;
}
public Integer getNum() { public Integer getNum() {
return num; return num;
} }
@ -174,6 +187,7 @@ public class CouponDiscountPackageDetails implements Serializable {
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId())) && (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getDiscountId() == null ? other.getDiscountId() == null : this.getDiscountId().equals(other.getDiscountId())) && (this.getDiscountId() == null ? other.getDiscountId() == null : this.getDiscountId().equals(other.getDiscountId()))
&& (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName())) && (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName()))
&& (this.getDiscountImg() == null ? other.getDiscountImg() == null : this.getDiscountImg().equals(other.getDiscountImg()))
&& (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum())) && (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
&& (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime())) && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
&& (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime())) && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime()))
@ -191,6 +205,7 @@ public class CouponDiscountPackageDetails implements Serializable {
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode()); result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getDiscountId() == null) ? 0 : getDiscountId().hashCode()); result = prime * result + ((getDiscountId() == null) ? 0 : getDiscountId().hashCode());
result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode()); result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode());
result = prime * result + ((getDiscountImg() == null) ? 0 : getDiscountImg().hashCode());
result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode()); result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode()); result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode()); result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode());
@ -211,6 +226,7 @@ public class CouponDiscountPackageDetails implements Serializable {
sb.append(", discountPackageId=").append(discountPackageId); sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", discountId=").append(discountId); sb.append(", discountId=").append(discountId);
sb.append(", discountName=").append(discountName); sb.append(", discountName=").append(discountName);
sb.append(", discountImg=").append(discountImg);
sb.append(", num=").append(num); sb.append(", num=").append(num);
sb.append(", createdTime=").append(createdTime); sb.append(", createdTime=").append(createdTime);
sb.append(", updatedTime=").append(updatedTime); sb.append(", updatedTime=").append(updatedTime);

@ -375,6 +375,76 @@ public class CouponDiscountPackageDetailsExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDiscountImgIsNull() {
addCriterion("discount_img is null");
return (Criteria) this;
}
public Criteria andDiscountImgIsNotNull() {
addCriterion("discount_img is not null");
return (Criteria) this;
}
public Criteria andDiscountImgEqualTo(String value) {
addCriterion("discount_img =", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgNotEqualTo(String value) {
addCriterion("discount_img <>", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgGreaterThan(String value) {
addCriterion("discount_img >", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgGreaterThanOrEqualTo(String value) {
addCriterion("discount_img >=", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgLessThan(String value) {
addCriterion("discount_img <", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgLessThanOrEqualTo(String value) {
addCriterion("discount_img <=", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgLike(String value) {
addCriterion("discount_img like", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgNotLike(String value) {
addCriterion("discount_img not like", value, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgIn(List<String> values) {
addCriterion("discount_img in", values, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgNotIn(List<String> values) {
addCriterion("discount_img not in", values, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgBetween(String value1, String value2) {
addCriterion("discount_img between", value1, value2, "discountImg");
return (Criteria) this;
}
public Criteria andDiscountImgNotBetween(String value1, String value2) {
addCriterion("discount_img not between", value1, value2, "discountImg");
return (Criteria) this;
}
public Criteria andNumIsNull() { public Criteria andNumIsNull() {
addCriterion("num is null"); addCriterion("num is null");
return (Criteria) this; return (Criteria) this;

@ -33,6 +33,11 @@ public class CouponDiscountPackageRecord implements Serializable {
*/ */
private Integer orderId; private Integer orderId;
/**
* 订单号
*/
private String orderNo;
/** /**
* 子订单id * 子订单id
*/ */
@ -117,6 +122,14 @@ public class CouponDiscountPackageRecord implements Serializable {
this.orderId = orderId; this.orderId = orderId;
} }
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public Integer getChildOrderId() { public Integer getChildOrderId() {
return childOrderId; return childOrderId;
} }
@ -213,6 +226,7 @@ public class CouponDiscountPackageRecord implements Serializable {
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle())) && (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle()))
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId())) && (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId())) && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId())) && (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId()))
&& (this.getSerialNo() == null ? other.getSerialNo() == null : this.getSerialNo().equals(other.getSerialNo())) && (this.getSerialNo() == null ? other.getSerialNo() == null : this.getSerialNo().equals(other.getSerialNo()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
@ -233,6 +247,7 @@ public class CouponDiscountPackageRecord implements Serializable {
result = prime * result + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode()); result = prime * result + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode());
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode()); result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode()); result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode()); result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode());
result = prime * result + ((getSerialNo() == null) ? 0 : getSerialNo().hashCode()); result = prime * result + ((getSerialNo() == null) ? 0 : getSerialNo().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
@ -256,6 +271,7 @@ public class CouponDiscountPackageRecord implements Serializable {
sb.append(", discountPackageTitle=").append(discountPackageTitle); sb.append(", discountPackageTitle=").append(discountPackageTitle);
sb.append(", discountPackageId=").append(discountPackageId); sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", orderId=").append(orderId); sb.append(", orderId=").append(orderId);
sb.append(", orderNo=").append(orderNo);
sb.append(", childOrderId=").append(childOrderId); sb.append(", childOrderId=").append(childOrderId);
sb.append(", serialNo=").append(serialNo); sb.append(", serialNo=").append(serialNo);
sb.append(", type=").append(type); sb.append(", type=").append(type);

@ -375,6 +375,76 @@ public class CouponDiscountPackageRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderNoIsNull() {
addCriterion("order_no is null");
return (Criteria) this;
}
public Criteria andOrderNoIsNotNull() {
addCriterion("order_no is not null");
return (Criteria) this;
}
public Criteria andOrderNoEqualTo(String value) {
addCriterion("order_no =", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoNotEqualTo(String value) {
addCriterion("order_no <>", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoGreaterThan(String value) {
addCriterion("order_no >", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoGreaterThanOrEqualTo(String value) {
addCriterion("order_no >=", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoLessThan(String value) {
addCriterion("order_no <", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoLessThanOrEqualTo(String value) {
addCriterion("order_no <=", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoLike(String value) {
addCriterion("order_no like", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoNotLike(String value) {
addCriterion("order_no not like", value, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoIn(List<String> values) {
addCriterion("order_no in", values, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoNotIn(List<String> values) {
addCriterion("order_no not in", values, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoBetween(String value1, String value2) {
addCriterion("order_no between", value1, value2, "orderNo");
return (Criteria) this;
}
public Criteria andOrderNoNotBetween(String value1, String value2) {
addCriterion("order_no not between", value1, value2, "orderNo");
return (Criteria) this;
}
public Criteria andChildOrderIdIsNull() { public Criteria andChildOrderIdIsNull() {
addCriterion("child_order_id is null"); addCriterion("child_order_id is null");
return (Criteria) this; return (Criteria) this;

@ -80,6 +80,8 @@ public interface CouponDiscountPackageService {
*/ */
List<CouponDiscountPackageRecord> getListRecordByMap(Map<String , Object> map); List<CouponDiscountPackageRecord> getListRecordByMap(Map<String , Object> map);
void createRecord(CouponDiscountPackageRecord discountPackageRecord);
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @Name create * @Name create
@ -90,6 +92,14 @@ public interface CouponDiscountPackageService {
*/ */
void createDetail(CouponDiscountPackageDetails discountPackageDetails); void createDetail(CouponDiscountPackageDetails discountPackageDetails);
void updateDetail(CouponDiscountPackageDetails discountPackageDetails);
List<CouponDiscountPackageDetails> getDetailList(Integer discountPackageId);
CouponDiscountPackageDetails discountPackageDetail(Integer discountPackageId , Integer discountId);
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @Name delete * @Name delete
@ -98,6 +108,9 @@ public interface CouponDiscountPackageService {
* @Param id * @Param id
* @return void * @return void
*/ */
void deleteDetail(Long id); void deleteDetail(Integer id);
void giveDiscountPackage(Integer discountPackageId , String phone);
} }

@ -2,6 +2,7 @@ package com.hfkj.service.discount;
import com.hfkj.entity.CouponDiscount; import com.hfkj.entity.CouponDiscount;
import com.hfkj.entity.CouponDiscountGoodsRel; import com.hfkj.entity.CouponDiscountGoodsRel;
import com.hfkj.entity.CouponDiscountPackageDetails;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -105,6 +106,7 @@ public interface CouponDiscountService {
*/ */
void deleteDiscountGoodsRel(Long id); void deleteDiscountGoodsRel(Long id);
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @Name deleteDiscountGoodsRelDiscountId * @Name deleteDiscountGoodsRelDiscountId

@ -0,0 +1,30 @@
package com.hfkj.service.discount;
import com.hfkj.entity.CouponDiscount;
import com.hfkj.entity.CouponDiscountUserRel;
import java.util.List;
import java.util.Map;
public interface CouponDiscountUserRelService {
/**
* @Author Sum1Dream
* @Name create
* @Description // 创建
* @Date 15:11 2024/4/19
* @Param CouponDiscount
* @return void
*/
void create(CouponDiscountUserRel couponDiscountUserRel);
/**
* @Author Sum1Dream
* @Name getList
* @Description // 根据多条件查询列表
* @Date 15:13 2024/4/19
* @Param map
* @return java.util.List<com.hfkj.entity.CouponDiscount>
*/
List<CouponDiscountUserRel> getList(Map<String , Object> map);
}

@ -1,19 +1,25 @@
package com.hfkj.service.discount.impl; package com.hfkj.service.discount.impl;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.dao.CouponDiscountPackageDetailsMapper; import com.hfkj.dao.CouponDiscountPackageDetailsMapper;
import com.hfkj.dao.CouponDiscountPackageMapper; import com.hfkj.dao.CouponDiscountPackageMapper;
import com.hfkj.dao.CouponDiscountPackageRecordMapper; import com.hfkj.dao.CouponDiscountPackageRecordMapper;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.service.discount.CouponDiscountPackageService; import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.discount.CouponDiscountUserRelService;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.UserStatusEnum;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("couponDiscountPackageService") @Service("couponDiscountPackageService")
public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageService { public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageService {
@ -27,6 +33,15 @@ public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageSe
@Resource @Resource
private CouponDiscountPackageDetailsMapper couponDiscountPackageDetailsMapper; private CouponDiscountPackageDetailsMapper couponDiscountPackageDetailsMapper;
@Resource
private CouponDiscountUserRelService discountUserRelService;
@Resource
private BsUserService bsUserService;
@Resource
private CouponDiscountService discountService;
@Override @Override
public void create(CouponDiscountPackage discountPackage) { public void create(CouponDiscountPackage discountPackage) {
couponDiscountPackageMapper.insert(discountPackage); couponDiscountPackageMapper.insert(discountPackage);
@ -52,7 +67,7 @@ public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageSe
@Override @Override
public CouponDiscountPackage queryDetail(Long id) { public CouponDiscountPackage queryDetail(Long id) {
return null; return couponDiscountPackageMapper.selectByPrimaryKey(id);
} }
@Override @Override
@ -99,13 +114,117 @@ public class CouponDiscountPackageServiceImpl implements CouponDiscountPackageSe
return couponDiscountPackageRecordMapper.selectByExample(example); return couponDiscountPackageRecordMapper.selectByExample(example);
} }
@Override
public void createRecord(CouponDiscountPackageRecord discountPackageRecord) {
couponDiscountPackageRecordMapper.insert(discountPackageRecord);
}
@Override @Override
public void createDetail(CouponDiscountPackageDetails discountPackageDetails) { public void createDetail(CouponDiscountPackageDetails discountPackageDetails) {
couponDiscountPackageDetailsMapper.insert(discountPackageDetails); couponDiscountPackageDetailsMapper.insert(discountPackageDetails);
} }
@Override @Override
public void deleteDetail(Long id) { public void updateDetail(CouponDiscountPackageDetails discountPackageDetails) {
CouponDiscountPackageDetails discountPackageDetails = new CouponDiscountPackageDetails(); couponDiscountPackageDetailsMapper.updateByPrimaryKeySelective(discountPackageDetails);
}
@Override
public List<CouponDiscountPackageDetails> getDetailList(Integer discountPackageId) {
CouponDiscountPackageDetailsExample example = new CouponDiscountPackageDetailsExample();
example.createCriteria().andStatusEqualTo(1).andDiscountPackageIdEqualTo(discountPackageId);
return couponDiscountPackageDetailsMapper.selectByExample(example);
}
@Override
public CouponDiscountPackageDetails discountPackageDetail(Integer discountPackageId , Integer discountId) {
CouponDiscountPackageDetailsExample example = new CouponDiscountPackageDetailsExample();
example.createCriteria().andDiscountPackageIdEqualTo(discountPackageId).andDiscountIdEqualTo(discountId).andStatusEqualTo(1);
List<CouponDiscountPackageDetails> list = couponDiscountPackageDetailsMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public void deleteDetail(Integer id) {
couponDiscountPackageDetailsMapper.deleteByPrimaryKey(id);
}
@Override
public void giveDiscountPackage(Integer discountPackageId, String phone) {
CouponDiscountPackage discountPackage = queryDetail(Long.valueOf(discountPackageId));
BsUser bsUser = bsUserService.getUser(phone);
if (bsUser == null) {
bsUser = new BsUser();
bsUser.setPhone(phone);
bsUser.setStatus(UserStatusEnum.status1.getCode());
bsUserService.editData(bsUser);
}
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前券包不存在!");
}
CouponDiscountUserRel discountUserRel;
List<CouponDiscountPackageDetails> details = getDetailList(discountPackageId);
for (CouponDiscountPackageDetails detail : details) {
CouponDiscount discount = discountService.queryDetail(Long.valueOf(detail.getDiscountId()));
for (int i = 0; i < detail.getNum(); i++) {
discountUserRel = new CouponDiscountUserRel();
discountUserRel.setDiscountId(Long.valueOf(detail.getDiscountId()));
discountUserRel.setDiscountImg(detail.getDiscountImg());
discountUserRel.setDiscountName(detail.getDiscountName());
discountUserRel.setDiscountCondition(discount.getCondition());
discountUserRel.setDiscountPrice(discount.getPrice());
discountUserRel.setDiscountType(discount.getType());
discountUserRel.setDiscountPercentage(discount.getPercentage());
discountUserRel.setUserId(bsUser.getId());
discountUserRel.setStatus(1);
discountUserRel.setCreateTime(new Date());
// 计算使用有效期
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, discount.getEffectiveDay());
if (userEndTime.getTime().compareTo(discount.getSalesEndTime()) > 0) {
discountUserRel.setUseEndTime(discount.getSalesEndTime());
} else {
discountUserRel.setUseEndTime(userEndTime.getTime());
}
discountUserRelService.create(discountUserRel);
}
}
CouponDiscountPackageRecord discountPackageRecord = new CouponDiscountPackageRecord();
discountPackageRecord.setDiscountPackageId(discountPackageId);
discountPackageRecord.setDiscountPackageTitle(discountPackage.getTitle());
discountPackageRecord.setType(2);
discountPackageRecord.setSerialNo(OrderUtil.generateOrderNo());
discountPackageRecord.setUserId(bsUser.getId().intValue());
discountPackageRecord.setUserPhone(bsUser.getPhone());
discountPackageRecord.setCreatedTime(new Date());
discountPackageRecord.setStatus(1);
createRecord(discountPackageRecord);
discountPackage.setSurplusStock(discountPackage.getSurplusStock() - 1);
update(discountPackage);
} }
} }

@ -98,6 +98,8 @@ public class CouponDiscountServiceImpl implements CouponDiscountService {
couponDiscountGoodsRelMapper.deleteByPrimaryKey(id); couponDiscountGoodsRelMapper.deleteByPrimaryKey(id);
} }
@Override @Override
public void deleteDiscountGoodsRelDiscountId(Long discountId) { public void deleteDiscountGoodsRelDiscountId(Long discountId) {
CouponDiscountGoodsRelExample example = new CouponDiscountGoodsRelExample(); CouponDiscountGoodsRelExample example = new CouponDiscountGoodsRelExample();

@ -0,0 +1,46 @@
package com.hfkj.service.discount.impl;
import com.hfkj.dao.CouponDiscountUserRelMapper;
import com.hfkj.entity.CouponDiscountExample;
import com.hfkj.entity.CouponDiscountUserRel;
import com.hfkj.entity.CouponDiscountUserRelExample;
import com.hfkj.service.discount.CouponDiscountUserRelService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@Service("couponDiscountUserRelService")
public class CouponDiscountUserRelServiceImpl implements CouponDiscountUserRelService {
@Resource
private CouponDiscountUserRelMapper couponDiscountUserRelMapper;
@Override
public void create(CouponDiscountUserRel couponDiscountUserRel) {
couponDiscountUserRelMapper.insert(couponDiscountUserRel);
}
@Override
public List<CouponDiscountUserRel> getList(Map<String, Object> map) {
CouponDiscountUserRelExample example = new CouponDiscountUserRelExample();
CouponDiscountUserRelExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return couponDiscountUserRelMapper.selectByExample(example);
}
}
Loading…
Cancel
Save