From ea6dd840cfa13aada222145682fa7771bcf8cf5d Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 2 Apr 2021 22:53:25 +0800 Subject: [PATCH 1/2] 1 --- .../java/com/hai/dao/HighOrderMapperExt.java | 51 +++++++++++ .../java/com/hai/model/HighOrderData.java | 85 +++++++++++++++++++ .../com/hai/model/HighUserCouponModel.java | 2 +- .../com/hai/service/HighOrderService.java | 3 +- .../service/impl/HighOrderServiceImpl.java | 32 +------ 5 files changed, 143 insertions(+), 30 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/model/HighOrderData.java diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 05c05150..690ecca4 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1,12 +1,15 @@ package com.hai.dao; import com.hai.entity.HighOrder; +import com.hai.model.HighOrderData; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.type.JdbcType; import java.util.List; +import java.util.Map; /** * mapper扩展类 @@ -38,4 +41,52 @@ public interface HighOrderMapperExt { }) List getCloseOrder(); + @Select({ + "" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT), + @Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR), + @Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_model", property="payModel", jdbcType=JdbcType.INTEGER), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), + @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER), + @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), + @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), + @Result(column="goods_type", property="goodsType", jdbcType=JdbcType.INTEGER), + }) + List selectOrderDataList(@Param("map") Map map); + } diff --git a/hai-service/src/main/java/com/hai/model/HighOrderData.java b/hai-service/src/main/java/com/hai/model/HighOrderData.java new file mode 100644 index 00000000..55848450 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/HighOrderData.java @@ -0,0 +1,85 @@ +package com.hai.model; + +import com.hai.entity.HighOrder; + +public class HighOrderData extends HighOrder { + + + /** + * 子订单id + */ + private Long childOrderId; + + /** + * 区域ID + */ + private Long companyId; + + /** + * 商户ID + */ + private Long merchantId; + + /** + * 门店ID + */ + private Long storeId; + + /** + * 订单ID + */ + private Long orderId; + + /** + * 商品类型 1:卡卷 2.充值 + */ + private Integer goodsType; + + public Long getChildOrderId() { + return childOrderId; + } + + public void setChildOrderId(Long childOrderId) { + this.childOrderId = childOrderId; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + + public Long getMerchantId() { + return merchantId; + } + + public void setMerchantId(Long merchantId) { + this.merchantId = merchantId; + } + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + + public Integer getGoodsType() { + return goodsType; + } + + public void setGoodsType(Integer goodsType) { + this.goodsType = goodsType; + } +} diff --git a/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java b/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java index 6a0c73bf..0b4e6dcd 100644 --- a/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java +++ b/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java @@ -7,7 +7,7 @@ import com.hai.entity.HighUserCoupon; * @Description: * @Date: 2021/3/27 17:19 */ -public class HighUserCouponModel extends HighUserCoupon { +public class HighUserCouponModel extends HighUserCoupon { private HighCouponModel highCouponModel; diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 77a4c118..afcf36d2 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -2,6 +2,7 @@ package com.hai.service; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; +import com.hai.model.HighOrderData; import java.util.List; import java.util.Map; @@ -67,7 +68,7 @@ public interface HighOrderService { * @Description 查询订单列表 * @Date 2021/3/26 23:06 **/ - List getOrderList(Map map); + List getOrderList(Map map); /** * @Author 胡锐 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 94271aa8..ac5003fa 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 @@ -13,6 +13,7 @@ import com.hai.dao.HighUserCouponMapper; import com.hai.entity.*; import com.hai.model.HighCouponHandselModel; import com.hai.model.HighCouponModel; +import com.hai.model.HighOrderData; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -56,6 +57,7 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighUserCouponMapper highUserCouponMapper; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertOrder(HighOrder highOrder) throws Exception { @@ -211,35 +213,9 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override - public List getOrderList(Map map) { - - HighOrderExample example = new HighOrderExample(); - HighOrderExample.Criteria criteria = example.createCriteria(); - - if (MapUtils.getLong(map, "memId") != null) { - criteria.andMemIdEqualTo(MapUtils.getLong(map, "memId")); - } - - if (MapUtils.getInteger(map, "status") != null) { - criteria.andOrderStatusEqualTo(MapUtils.getInteger(map, "status")); - } + public List getOrderList(Map map) { - if (MapUtils.getString(map, "orderNo") != null) { - criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); - } - - if (MapUtils.getString(map, "phone") != null) { - criteria.andMemPhoneEqualTo(MapUtils.getString(map, "phone")); - } - - example.setOrderByClause("create_time desc"); - List list = highOrderMapper.selectByExample(example); - if (list.size() > 0) { - for (HighOrder order : list) { - order.setHighChildOrderList(getChildOrderByOrder(order.getId())); - } - } - return list; + return highOrderMapperExt.selectOrderDataList(map); } @Override From f14850e0836c14235dc52776814bb13574c4c991 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Sat, 3 Apr 2021 02:08:20 +0800 Subject: [PATCH 2/2] 1 --- .../com/bweb/controller/HighOrderController.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index c9c962c4..ed50a6dc 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -109,11 +109,21 @@ public class HighOrderController { HttpServletRequest request) { try { -// // 用户 -// SessionObject sessionObject = userCenter.getSessionObject(request); -// HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + Map map = new HashMap<>(); + + if (userInfoModel.getSecRole().getRoleType() == 5) { + map.put("companyId" , userInfoModel.getBsCompany().getId()); + } + if (userInfoModel.getSecRole().getRoleType() == 2) { + map.put("merchantId" , userInfoModel.getMerchant().getId()); + } + if (userInfoModel.getSecRole().getRoleType() == 3) { + map.put("storeId" , userInfoModel.getMerchantStore().getId()); + } map.put("status", status); map.put("orderNo", orderNo); map.put("phone", phone);