|
@@ -31,19 +31,92 @@ public class ReportFillingConfigService {
|
|
@Autowired
|
|
@Autowired
|
|
ReportFillingConfigMapper reportFillingConfigMapper;
|
|
ReportFillingConfigMapper reportFillingConfigMapper;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: getDataList
|
|
|
|
+ * @description: 初始化
|
|
|
|
+ * @param : ReportDefinitionModel model,
|
|
|
|
+ * @return:
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
public List<ReportDefinitionModel> getDataList(ReportDefinitionModel model) {
|
|
public List<ReportDefinitionModel> getDataList(ReportDefinitionModel model) {
|
|
return reportFillingConfigMapper.getDataList(model);
|
|
return reportFillingConfigMapper.getDataList(model);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: createReportData
|
|
|
|
+ * @description: 创建报表定义数据
|
|
|
|
+ * @param : ReportDefinitionModel model,
|
|
|
|
+ * @return:
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
public void createReportData(ReportDefinitionModel model) {
|
|
public void createReportData(ReportDefinitionModel model) {
|
|
- reportFillingConfigMapper.createReportData(model);
|
|
|
|
|
|
+ if (null != model) {
|
|
|
|
+ reportFillingConfigMapper.createReportData(model);
|
|
|
|
+ // 需填报单元格创建
|
|
|
|
+ if (null != model.getFillInFormDataList() && model.getFillInFormDataList().size()>0){
|
|
|
|
+ for ( ReportCalculationModel m : model.getFillInFormDataList()) {
|
|
|
|
+ m.setReportno(model.getReportNo());
|
|
|
|
+ m.setReportUnitNo(String.valueOf(m.getReportno())+"_"+String.valueOf(m.getReportUnitSheet())+"_"
|
|
|
|
+ + String.valueOf(m.getReportUnitRow())+"_"+String.valueOf(m.getReportUnitCell()));
|
|
|
|
+ m.setExcelFormula(ReportFinalParam.EXECUTE_REPORT);
|
|
|
|
+ reportFillingConfigMapper.createCalcReportData(m);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 需计算单元格创建
|
|
|
|
+ if (null != model.getCalculateFormDataList() && model.getCalculateFormDataList().size()>0){
|
|
|
|
+ for ( ReportCalculationModel m : model.getCalculateFormDataList()) {
|
|
|
|
+ reportFillingConfigMapper.createCalcReportData(m);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: updateReportData
|
|
|
|
+ * @description: 更新报表定义
|
|
|
|
+ * @param : ReportDefinitionModel model,
|
|
|
|
+ * @return:
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
public void updateReportData(ReportDefinitionModel model) {
|
|
public void updateReportData(ReportDefinitionModel model) {
|
|
- double version = (Double)DataUtil.getDataDefault(model.getReportVersion(),Double.class);
|
|
|
|
- model.setReportVersion(String.valueOf(new DecimalFormat("#.##").format(version + 0.1)));
|
|
|
|
- reportFillingConfigMapper.updateReportData(model);
|
|
|
|
|
|
+ if (null != model) {
|
|
|
|
+ double version = (Double)DataUtil.getDataDefault(model.getReportVersion(),Double.class);
|
|
|
|
+ model.setReportVersion(String.valueOf(new DecimalFormat("#.##").format(version + 0.1)));
|
|
|
|
+ reportFillingConfigMapper.updateReportData(model);
|
|
|
|
+ ReportCalculationModel calcModel = new ReportCalculationModel();
|
|
|
|
+ calcModel.setReportno(model.getReportNo());
|
|
|
|
+ reportFillingConfigMapper.deleteCalcReportData(calcModel);
|
|
|
|
+ // 需填报单元格创建
|
|
|
|
+ if (null != model.getFillInFormDataList() && model.getFillInFormDataList().size()>0){
|
|
|
|
+ for ( ReportCalculationModel m : model.getFillInFormDataList()) {
|
|
|
|
+ m.setReportno(model.getReportNo());
|
|
|
|
+ m.setReportUnitNo(String.valueOf(m.getReportno())+"_"+String.valueOf(m.getReportUnitSheet())+"_"
|
|
|
|
+ + String.valueOf(m.getReportUnitRow())+"_"+String.valueOf(m.getReportUnitCell()));
|
|
|
|
+ m.setExcelFormula(ReportFinalParam.EXECUTE_REPORT);
|
|
|
|
+ reportFillingConfigMapper.createCalcReportData(m);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 需计算单元格创建
|
|
|
|
+ if (null != model.getCalculateFormDataList() && model.getCalculateFormDataList().size()>0){
|
|
|
|
+ for ( ReportCalculationModel m : model.getCalculateFormDataList()) {
|
|
|
|
+ reportFillingConfigMapper.createCalcReportData(m);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: deleteReportData
|
|
|
|
+ * @description: 删除报表定义
|
|
|
|
+ * @param : ReportDefinitionModel model,String key
|
|
|
|
+ * @return:
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
public void deleteReportData(ReportDefinitionModel model) {
|
|
public void deleteReportData(ReportDefinitionModel model) {
|
|
boolean flag = reportFillingConfigMapper.deleteReportData(model);
|
|
boolean flag = reportFillingConfigMapper.deleteReportData(model);
|
|
if (flag){
|
|
if (flag){
|
|
@@ -53,12 +126,61 @@ public class ReportFillingConfigService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: checkReportDataisNotExist
|
|
|
|
+ * @description: 验证报表是否已存在
|
|
|
|
+ * @param : ReportDefinitionModel model,String key
|
|
|
|
+ * @return: ReportDefinitionModel
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
|
|
+ public ReportDefinitionModel checkReportDataisNotExist(ReportDefinitionModel model) {
|
|
|
|
+ ReportDefinitionModel selectModel = reportFillingConfigMapper.selectReportData(model);
|
|
|
|
+ return selectModel;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: selectReportData
|
|
|
|
+ * @description: 查询报表定义
|
|
|
|
+ * @param : ReportDefinitionModel model,String key
|
|
|
|
+ * @return: ReportDefinitionModel
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
public ReportDefinitionModel selectReportData(ReportDefinitionModel model) {
|
|
public ReportDefinitionModel selectReportData(ReportDefinitionModel model) {
|
|
- return reportFillingConfigMapper.selectReportData(model);
|
|
|
|
|
|
+ ReportDefinitionModel selectModel = reportFillingConfigMapper.selectReportData(model);
|
|
|
|
+ List<ReportCalculationModel> modelFillInList = new ArrayList<ReportCalculationModel>();
|
|
|
|
+ List<ReportCalculationModel> modelCalcList = new ArrayList<ReportCalculationModel>();
|
|
|
|
+ // 查询该报表所有单元格
|
|
|
|
+ List<ReportCalculationModel> listModel = reportFillingConfigMapper.selectCalcReportData(model.getReportNo());
|
|
|
|
+ if (null != listModel && listModel.size()>0) {
|
|
|
|
+ for(ReportCalculationModel m :listModel) {
|
|
|
|
+ if (null != m.getExcelFormula() && m.getExcelFormula().equals(ReportFinalParam.EXECUTE_REPORT)) {
|
|
|
|
+ modelFillInList.add(m);
|
|
|
|
+ } else {
|
|
|
|
+ modelCalcList.add(m);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 需填报单元格记录
|
|
|
|
+ selectModel.setFillInFormDataList(modelFillInList);
|
|
|
|
+ // 需计算单元格记录
|
|
|
|
+ selectModel.setCalculateFormDataList(modelCalcList);
|
|
|
|
+ return selectModel;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @author: 张艳杰
|
|
|
|
+ * @methodsName: selectCalcProcessType
|
|
|
|
+ * @description: 解析报表
|
|
|
|
+ * @param : ReportDefinitionModel model,String key
|
|
|
|
+ * @return:
|
|
|
|
+ * @throws:
|
|
|
|
+ */
|
|
|
|
+ public ReportDefinitionModel analyseReportFile(ReportDefinitionModel model,String key) {
|
|
|
|
|
|
- public Map<String,List<ReportCalculationModel>> analyseReportFile(ReportDefinitionModel model,String key) {
|
|
|
|
|
|
|
|
List<ReportCalculationModel> modelFillInList = new ArrayList<ReportCalculationModel>();
|
|
List<ReportCalculationModel> modelFillInList = new ArrayList<ReportCalculationModel>();
|
|
List<ReportCalculationModel> modelCalcList = new ArrayList<ReportCalculationModel>();
|
|
List<ReportCalculationModel> modelCalcList = new ArrayList<ReportCalculationModel>();
|
|
@@ -96,114 +218,22 @@ public class ReportFillingConfigService {
|
|
// 解析报表文件
|
|
// 解析报表文件
|
|
|
|
|
|
FilesValueCheckUtils.analyseReportFile(book,model,modelFillInList,modelCalcList);
|
|
FilesValueCheckUtils.analyseReportFile(book,model,modelFillInList,modelCalcList);
|
|
-
|
|
|
|
- resMap.put("FillIn",modelFillInList);
|
|
|
|
- resMap.put("Calc",modelCalcList);
|
|
|
|
|
|
+ model.setFillInFormDataList(modelFillInList);
|
|
|
|
+ model.setCalculateFormDataList(modelCalcList);
|
|
|
|
+// resMap.put("FillIn",modelFillInList);
|
|
|
|
+// resMap.put("Calc",modelCalcList);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// AdminUtil.queryParamValue("ATTACHPATH") + File.separator + entity.getFunctype() + File.separator + entity.getBusiid() + File.separator + entity.getBusiType();
|
|
// AdminUtil.queryParamValue("ATTACHPATH") + File.separator + entity.getFunctype() + File.separator + entity.getBusiid() + File.separator + entity.getBusiType();
|
|
- return resMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void createCalcReportData(List<ReportCalculationModel> modelList,String reportNo) {
|
|
|
|
- if (null != modelList && modelList.size() > 0) {
|
|
|
|
- for(ReportCalculationModel model:modelList) {
|
|
|
|
- if (null == model.getExcelFormula()) {
|
|
|
|
- model.setExcelFormula(ReportFinalParam.EXECUTE_REPORT);
|
|
|
|
- model.setReportno(reportNo);
|
|
|
|
- model.setReportUnitNo(reportNo+model.getReportUnitSheet()
|
|
|
|
- +model.getReportUnitRow()+model.getReportUnitCell());
|
|
|
|
- }
|
|
|
|
- reportFillingConfigMapper.createCalcReportData(model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void deleteCalcReportData(ReportCalculationModel model) {
|
|
|
|
- reportFillingConfigMapper.deleteCalcReportData(model);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public Map<String,List<ReportCalculationModel>> selectCalcReportData(String reportNo) {
|
|
|
|
- Map<String,List<ReportCalculationModel>> resMap = new HashMap<>();
|
|
|
|
- List<ReportCalculationModel> modelFillInList = new ArrayList<ReportCalculationModel>();
|
|
|
|
- List<ReportCalculationModel> modelCalcList = new ArrayList<ReportCalculationModel>();
|
|
|
|
- List<ReportCalculationModel> listModel = reportFillingConfigMapper.selectCalcReportData(reportNo);
|
|
|
|
- for(ReportCalculationModel model :listModel) {
|
|
|
|
- if (model.getExcelFormula().equals(ReportFinalParam.EXECUTE_REPORT)) {
|
|
|
|
- modelFillInList.add(model);
|
|
|
|
- } else {
|
|
|
|
- modelCalcList.add(model);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- resMap.put("FillIn",modelFillInList);
|
|
|
|
- resMap.put("Calc",modelCalcList);
|
|
|
|
- return resMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void updateCalcReportData(List<ReportCalculationModel> modelList, String keys) {
|
|
|
|
- // 记载老数据列表的序号
|
|
|
|
- String[] values = keys.split(",");
|
|
|
|
- // 存放老列表
|
|
|
|
- List<ReportCalculationModel> oldList = new ArrayList<ReportCalculationModel>();
|
|
|
|
- // 存放新列表
|
|
|
|
- List<ReportCalculationModel> newList = new ArrayList<ReportCalculationModel>();
|
|
|
|
- // 循环整个列表,根据values分别老列表和新加列表
|
|
|
|
- for(ReportCalculationModel model:modelList) {
|
|
|
|
- if (Arrays.asList(values).contains(model.getReportUnitNo())) {
|
|
|
|
- oldList.add(model);
|
|
|
|
- } else {
|
|
|
|
- newList.add(model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 判断是否有新加列表
|
|
|
|
- if (newList.isEmpty()) {
|
|
|
|
- // 老列表数据变少,将少的数据清除
|
|
|
|
- if (values.length > oldList.size()) {
|
|
|
|
- // 提前将数据库内老数据删除
|
|
|
|
- reportFillingConfigMapper.deleteCalcReportData(oldList.get(0));
|
|
|
|
- // 没有新加列表(但是老数据列表进行了删除),将老列表需要更新的数据更新,
|
|
|
|
- for (ReportCalculationModel model:oldList){
|
|
|
|
- // 更新
|
|
|
|
- reportFillingConfigMapper.createCalcReportData(model);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // 没有新加列表(老数据列表没变,或者老数据列表进行了编辑更改),将老列表需要更新的数据更新,
|
|
|
|
- for (ReportCalculationModel model:oldList){
|
|
|
|
- // 更新
|
|
|
|
- reportFillingConfigMapper.updateCalcReportData(model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // 提前将需填报列表在数据库内的数据删除
|
|
|
|
- reportFillingConfigMapper.deleteCalcReportData(oldList.get(0));
|
|
|
|
- // 有新列表加入,将新列表中与老列表重复的数据按新列表为准存进数据库
|
|
|
|
- for(ReportCalculationModel model:newList){
|
|
|
|
- model.setReportno(modelList.get(0).getReportno());
|
|
|
|
- model.setExcelFormula(ReportFinalParam.EXECUTE_REPORT);
|
|
|
|
- for (ReportCalculationModel oldModel:oldList){
|
|
|
|
- if (!oldModel.getReportUnitSheet().equals(model.getReportUnitSheet())
|
|
|
|
- || !oldModel.getReportUnitRow().equals(model.getReportUnitRow())
|
|
|
|
- || !oldModel.getReportUnitCell().equals(model.getReportUnitCell())) {
|
|
|
|
- // 老数据插入
|
|
|
|
- reportFillingConfigMapper.createCalcReportData(oldModel);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 新数据插入
|
|
|
|
- model.setReportUnitNo(model.getReportno()+model.getReportUnitSheet()
|
|
|
|
- +model.getReportUnitRow()+model.getReportUnitCell());
|
|
|
|
- reportFillingConfigMapper.createCalcReportData(model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ return model;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author: 张艳杰
|
|
* @author: 张艳杰
|
|
* @methodsName: selectCalcProcessType
|
|
* @methodsName: selectCalcProcessType
|
|
* @description: 获取计算过程类型列表
|
|
* @description: 获取计算过程类型列表
|
|
- * @param: HttpServletRequest request, HttpServletResponse response,
|
|
|
|
|
|
+ * @param:
|
|
* @return:
|
|
* @return:
|
|
* @throws:
|
|
* @throws:
|
|
*/
|
|
*/
|