Commit 0547b99b4b699d030d87d4fd06a2bc68be2ed071

Authored by jiangchengyong
1 parent b01020f8

收货地址 实现

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-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/pickinfo/impl/PickInfoServiceImpl.java
... ... @@ -2,12 +2,18 @@ package com.diligrp.mobsite.getway.service.buyer.pickinfo.impl;
2 2  
3 3 import com.b2c.myapp.common.api.pickingInfo.input.PickingInfoSaveInput;
4 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;
5 8 import com.diligrp.mobsite.getway.domain.protocol.pickinfo.*;
6 9 import com.diligrp.mobsite.getway.rpc.PickInfoRPC;
7 10 import com.diligrp.mobsite.getway.service.buyer.pickinfo.PickInfoService;
8 11 import org.springframework.beans.factory.annotation.Autowired;
9 12 import org.springframework.stereotype.Service;
10 13  
  14 +import java.util.ArrayList;
  15 +import java.util.List;
  16 +
11 17 /**
12 18 * Created by jiangchengyong on 2017/1/12.
13 19 */
... ... @@ -23,9 +29,13 @@ public class PickInfoServiceImpl implements PickInfoService{
23 29 */
24 30 @Override
25 31 public AddPickInfoResp addPickInfo(AddPickInfoReq req) {
  32 + AddPickInfoResp resp = new AddPickInfoResp();
26 33 PickingInfoSaveInput pickingInfoSaveInput = new PickingInfoSaveInput();
27   - pickInfoRPC.addPickingInfo(pickingInfoSaveInput);
28   - return null;
  34 + PickingInfoOutput pickingInfoOutput = pickInfoRPC.addPickingInfo(pickingInfoSaveInput);
  35 + if(null == pickingInfoOutput){
  36 + resp.setCode(ResultCode.BUSINESS_FAILED);
  37 + }
  38 + return resp;
29 39 }
30 40  
31 41 /**
... ... @@ -36,9 +46,12 @@ public class PickInfoServiceImpl implements PickInfoService{
36 46 */
37 47 @Override
38 48 public UpdatePickInfoResp updatePickInfo(UpdatePickInfoReq req) {
  49 + UpdatePickInfoResp resp = new UpdatePickInfoResp();
39 50 PickingInfoUpdateInput pickingInfoUpdateInput = new PickingInfoUpdateInput();
40   - pickInfoRPC.modify(pickingInfoUpdateInput);
41   - return null;
  51 + if(!pickInfoRPC.modify(pickingInfoUpdateInput)){
  52 + resp.setCode(ResultCode.BUSINESS_FAILED);
  53 + }
  54 + return resp;
42 55 }
43 56  
44 57 /**
... ... @@ -49,7 +62,9 @@ public class PickInfoServiceImpl implements PickInfoService{
49 62 */
50 63 @Override
51 64 public GetPickInfoResp getPickInfo(GetPickInfoReq req) {
52   - return null;
  65 + GetPickInfoResp resp = new GetPickInfoResp();
  66 +
  67 + return resp;
53 68 }
54 69  
55 70 /**
... ... @@ -60,8 +75,11 @@ public class PickInfoServiceImpl implements PickInfoService{
60 75 */
61 76 @Override
62 77 public DelPickInfoResp delPickInfo(DelPickInfoReq req) {
63   - pickInfoRPC.delPickingInfoById(req.getId());
64   - return null;
  78 + DelPickInfoResp resp = new DelPickInfoResp();
  79 + if(pickInfoRPC.delPickingInfoById(req.getId())){
  80 + resp.setCode(ResultCode.BUSINESS_FAILED);
  81 + }
  82 + return resp;
65 83 }
66 84  
67 85 /**
... ... @@ -72,8 +90,28 @@ public class PickInfoServiceImpl implements PickInfoService{
72 90 */
73 91 @Override
74 92 public GetPickInfoListResp getPickInfoList(GetPickInfoListReq req) {
75   - pickInfoRPC.queryPickingInfosByBuyerId(req.getToken().getUserId());
76   - return null;
  93 + GetPickInfoListResp resp = new GetPickInfoListResp();
  94 + List<PickingInfoOutput> outputList = pickInfoRPC.queryPickingInfosByBuyerId(req.getToken().getUserId());
  95 + List<PickInfo> pickInfos = new ArrayList<>();
  96 + for (PickingInfoOutput pickingInfoOutput :
  97 + outputList) {
  98 + PickInfo pickInfo = PickInfoOutputToPickInfo(pickingInfoOutput);
  99 + pickInfos.add(pickInfo);
  100 + }
  101 + resp.setPickInfos(pickInfos);
  102 + return resp;
  103 + }
  104 +
  105 + private PickInfo PickInfoOutputToPickInfo(PickingInfoOutput pickingInfoOutput) {
  106 + PickInfo pickInfo = new PickInfo();
  107 + pickInfo.setCityAddress(pickingInfoOutput.getAddressText());
  108 + pickInfo.setStreetAddress(pickingInfoOutput.getAddressDetail());
  109 + pickInfo.setCityId(pickingInfoOutput.getAddressId());
  110 + pickInfo.setId(pickingInfoOutput.getId());
  111 + pickInfo.setIsDefault(pickingInfoOutput.getDef());
  112 + pickInfo.setMobile(pickingInfoOutput.getTelphone());
  113 + pickInfo.setName(pickingInfoOutput.getName());
  114 + return pickInfo;
77 115 }
78 116  
79 117 /**
... ... @@ -85,8 +123,11 @@ public class PickInfoServiceImpl implements PickInfoService{
85 123 */
86 124 @Override
87 125 public GetDefaultPickInfoResp getDefaultPickInfo(GetDefaultPickInfoReq req) {
88   - pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getUserId());
89   - return null;
  126 + GetDefaultPickInfoResp resp = new GetDefaultPickInfoResp();
  127 + PickingInfoOutput pickingInfoOutput = pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getUserId());
  128 + PickInfo pickInfo = PickInfoOutputToPickInfo(pickingInfoOutput);
  129 + resp.setPickingInfo(pickInfo);
  130 + return resp;
