TmstruckReceiptResultController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.service.ITmstruckReceiptResultService;
  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 io.swagger.annotations.ApiImplicitParam;
  10. import io.swagger.annotations.ApiImplicitParams;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.util.HashMap;
  15. import java.util.List;
  16. import java.util.Map;
  17. /**
  18. * TmstruckReceiptResult RESTful接口:
  19. * @author generator
  20. * @version 1.0-SNAPSHORT 2021-09-10 10:10
  21. * 类描述
  22. * 修订历史:
  23. * 日期:2021-09-10
  24. * 作者:generator
  25. * 参考:
  26. * 描述:TmstruckReceiptResult RESTful接口
  27. * @see null
  28. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  29. */
  30. @RestController
  31. @RequestMapping("/${api.version}/tmstruckreceiptresults")
  32. public class TmstruckReceiptResultController extends BaseRESTfulController {
  33. @Autowired
  34. ITmstruckReceiptResultService tmstruckReceiptResultService;
  35. @Autowired
  36. ESFeign esFeign;
  37. @Autowired
  38. ColumnDataUtil columnDataUtil;
  39. @ApiOperation(value="查询收货实绩")
  40. @ApiImplicitParams({
  41. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  42. @ApiImplicitParam(name = "apiId(107)", value = "动态表头", required = false, dataType = "Integer"),
  43. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  44. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  45. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  46. })
  47. @PostMapping("/getReceiveResult")
  48. public RESTfulResult getReceiveResult(@RequestBody(required=false) Map<String,Object> mapValue,
  49. Integer apiId,
  50. Integer pageNum,
  51. Integer pageSize,
  52. Integer orderType,
  53. String con
  54. ){
  55. mapValue.put("orderTypee", orderType);
  56. //框计算
  57. if(con != null){
  58. if(!"undefined".equals(con)){
  59. String index="get_receivee_list";//设置要查询的索引名称
  60. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  61. }
  62. }
  63. List<Map<String, Object>> allReceiveResult = null;
  64. //如果有条件查询则跳过初始化,和创建索引
  65. if(mapValue.size() == 1){
  66. //将查询结果存入索引中
  67. allReceiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue);
  68. Map<String, Object> map = new HashMap<>();
  69. //添加索引
  70. map.put("index","get_receivee_list");
  71. //添加id
  72. map.put("indexId","receiveId");
  73. allReceiveResult.add(map);
  74. //新建索引
  75. esFeign.insertIndex(allReceiveResult);
  76. //删除
  77. allReceiveResult.remove(allReceiveResult.size()-1);
  78. }
  79. if(allReceiveResult == null)
  80. allReceiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue);
  81. PageHelper.startPage(pageNum,pageSize);
  82. //分页数据
  83. List<Map<String, Object>> receiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue);
  84. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReceiveResult,receiveResult);
  85. return success(pageList);
  86. }
  87. @ApiOperation(value="新增钢材到异地库达州站驻港人员确定收货")
  88. @PostMapping("/addSteelNzReceiptResult")
  89. public RESTfulResult addSteelNzReceiptResult(@RequestBody(required = false) Map<String, Object> map) {
  90. int i = tmstruckReceiptResultService.addSteelNzReceiptResult(map);
  91. return success(i);
  92. }
  93. }