|
|
@@ -45,6 +45,8 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
@Resource
|
|
|
private OperatingConfigDubboServiceClient operatingConfigDubboServiceClient;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AccountFreezdService accountFreezdService;
|
|
|
|
|
|
// @Override
|
|
|
// public Result freeze(FreezdParam param) {
|
|
|
@@ -87,19 +89,21 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
if (account == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("not.found"));
|
|
|
}
|
|
|
+ BigDecimal forWithdraw = accountFreezdService.sumFreezdForWithdraw(userId);
|
|
|
AccountDTO dto = BeanUtil.toBean(account, AccountDTO.class);
|
|
|
+ dto.setPayPrice(account.getBalance().subtract(forWithdraw));
|
|
|
return Result.genSuccessResult(dto);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Result openGroup(OpenParam param) {
|
|
|
- if (param == null){
|
|
|
+ if (param == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("object.is.empty"));
|
|
|
}
|
|
|
- if (param.getUserId() == null){
|
|
|
+ if (param.getUserId() == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("userid.is.empty"));
|
|
|
}
|
|
|
- if (param.getAmount() == null){
|
|
|
+ if (param.getAmount() == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("amount.is.empty"));
|
|
|
}
|
|
|
// 支付
|
|
|
@@ -111,19 +115,19 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
.transTime(param.getTransTime())
|
|
|
.bizType(BizTypeEnum.OPEN_GROUP_PAY.getKey())
|
|
|
.build());
|
|
|
-
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Result joinGroup(JoinParam param) {
|
|
|
- if (param == null){
|
|
|
+ if (param == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("object.is.empty"));
|
|
|
}
|
|
|
- if (param.getUserId() == null){
|
|
|
+ if (param.getUserId() == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("userid.is.empty"));
|
|
|
}
|
|
|
- if (param.getAmount() == null){
|
|
|
+ if (param.getAmount() == null) {
|
|
|
return Result.genFailResult(LocalUtil.get("amount.is.empty"));
|
|
|
}
|
|
|
// 支付
|
|
|
@@ -158,7 +162,7 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
|
|
|
@Override
|
|
|
public Result accomplishGroup(AccomplishParam param) {
|
|
|
- log.info("accomplishGroup param :"+ JSONObject.toJSONString(param));
|
|
|
+ log.info("accomplishGroup param :" + JSONObject.toJSONString(param));
|
|
|
// 类型 1001充值 2001提现 3001开团支付 3002参团支付 4001未成团退款 4002成团退款 5001开团红包收益 5002参团红包收益 5003签到红包收益 5004下级红包佣金 5005下下级红包佣金
|
|
|
for (OrderParam orderParam : param.getUserIds()) {
|
|
|
Result result = flowService.refund(RefundParam.builder()
|
|
|
@@ -172,15 +176,15 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
throw new ServiceException();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (param.getOpenGroupUserId() != null) {
|
|
|
- log.info("param.getOpenGroupUserId() :"+ param.getOpenGroupUserId());
|
|
|
+ log.info("param.getOpenGroupUserId() :" + param.getOpenGroupUserId());
|
|
|
// 计算开团红包金额
|
|
|
com.txz.operating.result.Result<ConfigDTO> openRedEnvelopeRate = operatingConfigDubboServiceClient.getConfigByCode("open_red_envelope_rate");
|
|
|
- log.info("operatingConfigDubboServiceClient.getConfigByCode openRedEnvelopeRate:"+ JSONObject.toJSONString(openRedEnvelopeRate));
|
|
|
+ log.info("operatingConfigDubboServiceClient.getConfigByCode openRedEnvelopeRate:" + JSONObject.toJSONString(openRedEnvelopeRate));
|
|
|
String rate = openRedEnvelopeRate.getData().getValueInfo();
|
|
|
BigDecimal amount = param.getAmount().multiply(new BigDecimal(rate)).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
|
|
|
-
|
|
|
+
|
|
|
// 开团红包
|
|
|
Result result1 = redEnvelopeService.addRedEnvelope(RedEnvelopeParam.builder()
|
|
|
.amount(amount).bizType(BizTypeEnum.OPEN_GROUP_RED_ENVELOPE.getKey()).orderNo(param.getBizNo())
|
|
|
@@ -188,33 +192,33 @@ public class AccountDubboServiceImpl implements AccountDubboService {
|
|
|
.transTime(param.getTransTime())
|
|
|
.build());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 计算参团红包金额
|
|
|
- for (int i = param.getUserIds().size() -1; i >=0 ; i--) {
|
|
|
+ for (int i = param.getUserIds().size() - 1; i >= 0; i--) {
|
|
|
OrderParam p = param.getUserIds().get(i);
|
|
|
- if (p.getUserId().compareTo(param.getOpenGroupUserId()) == 0){
|
|
|
+ if (p.getUserId().compareTo(param.getOpenGroupUserId()) == 0) {
|
|
|
param.getUserIds().remove(i);
|
|
|
}
|
|
|
}
|
|
|
- if (param.getWinnerUserId().compareTo(param.getOpenGroupUserId()) != 0){
|
|
|
+ if (param.getWinnerUserId().compareTo(param.getOpenGroupUserId()) != 0) {
|
|
|
param.getUserIds().add(OrderParam.builder().orderNo(param.getWinnerOrderNo()).userId(param.getWinnerUserId()).build());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
com.txz.operating.result.Result<ConfigDTO> openRedEnvelopeRate = operatingConfigDubboServiceClient.getConfigByCode("join_red_envelope_rate");
|
|
|
- log.info("operatingConfigDubboServiceClient.getConfigByCode2 openRedEnvelopeRate:"+ JSONObject.toJSONString(openRedEnvelopeRate));
|
|
|
+ log.info("operatingConfigDubboServiceClient.getConfigByCode2 openRedEnvelopeRate:" + JSONObject.toJSONString(openRedEnvelopeRate));
|
|
|
String rate = openRedEnvelopeRate.getData().getValueInfo();
|
|
|
BigDecimal amount = param.getAmount().multiply(new BigDecimal(rate)).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
|
|
|
// 参团红包
|
|
|
- if (CollUtil.isNotEmpty(param.getUserIds())){
|
|
|
+ if (CollUtil.isNotEmpty(param.getUserIds())) {
|
|
|
Result result1 = redEnvelopeService.addRedEnvelope(RedEnvelopeParam.builder()
|
|
|
.amount(amount).bizType(BizTypeEnum.JOIN_GROUP_RED_ENVELOPE.getKey()).orderNo(param.getBizNo())
|
|
|
.userIds(param.getUserIds())
|
|
|
.transTime(param.getTransTime())
|
|
|
.build());
|
|
|
}
|
|
|
-
|
|
|
- log.info("accomplishGroup end param :"+ JSONObject.toJSONString(param));
|
|
|
+
|
|
|
+ log.info("accomplishGroup end param :" + JSONObject.toJSONString(param));
|
|
|
return Result.genSuccessResult();
|
|
|
}
|
|
|
|