90 131 }
91 132  
92 133 /**
... ... @@ -98,10 +139,13 @@ public class PickInfoServiceImpl implements PickInfoService{
98 139 */
99 140 @Override
100 141 public SetDefaultPickInfoResp setDefault(Long consigneeId, Long userId) {
  142 + SetDefaultPickInfoResp resp = new SetDefaultPickInfoResp();
101 143 PickingInfoUpdateInput pickingInfoUpdateInput = new PickingInfoUpdateInput();
102 144 pickingInfoUpdateInput.setId(consigneeId);
103 145 pickingInfoUpdateInput.setBuyerId(userId);
104   - pickInfoRPC.modify(pickingInfoUpdateInput);
105   - return null;
  146 + if(!pickInfoRPC.modify(pickingInfoUpdateInput)){
  147 + resp.setCode(ResultCode.BUSINESS_FAILED);
  148 + }
  149 + return resp;
106 150 }
107 151 }
... ...
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 +import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq;
  4 +import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp;
3 5 import com.diligrp.mobsite.getway.domain.protocol.detail.*;
4 6 import com.diligrp.mobsite.getway.domain.protocol.search.*;
5 7 import com.diligrp.mobsite.getway.domain.protocol.shop.*;
... ...
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 3 import com.b2c.myapp.common.api.shop.output.ShopOutput;
  4 +import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput;
4 5 import com.diligrp.mobsite.getway.domain.common.ErrorMessage;
5 6 import com.diligrp.mobsite.getway.domain.common.ResultCode;
6 7 import com.diligrp.mobsite.getway.domain.except.ServiceException;
  8 +import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq;
  9 +import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp;
7 10 import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopReq;
8 11 import com.diligrp.mobsite.getway.domain.protocol.detail.BindToShopResp;
9 12 import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdReq;
10 13 import com.diligrp.mobsite.getway.domain.protocol.detail.GetShopByIdResp;
  14 +import com.diligrp.mobsite.getway.rpc.DeliveryTimeRPC;
  15 +import com.diligrp.mobsite.getway.rpc.ShopBuyerRPC;
11 16 import com.diligrp.mobsite.getway.rpc.impl.ShopRPCImpl;
12 17 import com.diligrp.mobsite.getway.service.buyer.shop.ShopService;
13 18 import com.diligrp.website.util.security.Validator;
... ... @@ -16,6 +21,9 @@ import org.slf4j.LoggerFactory;
16 21 import org.springframework.stereotype.Service;
17 22  
18 23 import javax.annotation.Resource;
  24 +import java.util.ArrayList;
  25 +import java.util.Arrays;
  26 +import java.util.List;
