菠萝派接口-订单下载
正在显示
3 个修改的文件
包含
66 行增加
和
123 行删除
1 | package com.sibu.orderHelper.integral.dao; | 1 | package com.sibu.orderHelper.integral.dao; |
2 | import com.sibu.orderHelper.integral.model.*; | 2 | import com.sibu.orderHelper.integral.model.*; |
3 | import com.sibu.orderHelper.integral.pineapple.model.*; | 3 | import com.sibu.orderHelper.integral.pineapple.model.*; |
4 | import com.sibu.orderHelper.integral.pineapple.response.OrderResponse; | ||
4 | import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; | 5 | import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; |
5 | import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; | 6 | import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; |
6 | import com.sibu.orderHelper.integral.reponse.SkuApiResponse; | 7 | import com.sibu.orderHelper.integral.reponse.SkuApiResponse; |
... | @@ -74,7 +75,7 @@ public interface PineappleDao { | ... | @@ -74,7 +75,7 @@ public interface PineappleDao { |
74 | * @param params | 75 | * @param params |
75 | * @return | 76 | * @return |
76 | */ | 77 | */ |
77 | List<Orders> getOrdersList(Map<String,Object> params); | 78 | List<OrderResponse> getOrdersList(Map<String,Object> params); |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * 子订单查询 | 81 | * 子订单查询 | ... | ... |
... | @@ -37,9 +37,6 @@ | ... | @@ -37,9 +37,6 @@ |
37 | <result property="remark" column="remark" /> | 37 | <result property="remark" column="remark" /> |
38 | <result property="createTime" column="create_time" /> | 38 | <result property="createTime" column="create_time" /> |
39 | <result property="updateTime" column="update_time" /> | 39 | <result property="updateTime" column="update_time" /> |
40 | <result property="regionName1" column="regionName1" /> | ||
41 | <result property="regionName2" column="regionName2" /> | ||
42 | <result property="regionName3" column="regionName3" /> | ||
43 | </resultMap> | 40 | </resultMap> |
44 | 41 | ||
45 | <!-- 根据订单号查询订单信息 只查询不是主订单的订单 --> | 42 | <!-- 根据订单号查询订单信息 只查询不是主订单的订单 --> |
... | @@ -159,9 +156,33 @@ | ... | @@ -159,9 +156,33 @@ |
159 | UPDATE product SET product_stock = #{productStock} WHERE id = #{productId} | 156 | UPDATE product SET product_stock = #{productStock} WHERE id = #{productId} |
160 | </update> | 157 | </update> |
161 | 158 | ||
159 | |||
160 | <!-- 下载订单实体--> | ||
161 | <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse"> | ||
162 | <result property="platOrderNo" column="order_sn" /> | ||
163 | <result property="tradeStatus" column="order_state" /> | ||
164 | <result property="tradeStatusDescription" column="remark" /> | ||
165 | <result property="tradeTime" column="create_time" /> | ||
166 | <result property="province" column="regionName1" /> | ||
167 | <result property="city" column="regionName2" /> | ||
168 | <result property="area" column="regionName3" /> | ||
169 | <result property="address" column="address_info" /> | ||
170 | <result property="mobile" column="mobile" /> | ||
171 | <result property="zip" column="zip_code" /> | ||
172 | <result property="postFee" column="money_logistics" /> | ||
173 | <result property="totalMoney" column="money_order" /> | ||
174 | <result property="favourableMoney" column="couponMoney" /> | ||
175 | <result property="goodsFee" column="money_product" /> | ||
176 | <result property="payTime" column="pay_time" /> | ||
177 | <result property="nick" column="member_name" /> | ||
178 | </resultMap> | ||
179 | |||
180 | |||
162 | <!-- 主订单下载--> | 181 | <!-- 主订单下载--> |
163 | <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders"> | 182 | <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders"> |
164 | select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,c.regionName AS regionName2,a.regionName AS regionName3,o.address_info,o.mobile,o.remark,o.zip_code,o.zip_code, | 183 | select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1, |
184 | c.regionName AS regionName2,a.regionName AS regionName3, | ||
185 | o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order-o.money_logistics AS couponMoney | ||
165 | o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o | 186 | o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o |
166 | LEFT JOIN regions p ON p.id = o.province_id | 187 | LEFT JOIN regions p ON p.id = o.province_id |
167 | LEFT JOIN regions c ON c.id = o.city_id | 188 | LEFT JOIN regions c ON c.id = o.city_id |
... | @@ -180,6 +201,7 @@ | ... | @@ -180,6 +201,7 @@ |
180 | limit ${PageIndex}, ${PageSize} | 201 | limit ${PageIndex}, ${PageSize} |
181 | </select> | 202 | </select> |
182 | 203 | ||
204 | <!-- 子订单实体--> | ||
183 | <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct"> | 205 | <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct"> |
184 | <result property="id" column="id" /> | 206 | <result property="id" column="id" /> |
185 | <result property="ordersId" column="orders_id" /> | 207 | <result property="ordersId" column="orders_id" /> |
... | @@ -217,6 +239,19 @@ | ... | @@ -217,6 +239,19 @@ |
217 | <result property="isEvaluate" column="is_evaluate" /> | 239 | <result property="isEvaluate" column="is_evaluate" /> |
218 | </resultMap> | 240 | </resultMap> |
219 | 241 | ||
242 | <!-- 下载子订单实体--> | ||
243 | <!-- <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse"> | ||
244 | <result property="productId" column="" /> | ||
245 | <result property="subOrderNo" column="" /> | ||
246 | <result property="tradeGoodsNo" column="" /> | ||
247 | <result property="tradeGoodsName" column="" /> | ||
248 | <result property="tradeGoodsSpec" column="" /> | ||
249 | <result property="goodsCount" column="" /> | ||
250 | <result property="price" column="" /> | ||
251 | <result property="discountMoney" column="" /> | ||
252 | <result property="status" column="" /> | ||
253 | </resultMap>--> | ||
254 | |||
220 | 255 | ||
221 | <!-- 查询子订单--> | 256 | <!-- 查询子订单--> |
222 | <select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct"> | 257 | <select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct"> | ... | ... |
... | @@ -12,6 +12,7 @@ import com.sibu.orderHelper.integral.model.IMSupplier; | ... | @@ -12,6 +12,7 @@ import com.sibu.orderHelper.integral.model.IMSupplier; |
12 | import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; | 12 | import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; |
13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
14 | import com.sibu.orderHelper.integral.pineapple.model.Orders; | 14 | import com.sibu.orderHelper.integral.pineapple.model.Orders; |
15 | import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct; | ||
15 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; | 16 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; |
16 | 17 | ||
17 | import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; | 18 | import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; |
... | @@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
30 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
31 | 32 | ||
32 | import javax.annotation.Resource; | 33 | import javax.annotation.Resource; |
34 | import javax.xml.bind.ValidationException; | ||
33 | import java.util.ArrayList; | 35 | import java.util.ArrayList; |
34 | import java.util.HashMap; | 36 | import java.util.HashMap; |
35 | import java.util.List; | 37 | import java.util.List; |
... | @@ -71,135 +73,40 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> | ... | @@ -71,135 +73,40 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> |
71 | } | 73 | } |
72 | params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); | 74 | params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); |
73 | params.put("PageSize",callRequest.getBizModel().getPageSize()); | 75 | params.put("PageSize",callRequest.getBizModel().getPageSize()); |
74 | List<Orders> ordersList = pineappleDao.getOrdersList(params); | 76 | List<OrderResponse> ordersList = pineappleDao.getOrdersList(params); |
75 | |||
76 | |||
77 | GetOrderResponse response = new GetOrderResponse(); | 77 | GetOrderResponse response = new GetOrderResponse(); |
78 | response.setNumTotalOrder(0); | 78 | response.setNumTotalOrder(ordersList.size()); |
79 | response.setOrders(null); | 79 | response.setOrders(null); |
80 | response.setCode(PineAppleConst.SUCCESS_CODE); | 80 | response.setCode(PineAppleConst.SUCCESS_CODE); |
81 | return response; | 81 | return response; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | private List<OrderResponse> findOrders(List<OrderResponse> ordersList){ | |
85 | @Override | ||
86 | public String getHandleMethodName() { | ||
87 | return "Differ.JH.Business.GetOrder"; | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | private GetOrderResponse findByOrderCode(CallRequest<GetOrderRequest> callRequest) { | ||
92 | DoingOrderDetailResponse order = null; | ||
93 | try { | ||
94 | order = iimDoingOrderService.getIMOrderDetailByOrderCode(callRequest.getBizModel().getPlatOrderNo()); | ||
95 | if (order != null) { | ||
96 | this.getBarCode(order); | ||
97 | } | ||
98 | } catch (Exception e) { | ||
99 | log.error("获取订单数据业务异常", e); | ||
100 | throw new BizException("获取订单数据业务异常", e); | ||
101 | } | ||
102 | int numTotalOrder = 0; | ||
103 | List<OrderResponse> orders = new ArrayList<>(); | 85 | List<OrderResponse> orders = new ArrayList<>(); |
104 | if (order != null) { | 86 | if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){ |
105 | numTotalOrder = 1; | 87 | ordersList.stream().forEach(o ->{ |
106 | orders.add(this.convertOrder(order)); | 88 | OrderResponse orderResponse = new OrderResponse(); |
89 | try { | ||
90 | pineappleDao.getOrdersProductList(o.getPayOrderNo()); | ||
91 | if(StringUtil.isNull(null)){ | ||
92 | throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getPayOrderNo()))); | ||
93 | } | ||
94 | //orderResponse.setGoodInfos(orderProductList); | ||
95 | orders.add(orderResponse); | ||
96 | } catch (Exception e) { | ||
97 | log.error("获取订单数据业务异常", e); | ||
98 | throw new BizException("获取订单数据业务异常", e); | ||
99 | } | ||
100 | }); | ||
107 | } | 101 | } |
108 | GetOrderResponse response = new GetOrderResponse(); | 102 | return orders; |
109 | response.setNumTotalOrder(numTotalOrder); | ||
110 | response.setOrders(orders); | ||
111 | response.setCode(PineAppleConst.SUCCESS_CODE); | ||
112 | return response; | ||
113 | } | ||
114 | |||
115 | private OrderResponse convertOrder(DoingOrderDetailResponse order) { | ||
116 | return this.platformOrderToPineAppleOrderConverter.convert(order); | ||
117 | } | 103 | } |
118 | 104 | ||
119 | public DoingOrderDetailResponse getBarCode(DoingOrderDetailResponse source) throws Exception { | ||
120 | for (DoingOrder1DetailResponse entity:source.getOrder1s()){ | ||
121 | IMProductBean product = pineappleDao.getIMProductBeanById(entity.getProductId()); | ||
122 | if(StringUtil.isNotBlank(product.getBarCode())){ | ||
123 | entity.setBarCode(product.getBarCode()); | ||
124 | } | ||
125 | } | ||
126 | return source; | ||
127 | } | ||
128 | 105 | ||
129 | 106 | ||
130 | private BaseResponse findList(CallRequest<GetOrderRequest> callRequest) { | 107 | @Override |
131 | List<IMDoingOrderBean> list = new ArrayList<IMDoingOrderBean>(); | 108 | public String getHandleMethodName() { |
132 | //默认获取订单数量值 | 109 | return "Differ.JH.Business.GetOrder"; |
133 | int[] modelValues = {0, 1, 2, 3, 4, 5, 6, 7}; | 110 | } |
134 | String redisMysqlDbConfig = ""; | ||
135 | Map<String, Object> params = new HashMap<>(); | ||
136 | String orderTableName = "im_doing_order_"; | ||
137 | String order1TableName = "im_doing_order1_"; | ||
138 | List<String[]> tableNames = new ArrayList<String[]>(); | ||
139 | //放入两个表名 | ||
140 | for (int j = 0; j < DbUtil.TABLE_LASTCHAR1.size(); j++) { | ||
141 | tableNames.add(new String[]{orderTableName + DbUtil.TABLE_LASTCHAR1.get(j), order1TableName + DbUtil.TABLE_LASTCHAR1.get(j)}); | ||
142 | } | ||
143 | params.put("tableNames", tableNames); | ||
144 | params.put("orderStatusList", callRequest.getBizModel().convertOrderStatus().getMallOrderStatus()); | ||
145 | params.put("supplierId", callRequest.getSupplier().getId()); | ||
146 | params.put("startTime", callRequest.getBizModel().convertAndCheckStartTime()); | ||
147 | params.put("endTime", callRequest.getBizModel().convertAndCheckEndTime()); | ||
148 | params.put("timeType", callRequest.getBizModel().convertTimeTypeEnum().getCode()); | ||
149 | int pageStartInit = (callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize(); | ||
150 | int pageSizeInt = callRequest.getBizModel().getPageSize(); | ||
151 | int totalRecord = 0; | ||
152 | boolean queryFlag = true; | ||
153 | List<DoingOrderDetailResponse> orderBeans = new ArrayList<>(); | ||
154 | //开始循环库查询 | ||
155 | for (int i = 0; i < modelValues.length; i++) { | ||
156 | redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, modelValues[i]); | ||
157 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 | ||
158 | int number = iMDoingOrderDao.countPineAppleOrder(params); | ||
159 | totalRecord += number; | ||
160 | if (queryFlag && number > 0) { | ||
161 | //已经查到有数据了,从下一张表的第一条记录开始查询 | ||
162 | if (orderBeans != null && orderBeans.size() > 0) { | ||
163 | int pageSize = pageSizeInt - orderBeans.size();//减去已查到的数据 | ||
164 | params.put("pageNow", 0); | ||
165 | params.put("pageSize", pageSize); | ||
166 | } else if (totalRecord > pageStartInit) { | ||
167 | int pageNow = pageStartInit - (totalRecord - number); | ||
168 | params.put("pageNow", pageNow); | ||
169 | params.put("pageSize", pageSizeInt); | ||
170 | } else { | ||
171 | continue;//继续循环 | ||
172 | } | ||
173 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 | ||
174 | List<DoingOrderDetailResponse> orders = iMDoingOrderDao.pagerPineAppleOrders(params); | ||
175 | orderBeans.addAll(orders); | ||
176 | if (orderBeans.size() >= callRequest.getBizModel().getPageSize()) { | ||
177 | queryFlag = false; | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | List<OrderResponse> orders = orderBeans | ||
182 | .stream() | ||
183 | .map(p -> { | ||
184 | DoingOrderDetailResponse order = null; | ||
185 | try { | ||
186 | order = iimDoingOrderService.getIMOrderDetailByOrderCode(p.getOrderCode()); | ||
187 | if(!StringUtil.isNull(order)){ | ||
188 | this.getBarCode(order); | ||
189 | } | ||
190 | } catch (Exception e) { | ||
191 | log.error("获取订单数据业务异常", e); | ||
192 | throw new BizException("获取订单数据业务异常", e); | ||
193 | } | ||
194 | return order; | ||
195 | }) | ||
196 | .map(p -> platformOrderToPineAppleOrderConverter.convert(p)) | ||
197 | .collect(Collectors.toList()); | ||
198 | GetOrderResponse response = new GetOrderResponse(); | ||
199 | response.setNumTotalOrder(totalRecord); | ||
200 | response.setOrders(orders); | ||
201 | response.setCode(PineAppleConst.SUCCESS_CODE); | ||
202 | 111 | ||
203 | return response; | ||
204 | }*/ | ||
205 | } | 112 | } | ... | ... |
-
请 注册 或 登录 后发表评论