|
@@ -45,16 +45,19 @@ import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.*;
|
|
import com.sckw.system.api.model.dto.res.*;
|
|
|
|
|
+import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.Valid;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import javax.xml.crypto.dsig.TransformService;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
@@ -104,6 +107,8 @@ public class KwcContractTradeService {
|
|
|
|
|
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private TradeOrderInfoService tradeOrderInfoService;
|
|
private TradeOrderInfoService tradeOrderInfoService;
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
+ private TransportRemoteService transportRemoteService;
|
|
|
|
|
|
|
|
/**销售合同*/
|
|
/**销售合同*/
|
|
|
@Value(value = "${jumpUrl.saleSendContract}")
|
|
@Value(value = "${jumpUrl.saleSendContract}")
|
|
@@ -176,7 +181,17 @@ public class KwcContractTradeService {
|
|
|
return PageHelperUtil.getPageResult(new PageInfo<>());
|
|
return PageHelperUtil.getPageResult(new PageInfo<>());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- List<QueryListResVo> list = getQueryListResVos(queryListResDtos);
|
|
|
|
|
|
|
+ //获取贸易合同id
|
|
|
|
|
+ Set<Long> tradeContractIds =
|
|
|
|
|
+ queryListResDtos.stream().map(QueryListResDto::getId).collect(Collectors.toSet());
|
|
|
|
|
+ //查询贸易合同关联商品
|
|
|
|
|
+ List<KwcContractTradeGoods> tradeContractGoods = kwcContractTradeGoodsRepository.queryByContractIds(tradeContractIds);
|
|
|
|
|
+ Map<Long, List<KwcContractTradeGoods>> contractIdGoodsIdKeyAndGoodsMap = Maps.newHashMap();
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tradeContractGoods)){
|
|
|
|
|
+ contractIdGoodsIdKeyAndGoodsMap =
|
|
|
|
|
+ tradeContractGoods.stream().collect(Collectors.groupingBy(KwcContractTradeGoods::getContractId));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<QueryListResVo> list = getQueryListResVos(queryListResDtos, contractIdGoodsIdKeyAndGoodsMap);
|
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
|
|
return PageHelperUtil.getPageResult(new PageInfo<>(list), queryListResDtos, reqVo.getPageSize());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -188,7 +203,7 @@ public class KwcContractTradeService {
|
|
|
* @author: czh
|
|
* @author: czh
|
|
|
* @date: 2023/7/18
|
|
* @date: 2023/7/18
|
|
|
*/
|
|
*/
|
|
|
- private List<QueryListResVo> getQueryListResVos(List<QueryListResDto> queryListResDtos) {
|
|
|
|
|
|
|
+ private List<QueryListResVo> getQueryListResVos(List<QueryListResDto> queryListResDtos,Map<Long, List<KwcContractTradeGoods>> contractIdGoodsIdKeyAndGoodsMap ) {
|
|
|
Map<Long, UserCacheResDto> longUserCacheResDtoMap = new HashMap<>(8);
|
|
Map<Long, UserCacheResDto> longUserCacheResDtoMap = new HashMap<>(8);
|
|
|
List<Long> initiateByList = queryListResDtos.stream().map(QueryListResDto::getInitiateBy).toList();
|
|
List<Long> initiateByList = queryListResDtos.stream().map(QueryListResDto::getInitiateBy).toList();
|
|
|
if (CollectionUtils.isNotEmpty(initiateByList)) {
|
|
if (CollectionUtils.isNotEmpty(initiateByList)) {
|
|
@@ -225,7 +240,18 @@ public class KwcContractTradeService {
|
|
|
String.valueOf(queryListResDto.getUnloadWay())));
|
|
String.valueOf(queryListResDto.getUnloadWay())));
|
|
|
queryListResVo.setAmount(queryListResDto.getAmount());
|
|
queryListResVo.setAmount(queryListResDto.getAmount());
|
|
|
queryListResVo.setPerformedAmount(queryListResDto.getPerformedAmount());
|
|
queryListResVo.setPerformedAmount(queryListResDto.getPerformedAmount());
|
|
|
-
|
|
|
|
|
|
|
+ BigDecimal performedAmountMoney = BigDecimal.ZERO;
|
|
|
|
|
+ if(MapUtils.isNotEmpty(contractIdGoodsIdKeyAndGoodsMap)) {
|
|
|
|
|
+ List<KwcContractTradeGoods> contractTradeGoods = contractIdGoodsIdKeyAndGoodsMap.get(queryListResDto.getId());
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(contractTradeGoods)){
|
|
|
|
|
+ for (KwcContractTradeGoods goods : contractTradeGoods) {
|
|
|
|
|
+ BigDecimal performedAmount = goods.getPerformedAmount() != null ? goods.getPerformedAmount() : BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal price = goods.getPrice() != null ? goods.getPrice() : BigDecimal.ZERO;
|
|
|
|
|
+ performedAmountMoney = performedAmountMoney.add(performedAmount.multiply(price));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ queryListResVo.setPerformedAmountMoney( performedAmountMoney);
|
|
|
if(Objects.nonNull(queryListResVo.getEndTime())) {
|
|
if(Objects.nonNull(queryListResVo.getEndTime())) {
|
|
|
queryListResVo.setEndTime(DateUtils.getStartOfDay(queryListResVo.getEndTime()));
|
|
queryListResVo.setEndTime(DateUtils.getStartOfDay(queryListResVo.getEndTime()));
|
|
|
}
|
|
}
|
|
@@ -860,7 +886,7 @@ public class KwcContractTradeService {
|
|
|
throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
|
|
throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- List<QueryListResVo> list = getQueryListResVos(queryListResDtos);
|
|
|
|
|
|
|
+ List<QueryListResVo> list = getQueryListResVos(queryListResDtos,null);
|
|
|
List<TradeListExport> dataList = BeanUtils.copyToList(list, TradeListExport.class);
|
|
List<TradeListExport> dataList = BeanUtils.copyToList(list, TradeListExport.class);
|
|
|
ExcelUtil.downData(response, TradeListExport.class, dataList);
|
|
ExcelUtil.downData(response, TradeListExport.class, dataList);
|
|
|
}
|
|
}
|
|
@@ -881,7 +907,7 @@ public class KwcContractTradeService {
|
|
|
if (CollectionUtils.isEmpty(queryListResDtos)) {
|
|
if (CollectionUtils.isEmpty(queryListResDtos)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
- return getQueryListResVos(queryListResDtos);
|
|
|
|
|
|
|
+ return getQueryListResVos(queryListResDtos,null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|