19 27  
20 28  
21 29 /**
... ... @@ -31,13 +39,17 @@ public class ShopServiceImpl implements ShopService {
31 39  
32 40 @Resource
33 41 private ShopRPCImpl shopRPC;
34   -
  42 + @Resource
  43 + private ShopBuyerRPC shopBuyerRPC;
35 44  
36 45 private Logger logger = LoggerFactory.getLogger(getClass());
37 46  
38 47 @Override
39 48 public BindToShopResp bindToShop(BindToShopReq req) {
40   - return null;
  49 + ShopBuyerOutput shopBuyerOutput = shopBuyerRPC.bindAndActivate(req.getUserId(),Long.valueOf(req.getShopAuthCode()));
  50 + BindToShopResp bindToShopResp = new BindToShopResp();
  51 + bindToShopResp.setShopBuyerOutput(shopBuyerOutput);
  52 + return bindToShopResp;
41 53 }
42 54  
43 55 @Override
... ... @@ -49,7 +61,6 @@ public class ShopServiceImpl implements ShopService {
49 61 throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.SHOP_NOT_EXIST);
50 62 }
51 63 GetShopByIdResp resp = new GetShopByIdResp();
52   - resp.setShopId(shop.getId());
53 64 resp.setPhone(shop.getServiceTel());
54 65 resp.setShopId(shop.getId());
55 66 resp.setShopLogo(shop.getShopLogo());
... ... @@ -58,6 +69,17 @@ public class ShopServiceImpl implements ShopService {
58 69 resp.setCityCode(shop.getAddressId());
59 70 resp.setCityName(shop.getAddressText());
60 71 resp.setShopAddr(shop.getAddressDetail());
  72 + String[] categorys = shop.getBusinessCategoryIds().split(",");
  73 + List<Long> categoryList = new ArrayList<>();
  74 + for (String category :
  75 + categorys) {
  76 + categoryList.add(Long.valueOf(category));
  77 + }
  78 + resp.setCategories(categoryList);
  79 + resp.setFreeShippingPrice(shop.getFreeShippingPrice());
  80 + resp.setPostage(shop.getPostage());
  81 + resp.setProductDisplayWay(shop.getProductDisplayWay());
61 82 return resp;
62 83 }
  84 +
63 85 }
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/shop/ShopController.java
... ... @@ -4,6 +4,7 @@ import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq;
4 4 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp;
5 5 import com.diligrp.mobsite.getway.domain.protocol.detail.*;
6 6 import com.diligrp.mobsite.getway.service.buyer.shop.ShopService;
  7 +import com.diligrp.mobsite.getway.service.seller.SellerShopService;
7 8 import com.diligrp.mobsite.getway.web.api.base.BaseApiController;
8 9 import com.diligrp.mobsite.getway.web.utils.BeanValidator;
9 10 import io.swagger.annotations.Api;
... ... @@ -34,6 +35,8 @@ public class ShopController extends BaseApiController {
34 35  
35 36 @Resource
36 37 private ShopService shopServiceImpl;
  38 + @Resource
  39 + private SellerShopService sellerShopService;
37 40 private Logger log = LoggerFactory.getLogger(getClass());
38 41  
39 42  
... ... @@ -87,7 +90,6 @@ public class ShopController extends BaseApiController {
87 90 GetProductRecommendResp resp = null;
88 91 try {
89 92 BeanValidator.validator(req);
90   - // resp = shopServiceImpl.getRecommends(req);
91 93 sendSuccessResp(resp);
92 94 }
93 95 catch(Exception e) {
... ... @@ -108,7 +110,7 @@ public class ShopController extends BaseApiController {
108 110 GetShopDeliveryTimeResp resp = null;
109 111 try {
110 112 BeanValidator.validator(req);
111   - // resp = shopServiceImpl.getRecommends(req);
  113 + resp = sellerShopService.getShopDeliveryTime(temp);
112 114 sendSuccessResp(resp);
113 115 }
114 116 catch(Exception e) {
... ...