TmstruckTotalResultController.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.service.ITmstruckTotalResultService;
  3. import com.steerinfo.dil.util.BaseRESTfulController;
  4. import com.steerinfo.dil.util.ColumnDataUtil;
  5. import com.steerinfo.dil.util.DataChange;
  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.PostMapping;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import java.math.BigDecimal;
  18. import java.text.SimpleDateFormat;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * @ author :TXF
  23. * @ time :2021/10/27 10:24
  24. */
  25. @RestController
  26. @RequestMapping("/${api.version}/tmstrucktotalresults")
  27. public class TmstruckTotalResultController extends BaseRESTfulController {
  28. @Autowired
  29. ITmstruckTotalResultService tmstruckTotalResultService;
  30. @Autowired
  31. ColumnDataUtil columnDataUtil;
  32. private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  33. @ApiOperation(value="添加总实绩 ")
  34. @ApiImplicitParams({
  35. @ApiImplicitParam(name = "map", value = "订单Id", required = false, dataType = "Map"),
  36. })
  37. @PostMapping("/addTotalResult")
  38. public int addTotalResult(@RequestBody(required=false) Map<String, Object> map){
  39. BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
  40. int i = tmstruckTotalResultService.addTotalResult(orderId);
  41. return i;
  42. }
  43. @ApiOperation(value="继续装补录实绩 ")
  44. @ApiImplicitParams({
  45. @ApiImplicitParam(name = "map", value = "订单Id", required = false, dataType = "Map"),
  46. })
  47. @PostMapping("/copyAllResult")
  48. public int copyAllResult(@RequestBody(required=false) Map<String, Object> map){
  49. BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
  50. BigDecimal orderIdOld = DataChange.dataToBigDecimal(map.get("orderIdOld"));
  51. BigDecimal resultTotalIdOld = DataChange.dataToBigDecimal(map.get("resultTotalIdOld"));
  52. int i = tmstruckTotalResultService.copyAllResult(orderId,orderIdOld,resultTotalIdOld);
  53. return i;
  54. }
  55. /**
  56. * 展示计数实绩列表
  57. *
  58. */
  59. @ApiOperation(value="查询计数实绩列表")
  60. @ApiImplicitParams({
  61. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  62. @ApiImplicitParam(name = "apiId(364)", 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("/selectCountList")
  68. public RESTfulResult selectCountList(@RequestBody(required=false) Map<String,Object> mapValue,
  69. Integer apiId,
  70. Integer pageNum,
  71. Integer pageSize
  72. ){
  73. //不分页筛选数据
  74. PageHelper.startPage(pageNum,pageSize);
  75. //分页数据
  76. List<Map<String, Object>> countList = tmstruckTotalResultService.selectCountList(mapValue);
  77. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,countList);
  78. return success(pageList);
  79. }
  80. @ApiOperation(value="查询所有的包月作业实绩")
  81. @ApiImplicitParams({
  82. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  83. @ApiImplicitParam(name = "apiId(365)", value = "动态表头", required = false, dataType = "Integer"),
  84. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  85. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  86. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  87. })
  88. @PostMapping("/getTmstruckMonthResult")
  89. public RESTfulResult getTmstruckMonthResult(@RequestBody(required=false) Map<String,Object> mapValue,
  90. Integer apiId,
  91. Integer pageNum,
  92. Integer pageSize
  93. ){
  94. //不分页筛选数据
  95. PageHelper.startPage(pageNum,pageSize);
  96. //分页数据
  97. List<Map<String, Object>> qualityResult = tmstruckTotalResultService.getTmstruckMonthResult(mapValue);
  98. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,qualityResult);
  99. return success(pageList);
  100. }
  101. @PostMapping("/getAllReverseResult")
  102. public RESTfulResult getAllReverseResult(@RequestBody(required=false) Map<String,Object> mapValue,
  103. Integer apiId,
  104. Integer pageNum,
  105. Integer pageSize,
  106. String con,
  107. String userId,
  108. String startTime,
  109. String endTime){
  110. PageHelper.startPage(pageNum,pageSize);
  111. mapValue.put("con",con);
  112. mapValue.put("userId",userId);
  113. DataChange.queryDataByDateTime(startTime,endTime,mapValue,sdfDateTime);
  114. //分页查询
  115. List<Map<String, Object>> qualityResult = tmstruckTotalResultService.getAllReverseResult(mapValue);
  116. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,qualityResult);
  117. return success(pageList);
  118. }
  119. /**
  120. * 修改订单线路ID,并迁移实绩。目前仅支持采购辅料
  121. * @param mapValue
  122. * @return
  123. */
  124. @PostMapping("/changeOrderLine")
  125. public RESTfulResult changeOrderLine(@RequestBody(required=false) Map<String,Object> mapValue){
  126. try{
  127. tmstruckTotalResultService.changeOrderLine(mapValue);
  128. }catch (Exception e){
  129. e.printStackTrace();
  130. if(e.getMessage()==null || e.getMessage().contains("Exception")){
  131. return failed("修改失败,未知原因!",e.getMessage());
  132. }else{
  133. return failed(e.getMessage());
  134. }
  135. }
  136. return success(1);
  137. }
  138. }