From 470061577e0b158ccbfdc195b7cf588cd1530eb0 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 13 Oct 2022 10:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/web/controller/OrderController.java | 4 +- .../java/com/hai/dao/HighOrderMapper.java | 35 ++++++---- .../com/hai/dao/HighOrderSqlProvider.java | 14 ++++ .../main/java/com/hai/entity/HighOrder.java | 16 +++++ .../java/com/hai/entity/HighOrderExample.java | 70 +++++++++++++++++++ .../order/service/impl/OrderServiceImpl.java | 28 ++++++-- 6 files changed, 146 insertions(+), 21 deletions(-) diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index 039a246c..047e08d5 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -204,7 +204,8 @@ public class OrderController { @RequestMapping(value="/getUserOrderList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取用户订单列表") - public ResponseData getUserOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, + public ResponseData getUserOrderList(@RequestParam(name = "title", required = false) String title, + @RequestParam(name = "orderNo", required = false) String orderNo, @RequestParam(name = "productType", required = false) Integer productType, @RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "pageNum", required = true) Integer pageNum, @@ -216,6 +217,7 @@ public class OrderController { } Map param = new HashMap<>(); + param.put("searchTitle", title); param.put("orderNo", orderNo); param.put("productType", productType); param.put("status", status); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index ee104d1f..d4c5d2ae 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -39,10 +39,11 @@ public interface HighOrderMapper extends HighOrderMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_order (product_type, company_id, ", - "company_name, promote_code, ", - "mem_discount_id, mem_discount_name, ", - "mem_id, mem_name, mem_phone, ", + "insert into high_order (search_title, product_type, ", + "company_id, company_name, ", + "promote_code, mem_discount_id, ", + "mem_discount_name, mem_id, ", + "mem_name, mem_phone, ", "order_no, pay_serial_no, ", "pay_type, mem_card_id, ", "mem_card_type, mem_card_no, ", @@ -60,10 +61,11 @@ public interface HighOrderMapper extends HighOrderMapperExt { "exception_content, ext_1, ", "ext_2, ext_3, ext_4, ", "ext_5, ext_6)", - "values (#{productType,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, ", - "#{companyName,jdbcType=VARCHAR}, #{promoteCode,jdbcType=VARCHAR}, ", - "#{memDiscountId,jdbcType=BIGINT}, #{memDiscountName,jdbcType=VARCHAR}, ", - "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", + "values (#{searchTitle,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, ", + "#{companyId,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, ", + "#{promoteCode,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ", + "#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ", + "#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{orderNo,jdbcType=VARCHAR}, #{paySerialNo,jdbcType=VARCHAR}, ", "#{payType,jdbcType=INTEGER}, #{memCardId,jdbcType=BIGINT}, ", "#{memCardType,jdbcType=INTEGER}, #{memCardNo,jdbcType=VARCHAR}, ", @@ -92,6 +94,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @SelectProvider(type=HighOrderSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="search_title", property="searchTitle", jdbcType=JdbcType.VARCHAR), @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER), @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR), @@ -141,12 +144,12 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Select({ "select", - "id, product_type, company_id, company_name, promote_code, mem_discount_id, mem_discount_name, ", - "mem_id, mem_name, mem_phone, order_no, pay_serial_no, pay_type, mem_card_id, ", - "mem_card_type, mem_card_no, total_price, deduction_price, pay_gold, payable_price, ", - "pay_price, pay_real_price, order_status, remarks, create_time, surplus_refund_price, ", - "surplus_refund_integral, pay_time, finish_time, cancel_time, cancel_remarks, ", - "refund_time, account_merchant_num, profit_sharing_status, profit_sharing_record_id, ", + "id, search_title, product_type, company_id, company_name, promote_code, mem_discount_id, ", + "mem_discount_name, mem_id, mem_name, mem_phone, order_no, pay_serial_no, pay_type, ", + "mem_card_id, mem_card_type, mem_card_no, total_price, deduction_price, pay_gold, ", + "payable_price, pay_price, pay_real_price, order_status, remarks, create_time, ", + "surplus_refund_price, surplus_refund_integral, pay_time, finish_time, cancel_time, ", + "cancel_remarks, refund_time, account_merchant_num, profit_sharing_status, profit_sharing_record_id, ", "whether_check, whether_rebate, exception_status, exception_content, ext_1, ext_2, ", "ext_3, ext_4, ext_5, ext_6", "from high_order", @@ -154,6 +157,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="search_title", property="searchTitle", jdbcType=JdbcType.VARCHAR), @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER), @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR), @@ -212,7 +216,8 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Update({ "update high_order", - "set product_type = #{productType,jdbcType=INTEGER},", + "set search_title = #{searchTitle,jdbcType=VARCHAR},", + "product_type = #{productType,jdbcType=INTEGER},", "company_id = #{companyId,jdbcType=BIGINT},", "company_name = #{companyName,jdbcType=VARCHAR},", "promote_code = #{promoteCode,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java index 596075a5..fc8e0bc1 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java @@ -28,6 +28,10 @@ public class HighOrderSqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("high_order"); + if (record.getSearchTitle() != null) { + sql.VALUES("search_title", "#{searchTitle,jdbcType=VARCHAR}"); + } + if (record.getProductType() != null) { sql.VALUES("product_type", "#{productType,jdbcType=INTEGER}"); } @@ -214,6 +218,7 @@ public class HighOrderSqlProvider { } else { sql.SELECT("id"); } + sql.SELECT("search_title"); sql.SELECT("product_type"); sql.SELECT("company_id"); sql.SELECT("company_name"); @@ -279,6 +284,10 @@ public class HighOrderSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); } + if (record.getSearchTitle() != null) { + sql.SET("search_title = #{record.searchTitle,jdbcType=VARCHAR}"); + } + if (record.getProductType() != null) { sql.SET("product_type = #{record.productType,jdbcType=INTEGER}"); } @@ -464,6 +473,7 @@ public class HighOrderSqlProvider { sql.UPDATE("high_order"); sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("search_title = #{record.searchTitle,jdbcType=VARCHAR}"); sql.SET("product_type = #{record.productType,jdbcType=INTEGER}"); sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); sql.SET("company_name = #{record.companyName,jdbcType=VARCHAR}"); @@ -518,6 +528,10 @@ public class HighOrderSqlProvider { SQL sql = new SQL(); sql.UPDATE("high_order"); + if (record.getSearchTitle() != null) { + sql.SET("search_title = #{searchTitle,jdbcType=VARCHAR}"); + } + if (record.getProductType() != null) { sql.SET("product_type = #{productType,jdbcType=INTEGER}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index 29128f75..c4bdc07a 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -20,6 +20,11 @@ public class HighOrder implements Serializable { */ private Long id; + /** + * 搜索标题 + */ + private String searchTitle; + /** * 产品类型 1:星巴克 @@ -251,6 +256,14 @@ public class HighOrder implements Serializable { this.id = id; } + public String getSearchTitle() { + return searchTitle; + } + + public void setSearchTitle(String searchTitle) { + this.searchTitle = searchTitle; + } + public Integer getProductType() { return productType; } @@ -616,6 +629,7 @@ public class HighOrder implements Serializable { } HighOrder other = (HighOrder) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getSearchTitle() == null ? other.getSearchTitle() == null : this.getSearchTitle().equals(other.getSearchTitle())) && (this.getProductType() == null ? other.getProductType() == null : this.getProductType().equals(other.getProductType())) && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName().equals(other.getCompanyName())) @@ -667,6 +681,7 @@ public class HighOrder implements Serializable { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getSearchTitle() == null) ? 0 : getSearchTitle().hashCode()); result = prime * result + ((getProductType() == null) ? 0 : getProductType().hashCode()); result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode()); @@ -721,6 +736,7 @@ public class HighOrder implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", searchTitle=").append(searchTitle); sb.append(", productType=").append(productType); sb.append(", companyId=").append(companyId); sb.append(", companyName=").append(companyName); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java index 0c9edcb5..e51cba92 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java @@ -186,6 +186,76 @@ public class HighOrderExample { return (Criteria) this; } + public Criteria andSearchTitleIsNull() { + addCriterion("search_title is null"); + return (Criteria) this; + } + + public Criteria andSearchTitleIsNotNull() { + addCriterion("search_title is not null"); + return (Criteria) this; + } + + public Criteria andSearchTitleEqualTo(String value) { + addCriterion("search_title =", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleNotEqualTo(String value) { + addCriterion("search_title <>", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleGreaterThan(String value) { + addCriterion("search_title >", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleGreaterThanOrEqualTo(String value) { + addCriterion("search_title >=", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleLessThan(String value) { + addCriterion("search_title <", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleLessThanOrEqualTo(String value) { + addCriterion("search_title <=", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleLike(String value) { + addCriterion("search_title like", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleNotLike(String value) { + addCriterion("search_title not like", value, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleIn(List values) { + addCriterion("search_title in", values, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleNotIn(List values) { + addCriterion("search_title not in", values, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleBetween(String value1, String value2) { + addCriterion("search_title between", value1, value2, "searchTitle"); + return (Criteria) this; + } + + public Criteria andSearchTitleNotBetween(String value1, String value2) { + addCriterion("search_title not between", value1, value2, "searchTitle"); + return (Criteria) this; + } + public Criteria andProductTypeIsNull() { addCriterion("product_type is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index fb2562f7..c7ec8a4f 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -154,17 +154,31 @@ public class OrderServiceImpl implements OrderService { // 购买卡券 if (child.getGoodsType().equals(OrderChildGoodsType.TYPE1.getNumber())) { order.setProductType(OrderProductType.PRODUCT_TYPE5.getNumber()); - childOrderList = orderCreateHandleService.couponHandle(discountUserRel, child); - + // 创建积分充值订单业务 + List couponOrderList = orderCreateHandleService.couponHandle(discountUserRel, child); + childOrderList = couponOrderList; + for (HighChildOrder childOrder : couponOrderList) { + if (StringUtils.isBlank(order.getSearchTitle())) { + order.setSearchTitle(childOrder.getGoodsName()); + } else { + order.setSearchTitle("+"+childOrder.getGoodsName()); + } + } // 积分充值 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE2.getNumber())) { order.setProductType(OrderProductType.PRODUCT_TYPE4.getNumber()); - childOrderList.add(orderCreateHandleService.integralRecharge(child)); - + // 创建积分充值订单业务 + HighChildOrder oilOrder = orderCreateHandleService.integralRecharge(child); + childOrderList.add(oilOrder); + order.setSearchTitle("积分充值"); + // 加油订单 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) { order.setProductType(OrderProductType.PRODUCT_TYPE6.getNumber()); - childOrderList.add(orderCreateHandleService.oilHandle(order, discountUserRel, createOrderModel, child)); + // 创建加油订单业务 + HighChildOrder oilOrder = orderCreateHandleService.oilHandle(order, discountUserRel, createOrderModel, child); + childOrderList.add(oilOrder); + order.setSearchTitle(oilOrder.getGoodsName()); // 肯德基 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE4.getNumber())) { @@ -563,6 +577,10 @@ public class OrderServiceImpl implements OrderService { criteria.andMemIdEqualTo(MapUtils.getLong(param, "userId")); } + if (StringUtils.isNotBlank(MapUtils.getString(param, "searchTitle"))) { + criteria.andSearchTitleLike("%" + MapUtils.getString(param, "title") + "%"); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) { criteria.andOrderNoLike("%" + MapUtils.getString(param, "orderNo") + "%"); }