StatisticalReportImpl.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package com.steerinfo.dil.service.impl;
  2. import com.steerinfo.dil.mapper.StatisticalReportMapper;
  3. import com.steerinfo.dil.service.IStatisticalReportService;
  4. import com.steerinfo.dil.util.DataChange;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7. import java.math.BigDecimal;
  8. import java.util.Date;
  9. import java.util.List;
  10. import java.util.Map;
  11. /**
  12. * @ author :TXF
  13. * @ time :2021/12/14 15:26
  14. */
  15. @Service
  16. public class StatisticalReportImpl implements IStatisticalReportService {
  17. @Autowired
  18. StatisticalReportMapper statisticalReportMapper;
  19. /**
  20. * 计算相差时间
  21. * @return
  22. */
  23. public void calculateDifferenceTime(Map<String, Object> mesMap){
  24. Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
  25. Object resultOutGateTime = mesMap.get("resultOutGateTime");
  26. if(resultEntryGateTime != null && resultOutGateTime != null){
  27. Date enterDate = (Date) resultEntryGateTime;
  28. Date outDate = (Date) resultOutGateTime;
  29. //计算相差时间
  30. long dTime = outDate.getTime() - enterDate.getTime();
  31. mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
  32. }
  33. if(resultEntryGateTime != null && resultOutGateTime == null){
  34. //如果没有出厂时间则以当前时间减去进厂时间
  35. Date enterDate = (Date) resultEntryGateTime;
  36. long dTime = new Date().getTime() - enterDate.getTime();
  37. mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
  38. }
  39. }
  40. /**
  41. * 查询采购统计报表
  42. * @Author TXF
  43. * @Date 2022/1/6 9:52
  44. * @param map
  45. * @return
  46. **/
  47. public List<Map<String, Object>> getRLFLReport(Map<String, Object> map){
  48. List<Map<String, Object>> mapList = statisticalReportMapper.getAllPurchaseFLRLReport(map);
  49. for (Map<String, Object> mesMap : mapList) {
  50. calculateDifferenceTime(mesMap);
  51. }
  52. return mapList;
  53. }
  54. @Override
  55. public List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map) {
  56. return statisticalReportMapper.getAllPurchaseFLRLReport(map);
  57. }
  58. /**
  59. * 查询销售统计报表
  60. * @param map
  61. * @return
  62. */
  63. @Override
  64. public List<Map<String, Object>> getAllSaleReport(Map<String, Object> map) {
  65. List<Map<String, Object>> mapList = statisticalReportMapper.getAllSaleReport(map);
  66. for (Map<String, Object> mesMap : mapList) {
  67. calculateDifferenceTime(mesMap);
  68. }
  69. return mapList;
  70. }
  71. @Override
  72. public List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map) {
  73. return statisticalReportMapper.getAllSaleReport(map);
  74. }
  75. /**
  76. * 查询零星物资进厂统计报表
  77. */
  78. @Override
  79. public List<Map<String, Object>> getSporadicSuppliesReportNum1(Map<String, Object> mapValue) {
  80. return statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  81. }
  82. @Override
  83. public List<Map<String, Object>> getSporadicSuppliesReport1(Map<String, Object> mapValue) {
  84. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  85. for (Map<String, Object> mesMap : mapList) {
  86. calculateDifferenceTime(mesMap);
  87. }
  88. return mapList;
  89. }
  90. /**
  91. * 查询零星物资出厂统计报表
  92. */
  93. @Override
  94. public List<Map<String, Object>> getSporadicSuppliesReportNum2(Map<String, Object> mapValue) {
  95. return statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  96. }
  97. @Override
  98. public List<Map<String, Object>> getSporadicSuppliesReport2(Map<String, Object> mapValue) {
  99. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  100. for (Map<String, Object> mesMap : mapList) {
  101. calculateDifferenceTime(mesMap);
  102. }
  103. return mapList;
  104. }
  105. //采购内转统计报表
  106. @Override
  107. public List<Map<String, Object>> getPurInwardReport(Map<String, Object> mapValue) {
  108. //查询出所有订单类型为10的采购内转订单总实绩id集合
  109. List<Map<String,Object>> inwardReport=null;
  110. List<Map<String,Object>> totalResultList = statisticalReportMapper.getTotalResultList();
  111. for (Map<String,Object>maptotal:totalResultList
  112. ) {
  113. //遍历总实绩,根据总实绩id获取所有采购内转统计报表
  114. mapValue.put("totalId",maptotal.get("totalId"));
  115. List<Map<String, Object>> inwardReportResult = statisticalReportMapper.getInwardReportResult(mapValue);
  116. for (Map<String,Object> map1:inwardReportResult) {
  117. calculateDifferenceTime(map1);
  118. inwardReport.add(map1);
  119. }
  120. }
  121. return inwardReport;
  122. }
  123. }