| 
					
				 | 
			
			
				@@ -14,8 +14,10 @@ import com.ym.mec.common.page.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.collection.MapUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.excel.POIUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.OutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -87,6 +90,9 @@ public class ExportController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private DegreeRegistrationService degreeRegistrationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private CooperationOrganService cooperationOrganService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "导出教师考勤列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("export/queryTeacherAttendances") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PreAuthorize("@pcs.hasPermissions('export/queryTeacherAttendances')") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1622,4 +1628,60 @@ public class ExportController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation(value = "合作单位导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RequestMapping("export/cooperationOrgan") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PreAuthorize("@pcs.hasPermissions('export/cooperationOrgan')") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void cooperationOrgan(CooperationOrganQueryInfo queryInfo,HttpServletResponse response) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	SysUser sysUser = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (sysUser == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new IOException("用户信息获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(!sysUser.getIsSuperAdmin()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Employee employee = employeeDao.get(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (StringUtils.isEmpty(queryInfo.getOrganId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				queryInfo.setOrganId(employee.getOrganIdList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else if(StringUtils.isEmpty(employee.getOrganIdList())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				throw new IOException("用户所在分部异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<String> list = Arrays.asList(employee.getOrganIdList().split(",")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					throw new IOException("非法请求"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        queryInfo.setRows(65000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageInfo<CooperationOrgan> pageList = cooperationOrganService.queryPage(queryInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (pageList.getTotal() <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setStatus(200); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setContentType("Content-Type: application/json;charset=UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.flushBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OutputStream outputStream = response.getOutputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String[] header = {"分部", "单位编号", "单位名称", "联系人", "职位", "手机号", "是否启用"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String[] body = {"organization.name", "id", "name", "linkman", "job", "mobileNo", "address", "ownershipType.desc", "isEnable"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            HSSFWorkbook workbook = POIUtil.exportExcel(header, body, pageList.getRows()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setContentType("application/octet-stream"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setHeader("Content-Disposition", "attachment;filename=cooperationOrgan-" + DateUtil.getDate(new Date()) + ".xls"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.flushBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream = response.getOutputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            workbook.write(outputStream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (outputStream != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    outputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |