TmstruckEnfactoryResultController.java 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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(210)", 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. ){
  55. mapValue.put("orderTypee", orderType);
  56. //框计算
  57. if(con != null){
  58. if(!"undefined".equals(con)){
  59. //设置要查询的索引名称
  60. String index="get_enfactory_list";
  61. //获取查询结果
  62. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
  63. }
  64. }
  65. List<Map<String, Object>> allEnFactoryResult = null;
  66. //如果有条件查询则跳过初始化,和创建索引
  67. if(mapValue.size() == 1){
  68. //将查询结果存入索引中
  69. allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  70. Map<String, Object> map = new HashMap<>();
  71. //添加索引
  72. map.put("index","get_enfactory_list");
  73. //添加id
  74. map.put("indexId","enFactoryId");
  75. allEnFactoryResult.add(map);
  76. //新建索引
  77. esFeign.insertIndex(allEnFactoryResult);
  78. //删除
  79. allEnFactoryResult.remove(allEnFactoryResult.size()-1);
  80. }
  81. if(allEnFactoryResult == null)
  82. allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  83. PageHelper.startPage(pageNum,pageSize);
  84. //分页数据
  85. List<Map<String, Object>> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
  86. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allEnFactoryResult,enFactoryResult);
  87. return success(pageList);
  88. }
  89. @ApiOperation(value="通过PDA添加进厂实绩")
  90. @ApiImplicitParams({
  91. @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号", required = false, dataType = "Map"),
  92. })
  93. @PostMapping("/enFactoryResultByPDA")
  94. public RESTfulResult enFactoryResultByPDA(@RequestBody(required=false) Map<String,Object> mapValue){
  95. int i = tmstruckEnfactoryResultService.enFactoryResultByPDA(mapValue);
  96. return success(i);
  97. }
  98. @ApiOperation(value="通过门禁进厂")
  99. @ApiImplicitParams({
  100. @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号 车牌号 进厂时间", required = false, dataType = "Map"),
  101. })
  102. @PostMapping("/enFactoryResultByMJ")
  103. public RESTfulResult enFactoryResultByMJ(@RequestBody(required=false) Map<String,Object> mapValue){
  104. int i = tmstruckEnfactoryResultService.enFactoryResultByMJ(mapValue);
  105. return success(i);
  106. }
  107. @ApiOperation(value="新增进厂作业实绩:oms远程调用")
  108. @ApiImplicitParams({
  109. @ApiImplicitParam(name = "mapValue", value = "总实绩Id、线路起点", required = false, dataType = "Map"),
  110. })
  111. @PostMapping("/addEnFactoryResult")
  112. public RESTfulResult addEnFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue){
  113. int i = tmstruckEnfactoryResultService.addEnFactoryResult(mapValue);
  114. return success(i);
  115. }
  116. @ApiOperation(value="通过运输订单id查询物资信息")
  117. @ApiImplicitParams({
  118. @ApiImplicitParam(name = "orderId", value = "运输订单id", required = false, dataType = "Integer"),
  119. })
  120. @GetMapping("/getMaterial")
  121. public RESTfulResult getMaterial(Integer orderId){
  122. List<Map<String, Object>> material = tmstruckEnfactoryResultService.getMaterial(orderId);
  123. return success(material);
  124. }
  125. }