|
@@ -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;
|
|
@@ -256,6 +257,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public void parse(){
|
|
|
LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(AdvancePaymentCertificate.class);
|
|
|
tec.formDataMap.putAll(fdm);
|
|
@@ -2052,6 +2054,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
return pnb;
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void parse() {
|
|
|
builderFormDatas(InterimMeterPaySummary.class);
|
|
@@ -2059,31 +2063,45 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
Map<Long,MeterApply> meterApplyGroup = meterApplyList.stream().collect(Collectors.toMap(MeterApply::getId,m->m,(v1,v2)->v1));
|
|
|
LinkedHashMap<String,List<Payment>> group= current.stream().collect(Collectors.groupingBy(chapterPreFixFc,LinkedHashMap::new,Collectors.toList()));
|
|
|
group.forEach((k,v)->{
|
|
|
- MeterApply meterApply = meterApplyGroup.get(v.get(0).getMiddleMeterId());
|
|
|
- for(Payment payment:v){
|
|
|
+ List<InterimMeterPaySummary> addList= new ArrayList<>();
|
|
|
+ /*先按编号分组,再归集*/
|
|
|
+ LinkedHashMap<String,List<Payment>> paymentGroup = v.stream().collect(Collectors.groupingBy(Payment::getNumber,LinkedHashMap::new,Collectors.toList()));
|
|
|
+ paymentGroup.forEach((pn,ps)->{
|
|
|
+ /*同编号汇总*/
|
|
|
+ Payment payment = ps.get(0);
|
|
|
InterimMeterPaySummary imps = new InterimMeterPaySummary();
|
|
|
BeanUtils.copyProperties(payment,imps);
|
|
|
imps.setItemName(payment.getName());
|
|
|
imps.setFormNumber(payment.getNumber());
|
|
|
- imps.setCompleted(StringUtils.handleNull(payment.getCompleted()));
|
|
|
+ imps.setCompleted(ps.stream().map(e->BaseUtils.str2BigDecimal(e.getCompleted())).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString());
|
|
|
+ imps.setMoney(ps.stream().map(e->BaseUtils.str2BigDecimal(e.getMoney())).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString());
|
|
|
+ FormulaUtils.getScale(payment.getUnit()).ifPresent(scale->{
|
|
|
+ imps.setCompleted(BaseUtils.str2BigDecimal(imps.getCompleted()).setScale(scale,RoundingMode.HALF_UP).toPlainString());
|
|
|
+ imps.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(imps.getCompleted(), imps.getPrice())).setScale(0,RoundingMode.HALF_UP).toPlainString());
|
|
|
+ });
|
|
|
imps.setMeterNumber("");
|
|
|
- dataList.add(imps);
|
|
|
- InterimMeterPaySummary part = new InterimMeterPaySummary();
|
|
|
- part.setItemName(meterApply.getEngineerDivide());
|
|
|
- part.setMeterNumber(meterApply.getMeterNumber());
|
|
|
- part.setCompleted(imps.getCompleted());
|
|
|
- dataList.add(part);
|
|
|
- }
|
|
|
- int add= capacity-v.size()*2%capacity-1;
|
|
|
+ addList.add(imps);
|
|
|
+ /*部位显示*/
|
|
|
+ for(Payment pay:ps){
|
|
|
+ MeterApply meterApply = meterApplyGroup.get(pay.getMiddleMeterId());
|
|
|
+ InterimMeterPaySummary part = new InterimMeterPaySummary();
|
|
|
+ part.setItemName(meterApply.getEngineerDivide());
|
|
|
+ part.setMeterNumber(meterApply.getMeterNumber());
|
|
|
+ part.setCompleted(imps.getCompleted());
|
|
|
+ addList.add(part);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dataList.addAll(addList);
|
|
|
+ int add= capacity-addList.size()%capacity-1;
|
|
|
if(add>0){
|
|
|
dataList.addAll(Collections.nCopies(add,new InterimMeterPaySummary()));
|
|
|
}
|
|
|
InterimMeterPaySummary chapter = new InterimMeterPaySummary("章小计");
|
|
|
- String sum=v.stream().map(Payment::getMoney).map(p->BaseUtils.str2BigDecimal(p).setScale(0,RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString();
|
|
|
+ String sum=addList.stream().map(InterimMeterPaySummary::getMoney).map(p->BaseUtils.str2BigDecimal(p).setScale(0,RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString();
|
|
|
chapter.setMoney(sum);
|
|
|
dataList.add(chapter);
|
|
|
- tec.periodInfo.setSummaryNumber(String.valueOf(BaseUtils.sliceNumber(dataList.size(),capacity)));
|
|
|
});
|
|
|
+ tec.periodInfo.setSummaryNumber(String.valueOf(BaseUtils.sliceNumber(dataList.size(),capacity)));
|
|
|
putOut(InterimMeterPaySummary.class);
|
|
|
}
|
|
|
}
|