|
|
@@ -29,8 +29,12 @@ import com.jeeplus.idlefactorybuildings.service.IdleFactoryBuildingsService;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 闲置厂房Controller
|
|
|
@@ -102,6 +106,7 @@ public class IdleFactoryBuildingsController {
|
|
|
@GetMapping("list2")
|
|
|
public ResponseEntity<IPage<IdleFactoryBuildingsDTO>> list2(IdleFactoryBuildingsDTO idleFactoryBuildingsDTO, Page<IdleFactoryBuildingsDTO> page) throws Exception {
|
|
|
String area=idleFactoryBuildingsDTO.getIdleArea();
|
|
|
+ String des1=idleFactoryBuildingsDTO.getDes1();
|
|
|
if(area!=null&&area.equals("")){
|
|
|
idleFactoryBuildingsDTO.setIdleArea("");
|
|
|
}
|
|
|
@@ -120,6 +125,39 @@ public class IdleFactoryBuildingsController {
|
|
|
queryWrapper.gt("idle_area",5000);
|
|
|
}
|
|
|
}
|
|
|
+ //添加产业的筛选
|
|
|
+// if(des1!=null&&!des1.equals("")) {
|
|
|
+// queryWrapper.apply("FIND_IN_SET({0}, des1)", des1);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 1. 拆分 des1
|
|
|
+ List<String> desArr = new ArrayList<>();
|
|
|
+ if (des1 != null && !des1.trim().isEmpty()) { // 用 isEmpty() 代替 isBlank()
|
|
|
+ desArr = Arrays.stream(des1.split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .filter(s -> !s.isEmpty())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 把数组变成 final,才能在 lambda 里用
|
|
|
+ final List<String> finalDesArr = desArr;
|
|
|
+
|
|
|
+ // 3. 拼 OR 条件
|
|
|
+ if (!finalDesArr.isEmpty()) {
|
|
|
+ queryWrapper.and(qw -> {
|
|
|
+ QueryWrapper<IdleFactoryBuildingsDTO> wrapper = (QueryWrapper<IdleFactoryBuildingsDTO>) qw;
|
|
|
+ for (int i = 0; i < finalDesArr.size(); i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ wrapper.apply("FIND_IN_SET({0}, a.des1)", finalDesArr.get(i));
|
|
|
+ } else {
|
|
|
+ wrapper.or().apply("FIND_IN_SET({0}, a.des1)", finalDesArr.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
IPage<IdleFactoryBuildingsDTO> result = idleFactoryBuildingsService.findPage (page, queryWrapper);
|
|
|
return ResponseEntity.ok (result);
|
|
|
@@ -147,6 +185,42 @@ public class IdleFactoryBuildingsController {
|
|
|
return ResponseEntity.ok (map);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *产业统计
|
|
|
+ */
|
|
|
+ @ApiLog("产业统计")
|
|
|
+ @ApiOperation(value = "产业统计")
|
|
|
+ @GetMapping("getIndustryList")
|
|
|
+ public ResponseEntity<List<HashMap<String, Object>>> getIndustryList() throws Exception {
|
|
|
+ List<HashMap<String, Object>> map=idleFactoryBuildingsService.getIndustryList();
|
|
|
+ if(map!=null&&map.size()>0){
|
|
|
+ for (int i=0;i<map.size();i++){
|
|
|
+ if(map.get(i).get("content")!=null){
|
|
|
+ String alls=map.get(i).get("content").toString();
|
|
|
+ if(alls.contains(",")){
|
|
|
+ List<Integer> codes = Arrays.stream(alls.split(","))
|
|
|
+ .map(String::trim) // 去掉前后空格(可选)
|
|
|
+ .map(Integer::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ HashMap<String, Object> map2=idleFactoryBuildingsService.statByDesCodes(codes);
|
|
|
+ if(map2!=null){
|
|
|
+ map.get(i).put("building_cnt",map2.get("building_cnt").toString());
|
|
|
+ map.get(i).put("total_idle_area",map2.get("total_idle_area").toString());
|
|
|
+ map.get(i).put("total_area",map2.get("total_area").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseEntity.ok (map);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 根据Id获取闲置厂房数据
|