|
@@ -10,6 +10,7 @@ import java.util.function.BiFunction;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
@@ -25,15 +26,20 @@ import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
+import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
|
+import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.ini.IniFileUtil;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.system.ApplicationHome;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
@@ -43,10 +49,13 @@ 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.web.bind.annotation.GetMapping;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import static com.ym.mec.biz.dal.enums.QuestionnaireActiveTypeEnum.CLOUD_TEACHER_FEEDBACK;
|
|
|
+
|
|
|
@Service
|
|
|
public class ExportServiceImpl implements ExportService {
|
|
|
|
|
@@ -93,6 +102,8 @@ public class ExportServiceImpl implements ExportService {
|
|
|
@Autowired
|
|
|
private OrganizationService organizationService;
|
|
|
@Autowired
|
|
|
+ private StudentInstrumentDao studentInstrumentDao;
|
|
|
+ @Autowired
|
|
|
private VipGroupService vipGroupService;
|
|
|
@Autowired
|
|
|
private PracticeGroupService practiceGroupService;
|
|
@@ -167,6 +178,9 @@ public class ExportServiceImpl implements ExportService {
|
|
|
@Autowired
|
|
|
private SysUserCashAccountLogService sysUserCashAccountLogService;
|
|
|
|
|
|
+ @Value("${spring.profiles.active:dev}")
|
|
|
+ private String profiles;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Map<String,String> getExportMap(ExportDto exportDto) throws IOException {
|
|
@@ -184,7 +198,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
for (int i = 0; i < headColumns.size(); i++) {
|
|
|
headMap.put(headColumns.get(i),fieldColumns.get(i));
|
|
|
}
|
|
|
- headMap.keySet().removeAll(org.apache.commons.collections.CollectionUtils.subtract(headColumns, exportDto.getHeadColumns()));
|
|
|
+ headMap.keySet().removeAll(org.apache.commons.collections.CollectionUtils.subtract(headColumns, paramColumns));
|
|
|
return headMap;
|
|
|
}
|
|
|
|
|
@@ -319,6 +333,8 @@ public class ExportServiceImpl implements ExportService {
|
|
|
exportFuncMap.put(ExportEnum.COUNT_CLOUD_TEACHER_ACTIVE_DETAIL, info -> countCloudTeacherActiveDetail(info));
|
|
|
exportFuncMap.put(ExportEnum.MUSIC_ENLIGHTENMENT_QUESTIONNAIRES, info -> musicEnlightenmentQuestionnaireService.queryPage(getQueryInfo(info,TeacherServeQueryInfo.class,false)).getRows());
|
|
|
exportFuncMap.put(ExportEnum.EXERCISES_SITUATION, info -> studentExtracurricularExercisesSituationService.queryTeacherPerformanceIndicator(getQueryInfo(info,TeacherServeQueryInfo.class,false)));
|
|
|
+ exportFuncMap.put(ExportEnum.STUDENT_INSTRUMENT, info -> exportStudentInstrument(info));
|
|
|
+ exportFuncMap.put(ExportEnum.EXPORT_BILL, info -> exportBill(info));
|
|
|
|
|
|
//导出到报表中心
|
|
|
// exportManageFuncMap.put(ExportEnum.SUPER_FIND_COURSE_SCHEDULES, (info,headColumns) -> this.superFindCourseSchedules(info,headColumns));
|
|
@@ -331,6 +347,149 @@ public class ExportServiceImpl implements ExportService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //导出对账单
|
|
|
+ @Override
|
|
|
+ public List exportBill(Map<String, Object> info){
|
|
|
+ String startTimeStr = getParam(info, "startTime", String.class);
|
|
|
+ Date startTime = null;
|
|
|
+ if(StringUtils.isNotEmpty(startTimeStr)){
|
|
|
+ startTime = DateUtil.stringToDate(startTimeStr,DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ }
|
|
|
+ Date endTime = null;
|
|
|
+ String endTimeStr = getParam(info, "endTime", String.class);
|
|
|
+ if(StringUtils.isNotEmpty(endTimeStr)){
|
|
|
+ endTime = DateUtil.stringToDate(endTimeStr,DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ }
|
|
|
+ long createdGte = startTime.getTime();
|
|
|
+ long createdLte = DateUtil.getLastSecondWithDay(endTime).getTime();
|
|
|
+ int pageIndex = 1;
|
|
|
+ List<Map<String, Object>> data = new ArrayList<>();
|
|
|
+ while (profiles.equals("prod")) {
|
|
|
+ Map<String, Object> paymentList = null;
|
|
|
+ try {
|
|
|
+ paymentList = Payment.queryList(pageIndex, createdGte, createdLte);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ JSONArray payments = (JSONArray) paymentList.get("payments");
|
|
|
+ if (!paymentList.get("status").equals("succeeded")) {
|
|
|
+ throw new BizException("查询失败,请重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (payments != null && payments.size() > 0) {
|
|
|
+ for (Object payment : payments) {
|
|
|
+ Map<String, Object> paymentMap = (Map<String, Object>) payment;
|
|
|
+ if (!paymentMap.get("status").equals("succeeded")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ paymentMap.put("created_time", DateUtil.timeStamp2Date(paymentMap.get("created_time").toString(), null));
|
|
|
+ if (paymentMap.get("pay_channel").equals("alipay_qr")) {
|
|
|
+ paymentMap.put("pay_channel", "支付宝正扫");
|
|
|
+ } else if (paymentMap.get("pay_channel").equals("alipay_wap")) {
|
|
|
+ paymentMap.put("pay_channel", "支付宝H5支付");
|
|
|
+ } else {
|
|
|
+ paymentMap.put("pay_channel", "微信公众号支付");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (paymentMap.get("status").equals("pending")) {
|
|
|
+ paymentMap.put("status", "交易处理中");
|
|
|
+ } else if (paymentMap.get("status").equals("succeeded")) {
|
|
|
+ paymentMap.put("status", "交易成功");
|
|
|
+ } else {
|
|
|
+ paymentMap.put("status", "交易失败");
|
|
|
+ }
|
|
|
+ if (paymentMap.get("pay_mode").equals("delay")) {
|
|
|
+ if (!paymentMap.containsKey("payment_confirms")) {
|
|
|
+ Map<String, Object> confirmMap = null;
|
|
|
+ try {
|
|
|
+ confirmMap = Payment.queryConfirmList(paymentMap.get("id").toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (confirmMap.containsKey("payment_confirms")) {
|
|
|
+ paymentMap.put("payment_confirms", confirmMap.get("payment_confirms"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!paymentMap.containsKey("payment_confirms")) {
|
|
|
+ paymentMap.put("memo", "没有提交分账信息,请联系技术核查");
|
|
|
+ data.add(paymentMap);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONArray confirms = (JSONArray) paymentMap.get("payment_confirms");
|
|
|
+ for (Object confirm : confirms) {
|
|
|
+ Map<String, Object> divMemberMap = (Map<String, Object>) confirm;
|
|
|
+ paymentMap.put("fee_amt", divMemberMap.get("fee_amt"));
|
|
|
+ divMemberMap.putAll(paymentMap);
|
|
|
+
|
|
|
+ JSONArray divMembers = (JSONArray) divMemberMap.get("div_members");
|
|
|
+ Map<String, Object> divMember = (Map<String, Object>) divMembers.get(0);
|
|
|
+ divMemberMap.putAll(divMember);
|
|
|
+ if (divMemberMap.get("member_id").equals("0")) {
|
|
|
+ divMemberMap.put("member_id", ConfigInit.merNo);
|
|
|
+ }
|
|
|
+ data.add(divMemberMap);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ JSONArray divMembers = (JSONArray) paymentMap.get("div_members");
|
|
|
+ for (Object divMember : divMembers) {
|
|
|
+ Map<String, Object> divMemberMap = (Map<String, Object>) divMember;
|
|
|
+ divMemberMap.putAll(paymentMap);
|
|
|
+ if (divMemberMap.get("member_id").equals("0")) {
|
|
|
+ divMemberMap.put("member_id", ConfigInit.merNo);
|
|
|
+ }
|
|
|
+ if (divMemberMap.get("fee_flag").equals("N")) {
|
|
|
+ divMemberMap.put("fee_amt", "0.00");
|
|
|
+ }
|
|
|
+ data.add(divMemberMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (paymentList.get("has_more").equals(false)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ pageIndex++;
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ //乐保导出
|
|
|
+ @Override
|
|
|
+ public List exportStudentInstrument(Map<String, Object> info){
|
|
|
+ String startTimeStr = getParam(info, "startTime", String.class);
|
|
|
+ Date startTime = null;
|
|
|
+ if(StringUtils.isNotEmpty(startTimeStr)){
|
|
|
+ startTime = DateUtil.stringToDate(startTimeStr,DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ }
|
|
|
+ Date endTime = null;
|
|
|
+ String endTimeStr = getParam(info, "endTime", String.class);
|
|
|
+ if(StringUtils.isNotEmpty(endTimeStr)){
|
|
|
+ endTime = DateUtil.stringToDate(endTimeStr,DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ }
|
|
|
+ String organId = organizationService.getEmployeeOrgan("");
|
|
|
+
|
|
|
+ if (startTime != null) {
|
|
|
+ startTime = DateUtil.trunc(startTime);
|
|
|
+ }
|
|
|
+ if (endTime != null) {
|
|
|
+ endTime = DateUtil.getLastTimeWithDay(endTime);
|
|
|
+ }
|
|
|
+ List<StudentInstrumentExportDto> instruments = studentInstrumentDao.getInstruments(startTime, endTime, organId, TenantContextHolder.getTenantId());
|
|
|
+
|
|
|
+ if (instruments.size() <= 0) {
|
|
|
+ throw new BizException("没有可导出的记录");
|
|
|
+ }
|
|
|
+ for (StudentInstrumentExportDto instrument : instruments) {
|
|
|
+ StudentRegistration studentMusicGroup = studentInstrumentDao.findStudentMusicGroup(instrument.getStudentId());
|
|
|
+ if (studentMusicGroup != null) {
|
|
|
+ instrument.setRepairerName(studentMusicGroup.getParentsName());
|
|
|
+ instrument.setMusicGroupName(studentMusicGroup.getClassGroupName());
|
|
|
+ instrument.setStudentStatus(studentMusicGroup.getMusicGroupStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return instruments;
|
|
|
+ }
|
|
|
+
|
|
|
//班级列表导出
|
|
|
@Override
|
|
|
public List exportClassGroup(Map<String, Object> info){
|
|
@@ -631,7 +790,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
@Override
|
|
|
public List isSettlementCourseSalarys(Map<String, Object> info){
|
|
|
CourseSalaryQueryInfo4Web queryInfo = JSONObject.parseObject(JSONObject.toJSONString(info),CourseSalaryQueryInfo4Web.class);
|
|
|
- queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
+ queryInfo.setOrganIdList(organizationService.getEmployeeOrgan(queryInfo.getOrganIdList()));
|
|
|
List<TeacherCourseSalaryDetail4WebDto> rows = courseScheduleTeacherSalaryService.findIsSettlementCourseSalarys(queryInfo).getRows();
|
|
|
if (CollectionUtils.isEmpty(rows)) {
|
|
|
throw new BizException("没有可导出的记录");
|
|
@@ -775,7 +934,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
@Override
|
|
|
public List studentOrder(Map<String, Object> info){
|
|
|
String organIds = getParam(info,"organIds",String.class);
|
|
|
- Date date = getParam(info,"date",Date.class);
|
|
|
+ Date date = DateUtil.stringToDate(getParam(info,"date",String.class),DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
organIds = organizationService.getEmployeeOrgan(sysUser.getId(), organIds, sysUser.getIsSuperAdmin());
|
|
|
Date startTime = DateUtil.getFirstDayOfMonth(date);
|
|
@@ -983,8 +1142,8 @@ public class ExportServiceImpl implements ExportService {
|
|
|
HashSet<Integer> added = new HashSet<>();
|
|
|
//获取用户选择的表头和表字段
|
|
|
Map<String, String> exportMap = getExportMap(exportDto);
|
|
|
- Set<String> header = exportMap.keySet();
|
|
|
- Collection<String> body = exportMap.values();
|
|
|
+ Set<String> header = new LinkedHashSet<>(exportMap.keySet());
|
|
|
+ Set<String> body = new LinkedHashSet<>(exportMap.values());
|
|
|
for (RegisterSubjectDto registerSubject : registerSubjects) {
|
|
|
if (!added.contains(registerSubject.getSubjectId())) {
|
|
|
added.add(registerSubject.getSubjectId());
|
|
@@ -1127,8 +1286,8 @@ public class ExportServiceImpl implements ExportService {
|
|
|
HashSet<Integer> added = new HashSet<>();
|
|
|
//获取用户选择的表头和表字段
|
|
|
Map<String, String> exportMap = getExportMap(exportDto);
|
|
|
- Set<String> header = exportMap.keySet();
|
|
|
- Collection<String> body = exportMap.values();
|
|
|
+ Set<String> header = new LinkedHashSet<>(exportMap.keySet());
|
|
|
+ Set<String> body = new LinkedHashSet<>(exportMap.values());
|
|
|
for (RegisterSubjectDto registerSubject : registerSubjects) {
|
|
|
if (!added.contains(registerSubject.getSubjectId())) {
|
|
|
added.add(registerSubject.getSubjectId());
|