0716a07e 刘嘉

1.菠萝派发货接口-只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常

1 个父辈 e24fa9bc
......@@ -149,4 +149,7 @@ public interface PineappleDao {
* @throws Exception
*/
List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception;
IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception;
}
......
......@@ -357,6 +357,63 @@
AND supplier_id = #{supplierId}
</select>
<resultMap type="com.sibu.orderHelper.integral.model.IMDoingOrderBean" id="iMDoingOrderBean2">
<id column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="order_code" property="orderCode"/>
<result column="main_order_code" property="mainOrderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="order_from" property="orderFrom"/>
<result column="order_platform" property="orderPlatform"/>
<result column="contact" property="contact"/>
<result column="phone" property="phone"/>
<result column="province" property="province"/>
<result column="city" property="city"/>
<result column="area" property="area"/>
<result column="address" property="address"/>
<result column="zipcode" property="zipcode"/>
<result column="buyer_remark" property="buyerRemark"/>
<result column="seller_remark" property="sellerRemark"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"/>
<result column="freight" property="freight"/>
<result column="express_name" property="expressName"/>
<result column="express_code" property="expressCode"/>
<result column="express_code2" property="expressCode2"/>
<result column="create_dt" property="createDt"/>
<result column="pay_dt" property="payDt"/>
<result column="transaction_id" property="transactionId"/>
<result column="pay_type" property="payType"/>
<result column="open_id" property="openId"/>
<result column="buyer_username" property="buyerUsername"></result>
<result column="buyer_phone" property="buyerPhone"></result>
<result column="erp_import" property="erpImport"></result>
<result column="erp_import_dt" property="erpImportDt"></result>
<result column="ship_dt" property="shipDt"></result>
<result column="receive_dt" property="receiveDt"/>
<result column="user_coupon_money" property="userCouponMoney"/>
<result column="deduction_vb" property="deductionVb"/>
<result column="deduction_money" property="deductionMoney"/>
<result column="prerefund_original_order_status" property="prerefundOriginalOrderStatus"/>
<result column="share_member_id" property="shareMemberId"/>
<result column="share_order_money" property="shareOrderMoney"/>
<result column="platform_type" property="platformType"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
<result column="sign_pay_status" property="signPayStatus"/>
</resultMap>
<select id="getOrderListByMap" parameterType="java.util.Map" resultMap="iMDoingOrderBean2">
SELECT order_id,member_id,order_code,order_status,order_from,
contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id,
province,city,area,address,zipcode,buyer_remark,pay_type,transaction_id,user_coupon_id,user_coupon_money,
express_name,express_code,express_code2,order_platform,
erp_import,prerefund_original_order_status FROM ${doingOrderTable} WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</select>
<update id="updateBusinessSend" parameterType="java.util.Map">
UPDATE ${doingOrderTable}
<set>
......@@ -387,11 +444,19 @@
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
erp_import = 1,erp_import_dt = now(),ship_dt = now(),
order_status = 4
<if test="erpImportDt !=null and erpImportDt !='' ">
erp_import_dt =#{erpImportDt},
</if>
<if test="shipDt !=null and shipDt !='' ">
ship_dt =#{shipDt},
</if>
<if test="orderStatus !=null and orderStatus !='' ">
order_status =#{orderStatus},
</if>
erp_import = 1
</set>
WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId} AND order_status =#{orderStatus}
AND supplier_id = #{supplierId}
</update>
......
......@@ -8,6 +8,7 @@ import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
......@@ -16,6 +17,7 @@ import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
......@@ -31,14 +33,27 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
BaseResponse baseResponse =new BaseResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
params.put("doingOrderTable","im_doing_order_" + tableIndex);
params.put("orderCode",callRequest.getBizModel().getPlatOrderNo());
params.put("supplierId",callRequest.getSupplier().getId());
//只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params);
if(StringUtil.isNull(iMDoingOrderBean)){
log.error("获取订单数据业务异常");
throw new BizException("获取订单数据业务异常");
}
if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasReceived.getCode() || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasDelive.getCode()
|| iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){
if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){
params.put("orderStatus",PayOrderStatus.HasReceived.getCode());
params.put("erpImportDt",new Date());
params.put("shipDt",new Date());
}
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
params.put("expressCode",callRequest.getBizModel().getLogisticNo());
}
......@@ -68,7 +83,11 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
}
}
params.put("expressName",callRequest.getBizModel().getLogisticName());
params.put("orderStatus",PayOrderStatus.WaitShip.getCode());
}else{
log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
pineappleDao.updateBusinessSend(params);
baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
......