|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|
|
import com.mixsmart.utils.CustomFunction;
|
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
|
import com.mixsmart.utils.StringUtils;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
@@ -945,6 +946,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
chapters.stream().filter(e->e.getFormName().contains("暂")).findFirst().ifPresent(t->{
|
|
|
midPayItemList.stream().filter(e->e.getPayName().contains("暂")).findFirst().ifPresent(k->{
|
|
|
k.setPayNumber(t.getFormNumber());
|
|
|
+ tec.meterInfo.getBaseInfo().setProvisionalSum(paymentCertificateMap.get(t.getFormNumber()).getContractAmount());
|
|
|
});
|
|
|
});
|
|
|
/*合计后回显*/
|
|
@@ -989,19 +991,21 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
if(tec.meterInfo.getStartPayFormAll()!=null){
|
|
|
List<StartPayForm> startPayForm = tec.getMeterInfo().getStartPayFormAll();
|
|
|
if(startPayForm.size()>0){
|
|
|
- String[] startIds=tec.getPeriodInfo().getStartIds().split(",");
|
|
|
- if(Arrays.stream(startIds).anyMatch(BaseUtils::isNumber)) {
|
|
|
- List<StartPayForm> list = startPayForm.stream().sorted(Comparator.comparingInt(StartPayForm::getPeriodSort)).filter(e ->{
|
|
|
- for(String s:startIds){
|
|
|
- if(StringUtils.isEquals(s,e.getMeterPeriodId()))return true;
|
|
|
+ if(tec.getPeriodInfo().getStartIds()!=null) {
|
|
|
+ String[] startIds = tec.getPeriodInfo().getStartIds().split(",");
|
|
|
+ if (Arrays.stream(startIds).anyMatch(BaseUtils::isNumber)) {
|
|
|
+ List<StartPayForm> list = startPayForm.stream().sorted(Comparator.comparingInt(StartPayForm::getPeriodSort)).filter(e -> {
|
|
|
+ for (String s : startIds) {
|
|
|
+ if (StringUtils.isEquals(s, e.getMeterPeriodId())) return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (Func.isNotEmpty(list)) {
|
|
|
+ StartPayForm relate = list.get(list.size() - 1);
|
|
|
+ BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <= relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ startPay.setPreviousPeriodEndPay(pre.toPlainString());
|
|
|
+ startPay.setCurrentPeriodEndPay(addFc.apply(startPay.getCurrentPeriodPay(), startPay.getPreviousPeriodEndPay()));
|
|
|
}
|
|
|
- return false;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (Func.isNotEmpty(list)) {
|
|
|
- StartPayForm relate = list.get(list.size() - 1);
|
|
|
- BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <= relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- startPay.setPreviousPeriodEndPay(pre.toPlainString());
|
|
|
- startPay.setCurrentPeriodEndPay(addFc.apply(startPay.getCurrentPeriodPay(),startPay.getPreviousPeriodEndPay()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1617,8 +1621,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- baseInfo.setProvisionalSum(StringUtils.number2String(provisionalSum,2));
|
|
|
- baseInfo.setBOQAmount(StringUtils.number2String(BOQAmount,2));
|
|
|
+ baseInfo.setProvisionalSum(provisionalSum.toPlainString());
|
|
|
+ baseInfo.setBOQAmount(BOQAmount.toPlainString());
|
|
|
BigDecimal changeTokenTotal=tec.meterInfo.getChangeTokenListMap().values().stream().flatMap(Collection::stream).map(ChangeToken::getTotalChangeMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getContractAmount())+BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
|
|
|
String brief="开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()
|
|
@@ -1701,35 +1705,39 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
try {
|
|
|
String totalAmount=dataList.stream().map(ConstructionSchedule::getContractMoney).map(BaseUtils::str2BigDecimal).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString();
|
|
|
/*合同计划结束日期年末*/
|
|
|
+ LocalDate planStartDate=LocalDate.parse(baseInfo.getStartDatePlan(),BaseUtils.chineseDateFm);
|
|
|
LocalDate planEndDate=LocalDate.parse(baseInfo.getEndDatePlan(),BaseUtils.chineseDateFm);
|
|
|
- LocalDate planStartDate=LocalDate.parse(baseInfo.getEndDatePlan(),BaseUtils.chineseDateFm);
|
|
|
+ /*年份*/
|
|
|
+ FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_30").ifPresent(t -> {
|
|
|
+ List<Integer> value=IntStream.rangeClosed(planStartDate.getYear(),planEndDate.getYear()).boxed().collect(Collectors.toList());
|
|
|
+ elementWriter.write(t, value);
|
|
|
+ });
|
|
|
int max = monthMoney.keySet().stream().max(Comparator.comparingInt(i->i)).orElse(BaseUtils.dateInt(planEndDate.getYear(),12));
|
|
|
int min= monthMoney.keySet().stream().min(Comparator.comparingInt(i->i)).orElse(BaseUtils.dateInt(planStartDate.getYear(),1));
|
|
|
List<Integer> tickUnit =BaseUtils.getTickUnit(min,max);
|
|
|
- /*没月累计*/
|
|
|
- /* LocalDateTime head=BaseUtils.toLdt(min);
|
|
|
- LocalDateTime tail=BaseUtils.toLdt(max);*/
|
|
|
- /* List<String> monthlySum= IntStream.rangeClosed(1,max).boxed().map(month->{
|
|
|
- BigDecimal tmp= monthMoney.entrySet().stream().filter(e->e.getKey()<=month).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- return ratioFc.apply(tmp.toPlainString(),totalAmount);
|
|
|
- }).collect(Collectors.toList());*/
|
|
|
+ /*起始月相对于一月份的偏移量*/
|
|
|
+ int offset= min%100-1;
|
|
|
+ /*每月累计*/
|
|
|
+ LinkedHashMap<Integer,Double> actualMap = new LinkedHashMap<>();
|
|
|
List<String> monthlySum= tickUnit.stream().map(month->{
|
|
|
BigDecimal tmp= monthMoney.entrySet().stream().filter(e->e.getKey()<=month).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- return ratioFc.apply(tmp.toPlainString(),totalAmount);
|
|
|
+ String percent= ratioFc.apply(tmp.toPlainString(),totalAmount);
|
|
|
+ actualMap.put(month,Double.parseDouble(percent));
|
|
|
+ return percent;
|
|
|
}).collect(Collectors.toList());
|
|
|
-
|
|
|
- FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_22").ifPresent(t->{
|
|
|
- elementWriter.write(t,monthlySum);
|
|
|
- });
|
|
|
/*本月*/
|
|
|
- /*List<String> monthlyCount= IntStream.rangeClosed(1,max).boxed().map(month->{
|
|
|
- BigDecimal tmp= monthMoney.entrySet().stream().filter(e-> e.getKey().equals(month)).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- return ratioFc.apply(tmp.toPlainString(),totalAmount);
|
|
|
- }).collect(Collectors.toList());*/
|
|
|
List<String> monthlyCount= tickUnit.stream().map(month->{
|
|
|
BigDecimal tmp= monthMoney.entrySet().stream().filter(e-> e.getKey().equals(month)).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
return ratioFc.apply(tmp.toPlainString(),totalAmount);
|
|
|
}).collect(Collectors.toList());
|
|
|
+ if(offset>0){
|
|
|
+ monthlySum.addAll(0,Collections.nCopies(offset,""));
|
|
|
+ monthlyCount.addAll(0,Collections.nCopies(offset,""));
|
|
|
+ }
|
|
|
+ FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_22").ifPresent(t->{
|
|
|
+ elementWriter.write(t,monthlySum);
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_23").ifPresent(t->{
|
|
|
elementWriter.write(t,monthlyCount);
|
|
@@ -1737,6 +1745,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
List<String> planMonthSum=new ArrayList<>();
|
|
|
LinkedHashMap<Integer,BigDecimal> planMonthMap=new LinkedHashMap<>();
|
|
|
+ LinkedHashMap<Integer,Double> plannedMap =new LinkedHashMap<>();
|
|
|
if(chapterSchedules!=null&&chapterSchedules.size()>0) {
|
|
|
/*月份装入数组*/
|
|
|
chapterSchedules.forEach(ChapterSchedule::updateArray);
|
|
@@ -1747,23 +1756,22 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
planMonthMap.put(BaseUtils.dateInt(year,month),v.stream().map(e->e.getArr()[month-1]).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
}
|
|
|
});
|
|
|
- /* List<BigDecimal> planMonth = IntStream.range(0,12).boxed().map(i->chapterSchedules.stream().map(e->e.getArr()[i]).reduce(BigDecimal.ZERO,BigDecimal::add)).collect(Collectors.toList());*/
|
|
|
/*计划本月*/
|
|
|
FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_28").ifPresent(t -> {
|
|
|
List<String> value=planMonthMap.values().stream().map(BigDecimal::toPlainString).map(s-> ratioFc.apply(s, totalAmount)).collect(Collectors.toList());
|
|
|
elementWriter.write(t, value);
|
|
|
});
|
|
|
/*计划累计*/
|
|
|
-
|
|
|
+ planMonthMap.entrySet().stream().filter(kv->kv.getKey()<=max).forEach(kv->{
|
|
|
+ plannedMap.put(kv.getKey(), Double.parseDouble(ratioFc.apply(kv.getValue().toPlainString(),totalAmount)));
|
|
|
+ });
|
|
|
planMonthSum = planMonthMap.keySet().stream().map(yearMonth->{
|
|
|
String tmp= planMonthMap.entrySet().stream().filter(kv ->kv.getKey()<=yearMonth).map(Map.Entry::getValue).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
|
|
- return ratioFc.apply(tmp, totalAmount);
|
|
|
+ String percent= ratioFc.apply(tmp, totalAmount);
|
|
|
+ plannedMap.put(yearMonth,Double.parseDouble(percent));
|
|
|
+ return percent;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- /* planMonthSum = IntStream.range(0,12).boxed().map(i-> {
|
|
|
- String tmp= planMonth.stream().filter(e -> planMonth.indexOf(e) <= i).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
|
|
- return ratioFc.apply(tmp, totalAmount);
|
|
|
- } */
|
|
|
List<String> finalPlanMonthSum = planMonthSum;
|
|
|
FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_27").ifPresent(t -> {
|
|
|
elementWriter.write(t, finalPlanMonthSum);
|
|
@@ -1771,26 +1779,15 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
}
|
|
|
/*上传图标*/
|
|
|
- if(planMonthSum.size()>0&&monthlySum.size()>0){
|
|
|
- try {
|
|
|
- LinkedHashMap<Long,Double> actualMap = new LinkedHashMap<>();
|
|
|
- monthMoney.forEach((yearMonth,sum)->{
|
|
|
- actualMap.put(BaseUtils.getTimeMs(yearMonth/100,yearMonth%100),Double.parseDouble(ratioFc.apply(sum.toPlainString(),totalAmount)));
|
|
|
- });
|
|
|
-
|
|
|
- LinkedHashMap<Long,Double> plannedMap =new LinkedHashMap<>();
|
|
|
- planMonthMap.entrySet().stream().filter(kv->kv.getKey()<=max).forEach(kv->{
|
|
|
- plannedMap.put(BaseUtils.getTimeMs(kv.getKey()/100,kv.getKey()%100),Double.parseDouble(ratioFc.apply(kv.getValue().toPlainString(),totalAmount)));
|
|
|
- });
|
|
|
- String path=FormulaUtils.chapterScheduleChartUrl(actualMap,plannedMap,planStartDate.getYear(),planEndDate.getYear());
|
|
|
- BladeFile chartFile= tec.getNewIOSSClient().uploadFile( ConstructionSchedule.TBN+ SnowFlakeUtil.getId() + ".png",path);
|
|
|
- /*施工进度图*/
|
|
|
- FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_29").ifPresent(t -> {
|
|
|
- elementWriter.write(t, chartFile.getLink());
|
|
|
- });
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ try {
|
|
|
+ String path=FormulaUtils.chapterScheduleChartUrl(actualMap,plannedMap,planStartDate.getYear(),planEndDate.getYear());
|
|
|
+ BladeFile chartFile= tec.getNewIOSSClient().uploadFile( ConstructionSchedule.TBN+ SnowFlakeUtil.getId() + ".png",path);
|
|
|
+ /*施工进度图*/
|
|
|
+ FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_29").ifPresent(t -> {
|
|
|
+ elementWriter.write(t, chartFile.getLink());
|
|
|
+ });
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
StaticLog.error(e.getMessage());
|
|
@@ -1807,12 +1804,12 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*已过去*/
|
|
|
String passDay=CustomFunction.join(CustomFunction.daysPassed(baseInfo.getStartDate(), LocalDate.now()),"").toString();
|
|
|
|
|
|
- BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- baseInfo.setProvisionalSum(StringUtils.number2String(provisionalSum,2));
|
|
|
- baseInfo.setBOQAmount(StringUtils.number2String(BOQAmount,2));
|
|
|
+ BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"ZLJE".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"ZLJE".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ baseInfo.setProvisionalSum(provisionalSum.toPlainString());
|
|
|
+ baseInfo.setBOQAmount(BOQAmount.toPlainString());
|
|
|
BigDecimal changeTokenTotal=tec.meterInfo.getChangeTokenListMap().values().stream().flatMap(Collection::stream).map(ChangeToken::getTotalChangeMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
- double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getContractAmount())+BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
|
|
|
+ double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
|
|
|
String brief="开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()
|
|
|
+" 合同完成日期:"+baseInfo.getEndDatePlan()+" 合同期限"+contractDay+"天 时间延长"+extended+"天 修改后合同期限"+ totalDay
|
|
|
+"天(即至"+baseInfo.getEndDate()+")"
|