Merge branch 'dev_180508_联盟红人推广' of http://git.yoho.cn/yoho30/yohobuy-union into dev_180508_联盟红人推广
Conflicts: server/src/main/java/com/yoho/unions/server/service/impl/UnionShareServiceImpl.java
Showing
24 changed files
with
796 additions
and
202 deletions
@@ -13,5 +13,7 @@ public interface IMktMarketingUrlDAO { | @@ -13,5 +13,7 @@ public interface IMktMarketingUrlDAO { | ||
13 | 13 | ||
14 | MktMarketingUrl selectByName(String name); | 14 | MktMarketingUrl selectByName(String name); |
15 | 15 | ||
16 | - List<Long> listUnionTypes(@Param("unionType")String unionType,@Param("name")String name,@Param("channelType")String channelType); | 16 | + List<Long> selectUnionTypes(@Param("unionType") Long unionType, @Param("name") String name, @Param("channelType") String channelType); |
17 | + | ||
18 | + Long selectByNameAndUnionType(@Param("name")String name,@Param("unionType")Long unionType); | ||
17 | } | 19 | } |
@@ -13,7 +13,7 @@ public interface IOrdersMapper { | @@ -13,7 +13,7 @@ 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); | 16 | + List<Orders> selectByOrderCodeList(@Param("list") Long[] list); |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * 查询某用户一段时间以来的已交寄订单 | 19 | * 查询某用户一段时间以来的已交寄订单 |
@@ -35,7 +35,7 @@ public interface IUserOrdersDAO { | @@ -35,7 +35,7 @@ public interface IUserOrdersDAO { | ||
35 | */ | 35 | */ |
36 | List<UserOrders> getExistOrderCodes(@Param("list") Set<String> list); | 36 | List<UserOrders> getExistOrderCodes(@Param("list") Set<String> list); |
37 | 37 | ||
38 | - int selectCount(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionIds") List<Long> unionIds,@Param("idList") List<String> idList); | 38 | + int selectCount(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionId") String unionId,@Param("idList") List<String> idList); |
39 | 39 | ||
40 | - List<UserOrders> selectUserOrderList(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionIds") List<Long> unionIds,@Param("idList") List<String> idList,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize); | 40 | + List<UserOrders> selectUserOrderList(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionId") String unionId,@Param("idList") List<String> idList,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize); |
41 | } | 41 | } |
@@ -5,11 +5,10 @@ import com.yoho.unions.dal.model.OrdersAccessOry; | @@ -5,11 +5,10 @@ import com.yoho.unions.dal.model.OrdersAccessOry; | ||
5 | import org.apache.ibatis.annotations.Param; | 5 | import org.apache.ibatis.annotations.Param; |
6 | 6 | ||
7 | import java.util.List; | 7 | import java.util.List; |
8 | -import java.util.Set; | ||
9 | 8 | ||
10 | public interface OrdersAccessOryMapper { | 9 | public interface OrdersAccessOryMapper { |
11 | 10 | ||
12 | OrdersAccessOry selectByPrimaryKey(Long orderCode); | 11 | OrdersAccessOry selectByPrimaryKey(Long orderCode); |
13 | 12 | ||
14 | - List<OrdersAccessOry> selectByOrderCodeList(@Param("list") List<Long> orderCode); | 13 | + List<OrdersAccessOry> selectByOrderCodeList(@Param("list") Long[] orderCode); |
15 | } | 14 | } |
@@ -5,12 +5,11 @@ import com.yoho.unions.dal.model.OrdersCoupons; | @@ -5,12 +5,11 @@ import com.yoho.unions.dal.model.OrdersCoupons; | ||
5 | import org.apache.ibatis.annotations.Param; | 5 | import org.apache.ibatis.annotations.Param; |
6 | 6 | ||
7 | import java.util.List; | 7 | import java.util.List; |
8 | -import java.util.Set; | ||
9 | 8 | ||
10 | public interface OrdersCouponsMapper { | 9 | public interface OrdersCouponsMapper { |
11 | 10 | ||
12 | OrdersCoupons selectByOrderCode(Long orderCode); | 11 | OrdersCoupons selectByOrderCode(Long orderCode); |
13 | 12 | ||
14 | - List<OrdersCoupons> selectByOrderCodeList(@Param("list") List<Long> orderCode); | 13 | + List<OrdersCoupons> selectByOrderCodeList(@Param("list") Long[] orderCode); |
15 | 14 | ||
16 | } | 15 | } |
@@ -2,10 +2,12 @@ package com.yoho.unions.dal; | @@ -2,10 +2,12 @@ package com.yoho.unions.dal; | ||
2 | 2 | ||
3 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; | 3 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; |
4 | import com.yoho.unions.dal.model.UnionShareOrders; | 4 | import com.yoho.unions.dal.model.UnionShareOrders; |
5 | +import org.apache.ibatis.annotations.MapKey; | ||
5 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
6 | 7 | ||
7 | import java.math.BigDecimal; | 8 | import java.math.BigDecimal; |
8 | import java.util.List; | 9 | import java.util.List; |
10 | +import java.util.Map; | ||
9 | 11 | ||
10 | public interface UnionShareOrdersMapper { | 12 | public interface UnionShareOrdersMapper { |
11 | int deleteByPrimaryKey(Integer id); | 13 | int deleteByPrimaryKey(Integer id); |
@@ -18,6 +20,17 @@ public interface UnionShareOrdersMapper { | @@ -18,6 +20,17 @@ public interface UnionShareOrdersMapper { | ||
18 | 20 | ||
19 | UnionShareOrders selectByCode(String orderCode); | 21 | UnionShareOrders selectByCode(String orderCode); |
20 | 22 | ||
23 | + int selectCountByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode")String orderCode); | ||
24 | + | ||
25 | + @MapKey("orderCode") | ||
26 | + Map<String,UnionShareOrders> selectListByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode") String orderCode,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize); | ||
27 | + | ||
28 | + @MapKey("orderCode") | ||
29 | + Map<String,UnionShareOrders> selectListByIds(List<String> ids); | ||
30 | + | ||
31 | + @MapKey("orderCode") | ||
32 | + Map<String,UnionShareOrders> selectAllListByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode") String orderCode); | ||
33 | + | ||
21 | int selectCountByCondition(@Param("promoteUid")int promoteUid, @Param("status")String status); | 34 | int selectCountByCondition(@Param("promoteUid")int promoteUid, @Param("status")String status); |
22 | 35 | ||
23 | BigDecimal selectAmountByStatus(@Param("promoteUid")int promoteUid, @Param("statusList")List<String> statusList); | 36 | BigDecimal selectAmountByStatus(@Param("promoteUid")int promoteUid, @Param("statusList")List<String> statusList); |
1 | package com.yoho.unions.dal; | 1 | package com.yoho.unions.dal; |
2 | 2 | ||
3 | import com.yoho.unions.dal.model.UnionShareUser; | 3 | import com.yoho.unions.dal.model.UnionShareUser; |
4 | +import org.apache.ibatis.annotations.MapKey; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
4 | 8 | ||
5 | public interface UnionShareUserMapper { | 9 | public interface UnionShareUserMapper { |
6 | int deleteByPrimaryKey(Integer id); | 10 | int deleteByPrimaryKey(Integer id); |
@@ -18,4 +22,9 @@ public interface UnionShareUserMapper { | @@ -18,4 +22,9 @@ public interface UnionShareUserMapper { | ||
18 | int updateByPrimaryKeySelective(UnionShareUser record); | 22 | int updateByPrimaryKeySelective(UnionShareUser record); |
19 | 23 | ||
20 | int updateByPrimaryKey(UnionShareUser record); | 24 | int updateByPrimaryKey(UnionShareUser record); |
25 | + | ||
26 | + List<Integer> selectUids(List<Long> unionTypes); | ||
27 | + | ||
28 | + @MapKey("uid") | ||
29 | + Map<Integer,UnionShareUser> selectByUids(List<Integer> uids); | ||
21 | } | 30 | } |
1 | +package com.yoho.unions.dal.model; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by shengguo.cai on 2018/5/15. | ||
5 | + */ | ||
6 | +public class ShareUserOrderDatailBO{ | ||
7 | + private Integer channelType; | ||
8 | + private String unionType; | ||
9 | + private String unionName; | ||
10 | + private String orderCode; | ||
11 | + public Integer getChannelType() { | ||
12 | + return channelType; | ||
13 | + } | ||
14 | + | ||
15 | + public void setChannelType(Integer channelType) { | ||
16 | + this.channelType = channelType; | ||
17 | + } | ||
18 | + | ||
19 | + public String getUnionType() { | ||
20 | + return unionType; | ||
21 | + } | ||
22 | + | ||
23 | + public void setUnionType(String unionType) { | ||
24 | + this.unionType = unionType; | ||
25 | + } | ||
26 | + | ||
27 | + public String getUnionName() { | ||
28 | + return unionName; | ||
29 | + } | ||
30 | + | ||
31 | + public void setUnionName(String unionName) { | ||
32 | + this.unionName = unionName; | ||
33 | + } | ||
34 | + | ||
35 | + public String getOrderCode() { | ||
36 | + return orderCode; | ||
37 | + } | ||
38 | + | ||
39 | + public void setOrderCode(String orderCode) { | ||
40 | + this.orderCode = orderCode; | ||
41 | + } | ||
42 | +} |
@@ -13,16 +13,6 @@ public class UserOrderDatailBO extends BaseBO { | @@ -13,16 +13,6 @@ public class UserOrderDatailBO extends BaseBO { | ||
13 | 13 | ||
14 | private String unionName; | 14 | private String unionName; |
15 | 15 | ||
16 | - private Integer channelType; | ||
17 | - | ||
18 | - public Integer getChannelType() { | ||
19 | - return channelType; | ||
20 | - } | ||
21 | - | ||
22 | - public void setChannelType(Integer channelType) { | ||
23 | - this.channelType = channelType; | ||
24 | - } | ||
25 | - | ||
26 | public Long getOrderCode() { | 16 | public Long getOrderCode() { |
27 | return orderCode; | 17 | return orderCode; |
28 | } | 18 | } |
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | delete from mkt_marketing_url | 38 | delete from mkt_marketing_url |
39 | where union_type = #{unionType,jdbcType=BIGINT} | 39 | where union_type = #{unionType,jdbcType=BIGINT} |
40 | </delete> | 40 | </delete> |
41 | - <select id="listUnionTypes" resultType="long"> | 41 | + <select id="selectUnionTypes" resultType="long"> |
42 | select union_type from mkt_marketing_url where | 42 | select union_type from mkt_marketing_url where |
43 | 1=1 | 43 | 1=1 |
44 | <if test="unionType!=null"> | 44 | <if test="unionType!=null"> |
@@ -51,4 +51,14 @@ | @@ -51,4 +51,14 @@ | ||
51 | and channel_type=#{channelType} | 51 | and channel_type=#{channelType} |
52 | </if> | 52 | </if> |
53 | </select> | 53 | </select> |
54 | + <select id="selectByNameAndUnionType" resultType="Long"> | ||
55 | + select union_type from mkt_marketing_url where 1=1 | ||
56 | + <if test="unionType!=null"> | ||
57 | + and union_type=#{unionType} | ||
58 | + </if> | ||
59 | + <if test="name!=null"> | ||
60 | + and name=#{name} | ||
61 | + </if> | ||
62 | + limit 1 | ||
63 | + </select> | ||
54 | </mapper> | 64 | </mapper> |
@@ -53,6 +53,15 @@ | @@ -53,6 +53,15 @@ | ||
53 | where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR} | 53 | where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR} |
54 | limit #{offset}, #{rows} | 54 | limit #{offset}, #{rows} |
55 | </select> | 55 | </select> |
56 | + <select id="selectListByIds" resultMap="BaseResultMap" > | ||
57 | + select | ||
58 | + <include refid="Base_Column_List" /> | ||
59 | + from union_share_orders | ||
60 | + where id in | ||
61 | + <foreach collection="list" open="(" close=")" item="id" separator=","> | ||
62 | + #{id} | ||
63 | + </foreach> | ||
64 | + </select> | ||
56 | <select id="selectOrderCodesByCondition" resultType="java.lang.String" > | 65 | <select id="selectOrderCodesByCondition" resultType="java.lang.String" > |
57 | select order_code from union_share_orders | 66 | select order_code from union_share_orders |
58 | where settlement_code = #{settlementCode,jdbcType=VARCHAR} | 67 | where settlement_code = #{settlementCode,jdbcType=VARCHAR} |
@@ -181,6 +190,63 @@ | @@ -181,6 +190,63 @@ | ||
181 | </set> | 190 | </set> |
182 | where id = #{id,jdbcType=INTEGER} | 191 | where id = #{id,jdbcType=INTEGER} |
183 | </update> | 192 | </update> |
193 | + <select id="selectCountByUids" resultType="int"> | ||
194 | + select count(*) from union_share_orders where 1=1 | ||
195 | + <if test="uids!=null and uids.size()>0"> | ||
196 | + and promote_uid in | ||
197 | + <foreach collection="uids" open="(" close=")" item="uid" separator=","> | ||
198 | + #{uid} | ||
199 | + </foreach> | ||
200 | + </if> | ||
201 | + <if test="orderCode != null" > | ||
202 | + and order_code = #{orderCode} | ||
203 | + </if> | ||
204 | + <if test="beginTime != 0" > | ||
205 | + and create_time > #{beginTime} | ||
206 | + </if> | ||
207 | + <if test="endTime != 0" > | ||
208 | + and create_time <#{endTime} | ||
209 | + </if> | ||
210 | + </select> | ||
211 | + <select id="selectAllListByUids" resultMap="BaseResultMap"> | ||
212 | + select <include refid="Base_Column_List" /> from union_share_orders where 1=1 | ||
213 | + <if test="uids!=null and uids.size()>0"> | ||
214 | + and promote_uid in | ||
215 | + <foreach collection="uids" open="(" close=")" item="uid" separator=","> | ||
216 | + #{uid} | ||
217 | + </foreach> | ||
218 | + </if> | ||
219 | + <if test="orderCode != null" > | ||
220 | + and order_code = #{orderCode} | ||
221 | + </if> | ||
222 | + <if test="beginTime != 0" > | ||
223 | + and create_time > #{beginTime} | ||
224 | + </if> | ||
225 | + <if test="endTime != 0" > | ||
226 | + and create_time <#{endTime} | ||
227 | + </if> | ||
228 | + order BY create_time desc | ||
229 | + </select> | ||
230 | + <select id="selectListByUids" resultMap="BaseResultMap"> | ||
231 | + select <include refid="Base_Column_List" /> from union_share_orders where 1=1 | ||
232 | + <if test="uids!=null and uids.size()>0"> | ||
233 | + and promote_uid in | ||
234 | + <foreach collection="uids" open="(" close=")" item="uid" separator=","> | ||
235 | + #{uid} | ||
236 | + </foreach> | ||
237 | + </if> | ||
238 | + <if test="orderCode != null" > | ||
239 | + and order_code = #{orderCode} | ||
240 | + </if> | ||
241 | + <if test="beginTime != 0" > | ||
242 | + and create_time > #{beginTime} | ||
243 | + </if> | ||
244 | + <if test="endTime != 0" > | ||
245 | + and create_time <#{endTime} | ||
246 | + </if> | ||
247 | + order BY create_time desc | ||
248 | + limit #{startIndex},#{pageSize} | ||
249 | + </select> | ||
184 | <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrders" > | 250 | <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrders" > |
185 | update union_share_orders | 251 | update union_share_orders |
186 | set order_code = #{orderCode,jdbcType=VARCHAR}, | 252 | set order_code = #{orderCode,jdbcType=VARCHAR}, |
@@ -352,11 +352,8 @@ | @@ -352,11 +352,8 @@ | ||
352 | <if test="orderCode != 0" > | 352 | <if test="orderCode != 0" > |
353 | and order_code = #{orderCode} | 353 | and order_code = #{orderCode} |
354 | </if> | 354 | </if> |
355 | - <if test="unionIds != null and unionIds.size>0" > | ||
356 | - and uid in | ||
357 | - <foreach item="item" index="index" collection="unionIds" open="(" separator="," close=")"> | ||
358 | - #{item} | ||
359 | - </foreach> | 355 | + <if test="unionId != null" > |
356 | + and uid = #{unionId} | ||
360 | </if> | 357 | </if> |
361 | <if test="beginTime != 0" > | 358 | <if test="beginTime != 0" > |
362 | and create_time > #{beginTime} | 359 | and create_time > #{beginTime} |
@@ -380,11 +377,8 @@ | @@ -380,11 +377,8 @@ | ||
380 | <if test="orderCode != 0" > | 377 | <if test="orderCode != 0" > |
381 | and order_code = #{orderCode} | 378 | and order_code = #{orderCode} |
382 | </if> | 379 | </if> |
383 | - <if test="unionIds != null and unionIds.size>0" > | ||
384 | - and uid in | ||
385 | - <foreach item="item" index="index" collection="unionIds" open="(" separator="," close=")"> | ||
386 | - #{item} | ||
387 | - </foreach> | 380 | + <if test="unionId != null" > |
381 | + and uid = #{unionId} | ||
388 | </if> | 382 | </if> |
389 | <if test="beginTime != 0" > | 383 | <if test="beginTime != 0" > |
390 | and create_time > #{beginTime} | 384 | and create_time > #{beginTime} |
@@ -36,6 +36,15 @@ | @@ -36,6 +36,15 @@ | ||
36 | values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{unionType,jdbcType=VARCHAR}, | 36 | values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{unionType,jdbcType=VARCHAR}, |
37 | #{updateTime,jdbcType=INTEGER}) | 37 | #{updateTime,jdbcType=INTEGER}) |
38 | </insert> | 38 | </insert> |
39 | + <select id="selectByUids" parameterType="Integer" resultMap="BaseResultMap"> | ||
40 | + select | ||
41 | + <include refid="Base_Column_List" /> | ||
42 | + from union_share_user | ||
43 | + where uid in | ||
44 | + <foreach collection="list" open="(" close=")" item="uid" separator=","> | ||
45 | + #{uid} | ||
46 | + </foreach> | ||
47 | + </select> | ||
39 | <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareUser" > | 48 | <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareUser" > |
40 | insert into union_share_user | 49 | insert into union_share_user |
41 | <trim prefix="(" suffix=")" suffixOverrides="," > | 50 | <trim prefix="(" suffix=")" suffixOverrides="," > |
@@ -82,6 +91,12 @@ | @@ -82,6 +91,12 @@ | ||
82 | </set> | 91 | </set> |
83 | where id = #{id,jdbcType=INTEGER} | 92 | where id = #{id,jdbcType=INTEGER} |
84 | </update> | 93 | </update> |
94 | + <select id="selectUids" parameterType="Long" resultType="Integer"> | ||
95 | + select uid from union_share_user where union_type in | ||
96 | + <foreach collection="list" open="(" close=")" item="unionType" separator=","> | ||
97 | + #{unionType} | ||
98 | + </foreach> | ||
99 | + </select> | ||
85 | <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareUser" > | 100 | <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareUser" > |
86 | update union_share_user | 101 | update union_share_user |
87 | set uid = #{uid,jdbcType=INTEGER}, | 102 | set uid = #{uid,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.3.8-SNAPSHOT</version> | 8 | + <version>1.3.9-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> |
@@ -31,9 +31,13 @@ public class UnionSettleUpdateConsumer implements YhConsumer { | @@ -31,9 +31,13 @@ public class UnionSettleUpdateConsumer implements YhConsumer { | ||
31 | } | 31 | } |
32 | List<Object> list = JsonUtil.jsonToObject(o.toString(), List.class); | 32 | List<Object> list = JsonUtil.jsonToObject(o.toString(), List.class); |
33 | list.forEach(l->{ | 33 | list.forEach(l->{ |
34 | - ShareSettlementBo bo = JsonUtil.jsonToObject(l.toString(), ShareSettlementBo.class); | ||
35 | - //TODO 提现结算单状态变更 | ||
36 | - unionShareService.updateSettlementStatus(bo); | 34 | + try { |
35 | + ShareSettlementBo bo = JsonUtil.jsonToObject(l.toString(), ShareSettlementBo.class); | ||
36 | + //TODO 提现结算单状态变更 | ||
37 | + unionShareService.updateSettlementStatus(bo); | ||
38 | + } catch (Exception e) { | ||
39 | + logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",l,e.getMessage()); | ||
40 | + } | ||
37 | }); | 41 | }); |
38 | 42 | ||
39 | } catch (Exception e) { | 43 | } catch (Exception e) { |
@@ -32,9 +32,13 @@ public class UnionShareOrderConsumer implements YhConsumer { | @@ -32,9 +32,13 @@ public class UnionShareOrderConsumer implements YhConsumer { | ||
32 | 32 | ||
33 | List<Object> list = JsonUtil.jsonToObject(o.toString(), List.class); | 33 | List<Object> list = JsonUtil.jsonToObject(o.toString(), List.class); |
34 | list.forEach(l->{ | 34 | list.forEach(l->{ |
35 | - ShareOrderBo bo = JsonUtil.jsonToObject(l.toString(), ShareOrderBo.class); | ||
36 | - //TODO 订单插入或更新 | ||
37 | - unionShareService.saveOrUpdateOrder(bo); | 35 | + try { |
36 | + ShareOrderBo bo = JsonUtil.jsonToObject(l.toString(), ShareOrderBo.class); | ||
37 | + //TODO 订单插入或更新 | ||
38 | + unionShareService.saveOrUpdateOrder(bo); | ||
39 | + } catch (Exception e) { | ||
40 | + logger.warn("UnionShareOrderConsumer,handleMessage fail! bo is {}, e {}",l,e.getMessage()); | ||
41 | + } | ||
38 | }); | 42 | }); |
39 | } catch (Exception e) { | 43 | } catch (Exception e) { |
40 | logger.warn("UnionShareOrderConsumer,handleMessage fail! obj is {}, e {}",o,e.getMessage()); | 44 | logger.warn("UnionShareOrderConsumer,handleMessage fail! obj is {}, e {}",o,e.getMessage()); |
1 | package com.yoho.unions.server.restapi; | 1 | package com.yoho.unions.server.restapi; |
2 | 2 | ||
3 | -import com.alibaba.fastjson.JSONObject; | ||
4 | -import com.yoho.service.model.union.request.ActiveUnionRequestBO; | ||
5 | -import com.yoho.service.model.union.request.AddUnionRequestBO; | ||
6 | import com.yoho.service.model.union.request.ClickUnionRequestBO; | 3 | import com.yoho.service.model.union.request.ClickUnionRequestBO; |
7 | import com.yoho.service.model.union.request.UnionOrderReqBO; | 4 | import com.yoho.service.model.union.request.UnionOrderReqBO; |
8 | -import com.yoho.service.model.union.response.ActiveUnionResponseBO; | ||
9 | import com.yoho.service.model.union.response.PageUnionOrderRspBO; | 5 | import com.yoho.service.model.union.response.PageUnionOrderRspBO; |
10 | import com.yoho.service.model.union.response.UnionResponse; | 6 | import com.yoho.service.model.union.response.UnionResponse; |
11 | import com.yoho.service.model.union.response.UnionResponseBO; | 7 | import com.yoho.service.model.union.response.UnionResponseBO; |
@@ -128,4 +124,5 @@ public class UnionRest { | @@ -128,4 +124,5 @@ public class UnionRest { | ||
128 | return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build(); | 124 | return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build(); |
129 | } | 125 | } |
130 | } | 126 | } |
127 | + | ||
131 | } | 128 | } |
@@ -3,7 +3,10 @@ package com.yoho.unions.server.restapi; | @@ -3,7 +3,10 @@ package com.yoho.unions.server.restapi; | ||
3 | import com.yoho.service.model.union.bo.ShareOrderBo; | 3 | import com.yoho.service.model.union.bo.ShareOrderBo; |
4 | import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo; | 4 | import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo; |
5 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; | 5 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; |
6 | +import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO; | ||
7 | +import com.yoho.service.model.union.response.PageUnionShareOrderRspBO; | ||
6 | import com.yoho.service.model.union.response.UnionResponse; | 8 | import com.yoho.service.model.union.response.UnionResponse; |
9 | +import com.yoho.unions.common.ApiResponse; | ||
7 | import com.yoho.unions.dal.model.UnionShareOrders; | 10 | import com.yoho.unions.dal.model.UnionShareOrders; |
8 | import com.yoho.unions.dal.model.UnionShareSettlement; | 11 | import com.yoho.unions.dal.model.UnionShareSettlement; |
9 | import com.yoho.unions.dal.model.UnionShareUser; | 12 | import com.yoho.unions.dal.model.UnionShareUser; |
@@ -48,6 +51,22 @@ public class UnionShareRest { | @@ -48,6 +51,22 @@ public class UnionShareRest { | ||
48 | return new UnionResponse(200, "addSettlement success", result); | 51 | return new UnionResponse(200, "addSettlement success", result); |
49 | } | 52 | } |
50 | 53 | ||
54 | + @RequestMapping("/queryUnionShareOrders") | ||
55 | + @ResponseBody | ||
56 | + public ApiResponse queryUnionShareOrders(UnionShareOrderSearchReqBO reqBO) { | ||
57 | + log.info("enter queryUnionShareOrders. param UnionShareOrderReqBO={}", reqBO); | ||
58 | + if (reqBO == null) { | ||
59 | + return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build(); | ||
60 | + } | ||
61 | + try { | ||
62 | + PageUnionShareOrderRspBO unionOrderRspBO = unionShareService.queryUnionShareOrders(reqBO); | ||
63 | + return new ApiResponse.ApiResponseBuilder().code(200).message("查询共享联盟订单").data(unionOrderRspBO).build(); | ||
64 | + } catch (Exception e) { | ||
65 | + log.warn("queryUnionShareOrders error exception is {}", e); | ||
66 | + return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build(); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
51 | /** | 70 | /** |
52 | * 用户登录时获取对应的渠道号 | 71 | * 用户登录时获取对应的渠道号 |
53 | * Created by qing.zhao on 2018/5/15 | 72 | * Created by qing.zhao on 2018/5/15 |
@@ -134,7 +153,7 @@ public class UnionShareRest { | @@ -134,7 +153,7 @@ public class UnionShareRest { | ||
134 | * 订单列表 | 153 | * 订单列表 |
135 | * //tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中 | 154 | * //tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中 |
136 | * Created by qing.zhao on 2018/5/15 | 155 | * Created by qing.zhao on 2018/5/15 |
137 | - * @param unionShareOrderReqBO | 156 | + * @param unionShareOrderReqBO csg |
138 | * @return | 157 | * @return |
139 | */ | 158 | */ |
140 | @RequestMapping("/queryOrderList") | 159 | @RequestMapping("/queryOrderList") |
@@ -4,13 +4,14 @@ import com.yoho.service.model.union.bo.ShareOrderBo; | @@ -4,13 +4,14 @@ import com.yoho.service.model.union.bo.ShareOrderBo; | ||
4 | import com.yoho.service.model.union.bo.ShareSettlementBo; | 4 | import com.yoho.service.model.union.bo.ShareSettlementBo; |
5 | import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo; | 5 | import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo; |
6 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; | 6 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; |
7 | +import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO; | ||
8 | +import com.yoho.service.model.union.response.PageUnionShareOrderRspBO; | ||
7 | import com.yoho.unions.dal.model.UnionShareOrders; | 9 | import com.yoho.unions.dal.model.UnionShareOrders; |
8 | import com.yoho.unions.dal.model.UnionShareSettlement; | 10 | import com.yoho.unions.dal.model.UnionShareSettlement; |
9 | import com.yoho.unions.dal.model.UnionShareUser; | 11 | import com.yoho.unions.dal.model.UnionShareUser; |
10 | 12 | ||
11 | -import java.util.List; | ||
12 | - | ||
13 | import java.math.BigDecimal; | 13 | import java.math.BigDecimal; |
14 | +import java.util.List; | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * 联盟红人推广返利 | 17 | * 联盟红人推广返利 |
@@ -23,6 +24,7 @@ public interface IUnionShareService { | @@ -23,6 +24,7 @@ public interface IUnionShareService { | ||
23 | */ | 24 | */ |
24 | void saveOrUpdateOrder(ShareOrderBo bo); | 25 | void saveOrUpdateOrder(ShareOrderBo bo); |
25 | 26 | ||
27 | + PageUnionShareOrderRspBO queryUnionShareOrders(UnionShareOrderSearchReqBO reqBO); | ||
26 | /** | 28 | /** |
27 | * 提现结算单状态变更 | 29 | * 提现结算单状态变更 |
28 | * */ | 30 | * */ |
1 | package com.yoho.unions.server.service.impl; | 1 | package com.yoho.unions.server.service.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONException; | ||
4 | +import com.alibaba.fastjson.JSONObject; | ||
3 | import com.yoho.core.config.ConfigReader; | 5 | import com.yoho.core.config.ConfigReader; |
4 | import com.yoho.core.rabbitmq.YhProducer; | 6 | import com.yoho.core.rabbitmq.YhProducer; |
7 | +import com.yoho.error.exception.ServiceException; | ||
5 | import com.yoho.service.model.union.bo.*; | 8 | import com.yoho.service.model.union.bo.*; |
6 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; | 9 | import com.yoho.service.model.union.request.UnionShareOrderReqBO; |
10 | +import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO; | ||
11 | +import com.yoho.service.model.union.response.PageUnionShareOrderRspBO; | ||
12 | +import com.yoho.service.model.union.response.UnionShareOrderRspBO; | ||
13 | +import com.yoho.unions.common.enums.OrderStatusEnum; | ||
7 | import com.yoho.unions.common.enums.ShareOrdersKeyEnum; | 14 | import com.yoho.unions.common.enums.ShareOrdersKeyEnum; |
8 | import com.yoho.unions.common.enums.ShareOrdersStatusEnum; | 15 | import com.yoho.unions.common.enums.ShareOrdersStatusEnum; |
9 | import com.yoho.unions.common.redis.RedisHashCache; | 16 | import com.yoho.unions.common.redis.RedisHashCache; |
17 | +import com.yoho.unions.common.redis.RedisValueCache; | ||
18 | +import com.yoho.unions.common.service.IBusinessExportService; | ||
10 | import com.yoho.unions.common.utils.DateUtil; | 19 | import com.yoho.unions.common.utils.DateUtil; |
11 | import com.yoho.unions.common.utils.RandomUtil; | 20 | import com.yoho.unions.common.utils.RandomUtil; |
12 | import com.yoho.unions.convert.BeanConvert; | 21 | import com.yoho.unions.convert.BeanConvert; |
13 | import com.yoho.unions.convert.Convert; | 22 | import com.yoho.unions.convert.Convert; |
14 | -import com.yoho.unions.dal.UnionShareOrdersMapper; | ||
15 | -import com.yoho.unions.dal.UnionShareOrdersProductMapper; | ||
16 | -import com.yoho.unions.dal.UnionShareSettlementMapper; | ||
17 | -import com.yoho.unions.dal.UnionShareUserMapper; | 23 | +import com.yoho.unions.dal.*; |
18 | import com.yoho.unions.dal.model.*; | 24 | import com.yoho.unions.dal.model.*; |
19 | import com.yoho.unions.server.service.IUnionShareService; | 25 | import com.yoho.unions.server.service.IUnionShareService; |
20 | import org.apache.commons.collections.CollectionUtils; | 26 | import org.apache.commons.collections.CollectionUtils; |
27 | +import org.apache.commons.lang3.StringUtils; | ||
21 | import org.slf4j.Logger; | 28 | import org.slf4j.Logger; |
22 | import org.slf4j.LoggerFactory; | 29 | import org.slf4j.LoggerFactory; |
23 | import org.springframework.beans.BeanUtils; | 30 | import org.springframework.beans.BeanUtils; |
31 | +import org.springframework.beans.BeansException; | ||
24 | import org.springframework.beans.factory.annotation.Autowired; | 32 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.stereotype.Service; | 33 | import org.springframework.stereotype.Service; |
26 | 34 | ||
@@ -30,13 +38,13 @@ import java.util.*; | @@ -30,13 +38,13 @@ import java.util.*; | ||
30 | import java.util.concurrent.TimeUnit; | 38 | import java.util.concurrent.TimeUnit; |
31 | import java.util.concurrent.atomic.AtomicInteger; | 39 | import java.util.concurrent.atomic.AtomicInteger; |
32 | 40 | ||
41 | + | ||
33 | /** | 42 | /** |
34 | * 联盟红人推广返利 | 43 | * 联盟红人推广返利 |
35 | * Created by mingdan.ge on 2018/5/10. | 44 | * Created by mingdan.ge on 2018/5/10. |
36 | */ | 45 | */ |
37 | @Service | 46 | @Service |
38 | -public class UnionShareServiceImpl implements IUnionShareService { | ||
39 | - | 47 | +public class UnionShareServiceImpl implements IUnionShareService,IBusinessExportService { |
40 | private Logger logger = LoggerFactory.getLogger(UnionShareServiceImpl.class); | 48 | private Logger logger = LoggerFactory.getLogger(UnionShareServiceImpl.class); |
41 | 49 | ||
42 | @Autowired | 50 | @Autowired |
@@ -47,10 +55,12 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -47,10 +55,12 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
47 | private UnionShareSettlementMapper unionShareSettlementMapper; | 55 | private UnionShareSettlementMapper unionShareSettlementMapper; |
48 | @Autowired | 56 | @Autowired |
49 | private UnionShareUserMapper unionShareUserMapper; | 57 | private UnionShareUserMapper unionShareUserMapper; |
50 | - | 58 | + @Autowired |
59 | + IMktMarketingUrlDAO mktMarketingUrlDAO; | ||
60 | + @Resource | ||
61 | + RedisValueCache redisValueCache; | ||
51 | @Resource( name = "yhProducer") | 62 | @Resource( name = "yhProducer") |
52 | private YhProducer yhProducer; | 63 | private YhProducer yhProducer; |
53 | - | ||
54 | @Resource(name = "core-config-reader") | 64 | @Resource(name = "core-config-reader") |
55 | private ConfigReader configReader; | 65 | private ConfigReader configReader; |
56 | 66 | ||
@@ -88,10 +98,116 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -88,10 +98,116 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
88 | result.setCanSettlement(canSettlement); | 98 | result.setCanSettlement(canSettlement); |
89 | result.setHistorySettlementAmount(historySettlementAmount); | 99 | result.setHistorySettlementAmount(historySettlementAmount); |
90 | result.setSettlementAmount(settlementAmount); | 100 | result.setSettlementAmount(settlementAmount); |
91 | - logger.info("getUserSettleMentInfo enter,uid is {},result is {}",uid,result); | 101 | + logger.info("getUserSettleMentInfo end,uid is {},result is {}",uid,result); |
92 | return result; | 102 | return result; |
93 | } | 103 | } |
94 | 104 | ||
105 | + @Override | ||
106 | + public PageUnionShareOrderRspBO queryUnionShareOrders(UnionShareOrderSearchReqBO reqBO){ | ||
107 | + logger.info("queryUnionShareOrders param is {}", reqBO); | ||
108 | + UnionShareOrderSearchBo bo=initUnionShareOrderSearchBo(reqBO); | ||
109 | + List<Integer> uids=null; | ||
110 | + if(bo.getUnionType()!=null || bo.getUnionName()!=null || bo.getChannelType()!=null){ | ||
111 | + uids=queryUids(bo); | ||
112 | + if(null==uids){ | ||
113 | + return null; | ||
114 | + } | ||
115 | + } | ||
116 | + //查询总数 | ||
117 | + int count = unionShareOrdersMapper.selectCountByUids(bo.getBeginTime(), bo.getEndTime(), uids,bo.getOrderCode()); | ||
118 | + logger.info("unionShareOrdersMapper.selectCountByUids: size is {}", count); | ||
119 | + if (count < 1) { | ||
120 | + return null; | ||
121 | + } | ||
122 | + Map<String,UnionShareOrders> ordersDOMap=this.unionShareOrdersMapper.selectListByUids(bo.getBeginTime(), bo.getEndTime(), uids,bo.getOrderCode(), reqBO.getStart(), reqBO.getSize()); | ||
123 | + List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRsp(ordersDOMap); | ||
124 | + PageUnionShareOrderRspBO pageUnionOrderRspBO = new PageUnionShareOrderRspBO(); | ||
125 | + pageUnionOrderRspBO.setList(unionOrderRspBOList); | ||
126 | + pageUnionOrderRspBO.setTotal(count); | ||
127 | + pageUnionOrderRspBO.setSize(reqBO.getSize()); | ||
128 | + pageUnionOrderRspBO.setPage(reqBO.getPage()); | ||
129 | + return pageUnionOrderRspBO; | ||
130 | + } | ||
131 | + | ||
132 | + private List<Integer> queryUids(UnionShareOrderSearchBo bo){ | ||
133 | + List<Integer> uids=null; | ||
134 | + List<Long> unionTypes=mktMarketingUrlDAO.selectUnionTypes(bo.getUnionType(), bo.getUnionName(), bo.getChannelType()); | ||
135 | + if(unionTypes.isEmpty()){ | ||
136 | + return null; | ||
137 | + } | ||
138 | + uids=this.unionShareUserMapper.selectUids(unionTypes); | ||
139 | + if(uids.isEmpty()){ | ||
140 | + return null; | ||
141 | + } | ||
142 | + return uids; | ||
143 | + } | ||
144 | + private UnionShareOrderSearchBo initUnionShareOrderSearchBo(UnionShareOrderSearchReqBO reqBO){ | ||
145 | + UnionShareOrderSearchBo bo=new UnionShareOrderSearchBo(); | ||
146 | + bo.setBeginTime(StringUtils.isBlank(reqBO.getBeginTime()) ? 0 : Integer.parseInt(reqBO.getBeginTime())); | ||
147 | + bo.setEndTime(StringUtils.isBlank(reqBO.getEndTime()) ? 0 : Integer.parseInt(reqBO.getEndTime())); | ||
148 | + bo.setOrderCode(StringUtils.isBlank(reqBO.getOrderCode()) ? null : reqBO.getOrderCode()); | ||
149 | + bo.setUnionType(StringUtils.isBlank(reqBO.getUnionId()) ? null :Long.valueOf( reqBO.getUnionId())); | ||
150 | + bo.setUnionName(StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType()); | ||
151 | + bo.setChannelType(StringUtils.isBlank(reqBO.getChannelType())?null:reqBO.getChannelType()); | ||
152 | + bo.setIdList(reqBO.getIdsList()); | ||
153 | + return bo; | ||
154 | + } | ||
155 | + | ||
156 | + private List<UnionShareOrderRspBO> queryUnionShareOrderRsp(Map<String,UnionShareOrders> ordersDOMap){ | ||
157 | + List<UnionShareOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersDOMap.size()); | ||
158 | + Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = initUserShareOrderDatails(ordersDOMap); | ||
159 | + for (UnionShareOrders orders : ordersDOMap.values()) { | ||
160 | + UnionShareOrderRspBO bo=initShareUnionOrderRspBO(orders,userOrderDatailBOMap); | ||
161 | + unionOrderRspBOList.add(bo); | ||
162 | + } | ||
163 | + return unionOrderRspBOList; | ||
164 | + } | ||
165 | + | ||
166 | + private UnionShareOrderRspBO initShareUnionOrderRspBO(UnionShareOrders orders,Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap){ | ||
167 | + UnionShareOrderRspBO orderRspBO=new UnionShareOrderRspBO(); | ||
168 | + orderRspBO.setOrderAmount(orders.getAmount()); | ||
169 | + orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(orders.getStatus())); | ||
170 | + Byte isNew=orders.getIsNew(); | ||
171 | + orderRspBO.setIsNew(isNew==null||isNew.equals(2)?"N":"Y"); | ||
172 | + orderRspBO.setUid(orders.getPromoteUid()); | ||
173 | + orderRspBO.setOrderCode(orders.getOrderCode()); | ||
174 | + orderRspBO.setId(orders.getId()); | ||
175 | + orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss")); | ||
176 | + ShareUserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getOrderCode()); | ||
177 | + orderRspBO.setUnionId(userOrderDatailBO.getUnionType()); | ||
178 | + orderRspBO.setUnionType(userOrderDatailBO.getUnionName()); | ||
179 | + orderRspBO.setChannelType(userOrderDatailBO.getChannelType()); | ||
180 | + return orderRspBO; | ||
181 | + } | ||
182 | + | ||
183 | + private List<Integer> getUids(Map<String,UnionShareOrders> ordersDOMap){ | ||
184 | + List<Integer> uids=new ArrayList<>(ordersDOMap.size()); | ||
185 | + for(UnionShareOrders order:ordersDOMap.values()){ | ||
186 | + uids.add(order.getPromoteUid()); | ||
187 | + } | ||
188 | + return uids; | ||
189 | + } | ||
190 | + private Map<String, ShareUserOrderDatailBO> initUserShareOrderDatails( Map<String,UnionShareOrders> ordersDOMap){ | ||
191 | + Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = new HashMap<>(ordersDOMap.size()); | ||
192 | + Map<Integer,UnionShareUser> userMap=unionShareUserMapper.selectByUids(getUids(ordersDOMap)); | ||
193 | + for (UnionShareOrders userOrders : ordersDOMap.values()) { | ||
194 | + String unionType=userMap.get(userOrders.getPromoteUid()).getUnionType(); | ||
195 | + ShareUserOrderDatailBO userOrderDatailBO = new ShareUserOrderDatailBO(); | ||
196 | + userOrderDatailBO.setUnionType(unionType); | ||
197 | + MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:" + unionType, MktMarketingUrl.class); | ||
198 | + if (mktMarketingUrl == null) { | ||
199 | + mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(unionType)); | ||
200 | + redisValueCache.set("yh:union:uniontype:" + unionType, mktMarketingUrl, 1, TimeUnit.HOURS); | ||
201 | + } | ||
202 | + if (mktMarketingUrl != null) { | ||
203 | + userOrderDatailBO.setUnionName(mktMarketingUrl.getName()); | ||
204 | + userOrderDatailBO.setChannelType(mktMarketingUrl.getChannelType()); | ||
205 | + } | ||
206 | + userOrderDatailBO.setOrderCode(userOrders.getOrderCode()); | ||
207 | + userOrderDatailBOMap.put(userOrderDatailBO.getOrderCode(),userOrderDatailBO); | ||
208 | + } | ||
209 | + return userOrderDatailBOMap; | ||
210 | + } | ||
95 | /** | 211 | /** |
96 | * 用户登录时获取对应的渠道号 | 212 | * 用户登录时获取对应的渠道号 |
97 | * @param uid | 213 | * @param uid |
@@ -113,7 +229,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -113,7 +229,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
113 | unionShareUser.setShareId(configReader.getString(UNION_SHAREID, "")); | 229 | unionShareUser.setShareId(configReader.getString(UNION_SHAREID, "")); |
114 | unionShareUser.setUrl(configReader.getString(UNION_URL, "")); | 230 | unionShareUser.setUrl(configReader.getString(UNION_URL, "")); |
115 | //设置缓存 | 231 | //设置缓存 |
116 | - addToRedis(ShareOrdersKeyEnum.UNION_TYPE,uid,unionShareUser,key); | 232 | + addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key); |
117 | return unionShareUser; | 233 | return unionShareUser; |
118 | } | 234 | } |
119 | 235 | ||
@@ -212,18 +328,22 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -212,18 +328,22 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
212 | //判断是否可以进行状态变更 | 328 | //判断是否可以进行状态变更 |
213 | if (!checkOrderStatusChangePass(unionShareOrders.getStatus(), bo.getStatus())) { | 329 | if (!checkOrderStatusChangePass(unionShareOrders.getStatus(), bo.getStatus())) { |
214 | //订单状态不可变更 | 330 | //订单状态不可变更 |
331 | + logger.info("saveOrUpdateOrder end,status can not be change,oldStatus is {} ,req is {}",unionShareOrders.getStatus(),bo); | ||
215 | return; | 332 | return; |
216 | } | 333 | } |
217 | int result = unionShareOrdersMapper.updateStatusById(unionShareOrders.getId(), unionShareOrders.getStatus(), bo.getStatus(), DateUtil.getCurrentTimeSecond()); | 334 | int result = unionShareOrdersMapper.updateStatusById(unionShareOrders.getId(), unionShareOrders.getStatus(), bo.getStatus(), DateUtil.getCurrentTimeSecond()); |
218 | if (result == 0) { | 335 | if (result == 0) { |
336 | + logger.info("saveOrUpdateOrder enter,update nothing,req is {}",bo); | ||
219 | //没有更新到数据,应该有并发更新事件,查询新的再试一下 | 337 | //没有更新到数据,应该有并发更新事件,查询新的再试一下 |
220 | UnionShareOrders unionShareOrdersNew = unionShareOrdersMapper.selectByCode(bo.getOrderCode()); | 338 | UnionShareOrders unionShareOrdersNew = unionShareOrdersMapper.selectByCode(bo.getOrderCode()); |
221 | if (unionShareOrdersNew == null) { | 339 | if (unionShareOrdersNew == null) { |
340 | + logger.info("saveOrUpdateOrder end,can not find the orderCode,req is {}",bo); | ||
222 | //查不到数据,不该出现的情况,目前没有硬删数据的途径 | 341 | //查不到数据,不该出现的情况,目前没有硬删数据的途径 |
223 | return; | 342 | return; |
224 | } | 343 | } |
225 | if (!checkOrderStatusChangePass(unionShareOrdersNew.getStatus(), bo.getStatus())) { | 344 | if (!checkOrderStatusChangePass(unionShareOrdersNew.getStatus(), bo.getStatus())) { |
226 | //订单状态不可变更 | 345 | //订单状态不可变更 |
346 | + logger.info("saveOrUpdateOrder end,Second try,status can not be change,oldStatus is {} ,req is {}",unionShareOrdersNew.getStatus(),bo); | ||
227 | return; | 347 | return; |
228 | } | 348 | } |
229 | unionShareOrdersMapper.updateStatusById(unionShareOrdersNew.getId(), unionShareOrdersNew.getStatus(), bo.getStatus(), DateUtil.getCurrentTimeSecond()); | 349 | unionShareOrdersMapper.updateStatusById(unionShareOrdersNew.getId(), unionShareOrdersNew.getStatus(), bo.getStatus(), DateUtil.getCurrentTimeSecond()); |
@@ -239,13 +359,15 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -239,13 +359,15 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
239 | logger.info("insertOrder,req is {}",bo); | 359 | logger.info("insertOrder,req is {}",bo); |
240 | //检查参数 | 360 | //检查参数 |
241 | if (!checkParam(bo)) { | 361 | if (!checkParam(bo)) { |
242 | - //缺少参数 todo logger | 362 | + //缺少参数 |
363 | + logger.warn("insertOrder end,param is invaild,req is {}",bo); | ||
243 | return; | 364 | return; |
244 | } | 365 | } |
245 | 366 | ||
246 | //检查状态 | 367 | //检查状态 |
247 | if (!canInsertStatus(bo.getStatus())) { | 368 | if (!canInsertStatus(bo.getStatus())) { |
248 | - //该状态数据不可插入 todo logger | 369 | + //该状态数据不可插入 |
370 | + logger.warn("insertOrder end,status can not be change,req is {}",bo); | ||
249 | return; | 371 | return; |
250 | } | 372 | } |
251 | //新增订单信息 | 373 | //新增订单信息 |
@@ -271,10 +393,14 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -271,10 +393,14 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
271 | unionShareOrdersMapper.insertSelective(insertReq); | 393 | unionShareOrdersMapper.insertSelective(insertReq); |
272 | //新增订单商品信息 | 394 | //新增订单商品信息 |
273 | bo.getProductList().forEach(p->{ | 395 | bo.getProductList().forEach(p->{ |
274 | - UnionShareOrdersProduct insertPro = new UnionShareOrdersProduct(); | ||
275 | - BeanUtils.copyProperties(p, insertPro); | ||
276 | - insertPro.setOrderCode(bo.getOrderCode()); | ||
277 | - unionShareOrdersProductMapper.insertSelective(insertPro); | 396 | + try { |
397 | + UnionShareOrdersProduct insertPro = new UnionShareOrdersProduct(); | ||
398 | + BeanUtils.copyProperties(p, insertPro); | ||
399 | + insertPro.setOrderCode(bo.getOrderCode()); | ||
400 | + unionShareOrdersProductMapper.insertSelective(insertPro); | ||
401 | + } catch (BeansException e) { | ||
402 | + logger.info("insertOrder product error,orderCode is {},product is {}",bo.getOrderCode(), p); | ||
403 | + } | ||
278 | }); | 404 | }); |
279 | logger.info("insertOrder end,req is {}",bo); | 405 | logger.info("insertOrder end,req is {}",bo); |
280 | } | 406 | } |
@@ -325,11 +451,13 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -325,11 +451,13 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
325 | int count = unionShareUserMapper.selectCountByUid(uid); | 451 | int count = unionShareUserMapper.selectCountByUid(uid); |
326 | if (count == 0) { | 452 | if (count == 0) { |
327 | //不是特邀用户 | 453 | //不是特邀用户 |
454 | + logger.info("addSettlement end,can not find unionType,uid is {}",uid); | ||
328 | return null; | 455 | return null; |
329 | } | 456 | } |
330 | //查询是否有处理中的提现 | 457 | //查询是否有处理中的提现 |
331 | if (hasSettlement(uid)) { | 458 | if (hasSettlement(uid)) { |
332 | //有处理中的提现单,不可提现 | 459 | //有处理中的提现单,不可提现 |
460 | + logger.info("addSettlement end,hasSettlement,uid is {}",uid); | ||
333 | return null; | 461 | return null; |
334 | } | 462 | } |
335 | 463 | ||
@@ -337,10 +465,12 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -337,10 +465,12 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
337 | int orderCount = unionShareOrdersMapper.selectCountByCondition(uid,ShareOrdersStatusEnum.CAN_SETTLE.getCode()); | 465 | int orderCount = unionShareOrdersMapper.selectCountByCondition(uid,ShareOrdersStatusEnum.CAN_SETTLE.getCode()); |
338 | if (orderCount == 0 ) { | 466 | if (orderCount == 0 ) { |
339 | //没有可以提现的订单 | 467 | //没有可以提现的订单 |
468 | + logger.info("addSettlement end,has not remaining settlement,uid is {}",uid); | ||
340 | return null; | 469 | return null; |
341 | } | 470 | } |
342 | //todo 生成取现单,绑定订单,考虑是否异步操作 | 471 | //todo 生成取现单,绑定订单,考虑是否异步操作 |
343 | BigDecimal amount = relateSettlementAndOrder(uid); | 472 | BigDecimal amount = relateSettlementAndOrder(uid); |
473 | + logger.info("addSettlement end,remaining settlement is {},uid is {}",amount,uid); | ||
344 | return amount; | 474 | return amount; |
345 | } | 475 | } |
346 | 476 | ||
@@ -392,7 +522,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -392,7 +522,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
392 | return cacheResult; | 522 | return cacheResult; |
393 | } | 523 | } |
394 | int count = unionShareSettlementMapper.selectCountByUid(uid,(byte) 1);//是否打款成功:1-处理中,2-已打款 | 524 | int count = unionShareSettlementMapper.selectCountByUid(uid,(byte) 1);//是否打款成功:1-处理中,2-已打款 |
395 | - logger.info("hasSettlement ,uid is {},result is {},count is {}",uid,count); | 525 | + logger.info("hasSettlement ,uid is {},count is {}",uid,count); |
396 | if (count > 0) { | 526 | if (count > 0) { |
397 | addToRedis(ShareOrdersKeyEnum.USER_SETTLEMENT,uid,true,type); | 527 | addToRedis(ShareOrdersKeyEnum.USER_SETTLEMENT,uid,true,type); |
398 | return true; | 528 | return true; |
@@ -429,17 +559,22 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -429,17 +559,22 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
429 | * */ | 559 | * */ |
430 | public BigDecimal relateSettlementAndOrder(int uid) { | 560 | public BigDecimal relateSettlementAndOrder(int uid) { |
431 | 561 | ||
562 | + logger.info("relateSettlementAndOrder enter,uid is {}",uid); | ||
563 | + | ||
432 | //生成提现编号 | 564 | //生成提现编号 |
433 | String settlementCode = createSettlementCode(); | 565 | String settlementCode = createSettlementCode(); |
566 | + logger.info("relateSettlementAndOrder,uid is {},settlementCode is {}",uid,settlementCode); | ||
434 | 567 | ||
435 | //更新订单状态,由可结算变为打款中 | 568 | //更新订单状态,由可结算变为打款中 |
436 | int updateTime = DateUtil.getCurrentTimeSecond(); | 569 | int updateTime = DateUtil.getCurrentTimeSecond(); |
437 | int count=unionShareOrdersMapper.updateStatusByUid(uid,settlementCode, ShareOrdersStatusEnum.CAN_SETTLE.getCode(), ShareOrdersStatusEnum.SETTLE.getCode(), updateTime); | 570 | int count=unionShareOrdersMapper.updateStatusByUid(uid,settlementCode, ShareOrdersStatusEnum.CAN_SETTLE.getCode(), ShareOrdersStatusEnum.SETTLE.getCode(), updateTime); |
438 | if (count == 0) { | 571 | if (count == 0) { |
572 | + logger.info("relateSettlementAndOrder end,uid is {},settlementCode is {},There are no available orders.",uid,settlementCode); | ||
439 | return null; | 573 | return null; |
440 | } | 574 | } |
441 | //计算提现金额 | 575 | //计算提现金额 |
442 | BigDecimal totalAmount=unionShareOrdersMapper.selectAmountBySettleCode(uid, settlementCode); | 576 | BigDecimal totalAmount=unionShareOrdersMapper.selectAmountBySettleCode(uid, settlementCode); |
577 | + logger.info("relateSettlementAndOrder,uid is {},settlementCode is {},totalAmount is {}",uid,settlementCode,totalAmount); | ||
443 | 578 | ||
444 | //生成提现单 | 579 | //生成提现单 |
445 | UnionShareSettlement insertReq = new UnionShareSettlement(); | 580 | UnionShareSettlement insertReq = new UnionShareSettlement(); |
@@ -451,7 +586,8 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -451,7 +586,8 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
451 | insertReq.setStatus((byte)1);//是否打款成功:1-处理中,2-已打款 | 586 | insertReq.setStatus((byte)1);//是否打款成功:1-处理中,2-已打款 |
452 | int num=unionShareSettlementMapper.insertSelective(insertReq); | 587 | int num=unionShareSettlementMapper.insertSelective(insertReq); |
453 | if (num < 1) { | 588 | if (num < 1) { |
454 | - //todo 插入失败 | 589 | + //插入失败 |
590 | + logger.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},insert nothing.",uid,settlementCode,totalAmount); | ||
455 | } | 591 | } |
456 | 592 | ||
457 | Set<String> orderCodes = new HashSet<>(); | 593 | Set<String> orderCodes = new HashSet<>(); |
@@ -466,6 +602,8 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -466,6 +602,8 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
466 | orderCodes.addAll(periodOrders); | 602 | orderCodes.addAll(periodOrders); |
467 | } | 603 | } |
468 | if (orderCodes.size() == 0) { | 604 | if (orderCodes.size() == 0) { |
605 | + //不该查不到订单 | ||
606 | + logger.warn("relateSettlementAndOrder end,uid is {},settlementCode is {},totalAmount is {},can not find orders.",uid,settlementCode,totalAmount); | ||
469 | return null; | 607 | return null; |
470 | } | 608 | } |
471 | 609 | ||
@@ -477,6 +615,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -477,6 +615,7 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
477 | ShareSettlementBo bo = new ShareSettlementBo(); | 615 | ShareSettlementBo bo = new ShareSettlementBo(); |
478 | BeanUtils.copyProperties(insertReq,bo); | 616 | BeanUtils.copyProperties(insertReq,bo); |
479 | bo.setOrderCodes(orderCodes); | 617 | bo.setOrderCodes(orderCodes); |
618 | + logger.info("relateSettlementAndOrder,send mq {} to erp,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo); | ||
480 | yhProducer.send(SETTLEMENT_TOPIC, bo); | 619 | yhProducer.send(SETTLEMENT_TOPIC, bo); |
481 | return totalAmount; | 620 | return totalAmount; |
482 | } | 621 | } |
@@ -532,4 +671,43 @@ public class UnionShareServiceImpl implements IUnionShareService { | @@ -532,4 +671,43 @@ public class UnionShareServiceImpl implements IUnionShareService { | ||
532 | redisHashCache.delete(ShareOrdersKeyEnum.USER_SETTLEMENT.getPreKey(),uid); | 671 | redisHashCache.delete(ShareOrdersKeyEnum.USER_SETTLEMENT.getPreKey(),uid); |
533 | } | 672 | } |
534 | 673 | ||
674 | + @Override | ||
675 | + public Class getDataClass() { | ||
676 | + return UnionShareOrderRspBO.class; | ||
677 | + } | ||
678 | + | ||
679 | + @Override | ||
680 | + public List<? extends Object> batchExport(String confStr) { | ||
681 | + try { | ||
682 | + UnionShareOrderSearchReqBO request = JSONObject.parseObject(confStr, UnionShareOrderSearchReqBO.class); | ||
683 | + List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRspBOForExport(request); | ||
684 | + if (CollectionUtils.isEmpty(unionOrderRspBOList)) { | ||
685 | + throw new ServiceException(400, "没有要导出的数据"); | ||
686 | + } | ||
687 | + return unionOrderRspBOList; | ||
688 | + } catch (JSONException e) { | ||
689 | + logger.warn("parse confStr error: confStr {}, e {}", confStr, e); | ||
690 | + throw new ServiceException(400, "传入数据格式错误"); | ||
691 | + } catch (com.yoho.error.exception.ServiceException e) { | ||
692 | + logger.warn("make url error params is confStr {}, e {}", confStr, e); | ||
693 | + throw new ServiceException(e.getCode(), e.getErrorMessage()); | ||
694 | + } | ||
695 | + } | ||
696 | + private List<UnionShareOrderRspBO> queryUnionShareOrderRspBOForExport(UnionShareOrderSearchReqBO reqBO){ | ||
697 | + UnionShareOrderSearchBo bo=initUnionShareOrderSearchBo(reqBO); | ||
698 | + Map<String,UnionShareOrders> ordersDOMap=null; | ||
699 | + if(bo.getIdList()!=null&&!bo.getIdList().isEmpty()){ | ||
700 | + ordersDOMap= this.unionShareOrdersMapper.selectListByIds(bo.getIdList()); | ||
701 | + }else{ | ||
702 | + List<Integer> uids=null; | ||
703 | + if(bo.getUnionType()!=null || bo.getUnionName()!=null || bo.getChannelType()!=null){ | ||
704 | + uids=queryUids(bo); | ||
705 | + if(null==uids){ | ||
706 | + return null; | ||
707 | + } | ||
708 | + } | ||
709 | + ordersDOMap=this.unionShareOrdersMapper.selectAllListByUids(bo.getBeginTime(), bo.getEndTime(), uids, bo.getOrderCode()); | ||
710 | + } | ||
711 | + return ordersDOMap.isEmpty()?null:queryUnionShareOrderRsp(ordersDOMap); | ||
712 | + } | ||
535 | } | 713 | } |
@@ -26,7 +26,10 @@ import org.springframework.stereotype.Service; | @@ -26,7 +26,10 @@ import org.springframework.stereotype.Service; | ||
26 | 26 | ||
27 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
28 | import java.math.BigDecimal; | 28 | import java.math.BigDecimal; |
29 | -import java.util.*; | 29 | +import java.util.ArrayList; |
30 | +import java.util.HashMap; | ||
31 | +import java.util.List; | ||
32 | +import java.util.Map; | ||
30 | import java.util.concurrent.TimeUnit; | 33 | import java.util.concurrent.TimeUnit; |
31 | 34 | ||
32 | /** | 35 | /** |
@@ -55,41 +58,8 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -55,41 +58,8 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
55 | @Resource | 58 | @Resource |
56 | RedisValueCache redisValueCache; | 59 | RedisValueCache redisValueCache; |
57 | 60 | ||
58 | - | ||
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 | - long orderCode = StringUtils.isBlank(reqBO.getOrderCode()) ? 0 : Long.valueOf(reqBO.getOrderCode()); | ||
64 | - String unionId = StringUtils.isBlank(reqBO.getUnionId()) ? null : reqBO.getUnionId(); | ||
65 | - String unionType = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType(); | ||
66 | - String channelType=StringUtils.isBlank(reqBO.getChannelType()) ? null : reqBO.getChannelType(); | ||
67 | - List<String> idList = new ArrayList<>(); | ||
68 | - if (StringUtils.isNotBlank(reqBO.getIds())) { | ||
69 | - String[] ids = StringUtils.isBlank(reqBO.getIds()) ? null : reqBO.getIds().split(","); | ||
70 | - idList = Arrays.asList(ids); | ||
71 | - } | ||
72 | - List<Long> unionTypes=null; | ||
73 | - if(unionId!=null||unionType!=null||channelType!=null){ | ||
74 | - unionTypes=this.mktMarketingUrlDAO.listUnionTypes(unionId,unionType,channelType); | ||
75 | - if (unionTypes.isEmpty()) { | ||
76 | - return null; | ||
77 | - } | ||
78 | - } | ||
79 | - //查询总数 | ||
80 | - int count = userOrdersDAO.selectCount(beginTime, endTime, String.valueOf(orderCode), unionTypes, idList); | ||
81 | - logger.info("userOrdersDAO.selectCount: size is {}", count); | ||
82 | - List<UserOrders> userOrdersList = new ArrayList<>(); | ||
83 | - List<UnionOrderRspBO> unionOrderRspBOList = new ArrayList<>(); | ||
84 | - if (count < 1) { | ||
85 | - return null; | ||
86 | - } | ||
87 | - if (count > 0) { | ||
88 | - userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), unionTypes, idList, reqBO.getStart(), reqBO.getSize()); | ||
89 | - } | ||
90 | - List<OrdersDetailBO> ordersDetailBOList = new ArrayList<>(); | ||
91 | - List<Long> orderCodeList = new ArrayList<>(); | ||
92 | - List<UserOrderDatailBO> userOrderDatailBOList = new ArrayList<>(); | 61 | + private List<UserOrderDatailBO> initUserOrderDatails(List<UserOrders> userOrdersList){ |
62 | + List<UserOrderDatailBO> userOrderDatailBOList = new ArrayList<>(userOrdersList.size()); | ||
93 | for (UserOrders userOrders : userOrdersList) { | 63 | for (UserOrders userOrders : userOrdersList) { |
94 | //根据查询出来的uid,ordercode,查询ERP_ORDERS.Orders | 64 | //根据查询出来的uid,ordercode,查询ERP_ORDERS.Orders |
95 | UserOrderDatailBO userOrderDatailBO = new UserOrderDatailBO(); | 65 | UserOrderDatailBO userOrderDatailBO = new UserOrderDatailBO(); |
@@ -101,12 +71,57 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -101,12 +71,57 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
101 | } | 71 | } |
102 | if (mktMarketingUrl != null) { | 72 | if (mktMarketingUrl != null) { |
103 | userOrderDatailBO.setUnionName(mktMarketingUrl.getName()); | 73 | userOrderDatailBO.setUnionName(mktMarketingUrl.getName()); |
104 | - userOrderDatailBO.setChannelType(mktMarketingUrl.getChannelType()); | ||
105 | } | 74 | } |
106 | userOrderDatailBO.setOrderCode(Long.valueOf(userOrders.getOrderCode())); | 75 | userOrderDatailBO.setOrderCode(Long.valueOf(userOrders.getOrderCode())); |
107 | userOrderDatailBOList.add(userOrderDatailBO); | 76 | userOrderDatailBOList.add(userOrderDatailBO); |
108 | - orderCodeList.add(Long.valueOf(userOrders.getOrderCode())); | ||
109 | } | 77 | } |
78 | + return userOrderDatailBOList; | ||
79 | + } | ||
80 | + | ||
81 | + private Map<Long, OrdersCoupons> initOrdersCoupons(Long[] subOrderCodeArr){ | ||
82 | + List<OrdersCoupons> ordersCouponsList = ordersCouponsMapper.selectByOrderCodeList(subOrderCodeArr); | ||
83 | + Map<Long, OrdersCoupons> couponsMap = new HashMap<Long, OrdersCoupons>(ordersCouponsList.size()); | ||
84 | + for (OrdersCoupons coupon : ordersCouponsList) { | ||
85 | + try { | ||
86 | + OrdersCoupons c = couponsMap.get(coupon.getOrderCode()); | ||
87 | + if (c == null) { | ||
88 | + couponsMap.put(coupon.getOrderCode(), coupon); | ||
89 | + } else { | ||
90 | + c.setCouponAmount(c.getCouponAmount().add(coupon.getCouponAmount())); | ||
91 | + } | ||
92 | + } catch (Exception e) { | ||
93 | + logger.error("set OrdersCoupons error :", e); | ||
94 | + } | ||
95 | + } | ||
96 | + return couponsMap; | ||
97 | + } | ||
98 | + | ||
99 | + public PageUnionOrderRspBO queryUnionOrders(UnionOrderReqBO reqBO) { | ||
100 | + logger.info("queryUnionOrders param is {}", reqBO); | ||
101 | + int beginTime = StringUtils.isBlank(reqBO.getBeginTime()) ? 0 : Integer.parseInt(reqBO.getBeginTime()); | ||
102 | + int endTime = StringUtils.isBlank(reqBO.getEndTime()) ? 0 : Integer.parseInt(reqBO.getEndTime()); | ||
103 | + long orderCode = StringUtils.isBlank(reqBO.getOrderCode()) ? 0 : Long.parseLong(reqBO.getOrderCode()); | ||
104 | + Long unionType = StringUtils.isBlank(reqBO.getUnionId()) ? null :Long.valueOf( reqBO.getUnionId()); | ||
105 | + String unionName = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType(); | ||
106 | + List<String> idList = reqBO.getIdsList(); | ||
107 | + | ||
108 | + if(unionType!=null || unionName!=null){ | ||
109 | + unionType=mktMarketingUrlDAO.selectByNameAndUnionType(unionName,unionType); | ||
110 | + if(unionType==null){ | ||
111 | + return null; | ||
112 | + } | ||
113 | + } | ||
114 | + //查询总数 | ||
115 | + int count = userOrdersDAO.selectCount(beginTime, endTime, String.valueOf(orderCode),null==unionType?null:unionType.toString(), idList); | ||
116 | + logger.info("userOrdersDAO.selectCount: size is {}", count); | ||
117 | + if (count < 1) { | ||
118 | + return null; | ||
119 | + } | ||
120 | + List<UserOrders> userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), null==unionType?null:unionType.toString(), idList, reqBO.getStart(), reqBO.getSize()); | ||
121 | + if(userOrdersList.isEmpty()){ | ||
122 | + return null; | ||
123 | + } | ||
124 | + List<UserOrderDatailBO> userOrderDatailBOList = initUserOrderDatails(userOrdersList); | ||
110 | Map<Long, UserOrderDatailBO> userOrderDatailBOMap = Maps.uniqueIndex(userOrderDatailBOList, new Function<UserOrderDatailBO, Long>() { | 125 | Map<Long, UserOrderDatailBO> userOrderDatailBOMap = Maps.uniqueIndex(userOrderDatailBOList, new Function<UserOrderDatailBO, Long>() { |
111 | @Override | 126 | @Override |
112 | public Long apply(UserOrderDatailBO userOrderDatailBO) { | 127 | public Long apply(UserOrderDatailBO userOrderDatailBO) { |
@@ -114,44 +129,17 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -114,44 +129,17 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
114 | } | 129 | } |
115 | }); | 130 | }); |
116 | //批量查询erp_orders.orders表 | 131 | //批量查询erp_orders.orders表 |
117 | - List<Orders> ordersList = ordersMapper.selectByOrderCodeList(orderCodeList); | 132 | + Long[] orderCodes=userOrderDatailBOMap.keySet().toArray(new Long[0]); |
133 | + List<Orders> ordersList = ordersMapper.selectByOrderCodeList(orderCodes); | ||
118 | Map<Long, Orders> ordersMap = Maps.uniqueIndex(ordersList, new Function<Orders, Long>() { | 134 | Map<Long, Orders> ordersMap = Maps.uniqueIndex(ordersList, new Function<Orders, Long>() { |
119 | @Override | 135 | @Override |
120 | public Long apply(Orders orders) { | 136 | public Long apply(Orders orders) { |
121 | return orders.getOrderCode(); | 137 | return orders.getOrderCode(); |
122 | } | 138 | } |
123 | }); | 139 | }); |
124 | - List<Long> subOrderCodeList = new ArrayList<>(); | ||
125 | - | ||
126 | - for (Map.Entry<Long, Orders> map : ordersMap.entrySet()) { | ||
127 | - OrdersDetailBO ordersDetailBO = new OrdersDetailBO(); | ||
128 | - Orders orders = map.getValue(); | ||
129 | - ordersDetailBO.setOrders(orders); | ||
130 | - subOrderCodeList.add(map.getKey()); | ||
131 | - ordersDetailBOList.add(ordersDetailBO); | ||
132 | - } | ||
133 | - | 140 | + Long[] subOrderCodeList=ordersMap.keySet().toArray(new Long[0]); |
134 | //批量查询优惠券金额 | 141 | //批量查询优惠券金额 |
135 | - List<OrdersCoupons> ordersCouponsList = ordersCouponsMapper.selectByOrderCodeList(subOrderCodeList); | ||
136 | - /*Map<Long, OrdersCoupons> couponsMap = Maps.uniqueIndex(ordersCouponsList, new Function<OrdersCoupons, Long>() { | ||
137 | - @Override | ||
138 | - public Long apply(OrdersCoupons ordersCoupons) { | ||
139 | - return ordersCoupons.getOrderCode(); | ||
140 | - } | ||
141 | - });*/ | ||
142 | - Map<Long, OrdersCoupons> couponsMap = new HashMap<Long, OrdersCoupons>(); | ||
143 | - for (OrdersCoupons coupon : ordersCouponsList) { | ||
144 | - try { | ||
145 | - OrdersCoupons c = couponsMap.get(coupon.getOrderCode()); | ||
146 | - if (c == null) { | ||
147 | - couponsMap.put(coupon.getOrderCode(), coupon); | ||
148 | - } else { | ||
149 | - c.setCouponAmount(c.getCouponAmount().add(coupon.getCouponAmount())); | ||
150 | - } | ||
151 | - } catch (Exception e) { | ||
152 | - logger.error("set OrdersCoupons error :", e); | ||
153 | - } | ||
154 | - } | 142 | + Map<Long, OrdersCoupons> couponsMap = initOrdersCoupons(subOrderCodeList); |
155 | //批量查询是否新客 | 143 | //批量查询是否新客 |
156 | List<OrdersAccessOry> ordersAccessOryList = ordersAccessOryMapper.selectByOrderCodeList(subOrderCodeList); | 144 | List<OrdersAccessOry> ordersAccessOryList = ordersAccessOryMapper.selectByOrderCodeList(subOrderCodeList); |
157 | Map<Long, OrdersAccessOry> ordersAccessOryMap = Maps.uniqueIndex(ordersAccessOryList, new Function<OrdersAccessOry, Long>() { | 145 | Map<Long, OrdersAccessOry> ordersAccessOryMap = Maps.uniqueIndex(ordersAccessOryList, new Function<OrdersAccessOry, Long>() { |
@@ -160,56 +148,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -160,56 +148,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
160 | return ordersAccessOry.getOrderCode(); | 148 | return ordersAccessOry.getOrderCode(); |
161 | } | 149 | } |
162 | }); | 150 | }); |
163 | - | ||
164 | - for (OrdersDetailBO ordersDetailBO : ordersDetailBOList) { | ||
165 | - Orders orders = ordersDetailBO.getOrders(); | ||
166 | - UnionOrderRspBO orderRspBO = new UnionOrderRspBO(); | ||
167 | - //优惠券金额 | ||
168 | - OrdersCoupons ordersCoupons = couponsMap.get(orders.getOrderCode()); | ||
169 | - if (null != ordersCoupons) { | ||
170 | - orderRspBO.setCouponAmount(ordersCoupons.getCouponAmount()); | ||
171 | - } else { | ||
172 | - orderRspBO.setCouponAmount(new BigDecimal(0)); | ||
173 | - } | ||
174 | - //防止订单数据没有在ERP中 | ||
175 | - | ||
176 | - //订单金额 | ||
177 | - orderRspBO.setOrderAmount(orders.getOrderAmount()); | ||
178 | - orderRspBO.setYohoCoinNum(orders.getYohoCoinNum()); | ||
179 | - | ||
180 | - //礼品卡抵运费--数据较少,暂时就用单个查询把 | ||
181 | - BigDecimal pay_shipping_amount = ordersGiftCardMapper.selectPayShippingAmount(Long.valueOf(orders.getOrderCode())); | ||
182 | - | ||
183 | - // 免邮券--数据较少,暂时就用单个查询把 | ||
184 | - BigDecimal coupon_amount = ordersFreightCouponsMapper.selectCouponAmount(Long.valueOf(orders.getOrderCode())); | ||
185 | - //运费 | ||
186 | - BigDecimal realShipmentAmount = orders.getShippingCost().subtract(pay_shipping_amount).subtract(coupon_amount); | ||
187 | - orderRspBO.setShipmentAmount(realShipmentAmount); | ||
188 | - //实际支付金额 | ||
189 | - orderRspBO.setRealPayAmount(orders.getLastOrderAmount().subtract(realShipmentAmount)); | ||
190 | - //订单状态 | ||
191 | - orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(String.valueOf(orders.getOrderStatus()))); | ||
192 | - //附加信息 | ||
193 | - orderRspBO.setExetInfmoation(orders.getRemark()); | ||
194 | - //支付方式 | ||
195 | - orderRspBO.setPayChannel(PaymentTypeEnum.getNameByCode(String.valueOf(orders.getPaymentType()))); | ||
196 | - //是否新客---从新的表中获取 | ||
197 | - OrdersAccessOry ordersAccessOry = ordersAccessOryMap.get(orders.getOrderCode()); | ||
198 | - if (null != ordersAccessOry) { | ||
199 | - orderRspBO.setIsNew(NewUserEnum.getNameByCode(ordersAccessOry.getIsNew() == null ? "N" : ordersAccessOry.getIsNew())); | ||
200 | - } else { | ||
201 | - orderRspBO.setIsNew(NewUserEnum.getNameByCode("N")); | ||
202 | - } | ||
203 | - orderRspBO.setUid(orders.getUid()); | ||
204 | - orderRspBO.setOrderCode(orders.getOrderCode()); | ||
205 | - orderRspBO.setId(orders.getId()); | ||
206 | - orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss")); | ||
207 | -// | ||
208 | - UserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getParentOrderCode()); | ||
209 | - orderRspBO.setUnionId(userOrderDatailBO.getUnionId()); | ||
210 | - orderRspBO.setUnionType(userOrderDatailBO.getUnionName()); | ||
211 | - orderRspBO.setChannelType(userOrderDatailBO.getChannelType()); | ||
212 | - unionOrderRspBOList.add(orderRspBO); | 151 | + List<UnionOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersMap.size()); |
152 | + for (Orders orders : ordersMap.values()) { | ||
153 | + unionOrderRspBOList.add(initUnionOrderRspBO(orders, couponsMap, ordersAccessOryMap, userOrderDatailBOMap)); | ||
213 | } | 154 | } |
214 | PageUnionOrderRspBO pageUnionOrderRspBO = new PageUnionOrderRspBO(); | 155 | PageUnionOrderRspBO pageUnionOrderRspBO = new PageUnionOrderRspBO(); |
215 | pageUnionOrderRspBO.setList(unionOrderRspBOList); | 156 | pageUnionOrderRspBO.setList(unionOrderRspBOList); |
@@ -219,6 +160,46 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -219,6 +160,46 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
219 | return pageUnionOrderRspBO; | 160 | return pageUnionOrderRspBO; |
220 | } | 161 | } |
221 | 162 | ||
163 | + private UnionOrderRspBO initUnionOrderRspBO(Orders orders,Map<Long, OrdersCoupons> couponsMap,Map<Long, OrdersAccessOry> ordersAccessOryMap,Map<Long, UserOrderDatailBO> userOrderDatailBOMap){ | ||
164 | + UnionOrderRspBO orderRspBO=new UnionOrderRspBO(); | ||
165 | + //优惠券金额 | ||
166 | + OrdersCoupons ordersCoupons = couponsMap.get(orders.getOrderCode()); | ||
167 | + orderRspBO.setCouponAmount(null != ordersCoupons?ordersCoupons.getCouponAmount():new BigDecimal(0)); | ||
168 | + //防止订单数据没有在ERP中 | ||
169 | + //订单金额 | ||
170 | + orderRspBO.setOrderAmount(orders.getAmount()); | ||
171 | + //礼品卡抵运费--数据较少,暂时就用单个查询把 | ||
172 | + BigDecimal pay_shipping_amount = ordersGiftCardMapper.selectPayShippingAmount(Long.valueOf(orders.getOrderCode())); | ||
173 | + // 免邮券--数据较少,暂时就用单个查询把 | ||
174 | + BigDecimal coupon_amount = ordersFreightCouponsMapper.selectCouponAmount(Long.valueOf(orders.getOrderCode())); | ||
175 | + //运费 | ||
176 | + BigDecimal realShipmentAmount = orders.getShippingCost().subtract(pay_shipping_amount).subtract(coupon_amount); | ||
177 | + orderRspBO.setShipmentAmount(realShipmentAmount); | ||
178 | + //实际支付金额 | ||
179 | + orderRspBO.setRealPayAmount(orders.getLastOrderAmount().subtract(realShipmentAmount)); | ||
180 | + //订单状态 | ||
181 | + orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(String.valueOf(orders.getOrderStatus()))); | ||
182 | + //附加信息 | ||
183 | + orderRspBO.setExetInfmoation(orders.getRemark()); | ||
184 | + //支付方式 | ||
185 | + orderRspBO.setPayChannel(PaymentTypeEnum.getNameByCode(String.valueOf(orders.getPaymentType()))); | ||
186 | + //是否新客---从新的表中获取 | ||
187 | + OrdersAccessOry ordersAccessOry = ordersAccessOryMap.get(orders.getOrderCode()); | ||
188 | + if (null != ordersAccessOry) { | ||
189 | + orderRspBO.setIsNew(NewUserEnum.getNameByCode(ordersAccessOry.getIsNew() == null ? "N" : ordersAccessOry.getIsNew())); | ||
190 | + } else { | ||
191 | + orderRspBO.setIsNew(NewUserEnum.getNameByCode("N")); | ||
192 | + } | ||
193 | + orderRspBO.setUid(orders.getUid()); | ||
194 | + orderRspBO.setOrderCode(orders.getOrderCode()); | ||
195 | + orderRspBO.setId(orders.getId()); | ||
196 | + orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss")); | ||
197 | + UserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getParentOrderCode()); | ||
198 | + orderRspBO.setUnionId(userOrderDatailBO.getUnionId()); | ||
199 | + orderRspBO.setUnionType(userOrderDatailBO.getUnionName()); | ||
200 | + return orderRspBO; | ||
201 | + } | ||
202 | + | ||
222 | @Override | 203 | @Override |
223 | public Class getDataClass() { | 204 | public Class getDataClass() { |
224 | return UnionOrderRspBO.class; | 205 | return UnionOrderRspBO.class; |
@@ -243,4 +224,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | @@ -243,4 +224,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport | ||
243 | throw new ServiceException(e.getCode(), e.getErrorMessage()); | 224 | throw new ServiceException(e.getCode(), e.getErrorMessage()); |
244 | } | 225 | } |
245 | } | 226 | } |
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | ||
246 | } | 232 | } |
@@ -118,8 +118,8 @@ | @@ -118,8 +118,8 @@ | ||
118 | value-type="com.yoho.unions.common.service.IBusinessExportService"> | 118 | value-type="com.yoho.unions.common.service.IBusinessExportService"> |
119 | <entry key="channelUserServiceImpl" value-ref="channelUserServiceImpl"/> | 119 | <entry key="channelUserServiceImpl" value-ref="channelUserServiceImpl"/> |
120 | <entry key="userOrdersServiceImpl" value-ref="userOrdersServiceImpl"/> | 120 | <entry key="userOrdersServiceImpl" value-ref="userOrdersServiceImpl"/> |
121 | + <entry key="unionShareServiceImpl" value-ref="unionShareServiceImpl"/> | ||
121 | <entry key="userRegisterBuyInfoserviceImpl" value-ref="userRegisterBuyInfoserviceImpl"/> | 122 | <entry key="userRegisterBuyInfoserviceImpl" value-ref="userRegisterBuyInfoserviceImpl"/> |
122 | - | ||
123 | </util:map> | 123 | </util:map> |
124 | 124 | ||
125 | </beans> | 125 | </beans> |
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta charset="UTF-8"> | ||
5 | + <title>Yoho!Buy运营平台</title> | ||
6 | + <script src="/union/js/include.js"></script> | ||
7 | + <script src="/union/js/ajaxfileupload.js"></script> | ||
8 | +</head> | ||
9 | +<body class="easyui-layout" fit="true"> | ||
10 | +<div region="north" style="padding-bottom: 35px; height: auto;"> | ||
11 | + <script> | ||
12 | + document.write(addHead('市场报表管理', 'CPS订单管理')); | ||
13 | + </script> | ||
14 | + <form id="searchForm" method="post" accept-charset="utf-8"> | ||
15 | + <div style="margin-left: 10px;margin-top: 10px"> | ||
16 | + | ||
17 | + <label>开始时间:</label> | ||
18 | + <input class="easyui-datetimebox" id="beginTime" name="beginTime"> | ||
19 | + </input> | ||
20 | + | ||
21 | + <label>结束时间:</label> | ||
22 | + <input class="easyui-datetimebox" id="endTime" name="endTime"> | ||
23 | + </input> | ||
24 | + | ||
25 | + <label>订单号:</label> | ||
26 | + <input class="easyui-textbox" id="orderCode" name="orderCode"> | ||
27 | + </input> | ||
28 | + | ||
29 | + <label>联盟用户ID:</label> | ||
30 | + <input class="easyui-textbox" id="unionId" name="unionId"> | ||
31 | + </input> | ||
32 | + | ||
33 | + <label>渠道:</label> | ||
34 | + <input class="easyui-textbox" id="unionType" name="unionType"> | ||
35 | + </input> | ||
36 | + | ||
37 | + <label>渠道号类型:</label> | ||
38 | + <input class="easyui-combobox" id="channelType" name="channelType"> | ||
39 | + </input> | ||
40 | + | ||
41 | + <a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a> | ||
42 | + <a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a> | ||
43 | + <a id="exportAllButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">全部导出</a> | ||
44 | + </div> | ||
45 | + </form> | ||
46 | +</div> | ||
47 | +<div region="center"> | ||
48 | + <div style="margin-left: 30px;margin-top: 20px; height: 500px;"> | ||
49 | + <table id="userOrdersTable"></table> | ||
50 | + </div> | ||
51 | +</div> | ||
52 | +<script type="text/javascript"> | ||
53 | + var checkedItems = []; | ||
54 | + $(function () { | ||
55 | + $("#userOrdersTable").myDatagrid({ | ||
56 | + fit: true, | ||
57 | + fitColumns: true, | ||
58 | + <!-- idField: "id",--> | ||
59 | + view: fileview, | ||
60 | + nowrap: false, | ||
61 | + onCheckAll: addcheckItem, | ||
62 | + onCheck: addcheckItem, | ||
63 | + onUncheckAll: removeAllItem, | ||
64 | + onUncheck: removeSingleItem, | ||
65 | + url: contextPath + "/UnionShareRest/queryUnionShareOrders", | ||
66 | + method: 'POST', | ||
67 | + loadFilter: function (data) { | ||
68 | + var temp = defaultLoadFilter(data); | ||
69 | + temp.rows = temp.list; | ||
70 | + return temp; | ||
71 | + }, | ||
72 | + columns: [[{ | ||
73 | + title: "ID", | ||
74 | + field: "id", | ||
75 | + idField:"id", | ||
76 | + width: 200, | ||
77 | + align: "center", | ||
78 | + checkbox: true | ||
79 | + }, { | ||
80 | + title: "联盟用户ID", | ||
81 | + field: "unionId", | ||
82 | + width: 200, | ||
83 | + align: "center" | ||
84 | + }, { | ||
85 | + title: "下单时间", | ||
86 | + field: "orderTime", | ||
87 | + width: 200, | ||
88 | + align: "center" | ||
89 | + }, { | ||
90 | + title: "订单号", | ||
91 | + field: "orderCode", | ||
92 | + width: 200, | ||
93 | + align: "center" | ||
94 | + }, { | ||
95 | + title: "订单用户ID", | ||
96 | + field: "uid", | ||
97 | + width: 200, | ||
98 | + align: "center" | ||
99 | + }, { | ||
100 | + title: "订单金额", | ||
101 | + field: "orderAmount", | ||
102 | + width: 200, | ||
103 | + align: "center" | ||
104 | + }, { | ||
105 | + title: "订单状态", | ||
106 | + field: "orderStatus", | ||
107 | + width: 200, | ||
108 | + align: "center" | ||
109 | + }, { | ||
110 | + title: "渠道", | ||
111 | + field: "unionType", | ||
112 | + width: 200, | ||
113 | + align: "center" | ||
114 | + }, { | ||
115 | + title: "渠道号类型", | ||
116 | + field: "channelType", | ||
117 | + width: 200, | ||
118 | + align: "center" | ||
119 | + }, { | ||
120 | + title: "是否新客", | ||
121 | + field: "isNew", | ||
122 | + width: 200, | ||
123 | + align: "center" | ||
124 | + } | ||
125 | + ]], | ||
126 | + cache: false, | ||
127 | + pagination: true, | ||
128 | + pageSize: 10, | ||
129 | + pageList: [10], | ||
130 | + idField: "id", | ||
131 | + singleSelect: false, | ||
132 | + checkOnSelect: false, | ||
133 | + onLoadSuccess: function (data) { | ||
134 | + resetSelectedCheckBox(data); | ||
135 | + } | ||
136 | + }); | ||
137 | + $("#channelType").combobox({ | ||
138 | + valueField : "channelType", | ||
139 | + textField : "channelTypeDesc", | ||
140 | + data:[{channelTypeDesc:"个人",channelType:"1"},{channelTypeDesc:"机构",channelType:"0"}] | ||
141 | + }); | ||
142 | + $("#channelType").combobox("clear"); | ||
143 | + | ||
144 | + function resetSelectedCheckBox(data){ | ||
145 | + $("input[type='checkbox'][name='id']").each(function () { | ||
146 | + var cb=$(this); | ||
147 | + $.each(checkedItems,function(index,value){ | ||
148 | + if(value==cb.val()){ | ||
149 | + cb.attr("checked",true); | ||
150 | + return false; | ||
151 | + } | ||
152 | + }); | ||
153 | + }); | ||
154 | + } | ||
155 | + function getParam(table) { | ||
156 | + var paramsArray = $("#"+table+"").serializeArray(); | ||
157 | + var params = {}; | ||
158 | + for (var i = 0; i < paramsArray.length; i++) { | ||
159 | + params[paramsArray[i].name] = paramsArray[i].value; | ||
160 | + } | ||
161 | + return params; | ||
162 | + } | ||
163 | + | ||
164 | + $("#searchBtn").linkbutton({ | ||
165 | + iconCls : "icon-search", | ||
166 | + onClick : function() { | ||
167 | + checkedItems=[]; | ||
168 | + var param = {}; | ||
169 | + if ($("#beginTime").datetimebox('getValue')!='') | ||
170 | + { | ||
171 | + param.beginTime = parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000) | ||
172 | + } | ||
173 | + if ($("#endTime").datetimebox('getValue') != ''){ | ||
174 | + param.endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000) | ||
175 | + } | ||
176 | + | ||
177 | + param.orderCode = $("#orderCode").val(), | ||
178 | + param.unionId = $("#unionId").val(), | ||
179 | + param.unionType=$("#unionType").val(), | ||
180 | + param.channelType=$("#channelType").combobox("getValue"), | ||
181 | + $("#userOrdersTable").myDatagrid("load", param); | ||
182 | + } | ||
183 | + }); | ||
184 | + | ||
185 | + function addcheckItem() { | ||
186 | + $("input[type='checkbox'][name='id']:checked").each(function () { | ||
187 | + var k = findCheckedItem($(this).val()); | ||
188 | + if (k == -1) { | ||
189 | + checkedItems.push($(this).val()); | ||
190 | + } | ||
191 | + }); | ||
192 | + } | ||
193 | + | ||
194 | + var fileview = $.extend({}, $.fn.datagrid.defaults.view, { onAfterRender: function (target) { isCheckItem(); } }); | ||
195 | + | ||
196 | + function isCheckItem() { | ||
197 | + for (var i = 0; i < checkedItems.length; i++) { | ||
198 | + $("input[type='checkbox'][name='id'][value='"+checkedItems[i]+"']").attr("checked", "checked"); | ||
199 | + } | ||
200 | + } | ||
201 | + | ||
202 | + function findCheckedItem(ID) { | ||
203 | + for (var i = 0; i < checkedItems.length; i++) { | ||
204 | + if (checkedItems[i] == ID) return i; | ||
205 | + } | ||
206 | + return -1; | ||
207 | + } | ||
208 | + | ||
209 | + function findCheckedItem(ID) { | ||
210 | + for (var i = 0; i < checkedItems.length; i++) { | ||
211 | + if (checkedItems[i] == ID) return i; | ||
212 | + } | ||
213 | + return -1; | ||
214 | + } | ||
215 | + | ||
216 | + function removeAllItem(rows) { | ||
217 | + $("input[type='checkbox'][name='id']").each(function () { | ||
218 | + if (!this.checked) { | ||
219 | + var k = findCheckedItem($(this).val()); | ||
220 | + if (k != -1) { | ||
221 | + checkedItems.splice(k, 1); | ||
222 | + } | ||
223 | + } | ||
224 | + }); | ||
225 | + } | ||
226 | + | ||
227 | + function removeSingleItem(rowIndex, rowData) { | ||
228 | + var k = findCheckedItem(rowData.id); | ||
229 | + if (k != -1) { | ||
230 | + checkedItems.splice(k, 1); | ||
231 | + } | ||
232 | + } | ||
233 | + | ||
234 | + $("#exportButton").linkbutton({ | ||
235 | + onClick : function() { | ||
236 | + if (checkedItems.length == 0) { | ||
237 | + $.messager.alert('提示','请选择要导出的数据'); | ||
238 | + return; | ||
239 | + } | ||
240 | + var params = {"ids": checkedItems.toString() }; | ||
241 | + window.open(contextPath + "/batch/export.do?type=unionShareServiceImpl&queryConf=" + JSON.stringify(params)); | ||
242 | + } | ||
243 | + }); | ||
244 | + | ||
245 | + $("#exportAllButton").linkbutton({ | ||
246 | + onClick : function() { | ||
247 | + window.open(contextPath + "/batch/export.do?type=unionShareServiceImpl&queryConf=" + JSON.stringify(getParams())); | ||
248 | + } | ||
249 | + }); | ||
250 | + | ||
251 | + function getParams() { | ||
252 | + var paramsArray = $("#searchForm").serializeArray(); | ||
253 | + var params = {}; | ||
254 | + var orderCode = ""; | ||
255 | + var beginTime=""; | ||
256 | + var endTime=""; | ||
257 | + for (var i = 0; i < paramsArray.length; i++ ) { | ||
258 | + if (paramsArray[i].name == "orderCode") { | ||
259 | + orderCode += paramsArray[i].value + ","; | ||
260 | + }else if(paramsArray[i].name=="beginTime"){ | ||
261 | + beginTime += paramsArray[i].value + ","; | ||
262 | + }else if(paramsArray[i].name=="endTime"){ | ||
263 | + endTime +=paramsArray[i].value+","; | ||
264 | + } else { | ||
265 | + params[paramsArray[i].name] = paramsArray[i].value; | ||
266 | + } | ||
267 | + } | ||
268 | + if (orderCode.length != 0) { | ||
269 | + params["orderCode"] = orderCode.substring(0, orderCode.length -1); | ||
270 | + } | ||
271 | + if(beginTime.length !=0){ | ||
272 | + params["beginTime"]= parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000) | ||
273 | + } | ||
274 | + if(endTime.length !=0){ | ||
275 | + params["endTime"]= parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000) | ||
276 | + } | ||
277 | + | ||
278 | + return params; | ||
279 | + } | ||
280 | + | ||
281 | + }); | ||
282 | +</script> | ||
283 | +</body> | ||
284 | +</html> |
@@ -34,10 +34,6 @@ | @@ -34,10 +34,6 @@ | ||
34 | <input class="easyui-textbox" id="unionType" name="unionType"> | 34 | <input class="easyui-textbox" id="unionType" name="unionType"> |
35 | </input> | 35 | </input> |
36 | 36 | ||
37 | - <label>渠道号类型:</label> | ||
38 | - <input class="easyui-combobox" id="channelType" name="channelType"> | ||
39 | - </input> | ||
40 | - | ||
41 | <a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a> | 37 | <a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a> |
42 | <a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a> | 38 | <a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a> |
43 | <a id="exportAllButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">全部导出</a> | 39 | <a id="exportAllButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">全部导出</a> |
@@ -114,7 +110,7 @@ | @@ -114,7 +110,7 @@ | ||
114 | }, { | 110 | }, { |
115 | title: "运费", | 111 | title: "运费", |
116 | field: "shipmentAmount", | 112 | field: "shipmentAmount", |
117 | - width: 90, | 113 | + width: 170, |
118 | align: "center" | 114 | align: "center" |
119 | }, { | 115 | }, { |
120 | title: "实付金额", | 116 | title: "实付金额", |
@@ -132,17 +128,9 @@ | @@ -132,17 +128,9 @@ | ||
132 | width: 170, | 128 | width: 170, |
133 | align: "center" | 129 | align: "center" |
134 | }, { | 130 | }, { |
135 | - title: "渠道号类型", | ||
136 | - field: "channelType", | ||
137 | - width: 120, | ||
138 | - align: "center", | ||
139 | - formatter: function (value, rowData, rowIndex) { | ||
140 | - return value==null?"":value==0?"机构":"个人"; | ||
141 | - } | ||
142 | - }, { | ||
143 | title: "附加信息", | 131 | title: "附加信息", |
144 | field: "exetInfmoation", | 132 | field: "exetInfmoation", |
145 | - width: 140, | 133 | + width: 170, |
146 | align: "center" | 134 | align: "center" |
147 | }, { | 135 | }, { |
148 | title: "支付方式", | 136 | title: "支付方式", |
@@ -173,12 +161,6 @@ | @@ -173,12 +161,6 @@ | ||
173 | }); | 161 | }); |
174 | } | 162 | } |
175 | }); | 163 | }); |
176 | - $("#channelType").combobox({ | ||
177 | - valueField : "channelType", | ||
178 | - textField : "channelTypeDesc", | ||
179 | - data:[{channelTypeDesc:"个人",channelType:"1"},{channelTypeDesc:"机构",channelType:"0"}] | ||
180 | - }); | ||
181 | - $("#channelType").combobox("clear"); | ||
182 | 164 | ||
183 | function getParam(table) { | 165 | function getParam(table) { |
184 | var paramsArray = $("#"+table+"").serializeArray(); | 166 | var paramsArray = $("#"+table+"").serializeArray(); |
@@ -204,7 +186,6 @@ | @@ -204,7 +186,6 @@ | ||
204 | param.orderCode = $("#orderCode").val(), | 186 | param.orderCode = $("#orderCode").val(), |
205 | param.unionId = $("#unionId").val(), | 187 | param.unionId = $("#unionId").val(), |
206 | param.unionType=$("#unionType").val(), | 188 | param.unionType=$("#unionType").val(), |
207 | - param.channelType=$("#channelType").combobox("getValue"), | ||
208 | $("#userOrdersTable").myDatagrid("load", param); | 189 | $("#userOrdersTable").myDatagrid("load", param); |
209 | } | 190 | } |
210 | }); | 191 | }); |
-
Please register or login to post a comment