TmstruckLeaveFactoryResultController.java 5.8 KB

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