Commit e28871c9d2462a396871e59d76294587fa103dc0

Authored by jiangchengyong
1 parent b144e693

shop

mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/shop/AddShopDeliveryTimeReq.java
@@ -9,6 +9,8 @@ import java.util.List; @@ -9,6 +9,8 @@ import java.util.List;
9 * Created by xxxzzz on 2016/12/28. 9 * Created by xxxzzz on 2016/12/28.
10 */ 10 */
11 public class AddShopDeliveryTimeReq extends BaseReq { 11 public class AddShopDeliveryTimeReq extends BaseReq {
  12 + @ApiModelProperty(value = "店铺ID")
  13 + private Long shopId;
12 14
13 @ApiModelProperty(value = "开始时间(如:13:00)",required = true) 15 @ApiModelProperty(value = "开始时间(如:13:00)",required = true)
14 private String beginTime; 16 private String beginTime;
@@ -16,6 +18,14 @@ public class AddShopDeliveryTimeReq extends BaseReq { @@ -16,6 +18,14 @@ public class AddShopDeliveryTimeReq extends BaseReq {
16 @ApiModelProperty(value = "结束时间(如:14:00)",required = true) 18 @ApiModelProperty(value = "结束时间(如:14:00)",required = true)
17 private String endTime; 19 private String endTime;
18 20
  21 + public Long getShopId() {
  22 + return shopId;
  23 + }
  24 +
  25 + public void setShopId(Long shopId) {
  26 + this.shopId = shopId;
  27 + }
  28 +
19 public String getBeginTime() { 29 public String getBeginTime() {
20 return beginTime; 30 return beginTime;
21 } 31 }
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerShopService.java
@@ -19,8 +19,6 @@ public interface SellerShopService { @@ -19,8 +19,6 @@ public interface SellerShopService {
19 19
20 GetShopInfoResp getShopInfo(BaseReq req); 20 GetShopInfoResp getShopInfo(BaseReq req);
21 21
22 - GetShowStyleResp getShowStyle(BaseReq req);  
23 -  
24 AddShopDeliveryTimeResp addShopDeliveryTime(AddShopDeliveryTimeReq req); 22 AddShopDeliveryTimeResp addShopDeliveryTime(AddShopDeliveryTimeReq req);
25 23
26 GetShopDeliveryTimeResp getShopDeliveryTime(GetShopDeliveryTimeReq req); 24 GetShopDeliveryTimeResp getShopDeliveryTime(GetShopDeliveryTimeReq req);
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerShopServiceImpl.java
1 package com.diligrp.mobsite.getway.service.seller.impl; 1 package com.diligrp.mobsite.getway.service.seller.impl;
2 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;
3 import com.b2c.myapp.common.api.shop.input.ShopSaveInput; 6 import com.b2c.myapp.common.api.shop.input.ShopSaveInput;
4 import com.b2c.myapp.common.api.shop.input.ShopUpdateInput; 7 import com.b2c.myapp.common.api.shop.input.ShopUpdateInput;
5 import com.b2c.myapp.common.api.shop.output.ShopOutput; 8 import com.b2c.myapp.common.api.shop.output.ShopOutput;
  9 +import com.diligrp.mobsite.getway.domain.common.ResultCode;
6 import com.diligrp.mobsite.getway.domain.except.ServiceException; 10 import com.diligrp.mobsite.getway.domain.except.ServiceException;
7 import com.diligrp.mobsite.getway.domain.protocol.BaseReq; 11 import com.diligrp.mobsite.getway.domain.protocol.BaseReq;
8 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq; 12 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq;
9 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp; 13 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp;
10 import com.diligrp.mobsite.getway.domain.protocol.shop.*; 14 import com.diligrp.mobsite.getway.domain.protocol.shop.*;
  15 +import com.diligrp.mobsite.getway.rpc.DeliveryTimeRPC;
11 import com.diligrp.mobsite.getway.rpc.ShopRPC; 16 import com.diligrp.mobsite.getway.rpc.ShopRPC;
  17 +import com.diligrp.mobsite.getway.service.common.utils.DateUtils;
12 import com.diligrp.mobsite.getway.service.seller.SellerShopService; 18 import com.diligrp.mobsite.getway.service.seller.SellerShopService;
  19 +import org.apache.commons.collections.CollectionUtils;
13 import org.apache.commons.lang.StringUtils; 20 import org.apache.commons.lang.StringUtils;
14 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
16 23
17 import java.util.ArrayList; 24 import java.util.ArrayList;
  25 +import java.util.Date;
18 import java.util.List; 26 import java.util.List;
19 27
20 28
@@ -30,7 +38,8 @@ import java.util.List; @@ -30,7 +38,8 @@ import java.util.List;
30 public class SellerShopServiceImpl implements SellerShopService { 38 public class SellerShopServiceImpl implements SellerShopService {
31 @Autowired 39 @Autowired
32 private ShopRPC shopRPC; 40 private ShopRPC shopRPC;
33 - 41 + @Autowired
  42 + private DeliveryTimeRPC deliveryTimeRPC;
34 @Override 43 @Override
35 public CreateShopResp createShop(CreateShopReq req) { 44 public CreateShopResp createShop(CreateShopReq req) {
36 ShopSaveInput shopSaveInput = new ShopSaveInput(); 45 ShopSaveInput shopSaveInput = new ShopSaveInput();
@@ -75,18 +84,40 @@ public class SellerShopServiceImpl implements SellerShopService { @@ -75,18 +84,40 @@ public class SellerShopServiceImpl implements SellerShopService {
75 } 84 }
76 85
77 @Override 86 @Override
78 - public GetShowStyleResp getShowStyle(BaseReq req) {  
79 - return null;  
80 - }  
81 -  
82 - @Override  
83 public AddShopDeliveryTimeResp addShopDeliveryTime(AddShopDeliveryTimeReq req) { 87 public AddShopDeliveryTimeResp addShopDeliveryTime(AddShopDeliveryTimeReq req) {
84 - return null; 88 + AddShopDeliveryTimeResp addShopDeliveryTimeResp = new AddShopDeliveryTimeResp();
  89 + DeliveryTimeSaveInput deliveryTimeSaveInput = new DeliveryTimeSaveInput();
  90 + deliveryTimeSaveInput.setShopId(req.getShopId());
  91 + try {
  92 + deliveryTimeSaveInput.setBeginTime(DateUtils.parseTime(req.getBeginTime(),DateUtils.DATE_TIME_FORMAT_TIME));
  93 + deliveryTimeSaveInput.setEndTime(DateUtils.parseTime(req.getEndTime(),DateUtils.DATE_TIME_FORMAT_TIME));
  94 + } catch (Exception e) {
  95 + e.printStackTrace();
  96 + }
  97 + DeliveryTimeOutput reuslt = deliveryTimeRPC.createShopDeliveryTime(deliveryTimeSaveInput);
  98 + if(null == reuslt){
  99 + addShopDeliveryTimeResp.setCode(ResultCode.BUSINESS_FAILED);
  100 + }
  101 + return addShopDeliveryTimeResp;
85 } 102 }
86 103
87 @Override 104 @Override
88 public GetShopDeliveryTimeResp getShopDeliveryTime(GetShopDeliveryTimeReq req) { 105 public GetShopDeliveryTimeResp getShopDeliveryTime(GetShopDeliveryTimeReq req) {
89 - return null; 106 + GetShopDeliveryTimeResp getShopDeliveryTimeResp = new GetShopDeliveryTimeResp();
  107 + DeliveryTimeListInput deliveryTimeListInput = new DeliveryTimeListInput();
  108 + deliveryTimeListInput.setShopId(req.getShopId());
  109 + List<DeliveryTimeOutput> result = deliveryTimeRPC.queryShopDeliveryTime(deliveryTimeListInput);
  110 + List<DeliveryTimeInfo> deliveryTimeInfos = new ArrayList<>();
  111 + for (DeliveryTimeOutput temp :
  112 + result) {
  113 + DeliveryTimeInfo deliveryTimeInfo = new DeliveryTimeInfo();
  114 + deliveryTimeInfo.setId(temp.getId());
  115 + deliveryTimeInfo.setBeginTime(DateUtils.formateDate(new Date(temp.getBeginTime().getTime()),DateUtils.DATE_TIME_FORMAT_TIME));
  116 + deliveryTimeInfo.setEndTime(DateUtils.formateDate(new Date(temp.getEndTime().getTime()),DateUtils.DATE_TIME_FORMAT_TIME));
  117 + deliveryTimeInfos.add(deliveryTimeInfo);
  118 + }
  119 + getShopDeliveryTimeResp.setDeliveryTimeInfos(deliveryTimeInfos);
  120 + return getShopDeliveryTimeResp;
90 } 121 }
91 122
92 @Override 123 @Override