Authored by tanling

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10

Showing 25 changed files with 974 additions and 165 deletions
package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AppraiseOrderGoodsMapper {
... ... @@ -8,9 +11,11 @@ public interface AppraiseOrderGoodsMapper {
int insertSelective(AppraiseOrderGoods record);
AppraiseOrderGoods selectByPrimaryKey(Integer id);
AppraiseOrderGoods selectByOrderCode(Long orderCode);
int updateByPrimaryKeySelective(AppraiseOrderGoods record);
int updateByPrimaryKey(AppraiseOrderGoods record);
List<AppraiseOrderGoods> selectByOrderCodes(@Param("orderCodes") List<Long> orderCodes);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.AppraiseOrder;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface AppraiseOrderMapper {
... ... @@ -8,9 +12,22 @@ public interface AppraiseOrderMapper {
int insertSelective(AppraiseOrder record);
AppraiseOrder selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AppraiseOrder record);
int updateByPrimaryKey(AppraiseOrder record);
List<AppraiseOrder> selectSubOrderList(long parentOrderCode);
AppraiseOrder selectByOrderCode(long orderCode);
int selectCntByOrderType(@Param("uid") int uid,
@Param("attributes") int attributes,
@Param("statusList")Collection<Integer> statusList);
List<AppraiseOrder> selectOrderListByOrderType(@Param("uid") int uid,
@Param("attributes") int attributes,
@Param("statusList")Collection<Integer> statusList,
@Param("offset")int offset,
@Param("limit")int limit);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import java.util.List;
public interface AppraiseOrderMetaMapper {
int insertBatch(List<AppraiseOrderMeta> list);
int insert(AppraiseOrderMeta record);
int insertSelective(AppraiseOrderMeta record);
AppraiseOrderMeta selectByPrimaryKey(Integer id);
AppraiseOrderMeta selectByOrderCode(AppraiseOrderMeta condition);
AppraiseOrderMeta selectByOrderCodeStorageId(AppraiseOrderMeta condition);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.AppraiseOrderStorage;
public interface AppraiseOrderStorageMapper {
int deleteByPrimaryKey(Integer id);
int insert(AppraiseOrderStorage record);
int insertSelective(AppraiseOrderStorage record);
AppraiseOrderStorage selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AppraiseOrderStorage record);
int updateByPrimaryKey(AppraiseOrderStorage record);
}
\ No newline at end of file
... ...
... ... @@ -10,11 +10,13 @@ public class AppraiseOrder {
private Integer uid;
private Long parentOrderCode;
private Long orderCode;
private Byte clientType;
private Integer clientType;
private Byte payment;
private Integer payment;
private BigDecimal amount;
... ... @@ -26,7 +28,11 @@ public class AppraiseOrder {
private Integer updateTime;
private Byte isDel;
private Integer isDel;
private String channelNo;
private Integer attributes;
private Byte platformDeliveryStatus;
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor@NoArgsConstructor
public class AppraiseOrderGoods {
private Integer id;
... ... @@ -13,51 +21,8 @@ public class AppraiseOrderGoods {
private String imageUrl;
public Integer getId() {
return id;
}
private Integer depotNo;
public void setId(Integer id) {
this.id = id;
}
private Integer num;
public Long getOrderCode() {
return orderCode;
}
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName == null ? null : productName.trim();
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode == null ? null : productCode.trim();
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl == null ? null : imageUrl.trim();
}
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order.model;
public class AppraiseOrderMeta {
private Integer id;
private Integer uid;
private Long orderCode;
private Integer storageId;
private String metaKey;
private String metaValue;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Long getOrderCode() {
return orderCode;
}
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public String getMetaKey() {
return metaKey;
}
public void setMetaKey(String metaKey) {
this.metaKey = metaKey == null ? null : metaKey.trim();
}
public String getMetaValue() {
return metaValue;
}
public void setMetaValue(String metaValue) {
this.metaValue = metaValue == null ? null : metaValue.trim();
}
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order.model;
public class AppraiseOrderStorage {
private Integer id;
private Long orderCode;
private Integer productId;
private Integer sizeId;
private String sizeName;
private Integer colorId;
private String colorName;
private Integer storageId;
private Integer num;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getOrderCode() {
return orderCode;
}
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getSizeId() {
return sizeId;
}
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public String getSizeName() {
return sizeName;
}
public void setSizeName(String sizeName) {
this.sizeName = sizeName == null ? null : sizeName.trim();
}
public Integer getColorId() {
return colorId;
}
public void setColorId(Integer colorId) {
this.colorId = colorId;
}
public String getColorName() {
return colorName;
}
public void setColorName(String colorName) {
this.colorName = colorName == null ? null : colorName.trim();
}
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
}
\ No newline at end of file
... ...
... ... @@ -8,22 +8,26 @@
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_code" jdbcType="VARCHAR" property="productCode" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="depot_no" jdbcType="INTEGER" property="depotNo" />
<result column="num" jdbcType="INTEGER" property="num" />
</resultMap>
<sql id="Base_Column_List">
id, order_code, product_id, product_name, product_code, image_url
id, order_code, product_id, product_name, product_code, image_url, depot_no, num
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order_goods
where id = #{id,jdbcType=INTEGER}
where order_code = #{orderCode,jdbcType=BIGINT}
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true">
insert into appraise_order_goods (order_code, product_id, product_name,
product_code, image_url)
product_code, image_url, depot_no,
num)
values (#{orderCode,jdbcType=BIGINT}, #{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR},
#{productCode,jdbcType=VARCHAR}, #{imageUrl,jdbcType=VARCHAR})
#{productCode,jdbcType=VARCHAR}, #{imageUrl,jdbcType=VARCHAR}, #{depotNo,jdbcType=INTEGER},
#{num,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true">
... ... @@ -44,6 +48,12 @@
<if test="imageUrl != null">
image_url,
</if>
<if test="depotNo != null">
depot_no,
</if>
<if test="num != null">
num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderCode != null">
... ... @@ -61,6 +71,12 @@
<if test="imageUrl != null">
#{imageUrl,jdbcType=VARCHAR},
</if>
<if test="depotNo != null">
#{depotNo,jdbcType=INTEGER},
</if>
<if test="num != null">
#{num,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods">
... ... @@ -81,6 +97,12 @@
<if test="imageUrl != null">
image_url = #{imageUrl,jdbcType=VARCHAR},
</if>
<if test="depotNo != null">
depot_no = #{depotNo,jdbcType=INTEGER},
</if>
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
... ... @@ -90,7 +112,18 @@
product_id = #{productId,jdbcType=INTEGER},
product_name = #{productName,jdbcType=VARCHAR},
product_code = #{productCode,jdbcType=VARCHAR},
image_url = #{imageUrl,jdbcType=VARCHAR}
image_url = #{imageUrl,jdbcType=VARCHAR},
depot_no = #{depotNo,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByOrderCodes" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from appraise_order_goods
where order_code in
<foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=",">
#{orderCode,jdbcType=BIGINT}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrder">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="parent_order_code" jdbcType="BIGINT" property="parentOrderCode" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="client_type" jdbcType="TINYINT" property="clientType" />
<result column="payment" jdbcType="TINYINT" property="payment" />
... ... @@ -14,35 +15,72 @@
<result column="update_time" jdbcType="INTEGER" property="updateTime" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
<result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, client_type, payment, amount, ship_fee, status, create_time,
update_time, is_del, channel_no
id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
create_time, update_time, is_del, channel_no, attributes, platform_delivery_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<select id="selectSubOrderList" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where id = #{id,jdbcType=INTEGER}
where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
</select>
<select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order
where order_code = #{orderCode,jdbcType=INTEGER}
</select>
<select id="selectCntByOrderType" resultType="java.lang.Integer">
select count(*) from appraise_order
where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
</select>
<select id="selectOrderListByOrderType" resultType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from appraise_order
where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status,jdbcType=TINYINT}
</foreach>
limit #{offset},#{limit}
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
insert into appraise_order (uid, order_code, client_type,
payment, amount, ship_fee,
status, create_time, update_time,
is_del, channel_no)
values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{clientType,jdbcType=TINYINT},
#{payment,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL},
#{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
#{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR})
insert into appraise_order (uid, parent_order_code, order_code,
client_type, payment, amount,
ship_fee, status, create_time,
update_time, is_del, channel_no,
attributes, platform_delivery_status)
values (#{uid,jdbcType=INTEGER}, #{parentOrderCode,jdbcType=BIGINT}, #{orderCode,jdbcType=BIGINT},
#{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL},
#{shipFee,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}, #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR},
#{attributes,jdbcType=INTEGER}, #{platformDeliveryStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
insert into appraise_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="parentOrderCode != null">
parent_order_code,
</if>
<if test="orderCode != null">
order_code,
</if>
... ... @@ -73,11 +111,20 @@
<if test="channelNo != null">
channel_no,
</if>
<if test="attributes != null">
attributes,
</if>
<if test="platformDeliveryStatus != null">
platform_delivery_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="parentOrderCode != null">
#{parentOrderCode,jdbcType=BIGINT},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=BIGINT},
</if>
... ... @@ -108,60 +155,34 @@
<if test="channelNo != null">
#{channelNo,jdbcType=VARCHAR},
</if>
<if test="attributes != null">
#{attributes,jdbcType=INTEGER},
</if>
<if test="platformDeliveryStatus != null">
#{platformDeliveryStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrder">
update appraise_order
<set>
<if test="uid != null">
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="orderCode != null">
order_code = #{orderCode,jdbcType=BIGINT},
</if>
<if test="clientType != null">
client_type = #{clientType,jdbcType=TINYINT},
</if>
<if test="payment != null">
payment = #{payment,jdbcType=TINYINT},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="shipFee != null">
ship_fee = #{shipFee,jdbcType=DECIMAL},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=TINYINT},
</if>
<if test="channelNo != null">
channel_no = #{channelNo,jdbcType=VARCHAR},
<if test="platformDeliveryStatus != null">
platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrder">
update appraise_order
set uid = #{uid,jdbcType=INTEGER},
order_code = #{orderCode,jdbcType=BIGINT},
client_type = #{clientType,jdbcType=TINYINT},
payment = #{payment,jdbcType=TINYINT},
amount = #{amount,jdbcType=DECIMAL},
ship_fee = #{shipFee,jdbcType=DECIMAL},
status = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER},
is_del = #{isDel,jdbcType=TINYINT},
channel_no = #{channelNo,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yohoufo.dal.order.AppraiseOrderMetaMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrderMeta">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="storage_id" jdbcType="INTEGER" property="storageId" />
<result column="meta_key" jdbcType="VARCHAR" property="metaKey" />
<result column="meta_value" jdbcType="VARCHAR" property="metaValue" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, storage_id, meta_key, meta_value
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order_meta
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true">
insert into appraise_order_meta (uid, order_code, storage_id,
meta_key, meta_value)
values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{storageId,jdbcType=INTEGER},
#{metaKey,jdbcType=VARCHAR}, #{metaValue,jdbcType=VARCHAR})
</insert>
<insert id="insertBatch" parameterType="java.util.List">
insert into appraise_order_meta (uid, order_code, storage_id, meta_key, meta_value)
values
<foreach collection="list" item="record" separator=",">
(#{record.uid,jdbcType=INTEGER}, #{record.orderCode,jdbcType=BIGINT}, #{record.storageId,jdbcType=INTEGER},
#{record.metaKey,jdbcType=VARCHAR}, #{record.metaValue,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true">
insert into appraise_order_meta
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="orderCode != null">
order_code,
</if>
<if test="storageId != null">
storage_id,
</if>
<if test="metaKey != null">
meta_key,
</if>
<if test="metaValue != null">
meta_value,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=BIGINT},
</if>
<if test="storageId != null">
#{storageId,jdbcType=INTEGER},
</if>
<if test="metaKey != null">
#{metaKey,jdbcType=VARCHAR},
</if>
<if test="metaValue != null">
#{metaValue,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selectByOrderCode" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order_meta
where order_code = #{orderCode,jdbcType=INTEGER}
and meta_key = #{metaKey,jdbcType=VARCHAR}
</select>
<select id="selectByOrderCodeStorageId" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order_meta
where order_code = #{orderCode,jdbcType=INTEGER}
and storage_id = #{storageId,jdbcType=INTEGER}
and meta_key = #{metaKey,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yohoufo.dal.order.AppraiseOrderStorageMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrderStorage">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="size_id" jdbcType="INTEGER" property="sizeId" />
<result column="size_name" jdbcType="VARCHAR" property="sizeName" />
<result column="color_id" jdbcType="INTEGER" property="colorId" />
<result column="color_name" jdbcType="VARCHAR" property="colorName" />
<result column="storage_id" jdbcType="INTEGER" property="storageId" />
<result column="num" jdbcType="INTEGER" property="num" />
</resultMap>
<sql id="Base_Column_List">
id, order_code, product_id, size_id, size_name, color_id, color_name, storage_id,
num
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from appraise_order_storage
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage" useGeneratedKeys="true">
insert into appraise_order_storage (order_code, product_id, size_id,
size_name, color_id, color_name,
storage_id, num)
values (#{orderCode,jdbcType=BIGINT}, #{productId,jdbcType=INTEGER}, #{sizeId,jdbcType=INTEGER},
#{sizeName,jdbcType=VARCHAR}, #{colorId,jdbcType=INTEGER}, #{colorName,jdbcType=VARCHAR},
#{storageId,jdbcType=INTEGER}, #{num,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage" useGeneratedKeys="true">
insert into appraise_order_storage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null">
order_code,
</if>
<if test="productId != null">
product_id,
</if>
<if test="sizeId != null">
size_id,
</if>
<if test="sizeName != null">
size_name,
</if>
<if test="colorId != null">
color_id,
</if>
<if test="colorName != null">
color_name,
</if>
<if test="storageId != null">
storage_id,
</if>
<if test="num != null">
num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderCode != null">
#{orderCode,jdbcType=BIGINT},
</if>
<if test="productId != null">
#{productId,jdbcType=INTEGER},
</if>
<if test="sizeId != null">
#{sizeId,jdbcType=INTEGER},
</if>
<if test="sizeName != null">
#{sizeName,jdbcType=VARCHAR},
</if>
<if test="colorId != null">
#{colorId,jdbcType=INTEGER},
</if>
<if test="colorName != null">
#{colorName,jdbcType=VARCHAR},
</if>
<if test="storageId != null">
#{storageId,jdbcType=INTEGER},
</if>
<if test="num != null">
#{num,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage">
update appraise_order_storage
<set>
<if test="orderCode != null">
order_code = #{orderCode,jdbcType=BIGINT},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=INTEGER},
</if>
<if test="sizeId != null">
size_id = #{sizeId,jdbcType=INTEGER},
</if>
<if test="sizeName != null">
size_name = #{sizeName,jdbcType=VARCHAR},
</if>
<if test="colorId != null">
color_id = #{colorId,jdbcType=INTEGER},
</if>
<if test="colorName != null">
color_name = #{colorName,jdbcType=VARCHAR},
</if>
<if test="storageId != null">
storage_id = #{storageId,jdbcType=INTEGER},
</if>
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage">
update appraise_order_storage
set order_code = #{orderCode,jdbcType=BIGINT},
product_id = #{productId,jdbcType=INTEGER},
size_id = #{sizeId,jdbcType=INTEGER},
size_name = #{sizeName,jdbcType=VARCHAR},
color_id = #{colorId,jdbcType=INTEGER},
color_name = #{colorName,jdbcType=VARCHAR},
storage_id = #{storageId,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -381,7 +381,7 @@
<update id="updateDepositEndTime">
update storage_deposit
set deposit_end_time = unix_timestamp(now()) + #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
set deposit_end_time = #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER}
</update>
... ...
... ... @@ -4,10 +4,7 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp;
import com.yohobuy.ufo.model.order.resp.*;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.service.impl.AppraiseOrderService;
import org.slf4j.Logger;
... ... @@ -31,14 +28,14 @@ public class AppraiseOrderController {
* @param productId
* @return
*/
@RequestMapping(params = "method=ufo.appriseOrder.compute")
@RequestMapping(params = "method=ufo.appraiseOrder.compute")
public ApiResponse compute(@RequestParam(name = "uid")int uid,
@RequestParam(name = "productId")int productId){
AppraiseOrderComputeReq req = AppraiseOrderComputeReq.builder()
.uid(uid)
.productId(productId)
.build();
logger.info("in ufo.appriseOrder.compute req {}", req);
logger.info("in ufo.appraiseOrder.compute req {}", req);
AppraiseOrderComputeResp resp = appraiseOrderService.compute(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
... ... @@ -48,13 +45,16 @@ public class AppraiseOrderController {
}
@RequestMapping(params = "method=ufo.appriseOrder.submit")
@RequestMapping(params = "method=ufo.appraiseOrder.submit")
public ApiResponse submit(@RequestParam(name = "uid")int uid,
@RequestParam(name = "productId")int productId,
@RequestParam(name = "addressId") String addressId){
@RequestParam(name = "addressId") String addressId,
@RequestParam(name = "channelNo", required = false) String channelNo,
@RequestParam(name = "client_type", required = false) String clientType){
AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder()
.uid(uid).productId(productId).addressId(addressId).build();
logger.info("in ufo.appriseOrder.submit req {}", req);
.uid(uid).productId(productId).addressId(addressId)
.channelNo(channelNo).clientType(clientType).build();
logger.info("in ufo.appraiseOrder.submit req {}", req);
AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
... ... @@ -69,7 +69,7 @@ public class AppraiseOrderController {
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.appriseOrder.list")
@RequestMapping(params = "method=ufo.appraiseOrder.list")
public ApiResponse list(@RequestParam(name = "uid")int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit){
... ... @@ -77,8 +77,8 @@ public class AppraiseOrderController {
AppraiseOrderListReq req = AppraiseOrderListReq.builder()
.uid(uid).limit(limit).page(page).build();
logger.info("in ufo.appriseOrder.list req {}", req);
AppraiseOrderListResp resp = appraiseOrderService.getOrderList(req);
logger.info("in ufo.appraiseOrder.list req {}", req);
PageResp<AppraiseOrderListResp> resp = appraiseOrderService.getOrderList(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(resp)
... ... @@ -87,11 +87,11 @@ public class AppraiseOrderController {
}
@RequestMapping(params = "method=ufo.appriseOrder.detail")
@RequestMapping(params = "method=ufo.appraiseOrder.detail")
public ApiResponse detail(@RequestParam(name = "uid")int uid,
@RequestParam(name = "orderCode")long orderCode){
AppraiseOrderDetailReq req = AppraiseOrderDetailReq.builder().uid(uid).orderCode(orderCode).build();
logger.info("in ufo.appriseOrder.detail req {}", req);
logger.info("in ufo.appraiseOrder.detail req {}", req);
AppraiseOrderDetailResp resp = appraiseOrderService.getOrderDetail(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
... ...
package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderComputeReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderDetailReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderSubmitReq;
import com.yohobuy.ufo.model.order.resp.*;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SellerDepositOrderController {
private Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
@RequestMapping(params = "method=ufo.depositOrder.compute")
public ApiResponse compute(@RequestParam(name = "uid")int uid,
@RequestParam(name = "goodsList")String goodsList){
SellerDepositOrderComputeReq req = SellerDepositOrderComputeReq.builder()
.uid(uid).goodsList(goodsList).build();
logger.info("in ufo.depositOrder.compute req {}", req);
SellerDepositOrderComputeResp resp = sellerDepositOrderService.compute(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(resp)
.message("寄存计算成功")
.build();
}
@RequestMapping(params = "method=ufo.depositOrder.submit")
public ApiResponse submit(@RequestParam(name = "uid")int uid,
@RequestParam(name = "goodsList")String goodsList){
SellerDepositOrderSubmitReq req = SellerDepositOrderSubmitReq.builder()
.uid(uid).goodsList(goodsList).build();
logger.info("in ufo.depositOrder.submit req {}", req);
SellerDepositOrderSubmitResp resp = sellerDepositOrderService.submit(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(resp)
.message("寄存订单提交成功")
.build();
}
/**
* 商品付费寄存列表
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.depositOrder.list")
public ApiResponse list(@RequestParam(name = "uid")int uid,
@RequestParam(name = "listType")int listType,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit){
SellerDepositOrderListReq req = SellerDepositOrderListReq.builder()
.uid(uid).listType(listType).limit(limit).page(page).build();
logger.info("in ufo.depositOrder.list req {}", req);
PageResp<SellerDepositOrderListResp> resp = sellerDepositOrderService.getOrderList(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(resp)
.message("寄存订单列表查询成功")
.build();
}
@RequestMapping(params = "method=ufo.depositOrder.detail")
public ApiResponse detail(@RequestParam(name = "uid")int uid,
@RequestParam(name = "orderCode")long orderCode){
SellerDepositOrderDetailReq req = SellerDepositOrderDetailReq.builder()
.uid(uid).orderCode(orderCode).build();
logger.info("in ufo.depositOrder.detail req {}", req);
SellerDepositOrderDetailResp resp = sellerDepositOrderService.getOrderDetail(req);
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(resp)
.message("寄存订单详情查询成功")
.build();
}
/**
* 发货
* @param uid
* @param orderCode
* @param depotNum
* @param addressId
* @return
*/
@RequestMapping(params = "method=ufo.depositOrder.deliverToDepot")
public ApiResponse deliverToDepot(@RequestParam(name = "uid")int uid,
@RequestParam(name = "orderCode")long orderCode,
@RequestParam(name = "depotNum")int depotNum,
@RequestParam(name = "addressId") String addressId){
return new ApiResponse.ApiResponseBuilder()
.code(200)
.data(null)
.message("寄存订单发货录入成功")
.build();
}
}
... ...
package com.yohoufo.order.convert;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;
public final class AppraiseOrderConverter {
public static AppraiseOrderListResp do2Resp(){
return null;
}
}
... ...
package com.yohoufo.order.convert;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
public final class AppraiseOrderGoodsConvertor {
public static AppraiseOrderGoodsBo do2Bo(AppraiseOrderGoods paog){
return AppraiseOrderGoodsBo.builder()
.productId(paog.getProductId())
.productName(paog.getProductName())
.productCode(paog.getProductCode())
.imageUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU="))
.build();
}
}
... ...
... ... @@ -21,6 +21,9 @@ public class AppraiseOrderContext {
private int productId;
private Integer clientType;
private String channelNo;
/**
* 鉴定费
*/
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.BuyerOrderMetaMapper;
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
import com.yohoufo.dal.order.model.BuyerOrderMeta;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import com.yohoufo.order.common.DelStatus;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.model.dto.AppraiseOrderContext;
import com.yohoufo.order.utils.LoggerUtils;
... ... @@ -18,6 +21,8 @@ import lombok.Data;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
... ... @@ -35,7 +40,7 @@ public class AppraiseOrderCreateService {
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
@Autowired
private BuyerOrderMetaMapper buyerOrderMetaMapper;
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
@Builder
@Data
... ... @@ -45,6 +50,8 @@ public class AppraiseOrderCreateService {
AppraiseOrderGoods appraiseOrderGoods;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Database(ForceMaster=true, DataSource="ufo_order")
public SubmitResult create(AppraiseOrderContext ctx){
logger.info("in AppraiseOrderCreateService create, ");
int uid = ctx.getUid();
... ... @@ -53,10 +60,18 @@ public class AppraiseOrderCreateService {
uid, orderCode, ctx.getProductId());
//
AppraiseOrder pao = new AppraiseOrder();
pao.setUid(ctx.getUid());
pao.setOrderCode(orderCode);
pao.setAmount(ctx.getFee());
//TODO
int cdt = DateUtil.getCurrentTimeSecond();
pao.setCreateTime(cdt);
pao.setUpdateTime(cdt);
//
pao.setStatus(AppraiseOrderStatus.WAITING_PAY.getCode());
pao.setIsDel(DelStatus.NOT_DEL.getCode());
pao.setChannelNo(ctx.getChannelNo());
pao.setClientType(ctx.getClientType());
appraiseOrderMapper.insertSelective(pao);
//
AppraiseOrderGoodsBo aogb = ctx.getGoodsBo();
... ... @@ -65,28 +80,29 @@ public class AppraiseOrderCreateService {
paog.setProductId(aogb.getProductId());
paog.setProductName(aogb.getProductName());
paog.setProductCode(aogb.getProductCode());
paog.setNum(1);
appraiseOrderGoodsMapper.insertSelective(paog);
//meta
AddressInfo noHiddenBackAddress = ctx.getBackAddress(),
hiddenBackAddress = ctx.getBackHiddenAddress();
final String key = MetaKey.BUYER_DELIVERY_ADDRESS,
hiiden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;
BuyerOrderMeta noHiddenAddressMeta=new BuyerOrderMeta();
hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;
AppraiseOrderMeta noHiddenAddressMeta = new AppraiseOrderMeta();
noHiddenAddressMeta.setUid(uid);
noHiddenAddressMeta.setOrderCode(orderCode);
noHiddenAddressMeta.setMetaKey(key);
noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress));
//hidden address
BuyerOrderMeta hiddenAddressMeta=new BuyerOrderMeta();
AppraiseOrderMeta hiddenAddressMeta = new AppraiseOrderMeta();
hiddenAddressMeta.setUid(uid);
hiddenAddressMeta.setOrderCode(orderCode);
hiddenAddressMeta.setMetaKey(hiiden_key);
hiddenAddressMeta.setMetaKey(hidden_key);
hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress));
List<BuyerOrderMeta> boms = new ArrayList<>(2);
List<AppraiseOrderMeta> boms = new ArrayList<>(2);
boms.add(noHiddenAddressMeta);
boms.add(hiddenAddressMeta);
buyerOrderMetaMapper.insertBatch(boms);
appraiseOrderMetaMapper.insertBatch(boms);
return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build();
}
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq;
import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;
import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp;
import com.yohobuy.ufo.model.order.resp.*;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.AddressUtil;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import com.yohoufo.dal.order.model.QiniuLiveRecord;
import com.yohoufo.order.common.ClientType;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor;
import com.yohoufo.order.model.dto.AppraiseOrderContext;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
... ... @@ -31,7 +39,10 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class AppraiseOrderService {
... ... @@ -51,7 +62,13 @@ public class AppraiseOrderService {
@Autowired
OrderCodeGenerator orderCodeGenerator;
private OrderCodeGenerator orderCodeGenerator;
@Autowired
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
@Autowired
private QiniuLiveRecordService qiniuLiveRecordService;
public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
... ... @@ -64,24 +81,7 @@ public class AppraiseOrderService {
if (productId <= 0){
throw new UfoServiceException(400, "商品ID错误");
}
int orderType = req.getOrderType();
OrderAttributes orderAttributes = checkOrderType(orderType);
double fee = 0D;
switch (orderAttributes){
case DEPOSITE:{
fee = 15D;
break;
}
case APPRAISE:{
fee = 31D;
break;
}
default:{
throw new UfoServiceException(400, "orderType错误");
}
}
double fee = 15D;
return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build();
}
... ... @@ -91,6 +91,7 @@ public class AppraiseOrderService {
add(OrderAttributes.APPRAISE);
}
};
private OrderAttributes checkOrderType(int orderType){
OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType);
if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){
... ... @@ -110,8 +111,6 @@ public class AppraiseOrderService {
AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo();
//TODO dependency product service support produce data
AppraiseOrderContext aoc = AppraiseOrderContext.builder()
.orderCode(orderCode)
.uid(pn.getUid())
... ... @@ -119,6 +118,8 @@ public class AppraiseOrderService {
.backAddress(pn.getNoHiddenBackAddress())
.backHiddenAddress(pn.getHiddenBackAddress())
.goodsBo(aog)
.channelNo(req.getChannelNo())
.clientType(ClientType.getClientType(req.getClientType()))
.build();
//2 persistent key info
... ... @@ -128,6 +129,8 @@ public class AppraiseOrderService {
AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc);
//todo notice by async
//resp
AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp();
aosr.setOrderCode(orderCode);
return aosr;
... ... @@ -143,6 +146,10 @@ public class AppraiseOrderService {
OrderAttributes orderAttributes;
}
OrderAttributes getOrderAttributes(){
return OrderAttributes.APPRAISE;
}
private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){
int uid = req.getUid();
if (uid<=0){
... ... @@ -152,7 +159,7 @@ public class AppraiseOrderService {
if (productId <= 0){
throw new UfoServiceException(400, "商品ID错误");
}
OrderAttributes orderAttributes = OrderAttributes.APPRAISE;
final OrderAttributes orderAttributes = getOrderAttributes();
int addressId = AddressUtil.getDecryptStr(req.getAddressId());
if (addressId < 0){
... ... @@ -179,23 +186,151 @@ public class AppraiseOrderService {
.build();
}
List<Integer> getLegalStatus(){
return new ArrayList<Integer>(){
{
add(AppraiseOrderStatus.HAS_PAYED.getCode());
add(AppraiseOrderStatus.SELLER_SEND_OUT.getCode());
add(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode());
add(AppraiseOrderStatus.JUDGE_PASS.getCode());
add(AppraiseOrderStatus.WAITING_RECEIVE.getCode());
add(AppraiseOrderStatus.CHECKING_FAKE.getCode());
add(AppraiseOrderStatus.SHAM_SEND_OUT.getCode());
add(AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode());
}
};
}
public PageResp<AppraiseOrderListResp> getOrderList(AppraiseOrderListReq req){
PageResp.PageRespBuilder respBuilder = PageResp.builder();
int uid = req.getUid();
OrderAttributes orderAttributes = getOrderAttributes();
final List<Integer> statusList = getLegalStatus();
int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList);
int limit = req.getLimit();
if (total == 0){
return respBuilder
.pageSize(limit)
.total(total)
.page(req.getPage())
.build();
}
public AppraiseOrderListResp getOrderList(AppraiseOrderListReq req){
int offset = (req.getPage() - 1) * limit;
List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, offset, limit);
return null;
List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes);
Map<Long,AppraiseOrderGoods> orderCodeAOGMap = paogs.stream().collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode, Function.identity()));
List<AppraiseOrderListResp> aolrList = orderList.parallelStream()
.map(pao-> buildAppraiseOrderListResp(pao, orderCodeAOGMap.get(pao.getOrderCode())))
.collect(Collectors.toList());
respBuilder.page(req.getPage())
.pageSize(limit)
.total(total)
.pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1))
.data(aolrList);
return respBuilder.build();
}
AppraiseOrderListResp buildAppraiseOrderListResp(AppraiseOrder pao, AppraiseOrderGoods paog){
Integer uid = pao.getUid();
Long orderCode = pao.getOrderCode();
Integer status = pao.getStatus();
AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status);
AppraiseOrderListResp resp = AppraiseOrderListResp.builder()
.uid(uid)
.orderCode(orderCode)
.goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog))
.buttons(Objects.nonNull(aos) ? aos.listButtons() : null)
.statuStr(Objects.nonNull(aos) ? aos.statusStr() : "")
.status(status)
.build();
return resp;
}
public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){
int uid = req.getUid();
long orderCode = req.getOrderCode();
return null;
AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
if (Objects.isNull(pao)){
logger.warn("in getOrderDetail of appraise order null ,req {}", req);
return null;
}
Integer aoac = pao.getAttributes();
OrderAttributes oa = OrderAttributes.getOrderAttributes(aoac);
if (Objects.isNull(oa) || !getOrderAttributes().equals(oa)){
logger.warn("in getOrderDetail of appraise order attr is null ,req {}", req);
return null;
}
AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
Integer status = pao.getStatus();
AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status);
//
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail
.builder().status(status)
.statuStr(aos.statusStr())
.detailDesc(aos.detailDesc()).build();
//
String hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;
AppraiseOrderMeta aomc = new AppraiseOrderMeta();
aomc.setOrderCode(orderCode);
aomc.setMetaKey(hidden_key);
AppraiseOrderMeta paom = appraiseOrderMetaMapper.selectByOrderCode(aomc);
AppraiseAddressInfo appraiseAddressInfo = null;
if (Objects.nonNull(paom)){
try {
appraiseAddressInfo = JSONObject.parseObject(paom.getMetaValue(), AppraiseAddressInfo.class);
}catch (Exception ex){
logger.warn("in get detail of appraise order ");
}
}
String appraiseVideoUrl = null;
QiniuLiveRecord qiniuLiveRecord = qiniuLiveRecordService.getByOrderCode(orderCode);
if (Objects.nonNull(qiniuLiveRecord)){
appraiseVideoUrl = qiniuLiveRecord.getVideoUrl();
}
AppraiseOrderDetailResp aodResp = AppraiseOrderDetailResp.builder()
.uid(uid).orderCode(orderCode)
.statusDetail(statusDetail)
.createTime(DateUtil.formatDate(pao.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS))
.goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog))
.appraiseAddress(appraiseAddressInfo)
.appraiseVideoUrl(appraiseVideoUrl)
.build();
return aodResp;
}
/**
* 是否付费鉴定订单
* @param uid
* @param orderCode
* @return
*/
public boolean isAppraiseOrder(int uid, long orderCode){
return false;
AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
Integer aoac = null;
OrderAttributes oa = null;
boolean flag = Objects.nonNull(pao)
&& Objects.nonNull(aoac=pao.getAttributes())
&& Objects.nonNull(oa = OrderAttributes.getOrderAttributes(aoac))
&& Objects.equals(oa, OrderAttributes.APPRAISE);
logger.info("in isAppraiseOrder uid {} orderCode {} aoac {} oa {} flag {}",
uid, orderCode, aoac, oa, flag);
return flag;
}
/**
... ... @@ -208,7 +343,7 @@ public class AppraiseOrderService {
}
/**
*
* 平台收货
* @param orderCode
*/
public void platformReceiveGoods(long orderCode){
... ... @@ -216,7 +351,7 @@ public class AppraiseOrderService {
}
/**
*
* 鉴定通过
* @param orderCode
*/
public void appraisePass(long orderCode){
... ...
... ... @@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService {
* @return
*/
public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) {
int result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60, DateUtil.getCurrentTimeSecond());
StorageDeposit deposit = storageDepositMapper.selectByPrimaryKey(depositId);
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
int result;
if (deposit.getDepositEndTime() <= currentTimeSecond) { // 如果当前库存记录已经过期,则按当前时间加续约时长
result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + currentTimeSecond, currentTimeSecond);
} else { // 如果当前库存记录未过期,则按库存结束时间加续约时长
result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + deposit.getDepositEndTime(), currentTimeSecond);
}
clearDepositCache(depositCode, uid);
return result;
}
... ...
... ... @@ -83,7 +83,7 @@ public class QiniuLiveRecordService {
qiniuLiveRecordMapper.insert(qiniuLiveRecords);
}
public QiniuLiveRecord selectByOrderCodes(Long orderCode) {
public QiniuLiveRecord getByOrderCode(Long orderCode) {
if (null == orderCode) {
return null;
}
... ...
package com.yohoufo.order.service.seller.deposit;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderComputeReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderDetailReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq;
import com.yohobuy.ufo.model.order.req.SellerDepositOrderSubmitReq;
import com.yohobuy.ufo.model.order.resp.*;
import org.springframework.stereotype.Service;
@Service
public class SellerDepositOrderService {
public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){
return null;
}
public SellerDepositOrderSubmitResp submit(SellerDepositOrderSubmitReq req){
return null;
}
public PageResp<SellerDepositOrderListResp> getOrderList(SellerDepositOrderListReq req ){
return null;
}
public SellerDepositOrderDetailResp getOrderDetail(SellerDepositOrderDetailReq req){
return null;
}
}
... ...
... ... @@ -115,6 +115,8 @@ datasources:
- com.yohoufo.dal.order.AlipayBlackUserMapper
- com.yohoufo.dal.order.AppraiseOrderMapper
- com.yohoufo.dal.order.AppraiseOrderGoodsMapper
- com.yohoufo.dal.order.AppraiseOrderMetaMapper
- com.yohoufo.dal.order.AppraiseOrderStorageMapper
ufo_promotion:
servers:
... ...
... ... @@ -114,6 +114,8 @@ datasources:
- com.yohoufo.dal.order.AlipayBlackUserMapper
- com.yohoufo.dal.order.AppraiseOrderMapper
- com.yohoufo.dal.order.AppraiseOrderGoodsMapper
- com.yohoufo.dal.order.AppraiseOrderMetaMapper
- com.yohoufo.dal.order.AppraiseOrderStorageMapper
ufo_promotion:
servers:
... ...