|
@@ -1,5 +1,6 @@
|
|
|
package com.steerinfo.dil.controller;
|
|
|
|
|
|
+import com.steerinfo.dil.feign.ESFeign;
|
|
|
import com.steerinfo.dil.model.AmsContractBreach;
|
|
|
import com.steerinfo.dil.model.AmsContractTransportPrice;
|
|
|
import com.steerinfo.dil.service.impl.AmsContractBreachServiceImpl;
|
|
@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -31,6 +33,8 @@ public class AmsContractBreachController extends BaseRESTfulController {
|
|
|
AmsContractBreachServiceImpl amsContractBreachService;
|
|
|
@Autowired
|
|
|
ColumnDataUtil columnDataUtil;
|
|
|
+ @Autowired
|
|
|
+ ESFeign esFeign;
|
|
|
|
|
|
/**
|
|
|
* 展示违约规则
|
|
@@ -50,13 +54,41 @@ public class AmsContractBreachController extends BaseRESTfulController {
|
|
|
public RESTfulResult getBreachList(@RequestBody(required = false) Map<String,Object> mapValue,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
- List<Map<String, Object>> list = amsContractBreachService.getBreachList(mapValue);
|
|
|
- PageHelper.startPage(pageNum, pageSize);
|
|
|
- //分页查询数据
|
|
|
- List<Map<String, Object>> columnList = amsContractBreachService.getBreachList(mapValue);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
- return success(data);
|
|
|
+ Integer apiId,
|
|
|
+ String con) {
|
|
|
+
|
|
|
+ //框计算
|
|
|
+ if(con != null){
|
|
|
+ if(!"undefined".equals(con)){
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index="get_breach_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> allBreachList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if(mapValue.size() == 0){
|
|
|
+ //将查询结果存入索引中
|
|
|
+ allBreachList = amsContractBreachService.getBreachList(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index","get_breach_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId","breachListId");
|
|
|
+ allBreachList.add(map);
|
|
|
+ //新建索引
|
|
|
+ esFeign.insertIndex(allBreachList);
|
|
|
+ //删除
|
|
|
+ allBreachList.remove(allBreachList.size()-1);
|
|
|
+ }
|
|
|
+ if(allBreachList == null)
|
|
|
+ allBreachList = amsContractBreachService.getBreachList(mapValue);
|
|
|
+ PageHelper.startPage(pageNum,pageSize);
|
|
|
+ //分页数据
|
|
|
+ List<Map<String, Object>> enFactoryResult = amsContractBreachService.getBreachList(mapValue);
|
|
|
+ PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allBreachList,enFactoryResult);
|
|
|
+ return success(pageList);
|
|
|
}
|
|
|
|
|
|
|