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
1 package com.yohoufo.dal.order; 1 package com.yohoufo.dal.order;
2 2
3 import com.yohoufo.dal.order.model.AppraiseOrderGoods; 3 import com.yohoufo.dal.order.model.AppraiseOrderGoods;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +import java.util.List;
4 7
5 public interface AppraiseOrderGoodsMapper { 8 public interface AppraiseOrderGoodsMapper {
6 9
@@ -8,9 +11,11 @@ public interface AppraiseOrderGoodsMapper { @@ -8,9 +11,11 @@ public interface AppraiseOrderGoodsMapper {
8 11
9 int insertSelective(AppraiseOrderGoods record); 12 int insertSelective(AppraiseOrderGoods record);
10 13
11 - AppraiseOrderGoods selectByPrimaryKey(Integer id); 14 + AppraiseOrderGoods selectByOrderCode(Long orderCode);
12 15
13 int updateByPrimaryKeySelective(AppraiseOrderGoods record); 16 int updateByPrimaryKeySelective(AppraiseOrderGoods record);
14 17
15 int updateByPrimaryKey(AppraiseOrderGoods record); 18 int updateByPrimaryKey(AppraiseOrderGoods record);
  19 +
  20 + List<AppraiseOrderGoods> selectByOrderCodes(@Param("orderCodes") List<Long> orderCodes);
16 } 21 }
1 package com.yohoufo.dal.order; 1 package com.yohoufo.dal.order;
2 2
3 import com.yohoufo.dal.order.model.AppraiseOrder; 3 import com.yohoufo.dal.order.model.AppraiseOrder;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +import java.util.Collection;
  7 +import java.util.List;
4 8
5 public interface AppraiseOrderMapper { 9 public interface AppraiseOrderMapper {
6 10
@@ -8,9 +12,22 @@ public interface AppraiseOrderMapper { @@ -8,9 +12,22 @@ public interface AppraiseOrderMapper {
8 12
9 int insertSelective(AppraiseOrder record); 13 int insertSelective(AppraiseOrder record);
10 14
11 - AppraiseOrder selectByPrimaryKey(Integer id);  
12 -  
13 int updateByPrimaryKeySelective(AppraiseOrder record); 15 int updateByPrimaryKeySelective(AppraiseOrder record);
14 16
15 int updateByPrimaryKey(AppraiseOrder record); 17 int updateByPrimaryKey(AppraiseOrder record);
  18 +
  19 + List<AppraiseOrder> selectSubOrderList(long parentOrderCode);
  20 +
  21 + AppraiseOrder selectByOrderCode(long orderCode);
  22 +
  23 +
  24 + int selectCntByOrderType(@Param("uid") int uid,
  25 + @Param("attributes") int attributes,
  26 + @Param("statusList")Collection<Integer> statusList);
  27 +
  28 + List<AppraiseOrder> selectOrderListByOrderType(@Param("uid") int uid,
  29 + @Param("attributes") int attributes,
  30 + @Param("statusList")Collection<Integer> statusList,
  31 + @Param("offset")int offset,
  32 + @Param("limit")int limit);
16 } 33 }
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.AppraiseOrderMeta;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface AppraiseOrderMetaMapper {
  8 + int insertBatch(List<AppraiseOrderMeta> list);
  9 +
  10 + int insert(AppraiseOrderMeta record);
  11 +
  12 + int insertSelective(AppraiseOrderMeta record);
  13 +
  14 + AppraiseOrderMeta selectByPrimaryKey(Integer id);
  15 +
  16 + AppraiseOrderMeta selectByOrderCode(AppraiseOrderMeta condition);
  17 +
  18 +
  19 + AppraiseOrderMeta selectByOrderCodeStorageId(AppraiseOrderMeta condition);
  20 +}
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.AppraiseOrderStorage;
  4 +
  5 +public interface AppraiseOrderStorageMapper {
  6 + int deleteByPrimaryKey(Integer id);
  7 +
  8 + int insert(AppraiseOrderStorage record);
  9 +
  10 + int insertSelective(AppraiseOrderStorage record);
  11 +
  12 + AppraiseOrderStorage selectByPrimaryKey(Integer id);
  13 +
  14 + int updateByPrimaryKeySelective(AppraiseOrderStorage record);
  15 +
  16 + int updateByPrimaryKey(AppraiseOrderStorage record);
  17 +}
@@ -10,11 +10,13 @@ public class AppraiseOrder { @@ -10,11 +10,13 @@ public class AppraiseOrder {
10 10
11 private Integer uid; 11 private Integer uid;
12 12
  13 + private Long parentOrderCode;
  14 +
13 private Long orderCode; 15 private Long orderCode;
14 16
15 - private Byte clientType; 17 + private Integer clientType;
16 18
17 - private Byte payment; 19 + private Integer payment;
18 20
19 private BigDecimal amount; 21 private BigDecimal amount;
20 22
@@ -26,7 +28,11 @@ public class AppraiseOrder { @@ -26,7 +28,11 @@ public class AppraiseOrder {
26 28
27 private Integer updateTime; 29 private Integer updateTime;
28 30
29 - private Byte isDel; 31 + private Integer isDel;
30 32
31 private String channelNo; 33 private String channelNo;
  34 +
  35 + private Integer attributes;
  36 +
  37 + private Byte platformDeliveryStatus;
32 } 38 }
1 package com.yohoufo.dal.order.model; 1 package com.yohoufo.dal.order.model;
2 2
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Builder;
  5 +import lombok.Data;
  6 +import lombok.NoArgsConstructor;
  7 +
  8 +@Data
  9 +@Builder
  10 +@AllArgsConstructor@NoArgsConstructor
3 public class AppraiseOrderGoods { 11 public class AppraiseOrderGoods {
4 private Integer id; 12 private Integer id;
5 13
@@ -13,51 +21,8 @@ public class AppraiseOrderGoods { @@ -13,51 +21,8 @@ public class AppraiseOrderGoods {
13 21
14 private String imageUrl; 22 private String imageUrl;
15 23
16 - public Integer getId() {  
17 - return id;  
18 - } 24 + private Integer depotNo;
19 25
20 - public void setId(Integer id) {  
21 - this.id = id;  
22 - } 26 + private Integer num;
23 27
24 - public Long getOrderCode() {  
25 - return orderCode;  
26 - }  
27 -  
28 - public void setOrderCode(Long orderCode) {  
29 - this.orderCode = orderCode;  
30 - }  
31 -  
32 - public Integer getProductId() {  
33 - return productId;  
34 - }  
35 -  
36 - public void setProductId(Integer productId) {  
37 - this.productId = productId;  
38 - }  
39 -  
40 - public String getProductName() {  
41 - return productName;  
42 - }  
43 -  
44 - public void setProductName(String productName) {  
45 - this.productName = productName == null ? null : productName.trim();  
46 - }  
47 -  
48 - public String getProductCode() {  
49 - return productCode;  
50 - }  
51 -  
52 - public void setProductCode(String productCode) {  
53 - this.productCode = productCode == null ? null : productCode.trim();  
54 - }  
55 -  
56 - public String getImageUrl() {  
57 - return imageUrl;  
58 - }  
59 -  
60 - public void setImageUrl(String imageUrl) {  
61 - this.imageUrl = imageUrl == null ? null : imageUrl.trim();  
62 - }  
63 } 28 }
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class AppraiseOrderMeta {
  4 + private Integer id;
  5 +
  6 + private Integer uid;
  7 +
  8 + private Long orderCode;
  9 +
  10 + private Integer storageId;
  11 +
  12 + private String metaKey;
  13 +
  14 + private String metaValue;
  15 +
  16 + public Integer getId() {
  17 + return id;
  18 + }
  19 +
  20 + public void setId(Integer id) {
  21 + this.id = id;
  22 + }
  23 +
  24 + public Integer getUid() {
  25 + return uid;
  26 + }
  27 +
  28 + public void setUid(Integer uid) {
  29 + this.uid = uid;
  30 + }
  31 +
  32 + public Long getOrderCode() {
  33 + return orderCode;
  34 + }
  35 +
  36 + public void setOrderCode(Long orderCode) {
  37 + this.orderCode = orderCode;
  38 + }
  39 +
  40 + public Integer getStorageId() {
  41 + return storageId;
  42 + }
  43 +
  44 + public void setStorageId(Integer storageId) {
  45 + this.storageId = storageId;
  46 + }
  47 +
  48 + public String getMetaKey() {
  49 + return metaKey;
  50 + }
  51 +
  52 + public void setMetaKey(String metaKey) {
  53 + this.metaKey = metaKey == null ? null : metaKey.trim();
  54 + }
  55 +
  56 + public String getMetaValue() {
  57 + return metaValue;
  58 + }
  59 +
  60 + public void setMetaValue(String metaValue) {
  61 + this.metaValue = metaValue == null ? null : metaValue.trim();
  62 + }
  63 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class AppraiseOrderStorage {
  4 + private Integer id;
  5 +
  6 + private Long orderCode;
  7 +
  8 + private Integer productId;
  9 +
  10 + private Integer sizeId;
  11 +
  12 + private String sizeName;
  13 +
  14 + private Integer colorId;
  15 +
  16 + private String colorName;
  17 +
  18 + private Integer storageId;
  19 +
  20 + private Integer num;
  21 +
  22 + public Integer getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(Integer id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public Long getOrderCode() {
  31 + return orderCode;
  32 + }
  33 +
  34 + public void setOrderCode(Long orderCode) {
  35 + this.orderCode = orderCode;
  36 + }
  37 +
  38 + public Integer getProductId() {
  39 + return productId;
  40 + }
  41 +
  42 + public void setProductId(Integer productId) {
  43 + this.productId = productId;
  44 + }
  45 +
  46 + public Integer getSizeId() {
  47 + return sizeId;
  48 + }
  49 +
  50 + public void setSizeId(Integer sizeId) {
  51 + this.sizeId = sizeId;
  52 + }
  53 +
  54 + public String getSizeName() {
  55 + return sizeName;
  56 + }
  57 +
  58 + public void setSizeName(String sizeName) {
  59 + this.sizeName = sizeName == null ? null : sizeName.trim();
  60 + }
  61 +
  62 + public Integer getColorId() {
  63 + return colorId;
  64 + }
  65 +
  66 + public void setColorId(Integer colorId) {
  67 + this.colorId = colorId;
  68 + }
  69 +
  70 + public String getColorName() {
  71 + return colorName;
  72 + }
  73 +
  74 + public void setColorName(String colorName) {
  75 + this.colorName = colorName == null ? null : colorName.trim();
  76 + }
  77 +
  78 + public Integer getStorageId() {
  79 + return storageId;
  80 + }
  81 +
  82 + public void setStorageId(Integer storageId) {
  83 + this.storageId = storageId;
  84 + }
  85 +
  86 + public Integer getNum() {
  87 + return num;
  88 + }
  89 +
  90 + public void setNum(Integer num) {
  91 + this.num = num;
  92 + }
  93 +}
@@ -8,22 +8,26 @@ @@ -8,22 +8,26 @@
8 <result column="product_name" jdbcType="VARCHAR" property="productName" /> 8 <result column="product_name" jdbcType="VARCHAR" property="productName" />
9 <result column="product_code" jdbcType="VARCHAR" property="productCode" /> 9 <result column="product_code" jdbcType="VARCHAR" property="productCode" />
10 <result column="image_url" jdbcType="VARCHAR" property="imageUrl" /> 10 <result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
  11 + <result column="depot_no" jdbcType="INTEGER" property="depotNo" />
  12 + <result column="num" jdbcType="INTEGER" property="num" />
11 </resultMap> 13 </resultMap>
12 <sql id="Base_Column_List"> 14 <sql id="Base_Column_List">
13 - id, order_code, product_id, product_name, product_code, image_url 15 + id, order_code, product_id, product_name, product_code, image_url, depot_no, num
14 </sql> 16 </sql>
15 - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 17 + <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
16 select 18 select
17 <include refid="Base_Column_List" /> 19 <include refid="Base_Column_List" />
18 from appraise_order_goods 20 from appraise_order_goods
19 - where id = #{id,jdbcType=INTEGER} 21 + where order_code = #{orderCode,jdbcType=BIGINT}
20 </select> 22 </select>
21 23
22 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> 24 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true">
23 insert into appraise_order_goods (order_code, product_id, product_name, 25 insert into appraise_order_goods (order_code, product_id, product_name,
24 - product_code, image_url) 26 + product_code, image_url, depot_no,
  27 + num)
25 values (#{orderCode,jdbcType=BIGINT}, #{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, 28 values (#{orderCode,jdbcType=BIGINT}, #{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR},
26 - #{productCode,jdbcType=VARCHAR}, #{imageUrl,jdbcType=VARCHAR}) 29 + #{productCode,jdbcType=VARCHAR}, #{imageUrl,jdbcType=VARCHAR}, #{depotNo,jdbcType=INTEGER},
  30 + #{num,jdbcType=INTEGER})
27 </insert> 31 </insert>
28 32
29 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> 33 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true">
@@ -44,6 +48,12 @@ @@ -44,6 +48,12 @@
44 <if test="imageUrl != null"> 48 <if test="imageUrl != null">
45 image_url, 49 image_url,
46 </if> 50 </if>
  51 + <if test="depotNo != null">
  52 + depot_no,
  53 + </if>
  54 + <if test="num != null">
  55 + num,
  56 + </if>
47 </trim> 57 </trim>
48 <trim prefix="values (" suffix=")" suffixOverrides=","> 58 <trim prefix="values (" suffix=")" suffixOverrides=",">
49 <if test="orderCode != null"> 59 <if test="orderCode != null">
@@ -61,6 +71,12 @@ @@ -61,6 +71,12 @@
61 <if test="imageUrl != null"> 71 <if test="imageUrl != null">
62 #{imageUrl,jdbcType=VARCHAR}, 72 #{imageUrl,jdbcType=VARCHAR},
63 </if> 73 </if>
  74 + <if test="depotNo != null">
  75 + #{depotNo,jdbcType=INTEGER},
  76 + </if>
  77 + <if test="num != null">
  78 + #{num,jdbcType=INTEGER},
  79 + </if>
64 </trim> 80 </trim>
65 </insert> 81 </insert>
66 <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods"> 82 <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods">
@@ -81,6 +97,12 @@ @@ -81,6 +97,12 @@
81 <if test="imageUrl != null"> 97 <if test="imageUrl != null">
82 image_url = #{imageUrl,jdbcType=VARCHAR}, 98 image_url = #{imageUrl,jdbcType=VARCHAR},
83 </if> 99 </if>
  100 + <if test="depotNo != null">
  101 + depot_no = #{depotNo,jdbcType=INTEGER},
  102 + </if>
  103 + <if test="num != null">
  104 + num = #{num,jdbcType=INTEGER},
  105 + </if>
84 </set> 106 </set>
85 where id = #{id,jdbcType=INTEGER} 107 where id = #{id,jdbcType=INTEGER}
86 </update> 108 </update>
@@ -90,7 +112,18 @@ @@ -90,7 +112,18 @@
90 product_id = #{productId,jdbcType=INTEGER}, 112 product_id = #{productId,jdbcType=INTEGER},
91 product_name = #{productName,jdbcType=VARCHAR}, 113 product_name = #{productName,jdbcType=VARCHAR},
92 product_code = #{productCode,jdbcType=VARCHAR}, 114 product_code = #{productCode,jdbcType=VARCHAR},
93 - image_url = #{imageUrl,jdbcType=VARCHAR} 115 + image_url = #{imageUrl,jdbcType=VARCHAR},
  116 + depot_no = #{depotNo,jdbcType=INTEGER},
  117 + num = #{num,jdbcType=INTEGER}
94 where id = #{id,jdbcType=INTEGER} 118 where id = #{id,jdbcType=INTEGER}
95 </update> 119 </update>
  120 +
  121 +
  122 + <select id="selectByOrderCodes" resultMap="BaseResultMap">
  123 + select <include refid="Base_Column_List" /> from appraise_order_goods
  124 + where order_code in
  125 + <foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=",">
  126 + #{orderCode,jdbcType=BIGINT}
  127 + </foreach>
  128 + </select>
96 </mapper> 129 </mapper>
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrder"> 4 <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrder">
5 <id column="id" jdbcType="INTEGER" property="id" /> 5 <id column="id" jdbcType="INTEGER" property="id" />
6 <result column="uid" jdbcType="INTEGER" property="uid" /> 6 <result column="uid" jdbcType="INTEGER" property="uid" />
  7 + <result column="parent_order_code" jdbcType="BIGINT" property="parentOrderCode" />
7 <result column="order_code" jdbcType="BIGINT" property="orderCode" /> 8 <result column="order_code" jdbcType="BIGINT" property="orderCode" />
8 <result column="client_type" jdbcType="TINYINT" property="clientType" /> 9 <result column="client_type" jdbcType="TINYINT" property="clientType" />
9 <result column="payment" jdbcType="TINYINT" property="payment" /> 10 <result column="payment" jdbcType="TINYINT" property="payment" />
@@ -14,35 +15,72 @@ @@ -14,35 +15,72 @@
14 <result column="update_time" jdbcType="INTEGER" property="updateTime" /> 15 <result column="update_time" jdbcType="INTEGER" property="updateTime" />
15 <result column="is_del" jdbcType="TINYINT" property="isDel" /> 16 <result column="is_del" jdbcType="TINYINT" property="isDel" />
16 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" /> 17 <result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
  18 + <result column="attributes" jdbcType="INTEGER" property="attributes" />
  19 + <result column="platform_delivery_status" jdbcType="TINYINT" property="platformDeliveryStatus" />
17 </resultMap> 20 </resultMap>
18 <sql id="Base_Column_List"> 21 <sql id="Base_Column_List">
19 - id, uid, order_code, client_type, payment, amount, ship_fee, status, create_time,  
20 - update_time, is_del, channel_no 22 + id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status,
  23 + create_time, update_time, is_del, channel_no, attributes, platform_delivery_status
21 </sql> 24 </sql>
22 - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 25 +
  26 + <select id="selectSubOrderList" parameterType="java.lang.Long" resultMap="BaseResultMap">
23 select 27 select
24 <include refid="Base_Column_List" /> 28 <include refid="Base_Column_List" />
25 from appraise_order 29 from appraise_order
26 - where id = #{id,jdbcType=INTEGER} 30 + where parent_order_code = #{parentOrderCode,jdbcType=INTEGER}
  31 + </select>
  32 +
  33 + <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
  34 + select
  35 + <include refid="Base_Column_List" />
  36 + from appraise_order
  37 + where order_code = #{orderCode,jdbcType=INTEGER}
  38 + </select>
  39 +
  40 + <select id="selectCntByOrderType" resultType="java.lang.Integer">
  41 + select count(*) from appraise_order
  42 + where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
  43 + and status in
  44 + <foreach collection="statusList" item="status" open="(" close=")" separator=",">
  45 + #{status,jdbcType=TINYINT}
  46 + </foreach>
  47 + </select>
  48 +
  49 + <select id="selectOrderListByOrderType" resultType="java.lang.Integer">
  50 + select
  51 + <include refid="Base_Column_List" />
  52 + from appraise_order
  53 + where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
  54 + and status in
  55 + <foreach collection="statusList" item="status" open="(" close=")" separator=",">
  56 + #{status,jdbcType=TINYINT}
  57 + </foreach>
  58 + limit #{offset},#{limit}
27 </select> 59 </select>
28 60
29 61
30 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true"> 62 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
31 - insert into appraise_order (uid, order_code, client_type,  
32 - payment, amount, ship_fee,  
33 - status, create_time, update_time,  
34 - is_del, channel_no)  
35 - values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{clientType,jdbcType=TINYINT},  
36 - #{payment,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL},  
37 - #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},  
38 - #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR}) 63 + insert into appraise_order (uid, parent_order_code, order_code,
  64 + client_type, payment, amount,
  65 + ship_fee, status, create_time,
  66 + update_time, is_del, channel_no,
  67 + attributes, platform_delivery_status)
  68 + values (#{uid,jdbcType=INTEGER}, #{parentOrderCode,jdbcType=BIGINT}, #{orderCode,jdbcType=BIGINT},
  69 + #{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL},
  70 + #{shipFee,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
  71 + #{updateTime,jdbcType=INTEGER}, #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR},
  72 + #{attributes,jdbcType=INTEGER}, #{platformDeliveryStatus,jdbcType=TINYINT})
39 </insert> 73 </insert>
  74 +
40 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true"> 75 <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true">
41 insert into appraise_order 76 insert into appraise_order
42 <trim prefix="(" suffix=")" suffixOverrides=","> 77 <trim prefix="(" suffix=")" suffixOverrides=",">
43 <if test="uid != null"> 78 <if test="uid != null">
44 uid, 79 uid,
45 </if> 80 </if>
  81 + <if test="parentOrderCode != null">
  82 + parent_order_code,
  83 + </if>
46 <if test="orderCode != null"> 84 <if test="orderCode != null">
47 order_code, 85 order_code,
48 </if> 86 </if>
@@ -73,11 +111,20 @@ @@ -73,11 +111,20 @@
73 <if test="channelNo != null"> 111 <if test="channelNo != null">
74 channel_no, 112 channel_no,
75 </if> 113 </if>
  114 + <if test="attributes != null">
  115 + attributes,
  116 + </if>
  117 + <if test="platformDeliveryStatus != null">
  118 + platform_delivery_status,
  119 + </if>
76 </trim> 120 </trim>
77 <trim prefix="values (" suffix=")" suffixOverrides=","> 121 <trim prefix="values (" suffix=")" suffixOverrides=",">
78 <if test="uid != null"> 122 <if test="uid != null">
79 #{uid,jdbcType=INTEGER}, 123 #{uid,jdbcType=INTEGER},
80 </if> 124 </if>
  125 + <if test="parentOrderCode != null">
  126 + #{parentOrderCode,jdbcType=BIGINT},
  127 + </if>
81 <if test="orderCode != null"> 128 <if test="orderCode != null">
82 #{orderCode,jdbcType=BIGINT}, 129 #{orderCode,jdbcType=BIGINT},
83 </if> 130 </if>
@@ -108,60 +155,34 @@ @@ -108,60 +155,34 @@
108 <if test="channelNo != null"> 155 <if test="channelNo != null">
109 #{channelNo,jdbcType=VARCHAR}, 156 #{channelNo,jdbcType=VARCHAR},
110 </if> 157 </if>
  158 + <if test="attributes != null">
  159 + #{attributes,jdbcType=INTEGER},
  160 + </if>
  161 + <if test="platformDeliveryStatus != null">
  162 + #{platformDeliveryStatus,jdbcType=TINYINT},
  163 + </if>
111 </trim> 164 </trim>
112 </insert> 165 </insert>
113 <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrder"> 166 <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrder">
114 update appraise_order 167 update appraise_order
115 <set> 168 <set>
116 - <if test="uid != null">  
117 - uid = #{uid,jdbcType=INTEGER},  
118 - </if>  
119 - <if test="orderCode != null">  
120 - order_code = #{orderCode,jdbcType=BIGINT},  
121 - </if>  
122 - <if test="clientType != null">  
123 - client_type = #{clientType,jdbcType=TINYINT},  
124 - </if>  
125 <if test="payment != null"> 169 <if test="payment != null">
126 payment = #{payment,jdbcType=TINYINT}, 170 payment = #{payment,jdbcType=TINYINT},
127 </if> 171 </if>
128 - <if test="amount != null">  
129 - amount = #{amount,jdbcType=DECIMAL},  
130 - </if>  
131 - <if test="shipFee != null">  
132 - ship_fee = #{shipFee,jdbcType=DECIMAL},  
133 - </if>  
134 <if test="status != null"> 172 <if test="status != null">
135 status = #{status,jdbcType=TINYINT}, 173 status = #{status,jdbcType=TINYINT},
136 </if> 174 </if>
137 - <if test="createTime != null">  
138 - create_time = #{createTime,jdbcType=INTEGER},  
139 - </if>  
140 <if test="updateTime != null"> 175 <if test="updateTime != null">
141 update_time = #{updateTime,jdbcType=INTEGER}, 176 update_time = #{updateTime,jdbcType=INTEGER},
142 </if> 177 </if>
143 <if test="isDel != null"> 178 <if test="isDel != null">
144 is_del = #{isDel,jdbcType=TINYINT}, 179 is_del = #{isDel,jdbcType=TINYINT},
145 </if> 180 </if>
146 - <if test="channelNo != null">  
147 - channel_no = #{channelNo,jdbcType=VARCHAR}, 181 + <if test="platformDeliveryStatus != null">
  182 + platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT},
148 </if> 183 </if>
149 </set> 184 </set>
150 where id = #{id,jdbcType=INTEGER} 185 where id = #{id,jdbcType=INTEGER}
151 </update> 186 </update>
152 - <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrder">  
153 - update appraise_order  
154 - set uid = #{uid,jdbcType=INTEGER},  
155 - order_code = #{orderCode,jdbcType=BIGINT},  
156 - client_type = #{clientType,jdbcType=TINYINT},  
157 - payment = #{payment,jdbcType=TINYINT},  
158 - amount = #{amount,jdbcType=DECIMAL},  
159 - ship_fee = #{shipFee,jdbcType=DECIMAL},  
160 - status = #{status,jdbcType=TINYINT},  
161 - create_time = #{createTime,jdbcType=INTEGER},  
162 - update_time = #{updateTime,jdbcType=INTEGER},  
163 - is_del = #{isDel,jdbcType=TINYINT},  
164 - channel_no = #{channelNo,jdbcType=VARCHAR}  
165 - where id = #{id,jdbcType=INTEGER}  
166 - </update> 187 +
167 </mapper> 188 </mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.AppraiseOrderMetaMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrderMeta">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="uid" jdbcType="INTEGER" property="uid" />
  7 + <result column="order_code" jdbcType="BIGINT" property="orderCode" />
  8 + <result column="storage_id" jdbcType="INTEGER" property="storageId" />
  9 + <result column="meta_key" jdbcType="VARCHAR" property="metaKey" />
  10 + <result column="meta_value" jdbcType="VARCHAR" property="metaValue" />
  11 + </resultMap>
  12 + <sql id="Base_Column_List">
  13 + id, uid, order_code, storage_id, meta_key, meta_value
  14 + </sql>
  15 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  16 + select
  17 + <include refid="Base_Column_List" />
  18 + from appraise_order_meta
  19 + where id = #{id,jdbcType=INTEGER}
  20 + </select>
  21 +
  22 +
  23 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true">
  24 + insert into appraise_order_meta (uid, order_code, storage_id,
  25 + meta_key, meta_value)
  26 + values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{storageId,jdbcType=INTEGER},
  27 + #{metaKey,jdbcType=VARCHAR}, #{metaValue,jdbcType=VARCHAR})
  28 + </insert>
  29 +
  30 + <insert id="insertBatch" parameterType="java.util.List">
  31 + insert into appraise_order_meta (uid, order_code, storage_id, meta_key, meta_value)
  32 + values
  33 + <foreach collection="list" item="record" separator=",">
  34 + (#{record.uid,jdbcType=INTEGER}, #{record.orderCode,jdbcType=BIGINT}, #{record.storageId,jdbcType=INTEGER},
  35 + #{record.metaKey,jdbcType=VARCHAR}, #{record.metaValue,jdbcType=VARCHAR})
  36 + </foreach>
  37 + </insert>
  38 +
  39 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true">
  40 + insert into appraise_order_meta
  41 + <trim prefix="(" suffix=")" suffixOverrides=",">
  42 + <if test="uid != null">
  43 + uid,
  44 + </if>
  45 + <if test="orderCode != null">
  46 + order_code,
  47 + </if>
  48 + <if test="storageId != null">
  49 + storage_id,
  50 + </if>
  51 + <if test="metaKey != null">
  52 + meta_key,
  53 + </if>
  54 + <if test="metaValue != null">
  55 + meta_value,
  56 + </if>
  57 + </trim>
  58 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  59 + <if test="uid != null">
  60 + #{uid,jdbcType=INTEGER},
  61 + </if>
  62 + <if test="orderCode != null">
  63 + #{orderCode,jdbcType=BIGINT},
  64 + </if>
  65 + <if test="storageId != null">
  66 + #{storageId,jdbcType=INTEGER},
  67 + </if>
  68 + <if test="metaKey != null">
  69 + #{metaKey,jdbcType=VARCHAR},
  70 + </if>
  71 + <if test="metaValue != null">
  72 + #{metaValue,jdbcType=VARCHAR},
  73 + </if>
  74 + </trim>
  75 + </insert>
  76 +
  77 +
  78 + <select id="selectByOrderCode" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap">
  79 + select
  80 + <include refid="Base_Column_List" />
  81 + from appraise_order_meta
  82 + where order_code = #{orderCode,jdbcType=INTEGER}
  83 + and meta_key = #{metaKey,jdbcType=VARCHAR}
  84 + </select>
  85 +
  86 + <select id="selectByOrderCodeStorageId" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap">
  87 + select
  88 + <include refid="Base_Column_List" />
  89 + from appraise_order_meta
  90 + where order_code = #{orderCode,jdbcType=INTEGER}
  91 + and storage_id = #{storageId,jdbcType=INTEGER}
  92 + and meta_key = #{metaKey,jdbcType=VARCHAR}
  93 + </select>
  94 +
  95 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.AppraiseOrderStorageMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.AppraiseOrderStorage">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="order_code" jdbcType="BIGINT" property="orderCode" />
  7 + <result column="product_id" jdbcType="INTEGER" property="productId" />
  8 + <result column="size_id" jdbcType="INTEGER" property="sizeId" />
  9 + <result column="size_name" jdbcType="VARCHAR" property="sizeName" />
  10 + <result column="color_id" jdbcType="INTEGER" property="colorId" />
  11 + <result column="color_name" jdbcType="VARCHAR" property="colorName" />
  12 + <result column="storage_id" jdbcType="INTEGER" property="storageId" />
  13 + <result column="num" jdbcType="INTEGER" property="num" />
  14 + </resultMap>
  15 + <sql id="Base_Column_List">
  16 + id, order_code, product_id, size_id, size_name, color_id, color_name, storage_id,
  17 + num
  18 + </sql>
  19 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  20 + select
  21 + <include refid="Base_Column_List" />
  22 + from appraise_order_storage
  23 + where id = #{id,jdbcType=INTEGER}
  24 + </select>
  25 +
  26 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage" useGeneratedKeys="true">
  27 + insert into appraise_order_storage (order_code, product_id, size_id,
  28 + size_name, color_id, color_name,
  29 + storage_id, num)
  30 + values (#{orderCode,jdbcType=BIGINT}, #{productId,jdbcType=INTEGER}, #{sizeId,jdbcType=INTEGER},
  31 + #{sizeName,jdbcType=VARCHAR}, #{colorId,jdbcType=INTEGER}, #{colorName,jdbcType=VARCHAR},
  32 + #{storageId,jdbcType=INTEGER}, #{num,jdbcType=INTEGER})
  33 + </insert>
  34 +
  35 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage" useGeneratedKeys="true">
  36 + insert into appraise_order_storage
  37 + <trim prefix="(" suffix=")" suffixOverrides=",">
  38 + <if test="orderCode != null">
  39 + order_code,
  40 + </if>
  41 + <if test="productId != null">
  42 + product_id,
  43 + </if>
  44 + <if test="sizeId != null">
  45 + size_id,
  46 + </if>
  47 + <if test="sizeName != null">
  48 + size_name,
  49 + </if>
  50 + <if test="colorId != null">
  51 + color_id,
  52 + </if>
  53 + <if test="colorName != null">
  54 + color_name,
  55 + </if>
  56 + <if test="storageId != null">
  57 + storage_id,
  58 + </if>
  59 + <if test="num != null">
  60 + num,
  61 + </if>
  62 + </trim>
  63 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  64 + <if test="orderCode != null">
  65 + #{orderCode,jdbcType=BIGINT},
  66 + </if>
  67 + <if test="productId != null">
  68 + #{productId,jdbcType=INTEGER},
  69 + </if>
  70 + <if test="sizeId != null">
  71 + #{sizeId,jdbcType=INTEGER},
  72 + </if>
  73 + <if test="sizeName != null">
  74 + #{sizeName,jdbcType=VARCHAR},
  75 + </if>
  76 + <if test="colorId != null">
  77 + #{colorId,jdbcType=INTEGER},
  78 + </if>
  79 + <if test="colorName != null">
  80 + #{colorName,jdbcType=VARCHAR},
  81 + </if>
  82 + <if test="storageId != null">
  83 + #{storageId,jdbcType=INTEGER},
  84 + </if>
  85 + <if test="num != null">
  86 + #{num,jdbcType=INTEGER},
  87 + </if>
  88 + </trim>
  89 + </insert>
  90 + <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage">
  91 + update appraise_order_storage
  92 + <set>
  93 + <if test="orderCode != null">
  94 + order_code = #{orderCode,jdbcType=BIGINT},
  95 + </if>
  96 + <if test="productId != null">
  97 + product_id = #{productId,jdbcType=INTEGER},
  98 + </if>
  99 + <if test="sizeId != null">
  100 + size_id = #{sizeId,jdbcType=INTEGER},
  101 + </if>
  102 + <if test="sizeName != null">
  103 + size_name = #{sizeName,jdbcType=VARCHAR},
  104 + </if>
  105 + <if test="colorId != null">
  106 + color_id = #{colorId,jdbcType=INTEGER},
  107 + </if>
  108 + <if test="colorName != null">
  109 + color_name = #{colorName,jdbcType=VARCHAR},
  110 + </if>
  111 + <if test="storageId != null">
  112 + storage_id = #{storageId,jdbcType=INTEGER},
  113 + </if>
  114 + <if test="num != null">
  115 + num = #{num,jdbcType=INTEGER},
  116 + </if>
  117 + </set>
  118 + where id = #{id,jdbcType=INTEGER}
  119 + </update>
  120 + <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrderStorage">
  121 + update appraise_order_storage
  122 + set order_code = #{orderCode,jdbcType=BIGINT},
  123 + product_id = #{productId,jdbcType=INTEGER},
  124 + size_id = #{sizeId,jdbcType=INTEGER},
  125 + size_name = #{sizeName,jdbcType=VARCHAR},
  126 + color_id = #{colorId,jdbcType=INTEGER},
  127 + color_name = #{colorName,jdbcType=VARCHAR},
  128 + storage_id = #{storageId,jdbcType=INTEGER},
  129 + num = #{num,jdbcType=INTEGER}
  130 + where id = #{id,jdbcType=INTEGER}
  131 + </update>
  132 +</mapper>
@@ -381,7 +381,7 @@ @@ -381,7 +381,7 @@
381 381
382 <update id="updateDepositEndTime"> 382 <update id="updateDepositEndTime">
383 update storage_deposit 383 update storage_deposit
384 - set deposit_end_time = unix_timestamp(now()) + #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER} 384 + set deposit_end_time = #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
385 where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER} 385 where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER}
386 </update> 386 </update>
387 387
@@ -4,10 +4,7 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; @@ -4,10 +4,7 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq;
4 import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; 4 import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq;
5 import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; 5 import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq;
6 import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; 6 import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq;
7 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp;  
8 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp;  
9 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;  
10 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; 7 +import com.yohobuy.ufo.model.order.resp.*;
11 import com.yohoufo.common.ApiResponse; 8 import com.yohoufo.common.ApiResponse;
12 import com.yohoufo.order.service.impl.AppraiseOrderService; 9 import com.yohoufo.order.service.impl.AppraiseOrderService;
13 import org.slf4j.Logger; 10 import org.slf4j.Logger;
@@ -31,14 +28,14 @@ public class AppraiseOrderController { @@ -31,14 +28,14 @@ public class AppraiseOrderController {
31 * @param productId 28 * @param productId
32 * @return 29 * @return
33 */ 30 */
34 - @RequestMapping(params = "method=ufo.appriseOrder.compute") 31 + @RequestMapping(params = "method=ufo.appraiseOrder.compute")
35 public ApiResponse compute(@RequestParam(name = "uid")int uid, 32 public ApiResponse compute(@RequestParam(name = "uid")int uid,
36 @RequestParam(name = "productId")int productId){ 33 @RequestParam(name = "productId")int productId){
37 AppraiseOrderComputeReq req = AppraiseOrderComputeReq.builder() 34 AppraiseOrderComputeReq req = AppraiseOrderComputeReq.builder()
38 .uid(uid) 35 .uid(uid)
39 .productId(productId) 36 .productId(productId)
40 .build(); 37 .build();
41 - logger.info("in ufo.appriseOrder.compute req {}", req); 38 + logger.info("in ufo.appraiseOrder.compute req {}", req);
42 AppraiseOrderComputeResp resp = appraiseOrderService.compute(req); 39 AppraiseOrderComputeResp resp = appraiseOrderService.compute(req);
43 return new ApiResponse.ApiResponseBuilder() 40 return new ApiResponse.ApiResponseBuilder()
44 .code(200) 41 .code(200)
@@ -48,13 +45,16 @@ public class AppraiseOrderController { @@ -48,13 +45,16 @@ public class AppraiseOrderController {
48 } 45 }
49 46
50 47
51 - @RequestMapping(params = "method=ufo.appriseOrder.submit") 48 + @RequestMapping(params = "method=ufo.appraiseOrder.submit")
52 public ApiResponse submit(@RequestParam(name = "uid")int uid, 49 public ApiResponse submit(@RequestParam(name = "uid")int uid,
53 @RequestParam(name = "productId")int productId, 50 @RequestParam(name = "productId")int productId,
54 - @RequestParam(name = "addressId") String addressId){ 51 + @RequestParam(name = "addressId") String addressId,
  52 + @RequestParam(name = "channelNo", required = false) String channelNo,
  53 + @RequestParam(name = "client_type", required = false) String clientType){
55 AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder() 54 AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder()
56 - .uid(uid).productId(productId).addressId(addressId).build();  
57 - logger.info("in ufo.appriseOrder.submit req {}", req); 55 + .uid(uid).productId(productId).addressId(addressId)
  56 + .channelNo(channelNo).clientType(clientType).build();
  57 + logger.info("in ufo.appraiseOrder.submit req {}", req);
58 AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req); 58 AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req);
59 return new ApiResponse.ApiResponseBuilder() 59 return new ApiResponse.ApiResponseBuilder()
60 .code(200) 60 .code(200)
@@ -69,7 +69,7 @@ public class AppraiseOrderController { @@ -69,7 +69,7 @@ public class AppraiseOrderController {
69 * @param uid 69 * @param uid
70 * @return 70 * @return
71 */ 71 */
72 - @RequestMapping(params = "method=ufo.appriseOrder.list") 72 + @RequestMapping(params = "method=ufo.appraiseOrder.list")
73 public ApiResponse list(@RequestParam(name = "uid")int uid, 73 public ApiResponse list(@RequestParam(name = "uid")int uid,
74 @RequestParam(value = "page", required = false, defaultValue = "1") int page, 74 @RequestParam(value = "page", required = false, defaultValue = "1") int page,
75 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit){ 75 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit){
@@ -77,8 +77,8 @@ public class AppraiseOrderController { @@ -77,8 +77,8 @@ public class AppraiseOrderController {
77 AppraiseOrderListReq req = AppraiseOrderListReq.builder() 77 AppraiseOrderListReq req = AppraiseOrderListReq.builder()
78 .uid(uid).limit(limit).page(page).build(); 78 .uid(uid).limit(limit).page(page).build();
79 79
80 - logger.info("in ufo.appriseOrder.list req {}", req);  
81 - AppraiseOrderListResp resp = appraiseOrderService.getOrderList(req); 80 + logger.info("in ufo.appraiseOrder.list req {}", req);
  81 + PageResp<AppraiseOrderListResp> resp = appraiseOrderService.getOrderList(req);
82 return new ApiResponse.ApiResponseBuilder() 82 return new ApiResponse.ApiResponseBuilder()
83 .code(200) 83 .code(200)
84 .data(resp) 84 .data(resp)
@@ -87,11 +87,11 @@ public class AppraiseOrderController { @@ -87,11 +87,11 @@ public class AppraiseOrderController {
87 } 87 }
88 88
89 89
90 - @RequestMapping(params = "method=ufo.appriseOrder.detail") 90 + @RequestMapping(params = "method=ufo.appraiseOrder.detail")
91 public ApiResponse detail(@RequestParam(name = "uid")int uid, 91 public ApiResponse detail(@RequestParam(name = "uid")int uid,
92 @RequestParam(name = "orderCode")long orderCode){ 92 @RequestParam(name = "orderCode")long orderCode){
93 AppraiseOrderDetailReq req = AppraiseOrderDetailReq.builder().uid(uid).orderCode(orderCode).build(); 93 AppraiseOrderDetailReq req = AppraiseOrderDetailReq.builder().uid(uid).orderCode(orderCode).build();
94 - logger.info("in ufo.appriseOrder.detail req {}", req); 94 + logger.info("in ufo.appraiseOrder.detail req {}", req);
95 AppraiseOrderDetailResp resp = appraiseOrderService.getOrderDetail(req); 95 AppraiseOrderDetailResp resp = appraiseOrderService.getOrderDetail(req);
96 return new ApiResponse.ApiResponseBuilder() 96 return new ApiResponse.ApiResponseBuilder()
97 .code(200) 97 .code(200)
  1 +package com.yohoufo.order.controller;
  2 +
  3 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderComputeReq;
  4 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderDetailReq;
  5 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq;
  6 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderSubmitReq;
  7 +import com.yohobuy.ufo.model.order.resp.*;
  8 +import com.yohoufo.common.ApiResponse;
  9 +import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
  10 +import com.yohoufo.order.utils.LoggerUtils;
  11 +import org.slf4j.Logger;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +@RestController
  18 +public class SellerDepositOrderController {
  19 +
  20 +
  21 + private Logger logger = LoggerUtils.getSellerOrderLogger();
  22 + @Autowired
  23 + private SellerDepositOrderService sellerDepositOrderService;
  24 +
  25 + @RequestMapping(params = "method=ufo.depositOrder.compute")
  26 + public ApiResponse compute(@RequestParam(name = "uid")int uid,
  27 + @RequestParam(name = "goodsList")String goodsList){
  28 + SellerDepositOrderComputeReq req = SellerDepositOrderComputeReq.builder()
  29 + .uid(uid).goodsList(goodsList).build();
  30 + logger.info("in ufo.depositOrder.compute req {}", req);
  31 + SellerDepositOrderComputeResp resp = sellerDepositOrderService.compute(req);
  32 + return new ApiResponse.ApiResponseBuilder()
  33 + .code(200)
  34 + .data(resp)
  35 + .message("寄存计算成功")
  36 + .build();
  37 + }
  38 +
  39 +
  40 + @RequestMapping(params = "method=ufo.depositOrder.submit")
  41 + public ApiResponse submit(@RequestParam(name = "uid")int uid,
  42 + @RequestParam(name = "goodsList")String goodsList){
  43 + SellerDepositOrderSubmitReq req = SellerDepositOrderSubmitReq.builder()
  44 + .uid(uid).goodsList(goodsList).build();
  45 + logger.info("in ufo.depositOrder.submit req {}", req);
  46 + SellerDepositOrderSubmitResp resp = sellerDepositOrderService.submit(req);
  47 + return new ApiResponse.ApiResponseBuilder()
  48 + .code(200)
  49 + .data(resp)
  50 + .message("寄存订单提交成功")
  51 + .build();
  52 + }
  53 +
  54 +
  55 + /**
  56 + * 商品付费寄存列表
  57 + * @param uid
  58 + * @return
  59 + */
  60 + @RequestMapping(params = "method=ufo.depositOrder.list")
  61 + public ApiResponse list(@RequestParam(name = "uid")int uid,
  62 + @RequestParam(name = "listType")int listType,
  63 + @RequestParam(value = "page", required = false, defaultValue = "1") int page,
  64 + @RequestParam(value = "limit", required = false, defaultValue = "10") int limit){
  65 +
  66 + SellerDepositOrderListReq req = SellerDepositOrderListReq.builder()
  67 + .uid(uid).listType(listType).limit(limit).page(page).build();
  68 +
  69 + logger.info("in ufo.depositOrder.list req {}", req);
  70 + PageResp<SellerDepositOrderListResp> resp = sellerDepositOrderService.getOrderList(req);
  71 + return new ApiResponse.ApiResponseBuilder()
  72 + .code(200)
  73 + .data(resp)
  74 + .message("寄存订单列表查询成功")
  75 + .build();
  76 + }
  77 +
  78 +
  79 + @RequestMapping(params = "method=ufo.depositOrder.detail")
  80 + public ApiResponse detail(@RequestParam(name = "uid")int uid,
  81 + @RequestParam(name = "orderCode")long orderCode){
  82 + SellerDepositOrderDetailReq req = SellerDepositOrderDetailReq.builder()
  83 + .uid(uid).orderCode(orderCode).build();
  84 + logger.info("in ufo.depositOrder.detail req {}", req);
  85 + SellerDepositOrderDetailResp resp = sellerDepositOrderService.getOrderDetail(req);
  86 + return new ApiResponse.ApiResponseBuilder()
  87 + .code(200)
  88 + .data(resp)
  89 + .message("寄存订单详情查询成功")
  90 + .build();
  91 + }
  92 +
  93 + /**
  94 + * 发货
  95 + * @param uid
  96 + * @param orderCode
  97 + * @param depotNum
  98 + * @param addressId
  99 + * @return
  100 + */
  101 + @RequestMapping(params = "method=ufo.depositOrder.deliverToDepot")
  102 + public ApiResponse deliverToDepot(@RequestParam(name = "uid")int uid,
  103 + @RequestParam(name = "orderCode")long orderCode,
  104 + @RequestParam(name = "depotNum")int depotNum,
  105 + @RequestParam(name = "addressId") String addressId){
  106 +
  107 +
  108 + return new ApiResponse.ApiResponseBuilder()
  109 + .code(200)
  110 + .data(null)
  111 + .message("寄存订单发货录入成功")
  112 + .build();
  113 + }
  114 +}
  1 +package com.yohoufo.order.convert;
  2 +
  3 +import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;
  4 +
  5 +public final class AppraiseOrderConverter {
  6 +
  7 + public static AppraiseOrderListResp do2Resp(){
  8 +
  9 +
  10 + return null;
  11 + }
  12 +}
  1 +package com.yohoufo.order.convert;
  2 +
  3 +import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
  4 +import com.yohoufo.common.helper.ImageUrlAssist;
  5 +import com.yohoufo.dal.order.model.AppraiseOrderGoods;
  6 +
  7 +public final class AppraiseOrderGoodsConvertor {
  8 +
  9 + public static AppraiseOrderGoodsBo do2Bo(AppraiseOrderGoods paog){
  10 + return AppraiseOrderGoodsBo.builder()
  11 + .productId(paog.getProductId())
  12 + .productName(paog.getProductName())
  13 + .productCode(paog.getProductCode())
  14 + .imageUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU="))
  15 + .build();
  16 + }
  17 +}
@@ -21,6 +21,9 @@ public class AppraiseOrderContext { @@ -21,6 +21,9 @@ public class AppraiseOrderContext {
21 21
22 private int productId; 22 private int productId;
23 23
  24 + private Integer clientType;
  25 +
  26 + private String channelNo;
24 /** 27 /**
25 * 鉴定费 28 * 鉴定费
26 */ 29 */
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.core.dal.datasource.annotation.Database;
4 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; 5 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
5 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 6 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
6 import com.yohobuy.ufo.model.order.vo.AddressInfo; 7 import com.yohobuy.ufo.model.order.vo.AddressInfo;
  8 +import com.yohoufo.common.utils.DateUtil;
7 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; 9 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
8 import com.yohoufo.dal.order.AppraiseOrderMapper; 10 import com.yohoufo.dal.order.AppraiseOrderMapper;
9 -import com.yohoufo.dal.order.BuyerOrderMetaMapper; 11 +import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
10 import com.yohoufo.dal.order.model.AppraiseOrder; 12 import com.yohoufo.dal.order.model.AppraiseOrder;
11 import com.yohoufo.dal.order.model.AppraiseOrderGoods; 13 import com.yohoufo.dal.order.model.AppraiseOrderGoods;
12 -import com.yohoufo.dal.order.model.BuyerOrderMeta; 14 +import com.yohoufo.dal.order.model.AppraiseOrderMeta;
  15 +import com.yohoufo.order.common.DelStatus;
13 import com.yohoufo.order.constants.MetaKey; 16 import com.yohoufo.order.constants.MetaKey;
14 import com.yohoufo.order.model.dto.AppraiseOrderContext; 17 import com.yohoufo.order.model.dto.AppraiseOrderContext;
15 import com.yohoufo.order.utils.LoggerUtils; 18 import com.yohoufo.order.utils.LoggerUtils;
@@ -18,6 +21,8 @@ import lombok.Data; @@ -18,6 +21,8 @@ import lombok.Data;
18 import org.slf4j.Logger; 21 import org.slf4j.Logger;
19 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
  24 +import org.springframework.transaction.annotation.Propagation;
  25 +import org.springframework.transaction.annotation.Transactional;
21 26
22 import java.util.ArrayList; 27 import java.util.ArrayList;
23 import java.util.List; 28 import java.util.List;
@@ -35,7 +40,7 @@ public class AppraiseOrderCreateService { @@ -35,7 +40,7 @@ public class AppraiseOrderCreateService {
35 private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; 40 private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
36 41
37 @Autowired 42 @Autowired
38 - private BuyerOrderMetaMapper buyerOrderMetaMapper; 43 + private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
39 44
40 @Builder 45 @Builder
41 @Data 46 @Data
@@ -45,6 +50,8 @@ public class AppraiseOrderCreateService { @@ -45,6 +50,8 @@ public class AppraiseOrderCreateService {
45 AppraiseOrderGoods appraiseOrderGoods; 50 AppraiseOrderGoods appraiseOrderGoods;
46 } 51 }
47 52
  53 + @Transactional(propagation = Propagation.REQUIRES_NEW)
  54 + @Database(ForceMaster=true, DataSource="ufo_order")
48 public SubmitResult create(AppraiseOrderContext ctx){ 55 public SubmitResult create(AppraiseOrderContext ctx){
49 logger.info("in AppraiseOrderCreateService create, "); 56 logger.info("in AppraiseOrderCreateService create, ");
50 int uid = ctx.getUid(); 57 int uid = ctx.getUid();
@@ -53,10 +60,18 @@ public class AppraiseOrderCreateService { @@ -53,10 +60,18 @@ public class AppraiseOrderCreateService {
53 uid, orderCode, ctx.getProductId()); 60 uid, orderCode, ctx.getProductId());
54 // 61 //
55 AppraiseOrder pao = new AppraiseOrder(); 62 AppraiseOrder pao = new AppraiseOrder();
  63 + pao.setUid(ctx.getUid());
56 pao.setOrderCode(orderCode); 64 pao.setOrderCode(orderCode);
57 pao.setAmount(ctx.getFee()); 65 pao.setAmount(ctx.getFee());
58 - //TODO 66 +
  67 + int cdt = DateUtil.getCurrentTimeSecond();
  68 + pao.setCreateTime(cdt);
  69 + pao.setUpdateTime(cdt);
  70 + //
59 pao.setStatus(AppraiseOrderStatus.WAITING_PAY.getCode()); 71 pao.setStatus(AppraiseOrderStatus.WAITING_PAY.getCode());
  72 + pao.setIsDel(DelStatus.NOT_DEL.getCode());
  73 + pao.setChannelNo(ctx.getChannelNo());
  74 + pao.setClientType(ctx.getClientType());
60 appraiseOrderMapper.insertSelective(pao); 75 appraiseOrderMapper.insertSelective(pao);
61 // 76 //
62 AppraiseOrderGoodsBo aogb = ctx.getGoodsBo(); 77 AppraiseOrderGoodsBo aogb = ctx.getGoodsBo();
@@ -65,28 +80,29 @@ public class AppraiseOrderCreateService { @@ -65,28 +80,29 @@ public class AppraiseOrderCreateService {
65 paog.setProductId(aogb.getProductId()); 80 paog.setProductId(aogb.getProductId());
66 paog.setProductName(aogb.getProductName()); 81 paog.setProductName(aogb.getProductName());
67 paog.setProductCode(aogb.getProductCode()); 82 paog.setProductCode(aogb.getProductCode());
  83 + paog.setNum(1);
68 appraiseOrderGoodsMapper.insertSelective(paog); 84 appraiseOrderGoodsMapper.insertSelective(paog);
69 85
70 //meta 86 //meta
71 AddressInfo noHiddenBackAddress = ctx.getBackAddress(), 87 AddressInfo noHiddenBackAddress = ctx.getBackAddress(),
72 hiddenBackAddress = ctx.getBackHiddenAddress(); 88 hiddenBackAddress = ctx.getBackHiddenAddress();
73 final String key = MetaKey.BUYER_DELIVERY_ADDRESS, 89 final String key = MetaKey.BUYER_DELIVERY_ADDRESS,
74 - hiiden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;  
75 - BuyerOrderMeta noHiddenAddressMeta=new BuyerOrderMeta(); 90 + hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;
  91 + AppraiseOrderMeta noHiddenAddressMeta = new AppraiseOrderMeta();
76 noHiddenAddressMeta.setUid(uid); 92 noHiddenAddressMeta.setUid(uid);
77 noHiddenAddressMeta.setOrderCode(orderCode); 93 noHiddenAddressMeta.setOrderCode(orderCode);
78 noHiddenAddressMeta.setMetaKey(key); 94 noHiddenAddressMeta.setMetaKey(key);
79 noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress)); 95 noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress));
80 //hidden address 96 //hidden address
81 - BuyerOrderMeta hiddenAddressMeta=new BuyerOrderMeta(); 97 + AppraiseOrderMeta hiddenAddressMeta = new AppraiseOrderMeta();
82 hiddenAddressMeta.setUid(uid); 98 hiddenAddressMeta.setUid(uid);
83 hiddenAddressMeta.setOrderCode(orderCode); 99 hiddenAddressMeta.setOrderCode(orderCode);
84 - hiddenAddressMeta.setMetaKey(hiiden_key); 100 + hiddenAddressMeta.setMetaKey(hidden_key);
85 hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress)); 101 hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress));
86 - List<BuyerOrderMeta> boms = new ArrayList<>(2); 102 + List<AppraiseOrderMeta> boms = new ArrayList<>(2);
87 boms.add(noHiddenAddressMeta); 103 boms.add(noHiddenAddressMeta);
88 boms.add(hiddenAddressMeta); 104 boms.add(hiddenAddressMeta);
89 - buyerOrderMetaMapper.insertBatch(boms); 105 + appraiseOrderMetaMapper.insertBatch(boms);
90 106
91 return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build(); 107 return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build();
92 } 108 }
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import com.yoho.error.ServiceError; 4 import com.yoho.error.ServiceError;
4 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
5 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; 6 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
  7 +import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
6 import com.yohobuy.ufo.model.order.common.OrderAttributes; 8 import com.yohobuy.ufo.model.order.common.OrderAttributes;
7 import com.yohobuy.ufo.model.order.common.OrderCodeType; 9 import com.yohobuy.ufo.model.order.common.OrderCodeType;
8 import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; 10 import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq;
9 import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; 11 import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq;
10 import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; 12 import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq;
11 import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; 13 import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq;
12 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp;  
13 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp;  
14 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp;  
15 -import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; 14 +import com.yohobuy.ufo.model.order.resp.*;
16 import com.yohobuy.ufo.model.order.vo.AddressInfo; 15 import com.yohobuy.ufo.model.order.vo.AddressInfo;
17 import com.yohoufo.common.exception.UfoServiceException; 16 import com.yohoufo.common.exception.UfoServiceException;
18 import com.yohoufo.common.utils.AddressUtil; 17 import com.yohoufo.common.utils.AddressUtil;
  18 +import com.yohoufo.common.utils.DateUtil;
19 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; 19 import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
20 import com.yohoufo.dal.order.AppraiseOrderMapper; 20 import com.yohoufo.dal.order.AppraiseOrderMapper;
  21 +import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
  22 +import com.yohoufo.dal.order.model.AppraiseOrder;
  23 +import com.yohoufo.dal.order.model.AppraiseOrderGoods;
  24 +import com.yohoufo.dal.order.model.AppraiseOrderMeta;
  25 +import com.yohoufo.dal.order.model.QiniuLiveRecord;
  26 +import com.yohoufo.order.common.ClientType;
  27 +import com.yohoufo.order.constants.MetaKey;
  28 +import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor;
21 import com.yohoufo.order.model.dto.AppraiseOrderContext; 29 import com.yohoufo.order.model.dto.AppraiseOrderContext;
22 import com.yohoufo.order.service.proxy.UserProxyService; 30 import com.yohoufo.order.service.proxy.UserProxyService;
23 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 31 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
@@ -31,7 +39,10 @@ import org.springframework.stereotype.Service; @@ -31,7 +39,10 @@ import org.springframework.stereotype.Service;
31 39
32 import java.util.ArrayList; 40 import java.util.ArrayList;
33 import java.util.List; 41 import java.util.List;
  42 +import java.util.Map;
34 import java.util.Objects; 43 import java.util.Objects;
  44 +import java.util.function.Function;
  45 +import java.util.stream.Collectors;
35 46
36 @Service 47 @Service
37 public class AppraiseOrderService { 48 public class AppraiseOrderService {
@@ -51,7 +62,13 @@ public class AppraiseOrderService { @@ -51,7 +62,13 @@ public class AppraiseOrderService {
51 62
52 63
53 @Autowired 64 @Autowired
54 - OrderCodeGenerator orderCodeGenerator; 65 + private OrderCodeGenerator orderCodeGenerator;
  66 +
  67 + @Autowired
  68 + private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
  69 +
  70 + @Autowired
  71 + private QiniuLiveRecordService qiniuLiveRecordService;
55 72
56 73
57 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ 74 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
@@ -64,24 +81,7 @@ public class AppraiseOrderService { @@ -64,24 +81,7 @@ public class AppraiseOrderService {
64 if (productId <= 0){ 81 if (productId <= 0){
65 throw new UfoServiceException(400, "商品ID错误"); 82 throw new UfoServiceException(400, "商品ID错误");
66 } 83 }
67 - int orderType = req.getOrderType();  
68 - OrderAttributes orderAttributes = checkOrderType(orderType);  
69 - double fee = 0D;  
70 - switch (orderAttributes){  
71 - case DEPOSITE:{  
72 - fee = 15D;  
73 - break;  
74 - }  
75 -  
76 - case APPRAISE:{  
77 - fee = 31D;  
78 - break;  
79 - }  
80 - default:{  
81 - throw new UfoServiceException(400, "orderType错误");  
82 - }  
83 - }  
84 - 84 + double fee = 15D;
85 return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build(); 85 return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build();
86 } 86 }
87 87
@@ -91,6 +91,7 @@ public class AppraiseOrderService { @@ -91,6 +91,7 @@ public class AppraiseOrderService {
91 add(OrderAttributes.APPRAISE); 91 add(OrderAttributes.APPRAISE);
92 } 92 }
93 }; 93 };
  94 +
94 private OrderAttributes checkOrderType(int orderType){ 95 private OrderAttributes checkOrderType(int orderType){
95 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType); 96 OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType);
96 if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){ 97 if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){
@@ -110,8 +111,6 @@ public class AppraiseOrderService { @@ -110,8 +111,6 @@ public class AppraiseOrderService {
110 111
111 AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo(); 112 AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo();
112 //TODO dependency product service support produce data 113 //TODO dependency product service support produce data
113 -  
114 -  
115 AppraiseOrderContext aoc = AppraiseOrderContext.builder() 114 AppraiseOrderContext aoc = AppraiseOrderContext.builder()
116 .orderCode(orderCode) 115 .orderCode(orderCode)
117 .uid(pn.getUid()) 116 .uid(pn.getUid())
@@ -119,6 +118,8 @@ public class AppraiseOrderService { @@ -119,6 +118,8 @@ public class AppraiseOrderService {
119 .backAddress(pn.getNoHiddenBackAddress()) 118 .backAddress(pn.getNoHiddenBackAddress())
120 .backHiddenAddress(pn.getHiddenBackAddress()) 119 .backHiddenAddress(pn.getHiddenBackAddress())
121 .goodsBo(aog) 120 .goodsBo(aog)
  121 + .channelNo(req.getChannelNo())
  122 + .clientType(ClientType.getClientType(req.getClientType()))
122 .build(); 123 .build();
123 124
124 //2 persistent key info 125 //2 persistent key info
@@ -128,6 +129,8 @@ public class AppraiseOrderService { @@ -128,6 +129,8 @@ public class AppraiseOrderService {
128 AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc); 129 AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc);
129 130
130 //todo notice by async 131 //todo notice by async
  132 +
  133 + //resp
131 AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp(); 134 AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp();
132 aosr.setOrderCode(orderCode); 135 aosr.setOrderCode(orderCode);
133 return aosr; 136 return aosr;
@@ -143,6 +146,10 @@ public class AppraiseOrderService { @@ -143,6 +146,10 @@ public class AppraiseOrderService {
143 OrderAttributes orderAttributes; 146 OrderAttributes orderAttributes;
144 } 147 }
145 148
  149 + OrderAttributes getOrderAttributes(){
  150 + return OrderAttributes.APPRAISE;
  151 + }
  152 +
146 private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){ 153 private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){
147 int uid = req.getUid(); 154 int uid = req.getUid();
148 if (uid<=0){ 155 if (uid<=0){
@@ -152,7 +159,7 @@ public class AppraiseOrderService { @@ -152,7 +159,7 @@ public class AppraiseOrderService {
152 if (productId <= 0){ 159 if (productId <= 0){
153 throw new UfoServiceException(400, "商品ID错误"); 160 throw new UfoServiceException(400, "商品ID错误");
154 } 161 }
155 - OrderAttributes orderAttributes = OrderAttributes.APPRAISE; 162 + final OrderAttributes orderAttributes = getOrderAttributes();
156 163
157 int addressId = AddressUtil.getDecryptStr(req.getAddressId()); 164 int addressId = AddressUtil.getDecryptStr(req.getAddressId());
158 if (addressId < 0){ 165 if (addressId < 0){
@@ -179,23 +186,151 @@ public class AppraiseOrderService { @@ -179,23 +186,151 @@ public class AppraiseOrderService {
179 .build(); 186 .build();
180 } 187 }
181 188
  189 + List<Integer> getLegalStatus(){
  190 +
  191 + return new ArrayList<Integer>(){
  192 + {
  193 + add(AppraiseOrderStatus.HAS_PAYED.getCode());
  194 + add(AppraiseOrderStatus.SELLER_SEND_OUT.getCode());
  195 + add(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode());
  196 + add(AppraiseOrderStatus.JUDGE_PASS.getCode());
  197 + add(AppraiseOrderStatus.WAITING_RECEIVE.getCode());
  198 + add(AppraiseOrderStatus.CHECKING_FAKE.getCode());
  199 + add(AppraiseOrderStatus.SHAM_SEND_OUT.getCode());
  200 + add(AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode());
  201 + }
  202 + };
  203 + }
182 204
  205 + public PageResp<AppraiseOrderListResp> getOrderList(AppraiseOrderListReq req){
  206 + PageResp.PageRespBuilder respBuilder = PageResp.builder();
  207 + int uid = req.getUid();
  208 + OrderAttributes orderAttributes = getOrderAttributes();
  209 + final List<Integer> statusList = getLegalStatus();
  210 + int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList);
  211 + int limit = req.getLimit();
  212 + if (total == 0){
  213 + return respBuilder
  214 + .pageSize(limit)
  215 + .total(total)
  216 + .page(req.getPage())
  217 + .build();
  218 + }
183 219
184 - public AppraiseOrderListResp getOrderList(AppraiseOrderListReq req){ 220 + int offset = (req.getPage() - 1) * limit;
185 221
  222 + List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, offset, limit);
186 223
187 - return null; 224 + List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
  225 + List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes);
  226 + Map<Long,AppraiseOrderGoods> orderCodeAOGMap = paogs.stream().collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode, Function.identity()));
  227 + List<AppraiseOrderListResp> aolrList = orderList.parallelStream()
  228 + .map(pao-> buildAppraiseOrderListResp(pao, orderCodeAOGMap.get(pao.getOrderCode())))
  229 + .collect(Collectors.toList());
  230 +
  231 + respBuilder.page(req.getPage())
  232 + .pageSize(limit)
  233 + .total(total)
  234 + .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1))
  235 + .data(aolrList);
  236 + return respBuilder.build();
188 } 237 }
189 238
  239 + AppraiseOrderListResp buildAppraiseOrderListResp(AppraiseOrder pao, AppraiseOrderGoods paog){
  240 + Integer uid = pao.getUid();
  241 + Long orderCode = pao.getOrderCode();
  242 + Integer status = pao.getStatus();
  243 +
  244 + AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status);
  245 +
  246 +
  247 +
  248 + AppraiseOrderListResp resp = AppraiseOrderListResp.builder()
  249 + .uid(uid)
  250 + .orderCode(orderCode)
  251 + .goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog))
  252 + .buttons(Objects.nonNull(aos) ? aos.listButtons() : null)
  253 + .statuStr(Objects.nonNull(aos) ? aos.statusStr() : "")
  254 + .status(status)
  255 + .build();
  256 + return resp;
  257 + }
  258 +
  259 +
190 260
191 public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){ 261 public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){
  262 + int uid = req.getUid();
  263 + long orderCode = req.getOrderCode();
192 264
193 - return null; 265 + AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
  266 + if (Objects.isNull(pao)){
  267 + logger.warn("in getOrderDetail of appraise order null ,req {}", req);
  268 + return null;
  269 + }
  270 + Integer aoac = pao.getAttributes();
  271 + OrderAttributes oa = OrderAttributes.getOrderAttributes(aoac);
  272 + if (Objects.isNull(oa) || !getOrderAttributes().equals(oa)){
  273 + logger.warn("in getOrderDetail of appraise order attr is null ,req {}", req);
  274 + return null;
  275 + }
  276 +
  277 + AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectByOrderCode(orderCode);
  278 +
  279 +
  280 + Integer status = pao.getStatus();
  281 + AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status);
  282 + //
  283 + OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail
  284 + .builder().status(status)
  285 + .statuStr(aos.statusStr())
  286 + .detailDesc(aos.detailDesc()).build();
  287 + //
  288 + String hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS;
  289 + AppraiseOrderMeta aomc = new AppraiseOrderMeta();
  290 + aomc.setOrderCode(orderCode);
  291 + aomc.setMetaKey(hidden_key);
  292 + AppraiseOrderMeta paom = appraiseOrderMetaMapper.selectByOrderCode(aomc);
  293 + AppraiseAddressInfo appraiseAddressInfo = null;
  294 + if (Objects.nonNull(paom)){
  295 + try {
  296 + appraiseAddressInfo = JSONObject.parseObject(paom.getMetaValue(), AppraiseAddressInfo.class);
  297 + }catch (Exception ex){
  298 + logger.warn("in get detail of appraise order ");
  299 + }
  300 + }
  301 + String appraiseVideoUrl = null;
  302 + QiniuLiveRecord qiniuLiveRecord = qiniuLiveRecordService.getByOrderCode(orderCode);
  303 + if (Objects.nonNull(qiniuLiveRecord)){
  304 + appraiseVideoUrl = qiniuLiveRecord.getVideoUrl();
  305 + }
  306 + AppraiseOrderDetailResp aodResp = AppraiseOrderDetailResp.builder()
  307 + .uid(uid).orderCode(orderCode)
  308 + .statusDetail(statusDetail)
  309 + .createTime(DateUtil.formatDate(pao.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS))
  310 + .goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog))
  311 + .appraiseAddress(appraiseAddressInfo)
  312 + .appraiseVideoUrl(appraiseVideoUrl)
  313 + .build();
  314 + return aodResp;
194 } 315 }
195 316
  317 + /**
  318 + * 是否付费鉴定订单
  319 + * @param uid
  320 + * @param orderCode
  321 + * @return
  322 + */
196 public boolean isAppraiseOrder(int uid, long orderCode){ 323 public boolean isAppraiseOrder(int uid, long orderCode){
197 -  
198 - return false; 324 + AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
  325 + Integer aoac = null;
  326 + OrderAttributes oa = null;
  327 + boolean flag = Objects.nonNull(pao)
  328 + && Objects.nonNull(aoac=pao.getAttributes())
  329 + && Objects.nonNull(oa = OrderAttributes.getOrderAttributes(aoac))
  330 + && Objects.equals(oa, OrderAttributes.APPRAISE);
  331 + logger.info("in isAppraiseOrder uid {} orderCode {} aoac {} oa {} flag {}",
  332 + uid, orderCode, aoac, oa, flag);
  333 + return flag;
199 } 334 }
200 335
201 /** 336 /**
@@ -208,7 +343,7 @@ public class AppraiseOrderService { @@ -208,7 +343,7 @@ public class AppraiseOrderService {
208 } 343 }
209 344
210 /** 345 /**
211 - * 346 + * 平台收货
212 * @param orderCode 347 * @param orderCode
213 */ 348 */
214 public void platformReceiveGoods(long orderCode){ 349 public void platformReceiveGoods(long orderCode){
@@ -216,7 +351,7 @@ public class AppraiseOrderService { @@ -216,7 +351,7 @@ public class AppraiseOrderService {
216 } 351 }
217 352
218 /** 353 /**
219 - * 354 + * 鉴定通过
220 * @param orderCode 355 * @param orderCode
221 */ 356 */
222 public void appraisePass(long orderCode){ 357 public void appraisePass(long orderCode){
@@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService { @@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService {
547 * @return 547 * @return
548 */ 548 */
549 public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) { 549 public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) {
550 - int result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60, DateUtil.getCurrentTimeSecond()); 550 +
  551 + StorageDeposit deposit = storageDepositMapper.selectByPrimaryKey(depositId);
  552 + int currentTimeSecond = DateUtil.getCurrentTimeSecond();
  553 + int result;
  554 + if (deposit.getDepositEndTime() <= currentTimeSecond) { // 如果当前库存记录已经过期,则按当前时间加续约时长
  555 + result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + currentTimeSecond, currentTimeSecond);
  556 + } else { // 如果当前库存记录未过期,则按库存结束时间加续约时长
  557 + result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + deposit.getDepositEndTime(), currentTimeSecond);
  558 + }
  559 +
551 clearDepositCache(depositCode, uid); 560 clearDepositCache(depositCode, uid);
552 return result; 561 return result;
553 } 562 }
@@ -83,7 +83,7 @@ public class QiniuLiveRecordService { @@ -83,7 +83,7 @@ public class QiniuLiveRecordService {
83 qiniuLiveRecordMapper.insert(qiniuLiveRecords); 83 qiniuLiveRecordMapper.insert(qiniuLiveRecords);
84 } 84 }
85 85
86 - public QiniuLiveRecord selectByOrderCodes(Long orderCode) { 86 + public QiniuLiveRecord getByOrderCode(Long orderCode) {
87 if (null == orderCode) { 87 if (null == orderCode) {
88 return null; 88 return null;
89 } 89 }
  1 +package com.yohoufo.order.service.seller.deposit;
  2 +
  3 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderComputeReq;
  4 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderDetailReq;
  5 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq;
  6 +import com.yohobuy.ufo.model.order.req.SellerDepositOrderSubmitReq;
  7 +import com.yohobuy.ufo.model.order.resp.*;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +@Service
  11 +public class SellerDepositOrderService {
  12 +
  13 + public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){
  14 + return null;
  15 + }
  16 +
  17 +
  18 + public SellerDepositOrderSubmitResp submit(SellerDepositOrderSubmitReq req){
  19 + return null;
  20 + }
  21 +
  22 +
  23 +
  24 + public PageResp<SellerDepositOrderListResp> getOrderList(SellerDepositOrderListReq req ){
  25 + return null;
  26 + }
  27 +
  28 +
  29 + public SellerDepositOrderDetailResp getOrderDetail(SellerDepositOrderDetailReq req){
  30 + return null;
  31 + }
  32 +}
@@ -115,6 +115,8 @@ datasources: @@ -115,6 +115,8 @@ datasources:
115 - com.yohoufo.dal.order.AlipayBlackUserMapper 115 - com.yohoufo.dal.order.AlipayBlackUserMapper
116 - com.yohoufo.dal.order.AppraiseOrderMapper 116 - com.yohoufo.dal.order.AppraiseOrderMapper
117 - com.yohoufo.dal.order.AppraiseOrderGoodsMapper 117 - com.yohoufo.dal.order.AppraiseOrderGoodsMapper
  118 + - com.yohoufo.dal.order.AppraiseOrderMetaMapper
  119 + - com.yohoufo.dal.order.AppraiseOrderStorageMapper
118 120
119 ufo_promotion: 121 ufo_promotion:
120 servers: 122 servers:
@@ -114,6 +114,8 @@ datasources: @@ -114,6 +114,8 @@ datasources:
114 - com.yohoufo.dal.order.AlipayBlackUserMapper 114 - com.yohoufo.dal.order.AlipayBlackUserMapper
115 - com.yohoufo.dal.order.AppraiseOrderMapper 115 - com.yohoufo.dal.order.AppraiseOrderMapper
116 - com.yohoufo.dal.order.AppraiseOrderGoodsMapper 116 - com.yohoufo.dal.order.AppraiseOrderGoodsMapper
  117 + - com.yohoufo.dal.order.AppraiseOrderMetaMapper
  118 + - com.yohoufo.dal.order.AppraiseOrderStorageMapper
117 119
118 ufo_promotion: 120 ufo_promotion:
119 servers: 121 servers: