TmstruckWeightResultController.java 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 = "mapList", value = "计量数据", required = false, dataType = "List<Map>"),
  52. })
  53. @PostMapping("/updateTruckWeight")
  54. public RESTfulResult updateTruckWeight(@RequestBody List<Map<String, Object>> mapList){
  55. int i = tmstruckWeightResultService.updateTruckWeight(mapList);
  56. return success(i);
  57. }
  58. @ApiOperation(value="查询计毛实绩")
  59. @ApiImplicitParams({
  60. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  61. @ApiImplicitParam(name = "apiId(102)", value = "动态表头", required = false, dataType = "Integer"),
  62. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  63. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  64. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  65. })
  66. @PostMapping("/getAllJiMaoResult")
  67. public RESTfulResult getAllJiMaoResult(@RequestBody(required=false) Map<String,Object> mapValue,
  68. Integer apiId,
  69. Integer pageNum,
  70. Integer pageSize,
  71. Integer orderType,
  72. String con
  73. ){
  74. mapValue.put("orderTypee", orderType);
  75. //框计算
  76. if(con != null){
  77. if(!"undefined".equals(con)){
  78. String index="get_jimao_list";//设置要查询的索引名称
  79. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  80. }
  81. }
  82. List<Map<String, Object>> allJiMaoResult = null;
  83. //如果有条件查询则跳过初始化,和创建索引
  84. if(mapValue.size() == 1){
  85. //将查询结果存入索引中
  86. allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  87. Map<String, Object> map = new HashMap<>();
  88. //添加索引
  89. map.put("index","get_jimao_list");
  90. //添加id
  91. map.put("indexId","jiMaoId");
  92. allJiMaoResult.add(map);
  93. //新建索引
  94. esFeign.insertIndex(allJiMaoResult);
  95. //删除
  96. allJiMaoResult.remove(allJiMaoResult.size()-1);
  97. }
  98. if(allJiMaoResult == null){
  99. allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  100. }
  101. PageHelper.startPage(pageNum,pageSize);
  102. //分页数据
  103. List<Map<String, Object>> jiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
  104. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiMaoResult,jiMaoResult);
  105. return success(pageList);
  106. }
  107. @ApiOperation(value="查询计皮实绩")
  108. @ApiImplicitParams({
  109. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  110. @ApiImplicitParam(name = "apiId(104)", value = "动态表头", required = false, dataType = "Integer"),
  111. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  112. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  113. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  114. })
  115. @PostMapping("/getAllJiPiResult")
  116. public RESTfulResult getAllJiPiResult(@RequestBody(required=false) Map<String,Object> mapValue,
  117. Integer apiId,
  118. Integer pageNum,
  119. Integer pageSize,
  120. Integer orderType,
  121. String con
  122. ){
  123. mapValue.put("orderTypee", orderType);
  124. //框计算
  125. if(con != null){
  126. if(!"undefined".equals(con)){
  127. String index="get_jipi_list";//设置要查询的索引名称
  128. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  129. }
  130. }
  131. //不分页筛选数据
  132. List<Map<String, Object>> allJiPiResult = null;
  133. //如果有条件查询则跳过初始化,和创建索引
  134. if(mapValue.size() == 1){
  135. //将查询结果存入索引中
  136. allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  137. Map<String, Object> map = new HashMap<>();
  138. //添加索引
  139. map.put("index","get_jipi_list");
  140. //添加id
  141. map.put("indexId","jiPiId");
  142. allJiPiResult.add(map);
  143. //新建索引
  144. esFeign.insertIndex(allJiPiResult);
  145. //删除
  146. allJiPiResult.remove(allJiPiResult.size()-1);
  147. }
  148. if(allJiPiResult == null){
  149. allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  150. }
  151. PageHelper.startPage(pageNum,pageSize);
  152. //分页数据
  153. List<Map<String, Object>> jiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
  154. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiPiResult,jiPiResult);
  155. return success(pageList);
  156. }
  157. @ApiOperation(value="采集新增计毛实绩 ")
  158. @ApiImplicitParams({
  159. @ApiImplicitParam(name = "mapValue", value = "采集的数据", required = false, dataType = "Map"),
  160. })
  161. @PostMapping("/addJiMaoResult")
  162. public RESTfulResult addJiMaoResult(@RequestBody Map<String, Object> mapValue){
  163. int i = tmstruckWeightResultService.addJiMaoResult(mapValue);
  164. return success(i);
  165. }
  166. @ApiOperation(value="采集新增计皮实绩 ")
  167. @ApiImplicitParams({
  168. @ApiImplicitParam(name = "mapValue", value = "采集的数据", required = false, dataType = "Map"),
  169. })
  170. @PostMapping("/addJiPiResult")
  171. public RESTfulResult addJiPiResult(@RequestBody Map<String, Object> mapValue){
  172. int i = tmstruckWeightResultService.addJiPiResult(mapValue);
  173. return success(i);
  174. }
  175. /**
  176. *通过运输订单判断下一步是否需要计量,更新汽车衡到计量实绩中
  177. */
  178. @PostMapping("/updateTruckCalculate/{orderId}")
  179. public RESTfulResult updateTruckCalculate(@PathVariable("orderId") Integer orderId){
  180. int i =0;
  181. return success(i);
  182. }
  183. }