|
@@ -23,10 +23,7 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.meter.dto.ContractMaterialValidityDTO;
|
|
import org.springblade.meter.dto.ContractMaterialValidityDTO;
|
|
-import org.springblade.meter.entity.AttachmentForm;
|
|
|
|
-import org.springblade.meter.entity.ContractMaterial;
|
|
|
|
-import org.springblade.meter.entity.ContractMaterialPrice;
|
|
|
|
-import org.springblade.meter.entity.ContractMaterialValidity;
|
|
|
|
|
|
+import org.springblade.meter.entity.*;
|
|
import org.springblade.meter.mapper.AttachmentFormMapper;
|
|
import org.springblade.meter.mapper.AttachmentFormMapper;
|
|
import org.springblade.meter.mapper.ContractMaterialMapper;
|
|
import org.springblade.meter.mapper.ContractMaterialMapper;
|
|
import org.springblade.meter.mapper.ContractMaterialValidityMapper;
|
|
import org.springblade.meter.mapper.ContractMaterialValidityMapper;
|
|
@@ -37,6 +34,7 @@ import org.springblade.meter.utils.ForestNodeMerger;
|
|
import org.springblade.meter.vo.ContractMaterialVO3;
|
|
import org.springblade.meter.vo.ContractMaterialVO3;
|
|
import org.springblade.meter.vo.ContractMaterialValidityVO;
|
|
import org.springblade.meter.vo.ContractMaterialValidityVO;
|
|
import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
|
|
import org.springblade.meter.vo.GetMaterialCurrentPriceVO;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -44,6 +42,7 @@ import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.YearMonth;
|
|
import java.time.YearMonth;
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -131,7 +130,7 @@ public class ContractMaterialValidityServiceImpl extends BaseServiceImpl<Contrac
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<GetMaterialCurrentPriceVO> getMaterialCurrentPrice(Long contractId, Long materialId, YearMonth yearMonth) {
|
|
|
|
|
|
+ public List<GetMaterialCurrentPriceVO> getMaterialCurrentPrice(Long contractId, Long materialId, String yearMonth) {
|
|
List<GetMaterialCurrentPriceVO> vos = baseMapper.getMaterialCurrentPrice(contractId,materialId,yearMonth);
|
|
List<GetMaterialCurrentPriceVO> vos = baseMapper.getMaterialCurrentPrice(contractId,materialId,yearMonth);
|
|
return vos;
|
|
return vos;
|
|
}
|
|
}
|
|
@@ -152,10 +151,25 @@ public class ContractMaterialValidityServiceImpl extends BaseServiceImpl<Contrac
|
|
if (quotaRatio == null){
|
|
if (quotaRatio == null){
|
|
throw new ServiceException("材料未设置调差限额");
|
|
throw new ServiceException("材料未设置调差限额");
|
|
}
|
|
}
|
|
|
|
+ //获取材料有效期
|
|
|
|
+ ContractMaterialValidity validity1 = this.getById(validity.getMaterialValidityId());
|
|
|
|
+ //获取材料调差名称
|
|
|
|
+ //计算调差金额,生成计算式
|
|
|
|
+ StringBuilder str = new StringBuilder("调差价格依据于:"+material.getMaterialName()+
|
|
|
|
+ "("+validity1.getStartDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))+"至"+
|
|
|
|
+ validity1.getEndDate().format(DateTimeFormatter.ofPattern("yyyyMMdd"))+")\n");
|
|
//计算比例
|
|
//计算比例
|
|
|
|
+ if (price.compareTo(currentPrice) == 1){
|
|
|
|
+ //市场价低于基准价
|
|
|
|
+ str.append("调差公式(标准):调增金额=调差数量×[市场价-基准价×(1-风险幅度差%)]×(1+合同增值税税率)\n");
|
|
|
|
+ }else {
|
|
|
|
+ //市场价高于基准价
|
|
|
|
+ str.append("调差公式(标准):调增金额=调差数量×[市场价-基准价×(1+风险幅度差%)]×(1+合同增值税税率)\n");
|
|
|
|
+ }
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
BigDecimal decimal = currentPrice.subtract(price).multiply(new BigDecimal(100)).divide(price, 2, RoundingMode.DOWN);
|
|
BigDecimal decimal = currentPrice.subtract(price).multiply(new BigDecimal(100)).divide(price, 2, RoundingMode.DOWN);
|
|
map.put("rangePriceRatio",decimal);
|
|
map.put("rangePriceRatio",decimal);
|
|
|
|
+ map.put("adjustCalculation",str.toString());
|
|
if (decimal.compareTo(quotaRatio.negate()) == 1 && decimal.compareTo(quotaRatio) == -1){
|
|
if (decimal.compareTo(quotaRatio.negate()) == 1 && decimal.compareTo(quotaRatio) == -1){
|
|
map.put("isAdjust",0);
|
|
map.put("isAdjust",0);
|
|
}else {
|
|
}else {
|