Commit 1bc16ae462b39cc4fe64ddf5aa1578c1751f389d

Authored by weiliwhereareyou@163.com
2 parents 8dda41e2 5528ec91

Merge remote-tracking branch 'origin/dev' into dev

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  
... ... @@ -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/impl/PickInfoRPCImpl.java
... ... @@ -137,4 +137,26 @@ public class PickInfoRPCImpl implements PickInfoRPC{
137 137 throw new ServiceException();
138 138 }
139 139 }
  140 +
  141 + /**
  142 + * 根据收货信息ID查收货信息详情
  143 + *
  144 + * @param id
  145 + * @return
  146 + */
  147 + @Override
  148 + public PickingInfoOutput getPickingInfoById(Long id) {
  149 + BaseOutput<PickingInfoOutput> output = null;
  150 + try {
  151 + output = myAppClient.getPickingInfoService().getPickingInfoById(id);
  152 + if(output.getCode().equals(200)){
  153 + return output.getData();
  154 + }else{
  155 + throw new ServiceException(Integer.parseInt(output.getCode()),output.getResult());
  156 + }
  157 + } catch (Exception e) {
  158 + logger.error("根据收货信息ID查收货信息详情接口出错:msg={}",e);
  159 + throw new ServiceException();
  160 + }
  161 + }
140 162 }
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/pickinfo/impl/PickInfoServiceImpl.java
... ... @@ -30,7 +30,14 @@ public class PickInfoServiceImpl implements PickInfoService{
30 30 @Override
31 31 public AddPickInfoResp addPickInfo(AddPickInfoReq req) {
32 32 AddPickInfoResp resp = new AddPickInfoResp();
  33 + PickInfo pickInfo = req.getPickInfo();
33 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());
34 41 PickingInfoOutput pickingInfoOutput = pickInfoRPC.addPickingInfo(pickingInfoSaveInput);
35 42 if(null == pickingInfoOutput){
36 43 resp.setCode(ResultCode.BUSINESS_FAILED);
... ... @@ -47,7 +54,15 @@ public class PickInfoServiceImpl implements PickInfoService{
47 54 @Override
48 55 public UpdatePickInfoResp updatePickInfo(UpdatePickInfoReq req) {
49 56 UpdatePickInfoResp resp = new UpdatePickInfoResp();
  57 + PickInfo pickInfo = req.getPickInfo();
50 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());
51 66 if(!pickInfoRPC.modify(pickingInfoUpdateInput)){
52 67 resp.setCode(ResultCode.BUSINESS_FAILED);
53 68 }
... ... @@ -63,7 +78,11 @@ public class PickInfoServiceImpl implements PickInfoService{
63 78 @Override
64 79 public GetPickInfoResp getPickInfo(GetPickInfoReq req) {
65 80 GetPickInfoResp resp = new GetPickInfoResp();
66   -
  81 + PickingInfoOutput pickInfoOutput = pickInfoRPC.getPickingInfoById(req.getId());
  82 + if(null == pickInfoOutput){
  83 + resp.setCode(ResultCode.BUSINESS_FAILED);
  84 + }
  85 + resp.setPickingInfo(PickInfoOutputToPickInfo(pickInfoOutput));
67 86 return resp;
68 87 }
69 88  
... ... @@ -76,7 +95,7 @@ public class PickInfoServiceImpl implements PickInfoService{
76 95 @Override
77 96 public DelPickInfoResp delPickInfo(DelPickInfoReq req) {
78 97 DelPickInfoResp resp = new DelPickInfoResp();
79   - if(pickInfoRPC.delPickingInfoById(req.getId())){
  98 + if(!pickInfoRPC.delPickingInfoById(req.getId())){
80 99 resp.setCode(ResultCode.BUSINESS_FAILED);
81 100 }
82 101 return resp;
... ... @@ -125,8 +144,7 @@ public class PickInfoServiceImpl implements PickInfoService{
125 144 public GetDefaultPickInfoResp getDefaultPickInfo(GetDefaultPickInfoReq req) {
126 145 GetDefaultPickInfoResp resp = new GetDefaultPickInfoResp();
127 146 PickingInfoOutput pickingInfoOutput = pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getUserId());
128   - PickInfo pickInfo = PickInfoOutputToPickInfo(pickingInfoOutput);
129   - resp.setPickingInfo(pickInfo);
  147 + resp.setPickingInfo(PickInfoOutputToPickInfo(pickingInfoOutput));
130 148 return resp;
131 149 }
132 150  
... ...