|
@@ -30,7 +30,9 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
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.http.HttpUtil;
|
|
|
+import com.ym.mec.util.ini.IniFileUtil;
|
|
|
import com.ym.mec.util.json.JsonUtil;
|
|
|
import com.ym.mec.util.validator.CommonValidator;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
@@ -39,13 +41,17 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -55,6 +61,7 @@ import java.util.stream.Collectors;
|
|
|
import static com.ym.mec.biz.dal.entity.ApprovalStatus.APPROVED;
|
|
|
import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
|
|
|
import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
|
|
|
import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
|
|
@@ -82,6 +89,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
@Autowired
|
|
|
+ private MusicGroupPaymentCalenderMemberDao musicGroupPaymentCalenderMemberDao;
|
|
|
+ @Autowired
|
|
|
private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentEntitiesDao musicGroupPaymentEntitiesDao;
|
|
@@ -204,6 +213,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
private StudentDao studentDao;
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderRepairDao musicGroupPaymentCalenderRepairDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderActivityDao musicGroupPaymentCalenderActivityDao;
|
|
|
|
|
|
private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
@@ -439,6 +450,196 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importStudentToMusicGroup1(List<MusicGroupPaymentImportDto> importDtos, MusicGroupPaymentCalender calender) throws Exception {
|
|
|
+ String musicGroupId = calender.getMusicGroupId();
|
|
|
+ //查询导入的声部是否正确
|
|
|
+ List<String> subjectNameList = importDtos.stream().distinct().map(t->t.getSubjectName()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<MusicGroupSubjectPlan> musicGroupSubjectPlanList = musicGroupSubjectPlanDao.getMusicSubjectClassPlan(musicGroupId);
|
|
|
+
|
|
|
+ Map<String,Integer> subjectMap = musicGroupSubjectPlanList.stream().collect(Collectors.toMap(MusicGroupSubjectPlan :: getSubName, MusicGroupSubjectPlan :: getSubjectId));
|
|
|
+
|
|
|
+ List<String> allSubjectNameList = musicGroupSubjectPlanList.stream().map(t -> t.getSubName()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for(String subName : subjectNameList){
|
|
|
+ if(!allSubjectNameList.contains(subName)){
|
|
|
+ throw new BizException("当前乐团不支持[{}]声部", subName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
|
|
|
+ if(musicGroupPaymentCalender == null){
|
|
|
+ throw new BizException("请先创建乐团报名缴费");
|
|
|
+ }
|
|
|
+ if(musicGroupPaymentCalender.getPaymentType() != MUSIC_APPLY){
|
|
|
+ throw new BizException("当前入口仅支持报名缴费项目导入");
|
|
|
+ }
|
|
|
+ Date now = new Date();
|
|
|
+ Long calenderId = musicGroupPaymentCalender.getId();
|
|
|
+ Boolean freeFlag = musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0;
|
|
|
+ List<String> phones = importDtos.stream().map(e -> e.getPhone()).collect(Collectors.toList());
|
|
|
+ List<BasicUserDto> userList = teacherDao.queryUserByPhones(phones);
|
|
|
+ List<String> existPhones = studentDao.queryExistStuByPhone(phones);
|
|
|
+ Map<String, BasicUserDto> userDtoMap = userList.stream().collect(Collectors.groupingBy(e -> e.getPhone(), Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0))));
|
|
|
+ Organization organization = organizationDao.get(calender.getOrganId());
|
|
|
+ //检查用户是否已入团或在其他机构已注册
|
|
|
+ List<StudentRegistration> insertList = new ArrayList<>();
|
|
|
+ List<StudentRegistration> updateList = new ArrayList<>();
|
|
|
+ List<StudentRegistration> allList = new ArrayList<>();
|
|
|
+ StudentRegistration studentRegistration = null;
|
|
|
+ SysUser sysUser = null;
|
|
|
+ Student student = null;
|
|
|
+ Integer applyNum = 0;
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberDao.findByCalenderId(calenderId);
|
|
|
+ MusicGroupPaymentCalenderRepair calenderRepair = musicGroupPaymentCalenderRepairDao.findByCalenderId(calenderId);
|
|
|
+ List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityDao.findByCalenderId(calenderId);
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId);
|
|
|
+ for(MusicGroupPaymentImportDto si : importDtos){
|
|
|
+ BasicUserDto userDto = userDtoMap.get(si.getPhone());
|
|
|
+ if (Objects.isNull(userDto)) {
|
|
|
+ sysUser = new SysUser();
|
|
|
+ sysUser.setPhone(si.getPhone());
|
|
|
+ int phoneStrLen = sysUser.getPhone().length();
|
|
|
+ sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
|
|
|
+ sysUser.setUsername(si.getStudentName());
|
|
|
+ sysUser.setGender(si.getGender().equals("男") ? 1 : 0);
|
|
|
+ sysUser.setUserType("STUDENT");
|
|
|
+ sysUser.setOrganId(calender.getOrganId());
|
|
|
+ sysUser.setCreateTime(now);
|
|
|
+ sysUser.setUpdateTime(now);
|
|
|
+ teacherDao.addSysUser(sysUser);
|
|
|
+ }
|
|
|
+ Integer userId = si.getUserId();
|
|
|
+ if(!existPhones.contains(si.getPhone())){
|
|
|
+ student = new Student(userId, subjectMap.get(si.getSubjectName()) + "");
|
|
|
+ student.setCurrentGradeNum(SixPlusGradeEnum.get(si.getGrade()).getCode());
|
|
|
+ studentDao.insert(student);
|
|
|
+ // 添加用户现金账户
|
|
|
+ sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
+ }
|
|
|
+ studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ if(studentRegistration == null){
|
|
|
+ studentRegistration = new StudentRegistration();
|
|
|
+ String studentGrade = studentService.getStudentGrade(organization.getGradeType(), student.getCurrentGradeNum());
|
|
|
+ studentRegistration.setCurrentGrade(studentGrade);
|
|
|
+ studentRegistration.setActualSubjectId(subjectMap.get(si.getSubjectName()));
|
|
|
+ studentRegistration.setIsAllowAdjust(YesOrNoEnum.YES);
|
|
|
+ studentRegistration.setSubjectId(subjectMap.get(si.getSubjectName()));
|
|
|
+ studentRegistration.setUserId(userId);
|
|
|
+ studentRegistration.setParentsPhone(si.getPhone());
|
|
|
+ studentRegistration.setName(si.getStudentName());
|
|
|
+ studentRegistration.setGender(sysUser.getGender());
|
|
|
+ studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
|
|
|
+ studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
|
|
|
+ studentRegistration.setTemporaryCourseFee(BigDecimal.ZERO);
|
|
|
+ studentRegistration.setMusicGroupPaymentCalenderId(calenderId);
|
|
|
+ studentRegistration.setTenantId(calender.getTenantId());
|
|
|
+ studentRegistration.setMusicGroupId(musicGroupId);
|
|
|
+ studentRegistration.setCreateTime(now);
|
|
|
+ studentRegistration.setUpdateTime(now);
|
|
|
+ insertList.add(studentRegistration);
|
|
|
+ applyNum ++;
|
|
|
+ } else{
|
|
|
+ if (studentRegistration.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
|
|
|
+ throw new BizException("学员{}乐团状态不支持导入",si.getStudentName());
|
|
|
+ }
|
|
|
+ studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
|
|
|
+ updateList.add(studentRegistration);
|
|
|
+ }
|
|
|
+ allList.add(studentRegistration);
|
|
|
+ String channelType = "";
|
|
|
+ String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
+ //生成订单,校验优惠券的使用情况
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ studentPaymentOrder.setExpectAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setActualAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setCouponRemitFee(BigDecimal.ZERO);
|
|
|
+ studentPaymentOrder.setUserId(studentRegistration.getUserId());
|
|
|
+ studentPaymentOrder.setGroupType(GroupType.OUTORDER);
|
|
|
+ studentPaymentOrder.setOrderNo(orderNo);
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.APPLY);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ studentPaymentOrder.setPaymentChannel(channelType);
|
|
|
+ studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
+ studentPaymentOrder.setCalenderId(calenderId);
|
|
|
+ studentPaymentOrder.setOrganId(calender.getOrganId());
|
|
|
+ studentPaymentOrder.setRoutingOrganId(calender.getOrganId());
|
|
|
+ studentPaymentOrder.setMemo("缴费项目外部订单导入");
|
|
|
+ studentPaymentOrder.setMerNos(si.getMerNos());
|
|
|
+ studentPaymentOrder.setTransNo(si.getTransNo());
|
|
|
+ studentPaymentOrder.setPayTime(si.getPayTime());
|
|
|
+ studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
+ studentRegistrationService.addOrder1(studentPaymentOrder,calender,courseSettings, calenderMember, calenderRepair, calenderActivities);
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, calender.getOrganId(), calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrderDetailService.addOrderDetailTo(studentPaymentOrder, musicGroup, studentRegistration);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(insertList)) {
|
|
|
+ studentRegistrationService.batchInsert(insertList);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(updateList)) {
|
|
|
+ studentRegistrationService.batchUpdate(updateList);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(allList)) {
|
|
|
+ Map<Integer, Long> subjectCountMap = allList.stream().collect(
|
|
|
+ Collectors.groupingBy(StudentRegistration::getActualSubjectId, Collectors.counting()));
|
|
|
+
|
|
|
+ MusicGroupSubjectPlan musicOneSubjectClassPlan = null;
|
|
|
+ for (Entry<Integer, Long> entry : subjectCountMap.entrySet()) {
|
|
|
+ musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, entry.getKey());
|
|
|
+ if (musicOneSubjectClassPlan == null) {
|
|
|
+ throw new BizException("系统数据[乐团声部设置]异常");
|
|
|
+ }
|
|
|
+ int num = musicOneSubjectClassPlan.getApplyStudentNum() == null ? 0 : musicOneSubjectClassPlan.getApplyStudentNum();
|
|
|
+ musicOneSubjectClassPlan.setApplyStudentNum(num + applyNum);
|
|
|
+ musicOneSubjectClassPlan.setPaidStudentNum((musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan
|
|
|
+ .getPaidStudentNum()) + entry.getValue().intValue());
|
|
|
+ if(freeFlag){
|
|
|
+ musicOneSubjectClassPlan.setPaidZeroNum((musicOneSubjectClassPlan.getPaidZeroNum() == null ? 0 : musicOneSubjectClassPlan.getPaidZeroNum())
|
|
|
+ + entry.getValue().intValue());
|
|
|
+ }
|
|
|
+ musicOneSubjectClassPlan.setUpdateTime(now);
|
|
|
+ musicGroupSubjectPlanDao.update(musicOneSubjectClassPlan);
|
|
|
+ }
|
|
|
+ // 更新实际缴费人数
|
|
|
+ if (musicGroupPaymentCalender.getActualNum() == null) {
|
|
|
+ musicGroupPaymentCalender.setActualNum(allList.size());
|
|
|
+ } else {
|
|
|
+ musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + allList.size());
|
|
|
+ }
|
|
|
+ if (musicGroupPaymentCalender.getExpectNum() == null) {
|
|
|
+ musicGroupPaymentCalender.setExpectNum(allList.size());
|
|
|
+ } else {
|
|
|
+ musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + allList.size());
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalender.setUpdateTime(now);
|
|
|
+ musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
|
|
|
+
|
|
|
+ MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
|
|
|
+ List<MusicGroupPaymentCalenderDetail> insertMusicGroupPaymentCalenderDetailList = new ArrayList<>();
|
|
|
+ for (MusicGroupPaymentImportDto si : importDtos) {
|
|
|
+ musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
|
|
|
+ musicGroupPaymentCalenderDetail.setTenantId(calender.getTenantId());
|
|
|
+ musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
+ musicGroupPaymentCalenderDetail.setUserId(si.getUserId());
|
|
|
+ musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
|
|
|
+ musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
|
|
|
+ musicGroupPaymentCalenderDetail.setPayTime(now);
|
|
|
+ musicGroupPaymentCalenderDetail.setPaymentOrderId(null);
|
|
|
+ musicGroupPaymentCalenderDetail.setUseInCourse(0);
|
|
|
+ musicGroupPaymentCalenderDetail.setOpen(1);
|
|
|
+ musicGroupPaymentCalenderDetail.setUserStatus(null);
|
|
|
+ musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
|
|
|
+ musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
|
|
|
+ insertMusicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
|
|
|
+ }
|
|
|
+ if (insertMusicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
+ musicGroupPaymentCalenderDetailDao.batchInsert(insertMusicGroupPaymentCalenderDetailList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String createGroup(SubFeeSettingDto subFeeSettingDto) {
|
|
@@ -945,6 +1146,72 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
return BaseController.succeed(payMap);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importRenew(List<MusicGroupPaymentImportDto> importDtos) throws Exception {
|
|
|
+ Map<String, List<MusicGroupPaymentImportDto>> dtoMap = importDtos.stream().collect(Collectors.groupingBy(e -> e.getBatchNo()));
|
|
|
+ Date now = new Date();
|
|
|
+ for (String batchNo : dtoMap.keySet()) {
|
|
|
+ List<MusicGroupPaymentCalender> byBatchNo = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
|
|
|
+ if(CollectionUtils.isEmpty(byBatchNo)){
|
|
|
+ throw new BizException("缴费项目批次{}不存在",batchNo);
|
|
|
+ }
|
|
|
+ MusicGroupPaymentCalender calender = byBatchNo.get(0);
|
|
|
+ if(calender.getPaymentType() != MUSIC_RENEW && calender.getPaymentType() != ADD_COURSE && calender.getPaymentType() != MUSIC_APPLY){
|
|
|
+ throw new BizException("不支持类型 {} 的缴费项目导入",calender.getPaymentType().getDesc());
|
|
|
+ }
|
|
|
+ if(calender.getPaymentType() == MUSIC_APPLY){
|
|
|
+ this.importStudentToMusicGroup1(importDtos,calender);
|
|
|
+ }else {
|
|
|
+ Long calenderId = calender.getId();
|
|
|
+ List<MusicGroupPaymentImportDto> userDtoList = dtoMap.get(batchNo);
|
|
|
+ List<MusicGroupPaymentCalenderDetail> detailList = musicGroupPaymentCalenderDetailDao.getCalenderDetailWithCalender(calenderId);
|
|
|
+ Map<Integer, MusicGroupPaymentCalenderDetail> detailMap = detailList.stream().collect(Collectors.groupingBy(e -> e.getUserId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0))));
|
|
|
+ for (MusicGroupPaymentImportDto userDto : userDtoList) {
|
|
|
+ MusicGroupPaymentCalenderDetail calenderDetail = detailMap.get(userDto.getUserId());
|
|
|
+ if(Objects.isNull(calenderDetail)){
|
|
|
+ throw new BizException("缴费项不存在学员{},请检查导入Excel",userDto.getUserId());
|
|
|
+ }
|
|
|
+ if (calenderDetail.getPaymentStatus() == PaymentStatus.PAID_COMPLETED) {
|
|
|
+ throw new BizException("学员{}已缴费,请勿重复录入",userDto.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (MusicGroupPaymentImportDto userDto : userDtoList) {
|
|
|
+ String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ studentPaymentOrder.setExpectAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setActualAmount(calender.getCurrentTotalAmount());
|
|
|
+ studentPaymentOrder.setCouponRemitFee(BigDecimal.ZERO);
|
|
|
+ studentPaymentOrder.setGroupType(GroupType.OUTORDER);
|
|
|
+ studentPaymentOrder.setUserId(userDto.getUserId());
|
|
|
+ studentPaymentOrder.setOrderNo(orderNo);
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.RENEW);
|
|
|
+ studentPaymentOrder.setStatus(SUCCESS);
|
|
|
+ studentPaymentOrder.setMusicGroupId(calender.getMusicGroupId());
|
|
|
+ studentPaymentOrder.setBatchNo(calenderId + "");
|
|
|
+ studentPaymentOrder.setCreateTime(now);
|
|
|
+ studentPaymentOrder.setUpdateTime(now);
|
|
|
+ studentPaymentOrder.setVersion(0);
|
|
|
+ studentPaymentOrder.setCalenderId(calenderId);
|
|
|
+ studentPaymentOrder.setOrganId(calender.getOrganId());
|
|
|
+ studentPaymentOrder.setRoutingOrganId(calender.getOrganId());
|
|
|
+ studentPaymentOrder.setMemo("缴费项目外部订单导入");
|
|
|
+ studentPaymentOrder.setMerNos(userDto.getMerNos());
|
|
|
+ studentPaymentOrder.setTransNo(userDto.getTransNo());
|
|
|
+ studentPaymentOrder.setPayTime(userDto.getPayTime());
|
|
|
+ studentPaymentOrderDao.insert(studentPaymentOrder);
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, calender.getOrganId(), calender.getCurrentTotalAmount());
|
|
|
+ Integer userId = studentPaymentOrder.getUserId();
|
|
|
+ String musicGroupId = studentPaymentOrder.getMusicGroupId();
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ //支付成功后处理课程、云教练、活动等数据
|
|
|
+ studentPaymentOrderDetailService.addOrderDetailTo(studentPaymentOrder, musicGroup, studentRegistration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private MusicGroupApplyGoodsDto getCalenderTotalAmount(RegisterPayDto registerPayDto, MusicGroupPaymentCalender calender) {
|
|
|
|
|
|
String musicGroupId = calender.getMusicGroupId();
|
|
@@ -1236,6 +1503,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
return BaseController.succeed(payMap);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateSubjectInfo(SubFeeSettingDto subFeeSettingDto) throws Exception {
|
|
@@ -3033,6 +3301,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean importRenewForCallback(StudentPaymentOrder studentPaymentOrder) throws IOException {
|
|
|
+ Integer userId = studentPaymentOrder.getUserId();
|
|
|
+ String musicGroupId = studentPaymentOrder.getMusicGroupId();
|
|
|
+
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ //支付成功后处理课程、云教练、活动等数据
|
|
|
+ studentPaymentOrderDetailService.addOrderDetailTo(studentPaymentOrder, musicGroup, studentRegistration);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public boolean updateTeacherCoursesSalary(Long courseScheduleId, Integer teacherId, BigDecimal salary, BigDecimal subsidy, String scope) {
|
|
@@ -3885,4 +4165,48 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public List<String> importMusicGroupPayment(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, TemplateTypeEnum.MUSIC_GROUP_PAYMENT_IMPORT.getMsg());
|
|
|
+ List<MusicGroupPaymentImportDto> importDtos = new ArrayList<>();
|
|
|
+ List<String> errMsg = new ArrayList();
|
|
|
+ for (String sheetName : sheetsListMap.keySet()) {
|
|
|
+ List<Map<String, Object>> sheet = sheetsListMap.get(sheetName);
|
|
|
+ for (int i = 0; i < sheet.size(); i++) {
|
|
|
+ Map<String, Object> row = sheet.get(i);
|
|
|
+ if (row.size() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject objectMap = new JSONObject();
|
|
|
+ valueIsNull: for (String s : row.keySet()) {
|
|
|
+ String columnValue = columns.get(s);
|
|
|
+ if (StringUtils.isEmpty(columnValue)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (null == row.get(s)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ objectMap.put(columnValue, row.get(s));
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ MusicGroupPaymentImportDto cost = JSONObject.parseObject(objectMap.toJSONString(), MusicGroupPaymentImportDto.class);
|
|
|
+ importDtos.add(cost);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ throw new BizException("导入数据出错", ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(errMsg)) {
|
|
|
+ return errMsg;
|
|
|
+ }
|
|
|
+ if(!org.springframework.util.CollectionUtils.isEmpty(importDtos)){
|
|
|
+ this.importRenew(importDtos);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|