Commit bf4a0fab3d94e114ec2ca8ee605cab561aaabae7

Authored by jiangchengyong
1 parent e26b52a5

资金管理 update

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-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/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/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.base.Page;
  7 +import com.diligrp.mobsite.getway.rpc.FundTradeRPC;
  8 +
  9 +/**
  10 + * Created by jiangchengyong on 2017/1/19.
  11 + */
  12 +public class FundTradeRPCImpl implements FundTradeRPC {
  13 + /**
  14 + * @param FundTradeListInput
  15 + * @return BaseOutput<Page<FundTradeOutput>>
  16 + * @comment 多条件查询储值卡资金交易明细
  17 + * @author kelan
  18 + * @time 2016/12/8 10:36
  19 + */
  20 + @Override
  21 + public Page<FundTradeOutput> queryFundTrade(FundTradeListInput FundTradeListInput) {
  22 + return null;
  23 + }
  24 +
  25 + /**
  26 + * 储值卡交易
  27 + *
  28 + * @param fundTradeSaveInput
  29 + * @return
  30 + */
  31 + @Override
  32 + public Boolean fundTrade(FundTradeSaveInput fundTradeSaveInput) {
  33 + return null;
  34 + }
  35 +}
... ...
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/ShopBuyerRPCImpl.java
... ... @@ -92,4 +92,28 @@ public class ShopBuyerRPCImpl implements ShopBuyerRPC {
92 92  
93 93 return null;
94 94 }
  95 +
  96 + /**
  97 + * 修改店铺名称
  98 + *
  99 + * @param shopBuyerId
  100 + * @param remarkName
  101 + * @return
  102 + */
  103 + @Override
  104 + public Boolean modifyShopRemarkName(Long shopBuyerId, String remarkName) {
  105 + BaseOutput<Boolean> output = null;
  106 + boolean flag = false;
  107 + try {
  108 + output = myAppClient.getShopBuyerService().modifyShopRemarkName(shopBuyerId,remarkName);
  109 + if(output.getCode().equals(200)){
  110 + return output.getData();
  111 + }
  112 + } catch (Exception e) {
  113 + log.error("修改店铺名称接口出错:msg={}",e);
  114 + throw new ServiceException();
  115 + }
  116 +
  117 + return null;
  118 + }
95 119 }
... ...
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/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 }
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/fund/FundController.java
... ... @@ -8,7 +8,10 @@ import io.swagger.annotations.Api;
8 8 import io.swagger.annotations.ApiOperation;
9 9 import org.apache.log4j.Logger;
10 10 import org.springframework.stereotype.Controller;
11   -import org.springframework.web.bind.annotation.*;
  11 +import org.springframework.web.bind.annotation.RequestBody;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.ResponseBody;
12 15  
13 16 import javax.annotation.Resource;
14 17  
... ... @@ -71,7 +74,7 @@ public class FundController extends BaseApiController{
71 74 public void storeValue(@RequestBody StoreValueReq temp) {
72 75 StoreValueReq req = super.getRequest(StoreValueReq.class);
73 76 try {
74   - StoreValueResp resp = fundService.storeValue(req.getTradePrice());
  77 + StoreValueResp resp = fundService.storeValue(temp);
75 78 super.sendSuccessResp(resp);
76 79 } catch (ServiceException e) {
77 80 log.error("获取储值列表出现业务异常", e);
... ...
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/shop/SellerShopController.java
... ... @@ -4,6 +4,7 @@ import com.diligrp.mobsite.getway.domain.protocol.BaseReq;
4 4 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeReq;
5 5 import com.diligrp.mobsite.getway.domain.protocol.GetShopDeliveryTimeResp;
6 6 import com.diligrp.mobsite.getway.domain.protocol.shop.*;
  7 +import com.diligrp.mobsite.getway.service.common.utils.DateUtils;
7 8 import com.diligrp.mobsite.getway.service.seller.SellerShopService;
8 9 import com.diligrp.mobsite.getway.web.api.base.BaseApiController;
9 10 import com.diligrp.mobsite.getway.web.utils.BeanValidator;
... ...