From 61b203c4cad561177c15797fc4dd65b8db428873 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Sun, 21 Nov 2021 19:49:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=A2=84=E7=BA=A6=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighOrderController.java | 16 +++ .../controller/HighOrderPreController.java | 133 ++++++++++++++++++ .../controller/pay/UnionPayController.java | 26 ++++ .../java/com/hai/dao/HighCouponMapper.java | 17 ++- .../com/hai/dao/HighCouponSqlProvider.java | 14 ++ .../main/java/com/hai/entity/HighCoupon.java | 18 ++- .../com/hai/entity/HighCouponExample.java | 60 ++++++++ .../com/hai/service/HighOrderPreService.java | 2 +- .../service/impl/HighOrderPreServiceImpl.java | 22 ++- .../service/impl/HighOrderServiceImpl.java | 48 +++++++ .../pay/impl/GoodsOrderServiceImpl.java | 24 ++++ 11 files changed, 367 insertions(+), 13 deletions(-) create mode 100644 hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 65ae2a31..ec1a5abd 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -121,6 +121,22 @@ public class HighOrderController { log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); } + if (coupon.getReserveStatus() == true) { + if (childOrder.getStoreId() == null) { + log.error("HighOrderController --> addOrder() error!", "未选择门店"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未选择门店"); + } + // 查询门店信息 + HighMerchantStoreModel merchantStore = highMerchantStoreService.getMerchantStoreById(childOrder.getStoreId()); + if (merchantStore == null) { + log.error("HighOrderController --> addOrder() error!", "未选择门店"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息"); + } + if (!merchantStore.getMerchantId().equals(coupon.getMerchantId())) { + log.error("HighOrderController --> addOrder() error!", "卡券无法在此门店消费"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡券无法在此门店消费"); + } + } // 支付类型:1.微信支付 2.金币支付 if(coupon.getPayType() == 2) { highOrder.setPayModel(1); // 支付模式:1 金币,2 第三方平台,3 混合 diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java new file mode 100644 index 00000000..c951848d --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java @@ -0,0 +1,133 @@ +package com.cweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.IDGenerator; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.TuanYouConfig; +import com.hai.entity.*; +import com.hai.model.HighMerchantStoreModel; +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.service.*; +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.factory.annotation.Autowired; +import org.springframework.dao.DeadlockLoserDataAccessException; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Auther: 胡锐 + * @Description: + * @Date: 2021/3/26 23:08 + */ +@Controller +@RequestMapping(value = "/orderPre") +@Api(value = "预约订单接口") +public class HighOrderPreController { + private static Logger log = LoggerFactory.getLogger(HighOrderPreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighOrderPreService highOrderPreService; + + + @RequestMapping(value = "/getUserOrderPreList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取用户预约订单") + public ResponseData getUserOrderPreList(@RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "orderPreNo", required = false) String preOrderNo, + @RequestParam(name = "goodsName", required = false) String goodsName, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("preUserId", userInfoModel.getHighUser().getId()); + map.put("status", status); + map.put("orderNo", orderNo); + map.put("preOrderNo", preOrderNo); + map.put("goodsName", goodsName); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderPreService.getListOrderPre(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserPreOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getOrderPreById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询预约订单详情") + public ResponseData getOrderPreById(@RequestParam(name = "orderPreId", required = true) Long orderPreId) { + try { + + return ResponseMsgUtil.success(highOrderPreService.findByOrderId(orderPreId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/orderComplete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "订单完成") + public ResponseData orderComplete(@RequestBody JSONObject body) { + try { + if (body == null || body.getLong("preOrderId") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查询预约订单详情 + HighOrderPre orderPre = highOrderPreService.findByOrderId(body.getLong("preOrderId")); + if (orderPre == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到预约订单"); + } + if (orderPre.getStatus() != 2) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); + } + orderPre.setStatus(3); + orderPre.setUpdateTime(new Date()); + highOrderPreService.updateOrderPre(orderPre); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighOrderController --> orderComplete() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + +} diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java index c23f4688..2d2b2da0 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java @@ -45,6 +45,9 @@ public class UnionPayController { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -134,6 +137,29 @@ public class UnionPayController { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); + + // 是否预约 + if (coupon.getReserveStatus() == true) { + HighOrderPre orderPre = new HighOrderPre(); + orderPre.setCompanyId(coupon.getCompanyId()); + orderPre.setMerchantId(coupon.getMerchantId()); + orderPre.setMerchantStoreId(highChildOrder.getStoreId()); + orderPre.setPreOrderNo(System.currentTimeMillis()+""); + orderPre.setOrderId(order.getId()); + orderPre.setOrderNo(order.getOrderNo()); + orderPre.setChildOrderId(highChildOrder.getId()); + orderPre.setPayRealPrice(order.getPayRealPrice()); + orderPre.setGoodsType(1); + orderPre.setGoodsName(coupon.getCouponName()); + orderPre.setGoodsId(coupon.getId()); + orderPre.setPreUserId(order.getMemId()); + orderPre.setPreUserName(order.getMemName()); + orderPre.setPreUserPhone(order.getMemPhone()); + orderPre.setPreUserRemark(order.getRemarks()); + orderPre.setStatus(1); + highOrderPreService.insertOrderPre(orderPre); + } + // 贵州中石化 if (coupon.getCouponSource() == 4) { // 获取token diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java index 034db444..795517ed 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java @@ -52,7 +52,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "pay_type, ext_1, ext_2, ", "ext_3, `status`, display_area, ", "coupon_source, distributor, ", - "goods_type_id, brand_id)", + "goods_type_id, brand_id, ", + "reserve_status)", "values (#{companyId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", "#{couponKey,jdbcType=VARCHAR}, #{couponName,jdbcType=VARCHAR}, ", "#{couponPrice,jdbcType=DECIMAL}, #{couponImg,jdbcType=VARCHAR}, ", @@ -66,7 +67,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "#{payType,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", "#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER}, ", "#{couponSource,jdbcType=INTEGER}, #{distributor,jdbcType=INTEGER}, ", - "#{goodsTypeId,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER})" + "#{goodsTypeId,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER}, ", + "#{reserveStatus,jdbcType=BIT})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCoupon record); @@ -107,7 +109,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER), @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER), @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER), - @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER) + @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER), + @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT) }) List selectByExample(HighCouponExample example); @@ -117,7 +120,7 @@ public interface HighCouponMapper extends HighCouponMapperExt { "coupon_carousel_img, coupon_desc, coupon_type, sales_end_time, recycle_day, ", "limit_number, sales_price, discount_price, sales_count, is_present, create_time, ", "update_time, operator_id, operator_name, pay_type, ext_1, ext_2, ext_3, `status`, ", - "display_area, coupon_source, distributor, goods_type_id, brand_id", + "display_area, coupon_source, distributor, goods_type_id, brand_id, reserve_status", "from high_coupon", "where id = #{id,jdbcType=BIGINT}" }) @@ -152,7 +155,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER), @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER), @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER), - @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER) + @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER), + @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT) }) HighCoupon selectByPrimaryKey(Long id); @@ -196,7 +200,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "coupon_source = #{couponSource,jdbcType=INTEGER},", "distributor = #{distributor,jdbcType=INTEGER},", "goods_type_id = #{goodsTypeId,jdbcType=INTEGER},", - "brand_id = #{brandId,jdbcType=INTEGER}", + "brand_id = #{brandId,jdbcType=INTEGER},", + "reserve_status = #{reserveStatus,jdbcType=BIT}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(HighCoupon record); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java index 1f7dd7e8..6ebc98ca 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java @@ -148,6 +148,10 @@ public class HighCouponSqlProvider { sql.VALUES("brand_id", "#{brandId,jdbcType=INTEGER}"); } + if (record.getReserveStatus() != null) { + sql.VALUES("reserve_status", "#{reserveStatus,jdbcType=BIT}"); + } + return sql.toString(); } @@ -188,6 +192,7 @@ public class HighCouponSqlProvider { sql.SELECT("distributor"); sql.SELECT("goods_type_id"); sql.SELECT("brand_id"); + sql.SELECT("reserve_status"); sql.FROM("high_coupon"); applyWhere(sql, example, false); @@ -329,6 +334,10 @@ public class HighCouponSqlProvider { sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}"); } + if (record.getReserveStatus() != null) { + sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -368,6 +377,7 @@ public class HighCouponSqlProvider { sql.SET("distributor = #{record.distributor,jdbcType=INTEGER}"); sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=INTEGER}"); sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}"); + sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}"); HighCouponExample example = (HighCouponExample) parameter.get("example"); applyWhere(sql, example, true); @@ -498,6 +508,10 @@ public class HighCouponSqlProvider { sql.SET("brand_id = #{brandId,jdbcType=INTEGER}"); } + if (record.getReserveStatus() != null) { + sql.SET("reserve_status = #{reserveStatus,jdbcType=BIT}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighCoupon.java b/hai-service/src/main/java/com/hai/entity/HighCoupon.java index 8cec3113..af52d038 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCoupon.java +++ b/hai-service/src/main/java/com/hai/entity/HighCoupon.java @@ -162,6 +162,11 @@ public class HighCoupon extends HighCouponModel implements Serializable { */ private Integer brandId; + /** + * 是否预约产品 0:否 1:是 + */ + private Boolean reserveStatus; + private static final long serialVersionUID = 1L; public Long getId() { @@ -412,6 +417,14 @@ public class HighCoupon extends HighCouponModel implements Serializable { this.brandId = brandId; } + public Boolean getReserveStatus() { + return reserveStatus; + } + + public void setReserveStatus(Boolean reserveStatus) { + this.reserveStatus = reserveStatus; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -454,7 +467,8 @@ public class HighCoupon extends HighCouponModel implements Serializable { && (this.getCouponSource() == null ? other.getCouponSource() == null : this.getCouponSource().equals(other.getCouponSource())) && (this.getDistributor() == null ? other.getDistributor() == null : this.getDistributor().equals(other.getDistributor())) && (this.getGoodsTypeId() == null ? other.getGoodsTypeId() == null : this.getGoodsTypeId().equals(other.getGoodsTypeId())) - && (this.getBrandId() == null ? other.getBrandId() == null : this.getBrandId().equals(other.getBrandId())); + && (this.getBrandId() == null ? other.getBrandId() == null : this.getBrandId().equals(other.getBrandId())) + && (this.getReserveStatus() == null ? other.getReserveStatus() == null : this.getReserveStatus().equals(other.getReserveStatus())); } @Override @@ -492,6 +506,7 @@ public class HighCoupon extends HighCouponModel implements Serializable { result = prime * result + ((getDistributor() == null) ? 0 : getDistributor().hashCode()); result = prime * result + ((getGoodsTypeId() == null) ? 0 : getGoodsTypeId().hashCode()); result = prime * result + ((getBrandId() == null) ? 0 : getBrandId().hashCode()); + result = prime * result + ((getReserveStatus() == null) ? 0 : getReserveStatus().hashCode()); return result; } @@ -532,6 +547,7 @@ public class HighCoupon extends HighCouponModel implements Serializable { sb.append(", distributor=").append(distributor); sb.append(", goodsTypeId=").append(goodsTypeId); sb.append(", brandId=").append(brandId); + sb.append(", reserveStatus=").append(reserveStatus); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java index a8dd6480..61c19413 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java @@ -2075,6 +2075,66 @@ public class HighCouponExample { addCriterion("brand_id not between", value1, value2, "brandId"); return (Criteria) this; } + + public Criteria andReserveStatusIsNull() { + addCriterion("reserve_status is null"); + return (Criteria) this; + } + + public Criteria andReserveStatusIsNotNull() { + addCriterion("reserve_status is not null"); + return (Criteria) this; + } + + public Criteria andReserveStatusEqualTo(Boolean value) { + addCriterion("reserve_status =", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotEqualTo(Boolean value) { + addCriterion("reserve_status <>", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusGreaterThan(Boolean value) { + addCriterion("reserve_status >", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusGreaterThanOrEqualTo(Boolean value) { + addCriterion("reserve_status >=", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusLessThan(Boolean value) { + addCriterion("reserve_status <", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusLessThanOrEqualTo(Boolean value) { + addCriterion("reserve_status <=", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusIn(List values) { + addCriterion("reserve_status in", values, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotIn(List values) { + addCriterion("reserve_status not in", values, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusBetween(Boolean value1, Boolean value2) { + addCriterion("reserve_status between", value1, value2, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotBetween(Boolean value1, Boolean value2) { + addCriterion("reserve_status not between", value1, value2, "reserveStatus"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java index eabbaf38..3fd95f2a 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java @@ -13,7 +13,7 @@ public interface HighOrderPreService { * @Param [map] * @return java.util.List **/ - List getListOrderPre(Map map); + List getListOrderPre(Map map); /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java index 55ceef27..2d9daf84 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -21,10 +22,14 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { private HighOrderPreMapper highOrderPreMapper; @Override - public List getListOrderPre(Map map) { + public List getListOrderPre(Map map) { HighOrderPreExample example = new HighOrderPreExample(); HighOrderPreExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getLong(map, "preUserId") != null) { + criteria.andPreUserIdEqualTo(MapUtils.getLong(map, "preUserId")); + } + if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } @@ -37,6 +42,10 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); } + if (MapUtils.getString(map, "preOrderNo") != null) { + criteria.andPreOrderNoLike("%" + MapUtils.getString(map, "preOrderNo") + "%"); + } + if (MapUtils.getString(map, "goodsName") != null) { criteria.andGoodsNameLike("%" + MapUtils.getString(map, "goodsName") + "%"); } @@ -45,10 +54,11 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { criteria.andPreUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); } - if (StringUtils.isNotBlank(map.get("createTimeS")) && StringUtils.isNotBlank(map.get("createTimeE"))) { + if (StringUtils.isNotBlank(MapUtils.getString(map,"createTimeS")) + && StringUtils.isNotBlank(MapUtils.getString(map,"createTimeE"))) { criteria.andCreateTimeBetween( - DateUtil.format(map.get("createTimeS") , "yyyy-MM-dd HH:mm:ss") , - DateUtil.format(map.get("createTimeE") , "yyyy-MM-dd HH:mm:ss")); + DateUtil.format(MapUtils.getString(map,"createTimeS") , "yyyy-MM-dd HH:mm:ss") , + DateUtil.format(MapUtils.getString(map,"createTimeE") , "yyyy-MM-dd HH:mm:ss")); } return highOrderPreMapper.selectByExample(example); } @@ -65,7 +75,9 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { @Override public void insertOrderPre(HighOrderPre highOrderPre) { - highOrderPreMapper.insert(highOrderPre); + highOrderPre.setCreateTime(new Date()); + highOrderPre.setUpdateTime(new Date()); + highOrderPreMapper.insert(highOrderPre); } @Override diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 1a4a05df..25ea9331 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -80,6 +80,9 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighActivityInfoService highActivityInfoService; @@ -199,6 +202,28 @@ public class HighOrderServiceImpl implements HighOrderService { if (highChildOrder.getGoodsType() == 1) { // 查询卡券 HighCoupon coupon = highCouponService.getCouponDetail(highChildOrder.getGoodsId()); + + // 是否预约 + if (coupon.getReserveStatus() == true) { + HighOrderPre orderPre = new HighOrderPre(); + orderPre.setCompanyId(coupon.getCompanyId()); + orderPre.setMerchantId(coupon.getMerchantId()); + orderPre.setMerchantStoreId(highChildOrder.getStoreId()); + orderPre.setPreOrderNo(System.currentTimeMillis()+""); + orderPre.setOrderId(highOrder.getId()); + orderPre.setOrderNo(highOrder.getOrderNo()); + orderPre.setChildOrderId(highChildOrder.getId()); + orderPre.setPayRealPrice(highOrder.getPayRealPrice()); + orderPre.setGoodsType(1); + orderPre.setGoodsName(coupon.getCouponName()); + orderPre.setGoodsId(coupon.getId()); + orderPre.setPreUserId(highOrder.getMemId()); + orderPre.setPreUserName(highOrder.getMemName()); + orderPre.setPreUserPhone(highOrder.getMemPhone()); + orderPre.setPreUserRemark(highOrder.getRemarks()); + orderPre.setStatus(1); + highOrderPreService.insertOrderPre(orderPre); + } // 贵州高速 if (coupon.getCouponSource() == 4) { // 获取token @@ -392,6 +417,29 @@ public class HighOrderServiceImpl implements HighOrderService { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); + + // 是否预约 + if (coupon.getReserveStatus() == true) { + HighOrderPre orderPre = new HighOrderPre(); + orderPre.setCompanyId(coupon.getCompanyId()); + orderPre.setMerchantId(coupon.getMerchantId()); + orderPre.setMerchantStoreId(highChildOrder.getStoreId()); + orderPre.setPreOrderNo(System.currentTimeMillis()+""); + orderPre.setOrderId(order.getId()); + orderPre.setOrderNo(order.getOrderNo()); + orderPre.setChildOrderId(highChildOrder.getId()); + orderPre.setPayRealPrice(order.getPayRealPrice()); + orderPre.setGoodsType(1); + orderPre.setGoodsName(coupon.getCouponName()); + orderPre.setGoodsId(coupon.getId()); + orderPre.setPreUserId(order.getMemId()); + orderPre.setPreUserName(order.getMemName()); + orderPre.setPreUserPhone(order.getMemPhone()); + orderPre.setPreUserRemark(order.getRemarks()); + orderPre.setStatus(1); + highOrderPreService.insertOrderPre(orderPre); + } + // 贵州中石化 if (coupon.getCouponSource() == 4) { // 获取token diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index cb924279..efbebf0e 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -59,6 +59,9 @@ public class GoodsOrderServiceImpl implements PayService { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -126,6 +129,27 @@ public class GoodsOrderServiceImpl implements PayService { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); + // 是否预约 + if (coupon.getReserveStatus() == true) { + HighOrderPre orderPre = new HighOrderPre(); + orderPre.setCompanyId(coupon.getCompanyId()); + orderPre.setMerchantId(coupon.getMerchantId()); + orderPre.setMerchantStoreId(highChildOrder.getStoreId()); + orderPre.setPreOrderNo(System.currentTimeMillis()+""); + orderPre.setOrderId(order.getId()); + orderPre.setOrderNo(order.getOrderNo()); + orderPre.setChildOrderId(highChildOrder.getId()); + orderPre.setPayRealPrice(order.getPayRealPrice()); + orderPre.setGoodsType(1); + orderPre.setGoodsName(coupon.getCouponName()); + orderPre.setGoodsId(coupon.getId()); + orderPre.setPreUserId(order.getMemId()); + orderPre.setPreUserName(order.getMemName()); + orderPre.setPreUserPhone(order.getMemPhone()); + orderPre.setPreUserRemark(order.getRemarks()); + orderPre.setStatus(1); + highOrderPreService.insertOrderPre(orderPre); + } // 贵州中石化 if (coupon.getCouponSource() == 4) { // 获取token