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