TmstruckWeightResultController.java 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.service.ITmstruckWeightResultService;
  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.math.BigDecimal;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. import java.util.Map;
  18. /**
  19. * TmstruckWeightResult RESTful接口:
  20. * @author generator
  21. * @version 1.0-SNAPSHORT 2021-09-09 02:21
  22. * 类描述
  23. * 修订历史:
  24. * 日期:2021-09-09
  25. * 作者:generator
  26. * 参考:
  27. * 描述:TmstruckWeightResult RESTful接口
  28. * @see null
  29. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  30. */
  31. @RestController
  32. @RequestMapping("/${api.version}/tmstruckweightresults")
  33. public class TmstruckWeightResultController extends BaseRESTfulController {
  34. @Autowired
  35. ITmstruckWeightResultService tmstruckWeightResultService;
  36. @Autowired
  37. ESFeign esFeign;
  38. @Autowired
  39. ColumnDataUtil columnDataUtil;
  40. @ApiOperation(value="新增计量实绩 ")
  41. @ApiImplicitParams({
  42. @ApiImplicitParam(name = "mapValue", value = "总实绩ID、计皮点、计毛点", required = false, dataType = "Map"),
  43. })
  44. @PostMapping("/addWeightResult")
  45. public RESTfulResult addWeightResult(@RequestBody Map<String, Object> mapValue){
  46. int i = tmstruckWeightResultService.addWeightResult(mapValue);
  47. return success(i);
  48. }
  49. @ApiOperation(value="查询计毛实绩")
  50. @ApiImplicitParams({
  51. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  52. @ApiImplicitParam(name = "apiId(102)", value = "动态表头", required = false, dataType = "Integer"),
  53. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  54. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  55. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  56. })
  57. @PostMapping("/getAllJiMaoResult")
  58. public RESTfulResult getAllJiMaoResult(@RequestBody(required=false) Map<String,Object> mapValue,
  59. Integer apiId,
  60. Integer pageNum,
  61. Integer pageSize,
  62. Integer orderType,
  63. String con
  64. ){
  65. mapValue.put("orderTypee", orderType);
  66. //框计算
  67. if(con != null){
  68. if(!"undefined".equals(con)){
  69. String index="get_jimao_list";//设置要查询的索引名称
  70. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  71. }
  72. }
  73. List<Map<String, Object>> allJiMaoResult = null;
  74. //如果有条件查询则跳过初始化,和创建索引
  75. if(mapValue.size() == 1){
  76. //将查询结果存入索引中
  77. allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  78. Map<String, Object> map = new HashMap<>();
  79. //添加索引
  80. map.put("index","get_jimao_list");
  81. //添加id
  82. map.put("indexId","jiMaoId");
  83. allJiMaoResult.add(map);
  84. //新建索引
  85. esFeign.insertIndex(allJiMaoResult);
  86. //删除
  87. allJiMaoResult.remove(allJiMaoResult.size()-1);
  88. }
  89. if(allJiMaoResult == null){
  90. allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  91. }
  92. PageHelper.startPage(pageNum,pageSize);
  93. //分页数据
  94. List<Map<String, Object>> jiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  95. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiMaoResult,jiMaoResult);
  96. return success(pageList);
  97. }
  98. @ApiOperation(value="查询计皮实绩")
  99. @ApiImplicitParams({
  100. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  101. @ApiImplicitParam(name = "apiId(104)", value = "动态表头", required = false, dataType = "Integer"),
  102. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  103. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  104. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  105. })
  106. @PostMapping("/getAllJiPiResult")
  107. public RESTfulResult getAllJiPiResult(@RequestBody(required=false) Map<String,Object> mapValue,
  108. Integer apiId,
  109. Integer pageNum,
  110. Integer pageSize,
  111. Integer orderType,
  112. String con
  113. ){
  114. mapValue.put("orderTypee", orderType);
  115. //框计算
  116. if(con != null){
  117. if(!"undefined".equals(con)){
  118. String index="get_jipi_list";//设置要查询的索引名称
  119. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  120. }
  121. }
  122. //不分页筛选数据
  123. List<Map<String, Object>> allJiPiResult = null;
  124. //如果有条件查询则跳过初始化,和创建索引
  125. if(mapValue.size() == 1){
  126. //将查询结果存入索引中
  127. allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  128. Map<String, Object> map = new HashMap<>();
  129. //添加索引
  130. map.put("index","get_jipi_list");
  131. //添加id
  132. map.put("indexId","jiPiId");
  133. allJiPiResult.add(map);
  134. //新建索引
  135. esFeign.insertIndex(allJiPiResult);
  136. //删除
  137. allJiPiResult.remove(allJiPiResult.size()-1);
  138. }
  139. if(allJiPiResult == null){
  140. allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  141. }
  142. PageHelper.startPage(pageNum,pageSize);
  143. //分页数据
  144. List<Map<String, Object>> jiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  145. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiPiResult,jiPiResult);
  146. return success(pageList);
  147. }
  148. /**
  149. *通过运输订单判断下一步是否需要计量,更新汽车衡到计量实绩中
  150. */
  151. @PostMapping("/updateTruckCalculate/{orderId}")
  152. public RESTfulResult updateTruckCalculate(@PathVariable("orderId") Integer orderId){
  153. int i =0;
  154. return success(i);
  155. }
  156. }