95041489 刘嘉

菠萝派接口- 订单下载更新数据源

1 个父辈 4b154430
...@@ -67,6 +67,14 @@ public interface MemberReadDao { ...@@ -67,6 +67,14 @@ public interface MemberReadDao {
67 */ 67 */
68 List<Orders> getOrdersList(Map<String,Object> params); 68 List<Orders> getOrdersList(Map<String,Object> params);
69 69
70
71 /**
72 * 订单下载总数
73 * @param params
74 * @return
75 */
76 int countgetOrdersList(Map<String,Object> params);
77
70 /** 78 /**
71 * 子订单查询 79 * 子订单查询
72 * @param orderSn 80 * @param orderSn
......
...@@ -42,10 +42,20 @@ ...@@ -42,10 +42,20 @@
42 <result property="remark" column="remark" /> 42 <result property="remark" column="remark" />
43 <result property="createTime" column="create_time" /> 43 <result property="createTime" column="create_time" />
44 <result property="updateTime" column="update_time" /> 44 <result property="updateTime" column="update_time" />
45 <result property="province" column="regionName1" /> 45 <result property="regionName1" column="regionName1" />
46 <result property="city" column="regionName2" /> 46 <result property="regionName2" column="regionName2" />
47 <result property="area" column="regionName3" /> 47 <result property="regionName3" column="regionName3" />
48 <result property="orderState" column="order_state" /> 48 <result property="orderState" column="order_state" />
49 <result property="moneyOrder" column="money_order" />
50 <result property="moneyPaidBalance" column="money_paid_balance" />
51 <result property="moneyCoupon" column="money_coupon" />
52 <result property="moneyLogistics" column="money_logistics" />
53 <result property="moneyProduct" column="money_product" />
54 <result property="moneyActFull" column="money_act_full" />
55 <result property="moneyDiscount" column="money_discount" />
56 <result property="moneyBack" column="money_back" />
57 <result property="moneyIntegral" column="money_integral" />
58 <result property="payTime" column="pay_time" />
49 </resultMap> 59 </resultMap>
50 60
51 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 --> 61 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
...@@ -142,25 +152,58 @@ ...@@ -142,25 +152,58 @@
142 <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders"> 152 <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
143 select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1, 153 select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
144 c.regionName AS regionName2,a.regionName AS regionName3, 154 c.regionName AS regionName2,a.regionName AS regionName3,
145 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 155 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,
146 o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o 156 o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
147 LEFT JOIN regions p ON p.id = o.province_id 157 LEFT JOIN regions p ON p.id = o.province_id
148 LEFT JOIN regions c ON c.id = o.city_id 158 LEFT JOIN regions c ON c.id = o.city_id
149 LEFT JOIN regions a ON a.id = o.area_id 159 LEFT JOIN regions a ON a.id = o.area_id
150 WHERE o.is_parent = 0 160 WHERE o.is_parent = 0
151 AND seller_id = #{sellerId} AND order_sn = #{orderSn} 161 AND o.seller_id = #{sellerId}
152 <if test="startTime !=null and startTime ! =''"> 162 <if test="orderState!=null and orderState!=''">
153 AND create_time >= #{startTime} 163 AND o.order_state in
164 <foreach collection="orderState" item="state" open="(" close=")" separator=",">
165 #{state}
166 </foreach>
154 </if> 167 </if>
155 <if test="endTime !=null and endTime ! =''"> 168 <if test="orderSn!=null and orderSn!=''">
169 AND o.order_sn = #{orderSn}
170 </if>
171 <if test="startTime!=null and startTime!=''">
172 AND o.create_time >= #{startTime}
173 </if>
174 <if test="endTime!=null and endTime!=''">
156 <![CDATA[ 175 <![CDATA[
157 and create_time <= #{endTime} 176 and o.create_time <= #{endTime}
158 ]]> 177 ]]>
159 </if> 178 </if>
160 ORDER BY o.id DESC 179 ORDER BY o.create_time DESC
161 limit ${PageIndex}, ${PageSize} 180 limit ${PageIndex}, ${PageSize}
162 </select> 181 </select>
163 182
183 <!-- 订单下载总数-->
184 <select id="countgetOrdersList" parameterType="java.util.Map" resultType="java.lang.Integer">
185 select count(*) FROM orders o
186 WHERE o.is_parent = 0
187 AND o.seller_id = #{sellerId}
188 <if test="orderState!=null and orderState!=''">
189 AND o.order_state in
190 <foreach collection="orderState" item="state" open="(" close=")" separator=",">
191 #{state}
192 </foreach>
193 </if>
194 <if test="orderSn!=null and orderSn!=''">
195 AND o.order_sn = #{orderSn}
196 </if>
197 <if test="startTime!=null and startTime!=''">
198 AND o.create_time >= #{startTime}
199 </if>
200 <if test="endTime!=null and endTime!=''">
201 <![CDATA[
202 and o.create_time <= #{endTime}
203 ]]>
204 </if>
205 </select>
206
164 <!-- 子订单实体--> 207 <!-- 子订单实体-->
165 <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct"> 208 <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
166 <result property="id" column="id" /> 209 <result property="id" column="id" />
...@@ -201,9 +244,9 @@ ...@@ -201,9 +244,9 @@
201 244
202 245
203 <!-- 查询子订单--> 246 <!-- 查询子订单-->
204 <select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct"> 247 <select id="getOrdersProductList" resultType="java.lang.String" resultMap="ordersProduct">
205 SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product 248 SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
206 WHERE orders_sn = #{ordersSn} 249 WHERE orders_sn = #{orderSn}
207 </select> 250 </select>
208 251
209 <!-- 地址实体类--> 252 <!-- 地址实体类-->
......
...@@ -23,7 +23,7 @@ public class Orders implements Serializable{ ...@@ -23,7 +23,7 @@ public class Orders implements Serializable{
23 private Integer memberId; 23 private Integer memberId;
24 private String memberName; 24 private String memberName;
25 private Integer orderState; 25 private Integer orderState;
26 private String payTime; 26 private Date payTime;
27 private Integer paymentStatus; 27 private Integer paymentStatus;
28 private Integer invoiceStatus; 28 private Integer invoiceStatus;
29 private String invoiceTitle; 29 private String invoiceTitle;
...@@ -68,7 +68,7 @@ public class Orders implements Serializable{ ...@@ -68,7 +68,7 @@ public class Orders implements Serializable{
68 private String codconfirmTime; 68 private String codconfirmTime;
69 private String codconfirmRemark; 69 private String codconfirmRemark;
70 private Integer codconfirmState; 70 private Integer codconfirmState;
71 private String createTime; 71 private Date createTime;
72 private String updateTime; 72 private String updateTime;
73 private Integer evaluateState; 73 private Integer evaluateState;
74 private String regionName1; 74 private String regionName1;
......
...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.IMDoingOrderBean; ...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
10 import com.sibu.orderHelper.integral.model.IMProductBean; 10 import com.sibu.orderHelper.integral.model.IMProductBean;
11 import com.sibu.orderHelper.integral.model.IMSupplier; 11 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.enums.EJavaShopOrderStateEnum;
13 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum; 14 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
14 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 15 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
15 import com.sibu.orderHelper.integral.pineapple.model.Orders; 16 import com.sibu.orderHelper.integral.pineapple.model.Orders;
...@@ -26,6 +27,7 @@ import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; ...@@ -26,6 +27,7 @@ import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
26 import com.sibu.orderHelper.integral.service.IIMDoingOrderService; 27 import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
27 import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService; 28 import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
28 import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter; 29 import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter;
30 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
29 import com.sibu.orderHelper.service.redis.RedisProductSkuService; 31 import com.sibu.orderHelper.service.redis.RedisProductSkuService;
30 import org.apache.commons.lang3.StringUtils; 32 import org.apache.commons.lang3.StringUtils;
31 import org.apache.log4j.Logger; 33 import org.apache.log4j.Logger;
...@@ -52,16 +54,12 @@ import java.util.stream.Collectors; ...@@ -52,16 +54,12 @@ import java.util.stream.Collectors;
52 @Service 54 @Service
53 public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> { 55 public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> {
54 private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class); 56 private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class);
55 @Resource
56 private IIMDoingOrderService iimDoingOrderService;
57 57
58 @Resource
59 private IMDoingOrderDao iMDoingOrderDao;
60 @Autowired 58 @Autowired
61 private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter; 59 private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter;
62 60
63 @Resource 61 @Resource
64 PineappleDao pineappleDao; 62 private MemberReadDao memberReadDao;
65 63
66 @Override 64 @Override
67 public BaseResponse call(CallRequest<GetOrderRequest> callRequest) { 65 public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
...@@ -69,6 +67,10 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -69,6 +67,10 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
69 if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){ 67 if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
70 params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); 68 params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
71 } 69 }
70 if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){
71 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus());
72 params.put("orderState",orderStatusEnum.getMallOrderStatus());
73 }
72 params.put("sellerId",callRequest.getSupplier().getId()); 74 params.put("sellerId",callRequest.getSupplier().getId());
73 if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){ 75 if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
74 params.put("startTime",callRequest.getBizModel().getStartTime()); 76 params.put("startTime",callRequest.getBizModel().getStartTime());
...@@ -78,9 +80,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -78,9 +80,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
78 } 80 }
79 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); 81 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
80 params.put("PageSize",callRequest.getBizModel().getPageSize()); 82 params.put("PageSize",callRequest.getBizModel().getPageSize());
81 List<Orders> ordersList = pineappleDao.getOrdersList(params); 83 List<Orders> ordersList = memberReadDao.getOrdersList(params);
82 GetOrderResponse response = new GetOrderResponse(); 84 GetOrderResponse response = new GetOrderResponse();
83 response.setNumTotalOrder(ordersList.size()); 85 response.setNumTotalOrder(memberReadDao.countgetOrdersList(params));
84 response.setOrders(findOrders(ordersList)); 86 response.setOrders(findOrders(ordersList));
85 response.setCode(PineAppleConst.SUCCESS_CODE); 87 response.setCode(PineAppleConst.SUCCESS_CODE);
86 return response; 88 return response;
...@@ -92,8 +94,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -92,8 +94,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
92 ordersList.stream().forEach(o ->{ 94 ordersList.stream().forEach(o ->{
93 OrderResponse orderResponse = this.getOrderResponse(o); 95 OrderResponse orderResponse = this.getOrderResponse(o);
94 try { 96 try {
95 List<OrdersProduct> ordersProductList = pineappleDao.getOrdersProductList(o.getOrderSn()); 97 List<OrdersProduct> ordersProductList = memberReadDao.getOrdersProductList(o.getOrderSn());
96 if(StringUtil.isNull(null)){ 98 if(StringUtil.isNull(ordersProductList)){
97 throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn()))); 99 throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
98 } 100 }
99 List<OrderGoodResponse> goodInfos = new ArrayList<>(); 101 List<OrderGoodResponse> goodInfos = new ArrayList<>();
...@@ -101,11 +103,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -101,11 +103,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
101 OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p); 103 OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
102 goodInfos.add(orderGoodResponse); 104 goodInfos.add(orderGoodResponse);
103 }); 105 });
106
104 orderResponse.setGoodInfos(goodInfos); 107 orderResponse.setGoodInfos(goodInfos);
105 orderResponseList.add(orderResponse); 108 orderResponseList.add(orderResponse);
106 } catch (Exception e) { 109 } catch (Exception e) {
107 log.error("获取订单数据业务异常", e); 110 log.error("获取订单数据业务异常", e);
108 throw new BizException("获取订单数据业务异常", e); 111 throw new BizException(String.format("获取订单数据业务异常:[%s]",o.getOrderSn()));
109 } 112 }
110 }); 113 });
111 } 114 }
...@@ -130,12 +133,13 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -130,12 +133,13 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
130 orderResponse.setCity(orders.getRegionName2()); 133 orderResponse.setCity(orders.getRegionName2());
131 orderResponse.setArea(orders.getRegionName3()); 134 orderResponse.setArea(orders.getRegionName3());
132 orderResponse.setAddress(orders.getAddressInfo()); 135 orderResponse.setAddress(orders.getAddressInfo());
136 orderResponse.setNick(orders.getMemberName());
133 orderResponse.setPhone(orders.getMobile()); 137 orderResponse.setPhone(orders.getMobile());
134 orderResponse.setMobile(orders.getMobile()); 138 orderResponse.setMobile(orders.getMobile());
135 orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics())); 139 orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));
136 orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct())); 140 orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));
137 orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder())); 141 orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));
138 orderResponse.setPayTime(this.buildDefaultSimpleDateFormat().format(orders.getPayTime())); 142 orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
139 orderResponse.setShouldPayType("银行收款"); 143 orderResponse.setShouldPayType("银行收款");
140 orderResponse.setTown(""); 144 orderResponse.setTown("");
141 orderResponse.setTaxAmount(""); 145 orderResponse.setTaxAmount("");
...@@ -176,7 +180,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -176,7 +180,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
176 orderGoodResponse.setRefundStatus(""); 180 orderGoodResponse.setRefundStatus("");
177 orderGoodResponse.setStatus(""); 181 orderGoodResponse.setStatus("");
178 orderGoodResponse.setRemark(""); 182 orderGoodResponse.setRemark("");
179 return null; 183 return orderGoodResponse;
180 } 184 }
181 185
182 186
...@@ -194,7 +198,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -194,7 +198,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
194 } 198 }
195 199
196 private String convertAndCheckFreight(BigDecimal money) { 200 private String convertAndCheckFreight(BigDecimal money) {
197 return money.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString(); 201 BigDecimal price = money==null?BigDecimal.ZERO:money;
202 return price.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
198 } 203 }
199 204
200 @Override 205 @Override
......