89909241 刘嘉

菠萝派接口-订单下载,传商品条形码不传商户ID,商品下载根据产品编号或条形码查询

1 个父辈 a4a10d2e
......@@ -152,4 +152,6 @@ public interface PineappleDao {
IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception;
IMProductBean getIMProductBeanById(@Param("productId") String productId)throws Exception;
}
......
......@@ -132,6 +132,7 @@
<result column="market_price" property="marketPrice" />
<result column="product_type" property="productType" />
<result column="is_show" property="isShow"/>
<result column="bar_code" property="barCode"/>
<result column="is_open_spec" property="isOpenSpec"/>
<result column="spec" property="spec"/>
<result column="mini_purchase_number" property="miniPurchaseNumber"/>
......@@ -168,7 +169,7 @@
and p.is_show = 1
</if>
<if test="productId !=null and productId !=''">
AND p.im_product_id =#{productId}
AND (p.im_product_id =#{productId} OR p.bar_code =#{productId})
</if>
<if test="productName !=null and productName !=''">
AND p.name =#{productName}
......@@ -297,6 +298,15 @@
AND s.supplier_id = #{supplierId}
</select>
<select id="getIMProductBeanById" parameterType="java.lang.String" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />,imp.bar_code
FROM
im_product imp
WHERE imp.im_product_id = #{productId}
</select>
<update id="updateProductInventory" parameterType="com.sibu.orderHelper.integral.model.IMProductInventory">
update im_product_inventory set stock_num=#{stockNum} where im_product_id=#{imProductId}
</update>
......
......@@ -60,6 +60,16 @@ public class DoingOrder1DetailResponse implements Serializable {
private BigDecimal deductionLineVbPrice;
private String barCode;
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode;
}
public Integer getRefundOperateTypeCode() {
if (refundOperateTypeEnum != null) {
return refundOperateTypeEnum.getCode();
......
package com.sibu.orderHelper.integral.service.pineapple.converter;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
......@@ -54,6 +55,9 @@ public class PlatformOrderItemToPineAppleOrderItemConverter implements Converter
}
private String convertAndCheckProductId(DoingOrder1DetailResponse source) {
if(StringUtil.isNotBlank(source.getBarCode())){
return source.getBarCode();
}
if (StringUtils.isNotBlank(source.getSkuId())) {
return source.getSkuId();
}
......
......@@ -3,8 +3,11 @@ package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.integral.dao.IMDoingOrderDao;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.model.IMProductBean;
import com.sibu.orderHelper.integral.model.IMSupplier;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
......@@ -14,6 +17,7 @@ import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
......@@ -48,6 +52,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
@Autowired
private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter;
@Resource
PineappleDao pineappleDao;
@Override
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
if (StringUtils.isNotBlank(callRequest.getBizModel().getPlatOrderNo())) {
......@@ -68,6 +75,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
DoingOrderDetailResponse order = null;
try {
order = iimDoingOrderService.getIMOrderDetailByOrderCode(callRequest.getBizModel().getPlatOrderNo());
if (order != null) {
this.getBarCode(order);
}
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
......@@ -89,6 +99,17 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return this.platformOrderToPineAppleOrderConverter.convert(order);
}
public DoingOrderDetailResponse getBarCode(DoingOrderDetailResponse source) throws Exception {
for (DoingOrder1DetailResponse entity:source.getOrder1s()){
IMProductBean product = pineappleDao.getIMProductBeanById(entity.getProductId());
if(StringUtil.isNotBlank(product.getBarCode())){
entity.setBarCode(product.getBarCode());
}
}
return source;
}
private BaseResponse findList(CallRequest<GetOrderRequest> callRequest) {
List<IMDoingOrderBean> list = new ArrayList<IMDoingOrderBean>();
//默认获取订单数量值
......@@ -146,6 +167,9 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
DoingOrderDetailResponse order = null;
try {
order = iimDoingOrderService.getIMOrderDetailByOrderCode(p.getOrderCode());
if(!StringUtil.isNull(order)){
this.getBarCode(order);
}
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
......