| 
														
															@@ -10,9 +10,11 @@ import com.sysu.admin.controller.lz.period.WarningCondition; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.lz.tree.LzTree; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.lz.tree.LzTree; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.lz.tree.LzTreeService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.lz.tree.LzTreeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.site.CommonVo; 
														 | 
														
														 | 
														
															 import com.sysu.admin.site.CommonVo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.utils.MySimpleDateFormat; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.utils.shape.GeoCastUtil; 
														 | 
														
														 | 
														
															 import com.sysu.admin.utils.shape.GeoCastUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.xiesx.fastboot.base.result.BaseResult; 
														 | 
														
														 | 
														
															 import com.xiesx.fastboot.base.result.BaseResult; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.xiesx.fastboot.base.result.R; 
														 | 
														
														 | 
														
															 import com.xiesx.fastboot.base.result.R; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.xiesx.fastboot.utils.DateUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.locationtech.jts.geom.MultiPolygon; 
														 | 
														
														 | 
														
															 import org.locationtech.jts.geom.MultiPolygon; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.locationtech.jts.geom.Point; 
														 | 
														
														 | 
														
															 import org.locationtech.jts.geom.Point; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -20,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestBody; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.web.bind.annotation.RequestMapping; 
														 | 
														
														 | 
														
															 import org.springframework.web.bind.annotation.RequestMapping; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.web.bind.annotation.RestController; 
														 | 
														
														 | 
														
															 import org.springframework.web.bind.annotation.RestController; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.util.ArrayList; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.util.Calendar; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.util.Date; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.List; 
														 | 
														
														 | 
														
															 import java.util.List; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @RequestMapping("/site/lz_tree") 
														 | 
														
														 | 
														
															 @RequestMapping("/site/lz_tree") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -37,35 +42,33 @@ public class LzTreeController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/list") 
														 | 
														
														 | 
														
															     @RequestMapping("/list") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public BaseResult list(){ 
														 | 
														
														 | 
														
															     public BaseResult list(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<LzTree> list = lzTreeService.findAll(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<LzTree> list = lzTreeService.findAllByShow(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         list.forEach(lzTree -> { 
														 | 
														
														 | 
														
															         list.forEach(lzTree -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            lzTree.setWkt(GeoCastUtil.geomToWkt(lzTree.getPoint())); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             LzEveryday lzEveryday = lzTree.getLzEveryday(); 
														 | 
														
														 | 
														
															             LzEveryday lzEveryday = lzTree.getLzEveryday(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if(lzEveryday != null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                lzTree.setColor(WarningCondition.getWarningColor(lzEveryday.getLzPeriod().getId(), lzEveryday.getWhitePoint())); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                lzTree.setPartImgUrl(lzEveryday.getPartImgUrl()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            lzTree.setWkt(GeoCastUtil.geomToWkt(lzTree.getPoint())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            lzTree.setColor(WarningCondition.getWarningColor(lzEveryday.getLzPeriod().getId(), lzEveryday.getWhitePoint())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            lzTree.setPartImgUrl(lzEveryday.getPartImgUrl()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return R.succ(list); 
														 | 
														
														 | 
														
															         return R.succ(list); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/info") 
														 | 
														
														 | 
														
															     @RequestMapping("/info") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public BaseResult info(@RequestBody CommonVo commonVo){ 
														 | 
														
														 | 
														
															     public BaseResult info(@RequestBody CommonVo commonVo){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        LzTree bean = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if(commonVo.getId() != null) { 
														 | 
														
														 | 
														
															         if(commonVo.getId() != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            LzTree bean = lzTreeService.findOne(commonVo.getId().intValue()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<LzEveryday> lzEverydayList = everydayService.findListByTreeId(bean.getId()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            bean.setLzEverydays(lzEverydayList); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            return R.succ(bean); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            bean = lzTreeService.findOne(commonVo.getId().intValue()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }else{ 
														 | 
														
														 | 
														
															         }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            LzTree bean = lzTreeService.findByPoint(commonVo.getPoint(), 5); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if(bean != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                List<LzEveryday> lzEverydayList = everydayService.findListByTreeId(bean.getId()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                bean.setLzEverydays(lzEverydayList); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                return R.succ(bean); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            }else{ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            bean = lzTreeService.findByPoint(commonVo.getPoint(), 5); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if(bean == null){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return R.succ(); 
														 | 
														
														 | 
														
															                 return R.succ(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Date now = new Date(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Date start = getMonthBegin(DateUtils.addMonths(now, -1)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<LzEveryday> lzEverydayList = everydayService.findListByTreeId(bean.getId(),start, now); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        bean.setLzEverydays(lzEverydayList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return R.succ(bean); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/save") 
														 | 
														
														 | 
														
															     @RequestMapping("/save") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -80,4 +83,26 @@ public class LzTreeController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return R.succ(); 
														 | 
														
														 | 
														
															         return R.succ(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 获取指定时间戳所在月份开始的时间戳/秒 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public static Date getMonthBegin(Date date) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Calendar c = Calendar.getInstance(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.setTime(date); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //设置为1号,当前日期既为本月第一天 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.set(Calendar.DAY_OF_MONTH, 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //将小时至0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.set(Calendar.HOUR_OF_DAY, 0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //将分钟至0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.set(Calendar.MINUTE, 0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //将秒至0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.set(Calendar.SECOND,0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //将毫秒至0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        c.set(Calendar.MILLISECOND, 0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 获取本月第一天的时间戳 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return c.getTime(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |