| 
														
															@@ -1,22 +1,75 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 package com.sysu.admin.controller.lz.ns.site; 
														 | 
														
														 | 
														
															 package com.sysu.admin.controller.lz.ns.site; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.lz.ns.NsActionRecordService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.lz.ns.NsActionTreeService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.lz.ns.NsActionTreeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.lz.ns.bean.NsActionRecord; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.lz.ns.bean.NsActionTree; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.lz.tree.LzTree; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.lz.tree.LzTreeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.site.CommonVo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 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 org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+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.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @RequestMapping("/site/ns_action_record") 
														 | 
														
														 | 
														
															 @RequestMapping("/site/ns_action_record") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @RestController 
														 | 
														
														 | 
														
															 @RestController 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 public class NsActionRecordController { 
														 | 
														
														 | 
														
															 public class NsActionRecordController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private NsActionTreeService nsActionTreeService; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private NsActionRecordService nsActionRecordService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private NsActionTreeService actionTreeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private LzTreeService lzTreeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/list") 
														 | 
														
														 | 
														
															     @RequestMapping("/list") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public BaseResult list(){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public BaseResult list(@RequestBody CommonVo commonVo){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<LzTree> treeList = lzTreeService.findListByAreaId(commonVo.getAreaId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<Integer> ids = new ArrayList<>(treeList.size()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        treeList.stream().forEach(lzTree -> ids.add(lzTree.getId())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<NsActionTree> nsActionTrees = actionTreeService.findAll(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Map<Integer, NsActionTree>  integerNsActionTreeMap =  listToMap(nsActionTrees); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<NsActionRecord> res = nsActionRecordService.findAllByTreeIds(ids, commonVo.getFinished()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        res.stream().forEach(nsActionRecord -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            NsActionTree actionTree = integerNsActionTreeMap.get(nsActionRecord.getActionId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            nsActionRecord.setActionName(actionTree.getName()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            nsActionRecord.setTypeId(actionTree.getTypeId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return R.succ(res); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public Map<Integer, NsActionTree> listToMap(List<NsActionTree> nsActionTrees){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Map<Integer, NsActionTree> map = new HashMap<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        nsActionTrees.forEach(nsActionTree -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            map.put(nsActionTree.getId(), nsActionTree); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return map; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @RequestMapping("/save") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public BaseResult save(@RequestBody ActionRecordVo actionRecordVo){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<LzTree> treeList = lzTreeService.findListByCodes(actionRecordVo.getCodes()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Date now = new Date(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<NsActionRecord> nsActionRecordList = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        treeList.stream().forEach(tree -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            actionRecordVo.getActionIds().stream().forEach(actionId -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                NsActionRecord nsActionRecord = new NsActionRecord(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecord.setTreeId(tree.getId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecord.setActionId(actionId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecord.setFinished(actionRecordVo.getFinished()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecord.setSource(actionRecordVo.getSource()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecord.setCreateDate(now); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                nsActionRecordList.add(nsActionRecord); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        nsActionRecordService.saveAll(nsActionRecordList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return R.succ(); 
														 | 
														
														 | 
														
															         return R.succ(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |