|
@@ -1,15 +1,5 @@
|
|
package com.ym.mec.biz.service.impl;
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import java.io.*;
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.util.*;
|
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
|
-import java.util.concurrent.Executors;
|
|
|
|
-import java.util.function.BiFunction;
|
|
|
|
-import java.util.function.Function;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
@@ -26,11 +16,16 @@ import com.ym.mec.common.entity.HttpResponseResult;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
|
+import com.ym.mec.common.tenant.TenantContextHolder;
|
|
import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
import com.ym.mec.thirdparty.adapay.Payment;
|
|
import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
|
+import com.ym.mec.thirdparty.storage.StoragePluginContext;
|
|
|
|
+import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
|
+import com.ym.mec.util.excel.POIUtil;
|
|
import com.ym.mec.util.ini.IniFileUtil;
|
|
import com.ym.mec.util.ini.IniFileUtil;
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+import com.ym.mec.util.upload.UploadUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -38,23 +33,20 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.system.ApplicationHome;
|
|
import org.springframework.boot.system.ApplicationHome;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-
|
|
|
|
-import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
|
-import com.ym.mec.thirdparty.storage.StoragePluginContext;
|
|
|
|
-import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
|
|
|
|
-import com.ym.mec.util.date.DateUtil;
|
|
|
|
-import com.ym.mec.util.excel.POIUtil;
|
|
|
|
-import com.ym.mec.util.upload.UploadUtil;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
-
|
|
|
|
-import static com.ym.mec.biz.dal.enums.QuestionnaireActiveTypeEnum.CLOUD_TEACHER_FEEDBACK;
|
|
|
|
|
|
+import java.io.*;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
+import java.util.function.BiFunction;
|
|
|
|
+import java.util.function.Function;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class ExportServiceImpl implements ExportService {
|
|
public class ExportServiceImpl implements ExportService {
|
|
@@ -1419,7 +1411,7 @@ public class ExportServiceImpl implements ExportService {
|
|
CompletableFuture.runAsync(()->{
|
|
CompletableFuture.runAsync(()->{
|
|
try {
|
|
try {
|
|
this.studentVipPractice(organId, managerDownload, tenantId,headColumns);
|
|
this.studentVipPractice(organId, managerDownload, tenantId,headColumns);
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
},executor);
|
|
},executor);
|
|
@@ -1443,7 +1435,7 @@ public class ExportServiceImpl implements ExportService {
|
|
CompletableFuture.runAsync(()->{
|
|
CompletableFuture.runAsync(()->{
|
|
try {
|
|
try {
|
|
this.queryStudentCourseInfo(organId, tenantId,"VIP", managerDownload,headColumns,ExportEnum.STUDENT_VIP_COURSE_INFO);
|
|
this.queryStudentCourseInfo(organId, tenantId,"VIP", managerDownload,headColumns,ExportEnum.STUDENT_VIP_COURSE_INFO);
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
},executor);
|
|
},executor);
|
|
@@ -1467,7 +1459,7 @@ public class ExportServiceImpl implements ExportService {
|
|
CompletableFuture.runAsync(()->{
|
|
CompletableFuture.runAsync(()->{
|
|
try {
|
|
try {
|
|
this.queryStudentCourseInfo(organId, tenantId,"THEORY", managerDownload,headColumns,ExportEnum.STUDENT_MUSIC_THEORY_COURSE_INFO);
|
|
this.queryStudentCourseInfo(organId, tenantId,"THEORY", managerDownload,headColumns,ExportEnum.STUDENT_MUSIC_THEORY_COURSE_INFO);
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
},executor);
|
|
},executor);
|
|
@@ -1507,7 +1499,7 @@ public class ExportServiceImpl implements ExportService {
|
|
CompletableFuture.runAsync(()->{
|
|
CompletableFuture.runAsync(()->{
|
|
try {
|
|
try {
|
|
this.orderList(params, managerDownload, headColumns);
|
|
this.orderList(params, managerDownload, headColumns);
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
},executor);
|
|
},executor);
|
|
@@ -1539,7 +1531,7 @@ public class ExportServiceImpl implements ExportService {
|
|
CompletableFuture.runAsync(()->{
|
|
CompletableFuture.runAsync(()->{
|
|
try {
|
|
try {
|
|
this.superFindCourseSchedules(queryInfo, managerDownload);
|
|
this.superFindCourseSchedules(queryInfo, managerDownload);
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
},executor);
|
|
},executor);
|
|
@@ -1589,7 +1581,28 @@ public class ExportServiceImpl implements ExportService {
|
|
//获取机构费率
|
|
//获取机构费率
|
|
Integer tenantId = (Integer) params.get("tenantId");
|
|
Integer tenantId = (Integer) params.get("tenantId");
|
|
TenantConfig tenantConfig = tenantConfigService.queryByTenantId(tenantId);
|
|
TenantConfig tenantConfig = tenantConfigService.queryByTenantId(tenantId);
|
|
-
|
|
|
|
|
|
+ //获取缴费项目编号
|
|
|
|
+ List<Long> calenderIds = studentPaymentOrderExportDtos.stream().map(e -> e.getCalenderId()).filter(e -> e != null).distinct().collect(Collectors.toList());
|
|
|
|
+ Map<Long, Integer> calenderCooperationMap = new HashMap<>();
|
|
|
|
+ Map<Integer, String> firstMusicMap = new HashMap<>();
|
|
|
|
+ if(calenderIds != null && calenderIds.size() > 0){
|
|
|
|
+ //获取缴费项目关联的合作单位
|
|
|
|
+ calenderCooperationMap = musicGroupPaymentCalenderService.findCooperationByIds(calenderIds);
|
|
|
|
+ //获取合作单位第一个乐团
|
|
|
|
+ firstMusicMap = MapUtil.convertMybatisMap(cooperationOrganDao.findFirstMusic());
|
|
|
|
+ }
|
|
|
|
+ List<Integer> studentIds = studentPaymentOrderExportDtos.stream().map(e -> e.getUserId()).distinct().collect(Collectors.toList());
|
|
|
|
+ //获取学员第一个课程组编号
|
|
|
|
+ Map<Integer, String> userFirstVipMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.findUserFirstVipMap("VIP",studentIds));
|
|
|
|
+ //获取学员最近加入的一个乐团编号
|
|
|
|
+ Map<Integer, String> userLastMusicIdMap = MapUtil.convertMybatisMap(studentRegistrationDao.getLastMusicGroupId(studentIds));
|
|
|
|
+ Map<Integer, String> userLastMusicNameMap = MapUtil.convertMybatisMap(studentRegistrationDao.getLastMusicGroupName(studentIds));
|
|
|
|
+ Set<String> musicGroupIds = studentPaymentOrderExportDtos.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
|
|
|
|
+ Map<String, String> musicGroupNameMap = new HashMap<>();
|
|
|
|
+ if(musicGroupIds != null && musicGroupIds.size() > 0){
|
|
|
|
+ musicGroupNameMap = MapUtil.convertIntegerMap(musicGroupDao.queryMusicGroupNameMap(musicGroupIds));
|
|
|
|
+ }
|
|
|
|
+
|
|
for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
|
|
for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
|
|
if (row.getActualAmount() == null) {
|
|
if (row.getActualAmount() == null) {
|
|
row.setActualAmount(BigDecimal.ZERO);
|
|
row.setActualAmount(BigDecimal.ZERO);
|
|
@@ -1607,6 +1620,28 @@ public class ExportServiceImpl implements ExportService {
|
|
row.setTransferFee(transferFee);
|
|
row.setTransferFee(transferFee);
|
|
row.setPlatformFee(row.getActualAmount().multiply(tenantConfig.getChargeRate()).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP));
|
|
row.setPlatformFee(row.getActualAmount().multiply(tenantConfig.getChargeRate()).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
|
|
+ Long calenderId = row.getCalenderId();
|
|
|
|
+ if(calenderId != null){
|
|
|
|
+ row.setFeeMusicGroupId(row.getMusicGroupId());
|
|
|
|
+ row.setFeeMusicGroupName(musicGroupNameMap.get(row.getMusicGroupId()));
|
|
|
|
+ OrderTypeEnum orderTypeEnum = row.getType();
|
|
|
|
+ if(orderTypeEnum == OrderTypeEnum.APPLY || orderTypeEnum == OrderTypeEnum.ADD_STUDENT){
|
|
|
|
+ Integer cooperationId = calenderCooperationMap.get(calenderId);
|
|
|
|
+ if(cooperationId != null){
|
|
|
|
+ String firstMusicId = firstMusicMap.get(cooperationId);
|
|
|
|
+ if(Objects.equals(firstMusicId,row.getMusicGroupId())){
|
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.NEW_MUSIC);
|
|
|
|
+ }else {
|
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.ADD_MUSIC);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.RENEW_MUSIC);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ row.setFeeMusicGroupId(userLastMusicIdMap.get(row.getUserId()));
|
|
|
|
+ row.setFeeMusicGroupName(userLastMusicNameMap.get(row.getUserId()));
|
|
|
|
+ }
|
|
String goodsName = "";
|
|
String goodsName = "";
|
|
if (row.getOrderDetailList() != null) {
|
|
if (row.getOrderDetailList() != null) {
|
|
for (StudentPaymentOrderDetail orderDetail : row.getOrderDetailList()) {
|
|
for (StudentPaymentOrderDetail orderDetail : row.getOrderDetailList()) {
|
|
@@ -1671,6 +1706,15 @@ public class ExportServiceImpl implements ExportService {
|
|
vipCourseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
vipCourseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
}
|
|
}
|
|
row.setVipCourseFee(vipCourseFee);
|
|
row.setVipCourseFee(vipCourseFee);
|
|
|
|
+ if(row.getTypeDesc() == null){
|
|
|
|
+ //学员没有历史VIP课程则导出为【VIP课新增】
|
|
|
|
+ //学员有历史VIP课程到导出为【VIP课续费]
|
|
|
|
+ if(Objects.equals(userFirstVipMap.get(row.getUserId()),row.getMusicGroupId())){
|
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.NEW_VIP);
|
|
|
|
+ }else {
|
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.RENEW_VIP);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case THEORY_COURSE:
|
|
case THEORY_COURSE:
|
|
BigDecimal theoryCourseFee = BigDecimal.ZERO;
|
|
BigDecimal theoryCourseFee = BigDecimal.ZERO;
|
|
@@ -2419,14 +2463,32 @@ public class ExportServiceImpl implements ExportService {
|
|
public void studentVipPractice(String organId, ManagerDownload managerDownload, Integer tenantId,List<String> headColumns) throws FileNotFoundException {
|
|
public void studentVipPractice(String organId, ManagerDownload managerDownload, Integer tenantId,List<String> headColumns) throws FileNotFoundException {
|
|
List<StudentVipPracticeExportDto> studentVipPracticeExportDtos = courseScheduleStudentPaymentDao.exportStudentVipPractice(organId, tenantId);
|
|
List<StudentVipPracticeExportDto> studentVipPracticeExportDtos = courseScheduleStudentPaymentDao.exportStudentVipPractice(organId, tenantId);
|
|
if(studentVipPracticeExportDtos != null && studentVipPracticeExportDtos.size() > 0){
|
|
if(studentVipPracticeExportDtos != null && studentVipPracticeExportDtos.size() > 0){
|
|
- List<Integer> studentIds = studentVipPracticeExportDtos.stream().map(e -> e.getUserId()).collect(Collectors.toList());
|
|
|
|
- //获取学员最后一节已结束的vip课的老师以及编号
|
|
|
|
|
|
+ List<Integer> studentIds = studentVipPracticeExportDtos.stream().map(e -> e.getUserId()).distinct().collect(Collectors.toList());
|
|
|
|
+ //新增声部课老师,学员有在读乐团,导出该学员所在声部班班级老师,无声部班则为空
|
|
|
|
+ List<BaseNameDto> normalClassTeacher = courseScheduleStudentPaymentDao.queryClassTeacher(studentIds);
|
|
|
|
+ Map<Integer, List<BaseNameDto>> normalClassTeacherMap = new HashMap<>();
|
|
|
|
+ if(normalClassTeacher != null && normalClassTeacher.size() > 0){
|
|
|
|
+ normalClassTeacherMap = normalClassTeacher.stream().collect(Collectors.groupingBy(BaseNameDto::getUserId));
|
|
|
|
+ }
|
|
|
|
+ //获取最近一节未开始vip课课程组老师编号
|
|
|
|
+ List<BaseNameDto> vipFirstNotStartTeacher = courseScheduleStudentPaymentDao.queryFirstNotStartTeacher(studentIds,"VIP");
|
|
|
|
+ Map<Integer, List<BaseNameDto>> vipFirstNotStartTeacherMap = new HashMap<>();
|
|
|
|
+ if(vipFirstNotStartTeacher != null && vipFirstNotStartTeacher.size() > 0){
|
|
|
|
+ vipFirstNotStartTeacherMap = vipFirstNotStartTeacher.stream().collect(Collectors.groupingBy(BaseNameDto::getUserId));
|
|
|
|
+ }
|
|
|
|
+ //获取最近一节未开始网管课课课程组老师编号
|
|
|
|
+ List<BaseNameDto> practiceFirstNotStartTeacher = courseScheduleStudentPaymentDao.queryFirstNotStartTeacher(studentIds,"PRACTICE");
|
|
|
|
+ Map<Integer, List<BaseNameDto>> practiceFirstNotStartTeacherMap = new HashMap<>();
|
|
|
|
+ if(practiceFirstNotStartTeacher != null && practiceFirstNotStartTeacher.size() > 0){
|
|
|
|
+ practiceFirstNotStartTeacherMap = practiceFirstNotStartTeacher.stream().collect(Collectors.groupingBy(BaseNameDto::getUserId));
|
|
|
|
+ }
|
|
|
|
+ //获取学员最后一节已结束的vip课课程组的老师以及编号
|
|
List<BaseNameDto> vipBaseNameDtos = courseScheduleStudentPaymentDao.queryLastOverTeacher(studentIds,"VIP");
|
|
List<BaseNameDto> vipBaseNameDtos = courseScheduleStudentPaymentDao.queryLastOverTeacher(studentIds,"VIP");
|
|
Map<Integer, List<BaseNameDto>> vipBaseNameMap = new HashMap<>();
|
|
Map<Integer, List<BaseNameDto>> vipBaseNameMap = new HashMap<>();
|
|
if(vipBaseNameDtos != null && vipBaseNameDtos.size() > 0){
|
|
if(vipBaseNameDtos != null && vipBaseNameDtos.size() > 0){
|
|
vipBaseNameMap = vipBaseNameDtos.stream().collect(Collectors.groupingBy(BaseNameDto::getUserId));
|
|
vipBaseNameMap = vipBaseNameDtos.stream().collect(Collectors.groupingBy(BaseNameDto::getUserId));
|
|
}
|
|
}
|
|
- //获取学员最后一节已结束的网管课的老师以及编号
|
|
|
|
|
|
+ //获取学员最后一节已结束的网管课课程组的老师以及编号
|
|
List<BaseNameDto> practiceBaseNameDtos = courseScheduleStudentPaymentDao.queryLastOverTeacher(studentIds,"PRACTICE");
|
|
List<BaseNameDto> practiceBaseNameDtos = courseScheduleStudentPaymentDao.queryLastOverTeacher(studentIds,"PRACTICE");
|
|
Map<Integer, List<BaseNameDto>> practiceBaseNameMap = new HashMap<>();
|
|
Map<Integer, List<BaseNameDto>> practiceBaseNameMap = new HashMap<>();
|
|
if(practiceBaseNameDtos != null && practiceBaseNameDtos.size() > 0){
|
|
if(practiceBaseNameDtos != null && practiceBaseNameDtos.size() > 0){
|
|
@@ -2445,6 +2507,24 @@ public class ExportServiceImpl implements ExportService {
|
|
studentVipPracticeExportDto.setPracticeOverTeacherId(baseNameDto.getTeacherId());
|
|
studentVipPracticeExportDto.setPracticeOverTeacherId(baseNameDto.getTeacherId());
|
|
studentVipPracticeExportDto.setPracticeOverTeacherName(baseNameDto.getTeacherName());
|
|
studentVipPracticeExportDto.setPracticeOverTeacherName(baseNameDto.getTeacherName());
|
|
}
|
|
}
|
|
|
|
+ List<BaseNameDto> baseNameDtos2 = normalClassTeacherMap.get(studentVipPracticeExportDto.getUserId());
|
|
|
|
+ if(baseNameDtos2 != null && baseNameDtos2.size() > 0){
|
|
|
|
+ BaseNameDto baseNameDto = baseNameDtos2.get(0);
|
|
|
|
+ studentVipPracticeExportDto.setNormalClassTeacherId(baseNameDto.getTeacherId());
|
|
|
|
+ studentVipPracticeExportDto.setNormalClassTeacherName(baseNameDto.getTeacherName());
|
|
|
|
+ }
|
|
|
|
+ List<BaseNameDto> baseNameDtos3 = vipFirstNotStartTeacherMap.get(studentVipPracticeExportDto.getUserId());
|
|
|
|
+ if(baseNameDtos3 != null && baseNameDtos3.size() > 0){
|
|
|
|
+ BaseNameDto baseNameDto = baseNameDtos3.get(0);
|
|
|
|
+ studentVipPracticeExportDto.setVipNotStartTeacherId(baseNameDto.getTeacherId());
|
|
|
|
+ studentVipPracticeExportDto.setVipNotStartTeacherName(baseNameDto.getTeacherName());
|
|
|
|
+ }
|
|
|
|
+ List<BaseNameDto> baseNameDtos4 = practiceFirstNotStartTeacherMap.get(studentVipPracticeExportDto.getUserId());
|
|
|
|
+ if(baseNameDtos4 != null && baseNameDtos4.size() > 0){
|
|
|
|
+ BaseNameDto baseNameDto = baseNameDtos4.get(0);
|
|
|
|
+ studentVipPracticeExportDto.setPracticeNotStartTeacherId(baseNameDto.getTeacherId());
|
|
|
|
+ studentVipPracticeExportDto.setPracticeNotStartTeacherName(baseNameDto.getTeacherName());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
|
|
String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
|