|
@@ -337,7 +337,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
exportManageFuncMap.put(ExportEnum.ROUTE_ORDER_LIST2, (info,headColumns) -> routeOrderList(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.ORDER_LIST1, (info,headColumns) -> orderList(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.ORDER_LIST2, (info,headColumns) -> orderList(info,headColumns));
|
|
|
- exportManageFuncMap.put(ExportEnum.ORDER_LIST_NEW, (info,headColumns) -> orderList(info,headColumns));
|
|
|
+ exportManageFuncMap.put(ExportEnum.ORDER_LIST_SUM, (info,headColumns) -> orderList(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.STUDENT_VIP_PRACTICE, (info,headColumns) -> exportStudentVipPractice(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.STUDENT_VIP_COURSE_INFO, (info,headColumns) -> exportStudentVipCourseInfo(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.STUDENT_MUSIC_THEORY_COURSE_INFO, (info,headColumns) -> exportStudentMusicTheoryCourseInfo(info,headColumns));
|
|
@@ -1532,6 +1532,46 @@ public class ExportServiceImpl implements ExportService {
|
|
|
return succeed;
|
|
|
}
|
|
|
|
|
|
+ //订单列表导出
|
|
|
+ @Override
|
|
|
+ public HttpResponseResult orderListSum(Map<String, Object> info,List<String> headColumns){
|
|
|
+ StudentPaymentOrderQueryInfo queryInfo = JSONObject.parseObject(JSONObject.toJSONString(info),StudentPaymentOrderQueryInfo.class);
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if(sysUser == null || sysUser.getId() == null){
|
|
|
+ return BaseController.failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+ queryInfo.setOrganId(organizationService.getEmployeeOrgan(sysUser.getId(),queryInfo.getOrganId(),sysUser.getIsSuperAdmin()));
|
|
|
+ if (StringUtils.isNotBlank(queryInfo.getSearch())) {
|
|
|
+ List<BasicUserDto> users = studentPaymentOrderDao.getUsers(queryInfo.getSearch());
|
|
|
+ List<Integer> userIds = users.stream().map(BasicUserDto::getUserId).collect(Collectors.toList());
|
|
|
+ if (userIds.size() <= 0) {
|
|
|
+ userIds.add(0);
|
|
|
+ }
|
|
|
+ queryInfo.setUserIds(userIds);
|
|
|
+ }
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ int count = studentPaymentOrderDao.queryCount(params);
|
|
|
+ if (count <= 0) {
|
|
|
+ return BaseController.failed("没有可导出的数据");
|
|
|
+ }
|
|
|
+ if (count > 50000) {
|
|
|
+ return BaseController.failed("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
+ }
|
|
|
+ ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.ORDER,sysUser.getId());
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.orderListSum(params, managerDownload, headColumns);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
+ HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
+ succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
+ return succeed;
|
|
|
+ }
|
|
|
+
|
|
|
//保存下载记录
|
|
|
@Override
|
|
|
public ManagerDownload saveManagerDownload(ExportTypeEnum exportTypeEnum, Integer userId){
|
|
@@ -1951,6 +1991,402 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void orderListSum(Map<String, Object> params, ManagerDownload managerDownload,List<String> headColumns) throws FileNotFoundException {
|
|
|
+ List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentOrderService.ExportQueryPage(params);
|
|
|
+ long i = 1;
|
|
|
+ Map<Integer, String> cooperationOrganMap = new HashMap<>();
|
|
|
+ List<Integer> cooperationOrganIds = studentPaymentOrderExportDtos.stream()
|
|
|
+ .filter(e -> OrderTypeEnum.OUTORDER.equals(e.getType()))
|
|
|
+ .filter(e -> e.getMusicGroupId() != null)
|
|
|
+ .map(e -> Integer.valueOf(e.getMusicGroupId()))
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (cooperationOrganIds.size() > 0) {
|
|
|
+ List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getCooperationOrganByIds(cooperationOrganIds);
|
|
|
+ cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(CooperationOrgan::getId, CooperationOrgan::getName));
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取机构费率
|
|
|
+ Integer tenantId = (Integer) params.get("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> userFirstPracticeMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.findUserFirstVipMap("PRACTICE",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) {
|
|
|
+ if (row.getActualAmount() == null) {
|
|
|
+ row.setActualAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (row.getBalancePaymentAmount() == null) {
|
|
|
+ row.setBalancePaymentAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (row.getMemo() == null) {
|
|
|
+ row.setMemo("");
|
|
|
+ }
|
|
|
+ BigDecimal transferFee = BigDecimal.ZERO;
|
|
|
+ if (row.getPaymentChannel() != null && row.getPaymentChannel().equals("ADAPAY")) {
|
|
|
+ transferFee = row.getActualAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ row.setTransferFee(transferFee);
|
|
|
+ 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(StringUtils.isEmpty(firstMusicId)){
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.NEW_MUSIC);
|
|
|
+ }else {
|
|
|
+ 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 = "";
|
|
|
+ if (row.getOrderDetailList() != null) {
|
|
|
+ for (StudentPaymentOrderDetail orderDetail : row.getOrderDetailList()) {
|
|
|
+ switch (orderDetail.getType()) {
|
|
|
+ case COURSE:
|
|
|
+ case CLASSROOM:
|
|
|
+ case SINGLE:
|
|
|
+ case MIX:
|
|
|
+ case COMPREHENSIVE:
|
|
|
+ case ENLIGHTENMENT:
|
|
|
+ case TRAINING_SINGLE:
|
|
|
+ case TRAINING_MIX:
|
|
|
+ case MUSIC_NETWORK:
|
|
|
+ case HIGH:
|
|
|
+ case HIGH_ONLINE:
|
|
|
+ case HIGH_ONLINE_COURSE:
|
|
|
+ row.setMusicGroupCourseFee(row.getMusicGroupCourseFee().add(orderDetail.getPrice()));
|
|
|
+ break;
|
|
|
+ case MUSICAL:
|
|
|
+ if (orderDetail.getKitGroupPurchaseType() != null && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
+ BigDecimal leaseFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ leaseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ row.setLeaseFee(leaseFee);
|
|
|
+ } else {
|
|
|
+ row.setMusicalFee(orderDetail.getPrice());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ACCESSORIES:
|
|
|
+ case TEACHING:
|
|
|
+ row.setTeachingFee(row.getTeachingFee().add(orderDetail.getPrice()));
|
|
|
+ break;
|
|
|
+ case OTHER:
|
|
|
+ row.setOtherFee(row.getOtherFee().add(orderDetail.getPrice()));
|
|
|
+ break;
|
|
|
+ case MAINTENANCE:
|
|
|
+ BigDecimal repairFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ repairFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ row.setMaintenanceFee(repairFee);
|
|
|
+ break;
|
|
|
+ case CLOUD_TEACHER:
|
|
|
+ case CLOUD_TEACHER_PLUS:
|
|
|
+ BigDecimal cloudTeacherFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ cloudTeacherFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ row.setCloudTeacherFee(cloudTeacherFee);
|
|
|
+ break;
|
|
|
+ case DEGREE_REGISTRATION:
|
|
|
+ BigDecimal degreeFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ degreeFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ row.setDegreeFee(degreeFee);
|
|
|
+ break;
|
|
|
+ case VIP:
|
|
|
+ BigDecimal vipCourseFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ vipCourseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ case THEORY_COURSE:
|
|
|
+ BigDecimal theoryCourseFee = BigDecimal.ZERO;
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ theoryCourseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ row.setTheoryCourseFee(theoryCourseFee);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (row.getGoodsList() != null) {
|
|
|
+ goodsName = row.getGoodsList().stream().map(Goods::getName).collect(Collectors.joining("|"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(goodsName)) {
|
|
|
+ row.setMemo(goodsName);
|
|
|
+ }
|
|
|
+ //专业
|
|
|
+ if (row.getGroupType().equals(GroupType.VIP)) {
|
|
|
+ row.setVipCourseFee(row.getActualAmount());
|
|
|
+ VipGroup vipGroupInfo = vipGroupDao.findVipGroupInfo(Integer.parseInt(row.getMusicGroupId()), row.getClassGroupId());
|
|
|
+ if (vipGroupInfo != null) {
|
|
|
+ row.setSchoolName(vipGroupInfo.getSchoolName());
|
|
|
+ row.setSubjectName(vipGroupInfo.getSubjectName());
|
|
|
+ row.setEduTeacher(vipGroupInfo.getEducationalTeacherName());
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(row.getGroupType() == GroupType.ACTIVITY){
|
|
|
+ row.setVipCourseFee(row.getActualAmount());
|
|
|
+ }else if(row.getGroupType() == GroupType.MEMBER){
|
|
|
+ row.setCloudTeacherFee(row.getActualAmount());
|
|
|
+ } else if (row.getGroupType().equals(GroupType.SPORADIC)) {
|
|
|
+ //考级报名
|
|
|
+ if (row.getType().equals(OrderTypeEnum.DEGREE_REGISTRATION)) {
|
|
|
+ String[] feeTypes = row.getMemo().split(";");
|
|
|
+ List<String> feeTypeList = Arrays.asList(feeTypes);
|
|
|
+ for (String feeTypeStr : feeTypeList) {
|
|
|
+ int index = feeTypeStr.lastIndexOf(":");
|
|
|
+ if (index < 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ BigDecimal typeFee = new BigDecimal(feeTypeStr.substring(index + 1));
|
|
|
+ if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ }
|
|
|
+ if (feeTypeStr.contains("VIP")) {
|
|
|
+ row.setVipCourseFee(typeFee);
|
|
|
+ } else if (feeTypeStr.contains("网管课")) {
|
|
|
+ row.setPracticeCourseFee(typeFee);
|
|
|
+ } else if (feeTypeStr.contains("乐理课")) {
|
|
|
+ row.setTheoryCourseFee(typeFee);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.setDegreeFee(row.getActualAmount().subtract(row.getVipCourseFee()).subtract(row.getPracticeCourseFee()).subtract(row.getTheoryCourseFee()));
|
|
|
+ } else {
|
|
|
+ if (row.getChargeType() != null && SporadicChargeTypeEnum.LEVEL.getCode().equals(row.getChargeType())) {
|
|
|
+ row.setDegreeFee(row.getActualAmount());
|
|
|
+ } else if (row.getChargeType() != null && SporadicChargeTypeEnum.PRACTICE_GROUP_BUY.getCode().equals(row.getChargeType())) {
|
|
|
+ row.setPracticeCourseFee(row.getActualAmount());
|
|
|
+ } else if (row.getChargeType() != null && SporadicChargeTypeEnum.MUSIC_UPKEEP.getCode().equals(row.getChargeType())) {
|
|
|
+ row.setMaintenanceFee(row.getActualAmount());
|
|
|
+ } else if (row.getChargeType() != null && SporadicChargeTypeEnum.VISITING_FEE.getCode().equals(row.getChargeType())) {
|
|
|
+ row.setVisitFee(row.getActualAmount());
|
|
|
+ } else if (row.getChargeType() != null && (SporadicChargeTypeEnum.RECHARGE.getCode().equals(row.getChargeType()) ||
|
|
|
+ SporadicChargeTypeEnum.HIGH_ONLINE_ACTIVITY.getCode().equals(row.getChargeType()))) {
|
|
|
+ row.setRechargeFee(row.getActualAmount());
|
|
|
+ } else if (row.getChargeType() != null && SporadicChargeTypeEnum.CLOUD_TEACHER_BUY.getCode().equals(row.getChargeType())) {
|
|
|
+ row.setCloudTeacherFee(row.getActualAmount());
|
|
|
+ } else {
|
|
|
+ row.setOtherFee(row.getActualAmount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (row.getChargeType() != null) {
|
|
|
+ for (SporadicChargeTypeEnum chargeType : SporadicChargeTypeEnum.values()) {
|
|
|
+ if (!chargeType.getCode().equals(row.getChargeType())) continue;
|
|
|
+ row.setSporadicType(chargeType.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.getGroupType().equals(GroupType.PRACTICE)) {
|
|
|
+ row.setPracticeCourseFee(row.getActualAmount());
|
|
|
+ PracticeCourseDto practiceGroup = practiceGroupDao.findByGroupId(Integer.parseInt(row.getMusicGroupId()));
|
|
|
+ if (practiceGroup != null) {
|
|
|
+ row.setSubjectName(practiceGroup.getSubjectName());
|
|
|
+ row.setEduTeacher(practiceGroup.getEduTeacherName());
|
|
|
+ }
|
|
|
+ if(row.getTypeDesc() == null){
|
|
|
+ if(Objects.equals(userFirstPracticeMap.get(row.getUserId()),row.getMusicGroupId())){
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.NEW_PRACTICE);
|
|
|
+ }else {
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.RENEW_PRACTICE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.getGroupType().equals(GroupType.REPLACEMENT)) {
|
|
|
+ row.setMusicalFee(row.getActualAmount());
|
|
|
+ ReplacementInstrumentActivityStatDto info = replacementInstrumentActivityDao.getInfo(Integer.parseInt(row.getMusicGroupId()));
|
|
|
+ if (info != null) {
|
|
|
+ row.setSubjectName(info.getSubjectName());
|
|
|
+ row.setCooperationOrganName(info.getCooperationOrganName());
|
|
|
+ row.setMemo(info.getBrand() + "(" + info.getSpecification() + ")");
|
|
|
+ CooperationOrgan cooperationOrganEduTeacher = musicGroupDao.findCooperationOrganEduTeacher(info.getCooperationOrganId());
|
|
|
+ if (cooperationOrganEduTeacher != null) {
|
|
|
+ row.setEduTeacher(cooperationOrganEduTeacher.getLinkman());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (row.getGroupType().equals(GroupType.GOODS_SELL)) {
|
|
|
+ row.setRetailGoodsFee(row.getActualAmount());
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.RETAIL_GOODS);
|
|
|
+ } else if (row.getGroupType().equals(GroupType.OUTORDER)) {
|
|
|
+ row.setLargeMusicalFee(row.getActualAmount());
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.LARGE_MUSICAL);
|
|
|
+ } else {
|
|
|
+ StudentPaymentOrderExportDto feeByType = sellOrderDao.getFeeByType(row.getId());
|
|
|
+ BigDecimal childRepairFee = sellOrderDao.getChildRepair(row.getId());
|
|
|
+ row.setMusicalFee(feeByType.getMusicalFee());
|
|
|
+ row.setTeachingFee(feeByType.getTeachingFee().subtract(childRepairFee));
|
|
|
+ row.setMaintenanceProductFee(feeByType.getRepairFee().add(childRepairFee));
|
|
|
+ row.setOtherFee(feeByType.getOtherFee());
|
|
|
+ if (row.getGroupType().equals(GroupType.MUSIC)) {
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
|
|
|
+ if (studentRegistration != null) {
|
|
|
+ row.setSubjectName(studentRegistration.getSubjectName());
|
|
|
+ row.setSchoolName(studentRegistration.getSchoolName());
|
|
|
+ row.setCooperationOrganName(studentRegistration.getRemark());
|
|
|
+ row.setEduTeacher(studentRegistration.getName());
|
|
|
+ }
|
|
|
+ row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()).subtract(row.getCloudTeacherFee()));
|
|
|
+ } else if (row.getType().equals(OrderTypeEnum.REPAIR)) {
|
|
|
+ row.setRepairFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getOtherFee()));
|
|
|
+ } else if (row.getType().equals(OrderTypeEnum.OUTORDER)) {
|
|
|
+ row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()));
|
|
|
+ row.setTransferFee(BigDecimal.ZERO);
|
|
|
+ row.setPlatformFee(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果合作单位不存在取学员的第一个乐团的合作单位,乐团主管
|
|
|
+ if (row.getCooperationOrganName() == null) {
|
|
|
+ CooperationOrgan cooperationOrgan = studentService.getStudentEduTeacher(row.getUserId());
|
|
|
+ if (cooperationOrgan != null) {
|
|
|
+ row.setCooperationOrganName(cooperationOrgan.getName());
|
|
|
+ row.setEduTeacher(cooperationOrgan.getLinkman() != null ? cooperationOrgan.getLinkman() : row.getEduTeacher());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (row.getType().equals(OrderTypeEnum.OUTORDER) && row.getMusicGroupId() != null) {
|
|
|
+ if (cooperationOrganMap.containsKey(Integer.valueOf(row.getMusicGroupId()))) {
|
|
|
+ row.setCooperationOrganName(cooperationOrganMap.get(Integer.valueOf(row.getMusicGroupId())));
|
|
|
+ CooperationOrgan cooperationOrganEduTeacher = musicGroupDao.findCooperationOrganEduTeacher(Integer.valueOf(row.getMusicGroupId()));
|
|
|
+ if (cooperationOrganEduTeacher != null) {
|
|
|
+ row.setEduTeacher(cooperationOrganEduTeacher.getLinkman());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (row.getMusicGroupId() != null && row.getMusicGroupId().equals("null")) {
|
|
|
+ row.setMusicGroupId("");
|
|
|
+ }
|
|
|
+ String paymentChannel = "";
|
|
|
+ if (row.getPaymentChannel() == null) {
|
|
|
+ } else if (row.getPaymentChannel().equals("YQPAY")) {
|
|
|
+ paymentChannel = "双乾";
|
|
|
+ } else if (row.getPaymentChannel().equals("ADAPAY")) {
|
|
|
+ paymentChannel = "汇付";
|
|
|
+ } else if (row.getPaymentChannel().equals("BALANCE")) {
|
|
|
+ paymentChannel = "余额";
|
|
|
+ }
|
|
|
+ row.setPaymentChannel(paymentChannel);
|
|
|
+ row.setId(i);
|
|
|
+ row.setRepairFee(row.getRepairFee().add(row.getMaintenanceProductFee()));
|
|
|
+ row.setOrderAmount(row.getExpectAmount().add(row.getCouponRemitFee()));
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
|
|
|
+ File file = new File(basePath + "/" + managerDownload.getName());
|
|
|
+ FileOutputStream fileOutputStream = new FileOutputStream(file);
|
|
|
+
|
|
|
+ HSSFWorkbook workbook = null;
|
|
|
+ try {
|
|
|
+ Map<String, String> headMap = getExportMap(new ExportDto(ExportEnum.ORDER_LIST1, headColumns));
|
|
|
+ String[] header = headMap.keySet().toArray(new String[headMap.keySet().size()]);
|
|
|
+ String[] body = headMap.values().toArray(new String[headMap.keySet().size()]);
|
|
|
+ /*if(isPlatformUser){
|
|
|
+ String[] header = {"序号", "学生编号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "订单金额", "应付金额", "现金支付", "余额支付", "优惠金额",
|
|
|
+ "乐团课", "VIP课", "网管课", "乐理课", "考级", "维修费用", "乐保费用", "团练宝", "押金", "乐器", "教辅费用", "上门费",
|
|
|
+ "账户充值", "其它", "汇付手续费","平台手续费", "到账时间",
|
|
|
+ "关联乐团ID/VIP课ID", "课程形态", "零星收款类别", "专业", "分部", "教学点", "合作单位", "乐团主管", "备注"};
|
|
|
+
|
|
|
+ String[] body = {"id", "userId", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "orderAmount", "expectAmount", "actualAmount", "balancePaymentAmount", "couponRemitFee",
|
|
|
+ "musicGroupCourseFee", "vipCourseFee", "practiceCourseFee", "theoryCourseFee", "degreeFee", "repairFee", "maintenanceFee", "cloudTeacherFee",
|
|
|
+ "leaseFee", "musicalFee", "teachingFee", "visitFee", "rechargeFee", "otherFee", "transferFee", "platformFee", "payTime", "musicGroupId",
|
|
|
+ "groupType.desc", "sporadicType", "subjectName", "organName", "schoolName", "cooperationOrganName", "eduTeacher", "memo"};
|
|
|
+ workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
|
|
|
+ }else{
|
|
|
+ String[] header = {"序号", "学生编号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "订单金额", "应付金额", "现金支付", "余额支付", "优惠金额",
|
|
|
+ "乐团课", "VIP课", "网管课", "乐理课", "考级", "维修费用", "乐保费用", "团练宝", "押金", "乐器", "教辅费用", "上门费",
|
|
|
+ "账户充值", "其它","平台手续费", "到账时间",
|
|
|
+ "关联乐团ID/VIP课ID", "课程形态", "零星收款类别", "专业", "分部", "教学点", "合作单位", "乐团主管", "备注"};
|
|
|
+
|
|
|
+ String[] body = {"id", "userId", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "orderAmount", "expectAmount", "actualAmount", "balancePaymentAmount", "couponRemitFee",
|
|
|
+ "musicGroupCourseFee", "vipCourseFee", "practiceCourseFee", "theoryCourseFee", "degreeFee", "repairFee", "maintenanceFee", "cloudTeacherFee",
|
|
|
+ "leaseFee", "musicalFee", "teachingFee", "visitFee", "rechargeFee", "otherFee", "platformFee", "payTime", "musicGroupId",
|
|
|
+ "groupType.desc", "sporadicType", "subjectName", "organName", "schoolName", "cooperationOrganName", "eduTeacher", "memo"};
|
|
|
+ workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
|
|
|
+ workbook.write(fileOutputStream);
|
|
|
+ fileOutputStream.getFD().sync();
|
|
|
+ fileOutputStream.close();
|
|
|
+
|
|
|
+ String folder = "download/" + UploadUtil.getFileFloder();
|
|
|
+ String url = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, folder, file);
|
|
|
+ //把记录插入下载表
|
|
|
+ managerDownload.setFileUrl(url);
|
|
|
+ managerDownload.setStatus(1);
|
|
|
+ managerDownloadDao.update(managerDownload);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ fileOutputStream.close();
|
|
|
+ workbook.close();
|
|
|
+ file.delete();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void routeOrderList(Map<String, Object> params, ManagerDownload managerDownload,List<String> headColumns) throws FileNotFoundException {
|
|
|
List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentRouteOrderDao.ExportQueryPage(params);
|
|
|
|