|
@@ -2,6 +2,7 @@ package com.minpay.reportManage.action;
|
|
|
|
|
|
import java.io.OutputStream;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -16,6 +17,8 @@ import com.minpay.common.bean.User;
|
|
|
import com.minpay.common.constant.Constant;
|
|
|
import com.minpay.common.format.IFormatService;
|
|
|
import com.minpay.common.service.IDianwangService;
|
|
|
+import com.minpay.common.service.IReportService;
|
|
|
+import com.minpay.common.service.impl.ReportServiceImpl;
|
|
|
import com.minpay.common.util.CommonUtil;
|
|
|
import com.minpay.common.util.ListUtil;
|
|
|
import com.minpay.db.table.mapper.DwAlgorithmInfMapper;
|
|
@@ -23,6 +26,7 @@ import com.minpay.db.table.mapper.DwBranchReportTypeMapper;
|
|
|
import com.minpay.db.table.mapper.DwReportDataMapper;
|
|
|
import com.minpay.db.table.mapper.DwReportFileRelMapper;
|
|
|
import com.minpay.db.table.mapper.DwReportInfMapper;
|
|
|
+import com.minpay.db.table.mapper.DwReporttypeFiletypeRelMapper;
|
|
|
import com.minpay.db.table.mapper.DwUtilDataInfMapper;
|
|
|
import com.minpay.db.table.model.DwAlgorithmInf;
|
|
|
import com.minpay.db.table.model.DwAlgorithmInfExample;
|
|
@@ -31,6 +35,8 @@ import com.minpay.db.table.model.DwBranchReportTypeExample;
|
|
|
import com.minpay.db.table.model.DwReportData;
|
|
|
import com.minpay.db.table.model.DwReportFileRelKey;
|
|
|
import com.minpay.db.table.model.DwReportInf;
|
|
|
+import com.minpay.db.table.model.DwReporttypeFiletypeRelExample;
|
|
|
+import com.minpay.db.table.model.DwReporttypeFiletypeRelKey;
|
|
|
import com.minpay.db.table.model.DwUtilDataInf;
|
|
|
import com.minpay.db.table.model.DwUtilDataInfExample;
|
|
|
import com.minpay.db.table.own.mapper.ReportManageMapper;
|
|
@@ -63,6 +69,10 @@ public class ReportManageAction implements IMINAction {
|
|
|
public final static String FILE_INF_REPORT_QUERY = "fileInfReportQuery";
|
|
|
|
|
|
|
|
|
+ /** 根据不同的报表类型查询对应时间范围类的所需数据 */
|
|
|
+ public final static String REPORT_NEED_DATA_DETAIL = "reportNeedDataDetail";
|
|
|
+
|
|
|
+
|
|
|
/** 生成报表 */
|
|
|
public final static String FILE_INF_REPORT_SUBMIT = "fileInfReportSubmit";
|
|
|
|
|
@@ -82,10 +92,6 @@ public class ReportManageAction implements IMINAction {
|
|
|
/** 报告修改 */
|
|
|
public final static String REPORT_INF_UPDATE = "reportInfUpdate";
|
|
|
|
|
|
-
|
|
|
- /** 查询报告算法id */
|
|
|
- public final static String REPORT_ALGORITHM_ID = "reportAlgorithmId";
|
|
|
-
|
|
|
/**
|
|
|
* 报表查询
|
|
|
* @param page
|
|
@@ -209,6 +215,38 @@ public class ReportManageAction implements IMINAction {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 报告明细信息组装
|
|
|
+ * @param chooseFileListStr
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ * @throws MINBusinessException
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @MINAction(value = REPORT_NEED_DATA_DETAIL)
|
|
|
+ public MINActionResult reportNeedDataDetail(
|
|
|
+ @MINParam(key = "range") String range,
|
|
|
+ @MINParam(key = "timeRange") String timeRange,
|
|
|
+ @MINParam(key = "reportInf") String reportInf,
|
|
|
+ @MINParam(key = "monthNum") String monthNum,
|
|
|
+ @MINParam(key = "countNum") String countNum
|
|
|
+ ) throws MINBusinessException, ParseException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+
|
|
|
+ // 报表类型id
|
|
|
+ String reportTypeId = reportInf.split("_")[0];
|
|
|
+
|
|
|
+ Map<String, String> param = new HashMap<String, String>();
|
|
|
+ param.put("range", range);
|
|
|
+ param.put("timeRange", timeRange);
|
|
|
+ param.put("reportTypeId", reportTypeId);
|
|
|
+ param.put("monthNum", monthNum);
|
|
|
+ param.put("countNum", countNum);
|
|
|
+ Map<String, Object> resMap = Service.lookup(IReportService.class).reportNeedDetail(param);
|
|
|
+ res.set(IMINBusinessConstant.F_PAGING_LAY, resMap);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 报表提交
|
|
|
* @param reportData
|
|
|
* @param chooseFileData
|
|
@@ -221,29 +259,17 @@ public class ReportManageAction implements IMINAction {
|
|
|
@MINAction(value = FILE_INF_REPORT_SUBMIT, transaction = IMINTransactionEnum.CMT)
|
|
|
public MINActionResult fileInfReportSubmit(
|
|
|
@MINParam(key = "reportData") String reportData,
|
|
|
- @MINParam(key = "chooseFileData") String chooseFileData,
|
|
|
@MINParam(key = "reportInf") String reportInf,
|
|
|
@MINParam(key = "fileName") String fileName,
|
|
|
+ @MINParam(key = "range") String range,
|
|
|
+ @MINParam(key = "timeRange") String timeRange,
|
|
|
MINSession session
|
|
|
) throws MINBusinessException {
|
|
|
db = Service.lookup(IMINDataBaseService.class);
|
|
|
MINActionResult res = new MINActionResult();
|
|
|
|
|
|
- // 选中原始数据
|
|
|
- JSONArray chooseFileDataLis = JSONArray.fromObject(chooseFileData);
|
|
|
-
|
|
|
-
|
|
|
String reportId = db.getMybatisMapper(SequenceMapper.class).getSequence("REPORT_INF_NO");
|
|
|
|
|
|
- // 生成报表和原始文件的关系表
|
|
|
- for (Object object : chooseFileDataLis) {
|
|
|
- Map<String, String> chooseFile = (Map<String, String>)object;
|
|
|
- DwReportFileRelKey reportFileRelKey = new DwReportFileRelKey();
|
|
|
- reportFileRelKey.setFileId(chooseFile.get("id"));
|
|
|
- reportFileRelKey.setReportId(reportId);
|
|
|
- db.insertSelective(DwReportFileRelMapper.class, reportFileRelKey);
|
|
|
- }
|
|
|
-
|
|
|
String reportType = reportInf.split("_")[1];
|
|
|
String reportTypeId = reportInf.split("_")[0];
|
|
|
// 生成报表数据表
|
|
@@ -262,7 +288,9 @@ public class ReportManageAction implements IMINAction {
|
|
|
report.setCreatUser(user.getId());
|
|
|
report.setBranch(user.getBranchid());
|
|
|
report.setType(reportTypeId);
|
|
|
- report.setState("0");
|
|
|
+
|
|
|
+ report.setDayInterval(range); // 日期时间段
|
|
|
+ report.setTimeInterval(timeRange.replaceAll(" ", "")); // 时分秒时间段
|
|
|
db.insertSelective(DwReportInfMapper.class, report);
|
|
|
|
|
|
return res;
|
|
@@ -383,28 +411,4 @@ public class ReportManageAction implements IMINAction {
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- @MINAction(value = REPORT_ALGORITHM_ID)
|
|
|
- public MINActionResult reportAlgorithmId(
|
|
|
- @MINParam(key = "reportTypeId") String reportTypeId,
|
|
|
- MINSession session
|
|
|
- ) throws MINBusinessException {
|
|
|
- db = Service.lookup(IMINDataBaseService.class);
|
|
|
- MINActionResult res = new MINActionResult();
|
|
|
-
|
|
|
- // 查询关联的工具表和算法
|
|
|
- DwUtilDataInfExample utilDataInfExample = new DwUtilDataInfExample();
|
|
|
- utilDataInfExample.createCriteria().andReportTypeIdEqualTo(reportTypeId);
|
|
|
- List<DwUtilDataInf> utilDataInfList = db.selectByExample(DwUtilDataInfMapper.class, utilDataInfExample);
|
|
|
- if (utilDataInfList.size() != 0) {
|
|
|
- DwAlgorithmInfExample algorithmInfExample = new DwAlgorithmInfExample();
|
|
|
- algorithmInfExample.createCriteria().andUtilDataIdEqualTo(utilDataInfList.get(0).getId());
|
|
|
- List<DwAlgorithmInf> algorithmInflist = db.selectByExample(DwAlgorithmInfMapper.class, algorithmInfExample);
|
|
|
- if (algorithmInflist.size() != 0) {
|
|
|
- res.set("algorithmId", algorithmInflist.get(0).getId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return res;
|
|
|
- }
|
|
|
}
|