Commit 3fd2951df13fddbd9f7ec891f37f5bda20a34c3e
Merge branch 'dev' of http://git3.nong12.com/b2c/gateway into dev
# Conflicts: # mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/UserService.java # mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java # mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/user/UserController.java
Showing
65 changed files
with
1913 additions
and
1263 deletions
Too many changes to show.
To preserve performance only 65 of 85 files are displayed.
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/Constant.java
... | ... | @@ -170,8 +170,8 @@ public class Constant { |
170 | 170 | /** |
171 | 171 | * 代购订单使用 |
172 | 172 | */ |
173 | - public static final Long OPERATOR_ROLE_BUYER = 10L; //操作人角色 10买家 | |
174 | - public static final Long OPERATOR_ROLE_SELLER = 20L; //操作人角色 20卖家 | |
173 | + public static final Integer OPERATOR_ROLE_BUYER = 10; //操作人角色 10买家 | |
174 | + public static final Integer OPERATOR_ROLE_SELLER = 20; //操作人角色 20卖家 | |
175 | 175 | /** 是否选择代找物流:1-是,2-否*/ |
176 | 176 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_YES = 1; |
177 | 177 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_NO = 0; | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/ErrorMessage.java
... | ... | @@ -45,6 +45,7 @@ public final class ErrorMessage { |
45 | 45 | public static final String USER_NOT_LOGIN = "用户没有登录,请登录"; |
46 | 46 | public static final String USER_LOGIN_MULTI = "你的账号在其他设备登录,您被迫下线!"; |
47 | 47 | public static final String USER_NOT_EXIST = "用户信息不存在,请重新操作"; |
48 | + public static final String USER_SEARCH_FAILED = "查询用户信息失败"; | |
48 | 49 | public static final String USER_PASSWORD_WRONG = "原始密码输入错误,请重新输入"; |
49 | 50 | public static final String USER_MOBILE_EXIST = "手机号码已经存在,请重新输入"; |
50 | 51 | public static final String USER_MOBILE_NOT_EXIST = "用户不存在,请重新输入"; |
... | ... | @@ -63,7 +64,7 @@ public final class ErrorMessage { |
63 | 64 | public static final String SELLER_NOT_OPEN_SHOP ="您还未开通店铺,请到网站进行开通"; |
64 | 65 | public static final String SELLER_SHOP_NOT_AUDIT ="您的店铺还未审核通过,请等待审核"; |
65 | 66 | public static final String USER_FAVORITE_ADD_ERROR ="添加收藏失败,请重新操作"; |
66 | - | |
67 | + public static final String BUYER_NOT_OPEN_SHOP ="您还未绑定店铺"; | |
67 | 68 | |
68 | 69 | |
69 | 70 | /** | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/ResultCode.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/GetShopDeliveryTimeReq.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.base.BaseListReq; |
4 | +import io.swagger.annotations.ApiModelProperty; | |
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Created by xxxzzz on 2016/12/21. |
7 | 8 | */ |
8 | -public class GetShopDeliveryTimeReq extends BaseListReq { | |
9 | +public class GetShopDeliveryTimeReq extends BaseReq{ | |
10 | + @ApiModelProperty(value = "店铺ID") | |
11 | + private Long shopId; | |
12 | + | |
13 | + public Long getShopId() { | |
14 | + return shopId; | |
15 | + } | |
16 | + | |
17 | + public void setShopId(Long shopId) { | |
18 | + this.shopId = shopId; | |
19 | + } | |
9 | 20 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/GetShopDeliveryTimeResp.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.base.BaseListResp; | |
4 | 3 | import com.diligrp.mobsite.getway.domain.protocol.shop.DeliveryTimeInfo; |
5 | 4 | import io.swagger.annotations.ApiModelProperty; |
6 | 5 | |
... | ... | @@ -9,7 +8,7 @@ import java.util.List; |
9 | 8 | /** |
10 | 9 | * Created by xxxzzz on 2016/12/21. |
11 | 10 | */ |
12 | -public class GetShopDeliveryTimeResp extends BaseListResp { | |
11 | +public class GetShopDeliveryTimeResp extends BaseResp { | |
13 | 12 | |
14 | 13 | |
15 | 14 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/GoodsSuper.java
... | ... | @@ -20,7 +20,7 @@ public class GoodsSuper implements Serializable{ |
20 | 20 | @ApiModelProperty(value = "商品id" ) |
21 | 21 | private Long pid; |
22 | 22 | @ApiModelProperty(value = "商品状态:-1删除,3在售,4下架" ) |
23 | - private Long state; | |
23 | + private Integer state; | |
24 | 24 | @ApiModelProperty(value = "商品名称",required = true) |
25 | 25 | private String name; |
26 | 26 | @ApiModelProperty(value = "商品单位",required = true) |
... | ... | @@ -45,11 +45,11 @@ public class GoodsSuper implements Serializable{ |
45 | 45 | private Integer indexTop; |
46 | 46 | |
47 | 47 | |
48 | - public Long getState() { | |
48 | + public Integer getState() { | |
49 | 49 | return state; |
50 | 50 | } |
51 | 51 | |
52 | - public void setState(Long state) { | |
52 | + public void setState(Integer state) { | |
53 | 53 | this.state = state; |
54 | 54 | } |
55 | 55 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/Token.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/BindToShopResp.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.detail; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; | |
3 | 4 | import com.diligrp.mobsite.getway.domain.protocol.BaseResp; |
5 | +import io.swagger.annotations.ApiModelProperty; | |
4 | 6 | |
5 | 7 | /** |
6 | 8 | * <B>Description</B> 店铺简介响应 <br /> |
... | ... | @@ -12,35 +14,14 @@ import com.diligrp.mobsite.getway.domain.protocol.BaseResp; |
12 | 14 | */ |
13 | 15 | @SuppressWarnings("serial") |
14 | 16 | public class BindToShopResp extends BaseResp { |
17 | + @ApiModelProperty(value = "买家当前绑定的店铺信息") | |
18 | + private ShopBuyerOutput shopBuyerOutput; | |
15 | 19 | |
16 | - private Long shopId; | |
17 | - | |
18 | - private String shopName; | |
19 | - | |
20 | - private String logo; | |
21 | - | |
22 | - | |
23 | - public Long getShopId() { | |
24 | - return shopId; | |
25 | - } | |
26 | - | |
27 | - public void setShopId(Long shopId) { | |
28 | - this.shopId = shopId; | |
29 | - } | |
30 | - | |
31 | - public String getShopName() { | |
32 | - return shopName; | |
33 | - } | |
34 | - | |
35 | - public void setShopName(String shopName) { | |
36 | - this.shopName = shopName; | |
37 | - } | |
38 | - | |
39 | - public String getLogo() { | |
40 | - return logo; | |
20 | + public ShopBuyerOutput getShopBuyerOutput() { | |
21 | + return shopBuyerOutput; | |
41 | 22 | } |
42 | 23 | |
43 | - public void setLogo(String logo) { | |
44 | - this.logo = logo; | |
24 | + public void setShopBuyerOutput(ShopBuyerOutput shopBuyerOutput) { | |
25 | + this.shopBuyerOutput = shopBuyerOutput; | |
45 | 26 | } |
46 | 27 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/GetProductRecommendReq.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.detail; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
3 | +import com.diligrp.mobsite.getway.domain.base.BaseListReq; | |
4 | 4 | |
5 | 5 | /** |
6 | 6 | * <B>Description</B> 获取商品推荐请求 <br /> |
... | ... | @@ -11,7 +11,7 @@ import com.diligrp.mobsite.getway.domain.protocol.BaseReq; |
11 | 11 | * @author wujianjun |
12 | 12 | */ |
13 | 13 | @SuppressWarnings("serial") |
14 | -public class GetProductRecommendReq extends BaseReq { | |
14 | +public class GetProductRecommendReq extends BaseListReq { | |
15 | 15 | |
16 | 16 | /** |
17 | 17 | * 店铺ID | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/GetProductRecommendResp.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.detail; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
3 | +import com.diligrp.mobsite.getway.domain.base.BaseListResp; | |
4 | 4 | import com.diligrp.mobsite.getway.domain.protocol.GoodsSuper; |
5 | 5 | |
6 | 6 | import java.util.List; |
... | ... | @@ -14,7 +14,7 @@ import java.util.List; |
14 | 14 | * @author wujianjun |
15 | 15 | */ |
16 | 16 | @SuppressWarnings("serial") |
17 | -public class GetProductRecommendResp extends BaseResp { | |
17 | +public class GetProductRecommendResp extends BaseListResp { | |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * 商品列表 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/GetShopByIdReq.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/detail/GetShopByIdResp.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.detail; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.BaseResp; |
4 | +import io.swagger.annotations.ApiModelProperty; | |
5 | + | |
6 | +import java.util.List; | |
4 | 7 | |
5 | 8 | /** |
6 | 9 | * Created by xxxzzz on 2016/12/9. |
7 | 10 | */ |
8 | 11 | public class GetShopByIdResp extends BaseResp { |
12 | + @ApiModelProperty(value = "店铺id") | |
13 | + private Long shopId; | |
14 | + | |
15 | + @ApiModelProperty(value = "城市code") | |
16 | + private Long cityCode; | |
17 | + | |
18 | + @ApiModelProperty(value = "城市名称") | |
19 | + private String cityName; | |
20 | + | |
21 | + @ApiModelProperty(value = "店铺名称") | |
22 | + private String shopName; | |
23 | + | |
24 | + @ApiModelProperty(value = "店铺logo") | |
25 | + private String shopLogo; | |
26 | + | |
27 | + @ApiModelProperty(value = "主营类目") | |
28 | + private List<Long> categories; | |
29 | + | |
30 | + | |
31 | + | |
32 | + @ApiModelProperty(value = "店铺地址") | |
33 | + private String shopAddr; | |
34 | + | |
35 | + @ApiModelProperty(value = "客户电话") | |
36 | + private String phone; | |
37 | + | |
38 | + | |
39 | + @ApiModelProperty(value = "商品排列方式(1:两列式 2:列表式)") | |
40 | + private Integer productDisplayWay; | |
41 | + | |
42 | + @ApiModelProperty(value = "配送费") | |
43 | + private Long postage; | |
44 | + | |
45 | + @ApiModelProperty(value = "订单免配送费金额") | |
46 | + private Long freeShippingPrice; | |
47 | + | |
48 | + @ApiModelProperty(value = "店铺公告") | |
49 | + private String shopNotices; | |
50 | + | |
51 | + public Long getShopId() { | |
52 | + return shopId; | |
53 | + } | |
54 | + | |
55 | + public void setShopId(Long shopId) { | |
56 | + this.shopId = shopId; | |
57 | + } | |
58 | + | |
59 | + public Long getCityCode() { | |
60 | + return cityCode; | |
61 | + } | |
62 | + | |
63 | + public void setCityCode(Long cityCode) { | |
64 | + this.cityCode = cityCode; | |
65 | + } | |
66 | + | |
67 | + public String getCityName() { | |
68 | + return cityName; | |
69 | + } | |
70 | + | |
71 | + public void setCityName(String cityName) { | |
72 | + this.cityName = cityName; | |
73 | + } | |
74 | + | |
75 | + public String getShopName() { | |
76 | + return shopName; | |
77 | + } | |
78 | + | |
79 | + public void setShopName(String shopName) { | |
80 | + this.shopName = shopName; | |
81 | + } | |
82 | + | |
83 | + public String getShopLogo() { | |
84 | + return shopLogo; | |
85 | + } | |
86 | + | |
87 | + public void setShopLogo(String shopLogo) { | |
88 | + this.shopLogo = shopLogo; | |
89 | + } | |
90 | + | |
91 | + | |
92 | + public List<Long> getCategories() { | |
93 | + return categories; | |
94 | + } | |
95 | + | |
96 | + public void setCategories(List<Long> categories) { | |
97 | + this.categories = categories; | |
98 | + } | |
99 | + | |
100 | + public Integer getProductDisplayWay() { | |
101 | + return productDisplayWay; | |
102 | + } | |
103 | + | |
104 | + public void setProductDisplayWay(Integer productDisplayWay) { | |
105 | + this.productDisplayWay = productDisplayWay; | |
106 | + } | |
107 | + | |
108 | + public Long getPostage() { | |
109 | + return postage; | |
110 | + } | |
111 | + | |
112 | + public void setPostage(Long postage) { | |
113 | + this.postage = postage; | |
114 | + } | |
115 | + | |
116 | + public Long getFreeShippingPrice() { | |
117 | + return freeShippingPrice; | |
118 | + } | |
119 | + | |
120 | + public void setFreeShippingPrice(Long freeShippingPrice) { | |
121 | + this.freeShippingPrice = freeShippingPrice; | |
122 | + } | |
123 | + | |
124 | + public String getShopNotices() { | |
125 | + return shopNotices; | |
126 | + } | |
127 | + | |
128 | + public void setShopNotices(String shopNotices) { | |
129 | + this.shopNotices = shopNotices; | |
130 | + } | |
131 | + | |
132 | + public String getShopAddr() { | |
133 | + return shopAddr; | |
134 | + } | |
135 | + | |
136 | + public void setShopAddr(String shopAddr) { | |
137 | + this.shopAddr = shopAddr; | |
138 | + } | |
139 | + | |
140 | + public String getPhone() { | |
141 | + return phone; | |
142 | + } | |
143 | + | |
144 | + public void setPhone(String phone) { | |
145 | + this.phone = phone; | |
146 | + } | |
9 | 147 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/fund/GetfundTradeRecordReq.java
... | ... | @@ -10,15 +10,15 @@ public class GetfundTradeRecordReq extends BaseListReq { |
10 | 10 | |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "查询类型(1:充值 2:冻结4:消费)" ,required = true) |
13 | - private Long tradeType; | |
13 | + private Integer tradeType; | |
14 | 14 | @ApiModelProperty(value = "店铺用户ID,绑定的唯一标识") |
15 | 15 | private Long shopBuyerId; |
16 | 16 | |
17 | - public Long getTradeType() { | |
17 | + public Integer getTradeType() { | |
18 | 18 | return tradeType; |
19 | 19 | } |
20 | 20 | |
21 | - public void setTradeType(Long tradeType) { | |
21 | + public void setTradeType(Integer tradeType) { | |
22 | 22 | this.tradeType = tradeType; |
23 | 23 | } |
24 | 24 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/fund/GetfundTradeRecordResp.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.fund; |
2 | 2 | |
3 | -import com.b2c.orders.commons.utils.DateUtils; | |
4 | 3 | import com.diligrp.mobsite.getway.domain.base.BaseListResp; |
5 | -import com.diligrp.mobsite.getway.domain.protocol.fund.model.FoundTrade; | |
6 | -import io.swagger.annotations.ApiModelProperty; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.fund.model.FundTrade; | |
7 | 5 | |
8 | 6 | import java.util.List; |
9 | 7 | |
... | ... | @@ -12,13 +10,13 @@ import java.util.List; |
12 | 10 | */ |
13 | 11 | public class GetfundTradeRecordResp extends BaseListResp { |
14 | 12 | |
15 | - private List<FoundTrade> foundTrades; | |
13 | + private List<FundTrade> fundTrades; | |
16 | 14 | |
17 | - public List<FoundTrade> getFoundTrades() { | |
18 | - return foundTrades; | |
15 | + public List<FundTrade> getFundTrades() { | |
16 | + return fundTrades; | |
19 | 17 | } |
20 | 18 | |
21 | - public void setFoundTrades(List<FoundTrade> foundTrades) { | |
22 | - this.foundTrades = foundTrades; | |
19 | + public void setFundTrades(List<FundTrade> fundTrades) { | |
20 | + this.fundTrades = fundTrades; | |
23 | 21 | } |
24 | 22 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/fund/StoreValueReq.java
... | ... | @@ -3,28 +3,27 @@ package com.diligrp.mobsite.getway.domain.protocol.fund; |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.BaseReq; |
4 | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | 5 | |
6 | +import javax.validation.constraints.NotNull; | |
7 | + | |
6 | 8 | /** |
7 | 9 | * Created by xxxzzz on 2017/1/3. |
8 | 10 | */ |
9 | 11 | public class StoreValueReq extends BaseReq { |
10 | - | |
11 | - | |
12 | - | |
13 | - @ApiModelProperty(value = "交易类型(1:充值 2:冻结4:消费)" ,required = true) | |
14 | - private Long tradeType; | |
15 | - | |
16 | - | |
12 | + @ApiModelProperty(value = "买家绑定店铺唯一标识") | |
13 | + @NotNull(message="买家绑定店铺唯一标识不能为空") | |
14 | + private Long shopBuyerId; | |
17 | 15 | |
18 | 16 | @ApiModelProperty(value = "交易金额",required = true) |
17 | + @NotNull(message="交易金额不能为空") | |
19 | 18 | private Long tradePrice; |
20 | 19 | |
21 | 20 | |
22 | - public Long getTradeType() { | |
23 | - return tradeType; | |
21 | + public Long getShopBuyerId() { | |
22 | + return shopBuyerId; | |
24 | 23 | } |
25 | 24 | |
26 | - public void setTradeType(Long tradeType) { | |
27 | - this.tradeType = tradeType; | |
25 | + public void setShopBuyerId(Long shopBuyerId) { | |
26 | + this.shopBuyerId = shopBuyerId; | |
28 | 27 | } |
29 | 28 | |
30 | 29 | public Long getTradePrice() { | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/fund/model/FoundTrade.java renamed to mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/fund/model/FundTrade.java
... | ... | @@ -10,7 +10,7 @@ import java.util.Date; |
10 | 10 | * <br /> |
11 | 11 | * @createTime 2016-11-23 17:19:15 |
12 | 12 | * @author template |
13 | - */public class FoundTrade{ | |
13 | + */public class FundTrade { | |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * 订单编号 |
... | ... | @@ -30,7 +30,7 @@ import java.util.Date; |
30 | 30 | /** |
31 | 31 | * 交易类型(1:充值 2:冻结3:解冻 4:消费) |
32 | 32 | */ |
33 | - private Long tradeType; | |
33 | + private Integer tradeType; | |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * 交易时间 |
... | ... | @@ -61,11 +61,11 @@ import java.util.Date; |
61 | 61 | this.tradePrice = tradePrice; |
62 | 62 | } |
63 | 63 | |
64 | - public Long getTradeType() { | |
64 | + public Integer getTradeType() { | |
65 | 65 | return tradeType; |
66 | 66 | } |
67 | 67 | |
68 | - public void setTradeType(Long tradeType) { | |
68 | + public void setTradeType(Integer tradeType) { | |
69 | 69 | this.tradeType = tradeType; |
70 | 70 | } |
71 | 71 | |
... | ... | @@ -79,7 +79,7 @@ import java.util.Date; |
79 | 79 | |
80 | 80 | @Override |
81 | 81 | public String toString() { |
82 | - return "FoundTrade{" + | |
82 | + return "FundTrade{" + | |
83 | 83 | ", orderId=" + orderId + |
84 | 84 | ", tradeName='" + tradeName + '\'' + |
85 | 85 | ", tradePrice=" + tradePrice + | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/AuthLoginReq.java
... | ... | @@ -34,6 +34,14 @@ public class AuthLoginReq extends BaseReq { |
34 | 34 | private String registerNo; |
35 | 35 | |
36 | 36 | |
37 | + public String getAuthCode() { | |
38 | + return authCode; | |
39 | + } | |
40 | + | |
41 | + public void setAuthCode(String authCode) { | |
42 | + this.authCode = authCode; | |
43 | + } | |
44 | + | |
37 | 45 | public AuthLoginReq() { |
38 | 46 | } |
39 | 47 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/CheckVeriCodeReq.java
... | ... | @@ -26,10 +26,7 @@ public class CheckVeriCodeReq extends BaseReq { |
26 | 26 | */ |
27 | 27 | @ApiModelProperty(value = "手机号码",required = true) |
28 | 28 | private String mobile; |
29 | - /** | |
30 | - * 消息类型 | |
31 | - */ | |
32 | - private Integer msgType = SendVeriCodeReq.MSG_TYPE_DEFAULT; | |
29 | + | |
33 | 30 | |
34 | 31 | /** |
35 | 32 | * get value of CheckVeriCodeReq.veriCode |
... | ... | @@ -73,12 +70,5 @@ public class CheckVeriCodeReq extends BaseReq { |
73 | 70 | this.mobile = mobile; |
74 | 71 | } |
75 | 72 | |
76 | - public Integer getMsgType() { | |
77 | - return msgType; | |
78 | - } | |
79 | - | |
80 | - public void setMsgType(Integer msgType) { | |
81 | - this.msgType = msgType; | |
82 | - } | |
83 | 73 | |
84 | 74 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/LoginResp.java
... | ... | @@ -52,8 +52,10 @@ public class LoginResp extends BaseResp { |
52 | 52 | @ApiModelProperty(value = "当前绑定的店铺id") |
53 | 53 | private Long currentShopId; |
54 | 54 | |
55 | - @ApiModelProperty(value = "店铺购买者ID") | |
56 | - private Long shopBuyerId; | |
55 | + | |
56 | + | |
57 | + //@ApiModelProperty(value = "店铺购买者ID") | |
58 | + //private Long shopBuyerId; | |
57 | 59 | |
58 | 60 | |
59 | 61 | public Long getBuyerId() { |
... | ... | @@ -73,13 +75,13 @@ public class LoginResp extends BaseResp { |
73 | 75 | this.currentShopId = currentShopId; |
74 | 76 | } |
75 | 77 | |
76 | - public Long getShopBuyerId() { | |
77 | - return shopBuyerId; | |
78 | - } | |
79 | - | |
80 | - public void setShopBuyerId(Long shopBuyerId) { | |
81 | - this.shopBuyerId = shopBuyerId; | |
82 | - } | |
78 | + //public Long getShopBuyerId() { | |
79 | + // return shopBuyerId; | |
80 | + //} | |
81 | + // | |
82 | + //public void setShopBuyerId(Long shopBuyerId) { | |
83 | + // this.shopBuyerId = shopBuyerId; | |
84 | + //} | |
83 | 85 | |
84 | 86 | /** |
85 | 87 | * get value of LoginResp.accountName | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeReq.java
... | ... | @@ -17,12 +17,13 @@ public class SendVeriCodeReq extends BaseReq { |
17 | 17 | /** |
18 | 18 | * |
19 | 19 | * 发送校验码类别 |
20 | + * 1.登录 | |
20 | 21 | * 2.注册 |
21 | 22 | * 3.找回密码 |
22 | 23 | * 4.修改新手机号 |
23 | 24 | * 5.验证旧的手机号 |
24 | 25 | */ |
25 | - public static final int MSG_TYPE_DEFAULT = 1; | |
26 | + public static final int MSG_TYPE_LOGIN = 1; | |
26 | 27 | public static final int MSG_TYPE_REGISTER = 2; |
27 | 28 | public static final int MSG_TYPE_RETRIEVE_PASSWORD = 3; |
28 | 29 | public static final int MSG_TYPE_MODIFY_NEW_MOBILE = 4; |
... | ... | @@ -36,7 +37,7 @@ public class SendVeriCodeReq extends BaseReq { |
36 | 37 | /** |
37 | 38 | * 消息类型 |
38 | 39 | */ |
39 | - @ApiModelProperty(value = "消息类型:1保留,2注册,3找回密码,4修改新电话号码,5验证旧电话号码",required = true) | |
40 | + @ApiModelProperty(value = "消息类型:1验证码登录,2注册,3找回密码",required = true) | |
40 | 41 | private Integer msgType; |
41 | 42 | |
42 | 43 | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeResp.java
... | ... | @@ -31,10 +31,13 @@ public class SendVeriCodeResp extends BaseResp { |
31 | 31 | @ApiModelProperty(value = "发送结果:1成功") |
32 | 32 | private Integer sendCode = SEND_CODE_ERROR; |
33 | 33 | /** |
34 | - * 万能验证码 | |
34 | + * 验证码 | |
35 | 35 | */ |
36 | - @ApiModelProperty(value = "万能验证码") | |
36 | + @ApiModelProperty(value = "验证码(测试用)") | |
37 | 37 | private String passKey; |
38 | + | |
39 | + | |
40 | + | |
38 | 41 | |
39 | 42 | /** |
40 | 43 | * get value of SendVeriCodeResp.sendCode |
... | ... | @@ -59,12 +62,11 @@ public class SendVeriCodeResp extends BaseResp { |
59 | 62 | } |
60 | 63 | |
61 | 64 | |
62 | - public String getPassKey() { | |
63 | - return passKey; | |
64 | - } | |
65 | - | |
65 | + public String getPassKey() { | |
66 | + return passKey; | |
67 | + } | |
66 | 68 | |
67 | - public void setPassKey(String passKey) { | |
68 | - this.passKey = passKey; | |
69 | - } | |
69 | + public void setPassKey(String passKey) { | |
70 | + this.passKey = passKey; | |
71 | + } | |
70 | 72 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/pickinfo/GetPickInfoListResp.java
... | ... | @@ -2,6 +2,7 @@ package com.diligrp.mobsite.getway.domain.protocol.pickinfo; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.BaseResp; |
4 | 4 | import com.diligrp.mobsite.getway.domain.protocol.PickInfo; |
5 | +import io.swagger.annotations.ApiModelProperty; | |
5 | 6 | |
6 | 7 | import java.util.List; |
7 | 8 | |
... | ... | @@ -19,6 +20,14 @@ public class GetPickInfoListResp extends BaseResp { |
19 | 20 | /** |
20 | 21 | * 提货人信息列表 |
21 | 22 | */ |
23 | + @ApiModelProperty(value = "收货人列表") | |
22 | 24 | private List<PickInfo> pickInfos; |
23 | 25 | |
26 | + public List<PickInfo> getPickInfos() { | |
27 | + return pickInfos; | |
28 | + } | |
29 | + | |
30 | + public void setPickInfos(List<PickInfo> pickInfos) { | |
31 | + this.pickInfos = pickInfos; | |
32 | + } | |
24 | 33 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/pickinfo/SetDefaultPickInfoReq.java renamed to mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/pickinfo/SetDefaultReq.java
... | ... | @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; |
13 | 13 | * @createTime 2014/8/28 16:23 |
14 | 14 | */ |
15 | 15 | @SuppressWarnings("serial") |
16 | -public class SetDefaultPickInfoReq extends BaseReq { | |
16 | +public class SetDefaultReq extends BaseReq { | |
17 | 17 | /** |
18 | 18 | * 提货人信息Id |
19 | 19 | */ | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/pickinfo/SetDefaultPickInfoResp.java renamed to mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/pickinfo/SetDefaultResp.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/ListCategoryReq.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | + | |
5 | +/** | |
6 | + * Created by yanggang on 2017/1/17. | |
7 | + */ | |
8 | +public class ListCategoryReq extends BaseReq { | |
9 | + | |
10 | + private int parentId; | |
11 | + private int shopId; | |
12 | + | |
13 | + public int getParentId() { | |
14 | + return parentId; | |
15 | + } | |
16 | + | |
17 | + public void setParentId(int parentId) { | |
18 | + this.parentId = parentId; | |
19 | + } | |
20 | + | |
21 | + public int getShopId() { | |
22 | + return shopId; | |
23 | + } | |
24 | + | |
25 | + public void setShopId(int shopId) { | |
26 | + this.shopId = shopId; | |
27 | + } | |
28 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/ListCategoryResp.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.Category; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * Created by yanggang on 2017/1/17. | |
10 | + */ | |
11 | +public class ListCategoryResp extends BaseResp { | |
12 | + | |
13 | + private List<Category> categories; | |
14 | + | |
15 | + public List<Category> getCategories() { | |
16 | + return categories; | |
17 | + } | |
18 | + | |
19 | + public void setCategories(List<Category> categories) { | |
20 | + this.categories = categories; | |
21 | + } | |
22 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/SearchProductReq.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | + | |
5 | +/** | |
6 | + * Created by yanggang on 2017/1/17. | |
7 | + */ | |
8 | +public class SearchProductReq extends BaseReq { | |
9 | + | |
10 | + private Integer page; | |
11 | + private Integer pageSize; | |
12 | + private Integer cateId; | |
13 | + private Integer status; | |
14 | + private String name; | |
15 | + | |
16 | + public Integer getPage() { | |
17 | + return page; | |
18 | + } | |
19 | + | |
20 | + public void setPage(Integer page) { | |
21 | + this.page = page; | |
22 | + } | |
23 | + | |
24 | + public Integer getPageSize() { | |
25 | + return pageSize; | |
26 | + } | |
27 | + | |
28 | + public void setPageSize(Integer pageSize) { | |
29 | + this.pageSize = pageSize; | |
30 | + } | |
31 | + | |
32 | + public Integer getCateId() { | |
33 | + return cateId; | |
34 | + } | |
35 | + | |
36 | + public void setCateId(Integer cateId) { | |
37 | + this.cateId = cateId; | |
38 | + } | |
39 | + | |
40 | + public Integer getStatus() { | |
41 | + return status; | |
42 | + } | |
43 | + | |
44 | + public void setStatus(Integer status) { | |
45 | + this.status = status; | |
46 | + } | |
47 | + | |
48 | + public String getName() { | |
49 | + return name; | |
50 | + } | |
51 | + | |
52 | + public void setName(String name) { | |
53 | + this.name = name; | |
54 | + } | |
55 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/SearchProductResp.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.Goods; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * Created by yanggang on 2017/1/17. | |
10 | + */ | |
11 | +public class SearchProductResp extends BaseResp { | |
12 | + | |
13 | + private List<Goods> productList; | |
14 | + | |
15 | + public List<Goods> getProductList() { | |
16 | + return productList; | |
17 | + } | |
18 | + | |
19 | + public void setProductList(List<Goods> productList) { | |
20 | + this.productList = productList; | |
21 | + } | |
22 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/register/CheckMobileResp.java
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/shop/AddShopDeliveryTimeReq.java
... | ... | @@ -9,16 +9,36 @@ import java.util.List; |
9 | 9 | * Created by xxxzzz on 2016/12/28. |
10 | 10 | */ |
11 | 11 | public class AddShopDeliveryTimeReq extends BaseReq { |
12 | + @ApiModelProperty(value = "店铺ID") | |
13 | + private Long shopId; | |
12 | 14 | |
13 | - @ApiModelProperty(value = "时间段",required = true) | |
14 | - private List<DeliveryTimeInfo> deliveryTimeInfos; | |
15 | + @ApiModelProperty(value = "开始时间(如:13:00)",required = true) | |
16 | + private String beginTime; | |
15 | 17 | |
18 | + @ApiModelProperty(value = "结束时间(如:14:00)",required = true) | |
19 | + private String endTime; | |
16 | 20 | |
17 | - public List<DeliveryTimeInfo> getDeliveryTimeInfos() { | |
18 | - return deliveryTimeInfos; | |
21 | + public Long getShopId() { | |
22 | + return shopId; | |
19 | 23 | } |
20 | 24 | |
21 | - public void setDeliveryTimeInfos(List<DeliveryTimeInfo> deliveryTimeInfos) { | |
22 | - this.deliveryTimeInfos = deliveryTimeInfos; | |
25 | + public void setShopId(Long shopId) { | |
26 | + this.shopId = shopId; | |
27 | + } | |
28 | + | |
29 | + public String getBeginTime() { | |
30 | + return beginTime; | |
31 | + } | |
32 | + | |
33 | + public void setBeginTime(String beginTime) { | |
34 | + this.beginTime = beginTime; | |
35 | + } | |
36 | + | |
37 | + public String getEndTime() { | |
38 | + return endTime; | |
39 | + } | |
40 | + | |
41 | + public void setEndTime(String endTime) { | |
42 | + this.endTime = endTime; | |
23 | 43 | } |
24 | 44 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetDepositCardAmountReq.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.user; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.BaseReq; |
4 | +import io.swagger.annotations.ApiModelProperty; | |
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Created by xxxzzz on 2016/12/27. |
7 | 8 | */ |
8 | 9 | public class GetDepositCardAmountReq extends BaseReq { |
9 | 10 | |
11 | + @ApiModelProperty(value = "店铺用户ID,绑定的唯一标识") | |
12 | + private Long shopBuyerId; | |
10 | 13 | |
11 | 14 | |
15 | + public Long getShopBuyerId() { | |
16 | + return shopBuyerId; | |
17 | + } | |
12 | 18 | |
13 | - | |
14 | - | |
19 | + public void setShopBuyerId(Long shopBuyerId) { | |
20 | + this.shopBuyerId = shopBuyerId; | |
21 | + } | |
15 | 22 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetDepositCardAmountResp.java
... | ... | @@ -8,15 +8,47 @@ import io.swagger.annotations.ApiModelProperty; |
8 | 8 | */ |
9 | 9 | public class GetDepositCardAmountResp extends BaseResp { |
10 | 10 | |
11 | - @ApiModelProperty(value = "储值卡余额") | |
12 | - private Long depositCardAmount; | |
13 | 11 | |
14 | 12 | |
15 | - public Long getDepositCardAmount() { | |
16 | - return depositCardAmount; | |
13 | + @ApiModelProperty("储值总金额") | |
14 | + private Long storedTotalPrice; | |
15 | + @ApiModelProperty("可用余额") | |
16 | + private Long residueTotalPrice; | |
17 | + @ApiModelProperty("冻结总金额") | |
18 | + private Long freezeTotalPrice; | |
19 | + @ApiModelProperty("店铺id") | |
20 | + private Long shopId; | |
21 | + | |
22 | + | |
23 | + public Long getShopId() { | |
24 | + return shopId; | |
25 | + } | |
26 | + | |
27 | + public void setShopId(Long shopId) { | |
28 | + this.shopId = shopId; | |
29 | + } | |
30 | + | |
31 | + public Long getFreezeTotalPrice() { | |
32 | + return freezeTotalPrice; | |
33 | + } | |
34 | + | |
35 | + public void setFreezeTotalPrice(Long freezeTotalPrice) { | |
36 | + this.freezeTotalPrice = freezeTotalPrice; | |
37 | + } | |
38 | + | |
39 | + public Long getResidueTotalPrice() { | |
40 | + return residueTotalPrice; | |
41 | + } | |
42 | + | |
43 | + public void setResidueTotalPrice(Long residueTotalPrice) { | |
44 | + this.residueTotalPrice = residueTotalPrice; | |
45 | + } | |
46 | + | |
47 | + public Long getStoredTotalPrice() { | |
48 | + return storedTotalPrice; | |
17 | 49 | } |
18 | 50 | |
19 | - public void setDepositCardAmount(Long depositCardAmount) { | |
20 | - this.depositCardAmount = depositCardAmount; | |
51 | + public void setStoredTotalPrice(Long storedTotalPrice) { | |
52 | + this.storedTotalPrice = storedTotalPrice; | |
21 | 53 | } |
22 | 54 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/DeliveryTimeRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc; | |
2 | + | |
3 | +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeListInput; | |
4 | +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeSaveInput; | |
5 | +import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput; | |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * Created by jiangchengyong on 2017/1/18. | |
11 | + */ | |
12 | +public interface DeliveryTimeRPC { | |
13 | + /** | |
14 | + * @comment 创建店铺送货时间段 | |
15 | + * @param deliveryTimeSaveInput | |
16 | + * @return BaseOutput<Integer> | |
17 | + * @author kelan | |
18 | + * @time 2016/11/30 16:23 | |
19 | + */ | |
20 | + public DeliveryTimeOutput createShopDeliveryTime(DeliveryTimeSaveInput deliveryTimeSaveInput); | |
21 | + /** | |
22 | + * @comment 删除店铺送货时间段 | |
23 | + * @param deliveryTimeId 送货时间段id | |
24 | + * @return BaseOutput<Integer> | |
25 | + * @author kelan | |
26 | + * @time 2016/11/30 16:25 | |
27 | + */ | |
28 | + public Boolean deleteShopDeliveryTime(Long... deliveryTimeId); | |
29 | + /** | |
30 | + * @comment 查找店铺送货时间段 | |
31 | + * @param deliveryTimeListInput 店铺送货时间段对象 | |
32 | + * @return BaseOutput<List<DeliveryTimeOutput>> 店铺送货时间段列表 | |
33 | + * @author kelan | |
34 | + * @time 2016/11/30 16:26 | |
35 | + */ | |
36 | + public List<DeliveryTimeOutput> queryShopDeliveryTime(DeliveryTimeListInput deliveryTimeListInput); | |
37 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/FundTradeRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc; | |
2 | + | |
3 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeListInput; | |
4 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeSaveInput; | |
5 | +import com.b2c.myapp.common.api.fundTrade.output.FundTradeOutput; | |
6 | +import com.b2c.myapp.common.utils.base.Page; | |
7 | + | |
8 | +/** | |
9 | + * Created by jiangchengyong on 2017/1/19. | |
10 | + */ | |
11 | +public interface FundTradeRPC { | |
12 | + /** | |
13 | + * @comment 多条件查询储值卡资金交易明细 | |
14 | + * @param FundTradeListInput | |
15 | + * @return BaseOutput<Page<FundTradeOutput>> | |
16 | + * @author kelan | |
17 | + * @time 2016/12/8 10:36 | |
18 | + */ | |
19 | + public Page<FundTradeOutput> queryFundTrade(FundTradeListInput FundTradeListInput); | |
20 | + | |
21 | + /** | |
22 | + * 储值卡交易 | |
23 | + * @param fundTradeSaveInput | |
24 | + * @return | |
25 | + */ | |
26 | + Boolean fundTrade(FundTradeSaveInput fundTradeSaveInput); | |
27 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/GoodsRPC.java
... | ... | @@ -15,6 +15,9 @@ import com.diligrp.titan.sdk.domain.Category; |
15 | 15 | import com.diligrp.titan.sdk.domain.Product; |
16 | 16 | import com.diligrp.titan.sdk.input.CategoryInput; |
17 | 17 | import com.diligrp.titan.sdk.input.PopProductView; |
18 | +import com.diligrp.titan.sdk.input.ProductSearchInput; | |
19 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | |
20 | +import com.diligrp.titan.sdk.output.PageOutput; | |
18 | 21 | |
19 | 22 | import java.util.HashMap; |
20 | 23 | import java.util.List; |
... | ... | @@ -41,7 +44,7 @@ public interface GoodsRPC { |
41 | 44 | * @Title: getGoodsById |
42 | 45 | * @Description: 根据id获取商品详情 |
43 | 46 | */ |
44 | - public Product getGoodsById(Long id, String[] defindResult); | |
47 | + Product getGoodsById(Long id, String[] defindResult); | |
45 | 48 | |
46 | 49 | /** |
47 | 50 | * @param categoryId |
... | ... | @@ -51,7 +54,7 @@ public interface GoodsRPC { |
51 | 54 | * @createTime 2014年8月19日 下午2:55:50 |
52 | 55 | * @author zhangshirui |
53 | 56 | */ |
54 | - public HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId); | |
57 | + HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId); | |
55 | 58 | |
56 | 59 | /** |
57 | 60 | * 更具商品id获取商品 |
... | ... | @@ -123,4 +126,11 @@ public interface GoodsRPC { |
123 | 126 | List<Category> searchProductCategory(String input, Long userId); |
124 | 127 | |
125 | 128 | Object addGoods(PopProductView req, Long userId); |
129 | + | |
130 | + PageOutput<List<Product>> getProductRecommend(ProductSearchInput input , Long userId); | |
131 | + | |
132 | + List<Category> listCategory(int parentId,int shopId); | |
133 | + | |
134 | + List<Product> searchProduct(ProductSearchInput input); | |
135 | + Object updateProduct(UpdateProductInput updateProductInput); | |
126 | 136 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PassportRPC.java
1 | 1 | package com.diligrp.mobsite.getway.rpc; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; | |
4 | +import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; | |
5 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
3 | 6 | import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; |
4 | -import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp; | |
5 | 7 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; |
6 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp; | |
7 | 8 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
8 | -import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
9 | -import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp; | |
9 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
10 | +import com.diligrp.mobsite.getway.rpc.base.BaseOutput; | |
10 | 11 | import com.diligrp.mobsite.getway.rpc.base.BaseService; |
11 | 12 | |
12 | -import java.util.Map; | |
13 | - | |
14 | 13 | |
15 | 14 | /** |
16 | 15 | * <B>Description</B> Passport登陆 <br /> |
... | ... | @@ -22,13 +21,25 @@ import java.util.Map; |
22 | 21 | */ |
23 | 22 | public interface PassportRPC extends BaseService { |
24 | 23 | |
25 | - SellerLoginResp sellerLogin(LoginReq req); | |
24 | + SellerInfoOutput sellerLogin(LoginReq req); | |
25 | + | |
26 | + BuyerInfoOutput buyerRegister(UserRegisterReq req); | |
27 | + | |
28 | + boolean modifyPwdBuyer(ModifyPwdReq req); | |
29 | + boolean modifyPwdSeller(ModifyPwdReq req); | |
30 | + | |
31 | + SellerInfoOutput sellerRegister(SellerRegisterReq req); | |
32 | + | |
33 | + BuyerInfoOutput buyerLogin(LoginReq req); | |
34 | + | |
35 | + BaseOutput<String> sendVeriCodeOfSeller(String mobile, Integer msgType); | |
36 | + | |
37 | + BaseOutput<String> sendVeriCodeOfBuyer(String mobile,Integer msgType); | |
26 | 38 | |
27 | - UserRegisterResp register(UserRegisterReq req); | |
39 | + boolean verifySellerSmsCode(String mobile, String veriCode); | |
28 | 40 | |
29 | - String modifyPwd(Map<String, String> params); | |
41 | + boolean verifyBuyerSmsCode(String mobile, String veriCode); | |
30 | 42 | |
31 | - SellerRegisterResp sellerRegister(SellerRegisterReq req); | |
32 | 43 | |
33 | - LoginResp buyerLogin(LoginReq req); | |
44 | + BuyerInfoOutput authlogin(AuthLoginReq req); | |
34 | 45 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PickInfoRPC.java
... | ... | @@ -3,6 +3,7 @@ package com.diligrp.mobsite.getway.rpc; |
3 | 3 | import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoSaveInput; |
4 | 4 | import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoUpdateInput; |
5 | 5 | import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; |
6 | +import com.b2c.myapp.common.utils.BaseOutput; | |
6 | 7 | |
7 | 8 | import java.util.List; |
8 | 9 | |
... | ... | @@ -15,7 +16,7 @@ public interface PickInfoRPC { |
15 | 16 | * @param pickingInfoSaveInput |
16 | 17 | * @return |
17 | 18 | */ |
18 | - Integer addPickingInfo(PickingInfoSaveInput pickingInfoSaveInput); | |
19 | + PickingInfoOutput addPickingInfo(PickingInfoSaveInput pickingInfoSaveInput); | |
19 | 20 | |
20 | 21 | |
21 | 22 | /** |
... | ... | @@ -46,5 +47,12 @@ public interface PickInfoRPC { |
46 | 47 | * @author kelan |
47 | 48 | * @time 2016/12/16 17:58 |
48 | 49 | */ |
49 | - public Boolean delPickingInfoById(Long id); | |
50 | + Boolean delPickingInfoById(Long id); | |
51 | + | |
52 | + /** | |
53 | + * 根据收货信息ID查收货信息详情 | |
54 | + * @param id | |
55 | + * @return | |
56 | + */ | |
57 | + PickingInfoOutput getPickingInfoById(Long id); | |
50 | 58 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/SellerRPC.java
1 | 1 | package com.diligrp.mobsite.getway.rpc; |
2 | 2 | |
3 | -import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; | |
4 | 3 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
5 | -import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
6 | -import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
7 | - | |
8 | -import java.util.List; | |
9 | 4 | |
10 | 5 | |
11 | 6 | /** |
... | ... | @@ -32,17 +27,10 @@ public interface SellerRPC { |
32 | 27 | * @createTime 2014年8月27日 下午2:31:07 |
33 | 28 | * @author zhangshirui |
34 | 29 | */ |
35 | - boolean checkMobile(String mobile); | |
30 | + SellerInfoOutput checkMobile(String mobile); | |
31 | + | |
36 | 32 | |
37 | 33 | |
38 | - /** | |
39 | - * 修改进货单数量 | |
40 | - * @param req | |
41 | - * @return | |
42 | - * @createTime 2015年3月9日 下午2:49:27 | |
43 | - * @author zhangshirui | |
44 | - */ | |
45 | - boolean modifyAmount(ModifyAmountReq req); | |
46 | 34 | |
47 | 35 | /** |
48 | 36 | * 修改密码 |
... | ... | @@ -54,44 +42,11 @@ public interface SellerRPC { |
54 | 42 | */ |
55 | 43 | boolean modifyPwd(String accountName, String newPassword); |
56 | 44 | |
57 | - Long addConsignee(PickInfo pickInfo, Long userId); | |
58 | - | |
59 | - boolean updateConsignee(PickInfo pickInfo, Long userId); | |
60 | 45 | |
61 | - PickInfo getConsignee(Long id); | |
62 | - | |
63 | - boolean delConsignee(Long id); | |
64 | - | |
65 | - List<PickInfo> getConsigneeByUserId(Long userId); | |
66 | - | |
67 | - PickInfo getDefaultConsignee(Long userId); | |
68 | - | |
69 | - boolean setDefaultConsignee(Long id, Long userId); | |
70 | - | |
71 | - | |
72 | - /** | |
73 | - * 密码加密 | |
74 | - * @param pwd | |
75 | - * @return | |
76 | - * @createTime 2014年9月19日 上午10:04:35 | |
77 | - * @author zhangshirui | |
78 | - */ | |
79 | - String getEncryptPwd(String pwd); | |
80 | - | |
81 | - | |
82 | - | |
83 | - /** | |
84 | - * 验证用户密码 | |
85 | - * @param userId | |
86 | - * @param password | |
87 | - * @return | |
88 | - * @createTime 2015年6月24日 下午1:45:53 | |
89 | - * @author zhangshirui | |
90 | - */ | |
91 | - boolean checkPassword(Long userId, String password); | |
92 | - | |
93 | - | |
94 | - BuyerInfoOutput getUserByMobile(String accountName); | |
95 | 46 | |
96 | 47 | SellerInfoOutput getSellerByMobile(String accountName); |
48 | + | |
49 | + //ShopOutput getShopBySellerId(Long id); | |
50 | + // | |
51 | + //ShopOutput getShopById(Long id); | |
97 | 52 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/ShopBuyerRPC.java
... | ... | @@ -36,4 +36,12 @@ public interface ShopBuyerRPC { |
36 | 36 | * @return |
37 | 37 | */ |
38 | 38 | ShopBuyerKeyOutput getShopBuyerKeys(Long shopBuyerId); |
39 | + | |
40 | + /** | |
41 | + * 修改店铺名称 | |
42 | + * @param shopBuyerId | |
43 | + * @param remarkName | |
44 | + * @return | |
45 | + */ | |
46 | + Boolean modifyShopRemarkName(Long shopBuyerId,String remarkName); | |
39 | 47 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/UserRPC.java
1 | 1 | package com.diligrp.mobsite.getway.rpc; |
2 | 2 | |
3 | 3 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
4 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; | |
4 | 5 | import com.diligrp.mobsite.getway.domain.protocol.AddCartProduct; |
5 | 6 | import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; |
6 | 7 | |
... | ... | @@ -52,7 +53,7 @@ public interface UserRPC { |
52 | 53 | * @createTime 2014年8月27日 下午2:31:07 |
53 | 54 | * @author zhangshirui |
54 | 55 | */ |
55 | - boolean checkMobile(String mobile); | |
56 | + BuyerInfoOutput checkMobile(String mobile); | |
56 | 57 | |
57 | 58 | |
58 | 59 | /** |
... | ... | @@ -97,4 +98,6 @@ public interface UserRPC { |
97 | 98 | |
98 | 99 | |
99 | 100 | BuyerInfoOutput getUserByMobile(String accountName); |
101 | + | |
102 | + ShopBuyerOutput getDepositCardAmount(Long shopBuyerId,Long buyerId); | |
100 | 103 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/base/impl/BaseServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.base.impl; |
2 | 2 | |
3 | -import org.slf4j.Logger; | |
4 | -import org.slf4j.LoggerFactory; | |
5 | - | |
6 | 3 | import com.alibaba.fastjson.JSON; |
7 | 4 | import com.alibaba.fastjson.TypeReference; |
8 | -import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
9 | 5 | import com.diligrp.mobsite.getway.rpc.base.BaseOutput; |
10 | 6 | import com.diligrp.mobsite.getway.rpc.base.BaseService; |
11 | 7 | import com.github.kevinsawicki.http.HttpRequest; |
8 | +import org.apache.commons.beanutils.PropertyUtilsBean; | |
9 | +import org.slf4j.Logger; | |
10 | +import org.slf4j.LoggerFactory; | |
11 | + | |
12 | +import java.beans.PropertyDescriptor; | |
13 | +import java.util.HashMap; | |
14 | +import java.util.Map; | |
12 | 15 | |
13 | 16 | /** |
14 | 17 | * base |
... | ... | @@ -21,39 +24,39 @@ import com.github.kevinsawicki.http.HttpRequest; |
21 | 24 | @SuppressWarnings("unused") |
22 | 25 | private String token=""; |
23 | 26 | private String baseUrl; |
24 | - | |
27 | + | |
25 | 28 | public BaseServiceImpl(String token,String baseUrl){ |
26 | 29 | this.token = token; |
27 | 30 | this.baseUrl = baseUrl; |
28 | 31 | LOGGER = LoggerFactory.getLogger(this.getClass()); |
29 | 32 | } |
30 | - protected <T extends BaseOutput<?>> T httpGet(String url, Object paramObj, TypeReference<T> type,String sign){ | |
31 | - return execute(url, paramObj, type, "GET",sign); | |
33 | + protected <T extends BaseOutput<?>> T httpGet(String url, Object paramObj, TypeReference<T> type){ | |
34 | + return execute(url, paramObj, type, "GET"); | |
32 | 35 | } |
33 | - protected <T extends BaseOutput<?>> T httpPost(String url, Object paramObj, TypeReference<T> type,String sign){ | |
34 | - return execute(url, paramObj, type, "POST",sign); | |
36 | + protected <T extends BaseOutput<?>> T httpPost(String url, Object paramObj, TypeReference<T> type){ | |
37 | + return execute(url, paramObj, type, "POST"); | |
35 | 38 | } |
36 | 39 | |
37 | 40 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
38 | - private <T extends BaseOutput> T execute(String url, Object paramObj, TypeReference<T> type,String httpMethod,String sign){ | |
41 | + private <T extends BaseOutput> T execute(String url, Object paramObj, TypeReference<T> type,String httpMethod){ | |
39 | 42 | T output= (T) new BaseOutput(); |
40 | 43 | HttpRequest request = null; |
41 | 44 | if("POST".equalsIgnoreCase(httpMethod)){ |
42 | 45 | request = HttpRequest.post(baseUrl + url); |
46 | + request.connectTimeout(TIMEOUT); | |
47 | + request.readTimeout(TIMEOUT * 10000); | |
48 | + request.header("Content-Type", "application/json;charset=utf-8"); | |
49 | + //request.header("sign", sign); | |
50 | + String data=JSON.toJSONString(paramObj); | |
51 | + request.send(data); | |
43 | 52 | }else{ |
44 | - request = HttpRequest.get(baseUrl + url); | |
53 | + request = HttpRequest.get(baseUrl + url,beanToMap(paramObj),Boolean.TRUE); | |
45 | 54 | } |
46 | - request.connectTimeout(TIMEOUT); | |
47 | - request.readTimeout(TIMEOUT * 10000); | |
48 | - request.header("Content-Type", "application/json;charset=utf-8"); | |
49 | - request.header("sign", sign); | |
50 | - String data=JSON.toJSONString(paramObj); | |
51 | - request.send(data); | |
55 | + | |
52 | 56 | int code = request.code(); |
53 | - if (code != 200) { | |
54 | - output.setCode(ResultCode.BUSINESS_FAILED); | |
55 | - output.setResult("http code:"+code +";"+request.message()); | |
56 | - } else { | |
57 | + output.setCode(code); | |
58 | + output.setResult(request.message()); | |
59 | + if (code == 200) { | |
57 | 60 | String result = request.body(); |
58 | 61 | if (type != null) { |
59 | 62 | output = JSON.parseObject(result, type); |
... | ... | @@ -63,5 +66,33 @@ import com.github.kevinsawicki.http.HttpRequest; |
63 | 66 | } |
64 | 67 | return output; |
65 | 68 | } |
66 | - | |
69 | + | |
70 | + //将javabean实体类转为map类型,然后返回一个map类型的值 | |
71 | + public static Map<String, Object> beanToMap(Object obj) { | |
72 | + if(obj==null){ | |
73 | + return null; | |
74 | + } | |
75 | + if(obj instanceof Map){ | |
76 | + return (Map<String, Object>)obj; | |
77 | + } | |
78 | + Map<String, Object> params = new HashMap<String, Object>(0); | |
79 | + try { | |
80 | + PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); | |
81 | + PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(obj); | |
82 | + for (int i = 0; i < descriptors.length; i++) { | |
83 | + String name = descriptors[i].getName(); | |
84 | + if (!"class".equals(name)) { | |
85 | + Object value = propertyUtilsBean.getNestedProperty(obj, name); | |
86 | + if(null != value){ | |
87 | + params.put(name, value); | |
88 | + } | |
89 | + } | |
90 | + } | |
91 | + } catch (Exception e) { | |
92 | + e.printStackTrace(); | |
93 | + } | |
94 | + return params; | |
95 | + } | |
96 | + | |
97 | + | |
67 | 98 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/DeliveryTimeRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc.impl; | |
2 | + | |
3 | +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeListInput; | |
4 | +import com.b2c.myapp.common.api.deliveryTime.input.DeliveryTimeSaveInput; | |
5 | +import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput; | |
6 | +import com.b2c.myapp.common.api.fundTrade.output.FundTradeOutput; | |
7 | +import com.b2c.myapp.common.utils.BaseOutput; | |
8 | +import com.b2c.myapp.common.utils.ResultCode; | |
9 | +import com.b2c.myapp.common.utils.base.Page; | |
10 | +import com.b2c.myapp.sdk.MyAppClient; | |
11 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
12 | +import com.diligrp.mobsite.getway.rpc.DeliveryTimeRPC; | |
13 | +import org.slf4j.Logger; | |
14 | +import org.slf4j.LoggerFactory; | |
15 | +import org.springframework.stereotype.Component; | |
16 | + | |
17 | +import javax.annotation.Resource; | |
18 | +import java.util.List; | |
19 | + | |
20 | +/** | |
21 | + * Created by jiangchengyong on 2017/1/18. | |
22 | + */ | |
23 | +@Component | |
24 | +public class DeliveryTimeRPCImpl implements DeliveryTimeRPC { | |
25 | + private Logger logger = LoggerFactory.getLogger(DeliveryTimeRPCImpl.class); | |
26 | + | |
27 | + @Resource | |
28 | + private MyAppClient myAppClient; | |
29 | + | |
30 | + /** | |
31 | + * @param deliveryTimeSaveInput | |
32 | + * @return BaseOutput<Integer> | |
33 | + * @comment 创建店铺送货时间段 | |
34 | + * @author kelan | |
35 | + * @time 2016/11/30 16:23 | |
36 | + */ | |
37 | + @Override | |
38 | + public DeliveryTimeOutput createShopDeliveryTime(DeliveryTimeSaveInput deliveryTimeSaveInput) { | |
39 | + BaseOutput<DeliveryTimeOutput> output = null; | |
40 | + try { | |
41 | + output = myAppClient.getDeliveryTimeService().createShopDeliveryTime(deliveryTimeSaveInput); | |
42 | + if(output.getCode().equals(ResultCode.OK)){ | |
43 | + return output.getData(); | |
44 | + }else{ | |
45 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
46 | + } | |
47 | + } catch (Exception e) { | |
48 | + logger.error("创建店铺送货时间段接口出错:msg={}",e); | |
49 | + throw new ServiceException(); | |
50 | + } | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * @param deliveryTimeId 送货时间段id | |
55 | + * @return BaseOutput<Integer> | |
56 | + * @comment 删除店铺送货时间段 | |
57 | + * @author kelan | |
58 | + * @time 2016/11/30 16:25 | |
59 | + */ | |
60 | + @Override | |
61 | + public Boolean deleteShopDeliveryTime(Long... deliveryTimeId) { | |
62 | + BaseOutput<Boolean> output = null; | |
63 | + try { | |
64 | + output = myAppClient.getDeliveryTimeService().deleteShopDeliveryTime(deliveryTimeId); | |
65 | + if(output.getCode().equals(ResultCode.OK)){ | |
66 | + return output.getData(); | |
67 | + }else{ | |
68 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
69 | + } | |
70 | + } catch (Exception e) { | |
71 | + logger.error("删除店铺送货时间段接口出错:msg={}",e); | |
72 | + throw new ServiceException(); | |
73 | + } | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * @param deliveryTimeListInput 店铺送货时间段对象 | |
78 | + * @return BaseOutput<List<DeliveryTimeOutput>> 店铺送货时间段列表 | |
79 | + * @comment 查找店铺送货时间段 | |
80 | + * @author kelan | |
81 | + * @time 2016/11/30 16:26 | |
82 | + */ | |
83 | + @Override | |
84 | + public List<DeliveryTimeOutput> queryShopDeliveryTime(DeliveryTimeListInput deliveryTimeListInput) { | |
85 | + BaseOutput<List<DeliveryTimeOutput>> output = null; | |
86 | + try { | |
87 | + output = myAppClient.getDeliveryTimeService().queryShopDeliveryTime(deliveryTimeListInput); | |
88 | + if(output.getCode().equals(ResultCode.OK)){ | |
89 | + return output.getData(); | |
90 | + }else{ | |
91 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
92 | + } | |
93 | + } catch (Exception e) { | |
94 | + logger.error("查找店铺送货时间段接口出错:msg={}",e); | |
95 | + throw new ServiceException(); | |
96 | + } | |
97 | + } | |
98 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/FundTradeRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc.impl; | |
2 | + | |
3 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeListInput; | |
4 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeSaveInput; | |
5 | +import com.b2c.myapp.common.api.fundTrade.output.FundTradeOutput; | |
6 | +import com.b2c.myapp.common.utils.BaseOutput; | |
7 | +import com.b2c.myapp.common.utils.ResultCode; | |
8 | +import com.b2c.myapp.common.utils.base.Page; | |
9 | +import com.b2c.myapp.sdk.MyAppClient; | |
10 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
11 | +import com.diligrp.mobsite.getway.rpc.FundTradeRPC; | |
12 | +import org.apache.log4j.Logger; | |
13 | +import org.springframework.stereotype.Component; | |
14 | + | |
15 | +import javax.annotation.Resource; | |
16 | + | |
17 | +/** | |
18 | + * Created by jiangchengyong on 2017/1/19. | |
19 | + */ | |
20 | +@Component | |
21 | +public class FundTradeRPCImpl implements FundTradeRPC { | |
22 | + private final static Logger log = Logger.getLogger(FundTradeRPCImpl.class); | |
23 | + @Resource | |
24 | + private MyAppClient myAppClient; | |
25 | + /** | |
26 | + * @param fundTradeListInput | |
27 | + * @return BaseOutput<Page<FundTradeOutput>> | |
28 | + * @comment 多条件查询储值卡资金交易明细 | |
29 | + * @author kelan | |
30 | + * @time 2016/12/8 10:36 | |
31 | + */ | |
32 | + @Override | |
33 | + public Page<FundTradeOutput> queryFundTrade(FundTradeListInput fundTradeListInput) { | |
34 | + BaseOutput<Page<FundTradeOutput>> output = null; | |
35 | + try { | |
36 | + output = myAppClient.getFundTradeService().queryFundTrade(fundTradeListInput); | |
37 | + if(output.getCode().equals(ResultCode.OK)){ | |
38 | + return output.getData(); | |
39 | + }else{ | |
40 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
41 | + } | |
42 | + } catch (Exception e) { | |
43 | + log.error("多条件查询储值卡资金交易明细接口出错:msg={}",e); | |
44 | + throw new ServiceException(); | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * 储值卡交易 | |
50 | + * | |
51 | + * @param fundTradeSaveInput | |
52 | + * @return | |
53 | + */ | |
54 | + @Override | |
55 | + public Boolean fundTrade(FundTradeSaveInput fundTradeSaveInput) { | |
56 | + BaseOutput<Boolean> output = null; | |
57 | + try { | |
58 | + output = myAppClient.getFundTradeService().fundTrade(fundTradeSaveInput); | |
59 | + if(output.getCode().equals(ResultCode.OK)){ | |
60 | + return output.getData(); | |
61 | + }else{ | |
62 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
63 | + } | |
64 | + } catch (Exception e) { | |
65 | + log.error("储值卡交易接口出错:msg={}",e); | |
66 | + throw new ServiceException(); | |
67 | + } | |
68 | + } | |
69 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/GoodsRPCImpl.java
1 | -/** | |
2 | - * @Title: GoodsRPCImpl.java | |
1 | +/** | |
2 | + * @Title: GoodsRPCImpl.java | |
3 | 3 | * @Package:com.diligrp.mobsite.getway.rpc.impl |
4 | - * @Copyright:地利集团 | |
5 | - * @Description: | |
6 | - * @author:zhangshirui | |
7 | - * @date: 2014年8月14日 上午11:21:21 | |
8 | - * @version: V1.0 | |
9 | - */ | |
4 | + * @Copyright:地利集团 | |
5 | + * @Description: | |
6 | + * @author:zhangshirui | |
7 | + * @date: 2014年8月14日 上午11:21:21 | |
8 | + * @version: V1.0 | |
9 | + */ | |
10 | 10 | package com.diligrp.mobsite.getway.rpc.impl; |
11 | 11 | |
12 | 12 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
... | ... | @@ -21,7 +21,10 @@ import com.diligrp.titan.sdk.domain.Category; |
21 | 21 | import com.diligrp.titan.sdk.domain.Product; |
22 | 22 | import com.diligrp.titan.sdk.input.CategoryInput; |
23 | 23 | import com.diligrp.titan.sdk.input.PopProductView; |
24 | +import com.diligrp.titan.sdk.input.ProductSearchInput; | |
25 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | |
24 | 26 | import com.diligrp.titan.sdk.output.BaseOutput; |
27 | +import com.diligrp.titan.sdk.output.PageOutput; | |
25 | 28 | import com.diligrp.website.util.redis.RedisUtil; |
26 | 29 | import com.diligrp.website.util.security.Validator; |
27 | 30 | import org.slf4j.Logger; |
... | ... | @@ -34,53 +37,53 @@ import java.util.HashMap; |
34 | 37 | import java.util.List; |
35 | 38 | import java.util.Map; |
36 | 39 | |
37 | -/** | |
38 | - * @ClassName: GoodsRPCImpl | |
40 | +/** | |
41 | + * @author zhangshirui | |
42 | + * @ClassName: GoodsRPCImpl | |
39 | 43 | * @Description: 商品信息接口 |
40 | - * @author zhangshirui | |
41 | - * @date 2014年8月14日 上午11:21:21 | |
44 | + * @date 2014年8月14日 上午11:21:21 | |
42 | 45 | */ |
43 | 46 | @Service("goodsRPC") |
44 | 47 | public class GoodsRPCImpl implements GoodsRPC { |
45 | 48 | |
46 | - @Resource | |
47 | - private TitanClient titanClient; | |
48 | - @Resource | |
49 | - private RedisUtil redisUtil; | |
50 | - | |
51 | - private static final Logger logger = LoggerFactory.getLogger(GoodsRPCImpl.class); | |
52 | - | |
53 | - @Override | |
54 | - public Product getGoodsById(Long id, String[] defindResult) { | |
55 | - | |
56 | - List<Long> idList = new ArrayList<Long>(); | |
57 | - idList.add(id); | |
49 | + @Resource | |
50 | + private TitanClient titanClient; | |
51 | + @Resource | |
52 | + private RedisUtil redisUtil; | |
53 | + | |
54 | + private static final Logger logger = LoggerFactory.getLogger(GoodsRPCImpl.class); | |
55 | + | |
56 | + @Override | |
57 | + public Product getGoodsById(Long id, String[] defindResult) { | |
58 | + | |
59 | + List<Long> idList = new ArrayList<Long>(); | |
60 | + idList.add(id); | |
58 | 61 | List<Product> productList = getProductByIds(idList, defindResult); |
59 | 62 | Product product = null; |
60 | - if(!Validator.isEmpty(productList)){ | |
61 | - product = productList.get(0); | |
62 | - } | |
63 | - return product; | |
64 | - } | |
65 | - | |
66 | - @Override | |
67 | - public HashMap<String,List<Attribute>> getConditionByCid(Integer categoryId) { | |
68 | - BaseOutput<HashMap<String, List<Attribute>>> attributeBo = null; | |
69 | - try { | |
70 | - attributeBo = titanClient.getCategoryService().listAttributes(categoryId); | |
63 | + if (!Validator.isEmpty(productList)) { | |
64 | + product = productList.get(0); | |
65 | + } | |
66 | + return product; | |
67 | + } | |
68 | + | |
69 | + @Override | |
70 | + public HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId) { | |
71 | + BaseOutput<HashMap<String, List<Attribute>>> attributeBo = null; | |
72 | + try { | |
73 | + attributeBo = titanClient.getCategoryService().listAttributes(categoryId); | |
71 | 74 | } catch (Exception e) { |
72 | - logger.error("titanClient接口挂掉:根据分类id查询商品筛选条件",e); | |
75 | + logger.error("titanClient接口挂掉:根据分类id查询商品筛选条件", e); | |
73 | 76 | throw new ServiceException(); |
74 | 77 | } |
75 | - if(attributeBo.getCode() != ResultCode.SUCCESS){ | |
76 | - logger.error(String.format("商品筛选条件失败.[categoryId=%s,code=%s, message=%s]", | |
77 | - categoryId, attributeBo.getCode(), attributeBo.getResult())); | |
78 | - throw new ServiceException(); | |
79 | - } | |
80 | - if(logger.isInfoEnabled()){ | |
78 | + if (attributeBo.getCode() != ResultCode.SUCCESS) { | |
79 | + logger.error(String.format("商品筛选条件失败.[categoryId=%s,code=%s, message=%s]", | |
80 | + categoryId, attributeBo.getCode(), attributeBo.getResult())); | |
81 | + throw new ServiceException(); | |
82 | + } | |
83 | + if (logger.isInfoEnabled()) { | |
81 | 84 | logger.info(String.format("商品筛选条件.[size=%s]", attributeBo.getData().size())); |
82 | 85 | } |
83 | - return attributeBo.getData(); | |
86 | + return attributeBo.getData(); | |
84 | 87 | } |
85 | 88 | |
86 | 89 | |
... | ... | @@ -88,91 +91,90 @@ public class GoodsRPCImpl implements GoodsRPC { |
88 | 91 | public List<Product> getProductByIds(List<Long> productId, String[] defindResult) { |
89 | 92 | BaseOutput<List<Product>> output = null; |
90 | 93 | try { |
91 | - // output = titanClient.getProductService().getProductInfo(productId, defindResult); | |
94 | + // output = titanClient.getProductService().getProductInfo(productId, defindResult); | |
92 | 95 | } catch (Exception e) { |
93 | - logger.error("titanClient接口挂掉:搜索商品详情",e); | |
96 | + logger.error("titanClient接口挂掉:搜索商品详情", e); | |
94 | 97 | throw new RuntimeException(ErrorMessage.NETWORK_ERROR); |
95 | 98 | } |
96 | - if(output.getCode() != ResultCode.SUCCESS){ | |
97 | - logger.error(String.format("搜索商品详情失败.[productId=%s,code=%s, message=%s]", | |
98 | - productId.toString(),output.getCode(), output.getResult())); | |
99 | + if (output.getCode() != ResultCode.SUCCESS) { | |
100 | + logger.error(String.format("搜索商品详情失败.[productId=%s,code=%s, message=%s]", | |
101 | + productId.toString(), output.getCode(), output.getResult())); | |
99 | 102 | throw new ServiceException(ErrorMessage.PRODUCT_STATE_DOWNORDEL); |
100 | 103 | } |
101 | 104 | return output.getData(); |
102 | 105 | } |
103 | - | |
106 | + | |
104 | 107 | @Override |
105 | - public List<GoodsSuper> getGoodsInfoByIds(List<Long> productIds){ | |
106 | - List<Product> products = getProductByIds(productIds, new String[]{}); | |
107 | - if (Validator.isEmpty(products)) { | |
108 | - return null; | |
109 | - } | |
110 | - | |
111 | - List<GoodsSuper> goodsInfos = new ArrayList<GoodsSuper>(); | |
112 | - GoodsSuper goodsInfo = null; | |
113 | - for (Product product : products) { | |
114 | - //goodsInfo = new GoodsSuper(); | |
115 | - //goodsInfo.setId(product.getPid()); | |
116 | - //goodsInfo.setTitle(product.getName()); | |
117 | - //goodsInfo.setDefaultPic(product.getDefaultPic()); | |
118 | - //goodsInfo.setPrice((long)product.getMinPrice()); | |
119 | - //goodsInfo.setUnit(product.getSaleUnit()); | |
120 | - //goodsInfos.add(goodsInfo); | |
121 | - } | |
122 | - | |
123 | - return goodsInfos; | |
108 | + public List<GoodsSuper> getGoodsInfoByIds(List<Long> productIds) { | |
109 | + List<Product> products = getProductByIds(productIds, new String[]{}); | |
110 | + if (Validator.isEmpty(products)) { | |
111 | + return null; | |
112 | + } | |
113 | + | |
114 | + List<GoodsSuper> goodsInfos = new ArrayList<GoodsSuper>(); | |
115 | + GoodsSuper goodsInfo = null; | |
116 | + for (Product product : products) { | |
117 | + //goodsInfo = new GoodsSuper(); | |
118 | + //goodsInfo.setId(product.getPid()); | |
119 | + //goodsInfo.setTitle(product.getName()); | |
120 | + //goodsInfo.setDefaultPic(product.getDefaultPic()); | |
121 | + //goodsInfo.setPrice((long)product.getMinPrice()); | |
122 | + //goodsInfo.setUnit(product.getSaleUnit()); | |
123 | + //goodsInfos.add(goodsInfo); | |
124 | + } | |
125 | + | |
126 | + return goodsInfos; | |
124 | 127 | } |
125 | 128 | |
126 | 129 | |
127 | - | |
128 | 130 | @Override |
129 | - public Map<String, Product> getSkuInfoMap(List<String> skuList){ | |
130 | - BaseOutput<Map<String,Product>> output = null; | |
131 | + public Map<String, Product> getSkuInfoMap(List<String> skuList) { | |
132 | + BaseOutput<Map<String, Product>> output = null; | |
131 | 133 | try { |
132 | 134 | output = titanClient.getProductService().getSkuInfoMap(skuList); |
133 | 135 | } catch (Exception e) { |
134 | 136 | throw new RuntimeException(String.format("sku接口失败:获取商品sku信息失败.[code=%s, result=%s]", |
135 | - output.getCode(),output.getResult())); | |
137 | + output.getCode(), output.getResult())); | |
136 | 138 | } |
137 | - if(output.getCode() != ResultCode.SUCCESS){ | |
138 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
139 | + if (output.getCode() != ResultCode.SUCCESS) { | |
140 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
139 | 141 | } |
140 | 142 | if (logger.isInfoEnabled()) { |
141 | 143 | logger.info(String.format("查询sku信息成功:[skus=%s]", skuList.toString())); |
142 | 144 | } |
143 | 145 | return output.getData(); |
144 | 146 | } |
145 | - | |
147 | + | |
146 | 148 | @Override |
147 | - public String getProductDesc(Long productId){ | |
148 | - BaseOutput<String> output = null; | |
149 | + public String getProductDesc(Long productId) { | |
150 | + BaseOutput<String> output = null; | |
149 | 151 | try { |
150 | - // output = titanClient.getProductService().getProductDesc(productId); | |
152 | + // output = titanClient.getProductService().getProductDesc(productId); | |
151 | 153 | } catch (Exception e) { |
152 | - logger.error("商品库接口超时",e); | |
154 | + logger.error("商品库接口超时", e); | |
153 | 155 | } |
154 | - if(output.getCode() != ResultCode.SUCCESS){ | |
155 | - logger.error("查询商品描述信息失败[productId={},result={}]",productId,output.getResult()); | |
156 | + if (output.getCode() != ResultCode.SUCCESS) { | |
157 | + logger.error("查询商品描述信息失败[productId={},result={}]", productId, output.getResult()); | |
156 | 158 | } |
157 | 159 | logger.info("查询商品描述信息:[productId={}]", productId); |
158 | 160 | return output.getData(); |
159 | 161 | } |
160 | - | |
162 | + | |
161 | 163 | @Override |
162 | - public Category getCategoryById(Long cid){ | |
163 | - String redisKey = redisUtil.makeKey(RedisKey.PRODUCT_CATEGORY, String.valueOf(cid)); | |
164 | - Category category = redisUtil.getObject(redisKey, Category.class); | |
165 | - if (!Validator.isNull(category)) { | |
166 | - return category; | |
167 | - } | |
164 | + public Category getCategoryById(Long cid) { | |
165 | + String redisKey = redisUtil.makeKey(RedisKey.PRODUCT_CATEGORY, String.valueOf(cid)); | |
166 | + Category category = redisUtil.getObject(redisKey, Category.class); | |
167 | + if (!Validator.isNull(category)) { | |
168 | + return category; | |
169 | + } | |
168 | 170 | try { |
169 | - BaseOutput<Category> output = titanClient.getCategoryService().getCategoryInfo(cid.intValue()); | |
170 | - if(output.getCode() != ResultCode.SUCCESS){ | |
171 | - logger.error("查询分类信息失败[cid={},result={}]",cid,output.getResult()); | |
172 | - } | |
173 | - category = output.getData(); | |
171 | + BaseOutput<Category> output = titanClient.getCategoryService().getCategoryInfo(cid.intValue()); | |
172 | + if (output.getCode() != ResultCode.SUCCESS) { | |
173 | + logger.error("查询分类信息失败[cid={},result={}]", cid, output.getResult()); | |
174 | + } | |
175 | + category = output.getData(); | |
174 | 176 | } catch (Exception e) { |
175 | - logger.error("商品库接口超时",e); | |
177 | + logger.error("商品库接口超时", e); | |
176 | 178 | } |
177 | 179 | logger.info("查询分类信息:[cid={}]", cid); |
178 | 180 | redisUtil.setObjectByExpire(redisKey, category, RedisKey.PRODUCT_EXPIRE_TIME); |
... | ... | @@ -184,32 +186,32 @@ public class GoodsRPCImpl implements GoodsRPC { |
184 | 186 | List<Category> categories = null; |
185 | 187 | BaseOutput<List<Category>> output = null; |
186 | 188 | try { |
187 | - // BaseOutput<List<Category>> output = titanClient.getCategoryService().listCrumbs(cid.intValue()); | |
188 | - if(output.getCode() != ResultCode.SUCCESS){ | |
189 | - logger.error("查询类目面包屑失败[cid={},result={}]",cid,output.getResult()); | |
189 | + // BaseOutput<List<Category>> output = titanClient.getCategoryService().listCrumbs(cid.intValue()); | |
190 | + if (output.getCode() != ResultCode.SUCCESS) { | |
191 | + logger.error("查询类目面包屑失败[cid={},result={}]", cid, output.getResult()); | |
190 | 192 | } |
191 | 193 | categories = output.getData(); |
192 | 194 | } catch (Exception e) { |
193 | - logger.error("商品库接口超时",e); | |
195 | + logger.error("商品库接口超时", e); | |
194 | 196 | } |
195 | 197 | logger.info("查询类目面包屑:[cid={}]", cid); |
196 | 198 | return categories; |
197 | 199 | } |
198 | 200 | |
199 | 201 | @Override |
200 | - public Object addProductCategory(CategoryInput input,Long userId) { | |
202 | + public Object addProductCategory(CategoryInput input, Long userId) { | |
201 | 203 | BaseOutput<Object> output = null; |
202 | 204 | try { |
203 | 205 | output = titanClient.getCategoryService().insertCategory(input); |
204 | 206 | } catch (Exception e) { |
205 | - logger.error("调用添加分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
207 | + logger.error("调用添加分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
206 | 208 | throw new ServiceException(); |
207 | 209 | |
208 | 210 | } |
209 | - if (output.getCode()!=200) { | |
211 | + if (output.getCode() != 200) { | |
210 | 212 | logger.error("调用添加分类接口失败[userId={},code={},result={}]", |
211 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
212 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
213 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
214 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
213 | 215 | } |
214 | 216 | return output.getData(); |
215 | 217 | } |
... | ... | @@ -220,32 +222,32 @@ public class GoodsRPCImpl implements GoodsRPC { |
220 | 222 | try { |
221 | 223 | output = titanClient.getCategoryService().updateCategory(input); |
222 | 224 | } catch (Exception e) { |
223 | - logger.error("调用修改分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
225 | + logger.error("调用修改分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
224 | 226 | throw new ServiceException(); |
225 | 227 | |
226 | 228 | } |
227 | - if (output.getCode()!=200) { | |
229 | + if (output.getCode() != 200) { | |
228 | 230 | logger.error("调用修改分类接口失败[userId={},code={},result={}]", |
229 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
230 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
231 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
232 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
231 | 233 | } |
232 | 234 | return output.getData(); |
233 | 235 | } |
234 | 236 | |
235 | 237 | @Override |
236 | 238 | public List<Category> searchProductCategory(String input, Long userId) { |
237 | - BaseOutput<List<Category>> output = null; | |
239 | + BaseOutput<List<Category>> output = null; | |
238 | 240 | try { |
239 | 241 | output = titanClient.getCategoryService().searchCategoryInfo(input); |
240 | 242 | } catch (Exception e) { |
241 | - logger.error("搜索分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
243 | + logger.error("搜索分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
242 | 244 | throw new ServiceException(); |
243 | 245 | |
244 | 246 | } |
245 | - if (output.getCode()!=200) { | |
247 | + if (output.getCode() != 200) { | |
246 | 248 | logger.error("搜索分类接口失败[userId={},code={},result={}]", |
247 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
248 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
249 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
250 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
249 | 251 | } |
250 | 252 | return output.getData(); |
251 | 253 | } |
... | ... | @@ -254,19 +256,78 @@ public class GoodsRPCImpl implements GoodsRPC { |
254 | 256 | public Object addGoods(PopProductView input, Long userId) { |
255 | 257 | BaseOutput<Object> output = null; |
256 | 258 | try { |
257 | - output = titanClient.getProductService().insertPopProduct(input,userId+""); | |
259 | + output = titanClient.getProductService().insertPopProduct(input, userId + ""); | |
258 | 260 | } catch (Exception e) { |
259 | - logger.error("添加商品失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
261 | + logger.error("添加商品失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
260 | 262 | throw new ServiceException(); |
261 | 263 | |
262 | 264 | } |
263 | - if (output.getCode()!=200) { | |
265 | + if (output.getCode() != 200) { | |
264 | 266 | logger.error("添加商品失败[userId={},code={},result={}]", |
265 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
266 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
267 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
268 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
267 | 269 | } |
268 | 270 | return output.getData(); |
269 | 271 | } |
270 | 272 | |
273 | + public PageOutput<List<Product>> getProductRecommend(ProductSearchInput input, Long userId) { | |
274 | + PageOutput<List<Product>> output = null; | |
275 | + try { | |
276 | + output = titanClient.getProductService().searchListPopProducts(input); | |
277 | + } catch (Exception e) { | |
278 | + logger.info("获取店铺热门推荐商品接口出错:", e); | |
279 | + throw new ServiceException(ResultCode.NETWORK_FAILED); | |
280 | + } | |
281 | + if (output.getCode() != 200) { | |
282 | + logger.error("获取店铺热门推荐商品失败[userId={},code={},result={}]", | |
283 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
284 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
285 | + } | |
286 | + return output; | |
287 | + } | |
288 | + | |
289 | + @Override | |
290 | + public List<Category> listCategory(int parentId, int shopId) { | |
291 | + try { | |
292 | + BaseOutput<List<Category>> output = titanClient.getCategoryService().listChildren(parentId, shopId); | |
293 | + if (output.getCode() != 200) { | |
294 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
295 | + } | |
296 | + return output.getData(); | |
297 | + } catch (Exception e) { | |
298 | + logger.error("获取商品分类失败:[parentId={},shopId={}]", new Object[]{parentId, shopId}); | |
299 | + throw new ServiceException(); | |
300 | + } | |
301 | + } | |
302 | + | |
303 | + @Override | |
304 | + public List<Product> searchProduct(ProductSearchInput input) { | |
305 | + try { | |
306 | + PageOutput<List<Product>> output = titanClient.getProductService().searchListPopProducts(input); | |
307 | + if (output.getCode() != 200) { | |
308 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
309 | + } | |
310 | + return output.getData(); | |
311 | + } catch (Exception e) { | |
312 | + logger.error("搜搜商品失败", e); | |
313 | + throw new ServiceException(); | |
314 | + } | |
315 | + } | |
271 | 316 | |
317 | + @Override | |
318 | + public Object updateProduct(UpdateProductInput updateProductInput) { | |
319 | + BaseOutput<Object> output; | |
320 | + try { | |
321 | + output = titanClient.getProductService().updatePop(updateProductInput); | |
322 | + } catch (Exception e) { | |
323 | + logger.error("调用修改商品接口失败"); | |
324 | + throw new ServiceException(); | |
325 | + | |
326 | + } | |
327 | + if (output.getCode() != 200) { | |
328 | + logger.error("调用修改分类接口失败"); | |
329 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
330 | + } | |
331 | + return output.getData(); | |
332 | + } | |
272 | 333 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PassportRPCImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.impl; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSONObject; | |
4 | -import com.diligrp.mobsite.getway.domain.common.Constant; | |
5 | -import com.diligrp.mobsite.getway.domain.common.RedisKey; | |
3 | +import com.alibaba.fastjson.TypeReference; | |
4 | +import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; | |
5 | +import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; | |
6 | +import com.diligrp.mobsite.getway.domain.common.ErrorMessage; | |
6 | 7 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
7 | 8 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
9 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
8 | 10 | import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; |
9 | -import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq; | |
10 | 12 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; |
11 | -import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterResp; | |
12 | 13 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
13 | -import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
14 | -import com.diligrp.mobsite.getway.domain.protocol.saler.user.SellerLoginResp; | |
14 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
15 | 15 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
16 | 16 | import com.diligrp.mobsite.getway.rpc.base.BaseOutput; |
17 | 17 | import com.diligrp.mobsite.getway.rpc.base.impl.BaseServiceImpl; |
... | ... | @@ -48,228 +48,308 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { |
48 | 48 | |
49 | 49 | @Value("${passport.login.passportSign}") |
50 | 50 | private String passportSign; |
51 | - /** | |
52 | - * 登录超时时间:秒 | |
53 | - */ | |
54 | - @Value("${login.timeout.second}") | |
55 | - private int loginExpireTime; | |
51 | + | |
56 | 52 | |
57 | 53 | public PassportRPCImpl(String token, String baseUrl) { |
58 | 54 | super(token, baseUrl); |
59 | 55 | } |
60 | 56 | |
61 | 57 | @Override |
62 | - public SellerLoginResp sellerLogin(LoginReq req) { | |
63 | - Map<String,String> params = new HashMap<String, String>(); | |
64 | - params.put("userName", req.getAccountName()); | |
58 | + public SellerInfoOutput sellerLogin(LoginReq req) { | |
59 | + Map<String,String> params = new HashMap<>(); | |
60 | + params.put("username", req.getAccountName()); | |
65 | 61 | params.put("password", req.getPassword()); |
66 | - params.put("src", "zadeapp"); | |
67 | - BaseOutput<String> output = null; | |
62 | + BaseOutput<SellerInfoOutput> output = null; | |
68 | 63 | try { |
69 | - output = super.httpPost("/api/login/login.html", params, null,passportSign); | |
64 | + output = super.httpPost("/api/login/sellerLogin", params, new TypeReference<BaseOutput<SellerInfoOutput>>(){}); | |
70 | 65 | } catch (Exception e) { |
71 | - log.error("调用passport用户验证接口失败",e); | |
66 | + log.error("error:调用passport卖家登录接口失败",e); | |
72 | 67 | throw new ServiceException(); |
73 | 68 | } |
69 | + SellerInfoOutput sellerInfo = output.getData(); | |
70 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
71 | + log.error("error:调用passport买家登录失败[mobile=,code=,msg=]",new Object[]{req.getAccountName(),output.getCode(),output.getResult()}); | |
72 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
73 | + } | |
74 | + if (Validator.isNull(sellerInfo)||Validator.isNull(sellerInfo.getId())){ | |
75 | + log.error("error:买家登录返回用户信息为空[accountName=]",req.getAccountName()); | |
76 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST); | |
77 | + } | |
78 | + return sellerInfo; | |
79 | + } | |
74 | 80 | |
75 | - SellerLoginResp resp = new SellerLoginResp(); | |
76 | - JSONObject jsonBody = JSONObject.parseObject(output.getData()); | |
77 | - int code = 0; | |
78 | - try { | |
79 | - code = jsonBody.getIntValue("code"); | |
80 | - } catch (Exception e) { | |
81 | - log.error("passport返回数据:msg={}",jsonBody); | |
82 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,"登录失败请重新登录"); | |
83 | - } | |
84 | 81 | |
85 | - String msg = jsonBody.getString("msg"); | |
82 | + @Override | |
83 | + public BuyerInfoOutput buyerLogin(LoginReq req) { | |
86 | 84 | |
87 | - if (code == PASSPORT_LOGIN_CODE_LOCKED || code == PASSPORT_LOGIN_CODE_ACCOUNT_NOT_EXIST | |
88 | - || code == PASSPORT_LOGIN_CODE_PASSWORD_WRONG) { | |
89 | - throw new ServiceException(code,msg); | |
90 | - }else if (code != ResultCode.SUCCESS) { | |
91 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,msg); | |
85 | + Map<String,String> params = new HashMap<>(); | |
86 | + params.put("username", req.getAccountName()); | |
87 | + params.put("password", req.getPassword()); | |
88 | + BaseOutput<BuyerInfoOutput > output = null; | |
89 | + try { | |
90 | + output = super.httpPost("/api/login/buyerLogin", params, new TypeReference<BaseOutput<BuyerInfoOutput>>(){}); | |
91 | + } catch (Exception e) { | |
92 | + log.error("error:调用passport买家登录接口失败",e); | |
93 | + throw new ServiceException(); | |
94 | + } | |
95 | + BuyerInfoOutput buyerInfo = output.getData(); | |
96 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
97 | + log.error("error:调用passport买家登录失败[mobile=,code=,msg=]",new Object[]{req.getAccountName(),output.getCode(),output.getResult()}); | |
98 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
92 | 99 | } |
93 | 100 | |
94 | - //resp.setToken(jsonBody.getString("token")); | |
95 | - JSONObject jsonUser = jsonBody.getJSONObject("accountInfo"); | |
96 | - resp.setSellerId(jsonUser.getLong("accountId")); | |
97 | - resp.setPhone(jsonUser.getString("mobile")); | |
98 | - resp.setShopId(jsonUser.getLong("shopId")); | |
99 | - resp.setShopLogo("sds.jpg"); | |
100 | - resp.setShopName("张三的水果店铺"); | |
101 | - resp.setShopAuthCode(457854); | |
102 | - resp.setCode(code); | |
103 | - resp.setMsg(msg); | |
104 | - | |
105 | - //缓存userId | |
106 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(resp.getSellerId())); | |
107 | - redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getSellerId()), loginExpireTime); | |
108 | - | |
109 | - //缓存shopId | |
110 | - //String shopIdKey = redisUtil.makeKey(RedisKey.USER_SELLER_SHOPID, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(resp.getSellerId())); | |
111 | - //redisUtil.setStringByExpire(shopIdKey, String.valueOf(resp.getShopId()), loginExpireTime); | |
112 | - | |
113 | - | |
114 | - //缓存设备id,userId作为key | |
115 | - if (!Validator.isNull(req.getDeviceId())) { | |
116 | - String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(resp.getSellerId())); | |
117 | - redisUtil.setStringByExpire(onlyOneLoginRedisKey, req.getDeviceId(), loginExpireTime); | |
101 | + if (Validator.isNull(buyerInfo)||Validator.isNull(buyerInfo.getId())){ | |
102 | + log.error("error:买家登录返回用户信息为空[accountName=]",req.getAccountName()); | |
103 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST); | |
118 | 104 | } |
119 | - return resp; | |
105 | + return buyerInfo; | |
106 | + | |
107 | + | |
108 | + | |
120 | 109 | } |
121 | 110 | |
122 | 111 | @Override |
123 | - public UserRegisterResp register(UserRegisterReq req) { | |
112 | + public BuyerInfoOutput buyerRegister(UserRegisterReq req) { | |
124 | 113 | Map<String,String> params = new HashMap<String, String>(); |
125 | - params.put("mobile", req.getMobile()); | |
126 | - params.put("password", req.getPassword()); | |
127 | - // params.put("accountName", req.getAccountName()); | |
128 | - // params.put("source", PASSPORT_REGIST_SOURCE_PNR); | |
129 | - BaseOutput<String> output = null; | |
114 | + params.put("mobilePhone", req.getMobile()); | |
115 | + params.put("accountPwd", req.getPassword()); | |
116 | + params.put("validCode",req.getVeriCode()); | |
117 | + params.put("accountName",req.getMobile()); | |
118 | + BaseOutput<BuyerInfoOutput > output = null; | |
130 | 119 | try { |
131 | - output = super.httpPost("/api/register/buyerRegister.html", params,null, passportSign); | |
132 | - | |
120 | + output = super.httpPost("/api/register/buyerRegister", params,new TypeReference<BaseOutput<BuyerInfoOutput>>(){}); | |
133 | 121 | } catch (Exception e) { |
134 | - log.error("调用passport注册接口失败",e); | |
122 | + log.error("error:调用passport卖家注册接口失败",e); | |
135 | 123 | throw new ServiceException(); |
136 | 124 | } |
137 | - | |
138 | - UserRegisterResp resp = new UserRegisterResp(); | |
139 | - JSONObject jsonBody = JSONObject.parseObject(output.getData()); | |
140 | - int code = jsonBody.getIntValue("code"); | |
141 | - //成功 | |
142 | - if(code == ResultCode.SUCCESS){ | |
143 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
144 | - }else{ | |
145 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED); | |
125 | + | |
126 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
127 | + log.error("error:调用passport卖家注册失败[mobile={},code={},msg={}]",new Object[]{req.getMobile(),output.getCode(),output.getResult()}); | |
128 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
146 | 129 | } |
147 | - resp.setMsg(jsonBody.getString("msg")); | |
148 | - | |
149 | - log.info("注册用户信息:msg={}"+jsonBody.getString("msg")); | |
150 | - | |
151 | - return resp; | |
130 | + return output.getData(); | |
152 | 131 | } |
153 | 132 | |
154 | 133 | @Override |
155 | - public String modifyPwd(Map<String,String> params){ | |
156 | - | |
157 | - BaseOutput<String> output = null; | |
134 | + public boolean modifyPwdBuyer(ModifyPwdReq req){ | |
135 | + Map<String,String> params = new HashMap<>(); | |
136 | + params.put("password", req.getPassword()); | |
137 | + params.put("phoneNumber", req.getAccountName()); | |
138 | + | |
139 | + BaseOutput<String> output = null; | |
158 | 140 | try { |
159 | - output = super.httpPost("/api/account/initAccountPwd.html", params,null, passportSign); | |
141 | + output = super.httpPost("/api/forgot/updateBuyerPasswordByPhoneNumber", params,null); | |
160 | 142 | |
161 | 143 | } catch (Exception e) { |
162 | - log.error("调用passport修改密码接口失败",e); | |
144 | + log.error("error:调用passport买家修改密码接口失败",e); | |
163 | 145 | throw new ServiceException(); |
164 | 146 | } |
165 | - if (Validator.isNull(output)) { | |
166 | - log.error("调用passport修改密码接口失败"); | |
167 | - throw new ServiceException(ResultCode.BUSINESS_FAILED); | |
147 | + int code = output.getCode(); | |
148 | + if (code!=ResultCode.SUCCESS) { | |
149 | + log.error("error:调用passport买家修改密码接口失败[mobile={},password={}]",req.getAccountName(),req.getPassword()); | |
150 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
168 | 151 | } |
169 | - return output.getData(); | |
152 | + return code==ResultCode.SUCCESS; | |
170 | 153 | } |
171 | 154 | |
172 | 155 | @Override |
173 | - public SellerRegisterResp sellerRegister(SellerRegisterReq req) { | |
174 | - Map<String,String> params = new HashMap<String, String>(); | |
175 | - params.put("mobile", req.getMobile()); | |
156 | + public boolean modifyPwdSeller(ModifyPwdReq req){ | |
157 | + Map<String,String> params = new HashMap<>(); | |
176 | 158 | params.put("password", req.getPassword()); |
177 | - //BaseOutput<String> output = null; | |
178 | - //try { | |
179 | - // output = super.httpPost("/api/register/buyerRegister.html", params,null, passportSign); | |
180 | - // | |
181 | - //} catch (Exception e) { | |
182 | - // log.error("调用passport注册接口失败",e); | |
183 | - // throw new ServiceException(); | |
184 | - //} | |
185 | - // | |
186 | - SellerRegisterResp resp = new SellerRegisterResp(); | |
187 | - //JSONObject jsonBody = JSONObject.parseObject(output.getData()); | |
188 | - //int code = jsonBody.getIntValue("code"); | |
189 | - ////成功 | |
190 | - //if(code == ResultCode.SUCCESS){ | |
191 | - // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
192 | - //}else{ | |
193 | - // resp.setResultFlag(UserRegisterResp.RESULT_FLAG_FAILED); | |
194 | - //} | |
195 | - //resp.setMsg(jsonBody.getString("msg")); | |
196 | - // | |
197 | - //log.info("注册用户信息:msg={}"+jsonBody.getString("msg")); | |
198 | - | |
199 | - return resp; | |
159 | + params.put("phoneNumber", req.getAccountName()); | |
160 | + | |
161 | + BaseOutput<String> output = null; | |
162 | + try { | |
163 | + output = super.httpPost("/api/forgot/updateSellerPasswordByPhoneNumber", params,null); | |
164 | + | |
165 | + } catch (Exception e) { | |
166 | + log.error("error:调用passport卖家修改密码接口失败",e); | |
167 | + throw new ServiceException(); | |
168 | + } | |
169 | + if (output.getCode()!=ResultCode.SUCCESS) { | |
170 | + log.error("error:调用passport卖家修改密码接口失败[mobile={},password={}]",req.getAccountName(),req.getPassword()); | |
171 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
172 | + } | |
173 | + return output.getCode()==ResultCode.SUCCESS; | |
200 | 174 | } |
201 | 175 | |
202 | 176 | @Override |
203 | - public LoginResp buyerLogin(LoginReq req) { | |
204 | - | |
177 | + public SellerInfoOutput sellerRegister(SellerRegisterReq req) { | |
205 | 178 | Map<String,String> params = new HashMap<String, String>(); |
206 | - params.put("userName", req.getAccountName()); | |
207 | - params.put("password", req.getPassword()); | |
208 | - params.put("src", "zadeapp"); | |
179 | + params.put("mobilePhone", req.getMobile()); | |
180 | + params.put("accountPwd", req.getPassword()); | |
181 | + params.put("validCode",req.getVeriCode()); | |
182 | + params.put("appType",req.getAppType()+""); | |
183 | + BaseOutput<SellerInfoOutput > output = null; | |
184 | + try { | |
185 | + output = super.httpPost("/api/register/sellerRegister", params,new TypeReference<BaseOutput<SellerInfoOutput>>(){}); | |
186 | + } catch (Exception e) { | |
187 | + log.error("error:调用passport卖家注册接口失败",e); | |
188 | + throw new ServiceException(); | |
189 | + } | |
190 | + | |
191 | + | |
192 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
193 | + log.error("error:调用passport卖家注册失败[mobile=,code=,msg=]",new Object[]{req.getMobile(),output.getCode(),output.getResult()}); | |
194 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
195 | + } | |
196 | + | |
197 | + | |
198 | + return output.getData(); | |
199 | + } | |
200 | + | |
201 | + | |
202 | + | |
203 | + @Override | |
204 | + public BaseOutput<String> sendVeriCodeOfSeller(String mobile,Integer msgType) { | |
209 | 205 | BaseOutput<String> output = null; |
206 | + TypeReference<BaseOutput<Integer>> type = new TypeReference<BaseOutput<Integer>>() { | |
207 | + }; | |
210 | 208 | try { |
211 | - output = super.httpPost("/api/login/login.html", params, null,passportSign); | |
209 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
210 | + output = super.httpGet("/api/register/sendSellerRegisterSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){} ); | |
211 | + } | |
212 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
213 | + output = super.httpGet("/api/forgot/sendSellerForgotPasswordSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){} ); | |
214 | + } | |
212 | 215 | } catch (Exception e) { |
213 | - log.error("调用passport用户验证接口失败",e); | |
216 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
217 | + log.error("error:调用passport卖家注册发送验证码短信失败",e); | |
218 | + } | |
219 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
220 | + log.error("error:调用passport卖家忘记密码发送验证码短信失败",e); | |
221 | + } | |
214 | 222 | throw new ServiceException(); |
215 | 223 | } |
224 | + if (output.getCode()!= 200){ | |
225 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
226 | + log.error("error:调用passport卖家注册发送验证码短信失败[mobile=,code=,msg=]",new Object[]{mobile,output.getCode(),output.getResult()}); | |
227 | + } | |
228 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
229 | + log.error("error:调用passport卖家忘记密码发送验证码短信失败[mobile=,code,msg=]",new Object[]{mobile,output.getCode(),output.getResult()}); | |
230 | + } | |
231 | + | |
232 | + throw new ServiceException(output.getCode(),output.getResult()); | |
233 | + } | |
234 | + | |
235 | + System.out.println("验证码 = " + output.getData()); | |
236 | + | |
237 | + return output; | |
238 | + } | |
239 | + | |
216 | 240 | |
217 | - JSONObject jsonBody = JSONObject.parseObject(output.getData()); | |
218 | - int code = 0; | |
241 | + @Override | |
242 | + public BaseOutput<String> sendVeriCodeOfBuyer(String mobile,Integer msgType) { | |
243 | + BaseOutput<String> output = null; | |
219 | 244 | try { |
220 | - code = jsonBody.getIntValue("code"); | |
245 | + if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){ | |
246 | + output = super.httpGet("/api/login/sendSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); | |
247 | + } | |
248 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
249 | + output = super.httpGet("/api/register/sendBuyerRegisterSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); | |
250 | + } | |
251 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
252 | + output = super.httpGet("/api/forgot/sendBuyerForgotPasswordSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); | |
253 | + } | |
221 | 254 | } catch (Exception e) { |
222 | - log.error("passport返回数据:msg={}",jsonBody); | |
223 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,"登录失败请重新登录"); | |
255 | + | |
256 | + if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){ | |
257 | + log.error("error:调用passport买家登录发送验证码短信失败",e); | |
258 | + } | |
259 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
260 | + log.error("error:调用passport买家注册发送验证码短信失败",e); | |
261 | + } | |
262 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
263 | + log.error("error:调用passport买家忘记密码发送验证码短信失败",e); | |
264 | + } | |
265 | + throw new ServiceException(); | |
224 | 266 | } |
225 | 267 | |
226 | - String msg = jsonBody.getString("msg"); | |
268 | + if (output.getCode()!= 200){ | |
227 | 269 | |
228 | - if (code == PASSPORT_LOGIN_CODE_LOCKED || code == PASSPORT_LOGIN_CODE_ACCOUNT_NOT_EXIST | |
229 | - || code == PASSPORT_LOGIN_CODE_PASSWORD_WRONG) { | |
230 | - throw new ServiceException(code,msg); | |
231 | - }else if (code != ResultCode.SUCCESS) { | |
232 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,msg); | |
270 | + if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){ | |
271 | + log.error("error:调用passport买家注册发送验证码短信失败[mobile=,code,msg=]",new Object[]{mobile,output.getCode(),output.getResult()}); | |
272 | + } | |
273 | + if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
274 | + log.error("error:调用passport买家注册发送验证码短信失败[mobile=,code,msg=]",new Object[]{mobile,output.getCode(),output.getResult()}); | |
275 | + } | |
276 | + if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
277 | + log.error("error:调用passport买家忘记密码发送验证码短信失败[mobile=,code,msg=]",new Object[]{mobile,output.getCode(),output.getResult()}); | |
278 | + } | |
279 | + | |
280 | + throw new ServiceException(output.getCode(),output.getResult()); | |
233 | 281 | } |
234 | 282 | |
235 | - //resp.setToken(jsonBody.getString("token")); | |
236 | - JSONObject jsonUser = jsonBody.getJSONObject("accountInfo"); | |
237 | - LoginResp resp = new LoginResp(); | |
238 | - resp.setBuyerId(jsonUser.getLong("accountId")); | |
239 | - resp.setHeadImg(jsonUser.getString("img")); | |
240 | - resp.setMobile("13985454555"); | |
241 | - resp.setAccountName(""); | |
242 | - resp.setCurrentShopId(123L); | |
243 | - resp.setShopBuyerId(122L); | |
244 | - resp.setCode(code); | |
245 | - resp.setMsg(msg); | |
246 | - | |
247 | - //缓存userId | |
248 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
249 | - redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(resp.getBuyerId()), loginExpireTime); | |
250 | - | |
251 | - //缓存设备id,userId作为key | |
252 | - if (!Validator.isNull(req.getDeviceId())) { | |
253 | - String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
254 | - redisUtil.setStringByExpire(onlyOneLoginRedisKey, req.getDeviceId(), loginExpireTime); | |
283 | + System.out.println("验证码(买家) = " + output.getData()); | |
284 | + return output; | |
285 | + } | |
286 | + | |
287 | + @Override | |
288 | + public boolean verifySellerSmsCode(String mobile, String veriCode) { | |
289 | + BaseOutput<String> output = null; | |
290 | + Map<String,String> params = new HashMap<String, String>(); | |
291 | + params.put("phoneNumber", mobile); | |
292 | + params.put("code", veriCode); | |
293 | + try { | |
294 | + output = super.httpPost("/api/forgot/verifySellerSmsCode", params, null); | |
295 | + } catch (Exception e) { | |
296 | + log.error("passport校验卖家短信验证码失败",e); | |
297 | + throw new ServiceException(); | |
255 | 298 | } |
256 | 299 | |
257 | - //缓存currentShopId | |
258 | - //if (!Validator.isNull(resp.getCurrentShopId())){ | |
259 | - // String currentShopIdKey = redisUtil.makeKey(RedisKey.USER_BUYER_CURRENTSHOPID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
260 | - // redisUtil.setStringByExpire(currentShopIdKey, String.valueOf(resp.getCurrentShopId()), loginExpireTime); | |
261 | - //} | |
300 | + if (output.getCode()!= 200){ | |
301 | + log.error("passport校验卖家短信验证码失败[mobile=,msg=]",mobile,output.getResult()); | |
302 | + throw new ServiceException(output.getCode(),output.getResult()); | |
303 | + } | |
262 | 304 | |
305 | + return output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK); | |
306 | + } | |
263 | 307 | |
264 | - //缓存shopBuyerId | |
265 | - //if (!Validator.isNull(resp.getShopBuyerId())){ | |
266 | - // String shopUserIdKey = redisUtil.makeKey(RedisKey.USER_BUYER_SHOPUSERID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
267 | - // redisUtil.setStringByExpire(shopUserIdKey, String.valueOf(resp.getShopBuyerId()), loginExpireTime); | |
268 | - //} | |
269 | 308 | |
309 | + @Override | |
310 | + public boolean verifyBuyerSmsCode(String mobile, String veriCode) { | |
311 | + BaseOutput<String> output = null; | |
312 | + Map<String,String> params = new HashMap<String, String>(); | |
313 | + params.put("phoneNumber", mobile); | |
314 | + params.put("code", veriCode); | |
315 | + try { | |
316 | + output = super.httpPost("/api/forgot/verifyBuyerSmsCode", params, null); | |
317 | + } catch (Exception e) { | |
318 | + log.error("error:调用passport校验买家短信验证码失败",e); | |
319 | + throw new ServiceException(); | |
320 | + } | |
270 | 321 | |
322 | + if (output.getCode()!= 200){ | |
323 | + log.error("error:调用passport校验买家短信验证码失败[mobile=,msg=]",mobile,output.getResult()); | |
324 | + throw new ServiceException(output.getCode(),output.getResult()); | |
325 | + } | |
271 | 326 | |
272 | - return resp; | |
327 | + return output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK); | |
273 | 328 | } |
274 | 329 | |
330 | + @Override | |
331 | + public BuyerInfoOutput authlogin(AuthLoginReq req) { | |
332 | + Map<String,String> params = new HashMap<>(); | |
333 | + params.put("username", req.getAccountName()); | |
334 | + params.put("code", req.getAuthCode()); | |
335 | + BaseOutput<BuyerInfoOutput > output = null; | |
336 | + try { | |
337 | + output = super.httpPost("/api/login/buyerSMSLogin", params, new TypeReference<BaseOutput<BuyerInfoOutput>>(){}); | |
338 | + } catch (Exception e) { | |
339 | + log.error("error:调用passport买家验证码登录接口失败",e); | |
340 | + throw new ServiceException(); | |
341 | + } | |
342 | + BuyerInfoOutput buyerInfo = output.getData(); | |
343 | + if (output.getCode()!=ResultCode.SUCCESS){ | |
344 | + log.error("error:调用passport买家验证码登录失败[mobile=,code=,msg=]",new Object[]{req.getAccountName(),output.getCode(),output.getResult()}); | |
345 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
346 | + } | |
347 | + | |
348 | + if (Validator.isNull(buyerInfo)||Validator.isNull(buyerInfo.getId())){ | |
349 | + log.error("error:买家验证码登录返回用户信息为空[accountName=]",req.getAccountName()); | |
350 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST); | |
351 | + } | |
352 | + return buyerInfo; | |
353 | + | |
354 | + } | |
275 | 355 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PickInfoRPCImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.impl; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.deliveryTime.output.DeliveryTimeOutput; | |
3 | 4 | import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoSaveInput; |
4 | 5 | import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoUpdateInput; |
5 | 6 | import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; |
7 | +import com.b2c.myapp.common.utils.BaseOutput; | |
8 | +import com.b2c.myapp.common.utils.ResultCode; | |
9 | +import com.b2c.myapp.sdk.MyAppClient; | |
10 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
6 | 11 | import com.diligrp.mobsite.getway.rpc.PickInfoRPC; |
12 | +import org.slf4j.Logger; | |
13 | +import org.slf4j.LoggerFactory; | |
14 | +import org.springframework.stereotype.Component; | |
7 | 15 | |
16 | +import javax.annotation.Resource; | |
8 | 17 | import java.util.List; |
9 | 18 | |
10 | 19 | /** |
11 | 20 | * Created by jiangchengyong on 2017/1/12. |
12 | 21 | */ |
22 | +@Component | |
13 | 23 | public class PickInfoRPCImpl implements PickInfoRPC{ |
14 | 24 | |
25 | + private Logger logger = LoggerFactory.getLogger(PickInfoRPCImpl.class); | |
26 | + | |
27 | + @Resource | |
28 | + private MyAppClient myAppClient; | |
15 | 29 | |
16 | 30 | /** |
17 | 31 | * 新增收货人 |
... | ... | @@ -20,8 +34,19 @@ public class PickInfoRPCImpl implements PickInfoRPC{ |
20 | 34 | * @return |
21 | 35 | */ |
22 | 36 | @Override |
23 | - public Integer addPickingInfo(PickingInfoSaveInput pickingInfoSaveInput) { | |
24 | - return null; | |
37 | + public PickingInfoOutput addPickingInfo(PickingInfoSaveInput pickingInfoSaveInput) { | |
38 | + BaseOutput<PickingInfoOutput> output = null; | |
39 | + try { | |
40 | + output = myAppClient.getPickingInfoService().addPickingInfo(pickingInfoSaveInput); | |
41 | + if(output.getCode().equals(ResultCode.OK)){ | |
42 | + return output.getData(); | |
43 | + }else{ | |
44 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
45 | + } | |
46 | + } catch (Exception e) { | |
47 | + logger.error("新增收货人接口出错:msg={}",e); | |
48 | + throw new ServiceException(); | |
49 | + } | |
25 | 50 | } |
26 | 51 | |
27 | 52 | /** |
... | ... | @@ -32,7 +57,18 @@ public class PickInfoRPCImpl implements PickInfoRPC{ |
32 | 57 | */ |
33 | 58 | @Override |
34 | 59 | public Boolean modify(PickingInfoUpdateInput pickingInfoUpdateInput) { |
35 | - return null; | |
60 | + BaseOutput<Boolean> output = null; | |
61 | + try { | |
62 | + output = myAppClient.getPickingInfoService().modify(pickingInfoUpdateInput); | |
63 | + if(output.getCode().equals(ResultCode.OK)){ | |
64 | + return output.getData(); | |
65 | + }else{ | |
66 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
67 | + } | |
68 | + } catch (Exception e) { | |
69 | + logger.error("修改收货人信息接口出错:msg={}",e); | |
70 | + throw new ServiceException(); | |
71 | + } | |
36 | 72 | } |
37 | 73 | |
38 | 74 | /** |
... | ... | @@ -43,7 +79,18 @@ public class PickInfoRPCImpl implements PickInfoRPC{ |
43 | 79 | */ |
44 | 80 | @Override |
45 | 81 | public List<PickingInfoOutput> queryPickingInfosByBuyerId(Long buyerId) { |
46 | - return null; | |
82 | + BaseOutput<List<PickingInfoOutput>> output = null; | |
83 | + try { | |
84 | + output = myAppClient.getPickingInfoService().queryPickingInfosByBuyerId(buyerId); | |
85 | + if(output.getCode().equals(ResultCode.OK)){ | |
86 | + return output.getData(); | |
87 | + }else{ | |
88 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
89 | + } | |
90 | + } catch (Exception e) { | |
91 | + logger.error("按买家ID查询收货人接口出错:msg={}",e); | |
92 | + throw new ServiceException(); | |
93 | + } | |
47 | 94 | } |
48 | 95 | |
49 | 96 | /** |
... | ... | @@ -55,7 +102,18 @@ public class PickInfoRPCImpl implements PickInfoRPC{ |
55 | 102 | */ |
56 | 103 | @Override |
57 | 104 | public PickingInfoOutput getDefaultPickingInfoByBuyerId(Long buyerId) { |
58 | - return null; | |
105 | + BaseOutput<PickingInfoOutput> output = null; | |
106 | + try { | |
107 | + output = myAppClient.getPickingInfoService().getDefaultPickingInfoByBuyerId(buyerId); | |
108 | + if(output.getCode().equals(ResultCode.OK)){ | |
109 | + return output.getData(); | |
110 | + }else{ | |
111 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
112 | + } | |
113 | + } catch (Exception e) { | |
114 | + logger.error("根据买家id获取默认收货地址接口出错:msg={}",e); | |
115 | + throw new ServiceException(); | |
116 | + } | |
59 | 117 | } |
60 | 118 | |
61 | 119 | /** |
... | ... | @@ -67,6 +125,39 @@ public class PickInfoRPCImpl implements PickInfoRPC{ |
67 | 125 | */ |
68 | 126 | @Override |
69 | 127 | public Boolean delPickingInfoById(Long id) { |
70 | - return null; | |
128 | + BaseOutput<Boolean> output = null; | |
129 | + try { | |
130 | + output = myAppClient.getPickingInfoService().delPickingInfoById(id); | |
131 | + if(output.getCode().equals(ResultCode.OK)){ | |
132 | + return output.getData(); | |
133 | + }else{ | |
134 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
135 | + } | |
136 | + } catch (Exception e) { | |
137 | + logger.error("删除收货地址接口出错:msg={}",e); | |
138 | + throw new ServiceException(); | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + /** | |
143 | + * 根据收货信息ID查收货信息详情 | |
144 | + * | |
145 | + * @param id | |
146 | + * @return | |
147 | + */ | |
148 | + @Override | |
149 | + public PickingInfoOutput getPickingInfoById(Long id) { | |
150 | + BaseOutput<PickingInfoOutput> output = null; | |
151 | + try { | |
152 | + output = myAppClient.getPickingInfoService().getPickingInfoById(id); | |
153 | + if(output.getCode().equals(ResultCode.OK)){ | |
154 | + return output.getData(); | |
155 | + }else{ | |
156 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
157 | + } | |
158 | + } catch (Exception e) { | |
159 | + logger.error("根据收货信息ID查收货信息详情接口出错:msg={}",e); | |
160 | + throw new ServiceException(); | |
161 | + } | |
71 | 162 | } |
72 | 163 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/SellerRPCImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.impl; |
2 | 2 | |
3 | -import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; | |
4 | 3 | import com.b2c.myapp.common.api.sellerInfo.output.SellerInfoOutput; |
5 | 4 | import com.b2c.myapp.common.utils.BaseOutput; |
6 | 5 | import com.b2c.myapp.sdk.MyAppClient; |
7 | 6 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
8 | 7 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
9 | 8 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
10 | -import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
11 | -import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
12 | 9 | import com.diligrp.mobsite.getway.rpc.GoodsRPC; |
13 | 10 | import com.diligrp.mobsite.getway.rpc.SellerRPC; |
14 | 11 | import com.diligrp.website.util.redis.RedisUtil; |
... | ... | @@ -19,7 +16,6 @@ import org.slf4j.LoggerFactory; |
19 | 16 | import org.springframework.stereotype.Service; |
20 | 17 | |
21 | 18 | import javax.annotation.Resource; |
22 | -import java.util.List; | |
23 | 19 | |
24 | 20 | |
25 | 21 | /** |
... | ... | @@ -50,9 +46,8 @@ public class SellerRPCImpl implements SellerRPC { |
50 | 46 | |
51 | 47 | |
52 | 48 | @Override |
53 | - public boolean checkMobile(String mobile) { | |
49 | + public SellerInfoOutput checkMobile(String mobile) { | |
54 | 50 | BaseOutput<SellerInfoOutput> output = null; |
55 | - boolean flag = false; | |
56 | 51 | try { |
57 | 52 | output = userClient.getSellerInfoService().getSellerInfoByMobilePhone(mobile); |
58 | 53 | } catch (Exception e) { |
... | ... | @@ -60,96 +55,23 @@ public class SellerRPCImpl implements SellerRPC { |
60 | 55 | throw new ServiceException(); |
61 | 56 | } |
62 | 57 | |
63 | - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
58 | + if (output==null||!output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
64 | 59 | logger.error("手机号查询卖家接口失败:[userId={},code={},result={}]",new Object[]{mobile,output.getCode(),output.getResult()}); |
65 | - throw new ServiceException(); | |
60 | + throw new ServiceException(output.getResult()); | |
66 | 61 | } |
67 | - flag = !Validator.isNull(output.getData()); | |
68 | - if(flag){ | |
69 | - logger.info("success:电话号码没有被注册:mobile={}",mobile); | |
70 | - }else { | |
71 | - logger.info("error:电话号码已经被注册:mobile={}",mobile); | |
72 | - } | |
73 | - return flag; | |
74 | - } | |
75 | - | |
76 | - @Override | |
77 | - public boolean modifyAmount(ModifyAmountReq req) { | |
78 | - return false; | |
79 | - } | |
80 | - | |
81 | - @Override | |
82 | - public boolean modifyPwd(String accountName, String newPassword) { | |
83 | - return false; | |
84 | - } | |
85 | - | |
86 | - @Override | |
87 | - public Long addConsignee(PickInfo pickInfo, Long userId) { | |
88 | - return null; | |
89 | - } | |
90 | - | |
91 | - @Override | |
92 | - public boolean updateConsignee(PickInfo pickInfo, Long userId) { | |
93 | - return false; | |
94 | - } | |
95 | - | |
96 | - @Override | |
97 | - public PickInfo getConsignee(Long id) { | |
98 | - return null; | |
62 | + return output.getData(); | |
99 | 63 | } |
100 | 64 | |
101 | - @Override | |
102 | - public boolean delConsignee(Long id) { | |
103 | - return false; | |
104 | - } | |
105 | 65 | |
106 | - @Override | |
107 | - public List<PickInfo> getConsigneeByUserId(Long userId) { | |
108 | - return null; | |
109 | - } | |
110 | 66 | |
111 | 67 | @Override |
112 | - public PickInfo getDefaultConsignee(Long userId) { | |
113 | - return null; | |
114 | - } | |
115 | - | |
116 | - @Override | |
117 | - public boolean setDefaultConsignee(Long id, Long userId) { | |
68 | + public boolean modifyPwd(String accountName, String newPassword) { | |
118 | 69 | return false; |
119 | 70 | } |
120 | 71 | |
121 | - @Override | |
122 | - public String getEncryptPwd(String pwd) { | |
123 | - return null; | |
124 | - } | |
125 | 72 | |
126 | - @Override | |
127 | - public boolean checkPassword(Long userId, String password) { | |
128 | - return false; | |
129 | - } | |
130 | 73 | |
131 | - @Override | |
132 | - public BuyerInfoOutput getUserByMobile(String accountName) { | |
133 | - BaseOutput<BuyerInfoOutput> output = null; | |
134 | - boolean flag = false; | |
135 | - try { | |
136 | - output = userClient.getBuyerInfoService().getBuyerInfoByMobilePhone(accountName); | |
137 | - } catch (Exception e) { | |
138 | - logger.error("检测电话号码接口挂掉:msg={}",e.getMessage()); | |
139 | - throw new ServiceException(); | |
140 | - } | |
141 | 74 | |
142 | - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
143 | - logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()}); | |
144 | - throw new ServiceException(); | |
145 | - } | |
146 | - | |
147 | - if(Validator.isNull(output.getData())){ | |
148 | - logger.info("查询用户为空:[mobile={}]",new Object[]{accountName}); | |
149 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST); | |
150 | - } | |
151 | - return output.getData(); | |
152 | - } | |
153 | 75 | |
154 | 76 | @Override |
155 | 77 | public SellerInfoOutput getSellerByMobile(String accountName) { |
... | ... | @@ -158,12 +80,12 @@ public class SellerRPCImpl implements SellerRPC { |
158 | 80 | try { |
159 | 81 | output = userClient.getSellerInfoService().getSellerInfoByMobilePhone(accountName); |
160 | 82 | } catch (Exception e) { |
161 | - logger.error("检测电话号码接口挂掉:msg={}",e.getMessage()); | |
83 | + logger.error("调用手机号查询卖家接口挂掉:msg={}",e.getMessage()); | |
162 | 84 | throw new ServiceException(); |
163 | 85 | } |
164 | 86 | |
165 | - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
166 | - logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()}); | |
87 | + if (output==null||!output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
88 | + logger.error("手机号查询卖家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()}); | |
167 | 89 | throw new ServiceException(); |
168 | 90 | } |
169 | 91 | |
... | ... | @@ -174,4 +96,49 @@ public class SellerRPCImpl implements SellerRPC { |
174 | 96 | return output.getData(); |
175 | 97 | } |
176 | 98 | |
99 | + //@Override | |
100 | + //public ShopOutput getShopBySellerId(Long id) { | |
101 | + // BaseOutput<ShopOutput> output = null; | |
102 | + // boolean flag = false; | |
103 | + // try { | |
104 | + // output = userClient.getShopInfoService().getShopBySellerId(id); | |
105 | + // } catch (Exception e) { | |
106 | + // logger.error("调用根据id查询店铺接口挂掉",e); | |
107 | + // throw new ServiceException(); | |
108 | + // } | |
109 | + // | |
110 | + // if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
111 | + // logger.error("根据id查询店铺异常:[userId={},code={},result={}]",new Object[]{id,output.getCode(),output.getResult()}); | |
112 | + // throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_SEARCH_FAILED); | |
113 | + // } | |
114 | + // | |
115 | + // if(Validator.isNull(output.getData())){ | |
116 | + // logger.info("查询用户为空:[userId={}]",new Object[]{id}); | |
117 | + // throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.SHOP_NOT_EXIST); | |
118 | + // } | |
119 | + // return output.getData(); | |
120 | + //} | |
121 | + // | |
122 | + //@Override | |
123 | + //public ShopOutput getShopById(Long id) { | |
124 | + // BaseOutput<ShopOutput> output = null; | |
125 | + // try { | |
126 | + // output = userClient.getShopInfoService().getShopByShopId(id); | |
127 | + // } catch (Exception e) { | |
128 | + // logger.error("调用根据id查询店铺接口挂掉:msg={}",e.getMessage()); | |
129 | + // throw new ServiceException(); | |
130 | + // } | |
131 | + // | |
132 | + // if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
133 | + // logger.error("根据id查询店铺接口挂掉:[userId={},code={},result={}]",new Object[]{id,output.getCode(),output.getResult()}); | |
134 | + // throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_SEARCH_FAILED); | |
135 | + // } | |
136 | + // | |
137 | + // if(Validator.isNull(output.getData())){ | |
138 | + // logger.info("查询店铺为空:[userId={}]",new Object[]{id}); | |
139 | + // throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.SHOP_NOT_EXIST); | |
140 | + // } | |
141 | + // return output.getData(); | |
142 | + //} | |
143 | + | |
177 | 144 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/ShopBuyerRPCImpl.java
... | ... | @@ -6,6 +6,7 @@ import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerDetailOutput; |
6 | 6 | import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerKeyOutput; |
7 | 7 | import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; |
8 | 8 | import com.b2c.myapp.common.utils.BaseOutput; |
9 | +import com.b2c.myapp.common.utils.ResultCode; | |
9 | 10 | import com.b2c.myapp.common.utils.base.Page; |
10 | 11 | import com.b2c.myapp.sdk.MyAppClient; |
11 | 12 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
... | ... | @@ -36,14 +37,15 @@ public class ShopBuyerRPCImpl implements ShopBuyerRPC { |
36 | 37 | boolean flag = false; |
37 | 38 | try { |
38 | 39 | output = myAppClient.getShopBuyerService().queryShopAllBuyerList(shopBuyerDetail); |
39 | - if(output.getCode().equals(200)){ | |
40 | + if(output.getCode().equals(ResultCode.OK)){ | |
40 | 41 | return output.getData(); |
42 | + }else{ | |
43 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
41 | 44 | } |
42 | 45 | } catch (Exception e) { |
43 | 46 | log.error("查找店铺所有买家列表接口出错:msg={}",e); |
44 | 47 | throw new ServiceException(); |
45 | 48 | } |
46 | - return null; | |
47 | 49 | } |
48 | 50 | |
49 | 51 | /** |
... | ... | @@ -59,15 +61,16 @@ public class ShopBuyerRPCImpl implements ShopBuyerRPC { |
59 | 61 | boolean flag = false; |
60 | 62 | try { |
61 | 63 | output = myAppClient.getShopBuyerService().bindAndActivate(buyerId,promoCode); |
62 | - if(output.getCode().equals(200)){ | |
64 | + if(output.getCode().equals(ResultCode.OK)){ | |
63 | 65 | return output.getData(); |
66 | + }else{ | |
67 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
64 | 68 | } |
65 | 69 | } catch (Exception e) { |
66 | 70 | log.error("绑定并激活接口出错:msg={}",e); |
67 | 71 | throw new ServiceException(); |
68 | 72 | } |
69 | 73 | |
70 | - return null; | |
71 | 74 | } |
72 | 75 | |
73 | 76 | /** |
... | ... | @@ -82,14 +85,40 @@ public class ShopBuyerRPCImpl implements ShopBuyerRPC { |
82 | 85 | boolean flag = false; |
83 | 86 | try { |
84 | 87 | output = myAppClient.getShopBuyerService().getShopBuyerKeys(shopBuyerId); |
85 | - if(output.getCode().equals(200)){ | |
88 | + if(output.getCode().equals(ResultCode.OK)){ | |
86 | 89 | return output.getData(); |
90 | + }else{ | |
91 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
87 | 92 | } |
88 | 93 | } catch (Exception e) { |
89 | 94 | log.error("获取店铺用户的相关主键信息接口出错:msg={}",e); |
90 | 95 | throw new ServiceException(); |
91 | 96 | } |
92 | 97 | |
93 | - return null; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * 修改店铺名称 | |
102 | + * | |
103 | + * @param shopBuyerId | |
104 | + * @param remarkName | |
105 | + * @return | |
106 | + */ | |
107 | + @Override | |
108 | + public Boolean modifyShopRemarkName(Long shopBuyerId, String remarkName) { | |
109 | + BaseOutput<Boolean> output = null; | |
110 | + boolean flag = false; | |
111 | + try { | |
112 | + output = myAppClient.getShopBuyerService().modifyShopRemarkName(shopBuyerId,remarkName); | |
113 | + if(output.getCode().equals(ResultCode.OK)){ | |
114 | + return output.getData(); | |
115 | + }else{ | |
116 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
117 | + } | |
118 | + } catch (Exception e) { | |
119 | + log.error("修改店铺名称接口出错:msg={}",e); | |
120 | + throw new ServiceException(); | |
121 | + } | |
122 | + | |
94 | 123 | } |
95 | 124 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/ShopRPCImpl.java
... | ... | @@ -4,6 +4,7 @@ import com.b2c.myapp.common.api.shop.input.ShopListInput; |
4 | 4 | import com.b2c.myapp.common.api.shop.input.ShopSaveInput; |
5 | 5 | import com.b2c.myapp.common.api.shop.input.ShopUpdateInput; |
6 | 6 | import com.b2c.myapp.common.api.shop.output.ShopOutput; |
7 | +import com.b2c.myapp.common.api.shopProductRecommend.output.ShopProductRecommendOutput; | |
7 | 8 | import com.b2c.myapp.common.utils.BaseOutput; |
8 | 9 | import com.b2c.myapp.sdk.MyAppClient; |
9 | 10 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
... | ... | @@ -14,6 +15,7 @@ import org.slf4j.LoggerFactory; |
14 | 15 | import org.springframework.stereotype.Service; |
15 | 16 | |
16 | 17 | import javax.annotation.Resource; |
18 | +import java.util.List; | |
17 | 19 | |
18 | 20 | /** |
19 | 21 | * <B>Description</B> <br /> |
... | ... | @@ -42,14 +44,15 @@ public class ShopRPCImpl implements ShopRPC { |
42 | 44 | BaseOutput<ShopOutput> output = null; |
43 | 45 | try{ |
44 | 46 | output = myAppClient.getShopInfoService().createShopInfo(shopSaveInput); |
45 | - if(output.getCode().equals(200)){ | |
47 | + if(output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
46 | 48 | return output.getData(); |
49 | + }else{ | |
50 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
47 | 51 | } |
48 | 52 | }catch (Exception e){ |
49 | 53 | logger.info("调用创建店铺接口出错:",e); |
50 | 54 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
51 | 55 | } |
52 | - return null; | |
53 | 56 | } |
54 | 57 | |
55 | 58 | /** |
... | ... | @@ -64,14 +67,15 @@ public class ShopRPCImpl implements ShopRPC { |
64 | 67 | BaseOutput<ShopOutput> output = null; |
65 | 68 | try{ |
66 | 69 | output = myAppClient.getShopInfoService().getShopBySellerId(sellerId); |
67 | - if(output.getCode().equals(200)){ | |
70 | + if(output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
68 | 71 | return output.getData(); |
72 | + }else{ | |
73 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
69 | 74 | } |
70 | 75 | }catch (Exception e){ |
71 | 76 | logger.info("调用通过卖家id获取店铺信息接口出错:",e); |
72 | 77 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
73 | 78 | } |
74 | - return null; | |
75 | 79 | } |
76 | 80 | |
77 | 81 | /** |
... | ... | @@ -86,14 +90,15 @@ public class ShopRPCImpl implements ShopRPC { |
86 | 90 | BaseOutput<ShopOutput> output = null; |
87 | 91 | try{ |
88 | 92 | output = myAppClient.getShopInfoService().getShopByShopId(shopId); |
89 | - if(output.getCode().equals(200)){ | |
93 | + if(output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
90 | 94 | return output.getData(); |
95 | + }else{ | |
96 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
91 | 97 | } |
92 | 98 | }catch (Exception e){ |
93 | 99 | logger.info("调用通过店铺id获取店铺信息接口出错:",e); |
94 | 100 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
95 | 101 | } |
96 | - return null; | |
97 | 102 | } |
98 | 103 | |
99 | 104 | /** |
... | ... | @@ -108,14 +113,15 @@ public class ShopRPCImpl implements ShopRPC { |
108 | 113 | BaseOutput<ShopOutput> output = null; |
109 | 114 | try{ |
110 | 115 | output = myAppClient.getShopInfoService().getShopInfo(shopListInput); |
111 | - if(output.getCode().equals(200)){ | |
116 | + if(output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
112 | 117 | return output.getData(); |
118 | + }else{ | |
119 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
113 | 120 | } |
114 | 121 | }catch (Exception e){ |
115 | 122 | logger.info("调用多字段条件查询店铺信息接口出错:",e); |
116 | 123 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
117 | 124 | } |
118 | - return null; | |
119 | 125 | } |
120 | 126 | |
121 | 127 | /** |
... | ... | @@ -130,13 +136,16 @@ public class ShopRPCImpl implements ShopRPC { |
130 | 136 | BaseOutput<Boolean> output = null; |
131 | 137 | try{ |
132 | 138 | output = myAppClient.getShopInfoService().modifyShopBasicInfo(shopUpdateInput); |
133 | - if(output.getCode().equals(200)){ | |
139 | + if(output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
134 | 140 | return output.getData(); |
141 | + }else{ | |
142 | + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult()); | |
135 | 143 | } |
136 | 144 | }catch (Exception e){ |
137 | 145 | logger.info("调用修改店铺基本信息接口出错:",e); |
138 | 146 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
139 | 147 | } |
140 | - return null; | |
141 | 148 | } |
149 | + | |
150 | + | |
142 | 151 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/StationMsgRPCImpl.java
... | ... | @@ -49,7 +49,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC |
49 | 49 | params.put("userId", req.getUserId().toString()); |
50 | 50 | BaseOutput<String> output = null; |
51 | 51 | try { |
52 | - output = super.httpPost("/messages/readAllByGroup.do", params, null,null); | |
52 | + output = super.httpPost("/messages/readAllByGroup.do", params, null); | |
53 | 53 | } catch (Exception e) { |
54 | 54 | log.error("调用标识站内信息接口失败",e); |
55 | 55 | throw new ServiceException(); |
... | ... | @@ -90,7 +90,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC |
90 | 90 | params.put("groupCode",req.getGroupType()); |
91 | 91 | BaseOutput<String> output = null; |
92 | 92 | try { |
93 | - output = super.httpPost("/messages.do", params, null,null); | |
93 | + output = super.httpPost("/messages.do", params, null); | |
94 | 94 | } catch (Exception e) { |
95 | 95 | log.error("调用获取站内信列表接口失败",e); |
96 | 96 | throw new ServiceException(); |
... | ... | @@ -184,7 +184,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC |
184 | 184 | params.put("userId", userid.toString()); |
185 | 185 | BaseOutput<String> output = null; |
186 | 186 | try { |
187 | - output = super.httpPost("/messages/unRead.do", params, null,null); | |
187 | + output = super.httpPost("/messages/unRead.do", params, null); | |
188 | 188 | } catch (Exception e) { |
189 | 189 | log.error("调用获取站内信未读信息接口失败",e); |
190 | 190 | throw new ServiceException(); |
... | ... | @@ -218,7 +218,7 @@ public class StationMsgRPCImpl extends BaseServiceImpl implements StationMsgRPC |
218 | 218 | params.put("userId", req.getUserId().toString()); |
219 | 219 | BaseOutput<String> output = null; |
220 | 220 | try { |
221 | - output = super.httpPost("/groupedMessage.do", params, null,null); | |
221 | + output = super.httpPost("/groupedMessage.do", params, null); | |
222 | 222 | } catch (Exception e) { |
223 | 223 | log.error("调用站内信首页分组接口失败",e); |
224 | 224 | throw new ServiceException("调用站内信首页分组失败"); | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/UserRPCImpl.java
1 | 1 | package com.diligrp.mobsite.getway.rpc.impl; |
2 | 2 | |
3 | 3 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
4 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; | |
4 | 5 | import com.b2c.myapp.common.utils.BaseOutput; |
5 | 6 | import com.b2c.myapp.sdk.MyAppClient; |
6 | 7 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
... | ... | @@ -8,11 +9,8 @@ import com.diligrp.mobsite.getway.domain.common.ResultCode; |
8 | 9 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
9 | 10 | import com.diligrp.mobsite.getway.domain.protocol.AddCartProduct; |
10 | 11 | import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; |
11 | -import com.diligrp.mobsite.getway.rpc.GoodsRPC; | |
12 | 12 | import com.diligrp.mobsite.getway.rpc.UserRPC; |
13 | -import com.diligrp.website.util.redis.RedisUtil; | |
14 | 13 | import com.diligrp.website.util.security.Validator; |
15 | -import com.diligrp.website.web.interfaces.WebsiteClient; | |
16 | 14 | import org.slf4j.Logger; |
17 | 15 | import org.slf4j.LoggerFactory; |
18 | 16 | import org.springframework.stereotype.Service; |
... | ... | @@ -35,13 +33,8 @@ public class UserRPCImpl implements UserRPC { |
35 | 33 | |
36 | 34 | |
37 | 35 | @Resource |
38 | - private RedisUtil redisUtil; | |
39 | - @Resource | |
40 | 36 | private MyAppClient myAppClient; |
41 | - @Resource | |
42 | - private WebsiteClient websiteClient; | |
43 | - @Resource | |
44 | - private GoodsRPC goodsRPC; | |
37 | + | |
45 | 38 | |
46 | 39 | |
47 | 40 | private static final Logger logger = LoggerFactory.getLogger(UserRPCImpl.class); |
... | ... | @@ -62,9 +55,8 @@ public class UserRPCImpl implements UserRPC { |
62 | 55 | } |
63 | 56 | |
64 | 57 | @Override |
65 | - public boolean checkMobile(String mobile) { | |
58 | + public BuyerInfoOutput checkMobile(String mobile) { | |
66 | 59 | BaseOutput<BuyerInfoOutput> output = null; |
67 | - boolean flag = false; | |
68 | 60 | try { |
69 | 61 | output = myAppClient.getBuyerInfoService().getBuyerInfoByMobilePhone(mobile); |
70 | 62 | } catch (Exception e) { |
... | ... | @@ -72,38 +64,19 @@ public class UserRPCImpl implements UserRPC { |
72 | 64 | throw new ServiceException(); |
73 | 65 | } |
74 | 66 | |
75 | - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
67 | + if (output==null||!output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
76 | 68 | logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{mobile,output.getCode(),output.getResult()}); |
77 | - throw new ServiceException(); | |
78 | - } | |
79 | - flag = !Validator.isNull(output.getData()); | |
80 | - if(flag){ | |
81 | - logger.info("success:电话号码没有被注册:mobile={}",mobile); | |
82 | - }else { | |
83 | - logger.info("error:电话号码已经被注册:mobile={}",mobile); | |
69 | + throw new ServiceException(output.getResult()); | |
84 | 70 | } |
85 | - return flag; | |
86 | - } | |
87 | 71 | |
88 | - @Override | |
89 | - public boolean modifyAmount(ModifyAmountReq req) { | |
90 | - return false; | |
72 | + return output.getData(); | |
91 | 73 | } |
92 | 74 | |
93 | 75 | @Override |
94 | - public boolean modifyPwd(String accountName, String newPassword) { | |
76 | + public boolean modifyAmount(ModifyAmountReq req) { | |
95 | 77 | return false; |
96 | 78 | } |
97 | 79 | |
98 | - @Override | |
99 | - public String getEncryptPwd(String pwd) { | |
100 | - return null; | |
101 | - } | |
102 | - | |
103 | - @Override | |
104 | - public boolean checkPassword(Long userId, String password) { | |
105 | - return false; | |
106 | - } | |
107 | 80 | |
108 | 81 | @Override |
109 | 82 | public BuyerInfoOutput getUserByMobile(String accountName) { |
... | ... | @@ -112,11 +85,11 @@ public class UserRPCImpl implements UserRPC { |
112 | 85 | try { |
113 | 86 | output = myAppClient.getBuyerInfoService().getBuyerInfoByMobilePhone(accountName); |
114 | 87 | } catch (Exception e) { |
115 | - logger.error("检测电话号码接口挂掉:msg={}",e.getMessage()); | |
88 | + logger.error("手机号查询买家接口挂掉:msg={}",e.getMessage()); | |
116 | 89 | throw new ServiceException(); |
117 | 90 | } |
118 | 91 | |
119 | - if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){ | |
92 | + if (output==null||!output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
120 | 93 | logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()}); |
121 | 94 | throw new ServiceException(); |
122 | 95 | } |
... | ... | @@ -127,4 +100,38 @@ public class UserRPCImpl implements UserRPC { |
127 | 100 | } |
128 | 101 | return output.getData(); |
129 | 102 | } |
103 | + | |
104 | + @Override | |
105 | + public ShopBuyerOutput getDepositCardAmount(Long shopBuyerId,Long buyerId) { | |
106 | + BaseOutput<ShopBuyerOutput> output = null; | |
107 | + try { | |
108 | + output = myAppClient.getShopBuyerService().getShopBuyerById(shopBuyerId); | |
109 | + } catch (Exception e) { | |
110 | + logger.error("买家查询储值卡余额接口挂掉:msg={}",e.getMessage()); | |
111 | + throw new ServiceException(); | |
112 | + } | |
113 | + | |
114 | + if (output==null||!output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK)){ | |
115 | + logger.error("买家查询储值卡余额失败:[userId={},code={},result={}]",new Object[]{buyerId,output.getCode(),output.getResult()}); | |
116 | + throw new ServiceException(); | |
117 | + } | |
118 | + return output.getData(); | |
119 | + } | |
120 | + | |
121 | + @Override | |
122 | + public boolean modifyPwd(String accountName, String newPassword) { | |
123 | + return false; | |
124 | + } | |
125 | + | |
126 | + @Override | |
127 | + public String getEncryptPwd(String pwd) { | |
128 | + return null; | |
129 | + } | |
130 | + | |
131 | + @Override | |
132 | + public boolean checkPassword(Long userId, String password) { | |
133 | + return false; | |
134 | + } | |
135 | + | |
136 | + | |
130 | 137 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/goods/GoodsService.java
... | ... | @@ -13,6 +13,8 @@ import com.diligrp.mobsite.getway.domain.protocol.common.GetProductCategoryReq; |
13 | 13 | import com.diligrp.mobsite.getway.domain.protocol.common.GetProductCategoryResp; |
14 | 14 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductIntroductionReq; |
15 | 15 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductIntroductionResp; |
16 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductRecommendReq; | |
17 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductRecommendResp; | |
16 | 18 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByCategoryReq; |
17 | 19 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByCategoryResp; |
18 | 20 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByKeywordReq; |
... | ... | @@ -35,4 +37,6 @@ public interface GoodsService { |
35 | 37 | SearchProductByCategoryResp searchByCategory(SearchProductByCategoryReq req); |
36 | 38 | |
37 | 39 | GetProductIntroductionResp getIntroductionById(GetProductIntroductionReq req); |
40 | + | |
41 | + GetProductRecommendResp getProductRecommend(GetProductRecommendReq req); | |
38 | 42 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/goods/impl/GoodsServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.goods.impl; |
2 | 2 | |
3 | +import com.diligrp.mobsite.getway.domain.common.enums.PageEnum; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.Goods; | |
5 | +import com.diligrp.mobsite.getway.domain.protocol.GoodsSuper; | |
3 | 6 | import com.diligrp.mobsite.getway.domain.protocol.common.GetProductCategoryReq; |
4 | 7 | import com.diligrp.mobsite.getway.domain.protocol.common.GetProductCategoryResp; |
5 | 8 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductIntroductionReq; |
6 | 9 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductIntroductionResp; |
10 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductRecommendReq; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetProductRecommendResp; | |
7 | 12 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByCategoryReq; |
8 | 13 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByCategoryResp; |
9 | 14 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByKeywordReq; |
10 | 15 | import com.diligrp.mobsite.getway.domain.protocol.search.SearchProductByKeywordResp; |
16 | +import com.diligrp.mobsite.getway.rpc.GoodsRPC; | |
11 | 17 | import com.diligrp.mobsite.getway.service.buyer.goods.GoodsService; |
18 | +import com.diligrp.titan.sdk.domain.Product; | |
19 | +import com.diligrp.titan.sdk.input.ProductSearchInput; | |
20 | +import com.diligrp.titan.sdk.output.PageOutput; | |
21 | +import com.diligrp.website.util.security.Validator; | |
12 | 22 | import org.springframework.stereotype.Service; |
13 | 23 | |
24 | +import javax.annotation.Resource; | |
25 | +import java.util.ArrayList; | |
26 | +import java.util.List; | |
27 | + | |
14 | 28 | /** |
15 | 29 | * @author zhangshirui |
16 | 30 | * @ClassName: GoodsServiceImpl |
... | ... | @@ -20,6 +34,10 @@ import org.springframework.stereotype.Service; |
20 | 34 | @Service("goodsService") |
21 | 35 | public class GoodsServiceImpl implements GoodsService { |
22 | 36 | |
37 | + @Resource | |
38 | + private GoodsRPC goodsRPC; | |
39 | + | |
40 | + | |
23 | 41 | @Override |
24 | 42 | public SearchProductByKeywordResp searchGoodList(SearchProductByKeywordReq req) { |
25 | 43 | return null; |
... | ... | @@ -39,4 +57,37 @@ public class GoodsServiceImpl implements GoodsService { |
39 | 57 | public GetProductIntroductionResp getIntroductionById(GetProductIntroductionReq req) { |
40 | 58 | return null; |
41 | 59 | } |
60 | + | |
61 | + @Override | |
62 | + public GetProductRecommendResp getProductRecommend(GetProductRecommendReq req) { | |
63 | + ProductSearchInput input = new ProductSearchInput(); | |
64 | + input.setIndexTop(0); | |
65 | + input.setPageSize(PageEnum.MINPAGESIZE.getValue()); | |
66 | + input.setPage(Validator.isNull(req.getPageNum()) ? PageEnum.PAGENUM.getValue() : req.getPageNum()); | |
67 | + PageOutput<List<Product>> recommendGoods = goodsRPC.getProductRecommend(input, req.getUserId()); | |
68 | + GetProductRecommendResp resp = new GetProductRecommendResp(); | |
69 | + if (!Validator.isEmpty(recommendGoods.getData())){ | |
70 | + resp.setGoods(buildRecommendGoods(recommendGoods.getData())); | |
71 | + } | |
72 | + resp.setMaxPageNum(recommendGoods.getTotalPage()); | |
73 | + return resp; | |
74 | + } | |
75 | + | |
76 | + | |
77 | + | |
78 | + private List<GoodsSuper> buildRecommendGoods(List<Product> recommendGoods) { | |
79 | + List<GoodsSuper> goodsList = new ArrayList<>(); | |
80 | + for(Product goodsInfo:recommendGoods){ | |
81 | + GoodsSuper goods = new Goods(); | |
82 | + goods.setPid(goodsInfo.getPid()); | |
83 | + goods.setName(goodsInfo.getName()); | |
84 | + goods.setDefaultPic(goodsInfo.getDefaultPic()); | |
85 | + goods.setProductType(goodsInfo.getProductType()); | |
86 | + goods.setDesc(goodsInfo.getDesc()); | |
87 | + goods.setState(goodsInfo.getStatus()); | |
88 | + goodsList.add(goods); | |
89 | + } | |
90 | + return goodsList; | |
91 | + } | |
92 | + | |
42 | 93 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/pickinfo/PickInfoService.java
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/pickinfo/impl/PickInfoServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.pickinfo.impl; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoSaveInput; | |
4 | +import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoUpdateInput; | |
5 | +import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; | |
6 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
7 | +import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
3 | 8 | import com.diligrp.mobsite.getway.domain.protocol.pickinfo.*; |
9 | +import com.diligrp.mobsite.getway.rpc.PickInfoRPC; | |
4 | 10 | import com.diligrp.mobsite.getway.service.buyer.pickinfo.PickInfoService; |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
5 | 12 | import org.springframework.stereotype.Service; |
6 | 13 | |
14 | +import java.util.ArrayList; | |
15 | +import java.util.List; | |
16 | + | |
7 | 17 | /** |
8 | 18 | * Created by jiangchengyong on 2017/1/12. |
9 | 19 | */ |
10 | 20 | @Service |
11 | 21 | public class PickInfoServiceImpl implements PickInfoService{ |
22 | + @Autowired | |
23 | + private PickInfoRPC pickInfoRPC; | |
24 | + | |
12 | 25 | /** |
13 | 26 | * 新增收货人 |
14 | 27 | * |
... | ... | @@ -16,7 +29,20 @@ public class PickInfoServiceImpl implements PickInfoService{ |
16 | 29 | */ |
17 | 30 | @Override |
18 | 31 | public AddPickInfoResp addPickInfo(AddPickInfoReq req) { |
19 | - return null; | |
32 | + AddPickInfoResp resp = new AddPickInfoResp(); | |
33 | + PickInfo pickInfo = req.getPickInfo(); | |
34 | + PickingInfoSaveInput pickingInfoSaveInput = new PickingInfoSaveInput(); | |
35 | + pickingInfoSaveInput.setBuyerId(req.getUserId()); | |
36 | + pickingInfoSaveInput.setName(pickInfo.getName()); | |
37 | + pickingInfoSaveInput.setAddressDetail(pickInfo.getStreetAddress()); | |
38 | + pickingInfoSaveInput.setAddressId(pickInfo.getCityId()); | |
39 | + pickingInfoSaveInput.setDef(pickInfo.getIsDefault()); | |
40 | + pickingInfoSaveInput.setTelphone(pickInfo.getMobile()); | |
41 | + PickingInfoOutput pickingInfoOutput = pickInfoRPC.addPickingInfo(pickingInfoSaveInput); | |
42 | + if(null == pickingInfoOutput){ | |
43 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
44 | + } | |
45 | + return resp; | |
20 | 46 | } |
21 | 47 | |
22 | 48 | /** |
... | ... | @@ -27,7 +53,20 @@ public class PickInfoServiceImpl implements PickInfoService{ |
27 | 53 | */ |
28 | 54 | @Override |
29 | 55 | public UpdatePickInfoResp updatePickInfo(UpdatePickInfoReq req) { |
30 | - return null; | |
56 | + UpdatePickInfoResp resp = new UpdatePickInfoResp(); | |
57 | + PickInfo pickInfo = req.getPickInfo(); | |
58 | + PickingInfoUpdateInput pickingInfoUpdateInput = new PickingInfoUpdateInput(); | |
59 | + pickingInfoUpdateInput.setId(pickInfo.getId()); | |
60 | + pickingInfoUpdateInput.setBuyerId(req.getUserId()); | |
61 | + pickingInfoUpdateInput.setName(pickInfo.getName()); | |
62 | + pickingInfoUpdateInput.setAddressDetail(pickInfo.getStreetAddress()); | |
63 | + pickingInfoUpdateInput.setAddressId(pickInfo.getCityId()); | |
64 | + pickingInfoUpdateInput.setDef(pickInfo.getIsDefault()); | |
65 | + pickingInfoUpdateInput.setTelphone(pickInfo.getMobile()); | |
66 | + if(!pickInfoRPC.modify(pickingInfoUpdateInput)){ | |
67 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
68 | + } | |
69 | + return resp; | |
31 | 70 | } |
32 | 71 | |
33 | 72 | /** |
... | ... | @@ -38,7 +77,13 @@ public class PickInfoServiceImpl implements PickInfoService{ |
38 | 77 | */ |
39 | 78 | @Override |
40 | 79 | public GetPickInfoResp getPickInfo(GetPickInfoReq req) { |
41 | - return null; | |
80 | + GetPickInfoResp resp = new GetPickInfoResp(); | |
81 | + PickingInfoOutput pickInfoOutput = pickInfoRPC.getPickingInfoById(req.getId()); | |
82 | + if(null == pickInfoOutput){ | |
83 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
84 | + } | |
85 | + resp.setPickingInfo(PickInfoOutputToPickInfo(pickInfoOutput)); | |
86 | + return resp; | |
42 | 87 | } |
43 | 88 | |
44 | 89 | /** |
... | ... | @@ -49,7 +94,11 @@ public class PickInfoServiceImpl implements PickInfoService{ |
49 | 94 | */ |
50 | 95 | @Override |
51 | 96 | public DelPickInfoResp delPickInfo(DelPickInfoReq req) { |
52 | - return null; | |
97 | + DelPickInfoResp resp = new DelPickInfoResp(); | |
98 | + if(!pickInfoRPC.delPickingInfoById(req.getId())){ | |
99 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
100 | + } | |
101 | + return resp; | |
53 | 102 | } |
54 | 103 | |
55 | 104 | /** |
... | ... | @@ -60,7 +109,28 @@ public class PickInfoServiceImpl implements PickInfoService{ |
60 | 109 | */ |
61 | 110 | @Override |
62 | 111 | public GetPickInfoListResp getPickInfoList(GetPickInfoListReq req) { |
63 | - return null; | |
112 | + GetPickInfoListResp resp = new GetPickInfoListResp(); | |
113 | + List<PickingInfoOutput> outputList = pickInfoRPC.queryPickingInfosByBuyerId(req.getToken().getUserId()); | |
114 | + List<PickInfo> pickInfos = new ArrayList<>(); | |
115 | + for (PickingInfoOutput pickingInfoOutput : | |
116 | + outputList) { | |
117 | + PickInfo pickInfo = PickInfoOutputToPickInfo(pickingInfoOutput); | |
118 | + pickInfos.add(pickInfo); | |
119 | + } | |
120 | + resp.setPickInfos(pickInfos); | |
121 | + return resp; | |
122 | + } | |
123 | + | |
124 | + private PickInfo PickInfoOutputToPickInfo(PickingInfoOutput pickingInfoOutput) { | |
125 | + PickInfo pickInfo = new PickInfo(); | |
126 | + pickInfo.setCityAddress(pickingInfoOutput.getAddressText()); | |
127 | + pickInfo.setStreetAddress(pickingInfoOutput.getAddressDetail()); | |
128 | + pickInfo.setCityId(pickingInfoOutput.getAddressId()); | |
129 | + pickInfo.setId(pickingInfoOutput.getId()); | |
130 | + pickInfo.setIsDefault(pickingInfoOutput.getDef()); | |
131 | + pickInfo.setMobile(pickingInfoOutput.getTelphone()); | |
132 | + pickInfo.setName(pickingInfoOutput.getName()); | |
133 | + return pickInfo; | |
64 | 134 | } |
65 | 135 | |
66 | 136 | /** |
... | ... | @@ -72,7 +142,10 @@ public class PickInfoServiceImpl implements PickInfoService{ |
72 | 142 | */ |
73 | 143 | @Override |
74 | 144 | public GetDefaultPickInfoResp getDefaultPickInfo(GetDefaultPickInfoReq req) { |
75 | - return null; | |
145 | + GetDefaultPickInfoResp resp = new GetDefaultPickInfoResp(); | |
146 | + PickingInfoOutput pickingInfoOutput = pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getUserId()); | |
147 | + resp.setPickingInfo(PickInfoOutputToPickInfo(pickingInfoOutput)); | |
148 | + return resp; | |
76 | 149 | } |
77 | 150 | |
78 | 151 | /** |
... | ... | @@ -83,7 +156,15 @@ public class PickInfoServiceImpl implements PickInfoService{ |
83 | 156 | * @return |
84 | 157 | */ |
85 | 158 | @Override |
86 | - public SetDefaultPickInfoResp setDefault(Long consigneeId, Long userId) { | |
87 | - return null; | |
159 | + public SetDefaultResp setDefault(Long consigneeId, Long userId) { | |
160 | + SetDefaultResp resp = new SetDefaultResp(); | |
161 | + PickingInfoUpdateInput pickingInfoUpdateInput = new PickingInfoUpdateInput(); | |
162 | + pickingInfoUpdateInput.setId(consigneeId); | |
163 | + pickingInfoUpdateInput.setBuyerId(userId); | |
164 | + pickingInfoUpdateInput.setDef(2); | |
165 | + if(!pickInfoRPC.modify(pickingInfoUpdateInput)){ | |
166 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
167 | + } | |
168 | + return resp; | |
88 | 169 | } |
89 | 170 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/shop/ShopService.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.shop; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.detail.*; |
4 | -import com.diligrp.mobsite.getway.domain.protocol.search.*; | |
5 | -import com.diligrp.mobsite.getway.domain.protocol.shop.*; | |
6 | 4 | |
7 | 5 | |
8 | 6 | /** |
... | ... | @@ -15,99 +13,8 @@ import com.diligrp.mobsite.getway.domain.protocol.shop.*; |
15 | 13 | */ |
16 | 14 | public interface ShopService { |
17 | 15 | |
18 | - | |
19 | - SearchShopResp searchKeyword(SearchShopReq req); | |
20 | - | |
21 | - | |
22 | - GetShopDetailResp getDetailById(GetShopDetailReq req); | |
23 | - | |
24 | - GetShopCategoryResp getShopCategory(Long id); | |
25 | - | |
26 | - GetShopProductResp getProductByShopId(GetShopProductReq req); | |
27 | - | |
28 | - RemoveFavoriteShopResp removeShopFavorite(Long shopId, Long userId); | |
29 | - | |
30 | - | |
31 | - /** | |
32 | - * 获取商品简介 | |
33 | - * @param req | |
34 | - * @return | |
35 | - * @createTime 2015年6月9日 下午2:32:37 | |
36 | - * @author zhangshirui | |
37 | - */ | |
38 | - /** | |
39 | - * 查询店铺资质信息 | |
40 | - * @param req | |
41 | - * @return | |
42 | - * @createTime 2015年6月9日 下午3:53:12 | |
43 | - * @author zhangshirui | |
44 | - */ | |
45 | - GetShopCreditResp getShopCredit(GetShopCreditReq req); | |
46 | - /** | |
47 | - * 查询商品详情 | |
48 | - * @param req | |
49 | - * @return | |
50 | - * @createTime 2015年6月9日 下午2:04:16 | |
51 | - * @author zhangshirui | |
52 | - */ | |
53 | - @Deprecated | |
54 | - GetShopDetailsResp getShopDetails(GetShopDetailsReq req); | |
55 | - | |
56 | - /** | |
57 | - *查询销售店铺列表 | |
58 | - * */ | |
59 | - SearchSaleShopResp getSaleShopList(SearchSaleShopReq req); | |
60 | - | |
61 | - /** | |
62 | - *查询物流店铺列表 | |
63 | - * */ | |
64 | - SearchLogisticsShopResp getLogisticsShopList(SearchLogisticsShopReq req); | |
65 | - | |
66 | - /** | |
67 | - *查询代购店铺列表 | |
68 | - * */ | |
69 | - SearchBuyOnOtherShopResp getBuyOnOtherShopList(SearchBuyOnOtherShopReq req); | |
70 | - | |
71 | - /** | |
72 | - * 查询销售店铺主页 | |
73 | - * @param req | |
74 | - * @return | |
75 | - * @createTime 2015年6月9日 下午2:04:16 | |
76 | - * @author duanyugen | |
77 | - */ | |
78 | - SaleShopMainPageResp getShopDetailNew(GetShopDetailsReq req); | |
79 | - | |
80 | - /** | |
81 | - * 查询物流店铺主页 | |
82 | - * @param req | |
83 | - * @return | |
84 | - * @createTime 2015年6月9日 下午2:04:16 | |
85 | - * @author duanyugen | |
86 | - */ | |
87 | - // LogisticsShopMainPageResp getlogisticsShopMainPage(GetShopDetailsReq req); | |
88 | - | |
89 | - /** | |
90 | - * 查询店铺基本信息 | |
91 | - * @param req | |
92 | - * @return | |
93 | - * @createTime 2015年6月9日 下午2:04:16 | |
94 | - * @author duanyugen | |
95 | - */ | |
96 | - ShopBasicInfoResp getShopBasicInfo(GetShopDetailsReq req); | |
97 | - | |
98 | - /** | |
99 | - * 添加店铺收藏 | |
100 | - * @param req | |
101 | - * @return | |
102 | - * @createTime 2015年8月3日 下午4:55:54 | |
103 | - * @author zhangshiruicom.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdResp getById(GetShopByIdReq ); | |
104 | - */ | |
105 | - AddFavoriteShopResp addShopFavorite(AddFavoriteShopReq req); | |
106 | - | |
107 | - | |
108 | - BindToShopResp getShopIntroduction(BindToShopReq req); | |
109 | - | |
110 | 16 | BindToShopResp bindToShop(BindToShopReq req); |
111 | 17 | |
112 | 18 | GetShopByIdResp getShopById(GetShopByIdReq req); |
19 | + | |
113 | 20 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/shop/impl/ShopServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.shop.impl; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.protocol.detail.*; | |
4 | -import com.diligrp.mobsite.getway.domain.protocol.search.*; | |
5 | -import com.diligrp.mobsite.getway.domain.protocol.shop.*; | |
3 | +import com.b2c.myapp.common.api.shop.output.ShopOutput; | |
4 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; | |
5 | +import com.diligrp.mobsite.getway.domain.common.ErrorMessage; | |
6 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
7 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
8 | +import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopReq; | |
9 | +import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopResp; | |
10 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdReq; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdResp; | |
12 | +import com.diligrp.mobsite.getway.rpc.ShopBuyerRPC; | |
13 | +import com.diligrp.mobsite.getway.rpc.ShopRPC; | |
6 | 14 | import com.diligrp.mobsite.getway.service.buyer.shop.ShopService; |
15 | +import com.diligrp.website.util.security.Validator; | |
7 | 16 | import org.slf4j.Logger; |
8 | 17 | import org.slf4j.LoggerFactory; |
9 | -import org.springframework.beans.factory.annotation.Value; | |
10 | 18 | import org.springframework.stereotype.Service; |
11 | 19 | |
20 | +import javax.annotation.Resource; | |
21 | +import java.util.ArrayList; | |
22 | +import java.util.List; | |
23 | + | |
12 | 24 | |
13 | 25 | /** |
14 | 26 | * <B>Description</B> ShopServiceImpl <br /> |
... | ... | @@ -20,106 +32,52 @@ import org.springframework.stereotype.Service; |
20 | 32 | */ |
21 | 33 | @Service |
22 | 34 | public class ShopServiceImpl implements ShopService { |
23 | - | |
24 | - /** | |
25 | - * 城市级别 | |
26 | - */ | |
27 | - private static final int CITY_LEVEL_ONE = 1; | |
28 | - private static final int CITY_LEVEL_TWO = 2; | |
29 | - private static final int CITY_LEVEL_THREE = 3; | |
30 | - private final Logger logger = LoggerFactory.getLogger(ShopServiceImpl.class); | |
31 | - | |
32 | - // 车辆数量 | |
33 | - private static final String COMPANY_COUNT_TYPE_VEHICLE = "COMPANY_COUNT_TYPE_VEHICLE"; | |
34 | - // | |
35 | - private static final String COMPANY_COUNT_TYPE_LINES = "COMPANY_COUNT_TYPE_VEHICLE"; | |
36 | - // 综合评分 | |
37 | - private static final String AVERAGE_SCORE = "AVERAGE_SCORE"; | |
38 | - | |
39 | - @Value("${system.shopurl.prefix}") | |
40 | - private String shareURLPrefix; | |
41 | - | |
42 | - | |
43 | - | |
44 | - | |
45 | - @Override | |
46 | - public SearchShopResp searchKeyword(SearchShopReq req) { | |
47 | - return null; | |
48 | - } | |
49 | - | |
50 | - | |
51 | - @Override | |
52 | - public GetShopDetailResp getDetailById(GetShopDetailReq req) { | |
53 | - return null; | |
54 | - } | |
55 | - | |
56 | - @Override | |
57 | - public GetShopCategoryResp getShopCategory(Long id) { | |
58 | - return null; | |
59 | - } | |
60 | - | |
61 | - @Override | |
62 | - public GetShopProductResp getProductByShopId(GetShopProductReq req) { | |
63 | - return null; | |
64 | - } | |
65 | - | |
66 | - @Override | |
67 | - public RemoveFavoriteShopResp removeShopFavorite(Long shopId, Long userId) { | |
68 | - return null; | |
69 | - } | |
70 | - | |
71 | - @Override | |
72 | - public GetShopCreditResp getShopCredit(GetShopCreditReq req) { | |
73 | - return null; | |
74 | - } | |
75 | 35 | |
76 | - @Override | |
77 | - public GetShopDetailsResp getShopDetails(GetShopDetailsReq req) { | |
78 | - return null; | |
79 | - } | |
36 | + @Resource | |
37 | + private ShopRPC shopRPC; | |
38 | + @Resource | |
39 | + private ShopBuyerRPC shopBuyerRPC; | |
80 | 40 | |
81 | - @Override | |
82 | - public SearchSaleShopResp getSaleShopList(SearchSaleShopReq req) { | |
83 | - return null; | |
84 | - } | |
41 | + private Logger logger = LoggerFactory.getLogger(getClass()); | |
85 | 42 | |
86 | 43 | @Override |
87 | - public SearchLogisticsShopResp getLogisticsShopList(SearchLogisticsShopReq req) { | |
88 | - return null; | |
89 | - } | |
90 | - | |
91 | - @Override | |
92 | - public SearchBuyOnOtherShopResp getBuyOnOtherShopList(SearchBuyOnOtherShopReq req) { | |
93 | - return null; | |
94 | - } | |
95 | - | |
96 | - @Override | |
97 | - public SaleShopMainPageResp getShopDetailNew(GetShopDetailsReq req) { | |
98 | - return null; | |
44 | + public BindToShopResp bindToShop(BindToShopReq req) { | |
45 | + ShopBuyerOutput shopBuyerOutput = shopBuyerRPC.bindAndActivate(req.getUserId(),Long.valueOf(req.getShopAuthCode())); | |
46 | + BindToShopResp bindToShopResp = new BindToShopResp(); | |
47 | + bindToShopResp.setShopBuyerOutput(shopBuyerOutput); | |
48 | + return bindToShopResp; | |
99 | 49 | } |
100 | 50 | |
101 | 51 | @Override |
102 | - public ShopBasicInfoResp getShopBasicInfo(GetShopDetailsReq req) { | |
103 | - return null; | |
104 | - } | |
52 | + public GetShopByIdResp getShopById(GetShopByIdReq req) { | |
105 | 53 | |
106 | - @Override | |
107 | - public AddFavoriteShopResp addShopFavorite(AddFavoriteShopReq req) { | |
108 | - return null; | |
54 | + ShopOutput shop = shopRPC.getShopByShopId(req.getId()); | |
55 | + if (Validator.isNull(shop)||Validator.isNull(shop.getId())){ | |
56 | + logger.error("查询买家绑定的店铺信息为空[buyerId=%s,shopId=%s]",req.getUserId(),req.getId()); | |
57 | + throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.SHOP_NOT_EXIST); | |
58 | + } | |
59 | + GetShopByIdResp resp = new GetShopByIdResp(); | |
60 | + resp.setPhone(shop.getServiceTel()); | |
61 | + resp.setShopId(shop.getId()); | |
62 | + resp.setShopLogo(shop.getShopLogo()); | |
63 | + resp.setShopName(shop.getShopName()); | |
64 | + resp.setShopNotices(shop.getShopNotices()); | |
65 | + resp.setCityCode(shop.getAddressId()); | |
66 | + resp.setCityName(shop.getAddressText()); | |
67 | + resp.setShopAddr(shop.getAddressDetail()); | |
68 | + String[] categorys = shop.getBusinessCategoryIds().split(","); | |
69 | + List<Long> categoryList = new ArrayList<>(); | |
70 | + for (String category : | |
71 | + categorys) { | |
72 | + categoryList.add(Long.valueOf(category)); | |
73 | + } | |
74 | + resp.setCategories(categoryList); | |
75 | + resp.setFreeShippingPrice(shop.getFreeShippingPrice()); | |
76 | + resp.setPostage(shop.getPostage()); | |
77 | + resp.setProductDisplayWay(shop.getProductDisplayWay()); | |
78 | + return resp; | |
109 | 79 | } |
110 | 80 | |
111 | - @Override | |
112 | - public BindToShopResp getShopIntroduction(BindToShopReq req) { | |
113 | - return null; | |
114 | - } | |
115 | 81 | |
116 | - @Override | |
117 | - public BindToShopResp bindToShop(BindToShopReq req) { | |
118 | - return null; | |
119 | - } | |
120 | 82 | |
121 | - @Override | |
122 | - public GetShopByIdResp getShopById(GetShopByIdReq req) { | |
123 | - return null; | |
124 | - } | |
125 | 83 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/UserService.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.user; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.login.*; |
4 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameReq; | |
5 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameResp; | |
6 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileReq; | |
7 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp; | |
8 | 4 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
9 | 5 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
10 | 6 | import com.diligrp.mobsite.getway.domain.protocol.user.*; |
... | ... | @@ -29,17 +25,7 @@ public interface UserService { |
29 | 25 | * @createTime 2014年8月26日 下午5:37:05 |
30 | 26 | * @author zhangshirui |
31 | 27 | */ |
32 | - LoginResp login(LoginReq req); | |
33 | - | |
34 | - /** | |
35 | - * 验证用户名是否合法 | |
36 | - * | |
37 | - * @param req | |
38 | - * @return | |
39 | - * @createTime 2014年8月26日 下午6:32:14 | |
40 | - * @author zhangshirui | |
41 | - */ | |
42 | - CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req); | |
28 | + LoginResp buyerlogin(LoginReq req); | |
43 | 29 | |
44 | 30 | /** |
45 | 31 | * 验证手机收到的验证码 |
... | ... | @@ -70,25 +56,6 @@ public interface UserService { |
70 | 56 | UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); |
71 | 57 | |
72 | 58 | /** |
73 | - * | |
74 | - * @createTime 2014年8月28日 下午3:45:48 | |
75 | - * @author zhangshirui | |
76 | - * @param req | |
77 | - * @return | |
78 | - */ | |
79 | - CheckAccountNameResp checkAccountName(CheckAccountNameReq req); | |
80 | - | |
81 | - /** | |
82 | - * 验证手机号 | |
83 | - * | |
84 | - * @param req | |
85 | - * @return | |
86 | - * @createTime 2014年8月28日 下午4:03:59 | |
87 | - * @author zhangshirui | |
88 | - */ | |
89 | - CheckMobileResp checkMobile(CheckMobileReq req); | |
90 | - | |
91 | - /** | |
92 | 59 | * 用户注册 |
93 | 60 | * |
94 | 61 | * @param req |
... | ... | @@ -100,24 +67,6 @@ public interface UserService { |
100 | 67 | |
101 | 68 | GetUserInfoResp getUserIntroduction(GetUserInfoReq req); |
102 | 69 | |
103 | - UpdateMobileResp updateMobile(UpdateMobileReq req); | |
104 | - | |
105 | - SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req); | |
106 | - | |
107 | - SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req); | |
108 | - | |
109 | - GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req); | |
110 | - | |
111 | - GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req); | |
112 | - | |
113 | - DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req); | |
114 | - | |
115 | - DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req); | |
116 | - | |
117 | - GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req); | |
118 | - | |
119 | - GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req); | |
120 | - | |
121 | 70 | LogoutResp logout(LogoutReq req); |
122 | 71 | |
123 | 72 | /** |
... | ... | @@ -131,40 +80,6 @@ public interface UserService { |
131 | 80 | ModifyPwdResp modifyPwd(ModifyPwdReq req); |
132 | 81 | |
133 | 82 | /** |
134 | - * 查询用户认证信息 | |
135 | - * | |
136 | - * @param req | |
137 | - * @return | |
138 | - * @createTime 2015年7月9日 上午11:04:45 | |
139 | - * @author zhangshirui | |
140 | - */ | |
141 | - GetAuthInfoResp getAuthInfo(GetAuthInfoReq req); | |
142 | - | |
143 | - /** | |
144 | - * 删除收藏的信息 | |
145 | - * | |
146 | - * @param req | |
147 | - * @return | |
148 | - */ | |
149 | - DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req); | |
150 | - | |
151 | - /** | |
152 | - * 查询收藏的信息 | |
153 | - * | |
154 | - * @param req | |
155 | - * @return | |
156 | - */ | |
157 | - GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req); | |
158 | - | |
159 | - /** | |
160 | - * 添加收藏信息 | |
161 | - * | |
162 | - * @param req | |
163 | - * @return | |
164 | - */ | |
165 | - AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req); | |
166 | - | |
167 | - /** | |
168 | 83 | * 查询用户极光号 |
169 | 84 | * |
170 | 85 | * @param req |
... | ... | @@ -182,14 +97,8 @@ public interface UserService { |
182 | 97 | */ |
183 | 98 | GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req); |
184 | 99 | |
185 | - GetMemberListResp getMemberList(GetMemberListReq req); | |
186 | - | |
187 | - UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req); | |
188 | - | |
189 | 100 | GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req); |
190 | 101 | |
191 | - TradeRecordResp getTradeRecord(TradeRecordReq req); | |
192 | - | |
193 | 102 | SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req); |
194 | 103 | |
195 | 104 | LoginResp authlogin(AuthLoginReq req); | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
... | ... | @@ -10,11 +10,12 @@ import javax.annotation.Resource; |
10 | 10 | import org.slf4j.Logger; |
11 | 11 | import org.slf4j.LoggerFactory; |
12 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
13 | +import org.springframework.beans.factory.annotation.Value; | |
13 | 14 | import org.springframework.stereotype.Service; |
14 | 15 | |
15 | -import com.alibaba.fastjson.JSONObject; | |
16 | 16 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
17 | 17 | import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; |
18 | +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; | |
18 | 19 | import com.diligrp.mobsite.getway.domain.RegisterNoMapper; |
19 | 20 | import com.diligrp.mobsite.getway.domain.common.Constant; |
20 | 21 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
... | ... | @@ -31,41 +32,12 @@ import com.diligrp.mobsite.getway.domain.protocol.login.LogoutReq; |
31 | 32 | import com.diligrp.mobsite.getway.domain.protocol.login.LogoutResp; |
32 | 33 | import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq; |
33 | 34 | import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeResp; |
34 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameReq; | |
35 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameResp; | |
36 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileReq; | |
37 | -import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp; | |
38 | 35 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
39 | 36 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
40 | -import com.diligrp.mobsite.getway.domain.protocol.user.AddFavoriteInfoReq; | |
41 | -import com.diligrp.mobsite.getway.domain.protocol.user.AddFavoriteInfoResp; | |
42 | -import com.diligrp.mobsite.getway.domain.protocol.user.CheckUserInvalidReq; | |
43 | -import com.diligrp.mobsite.getway.domain.protocol.user.CheckUserInvalidResp; | |
44 | -import com.diligrp.mobsite.getway.domain.protocol.user.CompleteUserInfoReq; | |
45 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteInfoReq; | |
46 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteInfoResp; | |
47 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteProductReq; | |
48 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteProductResp; | |
49 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteShopReq; | |
50 | -import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteShopResp; | |
51 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetAuthInfoReq; | |
52 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetAuthInfoResp; | |
53 | 37 | import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressReq; |
54 | 38 | import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressResp; |
55 | 39 | import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountReq; |
56 | 40 | import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountResp; |
57 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetEnterpriseAuthReq; | |
58 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetEnterpriseAuthResp; | |
59 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteInfoReq; | |
60 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteInfoResp; | |
61 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteProductReq; | |
62 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteProductResp; | |
63 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteShopReq; | |
64 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteShopResp; | |
65 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetIdentityAuthReq; | |
66 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetIdentityAuthResp; | |
67 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetMemberListReq; | |
68 | -import com.diligrp.mobsite.getway.domain.protocol.user.GetMemberListResp; | |
69 | 41 | import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoReq; |
70 | 42 | import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoResp; |
71 | 43 | import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNobyUidsReq; |
... | ... | @@ -76,31 +48,17 @@ import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; |
76 | 48 | import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdResp; |
77 | 49 | import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoReq; |
78 | 50 | import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoResp; |
79 | -import com.diligrp.mobsite.getway.domain.protocol.user.SubmitEnterpriseAuthReq; | |
80 | -import com.diligrp.mobsite.getway.domain.protocol.user.SubmitEnterpriseAuthResp; | |
81 | -import com.diligrp.mobsite.getway.domain.protocol.user.SubmitIdentityAuthReq; | |
82 | -import com.diligrp.mobsite.getway.domain.protocol.user.SubmitIdentityAuthResp; | |
83 | -import com.diligrp.mobsite.getway.domain.protocol.user.TradeRecordReq; | |
84 | -import com.diligrp.mobsite.getway.domain.protocol.user.TradeRecordResp; | |
85 | -import com.diligrp.mobsite.getway.domain.protocol.user.UpdateMobileReq; | |
86 | -import com.diligrp.mobsite.getway.domain.protocol.user.UpdateMobileResp; | |
87 | 51 | import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoReq; |
88 | 52 | import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoResp; |
89 | 53 | import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; |
90 | 54 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
91 | -import com.diligrp.mobsite.getway.rpc.ConfigRPC; | |
92 | -import com.diligrp.mobsite.getway.rpc.GoodsRPC; | |
93 | -import com.diligrp.mobsite.getway.rpc.MessageRPC; | |
94 | 55 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
95 | 56 | import com.diligrp.mobsite.getway.rpc.PickInfoRPC; |
96 | -import com.diligrp.mobsite.getway.rpc.ShopRPC; | |
97 | 57 | import com.diligrp.mobsite.getway.rpc.UserRPC; |
98 | -import com.diligrp.mobsite.getway.rpc.utils.UserRedisUtil; | |
58 | +import com.diligrp.mobsite.getway.rpc.base.BaseOutput; | |
99 | 59 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; |
100 | -import com.diligrp.mobsite.getway.service.common.utils.PassportUtils; | |
101 | 60 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
102 | 61 | import com.diligrp.website.util.security.Validator; |
103 | -import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp; | |
104 | 62 | |
105 | 63 | /** |
106 | 64 | * <B>Description</B> 用户 服务层 <br /> |
... | ... | @@ -117,59 +75,108 @@ public class UserServiceImpl implements UserService { |
117 | 75 | |
118 | 76 | @Resource |
119 | 77 | private UserRPC userRPC; |
120 | - @Resource | |
121 | - private GoodsRPC goodsRPC; | |
122 | 78 | @Autowired |
123 | 79 | private RedisUtilImpl redisUtil; |
124 | - @Autowired | |
125 | - private UserRedisUtil userRedisUtil; | |
126 | 80 | |
127 | 81 | @Resource |
128 | 82 | private RegisterNoMapperManager registerNoMapperManager; |
129 | 83 | @Resource |
130 | 84 | private PassportRPC passportRPC; |
131 | 85 | @Resource |
132 | - private ConfigRPC configRPC; | |
133 | - | |
134 | - @Resource | |
135 | - private ShopRPC shopRPC; | |
136 | - @Autowired | |
137 | - private MessageRPC messageRPC; | |
138 | - @Resource | |
139 | 86 | private PickInfoRPC pickInfoRPC; |
140 | 87 | |
88 | + /** | |
89 | + * 登录超时时间:秒 | |
90 | + */ | |
91 | + @Value("${login.timeout.second}") | |
92 | + private int loginExpireTime; | |
93 | + | |
141 | 94 | private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); |
142 | 95 | |
143 | 96 | @Override |
144 | - public LoginResp login(LoginReq req) { | |
145 | - LoginResp resp = (LoginResp) passportRPC.buyerLogin(req); | |
97 | + public LoginResp buyerlogin(LoginReq req) { | |
98 | + BuyerInfoOutput userInfo = passportRPC.buyerLogin(req); | |
146 | 99 | |
147 | - if (!Validator.isEmpty(req.getRegisterNo())) { | |
148 | - // 缓存 | |
149 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
150 | - Constant.USER_ROLE_SIGN_BUYER + String.valueOf(resp.getBuyerId())); | |
100 | + // 缓存用户登录信息 | |
101 | + cacheUserInfo(userInfo.getId(), req.getDeviceId()); | |
151 | 102 | |
152 | - GetRegisterNoResp mappers = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
153 | - // 绑定极光ID | |
154 | - RegisterNoMapper mapper = new RegisterNoMapper(); | |
155 | - mapper.setRegisterNo(req.getRegisterNo()); | |
156 | - mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
157 | - mapper.setUserid(resp.getBuyerId()); | |
158 | - mapper.setUserType(Constant.USER_ROLE_BUYER); | |
159 | - mapper.setDeviceType(req.getDeviceType()); | |
160 | - try { | |
161 | - // 清除当前极光号userid缓存 | |
162 | - cleanOldredis(mapper); | |
163 | - // 构建缓存信息 | |
164 | - buildRedisInfo(mappers, mapper); | |
165 | - redisUtil.setObjectByExpire(redisKey, mappers, RedisKey.REGISTERNO_EXPIRE_TIME); | |
166 | - } catch (Exception e) { | |
167 | - throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, "绑定极光推送系统注册号失败"); | |
168 | - } | |
103 | + if (Validator.isEmpty(req.getRegisterNo())) { | |
104 | + logger.error("卖家登录激光推送id为空[userId=]", userInfo.getId()); | |
105 | + } else { | |
106 | + // 绑定用户激光推送id | |
107 | + bindUserRegisterNo(userInfo.getId(), req.getRegisterNo(), req.getDeviceType()); | |
108 | + } | |
109 | + Long currentShopId = userInfo.getCurrentShopId(); | |
110 | + LoginResp resp = new LoginResp(); | |
111 | + if (Validator.isNull(currentShopId)) { | |
112 | + logger.info("用户未绑定店铺[buyerId=]", userInfo.getId()); | |
113 | + resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
169 | 114 | } |
115 | + resp.setBuyerId(userInfo.getId()); | |
116 | + resp.setHeadImg(userInfo.getFace()); | |
117 | + resp.setMobile(userInfo.getMobilePhone()); | |
118 | + resp.setAccountName(userInfo.getAccountName()); | |
119 | + resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
170 | 120 | return resp; |
171 | 121 | } |
172 | 122 | |
123 | + private void bindUserRegisterNo(Long id, String registerNo, Integer deviceType) { | |
124 | + // 缓存 | |
125 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
126 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
127 | + | |
128 | + GetRegisterNoResp mappers = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
129 | + // 绑定极光ID | |
130 | + RegisterNoMapper mapper = new RegisterNoMapper(); | |
131 | + mapper.setRegisterNo(registerNo); | |
132 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
133 | + mapper.setUserid(id); | |
134 | + mapper.setUserType(Constant.USER_ROLE_BUYER); | |
135 | + mapper.setDeviceType(deviceType); | |
136 | + try { | |
137 | + // 清除当前极光号userid缓存 | |
138 | + cleanOldredis(mapper); | |
139 | + // 构建缓存信息 | |
140 | + buildRedisInfo(mappers, mapper); | |
141 | + redisUtil.setObjectByExpire(redisKey, mappers, RedisKey.REGISTERNO_EXPIRE_TIME); | |
142 | + } catch (Exception e) { | |
143 | + throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, "绑定极光推送系统注册号失败"); | |
144 | + } | |
145 | + } | |
146 | + | |
147 | + private void cacheUserInfo(Long id, String deviceId) { | |
148 | + | |
149 | + // 缓存userId | |
150 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
151 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
152 | + redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(id), loginExpireTime); | |
153 | + | |
154 | + // 缓存设备id,userId作为key | |
155 | + if (!Validator.isNull(deviceId)) { | |
156 | + String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, | |
157 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
158 | + redisUtil.setStringByExpire(onlyOneLoginRedisKey, deviceId, loginExpireTime); | |
159 | + } | |
160 | + | |
161 | + // 缓存currentShopId | |
162 | + // if (!Validator.isNull(resp.getCurrentShopId())){ | |
163 | + // String currentShopIdKey = | |
164 | + // redisUtil.makeKey(RedisKey.USER_BUYER_CURRENTSHOPID, | |
165 | + // Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
166 | + // redisUtil.setStringByExpire(currentShopIdKey, | |
167 | + // String.valueOf(resp.getCurrentShopId()), loginExpireTime); | |
168 | + // } | |
169 | + | |
170 | + // 缓存shopBuyerId | |
171 | + // if (!Validator.isNull(resp.getShopBuyerId())){ | |
172 | + // String shopUserIdKey = | |
173 | + // redisUtil.makeKey(RedisKey.USER_BUYER_SHOPUSERID, | |
174 | + // Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
175 | + // redisUtil.setStringByExpire(shopUserIdKey, | |
176 | + // String.valueOf(resp.getShopBuyerId()), loginExpireTime); | |
177 | + // } | |
178 | + } | |
179 | + | |
173 | 180 | /** |
174 | 181 | * 清除当前极光号下userid缓存 |
175 | 182 | * |
... | ... | @@ -202,82 +209,33 @@ public class UserServiceImpl implements UserService { |
202 | 209 | } |
203 | 210 | |
204 | 211 | @Override |
205 | - public CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req) { | |
206 | - return null; | |
207 | - } | |
208 | - | |
209 | - @Override | |
210 | 212 | public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { |
211 | - CheckVeriCodeResp resp = new CheckVeriCodeResp(); | |
213 | + passportRPC.verifyBuyerSmsCode(req.getMobile(), req.getVeriCode()); | |
212 | 214 | |
213 | - checkVeriCode(req.getVeriCode(), req.getMobile(), req.getMsgType()); | |
214 | - | |
215 | - return resp; | |
215 | + return new CheckVeriCodeResp(); | |
216 | 216 | } |
217 | 217 | |
218 | 218 | @Override |
219 | 219 | public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { |
220 | - SendVeriCodeResp resp = new SendVeriCodeResp(); | |
221 | - | |
222 | 220 | String mobile = req.getMobile(); |
223 | - boolean existFlag = !userRPC.checkMobile(mobile); | |
224 | - | |
221 | + BuyerInfoOutput userinfo = userRPC.checkMobile(mobile); | |
225 | 222 | Integer msgType = req.getMsgType(); |
226 | - String code = null; | |
227 | - String message = null; | |
228 | - | |
229 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
230 | - String veriCode = redisUtil.getString(redisKey); | |
231 | - | |
232 | - if (Validator.isEmpty(veriCode)) { | |
233 | - // 生成验证码 | |
234 | - veriCode = PassportUtils.generateMobileRandomNumber(); | |
235 | - redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME); | |
236 | - } | |
237 | - | |
238 | - if (!Validator.isNull(msgType) && msgType != SendVeriCodeReq.MSG_TYPE_DEFAULT) { | |
239 | - if (msgType == SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
240 | - // 注册,电话号码已经存在 | |
241 | - if (existFlag) { | |
242 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
243 | - } | |
244 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
245 | - resp.setPassKey(passkey); | |
246 | - | |
247 | - messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_ACCOUNT_REGISTRATION); | |
248 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
249 | - return resp; | |
250 | - } else if (msgType == SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
251 | - // 找回密码,电话号码没有存在 | |
252 | - if (!existFlag) { | |
253 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_NOT_EXIST); | |
223 | + if (msgType == SendVeriCodeReq.MSG_TYPE_LOGIN || msgType == SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
224 | + if (Validator.isNull(userinfo)) { | |
225 | + if (Validator.isNull(userinfo)) { | |
226 | + throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
254 | 227 | } |
255 | - messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_RETRIEVE_PASSWORD); | |
256 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
257 | - return resp; | |
258 | - } else if (msgType == SendVeriCodeReq.MSG_TYPE_MODIFY_NEW_MOBILE) { | |
259 | - // 修改手机号,电话号码已经存在 | |
260 | - if (existFlag) { | |
261 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
262 | - } | |
263 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
264 | - } else if (msgType == SendVeriCodeReq.MSG_TYPE_CHECK_OLD_MOBILE) { | |
265 | - // 验证旧的手机号,手机不存在 | |
266 | - if (!existFlag) { | |
267 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_NOT_EXIST); | |
268 | - } | |
269 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
270 | 228 | } |
271 | - DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT); | |
272 | - message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode); | |
273 | - } else { | |
274 | - message = Constant.SMS_CONTENT_DEFAULT.replace("{code}", veriCode); | |
275 | 229 | } |
276 | - | |
277 | - messageRPC.sendSMS(mobile, message); | |
278 | - | |
230 | + if (msgType == SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
231 | + if (!Validator.isNull(userinfo)) { | |
232 | + throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | |
233 | + } | |
234 | + } | |
235 | + BaseOutput<String> out = passportRPC.sendVeriCodeOfBuyer(mobile, req.getMsgType()); | |
236 | + SendVeriCodeResp resp = new SendVeriCodeResp(); | |
279 | 237 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); |
280 | - | |
238 | + resp.setPassKey(out.getData()); | |
281 | 239 | return resp; |
282 | 240 | } |
283 | 241 | |
... | ... | @@ -287,135 +245,39 @@ public class UserServiceImpl implements UserService { |
287 | 245 | } |
288 | 246 | |
289 | 247 | @Override |
290 | - public CheckAccountNameResp checkAccountName(CheckAccountNameReq req) { | |
291 | - return null; | |
292 | - } | |
293 | - | |
294 | - @Override | |
295 | - public CheckMobileResp checkMobile(CheckMobileReq req) { | |
296 | - return null; | |
297 | - } | |
298 | - | |
299 | - @Override | |
300 | 248 | public UserRegisterResp userRegister(UserRegisterReq req) { |
301 | - UserRegisterResp resp = new UserRegisterResp(); | |
302 | - | |
303 | 249 | // 手机号码和账号验证、验证码 |
304 | 250 | // if (!checkRegisterInfo(resp, req)) { |
305 | 251 | // return resp; |
306 | 252 | // } |
307 | - | |
308 | - resp = passportRPC.register(req); | |
309 | - | |
253 | + passportRPC.buyerRegister(req); | |
254 | + UserRegisterResp resp = new UserRegisterResp(); | |
255 | + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
310 | 256 | return resp; |
311 | 257 | } |
312 | 258 | |
313 | - /** | |
314 | - * 检测注册信息是否正确 1.电话号码 2.账号,会员名 3.验证码 | |
315 | - * | |
316 | - * @createTime 2014年10月31日 下午2:37:16 | |
317 | - * @author zhangshirui | |
318 | - */ | |
319 | - private boolean checkRegisterInfo(UserRegisterResp resp, UserRegisterReq req) { | |
320 | - if (!userRPC.checkMobile(req.getMobile())) { | |
321 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
322 | - } | |
323 | - // 验证万能验证码 | |
324 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
325 | - if (req.getVeriCode().equals(passkey)) { | |
326 | - return true; | |
327 | - } | |
328 | - | |
329 | - checkVeriCode(req.getVeriCode(), req.getMobile(), SendVeriCodeReq.MSG_TYPE_REGISTER); | |
330 | - | |
331 | - return true; | |
332 | - } | |
333 | - | |
334 | - /** | |
335 | - * 根据验证码和电话号码,验证收到的验证码 | |
336 | - * | |
337 | - * @param code | |
338 | - * @param mobile | |
339 | - * @return | |
340 | - * @createTime 2014年8月28日 下午5:44:48 | |
341 | - * @author zhangshirui | |
342 | - */ | |
343 | - private void checkVeriCode(String code, String mobile, Integer msgType) { | |
344 | - | |
345 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
346 | - | |
347 | - String redisCode = redisUtil.getString(redisKey); | |
348 | - | |
349 | - if (Validator.isEmpty(code)) { | |
350 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_EMPTY); | |
351 | - } | |
352 | - | |
353 | - // 验证码为空 | |
354 | - if (Validator.isEmpty(redisCode)) { | |
355 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_OVERTIME); | |
356 | - } | |
357 | - | |
358 | - // 验证码不为空,并且和redis中的验证码相同 | |
359 | - if (!code.equals(redisCode)) { | |
360 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_WRONG); | |
361 | - } | |
362 | - | |
363 | - } | |
364 | - | |
365 | 259 | @Override |
366 | 260 | public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { |
367 | 261 | return null; |
368 | 262 | } |
369 | 263 | |
370 | 264 | @Override |
371 | - public UpdateMobileResp updateMobile(UpdateMobileReq req) { | |
372 | - return null; | |
373 | - } | |
374 | - | |
375 | - @Override | |
376 | - public SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req) { | |
377 | - return null; | |
378 | - } | |
379 | - | |
380 | - @Override | |
381 | - public SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req) { | |
382 | - return null; | |
383 | - } | |
384 | - | |
385 | - @Override | |
386 | - public GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req) { | |
387 | - return null; | |
388 | - } | |
389 | - | |
390 | - @Override | |
391 | - public GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req) { | |
392 | - return null; | |
393 | - } | |
394 | - | |
395 | - @Override | |
396 | - public DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req) { | |
397 | - return null; | |
398 | - } | |
399 | - | |
400 | - @Override | |
401 | - public DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req) { | |
402 | - return null; | |
403 | - } | |
404 | - | |
405 | - @Override | |
406 | - public GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req) { | |
407 | - return null; | |
408 | - } | |
409 | - | |
410 | - @Override | |
411 | - public GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req) { | |
412 | - return null; | |
413 | - } | |
414 | - | |
415 | - @Override | |
416 | 265 | public LogoutResp logout(LogoutReq req) { |
417 | 266 | LogoutResp resp = new LogoutResp(); |
418 | 267 | |
268 | + // 解除登录缓存信息 | |
269 | + // userId | |
270 | + String cookieUserIdKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
271 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(req.getUserId())); | |
272 | + // 设备id | |
273 | + String cookieDeviceIdKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, | |
274 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(req.getUserId())); | |
275 | + try { | |
276 | + redisUtil.deleteByKey(cookieUserIdKey); | |
277 | + redisUtil.deleteByKey(cookieDeviceIdKey); | |
278 | + } catch (Exception e) { | |
279 | + logger.error("买家退出登录异常:清除登录缓存信息失败", e); | |
280 | + } | |
419 | 281 | // 解除绑定极光ID |
420 | 282 | if (!Validator.isEmpty(req.getRegisterNo())) { |
421 | 283 | |
... | ... | @@ -444,19 +306,9 @@ public class UserServiceImpl implements UserService { |
444 | 306 | public ModifyPwdResp modifyPwd(ModifyPwdReq req) { |
445 | 307 | BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); |
446 | 308 | Long userId = userInfo.getId(); |
447 | - | |
448 | - Map<String, String> params = new HashMap<String, String>(); | |
449 | - params.put("password", req.getPassword()); | |
450 | - params.put("accountId", String.valueOf(userId)); | |
451 | - | |
452 | - String result = passportRPC.modifyPwd(params); | |
453 | - | |
454 | - JSONObject jsonBody = JSONObject.parseObject(result); | |
455 | - int code = jsonBody.getIntValue("code"); | |
309 | + boolean result = passportRPC.modifyPwdBuyer(req); | |
456 | 310 | ModifyPwdResp resp = new ModifyPwdResp(); |
457 | - resp.setMsg(jsonBody.getString("msg")); | |
458 | - | |
459 | - if (code != ResultCode.SUCCESS) { | |
311 | + if (!result) { | |
460 | 312 | // 失败 |
461 | 313 | resp.setCode(ResultCode.BUSINESS_FAILED); |
462 | 314 | resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); |
... | ... | @@ -464,36 +316,13 @@ public class UserServiceImpl implements UserService { |
464 | 316 | } else { |
465 | 317 | // 修改成功,退出所有账号信息 |
466 | 318 | String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, |
467 | - Constant.USER_ROLE_BUYER + String.valueOf(userId)); | |
319 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(userId)); | |
468 | 320 | redisUtil.deleteByKey(cookieRedisKey); |
469 | 321 | } |
470 | - | |
471 | - logger.info("修改用户密码" + jsonBody.getString("msg")); | |
472 | - | |
473 | 322 | return resp; |
474 | 323 | } |
475 | 324 | |
476 | 325 | @Override |
477 | - public GetAuthInfoResp getAuthInfo(GetAuthInfoReq req) { | |
478 | - return null; | |
479 | - } | |
480 | - | |
481 | - @Override | |
482 | - public DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req) { | |
483 | - return null; | |
484 | - } | |
485 | - | |
486 | - @Override | |
487 | - public GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req) { | |
488 | - return null; | |
489 | - } | |
490 | - | |
491 | - @Override | |
492 | - public AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req) { | |
493 | - return null; | |
494 | - } | |
495 | - | |
496 | - @Override | |
497 | 326 | public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { |
498 | 327 | GetRegisterNoResp resp = new GetRegisterNoResp(); |
499 | 328 | if (Validator.isNull(req.getUserId()) || Validator.isNull(req.getUserType())) { |
... | ... | @@ -567,23 +396,14 @@ public class UserServiceImpl implements UserService { |
567 | 396 | } |
568 | 397 | |
569 | 398 | @Override |
570 | - public GetMemberListResp getMemberList(GetMemberListReq req) { | |
571 | - return null; | |
572 | - } | |
573 | - | |
574 | - @Override | |
575 | - public UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req) { | |
576 | - return null; | |
577 | - } | |
578 | - | |
579 | - @Override | |
580 | 399 | public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { |
581 | - return null; | |
582 | - } | |
583 | - | |
584 | - @Override | |
585 | - public TradeRecordResp getTradeRecord(TradeRecordReq req) { | |
586 | - return null; | |
400 | + ShopBuyerOutput shopByuer = userRPC.getDepositCardAmount(req.getShopBuyerId(), req.getUserId()); | |
401 | + GetDepositCardAmountResp resp = new GetDepositCardAmountResp(); | |
402 | + resp.setShopId(shopByuer.getShopId()); | |
403 | + resp.setFreezeTotalPrice(shopByuer.getFreezeTotalPrice()); | |
404 | + resp.setResidueTotalPrice(shopByuer.getResidueTotalPrice()); | |
405 | + resp.setStoredTotalPrice(shopByuer.getStoredTotalPrice()); | |
406 | + return resp; | |
587 | 407 | } |
588 | 408 | |
589 | 409 | @Override |
... | ... | @@ -593,7 +413,28 @@ public class UserServiceImpl implements UserService { |
593 | 413 | |
594 | 414 | @Override |
595 | 415 | public LoginResp authlogin(AuthLoginReq req) { |
596 | - return null; | |
416 | + BuyerInfoOutput userInfo = passportRPC.authlogin(req); | |
417 | + | |
418 | + // 缓存用户信息 | |
419 | + cacheUserInfo(userInfo.getId(), req.getDeviceId()); | |
420 | + if (Validator.isEmpty(req.getRegisterNo())) { | |
421 | + logger.error("卖家登录激光推送id为空[userId=]", userInfo.getId()); | |
422 | + } else { | |
423 | + // 绑定用户激光推送id | |
424 | + bindUserRegisterNo(userInfo.getId(), req.getRegisterNo(), req.getDeviceType()); | |
425 | + } | |
426 | + Long currentShopId = userInfo.getCurrentShopId(); | |
427 | + LoginResp resp = new LoginResp(); | |
428 | + if (Validator.isNull(currentShopId)) { | |
429 | + logger.info("用户未绑定店铺[buyerId=]", userInfo.getId()); | |
430 | + resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
431 | + } | |
432 | + resp.setBuyerId(userInfo.getId()); | |
433 | + resp.setHeadImg(userInfo.getFace()); | |
434 | + resp.setMobile(userInfo.getMobilePhone()); | |
435 | + resp.setAccountName(userInfo.getAccountName()); | |
436 | + resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
437 | + return resp; | |
597 | 438 | } |
598 | 439 | |
599 | 440 | @Override | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/common/utils/DateUtils.java
1 | 1 | package com.diligrp.mobsite.getway.service.common.utils; |
2 | 2 | |
3 | +import java.sql.Time; | |
3 | 4 | import java.text.ParseException; |
4 | 5 | import java.text.SimpleDateFormat; |
5 | 6 | import java.util.Calendar; |
... | ... | @@ -25,7 +26,8 @@ public class DateUtils { |
25 | 26 | public static final String DATE_TIME_FORMAT12 = "yyyy-MM-dd hh:mm:ss"; |
26 | 27 | public static final String DATE_TIME_FORMAT24 = "yyyy-MM-dd HH:mm:ss"; |
27 | 28 | public static final String DATE_TIME_FORMAT24_NO_SECOND = "yyyy-MM-dd HH:mm"; |
28 | - | |
29 | + public static final String DATE_TIME_FORMAT_TIME= "HH:mm"; | |
30 | + | |
29 | 31 | public static final String DATE_TIME_FORMAT_MILLI = "yyyy-MM-dd HH:mm:ss S"; |
30 | 32 | |
31 | 33 | public static final String DATE_FORMAT_ALL = "yyyyMMddHHmmssS"; |
... | ... | @@ -42,6 +44,7 @@ public class DateUtils { |
42 | 44 | public static String formateDateLenient(Date date,String formatStr,boolean lenient){ |
43 | 45 | SimpleDateFormat format = new SimpleDateFormat(formatStr); |
44 | 46 | format.setLenient(lenient); |
47 | + | |
45 | 48 | return format.format(date); |
46 | 49 | } |
47 | 50 | |
... | ... | @@ -175,8 +178,8 @@ public class DateUtils { |
175 | 178 | |
176 | 179 | /** |
177 | 180 | * 日期相减得到相差小时数 |
178 | - * @param date | |
179 | - * @param paramInt | |
181 | + * @param reductionDate | |
182 | + * @param minuendDate | |
180 | 183 | * @return |
181 | 184 | * @createTime 2015年4月8日 下午3:00:03 |
182 | 185 | * @author zhangshirui |
... | ... | @@ -188,8 +191,8 @@ public class DateUtils { |
188 | 191 | |
189 | 192 | /** |
190 | 193 | * 日期相减得到相差秒数 |
191 | - * @param date | |
192 | - * @param paramInt | |
194 | + * @param reductionDate | |
195 | + * @param minuendDate | |
193 | 196 | * @return |
194 | 197 | * @createTime 2015年4月8日 下午3:00:03 |
195 | 198 | * @author zhangshirui |
... | ... | @@ -204,10 +207,28 @@ public class DateUtils { |
204 | 207 | calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), 24, 0); |
205 | 208 | return calendar.getTime(); |
206 | 209 | } |
210 | + | |
211 | + public static Time parseTime(String dateStr,String formatStr) throws Exception { | |
212 | + SimpleDateFormat format = new SimpleDateFormat(formatStr); | |
213 | + format.setLenient(true); | |
214 | + try { | |
215 | + return new Time(format.parse(dateStr).getTime()); | |
216 | + } catch (ParseException e) { | |
217 | + throw new Exception("解析日期出错"); | |
218 | + } | |
219 | + } | |
207 | 220 | |
208 | 221 | public static void main(String[] args) { |
209 | - long ss = DateUtils.subDateToSeconds(DateUtils.getLastTimeCurrentDay(new Date()), new Date()); | |
210 | - | |
211 | - System.out.println(ss); | |
222 | +// long ss = DateUtils.subDateToSeconds(DateUtils.getLastTimeCurrentDay(new Date()), new Date()); | |
223 | + Time time = null; | |
224 | + try { | |
225 | + time = DateUtils.parseTime("17:30",DATE_TIME_FORMAT_TIME); | |
226 | + } catch (Exception e) { | |
227 | + e.printStackTrace(); | |
228 | + } | |
229 | + | |
230 | + Date date = new Date(time.getTime()); | |
231 | + | |
232 | + System.out.println(DateUtils.formateDate(date,DATE_TIME_FORMAT_TIME)); | |
212 | 233 | } |
213 | 234 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/FundService.java
... | ... | @@ -11,7 +11,7 @@ public interface FundService { |
11 | 11 | |
12 | 12 | public GetFundsResp getFunds(GetFundsReq fundsReq) ; |
13 | 13 | |
14 | - StoreValueResp storeValue(Long price); | |
14 | + StoreValueResp storeValue(StoreValueReq temp); | |
15 | 15 | |
16 | 16 | GetfundTradeRecordResp getfundTradeRecord(GetfundTradeRecordReq req); |
17 | 17 | ModifyShopRemarkNameResp modifyShopRemarkName(ModifyShopRemarkNameReq req); | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerGoodsService.java
... | ... | @@ -29,7 +29,7 @@ public interface SellerGoodsService { |
29 | 29 | * @return |
30 | 30 | * @createTime 2014年8月18日 下午4:11:27 |
31 | 31 | */ |
32 | - public GetProductsResp searchProductsByStatus(GetProductsReq req); | |
32 | + GetProductsResp searchProductsByStatus(GetProductsReq req); | |
33 | 33 | |
34 | 34 | /** |
35 | 35 | *根据商品id查询商品详情 |
... | ... | @@ -37,7 +37,7 @@ public interface SellerGoodsService { |
37 | 37 | * @return |
38 | 38 | * @createTime 2014年8月18日 下午4:11:27 |
39 | 39 | */ |
40 | - public GetSellerProductDetailResp getSellerProductDetail(GetProductDetailReq req); | |
40 | + GetSellerProductDetailResp getSellerProductDetail(GetProductDetailReq req); | |
41 | 41 | |
42 | 42 | /** |
43 | 43 | *更新商品区间价格 |
... | ... | @@ -45,7 +45,7 @@ public interface SellerGoodsService { |
45 | 45 | * @return |
46 | 46 | * @createTime 2014年8月18日 下午4:11:27 |
47 | 47 | */ |
48 | - public SellerProductCommonResp updateSellerProductRangePrice(UpdateRangePriceReq rangePriceReq); | |
48 | + SellerProductCommonResp updateSellerProductRangePrice(UpdateRangePriceReq rangePriceReq); | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | *更新商品sku价格 |
... | ... | @@ -53,7 +53,7 @@ public interface SellerGoodsService { |
53 | 53 | * @return |
54 | 54 | * @createTime 2014年8月18日 下午4:11:27 |
55 | 55 | */ |
56 | - public SellerProductCommonResp updateSellerProductSkuPrice(UpdateSkuPriceReq skuPriceReq); | |
56 | + SellerProductCommonResp updateSellerProductSkuPrice(UpdateSkuPriceReq skuPriceReq); | |
57 | 57 | |
58 | 58 | /** |
59 | 59 | *更新商品库存 |
... | ... | @@ -61,7 +61,7 @@ public interface SellerGoodsService { |
61 | 61 | * @return |
62 | 62 | * @createTime 2014年8月18日 下午4:11:27 |
63 | 63 | */ |
64 | - public SellerProductCommonResp updateSellerProductStock(UpdateSellerProductStockReq stockReq); | |
64 | + SellerProductCommonResp updateSellerProductStock(UpdateSellerProductStockReq stockReq); | |
65 | 65 | |
66 | 66 | /** |
67 | 67 | *批量更新商品状态 |
... | ... | @@ -69,7 +69,7 @@ public interface SellerGoodsService { |
69 | 69 | * @return |
70 | 70 | * @createTime 2014年8月18日 下午4:11:27 |
71 | 71 | */ |
72 | - public SellerProductCommonResp batchUpdateSellerProductStatus(BatchUpdateProductStatusReq batchReq); | |
72 | + SellerProductCommonResp batchUpdateSellerProductStatus(BatchUpdateProductStatusReq batchReq); | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | *批量删除商品 |
... | ... | @@ -77,7 +77,7 @@ public interface SellerGoodsService { |
77 | 77 | * @return |
78 | 78 | * @createTime 2014年8月18日 下午4:11:27 |
79 | 79 | */ |
80 | - public SellerProductCommonResp batchDeleteProduct(List<Long> pids, Long sellerId); | |
80 | + SellerProductCommonResp batchDeleteProduct(List<Long> pids, Long sellerId); | |
81 | 81 | |
82 | 82 | /** |
83 | 83 | *卖家发布商品 |
... | ... | @@ -85,7 +85,7 @@ public interface SellerGoodsService { |
85 | 85 | * @return |
86 | 86 | * @createTime 2014年8月18日 下午4:11:27 |
87 | 87 | */ |
88 | - public SellerProductCommonResp insertPopProduct(SellerPublishProductReq req); | |
88 | + SellerProductCommonResp insertPopProduct(SellerPublishProductReq req); | |
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
... | ... | @@ -94,7 +94,7 @@ public interface SellerGoodsService { |
94 | 94 | * @return |
95 | 95 | * @createTime 2014年8月18日 下午4:11:27 |
96 | 96 | */ |
97 | - public SellerProductCommonResp updatePopProduct(SellerUpdateProductReq req); | |
97 | + SellerProductCommonResp updatePopProduct(SellerUpdateProductReq req); | |
98 | 98 | |
99 | 99 | /** |
100 | 100 | *根据分类id获取商品属性 |
... | ... | @@ -102,7 +102,7 @@ public interface SellerGoodsService { |
102 | 102 | * @return |
103 | 103 | * @createTime 2014年8月18日 下午4:11:27 |
104 | 104 | */ |
105 | - public GetProductAttrResp listAttributes(Integer cid); | |
105 | + GetProductAttrResp listAttributes(Integer cid); | |
106 | 106 | |
107 | 107 | /** |
108 | 108 | *设置商品描述信息 |
... | ... | @@ -124,7 +124,7 @@ public interface SellerGoodsService { |
124 | 124 | * @return |
125 | 125 | * @createTime 2014年8月18日 下午4:11:27 |
126 | 126 | */ |
127 | - public GetProductAttrResp getProductAttrHasSelected(Integer cid, Long pid); | |
127 | + GetProductAttrResp getProductAttrHasSelected(Integer cid, Long pid); | |
128 | 128 | |
129 | 129 | AddProductCategoryResp addProductCategory(AddProductCategoryReq req); |
130 | 130 | |
... | ... | @@ -139,4 +139,10 @@ public interface SellerGoodsService { |
139 | 139 | GetGoodsResp getGoods(GetGoodsReq req); |
140 | 140 | |
141 | 141 | HandleGoodsResp handleGoods(HandleGoodsReq req); |
142 | + | |
143 | + ListCategoryResp listCategory(ListCategoryReq req); | |
144 | + | |
145 | + SearchProductResp searchProduct(SearchProductReq req); | |
146 | + | |
147 | + | |
142 | 148 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerShopService.java
... | ... | @@ -19,8 +19,6 @@ public interface SellerShopService { |
19 | 19 | |
20 | 20 | GetShopInfoResp getShopInfo(BaseReq req); |
21 | 21 | |
22 | - GetShowStyleResp getShowStyle(BaseReq req); | |
23 | - | |
24 | 22 | AddShopDeliveryTimeResp addShopDeliveryTime(AddShopDeliveryTimeReq req); |
25 | 23 | |
26 | 24 | GetShopDeliveryTimeResp getShopDeliveryTime(GetShopDeliveryTimeReq req); | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerUserService.java
... | ... | @@ -31,6 +31,9 @@ public interface SellerUserService { |
31 | 31 | |
32 | 32 | SendVeriCodeResp sendVeriCode(SendVeriCodeReq req); |
33 | 33 | |
34 | + | |
35 | + | |
36 | + | |
34 | 37 | CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req); |
35 | 38 | |
36 | 39 | CheckMobileResp checkMobile(CheckMobileReq req); |
... | ... | @@ -41,7 +44,5 @@ public interface SellerUserService { |
41 | 44 | |
42 | 45 | LogoutResp logout(LogoutReq req); |
43 | 46 | |
44 | - UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); | |
45 | 47 | |
46 | - GetUserInfoResp getUserIntroduction(GetUserInfoReq req); | |
47 | 48 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/FundServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.seller.impl; |
2 | 2 | |
3 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeListInput; | |
4 | +import com.b2c.myapp.common.api.fundTrade.input.FundTradeSaveInput; | |
5 | +import com.b2c.myapp.common.api.fundTrade.output.FundTradeOutput; | |
3 | 6 | import com.b2c.myapp.common.api.shop.output.ShopOutput; |
4 | 7 | import com.b2c.myapp.common.api.shopBuyer.input.ShopBuyerDetail; |
5 | 8 | import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerDetailOutput; |
9 | +import com.b2c.myapp.common.enums.TradeType; | |
6 | 10 | import com.b2c.myapp.common.utils.base.Page; |
11 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
7 | 12 | import com.diligrp.mobsite.getway.domain.protocol.fund.*; |
13 | +import com.diligrp.mobsite.getway.domain.protocol.fund.model.FundTrade; | |
14 | +import com.diligrp.mobsite.getway.rpc.FundTradeRPC; | |
8 | 15 | import com.diligrp.mobsite.getway.rpc.ShopBuyerRPC; |
9 | 16 | import com.diligrp.mobsite.getway.rpc.ShopRPC; |
10 | 17 | import com.diligrp.mobsite.getway.service.seller.FundService; |
18 | +import org.apache.commons.collections.CollectionUtils; | |
11 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 20 | import org.springframework.stereotype.Service; |
13 | 21 | |
22 | +import java.util.ArrayList; | |
23 | +import java.util.Collections; | |
24 | +import java.util.List; | |
25 | + | |
14 | 26 | /** |
15 | 27 | * Created by weili on 2017/1/3. |
16 | 28 | */ |
... | ... | @@ -20,6 +32,8 @@ public class FundServiceImpl implements FundService{ |
20 | 32 | private ShopBuyerRPC shopBuyerRPC; |
21 | 33 | @Autowired |
22 | 34 | private ShopRPC shopRPC; |
35 | + @Autowired | |
36 | + private FundTradeRPC fundTradeRPC; | |
23 | 37 | @Override |
24 | 38 | public GetFundsResp getFunds(GetFundsReq fundsReq) { |
25 | 39 | ShopBuyerDetail shopBuyerDetail = new ShopBuyerDetail(); |
... | ... | @@ -39,18 +53,49 @@ public class FundServiceImpl implements FundService{ |
39 | 53 | } |
40 | 54 | |
41 | 55 | @Override |
42 | - public StoreValueResp storeValue(Long price) { | |
43 | - | |
44 | - return null; | |
56 | + public StoreValueResp storeValue(StoreValueReq temp) { | |
57 | + FundTradeSaveInput fundTradeSaveInput = new FundTradeSaveInput(); | |
58 | + fundTradeSaveInput.setTradeType(TradeType.StoreValue); | |
59 | + fundTradeSaveInput.setShopBuyerId(temp.getShopBuyerId()); | |
60 | + fundTradeSaveInput.setTradePrice(temp.getTradePrice()); | |
61 | + Boolean result = fundTradeRPC.fundTrade(fundTradeSaveInput); | |
62 | + return new StoreValueResp(); | |
45 | 63 | } |
46 | 64 | |
47 | 65 | @Override |
48 | 66 | public GetfundTradeRecordResp getfundTradeRecord(GetfundTradeRecordReq req) { |
49 | - return null; | |
67 | + FundTradeListInput fundTradeListInput = new FundTradeListInput(); | |
68 | + fundTradeListInput.setShopBuyerId(req.getShopBuyerId()); | |
69 | + fundTradeListInput.setTradeType(TradeType.getTradeType(req.getTradeType())); | |
70 | + Page<FundTradeOutput> page = fundTradeRPC.queryFundTrade(fundTradeListInput); | |
71 | + GetfundTradeRecordResp resp = new GetfundTradeRecordResp(); | |
72 | + if(null != page){ | |
73 | + resp.setMaxPageNum(page.getPageCount()); | |
74 | + List<FundTrade> fundTrades = new ArrayList<>(); | |
75 | + if(CollectionUtils.isNotEmpty(page.getResult())){ | |
76 | + for (FundTradeOutput temp: | |
77 | + page.getResult()) { | |
78 | + FundTrade fundTrade = new FundTrade(); | |
79 | + fundTrade.setTradePrice(temp.getTradePrice()); | |
80 | + fundTrade.setCreated(temp.getCreated()); | |
81 | + fundTrade.setOrderId(temp.getOrderId()); | |
82 | + fundTrade.setTradeName(temp.getTradeName()); | |
83 | + fundTrade.setTradeType(temp.getTradeType().getIndex()); | |
84 | + fundTrades.add(fundTrade); | |
85 | + } | |
86 | + } | |
87 | + resp.setFundTrades(fundTrades); | |
88 | + } | |
89 | + return resp; | |
50 | 90 | } |
51 | 91 | |
52 | 92 | @Override |
53 | 93 | public ModifyShopRemarkNameResp modifyShopRemarkName(ModifyShopRemarkNameReq req) { |
54 | - return null; | |
94 | + Boolean result = shopBuyerRPC.modifyShopRemarkName(req.getShopBuyerId(),req.getRemarkName()); | |
95 | + ModifyShopRemarkNameResp resp = new ModifyShopRemarkNameResp(); | |
96 | + if(!result){ | |
97 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
98 | + } | |
99 | + return resp; | |
55 | 100 | } |
56 | 101 | } | ... | ... |