|
@@ -5,7 +5,6 @@ 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;
|
|
@@ -109,14 +108,38 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
)
|
|
|
));
|
|
|
|
|
|
- Function<List<Payment>, Map<String, BigDecimal>> moneySum= data-> data.stream()
|
|
|
+ Function<List<Payment>, Map<String, BigDecimal>> moneySumBak= data-> data.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
payment -> getPrefix(payment.getNumber()),
|
|
|
LinkedHashMap::new,
|
|
|
Collectors.reducing(BigDecimal.ZERO, Payment::getMoneyAsBigDecimal, BigDecimal::add)
|
|
|
));
|
|
|
|
|
|
-
|
|
|
+ Function<List<Payment>, Map<String, BigDecimal>> moneySum= data-> {
|
|
|
+ Map<String,BigDecimal> result= new HashMap<>();
|
|
|
+ LinkedHashMap<String,List<Payment>> group= data.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ payment -> getPrefix(payment.getNumber()),
|
|
|
+ LinkedHashMap::new,
|
|
|
+ Collectors.toList()
|
|
|
+ ));
|
|
|
+ group.forEach((k,v)->{
|
|
|
+ AtomicReference<String> chapter = new AtomicReference<>("0");
|
|
|
+ LinkedHashMap<String,List<Payment>> paymentGroup = v.stream().collect(Collectors.groupingBy(Payment::getNumber,LinkedHashMap::new,Collectors.toList()));
|
|
|
+ paymentGroup.forEach((kk,vv)->{
|
|
|
+ Optional<Integer> scale= FormulaUtils.getScale(vv.get(0).getUnit());
|
|
|
+ if(scale.isPresent()){
|
|
|
+ String completed=vv.stream().map(e->BaseUtils.str2BigDecimal(e.getCompleted())).reduce(BigDecimal.ZERO,BigDecimal::add).setScale(scale.get(),RoundingMode.HALF_UP).toPlainString();
|
|
|
+ String tmp=BaseUtils.str2BigDecimal(multiFc.apply(completed, vv.get(0).getPrice())).setScale(0,RoundingMode.HALF_UP).toPlainString();
|
|
|
+ chapter.set(addFc.apply(chapter.get(), tmp));
|
|
|
+ }else{
|
|
|
+ chapter.set(addFc.apply(chapter.get(), vv.stream().map(e -> BaseUtils.str2BigDecimal(e.getMoney())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ result.put(k,BaseUtils.str2BigDecimal(chapter.get()).setScale(0,RoundingMode.HALF_UP));
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ };
|
|
|
|
|
|
static String BTDL="保通道路";
|
|
|
/**根据清单编号获取支付项目章节编号*/
|