Browse Source

管乐米迭代

zouxuan 3 years ago
parent
commit
7ef7e55412

+ 54 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -143,6 +143,60 @@ public class ExportController extends BaseController {
     private OrganizationService organizationService;
     @Autowired
     private MusicEnlightenmentQuestionnaireService musicEnlightenmentQuestionnaireService;
+    @Autowired
+    private MusicGroupService musicGroupService;
+
+    @ApiOperation(value = "乐团列表导出")
+    @PostMapping("export/musicGroup")
+    @PreAuthorize("@pcs.hasPermissions('export/musicGroup')")
+    public void exportMusicGroup(HttpServletResponse response, MusicGroupQueryInfo queryInfo) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            throw new BizException("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                throw new BizException("非法请求");
+            }
+        }
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+        List<MusicGroup> rows = musicGroupService.queryMusicGroupPage(queryInfo).getRows();
+        if(rows.size() < 1){
+            throw new BizException("没有可导出数据");
+        }
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "乐团编号", "乐团名称","合作单位", "乐团状态",
+                    "收费模式","收费类型","乐团主管","成团人数", "在读人数", "申请时间", "成团时间", "清单状态"}, new String[]{
+                    "organName", "id", "name","cooperationOrganName", "status.msg", "courseViewType.msg","chargeTypeName",
+                    "educationalTeacherName", "teamTeacherName", "groupMemberNum","payNum"
+                    ,"createTime","updateTime","hasVerifyMusicalList?'已确认':'未确认'"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attac:wq" +
+                    "hment;filename=classGroup-" + 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();
+                }
+            }
+        }
+    }
 
     @ApiOperation(value = "21年暑期考级活动统计页面详情导出")
     @PostMapping("export/statisticsDetail")

+ 24 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java

@@ -77,7 +77,6 @@ public class MusicGroupQuitController extends BaseController {
     private CloudTeacherOrderDao cloudTeacherOrderDao;
     @Autowired
     private TeacherDao teacherDao;
-    
     @Autowired
     private EmployeeDao employeeDao;
 
@@ -260,6 +259,30 @@ public class MusicGroupQuitController extends BaseController {
         return succeed(musicGroupService.approveQuitMusicGroup(roleIds, musicGroupQuit));
     }
 
+    @ApiOperation(value = "批量退团")
+    @PostMapping("/batchQuitMusicGroup")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupQuit/batchQuitMusicGroup')")
+    public HttpResponseResult batchQuitMusicGroup(@RequestBody List<MusicGroupQuit> musicGroupQuits) throws Exception {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		List<Integer> roleIds = new ArrayList<Integer>();
+		if(sysUser.getIsSuperAdmin() == true) {
+			roleIds.add(SysUserRole.SECTION_MANAGER);
+			roleIds.add(SysUserRole.EDUCATIONAL_TEACHER);
+		} else {
+			roleIds = employeeDao.queryUserRole(sysUser.getId());
+		}
+		if (!(roleIds.contains(SysUserRole.SECTION_MANAGER) || roleIds.contains(SysUserRole.EDUCATIONAL_TEACHER))) {
+			throw new BizException("未经授权,不能操作");
+		}
+        for (MusicGroupQuit musicGroupQuit : musicGroupQuits) {
+            musicGroupService.approveQuitMusicGroup(roleIds, musicGroupQuit);
+        }
+        return succeed();
+    }
+
     @ApiOperation(value = "一键退团")
     @PostMapping("/directQuitMusicGroup")
     @PreAuthorize("@pcs.hasPermissions('musicGroupQuit/directQuitMusicGroup')")