Showing
21 changed files
with
454 additions
and
69 deletions
@@ -70,12 +70,6 @@ | @@ -70,12 +70,6 @@ | ||
70 | <artifactId>yoho-message-sdk</artifactId> | 70 | <artifactId>yoho-message-sdk</artifactId> |
71 | <version>1.0.0-SNAPSHOT</version> | 71 | <version>1.0.0-SNAPSHOT</version> |
72 | </dependency> | 72 | </dependency> |
73 | - <dependency> | ||
74 | - <groupId>com.yoho.service.model</groupId> | ||
75 | - <artifactId>union-service-model</artifactId> | ||
76 | - </dependency> | ||
77 | </dependencies> | 73 | </dependencies> |
78 | 74 | ||
79 | - | ||
80 | - | ||
81 | </project> | 75 | </project> |
@@ -13,6 +13,8 @@ public interface IOrdersMapper { | @@ -13,6 +13,8 @@ public interface IOrdersMapper { | ||
13 | 13 | ||
14 | List<Orders> selectByOrderCode(@Param("orderCode") long orderCode); | 14 | List<Orders> selectByOrderCode(@Param("orderCode") long orderCode); |
15 | 15 | ||
16 | + List<Orders> selectByOrderCodeList(@Param("list") List<Long> list); | ||
17 | + | ||
16 | /** | 18 | /** |
17 | * 查询某用户一段时间以来的已交寄订单 | 19 | * 查询某用户一段时间以来的已交寄订单 |
18 | * @param uid | 20 | * @param uid |
@@ -2,8 +2,14 @@ package com.yoho.unions.dal; | @@ -2,8 +2,14 @@ package com.yoho.unions.dal; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.yoho.unions.dal.model.OrdersAccessOry; | 4 | import com.yoho.unions.dal.model.OrdersAccessOry; |
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | +import java.util.Set; | ||
5 | 9 | ||
6 | public interface OrdersAccessOryMapper { | 10 | public interface OrdersAccessOryMapper { |
7 | 11 | ||
8 | OrdersAccessOry selectByPrimaryKey(Long orderCode); | 12 | OrdersAccessOry selectByPrimaryKey(Long orderCode); |
13 | + | ||
14 | + List<OrdersAccessOry> selectByOrderCodeList(@Param("list") List<Long> orderCode); | ||
9 | } | 15 | } |
@@ -2,9 +2,15 @@ package com.yoho.unions.dal; | @@ -2,9 +2,15 @@ package com.yoho.unions.dal; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.yoho.unions.dal.model.OrdersCoupons; | 4 | import com.yoho.unions.dal.model.OrdersCoupons; |
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | +import java.util.Set; | ||
5 | 9 | ||
6 | public interface OrdersCouponsMapper { | 10 | public interface OrdersCouponsMapper { |
7 | 11 | ||
8 | OrdersCoupons selectByOrderCode(Long orderCode); | 12 | OrdersCoupons selectByOrderCode(Long orderCode); |
9 | 13 | ||
14 | + List<OrdersCoupons> selectByOrderCodeList(@Param("list") List<Long> orderCode); | ||
15 | + | ||
10 | } | 16 | } |
@@ -11,6 +11,8 @@ import java.util.List; | @@ -11,6 +11,8 @@ import java.util.List; | ||
11 | */ | 11 | */ |
12 | public class OrdersDetailBO extends BaseBO{ | 12 | public class OrdersDetailBO extends BaseBO{ |
13 | 13 | ||
14 | + private Long orderCode; | ||
15 | + | ||
14 | private Orders orders; | 16 | private Orders orders; |
15 | 17 | ||
16 | private String unionId; | 18 | private String unionId; |
@@ -40,4 +42,12 @@ public class OrdersDetailBO extends BaseBO{ | @@ -40,4 +42,12 @@ public class OrdersDetailBO extends BaseBO{ | ||
40 | public void setOrders(Orders orders) { | 42 | public void setOrders(Orders orders) { |
41 | this.orders = orders; | 43 | this.orders = orders; |
42 | } | 44 | } |
45 | + | ||
46 | + public Long getOrderCode() { | ||
47 | + return orderCode; | ||
48 | + } | ||
49 | + | ||
50 | + public void setOrderCode(Long orderCode) { | ||
51 | + this.orderCode = orderCode; | ||
52 | + } | ||
43 | } | 53 | } |
1 | +package com.yoho.unions.dal.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | + | ||
5 | +public class OrdersFreightCoupons { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Long orderCode; | ||
9 | + | ||
10 | + private Integer couponId; | ||
11 | + | ||
12 | + private Byte couponType; | ||
13 | + | ||
14 | + private String couponCode; | ||
15 | + | ||
16 | + private BigDecimal couponAmount; | ||
17 | + | ||
18 | + private BigDecimal couponAdjustAmount; | ||
19 | + | ||
20 | + private String couponTitle; | ||
21 | + | ||
22 | + private Byte feeSharingType; | ||
23 | + | ||
24 | + private BigDecimal feeSharingRatio; | ||
25 | + | ||
26 | + private Integer createTime; | ||
27 | + | ||
28 | + public Integer getId() { | ||
29 | + return id; | ||
30 | + } | ||
31 | + | ||
32 | + public void setId(Integer id) { | ||
33 | + this.id = id; | ||
34 | + } | ||
35 | + | ||
36 | + public Long getOrderCode() { | ||
37 | + return orderCode; | ||
38 | + } | ||
39 | + | ||
40 | + public void setOrderCode(Long orderCode) { | ||
41 | + this.orderCode = orderCode; | ||
42 | + } | ||
43 | + | ||
44 | + public Integer getCouponId() { | ||
45 | + return couponId; | ||
46 | + } | ||
47 | + | ||
48 | + public void setCouponId(Integer couponId) { | ||
49 | + this.couponId = couponId; | ||
50 | + } | ||
51 | + | ||
52 | + public Byte getCouponType() { | ||
53 | + return couponType; | ||
54 | + } | ||
55 | + | ||
56 | + public void setCouponType(Byte couponType) { | ||
57 | + this.couponType = couponType; | ||
58 | + } | ||
59 | + | ||
60 | + public String getCouponCode() { | ||
61 | + return couponCode; | ||
62 | + } | ||
63 | + | ||
64 | + public void setCouponCode(String couponCode) { | ||
65 | + this.couponCode = couponCode == null ? null : couponCode.trim(); | ||
66 | + } | ||
67 | + | ||
68 | + public BigDecimal getCouponAmount() { | ||
69 | + return couponAmount; | ||
70 | + } | ||
71 | + | ||
72 | + public void setCouponAmount(BigDecimal couponAmount) { | ||
73 | + this.couponAmount = couponAmount; | ||
74 | + } | ||
75 | + | ||
76 | + public BigDecimal getCouponAdjustAmount() { | ||
77 | + return couponAdjustAmount; | ||
78 | + } | ||
79 | + | ||
80 | + public void setCouponAdjustAmount(BigDecimal couponAdjustAmount) { | ||
81 | + this.couponAdjustAmount = couponAdjustAmount; | ||
82 | + } | ||
83 | + | ||
84 | + public String getCouponTitle() { | ||
85 | + return couponTitle; | ||
86 | + } | ||
87 | + | ||
88 | + public void setCouponTitle(String couponTitle) { | ||
89 | + this.couponTitle = couponTitle == null ? null : couponTitle.trim(); | ||
90 | + } | ||
91 | + | ||
92 | + public Byte getFeeSharingType() { | ||
93 | + return feeSharingType; | ||
94 | + } | ||
95 | + | ||
96 | + public void setFeeSharingType(Byte feeSharingType) { | ||
97 | + this.feeSharingType = feeSharingType; | ||
98 | + } | ||
99 | + | ||
100 | + public BigDecimal getFeeSharingRatio() { | ||
101 | + return feeSharingRatio; | ||
102 | + } | ||
103 | + | ||
104 | + public void setFeeSharingRatio(BigDecimal feeSharingRatio) { | ||
105 | + this.feeSharingRatio = feeSharingRatio; | ||
106 | + } | ||
107 | + | ||
108 | + public Integer getCreateTime() { | ||
109 | + return createTime; | ||
110 | + } | ||
111 | + | ||
112 | + public void setCreateTime(Integer createTime) { | ||
113 | + this.createTime = createTime; | ||
114 | + } | ||
115 | +} |
1 | +package com.yoho.unions.dal.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | + | ||
5 | +public class OrdersGiftCard { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Long orderCode; | ||
9 | + | ||
10 | + private String code; | ||
11 | + | ||
12 | + private BigDecimal payAmount; | ||
13 | + | ||
14 | + private BigDecimal payShippingAmount; | ||
15 | + | ||
16 | + private Integer createTime; | ||
17 | + | ||
18 | + public Integer getId() { | ||
19 | + return id; | ||
20 | + } | ||
21 | + | ||
22 | + public void setId(Integer id) { | ||
23 | + this.id = id; | ||
24 | + } | ||
25 | + | ||
26 | + public Long getOrderCode() { | ||
27 | + return orderCode; | ||
28 | + } | ||
29 | + | ||
30 | + public void setOrderCode(Long orderCode) { | ||
31 | + this.orderCode = orderCode; | ||
32 | + } | ||
33 | + | ||
34 | + public String getCode() { | ||
35 | + return code; | ||
36 | + } | ||
37 | + | ||
38 | + public void setCode(String code) { | ||
39 | + this.code = code == null ? null : code.trim(); | ||
40 | + } | ||
41 | + | ||
42 | + public BigDecimal getPayAmount() { | ||
43 | + return payAmount; | ||
44 | + } | ||
45 | + | ||
46 | + public void setPayAmount(BigDecimal payAmount) { | ||
47 | + this.payAmount = payAmount; | ||
48 | + } | ||
49 | + | ||
50 | + public BigDecimal getPayShippingAmount() { | ||
51 | + return payShippingAmount; | ||
52 | + } | ||
53 | + | ||
54 | + public void setPayShippingAmount(BigDecimal payShippingAmount) { | ||
55 | + this.payShippingAmount = payShippingAmount; | ||
56 | + } | ||
57 | + | ||
58 | + public Integer getCreateTime() { | ||
59 | + return createTime; | ||
60 | + } | ||
61 | + | ||
62 | + public void setCreateTime(Integer createTime) { | ||
63 | + this.createTime = createTime; | ||
64 | + } | ||
65 | +} |
1 | +package com.yoho.unions.dal.model; | ||
2 | + | ||
3 | +import com.yoho.service.model.union.BaseBO; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by zhengwen.ge on 2017/12/15. | ||
7 | + */ | ||
8 | +public class UserOrderDatailBO extends BaseBO { | ||
9 | + | ||
10 | + private Long orderCode; | ||
11 | + | ||
12 | + private String unionId; | ||
13 | + | ||
14 | + private String unionName; | ||
15 | + | ||
16 | + public Long getOrderCode() { | ||
17 | + return orderCode; | ||
18 | + } | ||
19 | + | ||
20 | + public void setOrderCode(Long orderCode) { | ||
21 | + this.orderCode = orderCode; | ||
22 | + } | ||
23 | + | ||
24 | + public String getUnionId() { | ||
25 | + return unionId; | ||
26 | + } | ||
27 | + | ||
28 | + public void setUnionId(String unionId) { | ||
29 | + this.unionId = unionId; | ||
30 | + } | ||
31 | + | ||
32 | + public String getUnionName() { | ||
33 | + return unionName; | ||
34 | + } | ||
35 | + | ||
36 | + public void setUnionName(String unionName) { | ||
37 | + this.unionName = unionName; | ||
38 | + } | ||
39 | +} |
@@ -45,6 +45,14 @@ | @@ -45,6 +45,14 @@ | ||
45 | from orders | 45 | from orders |
46 | where parent_order_code = #{orderCode,jdbcType=BIGINT} | 46 | where parent_order_code = #{orderCode,jdbcType=BIGINT} |
47 | </select> | 47 | </select> |
48 | + | ||
49 | + <select id="selectByOrderCodeList" resultMap="BaseResultMap"> | ||
50 | + select <include refid="Base_Column_List" /> | ||
51 | + from orders where parent_order_code in | ||
52 | + <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> | ||
53 | + #{item} | ||
54 | + </foreach> | ||
55 | + </select> | ||
48 | 56 | ||
49 | <select id="selectCountShipStatusOrderSince" resultType="java.lang.Integer"> | 57 | <select id="selectCountShipStatusOrderSince" resultType="java.lang.Integer"> |
50 | select count(1) | 58 | select count(1) |
@@ -26,4 +26,12 @@ | @@ -26,4 +26,12 @@ | ||
26 | from orders_accessory | 26 | from orders_accessory |
27 | where order_code = #{orderCode,jdbcType=BIGINT} | 27 | where order_code = #{orderCode,jdbcType=BIGINT} |
28 | </select> | 28 | </select> |
29 | + | ||
30 | + <select id="selectByOrderCodeList" resultMap="BaseResultMap"> | ||
31 | + select <include refid="Base_Column_List" /> | ||
32 | + from orders_accessory where order_code in | ||
33 | + <foreach collection="list" item="item" separator="," index="index" open="(" close=")"> | ||
34 | + #{item} | ||
35 | + </foreach> | ||
36 | + </select> | ||
29 | </mapper> | 37 | </mapper> |
@@ -22,4 +22,13 @@ | @@ -22,4 +22,13 @@ | ||
22 | where order_code = #{orderCode,jdbcType=BIGINT} | 22 | where order_code = #{orderCode,jdbcType=BIGINT} |
23 | </select> | 23 | </select> |
24 | 24 | ||
25 | + <select id="selectByOrderCodeList" resultMap="BaseResultMap"> | ||
26 | + select <include refid="Base_Column_List" /> | ||
27 | + from orders_coupons | ||
28 | + where order_code in | ||
29 | + <foreach collection="list" item="item" index="index" separator="," open="(" close=")"> | ||
30 | + #{item} | ||
31 | + </foreach> | ||
32 | + </select> | ||
33 | + | ||
25 | </mapper> | 34 | </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.yoho.unions.dal.OrdersFreightCouponsMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.OrdersFreightCoupons" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="order_code" property="orderCode" jdbcType="BIGINT" /> | ||
7 | + <result column="coupon_id" property="couponId" jdbcType="INTEGER" /> | ||
8 | + <result column="coupon_type" property="couponType" jdbcType="TINYINT" /> | ||
9 | + <result column="coupon_code" property="couponCode" jdbcType="VARCHAR" /> | ||
10 | + <result column="coupon_amount" property="couponAmount" jdbcType="DECIMAL" /> | ||
11 | + <result column="coupon_adjust_amount" property="couponAdjustAmount" jdbcType="DECIMAL" /> | ||
12 | + <result column="coupon_title" property="couponTitle" jdbcType="VARCHAR" /> | ||
13 | + <result column="fee_sharing_type" property="feeSharingType" jdbcType="TINYINT" /> | ||
14 | + <result column="fee_sharing_ratio" property="feeSharingRatio" jdbcType="DECIMAL" /> | ||
15 | + <result column="create_time" property="createTime" jdbcType="INTEGER" /> | ||
16 | + </resultMap> | ||
17 | + <sql id="Base_Column_List" > | ||
18 | + id, order_code, coupon_id, coupon_type, coupon_code, coupon_amount, coupon_adjust_amount, | ||
19 | + coupon_title, fee_sharing_type, fee_sharing_ratio, create_time | ||
20 | + </sql> | ||
21 | + | ||
22 | + <select id="selectCouponAmount" resultType="java.math.BigDecimal"> | ||
23 | + select IFNULL(sum(coupon_amount),0) from orders_freight_coupons where order_code = #{orderCode} | ||
24 | + </select> | ||
25 | +</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.yoho.unions.dal.OrdersGiftCardMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.OrdersGiftCard" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="order_code" property="orderCode" jdbcType="BIGINT" /> | ||
7 | + <result column="code" property="code" jdbcType="VARCHAR" /> | ||
8 | + <result column="pay_amount" property="payAmount" jdbcType="DECIMAL" /> | ||
9 | + <result column="pay_shipping_amount" property="payShippingAmount" jdbcType="DECIMAL" /> | ||
10 | + <result column="create_time" property="createTime" jdbcType="INTEGER" /> | ||
11 | + </resultMap> | ||
12 | + <sql id="Base_Column_List" > | ||
13 | + id, order_code, code, pay_amount, pay_shipping_amount, create_time | ||
14 | + </sql> | ||
15 | + | ||
16 | + <select id="selectPayShippingAmount" resultType="java.math.BigDecimal"> | ||
17 | + select IFNULL(sum(pay_shipping_amount), 0) from orders_gift_card where order_code = #{orderCode} | ||
18 | + </select> | ||
19 | +</mapper> |
@@ -44,6 +44,7 @@ | @@ -44,6 +44,7 @@ | ||
44 | from user_orders | 44 | from user_orders |
45 | where order_code = #{orderCode} limit 1 | 45 | where order_code = #{orderCode} limit 1 |
46 | </select> | 46 | </select> |
47 | + | ||
47 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 48 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
48 | delete from user_orders | 49 | delete from user_orders |
49 | where id = #{id,jdbcType=INTEGER} | 50 | where id = #{id,jdbcType=INTEGER} |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <parent> | 5 | <parent> |
6 | <groupId>com.yoho</groupId> | 6 | <groupId>com.yoho</groupId> |
7 | <artifactId>parent</artifactId> | 7 | <artifactId>parent</artifactId> |
8 | - <version>1.2.6-SNAPSHOT</version> | 8 | + <version>1.3.1-SNAPSHOT</version> |
9 | </parent> | 9 | </parent> |
10 | <groupId>com.yoho.dsf</groupId> | 10 | <groupId>com.yoho.dsf</groupId> |
11 | <artifactId>yoho-unions</artifactId> | 11 | <artifactId>yoho-unions</artifactId> |
@@ -61,16 +61,6 @@ | @@ -61,16 +61,6 @@ | ||
61 | <groupId>com.yoho.service.model</groupId> | 61 | <groupId>com.yoho.service.model</groupId> |
62 | <artifactId>union-service-model</artifactId> | 62 | <artifactId>union-service-model</artifactId> |
63 | </dependency> | 63 | </dependency> |
64 | - <dependency> | ||
65 | - <groupId>com.yoho.service.model</groupId> | ||
66 | - <artifactId>union-service-model</artifactId> | ||
67 | - <version>1.2.6-SNAPSHOT</version> | ||
68 | - </dependency> | ||
69 | - <dependency> | ||
70 | - <groupId>com.yoho.service.model</groupId> | ||
71 | - <artifactId>union-service-model</artifactId> | ||
72 | - <version>1.2.6-SNAPSHOT</version> | ||
73 | - </dependency> | ||
74 | </dependencies> | 64 | </dependencies> |
75 | 65 | ||
76 | <build> | 66 | <build> |
@@ -2,6 +2,8 @@ package com.yoho.unions.server.service.impl; | @@ -2,6 +2,8 @@ package com.yoho.unions.server.service.impl; | ||
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONException; | 3 | import com.alibaba.fastjson.JSONException; |
4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
5 | +import com.google.common.base.Function; | ||
6 | +import com.google.common.collect.Maps; | ||
5 | import com.yoho.error.exception.ServiceException; | 7 | import com.yoho.error.exception.ServiceException; |
6 | import com.yoho.service.model.response.PageResponseBO; | 8 | import com.yoho.service.model.response.PageResponseBO; |
7 | import com.yoho.service.model.union.request.ChannelUserBO; | 9 | import com.yoho.service.model.union.request.ChannelUserBO; |
@@ -18,7 +20,9 @@ import com.yoho.unions.common.utils.DateUtil; | @@ -18,7 +20,9 @@ import com.yoho.unions.common.utils.DateUtil; | ||
18 | import com.yoho.unions.dal.*; | 20 | import com.yoho.unions.dal.*; |
19 | import com.yoho.unions.dal.model.*; | 21 | import com.yoho.unions.dal.model.*; |
20 | import com.yoho.unions.server.service.IUserOrdersService; | 22 | import com.yoho.unions.server.service.IUserOrdersService; |
23 | +import com.yoho.unions.vo.OrderInfo; | ||
21 | import org.apache.commons.collections.CollectionUtils; | 24 | import org.apache.commons.collections.CollectionUtils; |
25 | +import org.apache.commons.collections.map.HashedMap; | ||
22 | import org.apache.commons.lang3.StringUtils; | 26 | import org.apache.commons.lang3.StringUtils; |
23 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
24 | import org.slf4j.LoggerFactory; | 28 | import org.slf4j.LoggerFactory; |
@@ -28,9 +32,7 @@ import org.springframework.stereotype.Service; | @@ -28,9 +32,7 @@ import org.springframework.stereotype.Service; | ||
28 | 32 | ||
29 | import javax.annotation.Resource; | 33 | import javax.annotation.Resource; |
30 | import java.math.BigDecimal; | 34 | import java.math.BigDecimal; |
31 | -import java.util.ArrayList; | ||
32 | -import java.util.Arrays; | ||
33 | -import java.util.List; | 35 | +import java.util.*; |
34 | import java.util.concurrent.TimeUnit; | 36 | import java.util.concurrent.TimeUnit; |
35 | 37 | ||
36 | /** | 38 | /** |
@@ -51,70 +53,116 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -51,70 +53,116 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
51 | @Autowired | 53 | @Autowired |
52 | IMktMarketingUrlDAO mktMarketingUrlDAO; | 54 | IMktMarketingUrlDAO mktMarketingUrlDAO; |
53 | @Autowired | 55 | @Autowired |
56 | + OrdersFreightCouponsMapper ordersFreightCouponsMapper; | ||
57 | + @Autowired | ||
58 | + OrdersGiftCardMapper ordersGiftCardMapper; | ||
59 | + @Autowired | ||
54 | OrdersAccessOryMapper ordersAccessOryMapper; | 60 | OrdersAccessOryMapper ordersAccessOryMapper; |
55 | @Resource | 61 | @Resource |
56 | RedisValueCache redisValueCache; | 62 | RedisValueCache redisValueCache; |
57 | 63 | ||
58 | 64 | ||
59 | - public PageUnionOrderRspBO queryUnionOrders(UnionOrderReqBO reqBO){ | ||
60 | - logger.info("queryUnionOrders param is {}",reqBO); | ||
61 | - int beginTime = StringUtils.isBlank(reqBO.getBeginTime())?0:Integer.valueOf(reqBO.getBeginTime()); | ||
62 | - int endTime = StringUtils.isBlank(reqBO.getEndTime())?0:Integer.valueOf(reqBO.getEndTime()); | ||
63 | - int orderCode =StringUtils.isBlank(reqBO.getOrderCode())?0:Integer.valueOf(reqBO.getOrderCode()); | ||
64 | - String unionId = StringUtils.isBlank(reqBO.getUnionId())?null:reqBO.getUnionId(); | 65 | + public PageUnionOrderRspBO queryUnionOrders(UnionOrderReqBO reqBO) { |
66 | + logger.info("queryUnionOrders param is {}", reqBO); | ||
67 | + int beginTime = StringUtils.isBlank(reqBO.getBeginTime()) ? 0 : Integer.valueOf(reqBO.getBeginTime()); | ||
68 | + int endTime = StringUtils.isBlank(reqBO.getEndTime()) ? 0 : Integer.valueOf(reqBO.getEndTime()); | ||
69 | + int orderCode = StringUtils.isBlank(reqBO.getOrderCode()) ? 0 : Integer.valueOf(reqBO.getOrderCode()); | ||
70 | + String unionId = StringUtils.isBlank(reqBO.getUnionId()) ? null : reqBO.getUnionId(); | ||
65 | String unionType = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType(); | 71 | String unionType = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType(); |
66 | List<String> idList = new ArrayList<>(); | 72 | List<String> idList = new ArrayList<>(); |
67 | - if(StringUtils.isNotBlank(reqBO.getIds())){ | ||
68 | - String[] ids = StringUtils.isBlank(reqBO.getIds())? null: reqBO.getIds().split(","); | 73 | + if (StringUtils.isNotBlank(reqBO.getIds())) { |
74 | + String[] ids = StringUtils.isBlank(reqBO.getIds()) ? null : reqBO.getIds().split(","); | ||
69 | idList = Arrays.asList(ids); | 75 | idList = Arrays.asList(ids); |
70 | } | 76 | } |
71 | 77 | ||
72 | - if(StringUtils.isNotEmpty(unionType)){ | 78 | + if (StringUtils.isNotEmpty(unionType)) { |
73 | MktMarketingUrl mktMarketingUrl = mktMarketingUrlDAO.selectByName(unionType); | 79 | MktMarketingUrl mktMarketingUrl = mktMarketingUrlDAO.selectByName(unionType); |
74 | - if(null!=mktMarketingUrl){ | 80 | + if (null != mktMarketingUrl) { |
75 | String mktMarkeringUnionId = String.valueOf(mktMarketingUrl.getUnionType()); | 81 | String mktMarkeringUnionId = String.valueOf(mktMarketingUrl.getUnionType()); |
76 | - if(StringUtils.isEmpty(unionId)){ | 82 | + if (StringUtils.isEmpty(unionId)) { |
77 | unionId = mktMarkeringUnionId; | 83 | unionId = mktMarkeringUnionId; |
78 | } | 84 | } |
79 | - if(StringUtils.isNotEmpty(unionId)&&!unionId.equals(mktMarkeringUnionId)){ | 85 | + if (StringUtils.isNotEmpty(unionId) && !unionId.equals(mktMarkeringUnionId)) { |
80 | return null; | 86 | return null; |
81 | } | 87 | } |
82 | } | 88 | } |
83 | } | 89 | } |
84 | //查询总数 | 90 | //查询总数 |
85 | - int count = userOrdersDAO.selectCount(beginTime,endTime,String.valueOf(orderCode),unionId,idList); | 91 | + int count = userOrdersDAO.selectCount(beginTime, endTime, String.valueOf(orderCode), unionId, idList); |
86 | logger.info("userOrdersDAO.selectCount: size is {}", count); | 92 | logger.info("userOrdersDAO.selectCount: size is {}", count); |
87 | List<UserOrders> userOrdersList = new ArrayList<>(); | 93 | List<UserOrders> userOrdersList = new ArrayList<>(); |
88 | List<UnionOrderRspBO> unionOrderRspBOList = new ArrayList<>(); | 94 | List<UnionOrderRspBO> unionOrderRspBOList = new ArrayList<>(); |
89 | - if(count>0){ | ||
90 | - userOrdersList = userOrdersDAO.selectUserOrderList(beginTime,endTime,String.valueOf(orderCode),unionId,idList,reqBO.getStart(),reqBO.getSize()); | 95 | + if (count < 1) { |
96 | + return null; | ||
97 | + } | ||
98 | + if (count > 0) { | ||
99 | + userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), unionId, idList, reqBO.getStart(), reqBO.getSize()); | ||
91 | } | 100 | } |
92 | List<OrdersDetailBO> ordersDetailBOList = new ArrayList<>(); | 101 | List<OrdersDetailBO> ordersDetailBOList = new ArrayList<>(); |
102 | + List<Long> orderCodeList = new ArrayList<>(); | ||
103 | + List<UserOrderDatailBO> userOrderDatailBOList = new ArrayList<>(); | ||
93 | for (UserOrders userOrders : userOrdersList) { | 104 | for (UserOrders userOrders : userOrdersList) { |
94 | //根据查询出来的uid,ordercode,查询ERP_ORDERS.Orders | 105 | //根据查询出来的uid,ordercode,查询ERP_ORDERS.Orders |
95 | -// Orders orders = ordersMapper.selectByUidAndOrderCode(userOrders.getuId(),Long.valueOf(userOrders.getOrderCode())); | ||
96 | - List<Orders> order = ordersMapper.selectByOrderCode(Long.valueOf(userOrders.getOrderCode())); | ||
97 | - for(Orders orders:order){ | ||
98 | - OrdersDetailBO ordersDetailBO = new OrdersDetailBO(); | ||
99 | - ordersDetailBO.setOrders(orders); | ||
100 | - ordersDetailBO.setUnionId(userOrders.getUid()); | ||
101 | - MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:"+userOrders.getUid(),MktMarketingUrl.class); | ||
102 | - if(mktMarketingUrl==null){ | ||
103 | - mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(userOrders.getUid())); | ||
104 | - redisValueCache.set("yh:union:uniontype:"+userOrders.getUid(), mktMarketingUrl, 1, TimeUnit.HOURS); | ||
105 | - } | ||
106 | - if (mktMarketingUrl != null) { | ||
107 | - ordersDetailBO.setUnionType(mktMarketingUrl.getName()); | ||
108 | - } | ||
109 | - ordersDetailBOList.add(ordersDetailBO); | 106 | + UserOrderDatailBO userOrderDatailBO = new UserOrderDatailBO(); |
107 | + userOrderDatailBO.setUnionId(userOrders.getUid()); | ||
108 | + MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:" + userOrders.getUid(), MktMarketingUrl.class); | ||
109 | + if (mktMarketingUrl == null) { | ||
110 | + mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(userOrders.getUid())); | ||
111 | + redisValueCache.set("yh:union:uniontype:" + userOrders.getUid(), mktMarketingUrl, 1, TimeUnit.HOURS); | ||
112 | + } | ||
113 | + if (mktMarketingUrl != null) { | ||
114 | + userOrderDatailBO.setUnionName(mktMarketingUrl.getName()); | ||
115 | + } | ||
116 | + userOrderDatailBO.setOrderCode(Long.valueOf(userOrders.getOrderCode())); | ||
117 | + userOrderDatailBOList.add(userOrderDatailBO); | ||
118 | + orderCodeList.add(Long.valueOf(userOrders.getOrderCode())); | ||
119 | + } | ||
120 | + Map<Long, UserOrderDatailBO> userOrderDatailBOMap = Maps.uniqueIndex(userOrderDatailBOList, new Function<UserOrderDatailBO, Long>() { | ||
121 | + @Override | ||
122 | + public Long apply(UserOrderDatailBO userOrderDatailBO) { | ||
123 | + return userOrderDatailBO.getOrderCode(); | ||
110 | } | 124 | } |
125 | + }); | ||
126 | + //批量查询erp_orders.orders表 | ||
127 | + List<Orders> ordersList = ordersMapper.selectByOrderCodeList(orderCodeList); | ||
128 | + Map<Long, Orders> ordersMap = Maps.uniqueIndex(ordersList, new Function<Orders, Long>() { | ||
129 | + @Override | ||
130 | + public Long apply(Orders orders) { | ||
131 | + return orders.getOrderCode(); | ||
132 | + } | ||
133 | + }); | ||
134 | + List<Long> subOrderCodeList = new ArrayList<>(); | ||
111 | 135 | ||
136 | + for (Map.Entry<Long, Orders> map : ordersMap.entrySet()) { | ||
137 | + OrdersDetailBO ordersDetailBO = new OrdersDetailBO(); | ||
138 | + Orders orders = map.getValue(); | ||
139 | + ordersDetailBO.setOrders(orders); | ||
140 | + subOrderCodeList.add(map.getKey()); | ||
141 | + ordersDetailBOList.add(ordersDetailBO); | ||
112 | } | 142 | } |
143 | + | ||
144 | + //批量查询优惠券金额 | ||
145 | + List<OrdersCoupons> ordersCouponsList = ordersCouponsMapper.selectByOrderCodeList(subOrderCodeList); | ||
146 | + Map<Long, OrdersCoupons> couponsMap = Maps.uniqueIndex(ordersCouponsList, new Function<OrdersCoupons, Long>() { | ||
147 | + @Override | ||
148 | + public Long apply(OrdersCoupons ordersCoupons) { | ||
149 | + return ordersCoupons.getOrderCode(); | ||
150 | + } | ||
151 | + }); | ||
152 | + //批量查询是否新客 | ||
153 | + List<OrdersAccessOry> ordersAccessOryList = ordersAccessOryMapper.selectByOrderCodeList(subOrderCodeList); | ||
154 | + Map<Long, OrdersAccessOry> ordersAccessOryMap = Maps.uniqueIndex(ordersAccessOryList, new Function<OrdersAccessOry, Long>() { | ||
155 | + @Override | ||
156 | + public Long apply(OrdersAccessOry ordersAccessOry) { | ||
157 | + return ordersAccessOry.getOrderCode(); | ||
158 | + } | ||
159 | + }); | ||
160 | + | ||
113 | for (OrdersDetailBO ordersDetailBO : ordersDetailBOList) { | 161 | for (OrdersDetailBO ordersDetailBO : ordersDetailBOList) { |
114 | Orders orders = ordersDetailBO.getOrders(); | 162 | Orders orders = ordersDetailBO.getOrders(); |
115 | UnionOrderRspBO orderRspBO = new UnionOrderRspBO(); | 163 | UnionOrderRspBO orderRspBO = new UnionOrderRspBO(); |
116 | //优惠券金额 | 164 | //优惠券金额 |
117 | - OrdersCoupons ordersCoupons = ordersCouponsMapper.selectByOrderCode(Long.valueOf(orders.getOrderCode())); | 165 | + OrdersCoupons ordersCoupons = couponsMap.get(orders.getOrderCode()); |
118 | if (null != ordersCoupons) { | 166 | if (null != ordersCoupons) { |
119 | orderRspBO.setCouponAmount(ordersCoupons.getCouponAmount()); | 167 | orderRspBO.setCouponAmount(ordersCoupons.getCouponAmount()); |
120 | } else { | 168 | } else { |
@@ -125,14 +173,17 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -125,14 +173,17 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
125 | //订单金额 | 173 | //订单金额 |
126 | orderRspBO.setOrderAmount(orders.getOrderAmount()); | 174 | orderRspBO.setOrderAmount(orders.getOrderAmount()); |
127 | orderRspBO.setYohoCoinNum(orders.getYohoCoinNum()); | 175 | orderRspBO.setYohoCoinNum(orders.getYohoCoinNum()); |
128 | - int yohoCoin = 0; | ||
129 | - if(orders.getYohoCoinNum()>0){ | ||
130 | - yohoCoin = orders.getYohoCoinNum()/100; | ||
131 | - } | 176 | + |
177 | + //礼品卡抵运费--数据较少,暂时就用单个查询把 | ||
178 | + BigDecimal pay_shipping_amount = ordersGiftCardMapper.selectPayShippingAmount(Long.valueOf(orders.getOrderCode())); | ||
179 | + | ||
180 | + // 免邮券--数据较少,暂时就用单个查询把 | ||
181 | + BigDecimal coupon_amount = ordersFreightCouponsMapper.selectCouponAmount(Long.valueOf(orders.getOrderCode())); | ||
132 | //运费 | 182 | //运费 |
133 | - orderRspBO.setShipmentAmount(orders.getShippingCost()); | 183 | + BigDecimal realShipmentAmount = orders.getShippingCost().subtract(pay_shipping_amount).subtract(coupon_amount); |
184 | + orderRspBO.setShipmentAmount(realShipmentAmount); | ||
134 | //实际支付金额 | 185 | //实际支付金额 |
135 | - orderRspBO.setRealPayAmount(orders.getLastOrderAmount().subtract(orders.getShippingCost())); | 186 | + orderRspBO.setRealPayAmount(orders.getLastOrderAmount().subtract(realShipmentAmount)); |
136 | //订单状态 | 187 | //订单状态 |
137 | orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(String.valueOf(orders.getOrderStatus()))); | 188 | orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(String.valueOf(orders.getOrderStatus()))); |
138 | //附加信息 | 189 | //附加信息 |
@@ -140,26 +191,20 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -140,26 +191,20 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
140 | //支付方式 | 191 | //支付方式 |
141 | orderRspBO.setPayChannel(PaymentTypeEnum.getNameByCode(String.valueOf(orders.getPaymentType()))); | 192 | orderRspBO.setPayChannel(PaymentTypeEnum.getNameByCode(String.valueOf(orders.getPaymentType()))); |
142 | //是否新客---从新的表中获取 | 193 | //是否新客---从新的表中获取 |
143 | - OrdersAccessOry ordersAccessOry = ordersAccessOryMapper.selectByPrimaryKey(Long.valueOf(orders.getOrderCode())); | 194 | + OrdersAccessOry ordersAccessOry = ordersAccessOryMap.get(orders.getOrderCode()); |
144 | if (null != ordersAccessOry) { | 195 | if (null != ordersAccessOry) { |
145 | orderRspBO.setIsNew(NewUserEnum.getNameByCode(ordersAccessOry.getIsNew() == null ? "N" : ordersAccessOry.getIsNew())); | 196 | orderRspBO.setIsNew(NewUserEnum.getNameByCode(ordersAccessOry.getIsNew() == null ? "N" : ordersAccessOry.getIsNew())); |
146 | } else { | 197 | } else { |
147 | orderRspBO.setIsNew(NewUserEnum.getNameByCode("N")); | 198 | orderRspBO.setIsNew(NewUserEnum.getNameByCode("N")); |
148 | } | 199 | } |
149 | orderRspBO.setUid(orders.getUid()); | 200 | orderRspBO.setUid(orders.getUid()); |
150 | - orderRspBO.setOrderCode(orders.getOrderCode().intValue()); | 201 | + orderRspBO.setOrderCode(orders.getOrderCode()); |
151 | orderRspBO.setId(orders.getId()); | 202 | orderRspBO.setId(orders.getId()); |
152 | orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd")); | 203 | orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd")); |
153 | -// UserOrders userOrders = userOrdersDAO.selectByOrderCode(orders.getParentOrderCode()); | ||
154 | -// if(userOrders!=null){ | ||
155 | -// orderRspBO.setUnionId(userOrders.getUid()); | ||
156 | -// MktMarketingUrl mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(userOrders.getUid())); | ||
157 | -// if (mktMarketingUrl != null) { | ||
158 | -// orderRspBO.setUnionType(mktMarketingUrl.getName()); | ||
159 | -// } | ||
160 | -// } | ||
161 | - orderRspBO.setUnionId(ordersDetailBO.getUnionId()); | ||
162 | - orderRspBO.setUnionType(ordersDetailBO.getUnionType()); | 204 | +// |
205 | + UserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getParentOrderCode()); | ||
206 | + orderRspBO.setUnionId(userOrderDatailBO.getUnionId()); | ||
207 | + orderRspBO.setUnionType(userOrderDatailBO.getUnionName()); | ||
163 | unionOrderRspBOList.add(orderRspBO); | 208 | unionOrderRspBOList.add(orderRspBO); |
164 | } | 209 | } |
165 | PageUnionOrderRspBO pageUnionOrderRspBO = new PageUnionOrderRspBO(); | 210 | PageUnionOrderRspBO pageUnionOrderRspBO = new PageUnionOrderRspBO(); |
@@ -99,6 +99,16 @@ datasources: | @@ -99,6 +99,16 @@ datasources: | ||
99 | - com.yoho.unions.dal.OrdersCouponsMapper | 99 | - com.yoho.unions.dal.OrdersCouponsMapper |
100 | - com.yoho.unions.dal.OrdersAccessOryMapper | 100 | - com.yoho.unions.dal.OrdersAccessOryMapper |
101 | 101 | ||
102 | + erp_orders_new: | ||
103 | + servers: | ||
104 | + - 192.168.102.219:3306 | ||
105 | + - 192.168.102.219:3306 | ||
106 | + username: yh_test | ||
107 | + password: 9nm0icOwt6bMHjMusIfMLw== | ||
108 | + daos: | ||
109 | + - com.yoho.unions.dal.OrdersFreightCouponsMapper | ||
110 | + - com.yoho.unions.dal.OrdersGiftCardMapper | ||
111 | + | ||
102 | yh_guang: | 112 | yh_guang: |
103 | servers: | 113 | servers: |
104 | - 192.168.102.219:3306 | 114 | - 192.168.102.219:3306 |
@@ -100,6 +100,16 @@ datasources: | @@ -100,6 +100,16 @@ datasources: | ||
100 | - com.yoho.unions.dal.OrdersCouponsMapper | 100 | - com.yoho.unions.dal.OrdersCouponsMapper |
101 | - com.yoho.unions.dal.OrdersAccessOryMapper | 101 | - com.yoho.unions.dal.OrdersAccessOryMapper |
102 | 102 | ||
103 | + erp_orders_new: | ||
104 | + servers: | ||
105 | + - ${jdbc.mysql.platform.erp_orders.slave} | ||
106 | + - ${jdbc.mysql.platform.erp_orders.slave} | ||
107 | + username: ${jdbc.mysql.platform.erp_orders.username} | ||
108 | + password: ${jdbc.mysql.platform.erp_orders.password} | ||
109 | + daos: | ||
110 | + - com.yoho.unions.dal.OrdersFreightCouponsMapper | ||
111 | + - com.yoho.unions.dal.OrdersGiftCardMapper | ||
112 | + | ||
103 | yh_guang: | 113 | yh_guang: |
104 | servers: | 114 | servers: |
105 | - ${jdbc.mysql.yhguang.master} | 115 | - ${jdbc.mysql.yhguang.master} |
-
Please register or login to post a comment