StatisticalReportController.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.service.impl.StatisticalReportImpl;
  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.*;
  20. /**
  21. * @ author :TXF
  22. * @ time :2021/12/14 18:05
  23. */
  24. @RestController
  25. @RequestMapping("/${api.version}/statisticalReport")
  26. public class StatisticalReportController extends BaseRESTfulController {
  27. @Autowired
  28. StatisticalReportImpl statisticalReportService;
  29. @Autowired
  30. ColumnDataUtil columnDataUtil;
  31. private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
  32. private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  33. @ApiOperation(value="查询辅料燃料统计报表")
  34. @ApiImplicitParams({
  35. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  36. @ApiImplicitParam(name = "apiId(220)", value = "动态表头", required = false, dataType = "Integer"),
  37. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  38. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  39. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  40. })
  41. @PostMapping("/getRLFLReport")
  42. public RESTfulResult getRLFLReport(@RequestBody(required=false) Map<String,Object> mapValue,
  43. Integer apiId,
  44. Integer pageNum,
  45. Integer pageSize,
  46. String startTime,
  47. String endTime,
  48. Integer orderType
  49. ){
  50. mapValue.put("orderTypee", orderType);
  51. DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
  52. List<Map<String, Object>> allReport = statisticalReportService.getAllPurchaseFLRLReport(mapValue);
  53. PageHelper.startPage(pageNum, pageSize);
  54. //分页数据
  55. List<Map<String, Object>> report = statisticalReportService.getRLFLReport(mapValue);
  56. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport,report);
  57. return success(pageList);
  58. }
  59. @ApiOperation(value="查询销售统计报表")
  60. @ApiImplicitParams({
  61. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  62. @ApiImplicitParam(name = "apiId(423)", 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("/getAllSaleReport")
  68. public RESTfulResult getAllSaleReport(@RequestBody(required=false) Map<String,Object> mapValue,
  69. Integer apiId,
  70. Integer pageNum,
  71. Integer pageSize,
  72. String startTime,
  73. String endTime,
  74. String carrierSsoId
  75. ){
  76. if(carrierSsoId != null){
  77. if(!"null".equals(carrierSsoId)){
  78. mapValue.put("carrierSsoId", carrierSsoId);
  79. }
  80. }
  81. DataChange.queryDataByTwoDate(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  82. List<Map<String, Object>> allReport = statisticalReportService.getAllSaleReportNum(mapValue);
  83. PageHelper.startPage(pageNum, pageSize);
  84. //分页数据
  85. List<Map<String, Object>> report = statisticalReportService.getAllSaleReport(mapValue);
  86. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
  87. return success(pageList);
  88. }
  89. @ApiOperation(value="查询销售统计报表筛选过后的总净重")
  90. @ApiImplicitParams({
  91. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  92. @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
  93. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  94. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  95. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  96. })
  97. @PostMapping("/getAllSaleReportTotal")
  98. public RESTfulResult getAllSaleReportTotal(@RequestBody(required=false) Map<String,Object> mapValue,
  99. String startTime,
  100. String endTime,
  101. String carrierSsoId
  102. ){
  103. if(carrierSsoId != null){
  104. if(!"null".equals(carrierSsoId)){
  105. mapValue.put("carrierSsoId", carrierSsoId);
  106. }
  107. }
  108. DataChange.queryDataByTwoDate(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  109. List<Map<String, Object>> allReport = statisticalReportService.getAllSaleReportNum(mapValue);
  110. //获取销售统计报表筛选过后的总净重
  111. BigDecimal AllResultNetWeight = new BigDecimal(0);
  112. for (Map<String, Object> stringObjectMap : allReport) {
  113. if(stringObjectMap.get("resultNetWeight")!=null) {
  114. AllResultNetWeight = AllResultNetWeight.add(new BigDecimal(stringObjectMap.get("resultNetWeight").toString()));
  115. }
  116. }
  117. return success(AllResultNetWeight);
  118. }
  119. @ApiOperation(value="查询零星物资进厂统计报表")
  120. @ApiImplicitParams({
  121. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  122. @ApiImplicitParam(name = "apiId(424)", value = "动态表头", required = false, dataType = "Integer"),
  123. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  124. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  125. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  126. })
  127. @PostMapping("/getSporadicSuppliesReport1")
  128. public RESTfulResult getSporadicSuppliesReport1(@RequestBody(required=false) Map<String,Object> mapValue,
  129. Integer apiId,
  130. Integer pageNum,
  131. Integer pageSize,
  132. String startTime,
  133. String endTime,
  134. String carrierSsoId,
  135. String userId,
  136. String userIds,
  137. String con,
  138. Integer orderType
  139. ){
  140. if(carrierSsoId != null) {
  141. if (!"null".equals(carrierSsoId)) {
  142. mapValue.put("carrierSsoId", carrierSsoId);
  143. }
  144. }
  145. DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
  146. if (userId!=null){
  147. mapValue.put("userId",userId);
  148. }
  149. if (orderType!=null){
  150. mapValue.put("orderType",orderType);
  151. }
  152. if (userIds!=null){
  153. mapValue.put("userIds",userIds);
  154. }
  155. if (con!=null&&!con.equals("undefined")){
  156. mapValue.put("con","%"+con+"%");
  157. }
  158. List<Map<String, Object>> allReport = statisticalReportService.getSporadicSuppliesReportNum1(mapValue);
  159. PageHelper.startPage(pageNum, pageSize);
  160. //分页数据
  161. List<Map<String, Object>> report = statisticalReportService.getSporadicSuppliesReport1(mapValue);
  162. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
  163. return success(pageList);
  164. }
  165. @ApiOperation(value="查询零星物资出厂统计报表")
  166. @ApiImplicitParams({
  167. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  168. @ApiImplicitParam(name = "apiId(425)", value = "动态表头", required = false, dataType = "Integer"),
  169. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  170. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  171. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  172. })
  173. @PostMapping("/getSporadicSuppliesReport2")
  174. public RESTfulResult getSporadicSuppliesReport2(@RequestBody(required=false) Map<String,Object> mapValue,
  175. Integer apiId,
  176. Integer pageNum,
  177. Integer pageSize,
  178. String startTime,
  179. String endTime,
  180. String carrierSsoId,
  181. String userId,
  182. String userIds,
  183. String con,
  184. Integer orderType
  185. ){
  186. if(carrierSsoId != null){
  187. if(!"null".equals(carrierSsoId)){
  188. mapValue.put("carrierSsoId", carrierSsoId);
  189. }
  190. }
  191. DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
  192. if (con!=null&&!con.equals("undefined")){
  193. mapValue.put("con","%"+con+"%");
  194. }
  195. if (userId!=null){
  196. mapValue.put("userId",userId);
  197. }
  198. if (orderType!=null){
  199. mapValue.put("orderType",orderType);
  200. }
  201. if (userIds!=null){
  202. mapValue.put("userIds",userIds);
  203. }
  204. List<Map<String, Object>> allReport = statisticalReportService.getSporadicSuppliesReportNum2(mapValue);
  205. PageHelper.startPage(pageNum, pageSize);
  206. //分页数据
  207. List<Map<String, Object>> report = statisticalReportService.getSporadicSuppliesReport2(mapValue);
  208. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
  209. return success(pageList);
  210. }
  211. }