|
@@ -7,11 +7,14 @@ import com.sckw.core.common.enums.NumberConstant;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
|
|
+import com.sckw.core.model.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.OrderUtils;
|
|
import com.sckw.core.utils.OrderUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
|
|
+import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.order.api.model.UpdateOrderStatusParam;
|
|
import com.sckw.order.api.model.UpdateOrderStatusParam;
|
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
@@ -38,6 +41,7 @@ import com.sckw.stream.enums.MessageEnum;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
|
|
|
+import com.sckw.transport.api.model.param.LogisticsOrderParam;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -45,16 +49,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -69,6 +69,7 @@ public class KwpSettlementWalletService {
|
|
|
private final KwpSettlementWalletMapper settlementWalletMapper;
|
|
private final KwpSettlementWalletMapper settlementWalletMapper;
|
|
|
private final KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
|
|
private final KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
|
|
|
private final KwpLedgerTradeOrderService tradeOrderService;
|
|
private final KwpLedgerTradeOrderService tradeOrderService;
|
|
|
|
|
+ private final KwpLedgerLogisticsOrderService kwpLedgerLogisticsOrderService;
|
|
|
private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
|
|
private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
|
|
|
private final WalletBusinessService walletBusinessService;
|
|
private final WalletBusinessService walletBusinessService;
|
|
|
@Resource
|
|
@Resource
|
|
@@ -167,7 +168,7 @@ public class KwpSettlementWalletService {
|
|
|
* <p>
|
|
* <p>
|
|
|
* Transactional// isolation:事务的隔离级别,此处使用后端数据库的默认隔离级别, propagation: 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中(常见)。(rollbackFor = Exception.class, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
|
|
* Transactional// isolation:事务的隔离级别,此处使用后端数据库的默认隔离级别, propagation: 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中(常见)。(rollbackFor = Exception.class, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
|
|
|
*/
|
|
*/
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, name = "default_tx_group")
|
|
|
public Integer confirmLogisticsPayment(OfflinePaymentReq offlinePaymentReq) {
|
|
public Integer confirmLogisticsPayment(OfflinePaymentReq offlinePaymentReq) {
|
|
|
Long id = offlinePaymentReq.getIdLong();
|
|
Long id = offlinePaymentReq.getIdLong();
|
|
|
BigDecimal price = offlinePaymentReq.getPrice();
|
|
BigDecimal price = offlinePaymentReq.getPrice();
|
|
@@ -281,10 +282,22 @@ public class KwpSettlementWalletService {
|
|
|
kwpLedgerLogistics.setId(settlementLogisticsDto.getLLedgerId());
|
|
kwpLedgerLogistics.setId(settlementLogisticsDto.getLLedgerId());
|
|
|
kwpLedgerLogistics.setActualPrice(settlementLogistics.getActualPrice());
|
|
kwpLedgerLogistics.setActualPrice(settlementLogistics.getActualPrice());
|
|
|
kwpLedgerLogisticsMapper.updateById(kwpLedgerLogistics);
|
|
kwpLedgerLogisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
-
|
|
|
|
|
|
|
+ //dubbo修改物流订单状态
|
|
|
|
|
+ List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = kwpLedgerLogisticsOrderService.queryList(settlementLogisticsDto.getLLedgerId());
|
|
|
|
|
+ for (KwpLedgerLogisticsOrder kwpLedgerLogisticsOrder : kwpLedgerLogisticsOrders) {
|
|
|
|
|
+ LogisticsOrderParam logisticsOrderParam = new LogisticsOrderParam();
|
|
|
|
|
+ logisticsOrderParam.setLOrderId(kwpLedgerLogisticsOrder.getLOrderId());
|
|
|
|
|
+ logisticsOrderParam.setStatus(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getStatus());
|
|
|
|
|
+ logisticsOrderParam.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ logisticsOrderParam.setUpdateTime(new Date());
|
|
|
|
|
+ HttpResult httpResult = transportDubboService.checkLogisticsOrderStatusById(logisticsOrderParam);
|
|
|
|
|
+ if (httpResult.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
|
|
+ log.error("更新物流订单状态异常:{}", JSONObject.toJSONString(logisticsOrderParam));
|
|
|
|
|
+ throw new BusinessException(httpResult.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// 调用电子钱包进行清分操作
|
|
// 调用电子钱包进行清分操作
|
|
|
walletBusinessService.splitMoney(orderNo, uid, filter, channelEnum, price, "2");
|
|
walletBusinessService.splitMoney(orderNo, uid, filter, channelEnum, price, "2");
|
|
|
-
|
|
|
|
|
//推送双方系统管理员
|
|
//推送双方系统管理员
|
|
|
messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
put("company", logisticsUnit.getFirmName());
|
|
put("company", logisticsUnit.getFirmName());
|
|
@@ -303,33 +316,33 @@ public class KwpSettlementWalletService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public PageRes<SettlementWalletVo> pageListTradePayment(SettlementWalletReq settlementWalletReq) {
|
|
|
|
|
-// //todo 查询缓存,获取客户企业id
|
|
|
|
|
-// String keywords = settlementReq.getKeywords();
|
|
|
|
|
-// if (StringUtils.isNotBlank(keywords)) {
|
|
|
|
|
-// System.out.println("关键之:" + keywords);
|
|
|
|
|
|
|
+// public PageRes<SettlementWalletVo> pageListTradePayment(SettlementWalletReq settlementWalletReq) {
|
|
|
|
|
+//// //todo 查询缓存,获取客户企业id
|
|
|
|
|
+//// String keywords = settlementReq.getKeywords();
|
|
|
|
|
+//// if (StringUtils.isNotBlank(keywords)) {
|
|
|
|
|
+//// System.out.println("关键之:" + keywords);
|
|
|
|
|
+//// }
|
|
|
|
|
+// PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
|
|
|
|
|
+//
|
|
|
|
|
+// List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
|
|
|
|
|
+// for (SettlementWalletDto entity : settlementWalletLogisticsList) {
|
|
|
|
|
+// entity.setCreateByText("创建人名称");
|
|
|
|
|
+// entity.setUpdateByText("更新人名称");
|
|
|
// }
|
|
// }
|
|
|
- PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
|
|
|
|
|
-
|
|
|
|
|
- List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
|
|
|
|
|
- for (SettlementWalletDto entity : settlementWalletLogisticsList) {
|
|
|
|
|
- entity.setCreateByText("创建人名称");
|
|
|
|
|
- entity.setUpdateByText("更新人名称");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
|
|
|
|
|
- return new PageRes<>(new PageInfo<>());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //指定返回值
|
|
|
|
|
- List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
|
|
|
|
|
- SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
|
|
|
|
|
- BeanUtils.copyProperties(a, settlementWalletVo);
|
|
|
|
|
- return settlementWalletVo;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- return new PageRes<>(new PageInfo<>(collect));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
|
|
|
|
|
+// return new PageRes<>(new PageInfo<>());
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //指定返回值
|
|
|
|
|
+// List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
|
|
|
|
|
+// SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
|
|
|
|
|
+// BeanUtils.copyProperties(a, settlementWalletVo);
|
|
|
|
|
+// return settlementWalletVo;
|
|
|
|
|
+// }).collect(Collectors.toList());
|
|
|
|
|
+//
|
|
|
|
|
+// return new PageRes<>(new PageInfo<>(collect));
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -511,47 +524,47 @@ public class KwpSettlementWalletService {
|
|
|
return PageRes.build(pageInfo, collect);
|
|
return PageRes.build(pageInfo, collect);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public PageRes<SettlementWalletVo> pageListTradeCollection(SettlementWalletReq settlementWalletReq) {
|
|
|
|
|
- PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
|
|
|
|
|
-
|
|
|
|
|
- List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
|
|
|
|
|
- for (SettlementWalletDto entity : settlementWalletLogisticsList) {
|
|
|
|
|
- entity.setCreateByText("创建人名称");
|
|
|
|
|
- entity.setUpdateByText("更新人名称");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
|
|
|
|
|
- return new PageRes<>(new PageInfo<>());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Map<Long, UserCacheResDto> map = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
- //指定返回值
|
|
|
|
|
- List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
|
|
|
|
|
- SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
|
|
|
|
|
- BeanUtils.copyProperties(a, settlementWalletVo);
|
|
|
|
|
- Long createBy = a.getCreateBy();
|
|
|
|
|
- Long updateBy = a.getUpdateBy();
|
|
|
|
|
- UserCacheResDto userCacheResDto = map.get(createBy);
|
|
|
|
|
- if (Objects.isNull(userCacheResDto)) {
|
|
|
|
|
- userCacheResDto = remoteSystemService.queryUserCacheById(createBy);
|
|
|
|
|
- map.put(createBy, userCacheResDto);
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(userCacheResDto)) {
|
|
|
|
|
- settlementWalletVo.setCreateByText(userCacheResDto.getName());
|
|
|
|
|
- }
|
|
|
|
|
- userCacheResDto = map.get(updateBy);
|
|
|
|
|
- if (Objects.isNull(userCacheResDto)) {
|
|
|
|
|
- userCacheResDto = remoteSystemService.queryUserCacheById(updateBy);
|
|
|
|
|
- map.put(updateBy, userCacheResDto);
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(userCacheResDto)) {
|
|
|
|
|
- settlementWalletVo.setUpdateByText(userCacheResDto.getName());
|
|
|
|
|
- }
|
|
|
|
|
- return settlementWalletVo;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- return new PageRes<>(new PageInfo<>(collect));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// public PageRes<SettlementWalletVo> pageListTradeCollection(SettlementWalletReq settlementWalletReq) {
|
|
|
|
|
+// PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
|
|
|
|
|
+//
|
|
|
|
|
+// List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
|
|
|
|
|
+// for (SettlementWalletDto entity : settlementWalletLogisticsList) {
|
|
|
|
|
+// entity.setCreateByText("创建人名称");
|
|
|
|
|
+// entity.setUpdateByText("更新人名称");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
|
|
|
|
|
+// return new PageRes<>(new PageInfo<>());
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// Map<Long, UserCacheResDto> map = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
+// //指定返回值
|
|
|
|
|
+// List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
|
|
|
|
|
+// SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
|
|
|
|
|
+// BeanUtils.copyProperties(a, settlementWalletVo);
|
|
|
|
|
+// Long createBy = a.getCreateBy();
|
|
|
|
|
+// Long updateBy = a.getUpdateBy();
|
|
|
|
|
+// UserCacheResDto userCacheResDto = map.get(createBy);
|
|
|
|
|
+// if (Objects.isNull(userCacheResDto)) {
|
|
|
|
|
+// userCacheResDto = remoteSystemService.queryUserCacheById(createBy);
|
|
|
|
|
+// map.put(createBy, userCacheResDto);
|
|
|
|
|
+// }
|
|
|
|
|
+// if (Objects.nonNull(userCacheResDto)) {
|
|
|
|
|
+// settlementWalletVo.setCreateByText(userCacheResDto.getName());
|
|
|
|
|
+// }
|
|
|
|
|
+// userCacheResDto = map.get(updateBy);
|
|
|
|
|
+// if (Objects.isNull(userCacheResDto)) {
|
|
|
|
|
+// userCacheResDto = remoteSystemService.queryUserCacheById(updateBy);
|
|
|
|
|
+// map.put(updateBy, userCacheResDto);
|
|
|
|
|
+// }
|
|
|
|
|
+// if (Objects.nonNull(userCacheResDto)) {
|
|
|
|
|
+// settlementWalletVo.setUpdateByText(userCacheResDto.getName());
|
|
|
|
|
+// }
|
|
|
|
|
+// return settlementWalletVo;
|
|
|
|
|
+// }).collect(Collectors.toList());
|
|
|
|
|
+//
|
|
|
|
|
+// return new PageRes<>(new PageInfo<>(collect));
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 销售-预付款
|
|
* 销售-预付款
|
|
@@ -637,7 +650,6 @@ public class KwpSettlementWalletService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return "请勿重复提交!";
|
|
return "请勿重复提交!";
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -647,19 +659,6 @@ public class KwpSettlementWalletService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public WalletDto getConfirmLogisticsPayment(Long id) {
|
|
public WalletDto getConfirmLogisticsPayment(Long id) {
|
|
|
-// WalletDto walletDto = new WalletDto();
|
|
|
|
|
-// walletDto.setName("测试钱宝");
|
|
|
|
|
-// walletDto.setMemberName("");
|
|
|
|
|
-// walletDto.setUid("kll_0001");
|
|
|
|
|
-// walletDto.setChannel("1");
|
|
|
|
|
-// walletDto.setCreateTime(LocalDateTime.now());
|
|
|
|
|
-// walletDto.setFilter("kll_0002");
|
|
|
|
|
-// walletDto.setFreeze(0L);
|
|
|
|
|
-// walletDto.setApMoney(0L);
|
|
|
|
|
-// walletDto.setTotalMoney(12000L);
|
|
|
|
|
-// walletDto.setMoney(1L);
|
|
|
|
|
-//
|
|
|
|
|
-// return walletDto;
|
|
|
|
|
SettlementLogisticsDto byId = kwpSettlementLogisticsService.detail(id, LogisticsUnitType.CARRIER, LogisticsUnitType.SHIPPER);
|
|
SettlementLogisticsDto byId = kwpSettlementLogisticsService.detail(id, LogisticsUnitType.CARRIER, LogisticsUnitType.SHIPPER);
|
|
|
if (Objects.isNull(byId)) {
|
|
if (Objects.isNull(byId)) {
|
|
|
throw new BusinessException("结算单不存在");
|
|
throw new BusinessException("结算单不存在");
|
|
@@ -682,57 +681,27 @@ public class KwpSettlementWalletService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public WalletDto getConfirmTradePayment(Long id) {
|
|
public WalletDto getConfirmTradePayment(Long id) {
|
|
|
- //todo
|
|
|
|
|
- WalletDto walletDto = new WalletDto();
|
|
|
|
|
- walletDto.setName("测试钱宝");
|
|
|
|
|
- walletDto.setMemberName("");
|
|
|
|
|
- walletDto.setUid("kll_0001");
|
|
|
|
|
- walletDto.setChannel("1");
|
|
|
|
|
- walletDto.setCreateTime(LocalDateTime.now());
|
|
|
|
|
- walletDto.setFilter("kll_0002");
|
|
|
|
|
- walletDto.setFreeze(0L);
|
|
|
|
|
- walletDto.setApMoney(0L);
|
|
|
|
|
- walletDto.setTotalMoney(12000L);
|
|
|
|
|
- walletDto.setMoney(1L);
|
|
|
|
|
-
|
|
|
|
|
- return walletDto;
|
|
|
|
|
-// SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
|
|
|
|
|
-// if (Objects.isNull(byId)) {
|
|
|
|
|
-// throw new BusinessException("结算单不存在");
|
|
|
|
|
-// }
|
|
|
|
|
-// if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
|
|
|
|
|
-// throw new BusinessException("只支持货货到付款方式订单进行当前操作");
|
|
|
|
|
-// }
|
|
|
|
|
-// List<LedgerUnitDto> listById = kwpSettlementTradeService.getListById(id);
|
|
|
|
|
-// if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
|
|
-// throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
|
|
-// }
|
|
|
|
|
-// Long uid = null;
|
|
|
|
|
-// Long filter = null;
|
|
|
|
|
-// for (LedgerUnitDto ledgerUnitDto : listById) {
|
|
|
|
|
-// Integer unitType = ledgerUnitDto.getUnitType();
|
|
|
|
|
-// if (TradeUnitType.PURCHASE.equals(unitType)) {
|
|
|
|
|
-// uid = ledgerUnitDto.getTopEntId();
|
|
|
|
|
-// continue;
|
|
|
|
|
-// }
|
|
|
|
|
-// if (TradeUnitType.SELL.equals(unitType)) {
|
|
|
|
|
-// filter = ledgerUnitDto.getTopEntId();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// String relation = walletRelationService.getRelation(uid);
|
|
|
|
|
-// String filterUser = walletRelationService.getRelation(filter);
|
|
|
|
|
-// if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
|
|
|
-// throw new BusinessException("顶级企业未开通电子钱包");
|
|
|
|
|
-// }
|
|
|
|
|
-// R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(byId.getTrading()), filterUser);
|
|
|
|
|
-// if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
|
|
|
-// throw new BusinessException("暂未开通电子钱包");
|
|
|
|
|
-// }
|
|
|
|
|
-// List<WalletDto> data = wallet.getData();
|
|
|
|
|
-// return data.get(NumberConstant.ZERO);
|
|
|
|
|
-// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
|
|
|
|
+ SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
|
|
|
|
|
+ if (Objects.isNull(byId)) {
|
|
|
|
|
+ throw new BusinessException("结算单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
|
|
|
|
|
+ throw new BusinessException("只支持货到付款方式订单进行当前操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<LedgerUnitDto> listById = kwpSettlementTradeService.getListById(id);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
|
|
+ throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
|
|
+ }
|
|
|
|
|
+ return getWalletBalance(listById, byId.getTrading());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询交易双方的电子钱包
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param listById 双发企业
|
|
|
|
|
+ * @param trading 交易方式
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
private WalletDto getWalletBalance(List<LedgerUnitDto> listById, String trading) {
|
|
private WalletDto getWalletBalance(List<LedgerUnitDto> listById, String trading) {
|
|
|
Long uid = null;
|
|
Long uid = null;
|
|
|
Long filter = null;
|
|
Long filter = null;
|
|
@@ -751,13 +720,12 @@ public class KwpSettlementWalletService {
|
|
|
if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
|
throw new BusinessException("顶级企业未开通电子钱包");
|
|
throw new BusinessException("顶级企业未开通电子钱包");
|
|
|
}
|
|
}
|
|
|
- R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(trading), filterUser);
|
|
|
|
|
|
|
+ R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByTrading(trading), filterUser);
|
|
|
if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
|
- throw new BusinessException("暂未开通电子钱包");
|
|
|
|
|
|
|
+ throw new BusinessException("交易双方暂未开通电子钱包");
|
|
|
}
|
|
}
|
|
|
List<WalletDto> data = wallet.getData();
|
|
List<WalletDto> data = wallet.getData();
|
|
|
- return data.get(0);
|
|
|
|
|
-// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
|
|
|
|
+ return data.get(NumberConstant.ZERO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|