StatisticalReportController.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  52. PageHelper.startPage(pageNum, pageSize);
  53. //分页数据
  54. List<Map<String, Object>> report = statisticalReportService.getRLFLReport(mapValue);
  55. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,report);
  56. return success(pageList);
  57. }
  58. @ApiOperation(value="查询销售统计报表")
  59. @ApiImplicitParams({
  60. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  61. @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
  62. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  63. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  64. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  65. })
  66. @PostMapping("/getAllSaleReport")
  67. public RESTfulResult getAllSaleReport(@RequestBody(required=false) Map<String,Object> mapValue,
  68. Integer apiId,
  69. Integer pageNum,
  70. Integer pageSize,
  71. String startTime,
  72. String endTime,
  73. String carrierSsoId
  74. ){
  75. if(carrierSsoId != null){
  76. if(!"null".equals(carrierSsoId)){
  77. mapValue.put("carrierSsoId", carrierSsoId);
  78. }
  79. }
  80. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  81. List<Map<String, Object>> allReport = statisticalReportService.getAllSaleReportNum(mapValue);
  82. PageHelper.startPage(pageNum, pageSize);
  83. //分页数据
  84. List<Map<String, Object>> report = statisticalReportService.getAllSaleReport(mapValue);
  85. PageListAdd pageList = columnDataUtil.tableColumnData2(apiId, allReport, report);
  86. return success(pageList);
  87. }
  88. @ApiOperation(value="查询销售统计报表筛选过后的总净重")
  89. @ApiImplicitParams({
  90. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  91. @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
  92. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  93. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  94. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  95. })
  96. @PostMapping("/getAllSaleReportTotal")
  97. public RESTfulResult getAllSaleReportTotal(@RequestBody(required=false) Map<String,Object> mapValue,
  98. String startTime,
  99. String endTime,
  100. String carrierSsoId
  101. ){
  102. if(carrierSsoId != null){
  103. if(!"null".equals(carrierSsoId)){
  104. mapValue.put("carrierSsoId", carrierSsoId);
  105. }
  106. }
  107. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  108. List<Map<String, Object>> allReport = statisticalReportService.getAllSaleReportNum(mapValue);
  109. //获取销售统计报表筛选过后的总净重
  110. BigDecimal AllResultNetWeight = new BigDecimal(0);
  111. for (Map<String, Object> stringObjectMap : allReport) {
  112. if(stringObjectMap.get("resultNetWeight")!=null) {
  113. AllResultNetWeight = AllResultNetWeight.add(new BigDecimal(stringObjectMap.get("resultNetWeight").toString()));
  114. }
  115. }
  116. return success(AllResultNetWeight);
  117. }
  118. @ApiOperation(value="查询零星物资进厂统计报表")
  119. @ApiImplicitParams({
  120. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  121. @ApiImplicitParam(name = "apiId(424)", value = "动态表头", required = false, dataType = "Integer"),
  122. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  123. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  124. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  125. })
  126. @PostMapping("/getSporadicSuppliesReport1")
  127. public RESTfulResult getSporadicSuppliesReport1(@RequestBody(required=false) Map<String,Object> mapValue,
  128. Integer apiId,
  129. Integer pageNum,
  130. Integer pageSize,
  131. String startTime,
  132. String endTime,
  133. String carrierSsoId,
  134. String userId, String userIds, String con, Integer orderType
  135. ){
  136. if(carrierSsoId != null) {
  137. if (!"null".equals(carrierSsoId)) {
  138. mapValue.put("carrierSsoId", carrierSsoId);
  139. }
  140. }
  141. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  142. if (userId!=null){
  143. mapValue.put("userId",userId);
  144. }
  145. if (orderType!=null){
  146. mapValue.put("orderType",orderType);
  147. }
  148. if (userIds!=null){
  149. mapValue.put("userIds",userIds);
  150. }
  151. if (con!=null&&!con.equals("undefined")){
  152. mapValue.put("con","%"+con+"%");
  153. }
  154. List<Map<String, Object>> allReport = statisticalReportService.getSporadicSuppliesReportNum1(mapValue);
  155. PageHelper.startPage(pageNum, pageSize);
  156. //分页数据
  157. List<Map<String, Object>> report = statisticalReportService.getSporadicSuppliesReport1(mapValue);
  158. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
  159. return success(pageList);
  160. }
  161. @ApiOperation(value="查询零星物资出厂统计报表")
  162. @ApiImplicitParams({
  163. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  164. @ApiImplicitParam(name = "apiId(425)", value = "动态表头", required = false, dataType = "Integer"),
  165. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  166. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  167. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  168. })
  169. @PostMapping("/getSporadicSuppliesReport2")
  170. public RESTfulResult getSporadicSuppliesReport2(@RequestBody(required=false) Map<String,Object> mapValue,
  171. Integer apiId,
  172. Integer pageNum,
  173. Integer pageSize,
  174. String startTime,
  175. String endTime,
  176. String carrierSsoId,
  177. String userId,
  178. String userIds,
  179. String con,
  180. Integer orderType
  181. ){
  182. if(carrierSsoId != null){
  183. if(!"null".equals(carrierSsoId)){
  184. mapValue.put("carrierSsoId", carrierSsoId);
  185. }
  186. }
  187. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  188. if (con!=null&&!con.equals("undefined")){
  189. mapValue.put("con","%"+con+"%");
  190. }
  191. if (userId!=null){
  192. mapValue.put("userId",userId);
  193. }
  194. if (orderType!=null){
  195. mapValue.put("orderType",orderType);
  196. }
  197. if (userIds!=null){
  198. mapValue.put("userIds",userIds);
  199. }
  200. List<Map<String, Object>> allReport = statisticalReportService.getSporadicSuppliesReportNum2(mapValue);
  201. PageHelper.startPage(pageNum, pageSize);
  202. //分页数据
  203. List<Map<String, Object>> report = statisticalReportService.getSporadicSuppliesReport2(mapValue);
  204. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
  205. return success(pageList);
  206. }
  207. @ApiOperation(value="查询采购内转统计报表")
  208. @ApiImplicitParams({
  209. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  210. @ApiImplicitParam(name = "apiId", value = "动态表头", required = false, dataType = "Integer"),
  211. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  212. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  213. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  214. })
  215. @PostMapping("/getPurInwardReport")
  216. public RESTfulResult getPurInwardReport(@RequestBody(required=false) Map<String,Object> mapValue,
  217. Integer apiId,
  218. Integer pageNum,
  219. Integer pageSize,
  220. String startTime,
  221. String endTime
  222. ){
  223. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  224. PageHelper.startPage(pageNum, pageSize);
  225. //分页数据
  226. List<Map<String, Object>> report = statisticalReportService.getPurInwardReport(mapValue);
  227. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  228. return success(pageList);
  229. }
  230. @ApiOperation(value="查询零星内转统计报表")
  231. @ApiImplicitParams({
  232. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  233. @ApiImplicitParam(name = "apiId", value = "动态表头", required = false, dataType = "Integer"),
  234. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  235. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  236. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  237. })
  238. @PostMapping("/getLXInwardReport")
  239. public RESTfulResult getLXInwardReport(@RequestBody(required=false) Map<String,Object> mapValue,
  240. Integer apiId,
  241. Integer pageNum,
  242. Integer pageSize,
  243. String startTime,
  244. String endTime
  245. ){
  246. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  247. PageHelper.startPage(pageNum, pageSize);
  248. //分页数据
  249. List<Map<String, Object>> report = statisticalReportService.getLXInwardReport(mapValue);
  250. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  251. return success(pageList);
  252. }
  253. @ApiOperation(value="查询内转统计报表")
  254. @ApiImplicitParams({
  255. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  256. @ApiImplicitParam(name = "apiId", value = "动态表头", required = false, dataType = "Integer"),
  257. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  258. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  259. @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
  260. })
  261. @PostMapping("/getInwardReport")
  262. public RESTfulResult getInwardReport(@RequestBody(required=false) Map<String,Object> mapValue,
  263. Integer apiId,
  264. Integer pageNum,
  265. Integer pageSize,
  266. String startTime,
  267. String endTime
  268. ){
  269. DataChange.queryDataByDateTime(startTime, endTime, mapValue,sdfDateTime);//根据时间段查询数据
  270. PageHelper.startPage(pageNum, pageSize);
  271. //分页数据
  272. List<Map<String, Object>> report = statisticalReportService.getInwardReport(mapValue);
  273. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  274. return success(pageList);
  275. }
  276. @ApiOperation("对内转车辆装货点进行统计")
  277. @PostMapping("/getLoading")
  278. public RESTfulResult getLoading(@RequestBody(required=false) Map<String,Object> mapValue,
  279. Integer apiId,
  280. Integer pageNum,
  281. Integer pageSize,
  282. String startTime,
  283. String endTime){
  284. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  285. PageHelper.startPage(pageNum, pageSize);
  286. //分页数据
  287. List<Map<String, Object>> report = statisticalReportService.getLoading(mapValue);
  288. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  289. return success(pageList);
  290. }
  291. @ApiOperation("装载机所装车辆重量统计报表")
  292. @PostMapping("/getLoaderResult")
  293. public RESTfulResult getLoaderResult(@RequestBody(required=false) Map<String,Object> mapValue,
  294. Integer apiId,//apiId:463
  295. Integer pageNum,
  296. Integer pageSize,
  297. String startTime,
  298. String endTime){
  299. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
  300. PageHelper.startPage(pageNum, pageSize);
  301. //分页数据
  302. List<Map<String, Object>> report = statisticalReportService.getLoaderResult(mapValue);
  303. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  304. return success(pageList);
  305. }
  306. @ApiOperation("对内转车辆装卸货点进行统计")
  307. @PostMapping("/getUnLoading")
  308. public RESTfulResult getUnLoading(@RequestBody(required=false) Map<String,Object> mapValue,
  309. Integer apiId,
  310. Integer pageNum,
  311. Integer pageSize,
  312. String startTime,
  313. String endTime){
  314. DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
  315. PageHelper.startPage(pageNum, pageSize);
  316. //分页数据
  317. List<Map<String, Object>> report = statisticalReportService.getUnLoading(mapValue);
  318. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  319. return success(pageList);
  320. }
  321. //保卫部随机抽查车牌号查看所有信息
  322. @ApiOperation("保卫部随机抽查车牌号查看所有信息")
  323. @PostMapping("/getCapacityByDefend")
  324. public RESTfulResult getCapacityByDefend(@RequestBody(required = false) Map<String,Object> map,
  325. Integer apiId,
  326. Integer pageNum,
  327. Integer pageSize,
  328. String con){
  329. map.put("con",con);
  330. PageHelper.startPage(pageNum, pageSize);
  331. List<Map<String, Object>> report = statisticalReportService.getCapacityByDefend(map);
  332. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, report);
  333. return success(pageList);
  334. }
  335. }