package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import com.steerinfo.framework.service.pagehelper.PageList; import com.steerinfo.framework.utils.collection.ListUtils; import com.steerinfo.dil.model.DilBatch; import com.steerinfo.dil.service.IDilBatchService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; import java.math.BigDecimal; /** * DilBatch RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-11-06 10:22 * 类描述 * 修订历史: * 日期:2021-11-06 * 作者:generator * 参考: * 描述:DilBatch RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/dilbatchs") public class DilBatchController extends BaseRESTfulController { @Autowired IDilBatchService dilBatchService; @Autowired ESFeign esFeign; @Autowired ColumnDataUtil columnDataUtil; @ApiOperation(value="批次展示列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "375", required = false, dataType = "Integer") }) @PostMapping("/getBatchList") public RESTfulResult getBatchList(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String con) { //框计算 if (con != null) { if (!"undefined".equals(con)) { //设置要查询的索引名称 String index = "get_dil_batch"; //获取查询结果 return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con)); } } //初始化过滤 List> listTotal = null; //如果有条件查询则跳过初始化,和创建索引 if (mapValue.size() == 0) { //将查询结果存入索引中 listTotal = dilBatchService.getBatchList(null); Map map = new HashMap<>(); //添加索引 map.put("index", "get_dil_batch"); //添加id map.put("indexId", "batchId"); listTotal.add(map); //新建索引 String s = JSON.toJSONString(listTotal); esFeign.insertIndex(listTotal); //删除 listTotal.remove(listTotal.size() - 1); } if (listTotal == null) { listTotal = dilBatchService.getBatchList(mapValue); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = dilBatchService.getBatchList(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList); return success(data); } @ApiOperation(value="查询货权转移出现的批次展示列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "375", required = false, dataType = "Integer") }) @PostMapping("/getBatchListForAttorney") public RESTfulResult getBatchListForAttorney(@RequestBody(required = false) Map mapValue, Integer pageNum, Integer pageSize, Integer apiId, String con) { //框计算 if (con != null) { if (!"undefined".equals(con)) { //设置要查询的索引名称 String index = "get_dil_batch_attorney"; //获取查询结果 return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con)); } } //初始化过滤 List> listTotal = null; //如果有条件查询则跳过初始化,和创建索引 if (mapValue.size() == 0) { //将查询结果存入索引中 listTotal = dilBatchService.getBatchListFortTransfer(null); Map map = new HashMap<>(); //添加索引 map.put("index", "get_dil_batch_attorney"); //添加id map.put("indexId", "batchForAtrorneyId"); listTotal.add(map); //新建索引 String s = JSON.toJSONString(listTotal); esFeign.insertIndex(listTotal); //删除 listTotal.remove(listTotal.size() - 1); } if (listTotal == null) { listTotal = dilBatchService.getBatchListFortTransfer(mapValue); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = dilBatchService.getBatchListFortTransfer(mapValue); PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList); return success(data); } // 根据索引模糊查询外轮船名 @ApiOperation(value="根据用户输入输出船名", notes="模糊查询") @ApiImplicitParams({ @ApiImplicitParam(name = "con",value = "用户输入的江船名", required = false, dataType = "String") }) @PostMapping("/getShipNameList") public RESTfulResult getShipNameList(@RequestParam(value ="state") String state){ List> shipNameList = dilBatchService.getShipNameList(state); System.out.println("shipNameList"+shipNameList); return success(dilBatchService.getShipNameList(state)); } }