zouxuan %!s(int64=5) %!d(string=hai) anos
pai
achega
73b964f94d

+ 10 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java

@@ -81,14 +81,16 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
 	public PageInfo queryDetailPage(SporadicChargeInfoQueryInfo queryInfo) {
 		PageInfo<SporadicChargeInfo> pageInfo = queryPage(queryInfo);
 		List<SporadicChargeInfo> rows = pageInfo.getRows();
-		Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
-		Set<Integer> operatorIds = rows.stream().map(e -> e.getOperatorId()).collect(Collectors.toSet());
-        Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
-        Map<Integer,String> OperatorNames = MapUtil.convertMybatisMap(teacherDao.queryNameByIds(StringUtils.join(operatorIds,",")));
-		rows.forEach(e->{
-			e.setOrganName(organNames.get(e.getOrganId()));
-			e.setOperatorName(OperatorNames.get(e.getOperatorId()));
-		});
+		if(rows != null && rows.size() > 0){
+			Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
+			Set<Integer> operatorIds = rows.stream().map(e -> e.getOperatorId()).collect(Collectors.toSet());
+			Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
+			Map<Integer,String> OperatorNames = MapUtil.convertMybatisMap(teacherDao.queryNameByIds(StringUtils.join(operatorIds,",")));
+			rows.forEach(e->{
+				e.setOrganName(organNames.get(e.getOrganId()));
+				e.setOperatorName(OperatorNames.get(e.getOperatorId()));
+			});
+		}
 		return pageInfo;
 	}
 }

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -263,7 +263,7 @@
         GROUP BY su.id_,s.id_
     </select>
     <select id="queryNameByIds" resultType="java.util.Map" parameterType="list">
-        select id_ `key`,real_name_ `value` FROM sys_user s WHERE FIND_IN_SET(id_,#{userIds})
+        select id_ `key`,IF(real_name_ IS NUll,'',real_name_) `value` FROM sys_user s WHERE FIND_IN_SET(id_,#{userIds})
     </select>
 
     <select id="queryPhoneByIds" resultType="java.util.Map" parameterType="list">

+ 0 - 1
mec-im/src/main/java/com/ym/service/Impl/HereWhiteServiceImpl.java

@@ -2,7 +2,6 @@ package com.ym.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ym.dao.HereWhiteDao;
-import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.pojo.HereWhite;

+ 8 - 44
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -16,10 +16,10 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -39,34 +39,6 @@ public class ExportController extends BaseController {
     @Autowired
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
 
-    /*@RequestMapping("order/musicalListExport")
-    public ResponseEntity<byte[]> exportExcel(String musicGroupId) {
-        // 每次只需要改这几行
-        List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId);
-        if(musicalList == null || musicalList.size() < 1){
-            throw new BizException("数据为空");
-        }
-        String fileName = "乐器采购清单";
-        String[] headers = new String[] {"乐团","分部","商品类型", "商品名称", "型号", "数量"};
-        String[] getters  = new String[] {"getMemo","getBrief","getType","getName","getSpecification","getSellCount"};
-        Workbook wb = POIUtil.createWorkBook(musicalList, getters, headers,Goods.class);
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
-        try {
-            wb.write(os);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        byte[] content = os.toByteArray();
-        HttpHeaders httpHeaders = new HttpHeaders();
-        try {
-            fileName = URLEncoder.encode(fileName, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        httpHeaders.setContentDispositionFormData("attachment", fileName + ".xlsx");
-        return new ResponseEntity<>(content, httpHeaders, HttpStatus.OK);
-    }*/
-
     @ApiOperation(value = "导出乐器采购清单")
     @PostMapping("order/musicalListExport")
     public void musicalListExport(HttpServletResponse response, String musicGroupId){
@@ -98,30 +70,22 @@ public class ExportController extends BaseController {
 
     @ApiOperation(value = "乐团【报名中、缴费中】 学生详情列表导出")
     @PostMapping(value = "studentRegistration/queryStudentApplyDetailExport")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/queryStudentApplyDetailExport')")
     public void queryStudentApplyDetailExport(StudentRegistrationQueryInfo queryInfo, HttpServletResponse response) {
         List<StudentApplyDetailDto> studentApplyDetail = studentRegistrationService.queryStudentDetailPage(queryInfo).getRows();
         if(studentApplyDetail == null || studentApplyDetail.size() < 1){
             throw new BizException("数据为空");
         }
-        OutputStream outputStream = null;
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[] { "学生姓名","家长姓名", "年级", "班级", "性别", "服从调剂","报名专业", "实际专业","联系电话", "学员缴费状态", "乐器购买方式"}, new String[] {
-                    "studentName","parentsName", "currentGrade", "currentClass", "gender", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone","paymentStatus","kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
-            response.setContentType("application/vnd.ms-excel");
-            response.setHeader("Content-disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
-            outputStream = response.getOutputStream();
-            workbook.write(outputStream);
-            outputStream.flush();
+                    "studentName","parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone","paymentStatus.desc","kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            workbook.write(response.getOutputStream());
+            workbook.close();
         } catch (Exception e) {
             e.printStackTrace();
-        } finally {
-            if (outputStream != null) {
-                try {
-                    outputStream.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
         }
     }