Authored by qianjun

refund exchange

# 商品设置退换货接口服务定义
---------------------
## 查询所有ProductSkn和模糊匹配查询ProductSkn
> 接口名:`/refundExchangeAttribute/queryRefundExchangeProductSkn`
### 入参
``` json
{
}
or
{
"idName":"500008"
}
```
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|----|----|----|
|idName|String|"500008"|产品SKN(productSkn)|可选|无|
---------------------
### 对应SQL的操作库表(数据库 erp_product,表product)
```xml
<select id="selectRefundExchangeProductSkn" resultType="java.lang.Integer">
select product_skn
from product
<where>
<if test="productSkn != null and productSkn != ''">
product_skn like concat('%',#{productSkn},'%')
</if>
</where>
limit 100
</select>
```
### 错误编码
-------------------------
|错误码code|消息|说明|
|----------|----|----|
|无|无|无|
### 返回
``` json
{
"code": 200,
"data": [
{
"id": 50000055,
"text": "50000055"
},
{
"id": 50000056,
"text": "50000056"
},
{
"id": 50000057,
"text": "50000057"
}
],
"message": "操作成功"
}
```
## 查询所有品牌和模糊匹配查询品牌(以前平台化接口)
> 接口名:`/erpproduct/brands/getBrandNames`
### 入参
``` json
{
}
or
{
"idName":"43"
}
```
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|----|----|----|
|idName|String| "43"|品牌id或者名称|可选|无|
---------------------
### 对应SQL的操作库表(数据库 erp_product,表 brand)
```xml
!-- selectBriefBrandList 根据条件查询BrandList -->
<select id="selectBriefBrandList" resultMap="BriefResultMap">
select
<include refid="Brief_Column_List" />
from brand where 1=1
<if test="status != 0">
and status=#{status}
</if>
<if test="idOrName != null and idOrName != ''">
and (id like CONCAT('%',#{idOrName},'%')
or brand_name like CONCAT('%',#{idOrName},'%'))
</if>
order by id desc limit #{limit}
</select>
```
### 错误编码
-------------------------
|错误码code|消息|说明|
|----------|----|----|
|无|无|无|
### 返回
``` json
{
"code": 200,
"data": [
{
"brandNameEn": "test",
"id": "1430",
"text": "AAAA2"
},
{
"brandNameEn": "C'TERBOX",
"id": "1343",
"text": "C'TERBOX"
},
{
"brandNameEn": "monopoly",
"id": "1243",
"text": "monopoly"
}
],
"message": "操作成功"
}
```
## 查询或筛选全部列表
> 接口名:`/refundExchangeAttribute/queryRefundExchangeList`
### 入参
``` json
{
"productSkn":50000855,
"brandId" :133,
"isRefundExchange" :133
}
```
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|----|-----|----|
|productSkn|int|500008|产品SKN|是|无|
|brandId|int|133|品牌ID|是|无|
|isRefundExchange|int|0|是否支持退换货(0、不支持退换货-特殊商品 1、支持退换货-普通商品)|是|无|
---------------------
### 1. 对应SQL的操作库表(数据库 erp_product,表 product, 字段is_refund_exchange=1 )
```xml
<select id="selectRefundExchangeList" parameterType="com.yohobuy.platform.model.common.PageBean" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product
<where>
<if test="params.productSkn != null and params.productSkn !=-1">
product_skn= #{params.productSkn,jdbcType=INTEGER}
</if>
<if test="params.brandId != null and params.brandId != -1 ">
and brand_id=#{params.brandId, jdbcType=SMALLINT}
</if>
</where>
<if test="params.isLimit != null and params.isLimit == true">
limit #{startIndex},#{pageSize}
</if>
</select>
```
### 2. 对应SQL的操作库表(数据库 erp_product,表 brand)
```xml
<select id="selectByBrandIds" resultMap="BaseResultMap">
select id, brand_name, brand_domain, brand_name_cn, brand_name_en, status, sale_type from brand
where id in
<foreach item="brandId" collection="brandIds" open="(" separator="," close=")">
#{brandId}
</foreach>
</select>
```
### 3. 对应SQL的操作库表(数据库 erp_product,表 product_sort)
```xml
<select id="selectBySmallSortIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_sort
where id in
<foreach collection="smallSortIds" item="item" index="index" separator="," open="(" close=")">
#{item, jdbcType=SMALLINT}
</foreach>
</select>
```
### 4. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
```xml
<select id="selectByProductSkns" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_ext_attribute
where product_skn in
<foreach collection="productSkns" item="productSkn" index="index" separator="," open="(" close=")">
#{productSkn,jdbcType=INTEGER}
</foreach>
</select>
```
# 批量导入货到付款
> 接口名: `/batch/import`
### 入参
``` json
{
"type":"refundExchangeModify",
"file":"具体文件流"
}
```
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|----|-----|----|
|type|String|refundExchangeModify|键类型(退换货)|是|无|
|file|file|下载url为"/common/refundExchange.xlsx"|文件|是|无|
---------------------
### 1. 对应SQL的操作库表(数据库 yh_shops, 表product, 字段is_pay_delivery=1 ,批量更新n条记录)
```xml
<update id="updatePayDeliveryList" parameterType="java.util.List">
update product
<trim prefix="set" suffixOverrides=",">
<trim prefix="is_pay_delivery = case" suffix="end,">
<foreach collection="list" item="item" index="index">
when erp_product_id=#{item.erpProductId,jdbcType=INTEGER} then #{item.isPayDelivery,jdbcType=TINYINT}
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="item" index="index" >
erp_product_id= #{item.erpProductId,jdbcType=INTEGER}
</foreach>
</update>
```
### 2. 对应SQL的操作库表(数据库 erp_product, 表product_pay_delivery_check,字段check_status=100 ,批量插入n条记录)
```xml
<insert id="insertPayDeliveryList" >
insert into product_pay_delivery_check(product_skn ,brand_name,brand_id, is_pay_delivery,
check_status, applicant, applicant_pid,create_time)
values <foreach collection="list" item="item" index="index" separator="," >
(#{item.productSkn,jdbcType=INTEGER}, #{item.brandName,jdbcType=VARCHAR}, #{item.brandId,jdbcType=SMALLINT},#{item.isPayDelivery,jdbcType=TINYINT},
#{item.checkStatus,jdbcType=SMALLINT},#{item.applicant,jdbcType=VARCHAR}, #{item.applicantPid,jdbcType=SMALLINT},
#{item.createTime,jdbcType=INTEGER})
</foreach>
</insert>
```
### 涉及字段 product_skn ,brand_name,brand_id, is_pay_delivery,check_status, applicant, applicant_pid,create_time
### 返回
``` json
{
"code": 200,
"data": {
"failFileReason": [
"第2行:退换货状态输入错误,请修改\r\n"
],
"repeatFileReason": [
"SKN_50001796,出现2次,已经重复,请修改\r\n"
],
"successList": [
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50000684,
"sortIsRefundExchange": -1
},
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50001796,
"sortIsRefundExchange": -1
},
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50001796,
"sortIsRefundExchange": -1
}
]
},
"message": "处理成功"
}
```
\ No newline at end of file
... ...