|
@@ -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')")
|
|
@@ -1624,7 +1630,62 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "考级报名导出")
|
|
|
+ @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", "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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "报名中缴费中乐团缴费情况导出")
|
|
|
@RequestMapping("export/musicGroupRegister")
|
|
|
@PreAuthorize("@pcs.hasPermissions('export/musicGroupRegister')")
|
|
|
public void degreeRegistration(String organIds, HttpServletResponse response) throws IOException {
|
|
@@ -1678,7 +1739,6 @@ public class ExportController extends BaseController {
|
|
|
body.add("totalMoney");
|
|
|
|
|
|
|
|
|
-
|
|
|
List<Map<String, Object>> data = new ArrayList<>();
|
|
|
for (MusicGroupRegisterDto musicGroupRegister : musicGroupRegisters) {
|
|
|
added.clear();
|
|
@@ -1705,7 +1765,7 @@ public class ExportController extends BaseController {
|
|
|
musicGroupRegisterMap.put("subject" + registerSubject.getSubjectId(), registerSubject.getNum());
|
|
|
registerPayNum += registerSubject.getNum();
|
|
|
}
|
|
|
- if(!added.contains(registerSubject.getSubjectId())){
|
|
|
+ if (!added.contains(registerSubject.getSubjectId())) {
|
|
|
musicGroupRegisterMap.put("subject" + registerSubject.getSubjectId(), 0);
|
|
|
}
|
|
|
}
|