022d350a lauka

菠萝派接口-发货接口,统一使用writeDao,防止数据不一致,修改已有快单就不允许重复添加

1 个父辈 eb01643e
...@@ -43,4 +43,11 @@ public interface MemberWriteDao { ...@@ -43,4 +43,11 @@ public interface MemberWriteDao {
43 */ 43 */
44 int updateProductStock(Map<String,Object> params); 44 int updateProductStock(Map<String,Object> params);
45 45
46 /**
47 * 查询该订单是否有该快递单号
48 * @param params
49 * @return
50 */
51 int checkLogisticsNumber(Map<String,Object> params);
52
46 } 53 }
......
...@@ -4,6 +4,56 @@ ...@@ -4,6 +4,56 @@
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.sibu.orderHelper.mall.member.write.MemberWriteDao"> 5 <mapper namespace="com.sibu.orderHelper.mall.member.write.MemberWriteDao">
6 6
7 <!-- 订单实体 -->
8 <resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
9 <result property="id" column="id" />
10 <result property="sellerId" column="seller_id" />
11 <result property="sellerName" column="seller_name" />
12 <result property="orderId" column="order_id" />
13 <result property="orderSn" column="order_sn" />
14 <result property="orderProductId" column="order_product_id" />
15 <result property="productId" column="product_id" />
16 <result property="productName" column="product_name" />
17 <result property="memberId" column="member_id" />
18 <result property="memberName" column="member_name" />
19 <result property="provinceId" column="province_id" />
20 <result property="cityId" column="city_id" />
21 <result property="areaId" column="area_id" />
22 <result property="addressAll" column="address_all" />
23 <result property="addressInfo" column="address_info" />
24 <result property="zipCode" column="zip_code" />
25 <result property="changeName" column="change_name" />
26 <result property="phone" column="phone" />
27 <result property="logisticsId" column="logistics_id" />
28 <result property="logisticsName" column="logistics_name" />
29 <result property="logisticsMark" column="logistics_mark" />
30 <result property="logisticsNumber" column="logistics_number" />
31 <result property="number" column="number" />
32 <result property="question" column="question" />
33 <result property="image" column="image" />
34 <result property="name" column="name" />
35 <result property="state" column="state" />
36 <result property="optId" column="opt_id" />
37 <result property="optName" column="opt_name" />
38 <result property="remark" column="remark" />
39 <result property="createTime" column="create_time" />
40 <result property="updateTime" column="update_time" />
41 <result property="regionName1" column="regionName1" />
42 <result property="regionName2" column="regionName2" />
43 <result property="regionName3" column="regionName3" />
44 <result property="orderState" column="order_state" />
45 <result property="moneyOrder" column="money_order" />
46 <result property="moneyPaidBalance" column="money_paid_balance" />
47 <result property="moneyCoupon" column="money_coupon" />
48 <result property="moneyLogistics" column="money_logistics" />
49 <result property="moneyProduct" column="money_product" />
50 <result property="moneyActFull" column="money_act_full" />
51 <result property="moneyDiscount" column="money_discount" />
52 <result property="moneyBack" column="money_back" />
53 <result property="moneyIntegral" column="money_integral" />
54 <result property="payTime" column="pay_time" />
55 </resultMap>
56
7 <select id="count" resultType="java.lang.Integer"> 57 <select id="count" resultType="java.lang.Integer">
8 select count(*) from member 58 select count(*) from member
9 </select> 59 </select>
...@@ -18,6 +68,12 @@ ...@@ -18,6 +68,12 @@
18 UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId} 68 UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
19 </update> 69 </update>
20 70
71 <!-- 订单发货-->
72 <!-- 验证订单号是否已存在-->
73 <select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
74 select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
75 </select>
76
21 77
22 <!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 --> 78 <!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
23 <update id="updateOrdersState"> 79 <update id="updateOrdersState">
......
...@@ -41,17 +41,16 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen ...@@ -41,17 +41,16 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
41 params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); 41 params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
42 params.put("sellerId",callRequest.getSupplier().getId()); 42 params.put("sellerId",callRequest.getSupplier().getId());
43 43
44 Orders orders = memberReadDao.getOrdersByMap(params); 44 Orders orders = memberWriteDao.getOrdersByMap(params);
45 if(StringUtil.isNull(orders)){ 45 if(StringUtil.isNull(orders)){
46 log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); 46 log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
47 throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); 47 throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
48 } 48 }
49 //只有订单状态为12345可以允许修改快递单号,其中状态为123可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常 49 //只有订单状态为345可以允许操作该接口,其中状态为3才可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常,4、5只允许添加快递单号
50 if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()){ 50 if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()
51 51 && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitConfirmed.getCode()){
52 if(orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitConfirmed.getCode()
53 || orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
54 52
53 if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
55 //订单状态 54 //订单状态
56 params.put("state",EJavaShopOrderStateEnum.HasReceived.getCode()); 55 params.put("state",EJavaShopOrderStateEnum.HasReceived.getCode());
57 //收货人名字 56 //收货人名字
...@@ -62,21 +61,25 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen ...@@ -62,21 +61,25 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
62 if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ 61 if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
63 params.put("mobile",callRequest.getBizModel().getSenderTel()); 62 params.put("mobile",callRequest.getBizModel().getSenderTel());
64 } 63 }
65 //地址、快递信息 64 //地址、快递信息 建议去除
66 this.gainInfo(params,callRequest,orders); 65 //this.gainInfo(params,callRequest,orders);
67 66
68 } 67 }
69 68
70 if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ 69 if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
71 //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 70 //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
72 int num = memberReadDao.checkLogisticsNumber(params); 71 Map<String,Object> checkMap = new HashMap<>();
73 if(num == 0){ 72 checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
74 if(StringUtil.isNull(orders.getLogisticsNumber())){ 73 checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
75 params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo()); 74 checkMap.put("sellerId",callRequest.getSupplier().getId());
76 }else{ 75 int num = memberWriteDao.checkLogisticsNumber(checkMap);
77 params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo()); 76 if(num == 0){
78 } 77 if(StringUtil.isNull(orders.getLogisticsNumber())){
79 } 78 params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
79 }else{
80 params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
81 }
82 }
80 } 83 }
81 84
82 }else{ 85 }else{
......