Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge 5 years ago
parent
commit
4af8670998

+ 13 - 57
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -1,41 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
@@ -45,6 +14,17 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 
 @Service
 public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderDetail>  implements MusicGroupPaymentCalenderDetailService {
@@ -146,41 +126,17 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(calenderDetails.size() == 0){
 			return "操作失败,没有可以开启缴费的学员";
 		}
-//		Long musicGroupPaymentCalenderId = calenderDetails.get(0).getMusicGroupPaymentCalenderId();
-//		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
-//		Date startPaymentDate = calender.getStartPaymentDate();
-//		Date deadlinePaymentDate = calender.getDeadlinePaymentDate();
 		int length = ids.split(",").length;
 		Date date = new Date();
-		/*Iterator<MusicGroupPaymentCalenderDetail> iterator = calenderDetails.iterator();
-		MusicGroupPaymentCalenderDetail next;
-		while(iterator.hasNext()){
-			next = iterator.next();
-			Integer countOpenPayment = musicGroupPaymentCalenderDetailDao.countOpenPayment(next.getMusicGroupId(), next.getUserId());
-			if(countOpenPayment > 0){
-				iterator.remove();
-			}
-			*//*int count1 = musicGroupPaymentCalenderDao.queryIntersectionByPaymentDate(next.getMusicGroupId(),startPaymentDate,deadlinePaymentDate);
-			int count = musicGroupPaymentCalenderDetailDao.queryIntersectionByPaymentDate(next.getMusicGroupId(),next.getUserId());
-			if(count > 0 || count1 > 0){
-				iterator.remove();
-			}*//*
-		}*/
-		/*if(calenderDetails.size() == 0){
-			return "操作失败,学员有未完成的订单";
-		}*/
 		Long calenderId = calenderDetails.get(0).getMusicGroupPaymentCalenderId();
 		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(calenderId);
 		calenderDetails.forEach(e->{
 			e.setUpdateTime(date);
 			e.setOpen(1);
-//			e.setPaymentStatus(PROCESSING);
 			e.setStartPaymentDate(date);
 			e.setDeadlinePaymentDate(date);
 		});
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
-		//修改学员缴费状态为未缴费
-//		musicGroupStudentFeeDao.setNoPayment(calenderDetails);
 		Set<Integer> studentIds = calenderDetails.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		//推送消息
 		if (studentIds.size() > 0) {

+ 51 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -102,6 +102,8 @@ public class ExportController extends BaseController {
     private TeacherService teacherService;
     @Autowired
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
+    @Autowired
+    private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
 
     @ApiOperation(value = "乐团管理--修改--缴费设置--缴费记录导出")
     @PostMapping("export/musicGroupPaymentCalenderDetail")
@@ -135,6 +137,55 @@ public class ExportController extends BaseController {
         }
     }
 
+    @ApiOperation(value = "业务管理--审核列表导出")
+    @PostMapping("export/exportPaymentCalenderAuditList")
+    @PreAuthorize("@pcs.hasPermissions('export/exportPaymentCalenderAuditList')")
+    public void exportPaymentCalenderAuditList(HttpServletResponse response, MusicGroupPaymentCalenderQueryInfo queryInfo) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                throw new BizException("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                    throw new BizException("非法请求");
+                }
+            }
+        }
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+        List<MusicGroupPaymentCalenderAuditDto> rows = musicGroupPaymentCalenderService.auditList(queryInfo).getRows();
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部名称","分部编号","乐团编号", "乐团名称", "申请类型", "订单类型", "加课总时长(分钟)", "原现价(元)",
+                    "申请价格(元)", "备注", "申请人", "状态", "申请时间"}, new String[]{
+                    "organName", "organId", "musicGroupId", "musicGroupName", "paymentType.desc", "payUserType.desc",
+                    "addCourseTotalTime", "courseCurrentPrice", "courseOriginalPrice", "memo", "operatorName", "auditStatus.desc", "createTime"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
     @ApiOperation(value = "导出教师考勤列表")
     @PostMapping("export/queryTeacherAttendances")
     @PreAuthorize("@pcs.hasPermissions('export/queryTeacherAttendances')")