|
@@ -1,5 +1,7 @@
|
|
|
package com.steerinfo.dil.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.steerinfo.dil.feign.ESFeign;
|
|
|
import com.steerinfo.dil.service.impl.BmstrainDetailsOrderServiceImpl;
|
|
|
import com.steerinfo.dil.service.impl.BmstrainStatementServiceImpl;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
@@ -36,6 +38,8 @@ public class BmstrainStatementController extends BaseRESTfulController {
|
|
|
BmstrainStatementServiceImpl bmstrainStatementService;
|
|
|
@Autowired
|
|
|
ColumnDataUtil columnDataUtil;
|
|
|
+ @Autowired
|
|
|
+ ESFeign esFeign;
|
|
|
|
|
|
/**
|
|
|
* 展示火运账单列表
|
|
@@ -56,12 +60,41 @@ public class BmstrainStatementController extends BaseRESTfulController {
|
|
|
public RESTfulResult getTrainStatementList(@RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
- List<Map<String, Object>> list = bmstrainStatementService.getTrainStatementList(mapValue);
|
|
|
+ Integer apiId,
|
|
|
+ String con) {
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_train_statement_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> trainStatementList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 0) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ trainStatementList = bmstrainStatementService.getTrainStatementList(null);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_train_statement_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "statementId");
|
|
|
+ trainStatementList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(trainStatementList);
|
|
|
+ esFeign.insertIndex(trainStatementList);
|
|
|
+ //删除
|
|
|
+ trainStatementList.remove(trainStatementList.size() - 1);
|
|
|
+ }
|
|
|
+ if (trainStatementList == null) {
|
|
|
+ trainStatementList = bmstrainStatementService.getTrainStatementList(mapValue);
|
|
|
+ }
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
List<Map<String, Object>> columnList = bmstrainStatementService.getTrainStatementList(mapValue);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, trainStatementList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|
|
@@ -85,7 +118,7 @@ public class BmstrainStatementController extends BaseRESTfulController {
|
|
|
* 展示账单下的详单
|
|
|
*
|
|
|
* @param batchId
|
|
|
- * @param mapVal
|
|
|
+ * @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
* @param apiId
|
|
@@ -101,21 +134,47 @@ public class BmstrainStatementController extends BaseRESTfulController {
|
|
|
})
|
|
|
@PostMapping(value = "/getComplateTrainDetailsList")
|
|
|
public RESTfulResult getComplateTrainDetailsList(BigDecimal batchId,
|
|
|
- @RequestBody(required = false) Map<String, Object> mapVal,
|
|
|
+ @RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
Integer apiId,
|
|
|
- BigDecimal statementId) {
|
|
|
- if (mapVal == null) {
|
|
|
- mapVal = new HashMap<>();
|
|
|
+ BigDecimal statementId,
|
|
|
+ String con) {
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_uncomplate_train_details_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mapValue.put("batchId", batchId);
|
|
|
+ mapValue.put("statementId", statementId);
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> trainComplateDetailList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 2) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ trainComplateDetailList = bmstrainStatementService.getComplateTrainDetailsList(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_uncomplate_train_details_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "detailsId");
|
|
|
+ trainComplateDetailList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(trainComplateDetailList);
|
|
|
+ esFeign.insertIndex(trainComplateDetailList);
|
|
|
+ //删除
|
|
|
+ trainComplateDetailList.remove(trainComplateDetailList.size() - 1);
|
|
|
+ }
|
|
|
+ if (trainComplateDetailList == null) {
|
|
|
+ trainComplateDetailList = bmstrainStatementService.getComplateTrainDetailsList(mapValue);
|
|
|
}
|
|
|
- mapVal.put("batchId", batchId);
|
|
|
- mapVal.put("statementId", statementId);
|
|
|
- List<Map<String, Object>> list = bmstrainStatementService.getComplateTrainDetailsList(mapVal);
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
- List<Map<String, Object>> columnList = bmstrainStatementService.getComplateTrainDetailsList(mapVal);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ List<Map<String, Object>> columnList = bmstrainStatementService.getComplateTrainDetailsList(mapValue);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, trainComplateDetailList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|