TmstruckLeaveFactoryResultController.java 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.model.TmstruckLeaveFactoryResult;
  4. import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
  5. import com.steerinfo.dil.util.BaseRESTfulController;
  6. import com.steerinfo.dil.util.ColumnDataUtil;
  7. import com.steerinfo.dil.util.PageListAdd;
  8. import com.steerinfo.framework.controller.RESTfulResult;
  9. import com.steerinfo.framework.service.pagehelper.PageHelper;
  10. import com.steerinfo.route.service.impl.RouteServiceImpl;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.models.auth.In;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.io.File;
  18. import java.math.BigDecimal;
  19. import java.util.Arrays;
  20. import java.util.HashMap;
  21. import java.util.List;
  22. import java.util.Map;
  23. /**
  24. * TmstruckLeaveFactoryResult RESTful接口:
  25. * @author generator
  26. * @version 1.0-SNAPSHORT 2021-09-11 10:32
  27. * 类描述
  28. * 修订历史:
  29. * 日期:2021-09-11
  30. * 作者:TXF
  31. * 参考:
  32. * 描述:TmstruckLeaveFactoryResult RESTful接口
  33. * @see null
  34. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  35. */
  36. @RestController
  37. @RequestMapping("/${api.version}/tmstruckleavefactoryresults")
  38. public class TmstruckLeaveFactoryResultController extends BaseRESTfulController {
  39. @Autowired
  40. ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
  41. @Autowired
  42. private RouteServiceImpl routeService;
  43. @Autowired
  44. ESFeign esFeign;
  45. @Autowired
  46. ColumnDataUtil columnDataUtil;
  47. @ApiOperation(value="新增汽车出厂实绩:oms远程调用")
  48. @ApiImplicitParams({
  49. @ApiImplicitParam(name = "mapValue", value = "总实绩ID、线路终点", required = false, dataType = "Map"),
  50. })
  51. @PostMapping("/addLeaveFactory")
  52. public RESTfulResult addLeaveFactory(@RequestBody(required=false) Map<String,Object> mapValue){
  53. int i = tmstruckLeaveFactoryResultService.addLeaveFactory(mapValue);
  54. return success(i);
  55. }
  56. @ApiOperation(value="查询出厂实绩")
  57. @ApiImplicitParams({
  58. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  59. @ApiImplicitParam(name = "apiId(110)", value = "动态表头", required = false, dataType = "Integer"),
  60. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  61. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  62. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  63. })
  64. @PostMapping("/getLeaveFactoryResult")
  65. public RESTfulResult getLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue,
  66. Integer apiId,
  67. Integer pageNum,
  68. Integer pageSize,
  69. Integer orderType,
  70. String con, String carrierSsoId){
  71. mapValue.put("orderTypee", orderType);
  72. if(carrierSsoId != null){
  73. if(!"null".equals(carrierSsoId)){
  74. mapValue.put("carrierSsoId", carrierSsoId);
  75. }
  76. }
  77. //框计算
  78. if(con != null){
  79. if(!"undefined".equals(con)){
  80. String index="get_leavefactory_list";//设置要查询的索引名称
  81. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  82. }
  83. }
  84. List<Map<String, Object>> allLeaveFactoryResult = null;
  85. //如果有条件查询则跳过初始化,和创建索引
  86. if(mapValue.size() == 1){
  87. //将查询结果存入索引中
  88. allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
  89. Map<String, Object> map = new HashMap<>();
  90. //添加索引
  91. map.put("index","get_leavefactory_list");
  92. //添加id
  93. map.put("indexId","leaveFactoryId");
  94. allLeaveFactoryResult.add(map);
  95. //新建索引
  96. esFeign.insertIndex(allLeaveFactoryResult);
  97. //删除
  98. allLeaveFactoryResult.remove(allLeaveFactoryResult.size()-1);
  99. }
  100. if(allLeaveFactoryResult == null)
  101. allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
  102. PageHelper.startPage(pageNum,pageSize);
  103. //分页数据
  104. List<Map<String, Object>> leaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
  105. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allLeaveFactoryResult,leaveFactoryResult);
  106. return success(pageList);
  107. }
  108. @ApiOperation(value="PAD扫描汽车出厂实绩")
  109. @ApiImplicitParams({
  110. @ApiImplicitParam(name = "mapValue", value = "", required = false, dataType = "Map"),
  111. @ApiImplicitParam(name = "orderNumber", value = "", required = false, dataType = "String"),
  112. })
  113. @PostMapping("/addLeaveFactoryResult")
  114. public RESTfulResult addLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue){
  115. //中交新路接口
  116. // Map<String, Object> parem=tmstruckLeaveFactoryResultService.getTruckFactoryResult("WYSDD2021091000000002");
  117. // parem.put("turnOf","0");
  118. // routeService.saveRoute(parem);
  119. int leaveFactory = 0;
  120. try {
  121. leaveFactory = tmstruckLeaveFactoryResultService.leaveFactoryByPDA(mapValue);
  122. }catch (Exception e){
  123. return failed(e.getMessage());
  124. }
  125. return success(leaveFactory);
  126. }
  127. @ApiOperation(value="APP查询汽车出厂实绩")
  128. @PostMapping("/getLeaveFactoryList")
  129. public RESTfulResult getLeaveFactoryList(@RequestParam String orderNumber) {
  130. List<Map<String,Object>> mapList = tmstruckLeaveFactoryResultService.getLeaveFactoryList(orderNumber);
  131. return success(mapList);
  132. }
  133. }