Commit 8dda41e24a19d8eb68c254637add148539522847

Authored by weiliwhereareyou@163.com
1 parent 6aff1b99

买家获取储值卡余额接口开发

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/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/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  
... ... @@ -98,5 +99,5 @@ public interface UserRPC {
98 99  
99 100 BuyerInfoOutput getUserByMobile(String accountName);
100 101  
101   - void getDepositCardAmount();
  102 + ShopBuyerOutput getDepositCardAmount(Long shopBuyerId,Long buyerId);
102 103 }
... ...
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;
... ... @@ -101,26 +102,20 @@ public class UserRPCImpl implements UserRPC {
101 102 }
102 103  
103 104 @Override
104   - public void getDepositCardAmount() {
105   - BaseOutput<BuyerInfoOutput> output = null;
106   - boolean flag = false;
  105 + public ShopBuyerOutput getDepositCardAmount(Long shopBuyerId,Long buyerId) {
  106 + BaseOutput<ShopBuyerOutput> output = null;
107 107 try {
108   - // output = myAppClient.getFundTradeService()..getBuyerInfoByMobilePhone(accountName);
  108 + output = myAppClient.getShopBuyerService().getShopBuyerById(shopBuyerId);
109 109 } catch (Exception e) {
110   - logger.error("手机号查询买家接口挂掉:msg={}",e.getMessage());
  110 + logger.error("买家查询储值卡余额接口挂掉:msg={}",e.getMessage());
111 111 throw new ServiceException();
112 112 }
113 113  
114   - //if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){
115   - // logger.error("手机号查询买家接口失败:[userId={},code={},result={}]",new Object[]{accountName,output.getCode(),output.getResult()});
116   - // throw new ServiceException();
117   - //}
118   - //
119   - //if(Validator.isNull(output.getData())){
120   - // logger.info("查询用户为空:[mobile={}]",new Object[]{accountName});
121   - // throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_NOT_EXIST);
122   - //}
123   -
  114 + if (output==null||!output.getCode().equals(ResultCode.SUCCESS)){
  115 + logger.error("买家查询储值卡余额失败:[userId={},code={},result={}]",new Object[]{buyerId,output.getCode(),output.getResult()});
  116 + throw new ServiceException();
  117 + }
  118 + return output.getData();
124 119 }
125 120  
126 121 @Override
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/goods/impl/GoodsServiceImpl.java
... ... @@ -80,8 +80,11 @@ public class GoodsServiceImpl implements GoodsService {
80 80 for(Product goodsInfo:recommendGoods){
81 81 GoodsSuper goods = new Goods();
82 82 goods.setPid(goodsInfo.getPid());
83   - goods.setName("");
84   - goods.setDefaultPic("");
  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());
85 88 goodsList.add(goods);
86 89 }
87 90 return goodsList;
... ...
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
1 1 package com.diligrp.mobsite.getway.service.buyer.user.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.diligrp.mobsite.getway.domain.RegisterNoMapper;
5 6 import com.diligrp.mobsite.getway.domain.common.Constant;
6 7 import com.diligrp.mobsite.getway.domain.common.ErrorMessage;
... ... @@ -363,10 +364,13 @@ public class UserServiceImpl implements UserService {
363 364  
364 365 @Override
365 366 public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) {
366   -
367   - userRPC.getDepositCardAmount();
368   -
369   - return null;
  367 + ShopBuyerOutput shopByuer = userRPC.getDepositCardAmount(req.getShopBuyerId(),req.getUserId());
  368 + GetDepositCardAmountResp resp = new GetDepositCardAmountResp();
  369 + resp.setShopId(shopByuer.getShopId());
  370 + resp.setFreezeTotalPrice(shopByuer.getFreezeTotalPrice());
  371 + resp.setResidueTotalPrice(shopByuer.getResidueTotalPrice());
  372 + resp.setStoredTotalPrice(shopByuer.getStoredTotalPrice());
  373 + return resp;
370 374 }
371 375  
372 376  
... ...