DilBatchController.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package com.steerinfo.dil.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.steerinfo.dil.feign.ESFeign;
  4. import com.steerinfo.dil.util.BaseRESTfulController;
  5. import com.steerinfo.dil.util.ColumnDataUtil;
  6. import com.steerinfo.dil.util.PageListAdd;
  7. import com.steerinfo.framework.controller.RESTfulResult;
  8. import com.steerinfo.framework.service.pagehelper.PageHelper;
  9. import com.steerinfo.framework.service.pagehelper.PageList;
  10. import com.steerinfo.framework.utils.collection.ListUtils;
  11. import com.steerinfo.dil.model.DilBatch;
  12. import com.steerinfo.dil.service.IDilBatchService;
  13. import io.swagger.annotations.ApiImplicitParam;
  14. import io.swagger.annotations.ApiImplicitParams;
  15. import io.swagger.annotations.ApiOperation;
  16. import org.apache.commons.lang3.StringUtils;
  17. import org.apache.shiro.authz.annotation.RequiresPermissions;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.util.*;
  21. import java.math.BigDecimal;
  22. /**
  23. * DilBatch RESTful接口:
  24. * @author generator
  25. * @version 1.0-SNAPSHORT 2021-11-06 10:22
  26. * 类描述
  27. * 修订历史:
  28. * 日期:2021-11-06
  29. * 作者:generator
  30. * 参考:
  31. * 描述:DilBatch RESTful接口
  32. * @see null
  33. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  34. */
  35. @RestController
  36. @RequestMapping("/${api.version}/dilbatchs")
  37. public class DilBatchController extends BaseRESTfulController {
  38. @Autowired
  39. IDilBatchService dilBatchService;
  40. @Autowired
  41. ESFeign esFeign;
  42. @Autowired
  43. ColumnDataUtil columnDataUtil;
  44. @ApiOperation(value="批次展示列表", notes="分页查询")
  45. @ApiImplicitParams({
  46. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  47. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  48. @ApiImplicitParam(name = "apiId", value = "375", required = false, dataType = "Integer")
  49. })
  50. @PostMapping("/getBatchList")
  51. public RESTfulResult getBatchList(@RequestBody(required = false) Map<String, Object> mapValue,
  52. Integer pageNum,
  53. Integer pageSize,
  54. Integer apiId,
  55. String con) {
  56. //框计算
  57. if (con != null) {
  58. if (!"undefined".equals(con)) {
  59. //设置要查询的索引名称
  60. String index = "get_dil_batch";
  61. //获取查询结果
  62. return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
  63. }
  64. }
  65. //初始化过滤
  66. List<Map<String, Object>> listTotal = null;
  67. //如果有条件查询则跳过初始化,和创建索引
  68. if (mapValue.size() == 0) {
  69. //将查询结果存入索引中
  70. listTotal = dilBatchService.getBatchList(null);
  71. Map<String, Object> map = new HashMap<>();
  72. //添加索引
  73. map.put("index", "get_dil_batch");
  74. //添加id
  75. map.put("indexId", "batchId");
  76. listTotal.add(map);
  77. //新建索引
  78. String s = JSON.toJSONString(listTotal);
  79. esFeign.insertIndex(listTotal);
  80. //删除
  81. listTotal.remove(listTotal.size() - 1);
  82. }
  83. if (listTotal == null) {
  84. listTotal = dilBatchService.getBatchList(mapValue);
  85. }
  86. PageHelper.startPage(pageNum, pageSize);
  87. //分页查询数据
  88. List<Map<String, Object>> columnList = dilBatchService.getBatchList(mapValue);
  89. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  90. return success(data);
  91. }
  92. @ApiOperation(value="查询货权转移出现的批次展示列表", notes="分页查询")
  93. @ApiImplicitParams({
  94. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  95. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  96. @ApiImplicitParam(name = "apiId", value = "375", required = false, dataType = "Integer")
  97. })
  98. @PostMapping("/getBatchListForAttorney")
  99. public RESTfulResult getBatchListForAttorney(@RequestBody(required = false) Map<String, Object> mapValue,
  100. Integer pageNum,
  101. Integer pageSize,
  102. Integer apiId,
  103. String con) {
  104. //框计算
  105. if (con != null) {
  106. if (!"undefined".equals(con)) {
  107. //设置要查询的索引名称
  108. String index = "get_dil_batch_attorney";
  109. //获取查询结果
  110. return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
  111. }
  112. }
  113. //初始化过滤
  114. List<Map<String, Object>> listTotal = null;
  115. //如果有条件查询则跳过初始化,和创建索引
  116. if (mapValue.size() == 0) {
  117. //将查询结果存入索引中
  118. listTotal = dilBatchService.getBatchListFortTransfer(null);
  119. Map<String, Object> map = new HashMap<>();
  120. //添加索引
  121. map.put("index", "get_dil_batch_attorney");
  122. //添加id
  123. map.put("indexId", "batchForAtrorneyId");
  124. listTotal.add(map);
  125. //新建索引
  126. String s = JSON.toJSONString(listTotal);
  127. esFeign.insertIndex(listTotal);
  128. //删除
  129. listTotal.remove(listTotal.size() - 1);
  130. }
  131. if (listTotal == null) {
  132. listTotal = dilBatchService.getBatchListFortTransfer(mapValue);
  133. }
  134. PageHelper.startPage(pageNum, pageSize);
  135. //分页查询数据
  136. List<Map<String, Object>> columnList = dilBatchService.getBatchListFortTransfer(mapValue);
  137. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  138. return success(data);
  139. }
  140. // 根据索引模糊查询外轮船名
  141. @ApiOperation(value="根据用户输入输出船名", notes="模糊查询")
  142. @ApiImplicitParams({
  143. @ApiImplicitParam(name = "con",value = "用户输入的江船名", required = false, dataType = "String")
  144. })
  145. @PostMapping("/getShipNameList")
  146. public RESTfulResult getShipNameList(@RequestParam(value ="state") String state){
  147. List<Map<String, Object>> shipNameList = dilBatchService.getShipNameList(state);
  148. System.out.println("shipNameList"+shipNameList);
  149. return success(dilBatchService.getShipNameList(state));
  150. }
  151. }