|
@@ -27,7 +27,7 @@ import com.fjhx.common.entity.contract.po.ContractTemplate;
|
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
import com.fjhx.common.entity.currency.po.CurrencyRate;
|
|
|
import com.fjhx.common.entity.documentary.bo.DocumentaryData;
|
|
|
-import com.fjhx.common.enums.FlowStatusEnum;
|
|
|
+import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
import com.fjhx.common.service.contract.ContractTemplateService;
|
|
|
import com.fjhx.common.service.corporation.CorporationService;
|
|
|
import com.fjhx.common.service.currency.CurrencyRateService;
|
|
@@ -247,7 +247,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
private Page<ContractVo> pageCommon(ContractSelectDto dto, IWrapper<Contract> wrapper) {
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
|
|
|
- wrapper.between("t1", Contract::getStatus, FlowStatusEnum.DRAFT.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
|
|
|
+ wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
if (StringUtils.isNotEmpty(dto.getStatus())) {
|
|
|
wrapper.eq("t1", Contract::getStatus, dto.getStatus());
|
|
|
}
|
|
@@ -340,7 +340,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
public Page<ContractBudgetVo> getProfitBudgetPage(ContractSelectDto dto) {
|
|
|
IWrapper<Contract> wrapper = getWrapper();
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
- wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
|
|
|
+ wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
@@ -366,7 +366,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
Map<Long, String> otherAmountMap = otherAmountList.stream().collect(Collectors.toMap(PurchaseDetailVo::getDataResourceId, PurchaseDetailVo::getSumAmountCurrency));
|
|
|
//通过合同ID查询到退税数据
|
|
|
List<TaxRefundDetails> refundDetails = taxRefundDetailsService.getSumMoneyByContractIds(contractIds);
|
|
|
- Map<Long,List<TaxRefundDetails>> refundDetailsMap = refundDetails.stream().collect(Collectors.groupingBy(TaxRefundDetails::getContractId));
|
|
|
+ Map<Long, List<TaxRefundDetails>> refundDetailsMap = refundDetails.stream().collect(Collectors.groupingBy(TaxRefundDetails::getContractId));
|
|
|
|
|
|
//取出默认汇率
|
|
|
// List<CurrencyRate> currencyRateList = currencyRateService.getList();
|
|
@@ -399,8 +399,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
/**
|
|
|
* 处理退税金额
|
|
|
*/
|
|
|
- List<TaxRefundDetails> rList = refundDetailsMap.getOrDefault(v.getContractId(),null);
|
|
|
- if(CollectionUtils.isNotEmpty(rList)){
|
|
|
+ List<TaxRefundDetails> rList = refundDetailsMap.getOrDefault(v.getContractId(), null);
|
|
|
+ if (CollectionUtils.isNotEmpty(rList)) {
|
|
|
BigDecimal taxReturnMoney = rList.stream().map(taxRefundDetails -> {
|
|
|
//获取汇率
|
|
|
BigDecimal rate = map.getOrDefault(taxRefundDetails.getCurrency(), BigDecimal.ONE);
|
|
@@ -431,19 +431,19 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
//计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
|
|
|
v.setExpenditureAmount(
|
|
|
v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().multiply(rate).add
|
|
|
- (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(rate)).add
|
|
|
- (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(rate)).add
|
|
|
- (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(rate)).add
|
|
|
- (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(rate)).add
|
|
|
- (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(rate)).add
|
|
|
- (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(rate)).add
|
|
|
- (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
|
|
|
- (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
|
|
|
+ (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(rate)).add
|
|
|
+ (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(rate)).add
|
|
|
+ (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(rate)).add
|
|
|
+ (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(rate)).add
|
|
|
+ (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(rate)).add
|
|
|
+ (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(rate)).add
|
|
|
+ (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
|
|
|
+ (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
|
|
|
/**
|
|
|
* 处理退税金额
|
|
|
*/
|
|
|
- List<TaxRefundDetails> rList = refundDetailsMap.getOrDefault(v.getContractId(),null);
|
|
|
- if(CollectionUtils.isNotEmpty(rList)){
|
|
|
+ List<TaxRefundDetails> rList = refundDetailsMap.getOrDefault(v.getContractId(), null);
|
|
|
+ if (CollectionUtils.isNotEmpty(rList)) {
|
|
|
BigDecimal taxReturnMoney = rList.stream().map(taxRefundDetails -> {
|
|
|
//获取汇率
|
|
|
BigDecimal reRate = taxRefundDetails.getRate();
|
|
@@ -477,7 +477,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
public Page<ContractBudgetVo> getProfitClearingPage(ContractSelectDto dto) {
|
|
|
IWrapper<Contract> wrapper = getWrapper();
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
- wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
|
|
|
+ wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
@@ -509,7 +509,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
//到账金额
|
|
|
v.setSumClaimMoney(this.getSumClaimMoney(v, assignCurrencyRatesMap));
|
|
|
//采购合同总金额
|
|
|
- v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, assignCurrencyRatesMap,1));
|
|
|
+ v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, assignCurrencyRatesMap, 1));
|
|
|
//支出费用
|
|
|
this.getGroupTypeMoney(v, assignCurrencyRatesMap);
|
|
|
} else {//没有取默认的汇率
|
|
@@ -517,7 +517,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
//到账金额
|
|
|
v.setSumClaimMoney(this.getSumClaimMoney(v, defaultCurrencyRateMap));
|
|
|
//采购合同总金额
|
|
|
- v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, defaultCurrencyRateMap,2));
|
|
|
+ v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, defaultCurrencyRateMap, 2));
|
|
|
//支出费用
|
|
|
this.getGroupTypeMoney(v, defaultCurrencyRateMap);
|
|
|
}
|
|
@@ -941,7 +941,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
if (buyCorporationId != null) {
|
|
|
List<Contract> list = list(q -> q
|
|
|
.eq(Contract::getBuyCorporationId, buyCorporationId)
|
|
|
- .eq(Contract::getStatus, FlowStatusEnum.PASS.getKey())
|
|
|
+ .eq(Contract::getStatus, FlowStatusEnum1.PASS.getKey())
|
|
|
.orderByDesc(BaseIdPo::getId)
|
|
|
.last("limit 3")
|
|
|
);
|
|
@@ -1241,6 +1241,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
item.setCustomerName(customer.getName());
|
|
|
});
|
|
|
|
|
|
+ //赋值业务员名称
|
|
|
+ UserUtil.assignmentNickName(records, Contract::getCreateUser, Contract::setUserName);
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -1521,14 +1524,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
* @param currencyRatesMap 汇率JSON
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap,int type) {
|
|
|
+ private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap, int type) {
|
|
|
List<EhsdPurchaseProductVo> list = ehsdPurchaseProductService.getListByContractId(v.getContractId());
|
|
|
BigDecimal sumPurchaseContractMoney = BigDecimal.ZERO;
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
for (EhsdPurchaseProductVo c : list) {
|
|
|
- if(type==1){
|
|
|
+ if (type == 1) {
|
|
|
sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(c.getRate()));
|
|
|
}
|
|
|
|