WzLandManageDetailsController.java 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. package com.example.controller;
  2. import com.example.config.annotation.IgnoreAuth;
  3. import com.example.entity.OtnAreaEntity;
  4. import com.example.entity.WzLandManageDetailsEntity;
  5. import com.example.entity.vo.floormanager.FloorNoUserVo;
  6. import com.example.entity.vo.housemanager.HouseYearVo;
  7. import com.example.service.WzLandManageDetailsService;
  8. import com.example.service.WzOtnAreaService;
  9. import com.example.utils.PageMap;
  10. import com.example.utils.PageUtils;
  11. import com.example.utils.Query;
  12. import com.example.utils.R;
  13. import com.example.utils.excel.ExcelExport;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. import javax.servlet.http.HttpServletResponse;
  20. import java.text.DateFormat;
  21. import java.text.DecimalFormat;
  22. import java.text.SimpleDateFormat;
  23. import java.util.ArrayList;
  24. import java.util.Calendar;
  25. import java.util.Date;
  26. import java.util.HashMap;
  27. import java.util.List;
  28. import java.util.Map;
  29. @RestController
  30. @RequestMapping("/house-car/house/dist/api/WzLandManageDetails")
  31. public class WzLandManageDetailsController {
  32. @Autowired
  33. private WzLandManageDetailsService wzLandManageDetailsService;
  34. @Autowired
  35. private WzOtnAreaService otnAreaService;
  36. // @RequestMapping("/list")
  37. // @IgnoreAuth
  38. // public R list(@RequestBody PageMap pageMap) {
  39. // //查询列表数据
  40. // Query query = new Query(pageMap);
  41. //
  42. // int repeatNum=0;
  43. // //全省节点
  44. // FloorNoUserVo province=new FloorNoUserVo();
  45. // province.setCity("全省");
  46. // province.setCounty("全省");
  47. //
  48. // List<FloorNoUserVo> leaveUseVoList = wzLandManageDetailsService.queryLeaveUseList(pageMap.getMap());
  49. // Map<String,List<FloorNoUserVo>> map=new HashMap<>();
  50. // for (FloorNoUserVo leaveUseVo : leaveUseVoList) {
  51. // double avera=0l;
  52. // if(leaveUseVo.getBuildingAreaIdelArea()+leaveUseVo.getBuildingAreaRentArea()==0){
  53. // avera=0;
  54. // }else{
  55. // avera=leaveUseVo.getBuildingAreaIdelArea()/(leaveUseVo.getBuildingAreaIdelArea()+leaveUseVo.getBuildingAreaRentArea());
  56. // avera=formatDouble(avera)*100;
  57. // }
  58. // leaveUseVo.setAverage(avera);
  59. // List<FloorNoUserVo> list;
  60. // if(map.get(leaveUseVo.getCity())!=null){
  61. // list=map.get(leaveUseVo.getCity());
  62. // list.add(leaveUseVo);
  63. // }else{
  64. // list=new ArrayList<>();
  65. // list.add(leaveUseVo);
  66. // }
  67. // map.put(leaveUseVo.getCity(),list);
  68. // }
  69. // List<FloorNoUserVo> resultList=new ArrayList<>();
  70. // List<FloorNoUserVo> cityList=new ArrayList<>();
  71. // double abuildingAreaIdelArea=0l;
  72. // double abuildingAreaRentArea=0l;
  73. // double abuildArea=0l;
  74. // double abuildingAreaUnavailable=0l;
  75. // double abuildingAreaUseArea=0l;
  76. //
  77. // for(Map.Entry<String,List<FloorNoUserVo>> entry:map.entrySet()) {
  78. //
  79. // List<FloorNoUserVo> list = entry.getValue();
  80. // //对该list相同的县进行统计
  81. // Map<String, List<FloorNoUserVo>> countyMap = new HashMap<>();
  82. // for (FloorNoUserVo leaveUseVo : list) {
  83. // if (countyMap.get(leaveUseVo.getCounty()) != null) {
  84. // list = countyMap.get(leaveUseVo.getCounty());
  85. // list.add(leaveUseVo);
  86. // } else {
  87. // list = new ArrayList<>();
  88. // list.add(leaveUseVo);
  89. // }
  90. // countyMap.put(leaveUseVo.getCounty(), list);
  91. // }
  92. //
  93. // List<FloorNoUserVo> countyList = new ArrayList<>();
  94. // double citybuildingAreaIdelArea = 0l;
  95. // double citybuildingAreaRentArea = 0l;
  96. // double citybuildArea = 0l;
  97. // double citybuildingAreaUnavailable = 0l;
  98. // double citybuildingAreaUseArea = 0l;
  99. // for (Map.Entry<String, List<FloorNoUserVo>> countyEntry : countyMap.entrySet()) {
  100. // double buildingAreaIdelArea = 0l;
  101. // double buildingAreaRentArea = 0l;
  102. // double buildArea = 0l;
  103. // double buildingAreaUnavailable = 0l;
  104. // double buildingAreaUseArea = 0l;
  105. //
  106. // String reapStr="";
  107. // if (countyEntry.getKey().equals("市本部")){
  108. // reapStr="市本部"+repeatNum;
  109. // repeatNum++;
  110. // }
  111. //
  112. // FloorNoUserVo county = new FloorNoUserVo();
  113. // for (FloorNoUserVo leaveUseVo : countyEntry.getValue()) {
  114. // county.setCity(leaveUseVo.getCounty());
  115. // county.setCounty(leaveUseVo.getCounty());
  116. // if(!reapStr.equals("")){
  117. // county.setCity(reapStr);
  118. // county.setCounty(reapStr);
  119. // county.setCountyName(reapStr);
  120. // }
  121. //
  122. // buildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  123. // buildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  124. // buildArea += leaveUseVo.getBuildingArea();
  125. // buildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  126. // buildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  127. //
  128. // citybuildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  129. // citybuildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  130. // citybuildArea += leaveUseVo.getBuildingArea();
  131. // citybuildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  132. // citybuildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  133. //
  134. // abuildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  135. // abuildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  136. // abuildArea += leaveUseVo.getBuildingArea();
  137. // abuildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  138. // abuildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  139. // }
  140. // double avera=0;
  141. // if(buildingAreaIdelArea+buildingAreaRentArea==0){
  142. // avera=0;
  143. // }else{
  144. // try{
  145. // avera=formatDouble(buildingAreaIdelArea/(buildingAreaRentArea+buildingAreaIdelArea))*100;
  146. // }catch (Exception e){
  147. // e.printStackTrace();
  148. // }
  149. //
  150. // }
  151. // county.setBuildingArea(formatDouble(buildArea));
  152. // county.setBuildingAreaIdelArea(formatDouble(buildingAreaIdelArea));
  153. // county.setBuildingAreaUnavailable(formatDouble(buildingAreaUnavailable));
  154. // county.setBuildingAreaUseArea(formatDouble(buildingAreaUseArea));
  155. // county.setBuildingAreaRentArea(formatDouble(buildingAreaRentArea));
  156. // county.setAverage(formatDouble(avera));
  157. // countyList.add(county);
  158. // }
  159. // List<FloorNoUserVo> orderCountyList=new ArrayList<>();
  160. // try{
  161. // //对countList 进行排序
  162. // OtnAreaEntity area=otnAreaService.queryObject(list.get(0).getCity());
  163. // List<OtnAreaEntity> countyAreaList=otnAreaService.getCityOption(area.getId());
  164. // int i=0;
  165. // for (OtnAreaEntity otnAreaEntity : countyAreaList) {
  166. // for (FloorNoUserVo wzCity : countyList) {
  167. // if(wzCity.getCity().contains(otnAreaEntity.getName())){
  168. // i++;
  169. // wzCity.setFlag(i%2==0);
  170. // orderCountyList.add(wzCity);
  171. // }
  172. // }
  173. // }
  174. // }catch (Exception e){
  175. // orderCountyList=countyList;
  176. // e.printStackTrace();
  177. // }
  178. //
  179. //
  180. // double avera;
  181. // if(citybuildingAreaRentArea+citybuildingAreaIdelArea==0){
  182. // avera=0;
  183. // }else{
  184. // avera=formatDouble(citybuildingAreaIdelArea/(citybuildingAreaRentArea+citybuildingAreaIdelArea))*100;
  185. // }
  186. //
  187. // FloorNoUserVo parent = new FloorNoUserVo();
  188. // parent.setBuildingArea(formatDouble(citybuildArea));
  189. // parent.setBuildingAreaIdelArea(formatDouble(citybuildingAreaIdelArea));
  190. // parent.setBuildingAreaUnavailable(formatDouble(citybuildingAreaUnavailable));
  191. // parent.setBuildingAreaUseArea(formatDouble(citybuildingAreaUseArea));
  192. // parent.setBuildingAreaRentArea(formatDouble(citybuildingAreaRentArea));
  193. // parent.setCity(list.get(0).getCity());
  194. // parent.setCountyName(list.get(0).getCityName());
  195. // parent.setAverage(formatDouble(avera));
  196. // parent.setChildren(orderCountyList);
  197. // cityList.add(parent);
  198. // }
  199. //
  200. // //对cityList 进行排序
  201. // List<OtnAreaEntity> areaList=otnAreaService.getCityOption("018");
  202. // List<FloorNoUserVo> orderList=new ArrayList<>();
  203. // int i=0;
  204. // for (OtnAreaEntity otnAreaEntity : areaList) {
  205. // for (FloorNoUserVo wzCity : cityList) {
  206. // if(wzCity.getCity().contains(otnAreaEntity.getName())){
  207. // wzCity.setFlag(i%2==0);
  208. // orderList.add(wzCity);
  209. // i++;
  210. // }
  211. // }
  212. // }
  213. //
  214. // double aavera;
  215. // if(abuildingAreaRentArea+abuildingAreaIdelArea==0){
  216. // aavera=0;
  217. // }else{
  218. // aavera=formatDouble(abuildingAreaIdelArea/(abuildingAreaRentArea+abuildingAreaIdelArea))*100;
  219. // }
  220. // province.setBuildingArea(formatDouble(abuildArea));
  221. // province.setBuildingAreaIdelArea(formatDouble(abuildingAreaIdelArea));
  222. // province.setBuildingAreaUnavailable(formatDouble(abuildingAreaUnavailable));
  223. // province.setBuildingAreaUseArea(formatDouble(abuildingAreaUseArea));
  224. // province.setBuildingAreaRentArea(formatDouble(abuildingAreaRentArea));
  225. // province.setAverage(formatDouble(aavera));
  226. // province.setChildren(orderList);
  227. // resultList.add(province);
  228. //
  229. // int total = wzLandManageDetailsService.queryTotal(query);
  230. // PageUtils pageUtil = new PageUtils(resultList, total, query.getLimit(), query.getPage());
  231. // return R.ok().put("page", pageUtil);
  232. // }
  233. @RequestMapping("/queryHouseYear")
  234. @IgnoreAuth
  235. public R queryHouseYear(@RequestBody PageMap pageMap) {
  236. //查询列表数据
  237. Query query = new Query(pageMap);
  238. List<FloorNoUserVo> leaveUseVoList = wzLandManageDetailsService.queryLeaveUseList(query);
  239. Map<String,List<FloorNoUserVo>> map=new HashMap<>();
  240. for (FloorNoUserVo leaveUseVo : leaveUseVoList) {
  241. double avera=leaveUseVo.getBuildingAreaIdelArea()/(leaveUseVo.getBuildingAreaIdelArea()+leaveUseVo.getBuildingAreaRentArea());
  242. avera=formatDouble(avera);
  243. leaveUseVo.setAverage(avera);
  244. Calendar cal1=Calendar.getInstance();
  245. cal1.setTime(leaveUseVo.getBuildingStartyear());
  246. int year1=cal1.get(Calendar.YEAR);
  247. Calendar cal2=Calendar.getInstance();
  248. cal2.setTime(new Date());
  249. int year2=cal2.get(Calendar.YEAR);
  250. int num=year2-year1;
  251. leaveUseVo.setHouseYearNum(num);
  252. List<FloorNoUserVo> list;
  253. if(map.get(leaveUseVo.getCity())!=null){
  254. list=map.get(leaveUseVo.getCity());
  255. list.add(leaveUseVo);
  256. }else{
  257. list=new ArrayList<>();
  258. list.add(leaveUseVo);
  259. }
  260. map.put(leaveUseVo.getCity(),list);
  261. }
  262. List<HouseYearVo> resultList=new ArrayList<>();
  263. for(Map.Entry<String,List<FloorNoUserVo>> entry:map.entrySet()){
  264. List<FloorNoUserVo> list=entry.getValue();
  265. //对该list相同的县进行统计
  266. Map<String,List<FloorNoUserVo>> leaveMap=new HashMap<>();
  267. for (FloorNoUserVo leaveUseVo : list) {
  268. if(leaveMap.get(leaveUseVo.getCounty())!=null){
  269. list=leaveMap.get(leaveUseVo.getCounty());
  270. list.add(leaveUseVo);
  271. }else{
  272. list=new ArrayList<>();
  273. list.add(leaveUseVo);
  274. }
  275. leaveMap.put(leaveUseVo.getCounty(),list);
  276. }
  277. List<HouseYearVo> houseYearVoList=new ArrayList<>();
  278. for (Map.Entry<String,List<FloorNoUserVo>> entry1:leaveMap.entrySet()){
  279. List<FloorNoUserVo> value = entry1.getValue();
  280. HouseYearVo yearVo=new HouseYearVo();
  281. yearVo.setCity(value.get(0).getCity());
  282. yearVo.setCityName(value.get(0).getCityName());
  283. yearVo.setCounty(value.get(0).getCounty());
  284. yearVo.setCountyName(value.get(0).getCountyName());
  285. for (FloorNoUserVo leaveUseVo : value) {
  286. }
  287. houseYearVoList.add(yearVo);
  288. }
  289. HouseYearVo parent=new HouseYearVo();
  290. parent.setCity(houseYearVoList.get(0).getCity());
  291. parent.setCountyName(houseYearVoList.get(0).getCityName());
  292. parent.setChildren(houseYearVoList);
  293. resultList.add(parent);
  294. }
  295. int total = wzLandManageDetailsService.queryTotal(query);
  296. PageUtils pageUtil = new PageUtils(resultList, total, query.getLimit(), query.getPage());
  297. return R.ok().put("page", pageUtil);
  298. }
  299. // /**
  300. // * 土地记录
  301. // */
  302. // @RequestMapping("/queryLandDetail")
  303. // @IgnoreAuth
  304. // public R queryHouseDetail(@RequestBody PageMap pageMap) {
  305. // //查询列表数据
  306. // Query query = new Query(pageMap);
  307. // List<WzLandManageDetailsEntity> list = wzLandManageDetailsService.queryList(query);
  308. // Query query1 = new Query(pageMap);
  309. // int total = wzLandManageDetailsService.queryTotal(query1);
  310. // PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
  311. // return R.ok().put("page", pageUtil);
  312. // }
  313. /**
  314. * 土地记录
  315. */
  316. @RequestMapping("/queryLandDetailByCode")
  317. @IgnoreAuth
  318. public R queryHouseDetailByCode(@RequestBody PageMap pageMap) {
  319. //查询列表数据
  320. // Query query = new Query(pageMap);
  321. Map<String,Object> query=new HashMap<>();
  322. query.putAll(pageMap.getMap());
  323. List<WzLandManageDetailsEntity> list = wzLandManageDetailsService.queryList(query);
  324. Query query1 = new Query(pageMap);
  325. int total = wzLandManageDetailsService.queryTotal(query1);
  326. PageUtils pageUtil = new PageUtils(list, total, 0, 0);
  327. return R.ok().put("page", pageUtil);
  328. }
  329. /**
  330. * 清单excel
  331. *
  332. * @param response
  333. */
  334. @GetMapping("/excel")
  335. @IgnoreAuth
  336. public void excel(String name,String buildingNameAlias,String city,String county, HttpServletResponse response) {
  337. DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
  338. ExcelExport ee1 = new ExcelExport("报表" + df.format(new Date()));
  339. Map<String,Object> map=new HashMap<>();
  340. if(buildingNameAlias!=null){
  341. map.put("buildingNameAlias",buildingNameAlias);
  342. }
  343. if(city!=null){
  344. map.put("city",city);
  345. }
  346. if(county!=null){
  347. map.put("county",county);
  348. }
  349. //判定是闲置管理还是记录
  350. if(name.contains("记录")){
  351. ee1 = new ExcelExport("土地管理_土地记录" + df.format(new Date()));
  352. responseLandDetail(df,ee1,map);
  353. ee1.export(response);
  354. }else{
  355. ee1 = new ExcelExport("土地管理_闲置管理" + df.format(new Date()));
  356. responseLandEchart(df,ee1,map);
  357. ee1.export(response);
  358. }
  359. }
  360. public void responseLandEchart(DateFormat df, ExcelExport ee1, Map<String, Object> map1){
  361. try {
  362. int repeatNum=0;
  363. //全省节点
  364. FloorNoUserVo province=new FloorNoUserVo();
  365. province.setCity("全省");
  366. province.setCounty("全省");
  367. List<FloorNoUserVo> leaveUseVoList = wzLandManageDetailsService.queryLeaveUseList(map1);
  368. Map<String,List<FloorNoUserVo>> map=new HashMap<>();
  369. for (FloorNoUserVo leaveUseVo : leaveUseVoList) {
  370. double avera=0l;
  371. if(leaveUseVo.getBuildingAreaIdelArea()+leaveUseVo.getBuildingAreaRentArea()==0){
  372. avera=0;
  373. }else{
  374. avera=leaveUseVo.getBuildingAreaIdelArea()/(leaveUseVo.getBuildingAreaIdelArea()+leaveUseVo.getBuildingAreaRentArea());
  375. avera=formatDouble(avera)*100;
  376. }
  377. leaveUseVo.setAverage(avera);
  378. List<FloorNoUserVo> list;
  379. if(map.get(leaveUseVo.getCity())!=null){
  380. list=map.get(leaveUseVo.getCity());
  381. list.add(leaveUseVo);
  382. }else{
  383. list=new ArrayList<>();
  384. list.add(leaveUseVo);
  385. }
  386. map.put(leaveUseVo.getCity(),list);
  387. }
  388. List<FloorNoUserVo> resultList=new ArrayList<>();
  389. List<FloorNoUserVo> cityList=new ArrayList<>();
  390. double abuildingAreaIdelArea=0l;
  391. double abuildingAreaRentArea=0l;
  392. double abuildArea=0l;
  393. double abuildingAreaUnavailable=0l;
  394. double abuildingAreaUseArea=0l;
  395. for(Map.Entry<String,List<FloorNoUserVo>> entry:map.entrySet()) {
  396. List<FloorNoUserVo> list = entry.getValue();
  397. //对该list相同的县进行统计
  398. Map<String, List<FloorNoUserVo>> countyMap = new HashMap<>();
  399. for (FloorNoUserVo leaveUseVo : list) {
  400. if (countyMap.get(leaveUseVo.getCounty()) != null) {
  401. list = countyMap.get(leaveUseVo.getCounty());
  402. list.add(leaveUseVo);
  403. } else {
  404. list = new ArrayList<>();
  405. list.add(leaveUseVo);
  406. }
  407. countyMap.put(leaveUseVo.getCounty(), list);
  408. }
  409. List<FloorNoUserVo> countyList = new ArrayList<>();
  410. double citybuildingAreaIdelArea = 0l;
  411. double citybuildingAreaRentArea = 0l;
  412. double citybuildArea = 0l;
  413. double citybuildingAreaUnavailable = 0l;
  414. double citybuildingAreaUseArea = 0l;
  415. for (Map.Entry<String, List<FloorNoUserVo>> countyEntry : countyMap.entrySet()) {
  416. double buildingAreaIdelArea = 0l;
  417. double buildingAreaRentArea = 0l;
  418. double buildArea = 0l;
  419. double buildingAreaUnavailable = 0l;
  420. double buildingAreaUseArea = 0l;
  421. String reapStr="";
  422. if (countyEntry.getKey().equals("市本部")){
  423. reapStr="市本部"+repeatNum;
  424. repeatNum++;
  425. }
  426. FloorNoUserVo county = new FloorNoUserVo();
  427. for (FloorNoUserVo leaveUseVo : countyEntry.getValue()) {
  428. county.setCity(leaveUseVo.getCounty());
  429. county.setCounty(leaveUseVo.getCounty());
  430. if(!reapStr.equals("")){
  431. county.setCity(reapStr);
  432. county.setCounty(reapStr);
  433. county.setCountyName(reapStr);
  434. }
  435. buildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  436. buildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  437. buildArea += leaveUseVo.getBuildingArea();
  438. buildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  439. buildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  440. citybuildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  441. citybuildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  442. citybuildArea += leaveUseVo.getBuildingArea();
  443. citybuildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  444. citybuildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  445. abuildingAreaIdelArea += leaveUseVo.getBuildingAreaIdelArea();
  446. abuildingAreaRentArea += leaveUseVo.getBuildingAreaRentArea();
  447. abuildArea += leaveUseVo.getBuildingArea();
  448. abuildingAreaUnavailable += leaveUseVo.getBuildingAreaUnavailable();
  449. abuildingAreaUseArea += leaveUseVo.getBuildingAreaUseArea();
  450. }
  451. double avera=0;
  452. if(buildingAreaIdelArea+buildingAreaRentArea==0){
  453. avera=0;
  454. }else{
  455. try{
  456. avera=formatDouble(buildingAreaIdelArea/(buildingAreaRentArea+buildingAreaIdelArea))*100;
  457. }catch (Exception e){
  458. e.printStackTrace();
  459. }
  460. }
  461. county.setBuildingArea(formatDouble(buildArea));
  462. county.setBuildingAreaIdelArea(formatDouble(buildingAreaIdelArea));
  463. county.setBuildingAreaUnavailable(formatDouble(buildingAreaUnavailable));
  464. county.setBuildingAreaUseArea(formatDouble(buildingAreaUseArea));
  465. county.setBuildingAreaRentArea(formatDouble(buildingAreaRentArea));
  466. county.setAverage(formatDouble(avera));
  467. countyList.add(county);
  468. }
  469. List<FloorNoUserVo> orderCountyList=new ArrayList<>();
  470. try{
  471. //对countList 进行排序
  472. OtnAreaEntity area=otnAreaService.queryObject(list.get(0).getCity());
  473. List<OtnAreaEntity> countyAreaList=otnAreaService.getCityOption(area.getId());
  474. for (OtnAreaEntity otnAreaEntity : countyAreaList) {
  475. for (FloorNoUserVo wzCity : countyList) {
  476. if(wzCity.getCity().contains(otnAreaEntity.getName())){
  477. orderCountyList.add(wzCity);
  478. }
  479. }
  480. }
  481. }catch (Exception e){
  482. orderCountyList=countyList;
  483. e.printStackTrace();
  484. }
  485. double avera;
  486. if(citybuildingAreaRentArea+citybuildingAreaIdelArea==0){
  487. avera=0;
  488. }else{
  489. avera=formatDouble(citybuildingAreaIdelArea/(citybuildingAreaRentArea+citybuildingAreaIdelArea))*100;
  490. }
  491. FloorNoUserVo parent = new FloorNoUserVo();
  492. parent.setBuildingArea(formatDouble(citybuildArea));
  493. parent.setBuildingAreaIdelArea(formatDouble(citybuildingAreaIdelArea));
  494. parent.setBuildingAreaUnavailable(formatDouble(citybuildingAreaUnavailable));
  495. parent.setBuildingAreaUseArea(formatDouble(citybuildingAreaUseArea));
  496. parent.setBuildingAreaRentArea(formatDouble(citybuildingAreaRentArea));
  497. parent.setCity(list.get(0).getCity());
  498. parent.setCountyName(list.get(0).getCityName());
  499. parent.setAverage(formatDouble(avera));
  500. parent.setChildren(orderCountyList);
  501. cityList.add(parent);
  502. }
  503. //对cityList 进行排序
  504. List<OtnAreaEntity> areaList=otnAreaService.getCityOption("018");
  505. List<FloorNoUserVo> orderList=new ArrayList<>();
  506. for (OtnAreaEntity otnAreaEntity : areaList) {
  507. for (FloorNoUserVo wzCity : cityList) {
  508. if(otnAreaEntity.getName().equals(wzCity.getCity())){
  509. orderList.add(wzCity);
  510. }
  511. }
  512. }
  513. double aavera;
  514. if(abuildingAreaRentArea+abuildingAreaIdelArea==0){
  515. aavera=0;
  516. }else{
  517. aavera=formatDouble(abuildingAreaIdelArea/(abuildingAreaRentArea+abuildingAreaIdelArea))*100;
  518. }
  519. province.setBuildingArea(formatDouble(abuildArea));
  520. province.setBuildingAreaIdelArea(formatDouble(abuildingAreaIdelArea));
  521. province.setBuildingAreaUnavailable(formatDouble(abuildingAreaUnavailable));
  522. province.setBuildingAreaUseArea(formatDouble(abuildingAreaUseArea));
  523. province.setBuildingAreaRentArea(formatDouble(abuildingAreaRentArea));
  524. province.setAverage(formatDouble(aavera));
  525. province.setChildren(orderList);
  526. resultList.add(province);
  527. List<Object> colList=new ArrayList();;
  528. List<Object[]> allList = new ArrayList();
  529. for (int i = 0; i < resultList.size(); i++) {
  530. if(resultList.get(i).getCity().contains("省")){
  531. colList = new ArrayList();
  532. colList.add(resultList.get(i).getCity());
  533. colList.add("");
  534. colList.add("");
  535. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getBuildingArea(),true));
  536. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getBuildingAreaUnavailable(),true));
  537. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getBuildingAreaUseArea(),true));
  538. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getBuildingAreaIdelArea(),true));
  539. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getBuildingAreaRentArea(),true));
  540. colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getAverage(),true));
  541. allList.add(colList.toArray());
  542. //处理城市的
  543. List<FloorNoUserVo> cityList1=resultList.get(i).getChildren();
  544. for (FloorNoUserVo floorNoUserVo : cityList1) {
  545. colList = new ArrayList();
  546. colList.add("");
  547. colList.add(floorNoUserVo.getCity());
  548. colList.add("");
  549. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getBuildingArea(),true));
  550. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getBuildingAreaUnavailable(),true));
  551. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getBuildingAreaUseArea(),true));
  552. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getBuildingAreaIdelArea(),true));
  553. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getBuildingAreaRentArea(),true));
  554. colList.add(WzHouseMaintenaCostController.toThousands(floorNoUserVo.getAverage(),true));
  555. allList.add(colList.toArray());
  556. //处理县城的
  557. List<FloorNoUserVo> countyList1=floorNoUserVo.getChildren();
  558. for (FloorNoUserVo noUserVo : countyList1) {
  559. colList = new ArrayList();
  560. colList.add("");
  561. colList.add("");
  562. colList.add(noUserVo.getCity());
  563. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getBuildingArea(),true));
  564. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getBuildingAreaUnavailable(),true));
  565. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getBuildingAreaUseArea(),true));
  566. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getBuildingAreaIdelArea(),true));
  567. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getBuildingAreaRentArea(),true));
  568. colList.add(WzHouseMaintenaCostController.toThousands(noUserVo.getAverage(),true));
  569. allList.add(colList.toArray());
  570. }
  571. }
  572. }
  573. }
  574. String[] header = new String[]{
  575. "资产所属单位(一级)",
  576. "资产所属单位(二级)",
  577. "资产所属单位(三级)",
  578. "总面积",
  579. "不可使用面积",
  580. "自用面积",
  581. "闲置面积",
  582. "出租面积",
  583. "闲置率"
  584. };
  585. ee1.addSheetByArray(df.format(new Date()) + "清单", allList, header);
  586. } catch (Exception e) {
  587. e.printStackTrace();
  588. }
  589. }
  590. public void responseLandDetail(DateFormat df, ExcelExport ee1, Map<String, Object> map){
  591. try {
  592. List<WzLandManageDetailsEntity> list = wzLandManageDetailsService.queryList(map);
  593. List<Object> colList;
  594. List<Object[]> allList = new ArrayList();
  595. for (int i = 0; i < list.size(); i++) {
  596. colList = new ArrayList();
  597. colList.add(list.get(i).getProvince());
  598. colList.add(list.get(i).getCity());
  599. colList.add(list.get(i).getCounty());
  600. colList.add(list.get(i).getLandAlias());
  601. colList.add(list.get(i).getLandNature());
  602. colList.add(list.get(i).getUsageRightsType());
  603. colList.add(list.get(i).getLandUse());
  604. colList.add(list.get(i).getGetDate());
  605. colList.add(list.get(i).getIdelLandBegindate());
  606. colList.add(list.get(i).getBuildingNameAlias());
  607. colList.add(list.get(i).getStandardAddress());
  608. colList.add(list.get(i).getInvestmentEntity()); //投资主体
  609. colList.add(list.get(i).getManagementHierarchy()); //管理层级
  610. colList.add(list.get(i).getOwnershipStatus()); //权属状态
  611. colList.add(list.get(i).getUseState()); //使用状态
  612. colList.add(list.get(i).getTotalLandArea()); //土地总面积(㎡)
  613. colList.add(list.get(i).getLandSelfUseArea()); //土地自用面积(㎡)
  614. colList.add(list.get(i).getIdelLandBegindate()); //土地闲置面积(㎡)
  615. colList.add(list.get(i).getLandRentUseArea()); //土地出租面积(㎡)
  616. colList.add(list.get(i).getLanNoUnavailableArea()); //土地不可使用面积(㎡)
  617. colList.add(list.get(i).getLandCertificate()); //是否有土地证
  618. colList.add(list.get(i).getNoLandCertificateReason()); //无土地证原因
  619. colList.add(list.get(i).getProtectLandRisk()); //是否有保地风险
  620. colList.add(list.get(i).getClearingLand()); //是否空地
  621. colList.add(list.get(i).getCourtyard()); //是否有院落
  622. colList.add(list.get(i).getUnrelatedAssets()); //未关联资产
  623. colList.add(list.get(i).getAssetCode()); //资产编号
  624. colList.add(list.get(i).getAstsLabe()); //资产标签号
  625. colList.add(list.get(i).getResponsibleDepartment()); //责任部门
  626. colList.add(list.get(i).getResponsiblePerson()); //责任人
  627. colList.add(list.get(i).getBuildingLongitude()); //经度
  628. colList.add(list.get(i).getBuildingDimension()); //纬度
  629. colList.add(list.get(i).getBuildingActualPropertyOwner()); //实际产权人
  630. colList.add(list.get(i).getSpecialInstructions()); //特殊说明
  631. colList.add(list.get(i).getUseAreaIdelArea()); //使用面积-闲置(㎡)
  632. colList.add(list.get(i).getUseAreaUnavailableArea()); //使用面积-不可使用(㎡)
  633. colList.add(list.get(i).getLandManageName()); //楼长姓名
  634. colList.add(list.get(i).getLandManageCompany()); //楼长所在单位
  635. colList.add(list.get(i).getLandLongitude()); //土地经度
  636. colList.add(list.get(i).getLandDimension()); //土地纬度
  637. colList.add(list.get(i).getLandActualPropertyOwner()); //土地实际产权人
  638. allList.add(colList.toArray());
  639. }
  640. String[] header = new String[]{
  641. "资产所属单位(一级)",
  642. "资产所属单位(二级)",
  643. "资产所属单位(三级)",
  644. "土地别名",
  645. "土地性质",
  646. "使用权类型",
  647. "地类用途",
  648. "取得日期",
  649. "闲置开始时间",
  650. "局址别名",
  651. "标准地址",
  652. "投资主体",
  653. "管理层级",
  654. "权属状态",
  655. "使用状态",
  656. "土地总面积(㎡)",
  657. "土地自用面积(㎡)",
  658. "土地闲置面积(㎡)",
  659. "土地出租面积(㎡)",
  660. "土地不可使用面积(㎡)",
  661. "是否有土地证",
  662. "无土地证原因",
  663. "是否有保地风险",
  664. "是否空地",
  665. "是否有院落",
  666. "未关联资产",
  667. "资产编号",
  668. "资产标签号",
  669. "责任部门",
  670. "责任人",
  671. "经度",
  672. "纬度",
  673. "实际产权人",
  674. "特殊说明",
  675. "使用面积-闲置(㎡)",
  676. "使用面积-不可使用(㎡)",
  677. "楼长姓名",
  678. "楼长所在单位",
  679. "土地经度",
  680. "土地纬度",
  681. "土地实际产权人"
  682. };
  683. ee1.addSheetByArray(df.format(new Date()) + "清单", allList, header);
  684. } catch (Exception e) {
  685. e.printStackTrace();
  686. }
  687. }
  688. public double formatDouble(double num){
  689. DecimalFormat format2 = new DecimalFormat("#.0000");
  690. String str2 = format2.format(num);
  691. double avera = Double.parseDouble(str2);
  692. return avera;
  693. }
  694. // /**
  695. // * 获取局址别名
  696. // */
  697. // @RequestMapping("/getBuildingNameCode")
  698. // @IgnoreAuth
  699. // public R getBuildingNameCode(@RequestBody PageMap pageMap) {
  700. // //查询列表数据
  701. // Query query = new Query(pageMap);
  702. // List<String> list = wzLandManageDetailsService.getBuildingNameCode(query);
  703. // Query query1 = new Query(pageMap);
  704. // int total = wzLandManageDetailsService.queryBuildingNameCodeTotal(query1);
  705. // PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
  706. // return R.ok().put("page", pageUtil);
  707. // }
  708. //
  709. // /**
  710. // * 获取局址别名
  711. // */
  712. // @RequestMapping("/getBuildingNameAlias")
  713. // @IgnoreAuth
  714. // public R getBuildingNameAlias(@RequestBody PageMap pageMap) {
  715. // //查询列表数据
  716. // Query query = new Query(pageMap);
  717. // List<String> list = wzLandManageDetailsService.getBuildingNameAlias(query);
  718. // Query query1 = new Query(pageMap);
  719. // int total = wzLandManageDetailsService.getBuildingNameAliasTotal(query1);
  720. // PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
  721. // return R.ok().put("page", pageUtil);
  722. // }
  723. }