|
|
@@ -26,8 +26,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
-import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
|
* 特种设备申请Controller
|
|
|
@@ -207,46 +205,42 @@ public class SpecHomeController extends BaseController
|
|
|
public AjaxResult sumYlgcLength(@RequestBody Map<String, Object> params){
|
|
|
List plantIds = (List) params.get("plantIds");
|
|
|
// 查询管道长度
|
|
|
- List<TSpecdevYlgd> gdList = tSpecdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>().select("length")
|
|
|
- .eq("STATUS" , 1)
|
|
|
- .eq("del_flag" , 0)
|
|
|
- .in("plant_code",plantIds)
|
|
|
-// .in("unit",unitIds)
|
|
|
-// .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
|
|
|
-// .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds).or().isNull("unit"))
|
|
|
- );
|
|
|
- double allLength = 0;
|
|
|
- ExecutorService executorService = Executors.newFixedThreadPool(100);
|
|
|
- for (int i = 0; i < gdList.size(); i++) {
|
|
|
- executorService.execute(() -> {
|
|
|
-
|
|
|
- });
|
|
|
- double gdLength = 0;
|
|
|
- if (!StringUtils.isBlank(gdList.get(i).getLength())) {
|
|
|
- if (gdList.get(i).getLength().indexOf("\n") > -1) {
|
|
|
- String[] arr = gdList.get(i).getLength().split("\n");
|
|
|
+// List<TSpecdevYlgd> gdList = tSpecdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
|
|
|
+// .eq("STATUS" , 1)
|
|
|
+// .eq("del_flag" , 0)
|
|
|
+// .in("plant_code",plantIds)
|
|
|
+//// .in("unit",unitIds)
|
|
|
+//// .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
|
|
|
+//// .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds).or().isNull("unit"))
|
|
|
+// );
|
|
|
+ TSpecdevYlgd tSpecdevYlgd = new TSpecdevYlgd();
|
|
|
+ tSpecdevYlgd.setPlantCodes(plantIds);
|
|
|
+ List<TSpecdevYlgd> gdList = tSpecdevYlgdService.selectYlgdLengthList(tSpecdevYlgd);
|
|
|
+ ArrayList<Double> lengthList = new ArrayList<>();
|
|
|
+ for (TSpecdevYlgd ylgd : gdList) {
|
|
|
+ if (!StringUtils.isBlank(ylgd.getLength())) {
|
|
|
+ if (ylgd.getLength().indexOf("\n") > -1) {
|
|
|
+ String[] arr = ylgd.getLength().split("\n");
|
|
|
for (int j = 0; j < arr.length; j++) {
|
|
|
try {
|
|
|
- gdLength += Double.parseDouble(arr[j]);
|
|
|
- }catch (NumberFormatException e) {
|
|
|
- logger.error(JSON.toJSONString(e));
|
|
|
- continue;
|
|
|
+ lengthList.add(Double.valueOf(arr[j]));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
try {
|
|
|
- gdLength = Double.parseDouble(gdList.get(i).getLength());
|
|
|
- }catch (NumberFormatException e) {
|
|
|
- logger.error(JSON.toJSONString(e));
|
|
|
+ lengthList.add(Double.valueOf(ylgd.getLength()));
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- allLength += gdLength;
|
|
|
}
|
|
|
- executorService.shutdown();
|
|
|
+ double sum = lengthList.stream().mapToDouble(x->x).sum();
|
|
|
DecimalFormat df = new DecimalFormat("0.00#");
|
|
|
- System.out.println(df.format(allLength));
|
|
|
- return AjaxResult.success(df.format(allLength));
|
|
|
+ logger.info("==========sum:"+df.format(sum));
|
|
|
+ return AjaxResult.success(df.format(sum));
|
|
|
}
|
|
|
|
|
|
/**
|