| 
					
				 | 
			
			
				@@ -13,6 +13,8 @@ import com.ym.mec.util.excel.POIUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.ini.IniFileUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.ss.usermodel.PictureData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.service.impl.BaseServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.entity.TempBuyFreeLiveTheoryCourse; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,13 +30,11 @@ import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.ByteArrayInputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class TempBuyFreeLiveTheoryCourseServiceImpl extends BaseServiceImpl<Integer, TempBuyFreeLiveTheoryCourse> implements TempBuyFreeLiveTheoryCourseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final static Logger log = LoggerFactory.getLogger(TempBuyFreeLiveTheoryCourseServiceImpl.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TempBuyFreeLiveTheoryCourseDao tempBuyFreeLiveTheoryCourseDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -82,7 +82,7 @@ public class TempBuyFreeLiveTheoryCourseServiceImpl extends BaseServiceImpl<Inte 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String recommendLevel = objectMap.getString("recommendLevel"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(recommendLevel) && null == LevelEnum.getByName(recommendLevel.trim())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                err += "老师推荐级别列,数据异常(可选值:初级 中级 高级)/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                err += "老师推荐级别列,数据异常(可选值:一级 二级 三级)/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(err)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 err = "第" + (i + 1) + "行数据异常:" + err.substring(0, err.length() - 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -146,7 +146,7 @@ public class TempBuyFreeLiveTheoryCourseServiceImpl extends BaseServiceImpl<Inte 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String level = objectMap.getString("level"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(level) && null == LevelEnum.getByName(level.trim())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                err += "老师推荐级别列,数据异常(可选值:初级 中级 高级)/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                err += "老师推荐级别列,数据异常(可选值:一级 二级 三级)/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(err)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 err = "第" + (i + 1) + "行数据异常:" + err.substring(0, err.length() - 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -166,7 +166,7 @@ public class TempBuyFreeLiveTheoryCourseServiceImpl extends BaseServiceImpl<Inte 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //导入数据库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (TempLiveTeacherCard temp : tempList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             LevelEnum byName = LevelEnum.getByName(temp.getLevel()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(null == byName){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (null == byName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             TempLiveTeacherCard card = tempLiveTeacherCardDao.getBySubjectIdAndLevel(temp.getSubjectId(), byName.getCode()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -176,9 +176,42 @@ public class TempBuyFreeLiveTheoryCourseServiceImpl extends BaseServiceImpl<Inte 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             card.setUsername(temp.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             card.setAvatar(temp.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             card.setIntroduction(temp.getIntroduction()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            card.setMusicNames(temp.getMusicNames()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //处理曲目内容json 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String json = getMusicContent(temp.getMusicContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            card.setMusicContent(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             tempLiveTeacherCardDao.update(card); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String getMusicContent(String musicContent) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isEmpty(musicContent)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        musicContent = musicContent.trim(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> musicList = Arrays.asList(musicContent.split("\\|")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, String>> mapList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String musicStr : musicList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, String> musicMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String[] split = musicStr.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String coourseDay = split[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                coourseDay = coourseDay.replace("月",".").replace("日","") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .replace("(","(").replace(")",")"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                musicMap.put("coourseDay", coourseDay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                musicMap.put("coourseTime", split[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                musicMap.put("musicName", split[2]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mapList.add(musicMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.error("数据转换失败 data is {}", musicContent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return JSONObject.toJSONString(mapList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |