Forráskód Böngészése

Merge branch 'master' into feature-operating-report

周箭河 5 éve
szülő
commit
e6f1dc812a

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java

@@ -281,5 +281,5 @@ public interface MusicGroupDao extends BaseDAO<String, MusicGroup> {
      * @param organId:
      * @return java.util.List<com.ym.mec.biz.dal.dto.MusicCardDto>
      */
-    List<MusicCardDto> queryOrganMusicInfos(String organId);
+    List<MusicCardDto> queryOrganMusicInfos(Integer organId);
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/EmployeeInfo.java

@@ -237,6 +237,30 @@ public class EmployeeInfo {
 		return this.entryDate;
 	}
 
+	public boolean isInterviewed() {
+		return isInterviewed;
+	}
+
+	public void setInterviewed(boolean isInterviewed) {
+		this.isInterviewed = isInterviewed;
+	}
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
+	public boolean isProbationPeriod() {
+		return isProbationPeriod;
+	}
+
+	public void setProbationPeriod(boolean isProbationPeriod) {
+		this.isProbationPeriod = isProbationPeriod;
+	}
+
 	public void setPosition(JobTypeEnum position) {
 		this.position = position;
 	}

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/TemplateTypeEnum.java

@@ -0,0 +1,33 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum TemplateTypeEnum implements BaseEnum<String, TemplateTypeEnum> {
+    GOODS("GOODS","商品导入模板"),
+    FINANCIAL_EXPENDITURE("FINANCIAL_EXPENDITURE","财务支出导入模板");
+
+    private String code;
+
+    private String msg;
+
+    TemplateTypeEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/FinancialExpenditureService.java

@@ -17,5 +17,5 @@ public interface FinancialExpenditureService extends BaseService<Long, Financial
      * @param file:
      * @return java.lang.Object
      */
-    List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws IOException;
+    List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception;
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -291,7 +291,7 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * @param :
 	 * @return java.util.List<com.ym.mec.biz.dal.dto.MusicCardDto>
 	 */
-	List<MusicCardDto> queryOrganMusicInfos(String organId);
+	List<MusicCardDto> queryOrganMusicInfos(Integer organId);
 
 	/**
 	 * 补全musicGroupStudentFee表数据

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -2151,6 +2151,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         if(vipGroupCourseAdjustInfo.getCourseCreateStartTime().after(now)){
             teacherAttendanceDao.batchCleanCourseTeacherSignInfo(courseScheduleIds);
         }
+        studentAttendanceDao.deleteByCourseSchedules(courseScheduleIds);
 		//删除作业
 		courseHomeworkService.delHomwworkByCourseScheduleId(courseScheduleIds);
 		//删除评论
@@ -2403,7 +2404,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				List<StudentAttendance> studentAttendanceList = studentAttendanceDao.findByCourseId(oldCourseSchedule.getId());
 
 				for (StudentAttendance studentAttendance : studentAttendanceList) {
-					if (studentAttendance.getStatus() != StudentAttendanceStatusEnum.LEAVE) {
+					if (studentAttendance.getStatus() != StudentAttendanceStatusEnum.LEAVE
+						|| (studentAttendance.getStatus() != StudentAttendanceStatusEnum.LEAVE
+							&&DateUtil.addHours(studentAttendance.getCreateTime(),4).compareTo(oldCourseSchedule.getStartClassTime())>=0)) {
 						throw new BizException("{}[{}] {}-{}课程已点名", oldCourseSchedule.getName(), oldCourseSchedule.getId(), DateUtil.dateToString(
 								oldCourseSchedule.getStartClassTime(), DateUtil.EXPANDED_DATE_TIME_FORMAT), DateUtil.dateToString(
 								oldCourseSchedule.getEndClassTime(), DateUtil.EXPANDED_DATE_TIME_FORMAT));

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -4,6 +4,7 @@ package com.ym.mec.biz.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.FinancialExpenditureDao;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.IOException;
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
@@ -40,11 +41,10 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws IOException {
-		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(file.getInputStream(), 2, file.getOriginalFilename());
-		String fileName = file.getOriginalFilename().split("\\.")[0];
+	public List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception {
+		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
 		InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
-		Map<String,String> columns = IniFileUtil.readIniFile(inputStream,fileName);
+		Map<String,String> columns = IniFileUtil.readIniFile(inputStream,TemplateTypeEnum.FINANCIAL_EXPENDITURE.getMsg());
 		List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
 		Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
 		Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);

+ 3 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -5,13 +5,13 @@ import com.ym.mec.biz.dal.dao.GoodsCategoryDao;
 import com.ym.mec.biz.dal.dao.GoodsDao;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.enums.GoodsType;
+import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.UploadFileService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.UploadReturnBean;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.excel.IniFileUtil;
 import com.ym.mec.util.excel.POIUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -68,10 +68,9 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public List<Goods> importGoods(MultipartFile file) throws Exception {
-		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(file.getInputStream(), 2, file.getOriginalFilename());
+		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
 		InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
-		String fileName = file.getOriginalFilename().split(".")[0];
-		Map<String,String> columns = IniFileUtil.readIniFile(inputStream,fileName);
+		Map<String,String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.GOODS.getMsg());
 		List<Goods> goodsList = new ArrayList<>();
 //		Map<String, Integer> map = MapUtil.convertIntegerMap(goodsCategoryDao.queryCategotyMap());
 		Map<String, Integer> map = getMap("goods_category","name_","id_",true,String.class,Integer.class);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -996,7 +996,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
-    public List<MusicCardDto> queryOrganMusicInfos(String organId) {
+    public List<MusicCardDto> queryOrganMusicInfos(Integer organId) {
         return musicGroupDao.queryOrganMusicInfos(organId);
     }
 

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -592,8 +592,8 @@
         mg.id_ music_group_id_
         FROM music_group mg
         WHERE mg.status_ IN ('APPLY','PAY','PREPARE','PROGRESS')
-        <if test="organId != null and organId != ''">
-            AND FIND_IN_SET(mg.organ_id_,#{organId})
+        <if test="organId != null">
+            AND mg.organ_id_ = #{organId}
         </if>
         ORDER BY mg.create_time_ DESC
     </select>

+ 5 - 0
mec-im/pom.xml

@@ -96,6 +96,11 @@
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
     </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-all</artifactId>
+      <version>4.1.24.Final</version>
+    </dependency>
   </dependencies>
 
   <build>

+ 2 - 2
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -125,9 +125,9 @@ public class RoomServiceImpl implements RoomService {
         String userId = sysUser.getId().toString();
         Teacher teacher = teacherDao.get(Integer.parseInt(userId));
         CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
-        if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
+        /*if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
             throw new ApiException(ErrorEnum.JOIN_ROOM_ERROR, "加入房间失败,请前往线下教室");
-        }
+        }*/
         if(teacher != null && userId.equals(courseSchedule.getActualTeacherId())){
             courseScheduleStudentPaymentDao.adjustPlayMidi(Long.parseLong(roomId),null,null);
             userName = sysUser.getRealName();

+ 7 - 36
mec-util/src/main/java/com/ym/mec/util/excel/POIUtil.java

@@ -13,10 +13,7 @@ import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.text.SimpleDateFormat;
@@ -426,37 +423,15 @@ public class POIUtil {
 	 * @return
 	 * @throws IOException
 	 */
-	public static Map<String, List<Map<String, Object>>> importExcel(InputStream inputStream, int startRowNum, String extName) throws IOException {
-
-		Map<String, List<Map<String, Object>>> result = new HashMap<String, List<Map<String, Object>>>();
-
-		Workbook workbook = null;
-
-		try {
-			if (extName.endsWith(".xlsx")) {
-				// 支持excel2007 xlsx格式
-				workbook = new XSSFWorkbook(inputStream);
-			} else if (extName.endsWith(".xls")) {
-				// 支持excel2003以前 xls格式
-				workbook = new HSSFWorkbook(inputStream);
-			} else {
-				throw new UtilException("excel文件的扩展名是.xls or .xlsx!");
-			}
-		} catch (Exception ex) {
-			LOGGER.error("excel open error.", ex);
-			return result;
-		} finally {
-			if (inputStream != null) {
-				inputStream.close();
-			}
-		}
+	public static Map<String, List<Map<String, Object>>> importExcel(InputStream inputStream, int startRowNum, String extName) throws Exception {
 
+		Map<String, List<Map<String, Object>>> result = new HashMap<>();
+		Workbook workbook = WorkbookFactory.create(inputStream);
 		int sheetCount = workbook.getNumberOfSheets();
 		Sheet sheet = null;
 		Row row = null;
 		Cell cell = null;
 		int currentRowNum = 0, currentCellNum = 0;
-		// Object fieldValue = null;
 		Iterator<Row> rowIter = null;
 		Iterator<Cell> cellIter = null;
 
@@ -468,9 +443,9 @@ public class POIUtil {
 			sheet = workbook.getSheetAt(i);
 
 			Map<String, List<PictureData>> picMap = null;
-			if (extName.endsWith(".xlsx")) {
+			if(sheet instanceof  XSSFSheet){
 				picMap = getXlsxPictures((XSSFSheet) sheet);
-			} else if (extName.endsWith(".xls")) {
+			}else if(sheet instanceof  HSSFSheet){
 				picMap = getXlsPictures((HSSFSheet) sheet);
 			}
 
@@ -487,7 +462,6 @@ public class POIUtil {
 					if (currentRowNum == 1) {// 第一列表示英文名称对应表字段
 						cellIter = row.iterator();
 						// 列号清零
-						currentCellNum = 0;
 						List<String> names = new ArrayList<String>();
 						while (cellIter.hasNext()) {
 							cell = cellIter.next();
@@ -496,15 +470,12 @@ public class POIUtil {
 						fieldsName = names.toArray(new String[names.size()]);
 						continue;
 					}
-
 					// 跳过指定的行
 					if (currentRowNum < startRowNum) {
 						continue;
 					}
-
 					// 实例化对象
-					obj = new HashMap<String, Object>();// clazz.newInstance();
-
+					obj = new HashMap<>();
 					cellIter = row.iterator();
 					// 列号清零
 					currentCellNum = 0;

+ 4 - 14
mec-web/src/main/java/com/ym/mec/web/controller/ImportController.java

@@ -2,6 +2,7 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.common.controller.BaseController;
@@ -50,23 +51,12 @@ public class ImportController extends BaseController {
     @ApiOperation(value = "下载导入模板")
     @GetMapping(value = "downloadTemplate")
     @PreAuthorize("@pcs.hasPermissions('import/downloadTemplate')")
-    public void getGoodsTemplate(HttpServletResponse response,String templateType) throws IOException {
-        String templateName = null;
-        switch (templateType){
-            case "goods":
-                templateName = "商品导入模板";
-                break;
-            case "financialExpenditure":
-                templateName = "财务支出导入模板";
-                break;
-            default:
-                templateName = "商品导入模板";
-        }
-        InputStream inputStream = new ClassPathResource("excelTemplate/" + templateName + ".xls").getInputStream();
+    public void getGoodsTemplate(HttpServletResponse response, TemplateTypeEnum templateType) throws IOException {
+        InputStream inputStream = new ClassPathResource("excelTemplate/" + templateType.getMsg() + ".xls").getInputStream();
         OutputStream outputStream = response.getOutputStream();
         try {
             response.setContentType("application/octet-stream");
-            response.setHeader("Content-Disposition", "attachment;filename=" + templateName + "-" + DateUtil.getDate(new Date()) + ".xls");
+            response.setHeader("Content-Disposition", "attachment;filename=" + templateType.getMsg() + "-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
             outputStream = response.getOutputStream();
             IOUtils.copy(inputStream, outputStream);

+ 1 - 10
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -262,16 +262,7 @@ public class MusicGroupController extends BaseController {
 	@ApiOperation("获取分部乐团列表名称")
 	@GetMapping(value = "/queryOrganMusicInfos")
 	@PreAuthorize("@pcs.hasPermissions('musicGroup/queryOrganMusicInfos')")
-	public Object queryOrganMusicInfos() {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed("用户信息获取失败");
-		}
-		String organId = null;
-		if(!sysUser.getIsSuperAdmin()){
-			Employee employee = employeeDao.get(sysUser.getId());
-			organId = employee.getOrganIdList();
-		}
+	public Object queryOrganMusicInfos(Integer organId) {
 		return succeed(musicGroupService.queryOrganMusicInfos(organId));
 	}
 

BIN
mec-web/src/main/resources/excelTemplate/商品导入模板.xls