|
@@ -236,6 +236,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
/**
|
|
|
* 利润预算
|
|
|
+ *
|
|
|
* @param dto
|
|
|
* @return
|
|
|
*/
|
|
@@ -244,18 +245,18 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
IWrapper<Contract> wrapper = getWrapper();
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
|
|
|
- if(StringUtils.isNotEmpty(dto.getCustomerId())){
|
|
|
- wrapper.eq("t1",Contract::getBuyCorporationId,dto.getCustomerId());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
+ wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(dto.getUserId())){
|
|
|
- wrapper.eq("t1",Contract::getCreateUser,dto.getUserId());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getUserId())) {
|
|
|
+ wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(dto.getKeyword())){
|
|
|
- wrapper.keyword(dto.getKeyword(),new SqlField("t1.code"));
|
|
|
+ if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
+ wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
|
|
|
}
|
|
|
Page<ContractBudgetVo> page = this.baseMapper.getProfitBudgetPage(dto.getPage(), wrapper);
|
|
|
List<ContractBudgetVo> list = page.getRecords();
|
|
|
- if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
// 赋值客户名称
|
|
|
customerService.attributeAssign(list, Contract::getBuyCorporationId, (item, customer) -> {
|
|
|
item.setCustomerName(customer.getName());
|
|
@@ -264,65 +265,65 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
List<Long> contractIds = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
|
|
|
List<EhsdPurchaseProductVo> ehsdAmountList = ehsdPurchaseProductService.getGroupSumAmount(contractIds);
|
|
|
//取出采购所有金额和货币-通过合同ID分组
|
|
|
- Map<Long,String> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.toMap(EhsdPurchaseProductVo::getContractId,EhsdPurchaseProductVo::getCurrencyAmount));
|
|
|
+ Map<Long, String> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.toMap(EhsdPurchaseProductVo::getContractId, EhsdPurchaseProductVo::getCurrencyAmount));
|
|
|
List<PurchaseDetailVo> otherAmountList = purchaseDetailService.getSumCountInDataResourceIds(contractIds);
|
|
|
- Map<Long,String> otherAmountMap = otherAmountList.stream().collect(Collectors.toMap(PurchaseDetailVo::getDataResourceId,PurchaseDetailVo::getSumAmountCurrency));
|
|
|
+ Map<Long, String> otherAmountMap = otherAmountList.stream().collect(Collectors.toMap(PurchaseDetailVo::getDataResourceId, PurchaseDetailVo::getSumAmountCurrency));
|
|
|
//取出默认汇率
|
|
|
List<CurrencyRate> currencyRateList = currencyRateService.getList();
|
|
|
- Map<String,BigDecimal> currencyRateMap = currencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
|
|
|
- for(ContractBudgetVo v : list){
|
|
|
- if(StringUtils.isNotEmpty(v.getCurrencyRateJson())){//如果此条合同有汇率了
|
|
|
+ Map<String, BigDecimal> currencyRateMap = currencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
|
|
|
+ for (ContractBudgetVo v : list) {
|
|
|
+ if (StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
|
|
|
List<ContractCurrencyRate> contractCurrencyRates = JSON.parseArray(v.getCurrencyRateJson(), ContractCurrencyRate.class);
|
|
|
- Map<String,BigDecimal> map = contractCurrencyRates.stream().collect(Collectors.toMap(ContractCurrencyRate::getType,ContractCurrencyRate::getRate));
|
|
|
+ Map<String, BigDecimal> map = contractCurrencyRates.stream().collect(Collectors.toMap(ContractCurrencyRate::getType, ContractCurrencyRate::getRate));
|
|
|
v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
|
|
|
- if(MapUtils.isNotEmpty(ehsdAmountMap)){ //计算EHSD租户应付货款
|
|
|
- String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(),null);
|
|
|
- if(StringUtils.isNotEmpty(concatAmountCurrency)){
|
|
|
+ if (MapUtils.isNotEmpty(ehsdAmountMap)) { //计算EHSD租户应付货款
|
|
|
+ String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(), null);
|
|
|
+ if (StringUtils.isNotEmpty(concatAmountCurrency)) {
|
|
|
BigDecimal amount = new BigDecimal(concatAmountCurrency.split("-")[0]);
|
|
|
String currency = concatAmountCurrency.split("-")[1];
|
|
|
- BigDecimal rate = map.getOrDefault(currency,BigDecimal.ONE);
|
|
|
+ BigDecimal rate = map.getOrDefault(currency, BigDecimal.ONE);
|
|
|
v.setEhsdSumAmount(amount.multiply(rate));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
v.setEhsdSumAmount(BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
//计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
|
|
|
v.setIncomeAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())).add(v.getRefundableAmount()));
|
|
|
//计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
|
|
|
- v.setExpenditureAmount(v.getTrailerFee()==null?BigDecimal.ZERO:v.getTrailerFee().multiply(new BigDecimal(map.getOrDefault(v.getTrailerFeeCurrency(),BigDecimal.ONE).toString())).add
|
|
|
- (v.getCustomsFee()==null?BigDecimal.ZERO:v.getCustomsFee().multiply(new BigDecimal(map.getOrDefault(v.getCustomsFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getAgencyFee()==null?BigDecimal.ZERO:v.getAgencyFee().multiply(new BigDecimal(map.getOrDefault(v.getAgencyFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getPortMixedFee()==null?BigDecimal.ZERO:v.getPortMixedFee().multiply(new BigDecimal(map.getOrDefault(v.getPortMixedFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getInspectionRedPack()==null?BigDecimal.ZERO:v.getInspectionRedPack().multiply(new BigDecimal(map.getOrDefault(v.getInspectionRedPackCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getCommission()==null?BigDecimal.ZERO:v.getCommission().multiply(new BigDecimal(map.getOrDefault(v.getCommissionCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getOther()==null?BigDecimal.ZERO:v.getOther().multiply(new BigDecimal(map.getOrDefault(v.getOtherCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getEhsdSumAmount()==null?BigDecimal.ZERO:v.getEhsdSumAmount()).add
|
|
|
- (v.getOtherSumAmount()==null?BigDecimal.ZERO:v.getOtherSumAmount()));
|
|
|
- }else{//没有汇率取默认汇率
|
|
|
+ v.setExpenditureAmount(v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().multiply(new BigDecimal(map.getOrDefault(v.getTrailerFeeCurrency(), BigDecimal.ONE).toString())).add
|
|
|
+ (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(new BigDecimal(map.getOrDefault(v.getCustomsFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(new BigDecimal(map.getOrDefault(v.getAgencyFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(new BigDecimal(map.getOrDefault(v.getPortMixedFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(new BigDecimal(map.getOrDefault(v.getInspectionRedPackCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(new BigDecimal(map.getOrDefault(v.getCommissionCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(new BigDecimal(map.getOrDefault(v.getOtherCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
|
|
|
+ (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
|
|
|
+ } else {//没有汇率取默认汇率
|
|
|
v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
|
|
|
- if(MapUtils.isNotEmpty(ehsdAmountMap)){ //计算EHSD租户应付货款
|
|
|
- String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(),null);
|
|
|
- if(StringUtils.isNotEmpty(concatAmountCurrency)){
|
|
|
+ if (MapUtils.isNotEmpty(ehsdAmountMap)) { //计算EHSD租户应付货款
|
|
|
+ String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(), null);
|
|
|
+ if (StringUtils.isNotEmpty(concatAmountCurrency)) {
|
|
|
BigDecimal amount = new BigDecimal(concatAmountCurrency.split("-")[0]);
|
|
|
String currency = concatAmountCurrency.split("-")[1];
|
|
|
- BigDecimal rate = currencyRateMap.getOrDefault(currency,BigDecimal.ONE);
|
|
|
+ BigDecimal rate = currencyRateMap.getOrDefault(currency, BigDecimal.ONE);
|
|
|
v.setEhsdSumAmount(amount.multiply(rate));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
v.setEhsdSumAmount(BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
//计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
|
|
|
- v.setIncomeAmount(v.getAmount().multiply(currencyRateMap.getOrDefault(v.getContractId(),new BigDecimal("1"))).add(v.getRefundableAmount()));
|
|
|
+ v.setIncomeAmount(v.getAmount().multiply(currencyRateMap.getOrDefault(v.getContractId(), new BigDecimal("1"))).add(v.getRefundableAmount()));
|
|
|
//计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
|
|
|
- v.setExpenditureAmount(v.getTrailerFee()==null?BigDecimal.ZERO:v.getTrailerFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getTrailerFeeCurrency(),BigDecimal.ONE).toString())).add
|
|
|
- (v.getCustomsFee()==null?BigDecimal.ZERO:v.getCustomsFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCustomsFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getAgencyFee()==null?BigDecimal.ZERO:v.getAgencyFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getAgencyFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getPortMixedFee()==null?BigDecimal.ZERO:v.getPortMixedFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getPortMixedFeeCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getInspectionRedPack()==null?BigDecimal.ZERO:v.getInspectionRedPack().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getInspectionRedPackCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getCommission()==null?BigDecimal.ZERO:v.getCommission().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCommissionCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getOther()==null?BigDecimal.ZERO:v.getOther().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getOtherCurrency(),BigDecimal.ONE).toString()))).add
|
|
|
- (v.getEhsdSumAmount()==null?BigDecimal.ZERO:v.getEhsdSumAmount()).add
|
|
|
- (v.getOtherSumAmount()==null?BigDecimal.ZERO:v.getOtherSumAmount()));
|
|
|
+ v.setExpenditureAmount(v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getTrailerFeeCurrency(), BigDecimal.ONE).toString())).add
|
|
|
+ (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCustomsFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getAgencyFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getPortMixedFeeCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getInspectionRedPackCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCommissionCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getOtherCurrency(), BigDecimal.ONE).toString()))).add
|
|
|
+ (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
|
|
|
+ (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
|
|
|
}
|
|
|
//计算毛利 收入-支出
|
|
|
v.setGross(v.getIncomeAmount().subtract(v.getExpenditureAmount()));
|
|
@@ -335,6 +336,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
/**
|
|
|
* 利润结算表分页
|
|
|
+ *
|
|
|
* @param dto
|
|
|
* @return
|
|
|
*/
|
|
@@ -343,21 +345,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
IWrapper<Contract> wrapper = getWrapper();
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
|
|
|
- if(StringUtils.isNotEmpty(dto.getCustomerId())){
|
|
|
- wrapper.eq("t1",Contract::getBuyCorporationId,dto.getCustomerId());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
+ wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(dto.getUserId())){
|
|
|
- wrapper.eq("t1",Contract::getCreateUser,dto.getUserId());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getUserId())) {
|
|
|
+ wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(dto.getKeyword())){
|
|
|
- wrapper.keyword(dto.getKeyword(),new SqlField("t1.code"));
|
|
|
+ if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
+ wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
|
|
|
}
|
|
|
Page<ContractBudgetVo> page = this.baseMapper.getProfitClearingPage(dto.getPage(), wrapper);
|
|
|
List<ContractBudgetVo> list = page.getRecords();
|
|
|
//取出默认汇率
|
|
|
List<CurrencyRate> defaultCurrencyRateList = currencyRateService.getList();
|
|
|
- Map<String,BigDecimal> defaultCurrencyRateMap = defaultCurrencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
|
|
|
- for(ContractBudgetVo v : list){
|
|
|
+ Map<String, BigDecimal> defaultCurrencyRateMap = defaultCurrencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
|
|
|
+ for (ContractBudgetVo v : list) {
|
|
|
v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
|
|
|
v.setOtherIncomeAmount(BigDecimal.ZERO);//暂时先设置其他收入为0
|
|
|
v.setAccountPaid(BigDecimal.ZERO);//暂时先设置已付货款为0
|
|
@@ -365,28 +367,28 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
customerService.attributeAssign(list, Contract::getBuyCorporationId, (item, customer) -> {
|
|
|
item.setCustomerName(customer.getName());
|
|
|
});
|
|
|
- if(StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
|
|
|
+ if (StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
|
|
|
//取出汇率
|
|
|
List<CurrencyRate> assignCurrencyRatesList = JSON.parseArray(v.getCurrencyRateJson(), CurrencyRate.class);
|
|
|
- Map<String,BigDecimal> assignCurrencyRatesMap = assignCurrencyRatesList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
|
|
|
- v.setRmbContractAmount(v.getAmount().multiply(assignCurrencyRatesMap.getOrDefault(v.getCurrency(),BigDecimal.ONE)));//计算汇算人民币
|
|
|
+ Map<String, BigDecimal> assignCurrencyRatesMap = assignCurrencyRatesList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
|
|
|
+ v.setRmbContractAmount(v.getAmount().multiply(assignCurrencyRatesMap.getOrDefault(v.getCurrency(), BigDecimal.ONE)));//计算汇算人民币
|
|
|
//到账金额
|
|
|
- v.setSumClaimMoney(this.getSumClaimMoney(v,assignCurrencyRatesMap));
|
|
|
+ v.setSumClaimMoney(this.getSumClaimMoney(v, assignCurrencyRatesMap));
|
|
|
//采购合同总金额
|
|
|
- v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v,assignCurrencyRatesMap));
|
|
|
+ v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, assignCurrencyRatesMap));
|
|
|
//支出费用
|
|
|
- this.getGroupTypeMoney(v,assignCurrencyRatesMap);
|
|
|
- }else{//没有取默认的汇率
|
|
|
- v.setRmbContractAmount(v.getAmount().multiply(defaultCurrencyRateMap.getOrDefault(v.getCurrency(),BigDecimal.ONE)));//计算汇算人民币
|
|
|
+ this.getGroupTypeMoney(v, assignCurrencyRatesMap);
|
|
|
+ } else {//没有取默认的汇率
|
|
|
+ v.setRmbContractAmount(v.getAmount().multiply(defaultCurrencyRateMap.getOrDefault(v.getCurrency(), BigDecimal.ONE)));//计算汇算人民币
|
|
|
//到账金额
|
|
|
- v.setSumClaimMoney(this.getSumClaimMoney(v,defaultCurrencyRateMap));
|
|
|
+ v.setSumClaimMoney(this.getSumClaimMoney(v, defaultCurrencyRateMap));
|
|
|
//采购合同总金额
|
|
|
- v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v,defaultCurrencyRateMap));
|
|
|
+ v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, defaultCurrencyRateMap));
|
|
|
//支出费用
|
|
|
- this.getGroupTypeMoney(v,defaultCurrencyRateMap);
|
|
|
+ this.getGroupTypeMoney(v, defaultCurrencyRateMap);
|
|
|
}
|
|
|
//计算收入总计=合同金额(转人民币)+应退税金额(转人民币)+其他收入(转人民币)
|
|
|
- v.setIncomeAmount(v.getRmbContractAmount()==null?BigDecimal.ZERO:v.getRmbContractAmount().add(v.getRefundableAmount()).add(v.getOtherIncomeAmount()));
|
|
|
+ v.setIncomeAmount(v.getRmbContractAmount() == null ? BigDecimal.ZERO : v.getRmbContractAmount().add(v.getRefundableAmount()).add(v.getOtherIncomeAmount()));
|
|
|
//计算支出总计 除合同金额(转人民币)+应退税金额(转人民币)+其他收入(转人民币) 其他金额相加
|
|
|
v.setExpenditureAmount(v.getTrailerFee().add
|
|
|
(v.getCustomsFee()).add
|
|
@@ -691,8 +693,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
*/
|
|
|
@Override
|
|
|
public void contractHandover(ContractDto dto) {
|
|
|
- ObsFileUtil.editFile(dto.getFileList(),dto.getId(),1);
|
|
|
- ObsFileUtil.editFile(dto.getPackageFileList(),dto.getId(),2);
|
|
|
+ ObsFileUtil.editFile(dto.getFileList(), dto.getId(), 1);
|
|
|
+ ObsFileUtil.editFile(dto.getPackageFileList(), dto.getId(), 2);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -705,15 +707,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
QueryWrapper<Contract> query = Wrappers.query();
|
|
|
query.select("count(*) count,ifnull(sum(amount),0) amount,sell_corporation_id sellCorporationId");
|
|
|
query.groupBy("sell_corporation_id");
|
|
|
- query.eq("status",30);
|
|
|
+ query.eq("status", 30);
|
|
|
List<Contract> contractList = baseMapper.selectList(query);
|
|
|
|
|
|
//计算合计数量
|
|
|
Integer countAmount = contractList.stream().map(Contract::getCount).reduce(Integer::sum).orElse(0);
|
|
|
//计算合计金额
|
|
|
BigDecimal amount = contractList.stream().map(Contract::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- map.put("countAmount",countAmount);
|
|
|
- map.put("amount",amount);
|
|
|
+ map.put("countAmount", countAmount);
|
|
|
+ map.put("amount", amount);
|
|
|
|
|
|
//赋值归属公司名称
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
@@ -1261,49 +1263,52 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
/**
|
|
|
* 统计到账认领总金额
|
|
|
+ *
|
|
|
* @param v
|
|
|
* @param currencyRatesMap 汇率JSON
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal getSumClaimMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
|
|
|
- List<ClaimContract> claimContractList = claimContractService.list(Wrappers.<ClaimContract>query().lambda().eq(ClaimContract::getContractId,v.getContractId()));
|
|
|
+ private BigDecimal getSumClaimMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
|
|
|
+ List<ClaimContract> claimContractList = claimContractService.list(Wrappers.<ClaimContract>query().lambda().eq(ClaimContract::getContractId, v.getContractId()));
|
|
|
BigDecimal sumClaimMOney = BigDecimal.ZERO;
|
|
|
- if(CollectionUtils.isNotEmpty(claimContractList)){
|
|
|
- for(ClaimContract c:claimContractList){
|
|
|
- sumClaimMOney = sumClaimMOney.add(c.getMoney().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ if (CollectionUtils.isNotEmpty(claimContractList)) {
|
|
|
+ for (ClaimContract c : claimContractList) {
|
|
|
+ sumClaimMOney = sumClaimMOney.add(c.getMoney().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
}
|
|
|
return sumClaimMOney;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return BigDecimal.ZERO;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统采购合同总金额
|
|
|
+ *
|
|
|
* @param v
|
|
|
* @param currencyRatesMap 汇率JSON
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
|
|
|
+ private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
|
|
|
List<EhsdPurchaseProductVo> list = ehsdPurchaseProductService.getListByContractId(v.getContractId());
|
|
|
BigDecimal sumPurchaseContractMoney = BigDecimal.ZERO;
|
|
|
- if(CollectionUtils.isNotEmpty(list)){
|
|
|
- for(EhsdPurchaseProductVo c:list){
|
|
|
- sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (EhsdPurchaseProductVo c : list) {
|
|
|
+ sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
}
|
|
|
return sumPurchaseContractMoney;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return BigDecimal.ZERO;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统计支出各种费用
|
|
|
+ *
|
|
|
* @param v
|
|
|
* @param currencyRatesMap 汇率JSON
|
|
|
* @return
|
|
|
*/
|
|
|
- private void getGroupTypeMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
|
|
|
+ private void getGroupTypeMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
|
|
|
List<AccountRequestFundsDetailVo> list = accountRequestFundsDetailService.getListByContractId(v.getContractId());
|
|
|
/**
|
|
|
* 拖车费
|
|
@@ -1353,40 +1358,40 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
/**
|
|
|
* 其他费用
|
|
|
*/
|
|
|
- BigDecimal other = BigDecimal.ZERO;
|
|
|
+ BigDecimal other = BigDecimal.ZERO;
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(list)){
|
|
|
- for(AccountRequestFundsDetailVo c:list){
|
|
|
- switch (c.getCostType()){
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (AccountRequestFundsDetailVo c : list) {
|
|
|
+ switch (c.getCostType()) {
|
|
|
case "1"://拖车费
|
|
|
- trailerFee = trailerFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ trailerFee = trailerFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "2"://报关费
|
|
|
- customsFee = customsFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ customsFee = customsFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "3"://港杂费
|
|
|
- portMixedFee = portMixedFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ portMixedFee = portMixedFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "4"://验收红包
|
|
|
- inspectionRedPack = inspectionRedPack.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ inspectionRedPack = inspectionRedPack.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "5"://佣金
|
|
|
- commission = commission.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ commission = commission.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "6"://检测费
|
|
|
- checkout = checkout.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ checkout = checkout.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "7"://验货费
|
|
|
- inspectionCharge = inspectionCharge.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ inspectionCharge = inspectionCharge.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "8"://运费
|
|
|
- freight = freight.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ freight = freight.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
case "9"://产地证费
|
|
|
- certificateOfOrigin = certificateOfOrigin.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ certificateOfOrigin = certificateOfOrigin.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
default:
|
|
|
- other = other.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
|
|
|
+ other = other.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1402,4 +1407,20 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
v.setCertificateOfOrigin(certificateOfOrigin);
|
|
|
v.setOther(other);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取合同历史联系方式
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Contract> contactList(ContractDto dto) {
|
|
|
+ IWrapper<Contract> wrapper = IWrapper.getWrapper();
|
|
|
+ //根据卖方联系人名称/联系方式过滤
|
|
|
+ wrapper.or().like(Contract::getSellContactName, dto.getSellContactName());
|
|
|
+ wrapper.or().like(Contract::getSellContactNumber, dto.getSellContactNumber());
|
|
|
+ //根据买方联系人名称/联系方式过滤
|
|
|
+ wrapper.or().like(Contract::getBuyContactName, dto.getBuyContactName());
|
|
|
+ wrapper.or().like(Contract::getBuyContactNumber, dto.getBuyContactNumber());
|
|
|
+ List<Contract> list = baseMapper.contactList(wrapper);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|