f752d860 刘嘉

新系统应用-菠萝派接口,订单下载(未完成)、商品下载(未完成)、修改订单备注(已完成)、修改库存(已经完成)、订单发货(未完成)

1 个父辈 d0fcac64
正在显示 15 个修改的文件 包含 525 行增加699 行删除
package com.sibu.orderHelper.integral.dao;
import com.sibu.orderHelper.integral.model.*;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
import com.sibu.orderHelper.integral.pineapple.model.Product;
import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.reponse.SkuApiResponse;
......@@ -11,147 +14,76 @@ import java.util.Map;
public interface PineappleDao {
/**
* 退货退款单下载
* 根据订单号查询订单信息 只查询不是主订单的订单
* @param params
* @return
*/
List<GetRefundBean> pageGetRefundBean(Map<String,Object> params)throws Exception;
PineappleOderDetailBean getOneIMOrderById(Map<String,Object> map)throws Exception;
//获取api中的商品详情
IMAPIProductBean getApiProductDetailById(@Param("productId") String productId) throws Exception;
//根据条件查询退款订单
int countCheckRefundStatusResponse(Map<String,Object> params)throws Exception;
Orders getOrdersByMap(Map<String,Object> params);
/**
* 根据条件判断该订单是否有成功过的退款记录
* 修改订单备注
* @param params
* @return
* @throws Exception
*/
IMDoingOrderBean getIMDoingOrderBean(Map<String,Object> params)throws Exception;
/**
* 根据orderCode查询成功退款明细记录
* @param orderCode
* @return
* @throws Exception
*/
List<CheckRefundStatusBean> childrenrefundStatusBySuccess(@Param("orderCode")String orderCode)throws Exception;
int updateOdersRemark(Map<String,Object> params);
/**
* 根据条件判断该订单是否有退款中的退款记录
* @param orderCode
* @return
* @throws Exception
*/
List<CheckRefundStatusBean> childrenrefundStatusByCourse(@Param("orderCode")String orderCode)throws Exception;
/**
* 根据条件查询产品
* 查询该订单是否有该快递单号
* @param params
* @return
* @throws Exception
*/
IMProductBean getIMProductBeanByMap(Map<String,Object> params)throws Exception;
int checkLogisticsNumber(Map<String,Object> params);
/**
* 修改订单备注
* 订单发货更新订单状态与信息
* @param params
* @return
*/
int updateSelle(Map<String,Object> params)throws Exception;
int updateOrdersState(Map<String,Object> params);
/**
* 订单发货
* @param params
* @return
* @throws Exception
*/
int updateBusinessSend(Map<String,Object> params)throws Exception;
/**
* 订单发货时判断订单号是否存在,已存在就不添加该订单号
* 商品下载
* @param params
* @return
* @throws Exception
*/
int getOrderByMap(Map<String,Object> params)throws Exception;
List<DownloadProductBean> downloadProductListByMap(Map<String,Object> params);
/**
* 根据条件查SKU
* @param params
* @return
* @throws Exception
*/
SkuBean getSkuBeanByMap(Map<String,Object> params)throws Exception;
/**
* 根据产品ID查询所有SKU
* 根据商品ID获取该商品的所有SKU
* @param productId
* @return
* @throws Exception
*/
List<SkuApiResponse> getSkuBeanListByMap(String productId)throws Exception;
List<DownloadProductSkuBean> downloadSkuByProductId(@Param("productId") String productId);
/**
* 更新SKU库存
* @param skuBean
* @return
* @throws Exception
*/
int updateSku(SkuBean skuBean)throws Exception;
//更新产品库存
int updateProductInventory(IMProductInventory productInventory) throws Exception;
/**
* 更新产品库存
* 根据条件更新sku库存
* @param params
* @return
* @throws Exception
*/
int updateProduct(Map<String,Object> params)throws Exception;
int updateSkuStock(Map<String,Object> params);
/**
* 商品下载 查询产品
* 根据商品ID更新商品库存
* @param params
* @return
* @throws Exception
*/
List<DownloadProductBean> getProductListByMap(Map<String,Object> params)throws Exception;
int updateProductStock(Map<String,Object> params);
/**
* 根据产品ID查询SKU
* @param productid
* 订单下载
* @param params
* @return
* @throws Exception
*/
List<DownloadProductSkuBean> getDownloadProductSkuBeanList(String productid)throws Exception;
List<Orders> getOrdersList(Map<String,Object> params);
/**
* 根据产品ID查询SKU属性
* @param skuId
* 子订单查询
* @param orderSn
* @return
* @throws Exception
*/
List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception;
List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn);
IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception;
IMProductBean getIMProductBeanById(@Param("productId") String productId)throws Exception;
}
......
......@@ -3,477 +3,224 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.integral.dao.PineappleDao">
<!--检测退款订单-->
<select id="countCheckRefundStatusResponse" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM im_order_refund WHERE order_code = #{orderCode} AND refund_status NOT IN ('100','101','-128')
</select>
<select id="getIMDoingOrderBean" parameterType="java.util.Map" resultMap="iMDoingOrderBean">
select order_code,order_status from ${doingOrderTable} WHERE order_code = #{orderCode} and supplier_id =#{supplierId}
</select>
<resultMap id="iMDoingOrderBean" type="com.sibu.orderHelper.integral.model.IMDoingOrderBean">
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
</resultMap>
<select id="childrenrefundStatusBySuccess" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status = 7 AND r.order_code = #{orderCode}
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
<select id="getOrders" parameterType="java.util.Map" resultMap="orders">
select * from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} AND is_parent = 0
</select>
<resultMap id="checkRefundStatusBean" type="com.sibu.orderHelper.integral.model.CheckRefundStatusBean">
<result column="refund_code" property="refundno"/>
<result column="name" property="ProductName"/>
<result column="refund_status" property="refundStatus"/>
</resultMap>
<!-- 修改订单备注 -->
<update id="updateOdersRemark">
UPDATE orders SET remark = #{remark} WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<select id="childrenrefundStatusByCourse" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status NOT IN ('7','100','101','-128') AND r.order_code = #{orderCode}
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!-- 退货退款单下载 -->
<resultMap id="getRefundBeanResultMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
<result column="refund_code" property="refundno"/>
<result column="order_code" property="platorderno"/>
<result column="order1_id" property="subplatorderno"/>
<result column="refund_money" property="refundamount"/>
<result column="apply_date" property="createtime"/>
<result column="refund_status_last_update_dt" property="updatetime"/>
<result column="refund_reason" property="reason"/>
<result column="name" property="productname"/>
<result column="refund_goods_deliver_name" property="logisticname"/>
<result column="refund_goods_waybill" property="logisticno"/>
<result column="status" property="goodsstatus"/>
<result column="refund_remark" property="refundstatusdesc"/>
<result column="refund_status" property="refundstatus"/>
<result column="spec_detail" property="sku"/>
<result column="im_product_id" property="outerid"/>
</resultMap>
<select id="pageGetRefundBean" parameterType="java.util.Map" resultMap="getRefundBeanResultMap">
SELECT r.refund_code,r.order_code,r1.order1_id,r.refund_money,r.apply_date,r.refund_status_last_update_dt,r.refund_status,p.im_product_id,
r.refund_remark,'JH_98' status,p.details,r.refund_reason,r.refund_reason,r1.name,r.refund_goods_deliver_name,r.refund_goods_waybill,r1.spec_detail
FROM im_order_refund r
LEFT JOIN im_refund_order_item r1 ON r.refund_id = r1.refund_id
LEFT JOIN im_product p ON p.im_product_id = r1.product_id
WHERE 1 = 1 and r.order_from = 1 and r.refund_status NOT IN ('100','101','-128')
<if test="supplierId!=null and supplierId !=''">
AND r.supplier_id = #{supplierId}
<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
<update id="updateOrdersState">
UPDATE orders SET
<set>
<if test="name !=null and name !=''">
name = #{name},
</if>
<if test="beginTime != null and beginTime !=''">
and r.apply_date >= #{beginTime}
<if test="addressInfo !=null and addressInfo !=''">
address_info = #{addressInfo},
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[
and r.apply_date <= #{endTime}
]]>
<if test="deliverTime !=null and deliverTime !=''">
deliver_time = #{deliverTime},
</if>
ORDER by r.apply_date DESC
limit ${pageNow}, ${PageSize}
</select>
<!-- 获取订单详情(不包含产品) -->
<select id="getOneIMOrderById" parameterType="map" resultMap="pineappleOderDetailBean">
select ifnull(do.total_money,0) money,do.supplier_name,do.buyer_username,do.prerefund_original_order_status,do1.purchase_quantity
from ${doingOrderTable1} do1 LEFT JOIN ${doingOrderTable} do on do1.order_id = do.order_id
where do1.order1_id=#{orderId1}
</select>
<resultMap type="com.sibu.orderHelper.integral.model.PineappleOderDetailBean" id="pineappleOderDetailBean">
<result column="money" property="totalMoney" />
<result column="supplier_name" property="supplierName" />
<result column="buyer_username" property="buyerUsername" />
<result column="prerefund_original_order_status" property="orderStatus" />
<result column="purchase_quantity" property="num" />
</resultMap>
<resultMap type="com.sibu.orderHelper.integral.model.IMProductBean" id="listAPIIMProduct">
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
<result column="short_name" property="shortName" />
<result column="stock_num" property="stockNum" />
<result column="details" property="details" />
<result column="exchange_integral" property="exchangeIntegral" />
<result column="xws_exchange_integral" property="xwsExchangeIntegral" />
<result column="sibukg_exchange_integral" property="sibukgExchangeIntegral" />
<result column="onther1_exchange_integral" property="onther1ExchangeIntegral" />
<result column="onther2_exchange_integral" property="onther2ExchangeIntegral" />
<result column="onther3_exchange_integral" property="onther3ExchangeIntegral" />
<result column="thumb_img" property="thumbImg" />
<result column="bannel_img1" property="bannelImg1" />
<result column="bannel_img2" property="bannelImg2" />
<result column="bannel_img3" property="bannelImg3" />
<result column="bannel_img4" property="bannelImg4" />
<result column="bannel_img5" property="bannelImg5" />
<result column="limit_exchange_number" property="limitExchangeNumber"/>
<result column="is_new" property="isNew" />
<result column="is_hot" property="isHot" />
<result column="is_reco" property="isReco" />
<result column="cost" property="cost" />
<result column="attention" property="attention" />
<result column="total_comment_score" property="totalCommentScore" />
<result column="total_comment_number" property="totalCommentNumber" />
<result column="member_price" property="memberPrice" />
<result column="retail_price" property="retailPrice" />
<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"/>
<result column="format_str" property="formatStr"/>
<result column="erp_code" property="erpCode"/>
<result column="is_group" property="isGroup"/>
<result column="share_status" property="shareStatus"/>
<result column="share_percentage" property="sharePercentage"/>
<result column="im_category_id" property="imCategoryId"/>
<result column="delete_flag" property="deleteFlag"/>
</resultMap>
<if test="logisticsNumber !=null and logisticsNumber !=''">
logistics_number = #{logisticsNumber},
</if>
<if test="mobile !=null and mobile !=''">
mobile = #{mobile},
</if>
<if test="addressAll !=null and addressAll !=''">
address_all = #{addressAll},
</if>
<if test="orderState !=null and orderState !=''">
order_state = #{orderState},
</if>
<if test="provinceId !=null and provinceId !=''">
province_id = #{provinceId},
</if>
<if test="areaId !=null and areaId !=''">
area_id = #{areaId},
</if>
<if test="cityId !=null and cityId !=''">
city_id = #{cityId},
</if>
<if test="deliverTime !=null and deliverTime !=''">
deliver_time = now(),
</if>
<if test="logisticsName !=null and logisticsName !=''">
logistics_name = #{logisticsName},
</if>
<if test="logisticsId !=null and logisticsId !=''">
logistics_id = #{logisticsId},
</if>
</set>
WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 产品下载 -->
<!-- 商品下载实体-->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="im_product_id" property="PlatProductID"/>
<result column="id" property="PlatProductID"/>
<result column="name" property="name"/>
<result column="OuterID" property="OuterID"/>
<result column="outerID" property="OuterID"/>
<result column="price" property="price"/>
<result column="stock_num" property="num"/>
<result column="bannel_img1" property="pictureurl"/>
<result column="num" property="num"/>
<result column="pictureurl" property="pictureurl"/>
</resultMap>
<select id="getProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.im_product_id,p.name,p.im_product_id AS OuterID,IFNULL(p.retail_price,0) price,p.stock_num,p.bannel_img1
FROM im_product p,im_product_supplier i
WHERE p.im_product_id = i.product_id and i.supplier_id= #{supplierId}
<if test="isShow == 0">
and p.is_show = 0
</if>
<if test="isShow == 1">
and p.is_show = 1
</if>
<!-- 商品下载 -->
<select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mall_pc_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.im_product_id =#{productId} OR p.bar_code =#{productId})
AND (p.id = #{productId} or p.product_code = #{productId}
</if>
<if test="state !=null and state !=''">
AND p.state = #{state}
</if>
<if test="productName !=null and productName !=''">
AND p.name =#{productName}
AND p.state = #{productName}
</if>
ORDER BY p.im_product_id DESC
limit ${PageIndex}, ${PageSize}
</select>
<resultMap id="downloadProductSkuBeanList" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="sku_id" property="SkuID"/>
<result column="sku_id" property="skuOuterID"/>
<result column="retail_price" property="skuprice"/>
<result column="stock_num" property="skuQuantity"/>
</resultMap>
<select id="getDownloadProductSkuBeanList" parameterType="java.lang.String" resultMap="downloadProductSkuBeanList">
SELECT sku_id,stock_num,retail_price FROM sku WHERE im_product_id = #{productId}
</select>
<resultMap id="sku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="name" property="skuname"/>
<!-- 商品sku实体 -->
<resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="skuId" property="SkuID"/>
<result column="skuOuterID" property="skuOuterID"/>
<result column="skuprice" property="skuprice"/>
<result column="skuQuantity" property="skuQuantity"/>
<result column="skuname" property="skuname"/>
<result column="skupictureurl" property="skupictureurl"/>
</resultMap>
<select id="getDownloadSkuBean" parameterType="java.lang.String" resultMap="sku">
SELECT concat(concat(n.attr_name,':'),v.attr_value) name FROM attr_ref a
LEFT JOIN attr_value v ON a.attr_value_id = v.value_id
LEFT JOIN attr_name n on v.attr_id = n.attr_id WHERE a.sku_id = #{skuId} AND n.attr_name IS NOT NULL
<!-- 获取商品sku -->
<select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
select g.sku AS skuId,g.sku AS skuOuterID,g.mall_pc_price AS skuprice,g.product_stock AS skuQuantity,
g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g WHERE g.product_id = #{productId}
</select>
<!-- 同步库存 -->
<resultMap id="rs_SkuBean" type="com.sibu.orderHelper.integral.model.SkuBean">
<result property="skuId" column="sku_id" />
<result property="imProductId" column="im_product_id"/>
<result property="erpCode" column="erp_code" />
<result property="stockNum" column="stock_num" />
<result property="exchangeIntegral" column="exchange_integral"/>
<result property="retailPrice" column="retail_price" />
<result property="marketPrice" column="market_price" />
<result property="createDate" column="create_date" />
<result property="updateDate" column="update_date" />
<result property="isShow" column="is_show" />
</resultMap>
<resultMap id="skuApiResponse" type="com.sibu.orderHelper.integral.reponse.SkuApiResponse">
<result property="skuId" column="sku_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="erpCode" column="erp_code" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="stockNum" column="stock_num" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="exchangeIntegral" column="exchange_integral" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="memberPrice" column="member_price"/>
<result property="retailPrice" column="retail_price"/>
<result property="marketPrice" column="market_price"/>
<collection property="values" ofType="com.sibu.orderHelper.integral.reponse.SkuValueResponse" column="sku_Id">
<result property="attrValueId" column="attr_value_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrId" column="attr_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrName" column="attr_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="valueName" column="attr_value" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="sortIndex" column="sort_index" javaType="java.lang.Integer" jdbcType="TINYINT"/>
</collection>
</resultMap>
<!--根据产品ID与SKUID 查询SKU -->
<select id="getSkuBeanByMap" parameterType="java.util.Map" resultMap="rs_SkuBean">
SELECT * FROM sku where
sku_id = #{skuId} AND im_product_id = #{productId} and is_show =1
</select>
<!-- 查询product sku返回 -->
<select id="getSkuBeanListByMap" parameterType="java.lang.String" resultMap="skuApiResponse">
SELECT s.sku_id,s.erp_code,s.stock_num,s.exchange_integral,s.retail_price,s.market_price,s.member_price,
s.is_show,ref.attr_value_id,n.attr_id,n.attr_name,v.attr_value ,n.sort_index FROM sku s
LEFT JOIN attr_ref ref ON s.sku_id =ref.sku_id
LEFT JOIN attr_value v ON v.value_id =ref.attr_value_id
LEFT JOIN attr_name n ON n.attr_id =v.attr_id
WHERE s.im_product_id =#{productId}
</select>
<!-- 更新SKU-->
<update id="updateSku" parameterType="com.sibu.orderHelper.integral.model.SkuBean">
update sku SET stock_num = #{stockNum} WHERE sku_id = #{skuId}
</update>
<!-- 根据条件查询产品 -->
<sql id="Base_Product_Column">
imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.cost,
imp.attention,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.share_status,
imp.share_percentage
</sql>
<select id="getIMProductBeanByMap" parameterType="java.util.Map" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />
FROM
im_product imp,im_product_supplier s
WHERE imp.im_product_id = s.product_id
AND imp.im_product_id = #{productId}
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}
<!-- 更新SKU库存-->
<update id="updateSkuStock" parameterType="java.util.Map">
UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
</update>
<update id="updateProduct" parameterType="java.util.Map">
update im_product set stock_num = #{stockNum} WHERE im_product_id = #{productId}
<!-- 更新产品库存-->
<update id="updateProductStock" parameterType="java.util.Map">
UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
</update>
<select id="getApiProductDetailById" resultMap="listAPIIMProduct" parameterType="String" useCache="true" statementType="PREPARED">
select imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.details,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.bannel_img1,
imp.bannel_img2,
imp.bannel_img3,
imp.bannel_img4,
imp.bannel_img5,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.erp_code,
imp.is_group,
imp.share_status,
imp.share_percentage,
ipi.attention,
ipi.total_comment_score,
ipi.total_comment_number,
ipi.cost,
imp.delete_flag
FROM im_product imp left join im_product_inventory ipi on imp.im_product_id = ipi.im_product_id
WHERE
imp.im_product_id = #{productId}
</select>
<!-- 订单发货-->
<select id="getOrderByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM ${doingOrderTable} WHERE express_code like concat(concat('%',#{expressCode},'%')) AND order_code = #{orderCode}
AND supplier_id = #{supplierId}
<!-- 主订单下载-->
<select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
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,
o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
LEFT JOIN regions p ON p.id = o.province_id
LEFT JOIN regions c ON c.id = o.city_id
LEFT JOIN regions a ON a.id = o.area_id
WHERE o.is_parent = 0
AND seller_id = #{sellerId} AND order_sn = #{orderSn}
<if test="startTime !=null and startTime ! =''">
AND create_time >= #{startTime}
</if>
<if test="endTime !=null and endTime ! =''">
<![CDATA[
and create_time <= #{endTime}
]]>
</if>
ORDER BY o.id DESC
limit ${PageIndex}, ${PageSize}
</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 id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
<result property="id" column="id" />
<result property="ordersId" column="orders_id" />
<result property="ordersSn" column="orders_sn" />
<result property="ordersPsn" column="orders_psn" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="productCateId" column="product_cate_id" />
<result property="productId" column="product_id" />
<result property="productGoodsId" column="product_goods_id" />
<result property="specInfo" column="spec_info" />
<result property="productName" column="product_name" />
<result property="productSku" column="product_sku" />
<result property="packageGroupsId" column="package_groups_id" />
<result property="mallGroupsId" column="mall_groups_id" />
<result property="giftId" column="gift_id" />
<result property="isGift" column="is_gift" />
<result property="moneyPrice" column="money_price" />
<result property="number" column="number" />
<result property="moneyAmount" column="money_amount" />
<result property="moneyActSingle" column="money_act_single" />
<result property="actSingleId" column="act_single_id" />
<result property="actGroupId" column="act_group_id" />
<result property="actFlashSaleId" column="act_flash_sale_id" />
<result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
<result property="actBiddingId" column="act_bidding_id" />
<result property="actIntegralId" column="act_integral_id" />
<result property="actIntegralNum" column="act_integral_num" />
<result property="actIntegralMoney" column="act_integral_money" />
<result property="systemRemark" column="system_remark" />
<result property="backNumber" column="back_number" />
<result property="exchangeNumber" column="exchange_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isEvaluate" column="is_evaluate" />
</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 id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct">
SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
WHERE orders_sn = #{ordersSn}
</select>
<update id="updateBusinessSend" parameterType="java.util.Map">
UPDATE ${doingOrderTable}
<set>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<if test="expressCode !=null and expressCode !='' ">
express_code = #{expressCode},
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
buyer_phone = #{buyerPhone},
</if>
<if test="address!=null and address!='' ">
address =#{address},
</if>
<if test="expressName !=null and expressName !='' ">
express_name =#{expressName},
</if>
<if test="province !=null and province !='' ">
province =#{province},
</if>
<if test="city !=null and city !='' ">
city =#{city},
</if>
<if test="area !=null and area !='' ">
area =#{area},
</if>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<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}
</update>
<!-- 修改订单备注 -->
<update id="updateSelle" parameterType="java.util.Map">
UPDATE ${doingOrderTable} SET seller_remark = #{sellerRemark} WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</update>
</mapper>
\ No newline at end of file
......
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@ToString
public class Orders {
private Integer id;
private String orderSn;
private String orderPsn;
private Integer isParent;
private Integer isShow;
private String relationOrderSn;
private Integer orderType;
private Integer sellerId;
private String sellerName;
private Integer memberId;
private String memberName;
private Integer orderState;
private Date payTime;
private Integer paymentStatus;
private Integer invoiceStatus;
private String invoiceTitle;
private String invoiceType;
private BigDecimal moneyProduct;
private BigDecimal moneyLogistics;
private BigDecimal moneyOrder;
private BigDecimal moneyPaidBalance;
private BigDecimal moneyPaidReality;
private BigDecimal moneyCoupon;
private BigDecimal moneyActFull;
private BigDecimal moneyDiscount;
private BigDecimal moneyBack;
private BigDecimal moneyIntegral;
private Integer integral;
private Integer couponUserId;
private Integer actFullId;
private Integer activityId;
private String ip;
private String paymentName;
private String paymentCode;
private String name;
private Integer provinceId;
private Integer cityId;
private Integer areaId;
private String addressAll;
private String addressInfo;
private String mobile;
private String email;
private String zipCode;
private String remark;
private Date deliverTime;
private Date finishTime;
private String tradeSn;
private Integer source;
private Integer logisticsId;
private String logisticsName;
private String logisticsNumber;
private Integer isCodconfim;
private Integer codconfirmId;
private String codconfirmName;
private Date codconfirmTime;
private String codconfirmRemark;
private Integer codconfirmState;
private Date createTime;
private Date DateupdateTime;
private Integer evaluateState;
private String regionName1;
private String regionName2;
private String regionName3;
private List<OrdersProduct> goodinfos;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ToString
public class OrdersProduct {
private Integer id;
private Integer ordersId;
private String ordersSn;
private String ordersPsn;
private Integer sellerId;
private String sellerName;
private Integer productCateId;
private Integer productId;
private Integer productGoodsId;
private String specInfo;
private String productName;
private String productSku;
private Integer packageGroupsId;
private Integer mallGroupsId;
private Integer giftId;
private Integer isGift;
private BigDecimal moneyPrice;
private Integer number;
private BigDecimal moneyAmount;
private BigDecimal moneyActSingle;
private Integer actSingleId;
private Integer actGroupId;
private Integer actFlashSaleId;
private Integer actFlashSaleProductId;
private Integer actBiddingId;
private Integer actIntegralId;
private Integer actIntegralNum;
private BigDecimal actIntegralMoney;
private String systemRemark;
private Integer backNumber;
private Integer exchangeNumber;
private Date createTime;
private Date updateTime;
private Integer isEvaluate;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ToString
public class Product {
private Integer id;
private Integer productCateId;
private String productCatePath;
private String name1;
private String name2;
private String keyword;
private Integer productBrandId;
private Integer isSelf;
private BigDecimal costPrice;
private BigDecimal protectedPrice;
private BigDecimal marketPrice;
private BigDecimal mallPcPrice;
private BigDecimal malMobilePrice;
private Integer virtualSales;
private Integer actualSales;
private Integer productStock;
private Integer isNorm;
private String normIds;
private String normName;
private Integer state;
private Integer isTop;
private Date upTime;
private String description;
private String packing;
private Integer sellerId;
private Integer createId;
private Date createTime;
private Date updateTime;
private Integer sellerCateId;
private Integer sellerIsTop;
private Integer sellerState;
private Integer commentsNumber;
private Integer productCateState;
private Integer isInventedProduct;
private Integer transportType;
private Integer transportId;
private String masterImg;
private String productCode;
private BigDecimal saleScale1;
private BigDecimal saleScale2;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class ProductGoods {
private Long id;
private Long productId;
private String normAttrId;
private String normName;
private Double mallPcPrice;
private Double mallMobilePrice;
private Long productStock;
private Long productStockWarning;
private Long actualSales;
private String sku;
private String images;
private Long state;
private Double weight;
private Long length;
private Long width;
private Long height;
}
......@@ -12,6 +12,7 @@ public class PineappleSyncStockRequest {
@JsonProperty("PlatProductID")
private String platProductID;
@NotBlank(message = "skuid参数不能为空")
@JsonProperty("SkuID")
private String skuID;
......
......@@ -45,7 +45,7 @@ public class PineappleServiceImpl implements PineappleService {
params.put("endTime","");
params.put("pageNow","1");
params.put("PageSize","10");
return pineappleDao.pageGetRefundBean(params);
return null;
}
@Override
......@@ -68,7 +68,7 @@ public class PineappleServiceImpl implements PineappleService {
@Override
public PineappleSyncStockResponse updateSyncStock(PineappleSyncStockRequest pineappleSyncStockRequest) throws Exception {
PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
Map<String,Object> params = new HashMap<>();
/* Map<String,Object> params = new HashMap<>();
params.put("supplierId","");
params.put("productId",pineappleSyncStockRequest.getPlatProductID());
//先判断SKU在判断产品
......@@ -144,12 +144,13 @@ public class PineappleServiceImpl implements PineappleService {
pineappleSyncStockResponse.setQuantity(String.valueOf(pineappleSyncStockRequest.getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.ERROR.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.ERROR.getCode());
return pineappleSyncStockResponse;
return pineappleSyncStockResponse;*/
return null;
}
@Override
public BaseResponse shipments(PineappleSendRequest pineappleSend) throws Exception {
BaseResponse baseResponse =new BaseResponse();
/*BaseResponse baseResponse =new BaseResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
//订单号不符合
......@@ -200,12 +201,13 @@ public class PineappleServiceImpl implements PineappleService {
pineappleDao.updateBusinessSend(params);
baseResponse.setMessage(PineappleEnum.ERROR.getMsg());
baseResponse.setCode(PineappleEnum.ERROR.getCode());
return baseResponse;
return baseResponse;*/
return null;
}
@Override
public UpdateSellerMemoResponse updateSelle(UpdateSellerMemoRequest updateSellerMemoRequest)throws Exception {
UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
/* UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
//订单号不符合
......@@ -226,6 +228,7 @@ public class PineappleServiceImpl implements PineappleService {
UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return UpdateSellerMemoResponse;
return UpdateSellerMemoResponse;*/
return null;
}
}
......
......@@ -32,7 +32,7 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
params.put("orderCode",callRequest.getBizModel().getOrderID());
List<CheckRefundStatusBean> checkRefundStatusBeanList = new ArrayList<>();
/*
//先判断是否有退款
if(pineappleDao.countCheckRefundStatusResponse(params)>0){
Map<String,Object> map = new HashMap<>();
......@@ -112,7 +112,7 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_07.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/
return checkRefundStatusResponse;
}
......
......@@ -30,9 +30,9 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
DownloadProductResponse downloadProductResponse = new DownloadProductResponse();
Map<String,Object> params =new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStatus())){
/*if(!StringUtil.isNull(callRequest.getBizModel().getStatus())){
params.put("isShow", DownloadProductStatusEnum.resolve(callRequest.getBizModel().getStatus()).intValue());
}
}*/
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
if(!StringUtil.isNull(callRequest.getBizModel().getProductId())){
......@@ -42,34 +42,13 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
params.put("productName",callRequest.getBizModel().getPageSize());
}
//查询产品
List<DownloadProductBean> downloadProductBeanList = pineappleDao.getProductListByMap(params);
List<DownloadProductBean> downloadProductBeanList = pineappleDao.downloadProductListByMap(params);
if(!StringUtil.isNull(downloadProductBeanList) && !downloadProductBeanList.isEmpty()){
for(DownloadProductBean product : downloadProductBeanList){
//产品SKU
List<DownloadProductSkuBean> downloadProductSkuBeanList = pineappleDao.getDownloadProductSkuBeanList(product.getPlatProductID());
if(!StringUtil.isNull(downloadProductSkuBeanList) && !downloadProductSkuBeanList.isEmpty()){
for(int i=0;i<downloadProductSkuBeanList.size();i++){
DownloadProductSkuBean sku = downloadProductSkuBeanList.get(i);
//查询SKU规格名称
List<DownloadProductSkuBean> skuList = pineappleDao.getDownloadSkuBean(sku.getSkuID());
if(!StringUtil.isNull(skuList) && !skuList.isEmpty()){
StringBuffer sb = new StringBuffer();
for(int j = 0;j<skuList.size();j++){
if(j ==0){
sb.append(skuList.get(j).getSkuname());
}else{
sb.append(","+skuList.get(j).getSkuname());
}
}
sku.setSkuname(sb.toString());
sku.setSkupictureurl(product.getPictureurl());
}
}
}
List<DownloadProductSkuBean> downloadProductSkuBeanList = pineappleDao.downloadSkuByProductId(product.getPlatProductID());
product.setSkus(downloadProductSkuBeanList);
};
downloadProductResponse.setTotalcount(downloadProductBeanList.size());
}else{
downloadProductResponse.setTotalcount(0);
......
......@@ -11,6 +11,7 @@ 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;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
......@@ -57,11 +58,27 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
@Override
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
if (StringUtils.isNotBlank(callRequest.getBizModel().getPlatOrderNo())) {
return this.findByOrderCode(callRequest);
} else {
return this.findList(callRequest);
Map<String,Object> params = new HashMap<>();
if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
}
params.put("sellerId",callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
params.put("startTime",callRequest.getBizModel().getStartTime());
}
if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){
params.put("endTime",callRequest.getBizModel().getEndTime());
}
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<Orders> ordersList = pineappleDao.getOrdersList(params);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(0);
response.setOrders(null);
response.setCode(PineAppleConst.SUCCESS_CODE);
return response;
}
......@@ -70,7 +87,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return "Differ.JH.Business.GetOrder";
}
/*
private GetOrderResponse findByOrderCode(CallRequest<GetOrderRequest> callRequest) {
DoingOrderDetailResponse order = null;
try {
......@@ -184,5 +201,5 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
response.setCode(PineAppleConst.SUCCESS_CODE);
return response;
}
}*/
}
......
......@@ -34,7 +34,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
@Override
public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
GetRefundResponse getRefundResponse =new GetRefundResponse();
/*GetRefundResponse getRefundResponse =new GetRefundResponse();
Map<String,Object> params = new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
params.put("beginTime",callRequest.getBizModel().getBeginTime());
......@@ -83,8 +83,8 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
getRefundResponse.setRefunds(refundBeanList);
getRefundResponse.setSuccess(true);
getRefundResponse.setCode(PineappleEnum.SUCCESS.getCode());
getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return getRefundResponse;
getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/
return null;
}
@Override
......
......@@ -10,6 +10,7 @@ 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.model.Orders;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.request.PineappleSendRequest;
......@@ -32,53 +33,42 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception {
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());
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
params.put("sellerId",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("获取订单数据业务异常");
Orders orders = pineappleDao.getOrdersByMap(params);
if(StringUtil.isNull(orders)){
log.error("获取订单数据业务异常:"+callRequest.getBizModel().getPlatOrderNo());
throw new BizException("获取订单数据业务异常:"+callRequest.getBizModel().getPlatOrderNo());
}
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(orders.getOrderState().intValue() == PayOrderStatus.HasReceived.getCode() || orders.getOrderState().intValue() == PayOrderStatus.HasDelive.getCode()
|| orders.getOrderState().intValue() == PayOrderStatus.WaitShip.getCode()){
if(orders.getOrderState().intValue() == PayOrderStatus.WaitShip.getCode()){
params.put("orderState",PayOrderStatus.HasReceived.getCode());
params.put("deliverTime",new Date());
}
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
params.put("expressCode",callRequest.getBizModel().getLogisticNo());
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
int num = pineappleDao.getOrderByMap(params);
if(num > 0){
params.put("expressCode","");
}else{
int num = pineappleDao.checkLogisticsNumber(params);
if(num == 0){
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
if(StringUtil.isNull(iMDoingOrderBean.getExpressCode())){
params.put("expressCode",callRequest.getBizModel().getLogisticNo());
if(StringUtil.isNull(orders.getLogisticsNumber())){
params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
}else{
params.put("expressCode",iMDoingOrderBean.getExpressCode()+";"+callRequest.getBizModel().getLogisticNo());
params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
}
}
}
if(StringUtil.isNull(callRequest.getBizModel().getSenderName())){
params.put("buyerUsername","");
//收货人名字
if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){
params.put("name",callRequest.getBizModel().getSenderName());
}
//电话
if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
params.put("buyerPhone",callRequest.getBizModel().getSenderTel());
params.put("mobile",callRequest.getBizModel().getSenderTel());
}
if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){
//地址 良品不需要更改地址
/* if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){
String [] str = callRequest.getBizModel().getSenderAddress().split(" ");
if(!StringUtil.isNull(str) && str.length >3){
params.put("province",str[0]);
......@@ -88,20 +78,24 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
for(int i = 3;i<str.length;i++){
address.append(str[i]);
}
params.put("address",str[0]+"-"+str[1]+"-"+str[2]+"-"+address);
params.put("addressAll",str[0]+"-"+str[1]+"-"+str[2]);
params.put("addressInfo",str[0]+"-"+str[1]+"-"+str[2]+"-"+address);
}else{
log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
}
}
}*/
//物流公司名字
if(StringUtil.isNull(orders.getLogisticsName())){
params.put("expressName",callRequest.getBizModel().getLogisticName());
}
}else{
log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
pineappleDao.updateBusinessSend(params);
//修改订单信息
pineappleDao.updateOrdersState(params);
baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
baseResponse.setCode(PineappleEnum.SUCCESS.getCode());
return baseResponse;
......
......@@ -4,9 +4,7 @@ import com.sibu.orderHelper.common.util.StringUtil;
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.IMProductBean;
import com.sibu.orderHelper.integral.model.IMProductInventory;
import com.sibu.orderHelper.integral.model.SkuBean;
import com.sibu.orderHelper.integral.model.*;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.PineappleSyncStockResponse;
......@@ -33,94 +31,43 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
@Override
public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception {
PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
if(callRequest.getBizModel().getQuantity() < 0){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:%s",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:%s",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
Map<String,Object> params = new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
params.put("productId",callRequest.getBizModel().getPlatProductID());
//先判断SKU在判断产品
IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params);
if(StringUtil.isNull(iMProductBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
params.put("skuId",callRequest.getBizModel().getSkuID());
params.put("stock",callRequest.getBizModel().getQuantity());
List<DownloadProductBean> downloadProductBeans = pineappleDao.downloadProductListByMap(params);
if(StringUtil.isNull(downloadProductBeans)){
log.error(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
if(callRequest.getBizModel().getQuantity() < 0){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
if(pineappleDao.updateSkuStock(params) != 1){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) && !"0".equals(callRequest.getBizModel().getSkuID())) {
params.put("skuId",callRequest.getBizModel().getSkuID());
//查询该条SKUi
SkuBean skuBean = pineappleDao.getSkuBeanByMap(params);
List<DownloadProductSkuBean> skuBean = pineappleDao.downloadSkuByProductId(callRequest.getBizModel().getPlatProductID());
if(StringUtil.isNull(skuBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
}
//更新该条SKU
skuBean.setStockNum(callRequest.getBizModel().getQuantity());
if(pineappleDao.updateSku(skuBean) > 0){
//根据产品ID获取所有SKU总数
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(StringUtil.isNull(skuBeanList)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey())));
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
//更新SKU缓存
RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID());
Integer sumStock = skuBeanList.stream().map(s -> s.getStockNum()).reduce(0,(a,b) ->{
//获取sku总库存
Integer sumStock = skuBean.stream().map(s -> s.getSkuQuantity()).reduce(0,(a,b) ->{
return a+b;
});
//更新产品
params.put("stockNum",sumStock);
if(pineappleDao.updateProduct(params) > 0){
//更新产品缓存
RedisProductStockService.setProductStock(iMProductBean.getImProductId(), sumStock);
//1、更新商品库存
IMProductInventory productInventory = new IMProductInventory();
productInventory.setImProductId(iMProductBean.getImProductId());
productInventory.setStockNum(sumStock);
if(pineappleDao.updateProductInventory(productInventory) > 0){
//更新缓存
pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}
}else {
log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey())));
}
}else{
log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey())));
}
params.put("productStock",sumStock);
if(pineappleDao.updateProductStock(params) != 1){
log.error(String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())));
}
if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
}
params.put("stockNum",callRequest.getBizModel().getQuantity());
if(pineappleDao.updateProduct(params) > 0){
//更新产品
RedisProductStockService.setProductStock(iMProductBean.getImProductId(), callRequest.getBizModel().getQuantity());
//1、更新商品库存
IMProductInventory productInventory = new IMProductInventory();
productInventory.setImProductId(iMProductBean.getImProductId());
productInventory.setStockNum(callRequest.getBizModel().getQuantity());
if(pineappleDao.updateProductInventory(productInventory) > 0){
//更新缓存
pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}else{
log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城更新sku库存失败", callRequest.getRequest().getAppkey())));
}
}
}
log.error(String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey())));
}
@Override
......
......@@ -9,6 +9,7 @@ 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.model.Orders;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse;
import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest;
......@@ -30,22 +31,18 @@ public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateS
public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception {
UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo());
params.put("doingOrderTable","im_doing_order_" + tableIndex);
params.put("orderCode",callRequest.getBizModel().getPlatOrderNo());
params.put("sellerRemark",callRequest.getBizModel().getSellerMemo());
params.put("supplierId",callRequest.getSupplier().getId());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params);
if(StringUtil.isNull(iMDoingOrderBean)){
params.put("orderSn ",callRequest.getBizModel().getPlatOrderNo());
params.put("remark ",callRequest.getBizModel().getSellerMemo());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = pineappleDao.getOrdersByMap(params);
if(StringUtil.isNull(orders)){
log.error("获取订单数据业务异常");
throw new BizException("获取订单数据业务异常");
}
if(pineappleDao.updateOdersRemark(params) != 1){
log.error("获取订单数据业务异常");
throw new BizException("获取订单数据业务异常");
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
pineappleDao.updateSelle(params);
UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return UpdateSellerMemoResponse;
......