|
@@ -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,12 +26,15 @@ 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;
|
|
@@ -172,6 +176,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 {
|
|
@@ -325,6 +332,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
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));
|
|
@@ -337,6 +345,112 @@ 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){
|