TmstruckEnfactoryResultController.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.service.ITmstruckEnfactoryResultService;
  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. * TmstruckEnfactoryResult RESTful接口:
  19. * @author generator
  20. * @version 1.0-SNAPSHORT 2021-09-08 06:23
  21. * 类描述
  22. * 修订历史:
  23. * 日期:2021-09-08
  24. * 作者:TXF
  25. * 参考:
  26. * 描述:TmstruckEnfactoryResult RESTful接口
  27. * @see null
  28. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  29. */
  30. @RestController
  31. @RequestMapping("/${api.version}/tmstruckenfactoryresults")
  32. public class TmstruckEnfactoryResultController extends BaseRESTfulController {
  33. @Autowired
  34. ITmstruckEnfactoryResultService tmstruckEnfactoryResultService;
  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(220)", 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("/getAllEnFactoryResult")
  48. public RESTfulResult getAllEnFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue,
  49. Integer apiId,
  50. Integer pageNum,
  51. Integer pageSize,
  52. Integer orderType,
  53. String con,
  54. String userId,
  55. String userIds
  56. ){
  57. int count=0;
  58. if (userId!=null){
  59. mapValue.put("userId",userId);
  60. count++;
  61. }
  62. if (userIds!=null){
  63. mapValue.put("userIds",userIds);
  64. count++;
  65. }
  66. if (orderType!=null){
  67. mapValue.put("orderTypee", orderType);
  68. count++;
  69. }
  70. //框计算
  71. if(con != null){
  72. if(!"undefined".equals(con)){
  73. //设置要查询的索引名称
  74. String index="get_enfactory_list";
  75. //获取查询结果
  76. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
  77. }
  78. }
  79. List<Map<String, Object>> allEnFactoryResult = null;
  80. //如果有条件查询则跳过初始化,和创建索引
  81. if(mapValue.size() == count){
  82. //将查询结果存入索引中
  83. allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  84. Map<String, Object> map = new HashMap<>();
  85. //添加索引
  86. map.put("index","get_enfactory_list");
  87. //添加id
  88. map.put("indexId","enFactoryId");
  89. allEnFactoryResult.add(map);
  90. //新建索引
  91. esFeign.insertIndex(allEnFactoryResult);
  92. //删除
  93. allEnFactoryResult.remove(allEnFactoryResult.size()-1);
  94. }
  95. if(allEnFactoryResult == null)
  96. allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  97. PageHelper.startPage(pageNum,pageSize);
  98. //分页数据
  99. List<Map<String, Object>> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  100. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allEnFactoryResult,enFactoryResult);
  101. return success(pageList);
  102. }
  103. @ApiOperation(value="通过PDA添加进厂实绩")
  104. @ApiImplicitParams({
  105. @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号", required = false, dataType = "Map"),
  106. })
  107. @PostMapping("/enFactoryResultByPDA")
  108. public RESTfulResult enFactoryResultByPDA(@RequestBody(required=false) Map<String,Object> mapValue){
  109. int i = 0;
  110. try {
  111. i = tmstruckEnfactoryResultService.enFactoryResultByPDA(mapValue);
  112. } catch (Exception e) {
  113. return failed(e.getMessage());
  114. }
  115. return success(i);
  116. }
  117. @ApiOperation(value="通过门禁进厂")
  118. @ApiImplicitParams({
  119. @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号 车牌号 进厂时间", required = false, dataType = "Map"),
  120. })
  121. @PostMapping("/enFactoryResultByMJ")
  122. public RESTfulResult enFactoryResultByMJ(@RequestBody(required=false) Map<String,Object> mapValue){
  123. int i = tmstruckEnfactoryResultService.enFactoryResultByMJ(mapValue);
  124. return success(i);
  125. }
  126. @ApiOperation(value="新增进厂作业实绩:oms远程调用")
  127. @ApiImplicitParams({
  128. @ApiImplicitParam(name = "mapValue", value = "总实绩Id、线路起点", required = false, dataType = "Map"),
  129. })
  130. @PostMapping("/addEnFactoryResult")
  131. public RESTfulResult addEnFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue){
  132. int i = tmstruckEnfactoryResultService.addEnFactoryResult(mapValue);
  133. return success(i);
  134. }
  135. @ApiOperation(value="通过运输订单id查询物资信息")
  136. @ApiImplicitParams({
  137. @ApiImplicitParam(name = "orderId", value = "运输订单id", required = false, dataType = "Integer"),
  138. })
  139. @GetMapping("/getMaterial")
  140. public RESTfulResult getMaterial(Integer orderId){
  141. List<Map<String, Object>> material = tmstruckEnfactoryResultService.getMaterial(orderId);
  142. return success(material);
  143. }
  144. @ApiOperation(value="APP查询进厂实绩")
  145. @PostMapping("/getEnfactoryResultList")
  146. public RESTfulResult getEnfactoryResultList() {
  147. List<Map<String,Object>> mapList = tmstruckEnfactoryResultService.getEnfactoryResultList();
  148. return success(mapList);
  149. }
  150. @ApiOperation(value="APP通过运输订单id查询进厂实绩")
  151. @PostMapping("/getEnfactoryMessageByOrderId")
  152. public RESTfulResult getEnfactoryMessageByOrderId(@RequestParam String orderNumber) {
  153. List<Map<String,Object>> mapList = tmstruckEnfactoryResultService.getEnfactoryMessageByOrderId(orderNumber);
  154. return success(mapList);
  155. }
  156. }