StatisticalReportImpl.java 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 oracle.sql.DATE;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import java.math.BigDecimal;
  10. import java.util.ArrayList;
  11. import java.util.Date;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * @ author :TXF
  16. * @ time :2021/12/14 15:26
  17. */
  18. @Service
  19. public class StatisticalReportImpl implements IStatisticalReportService {
  20. @Autowired
  21. StatisticalReportMapper statisticalReportMapper;
  22. /**
  23. * 计算相差时间
  24. * @return
  25. */
  26. public void calculateDifferenceTime(Map<String, Object> mesMap){
  27. Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
  28. Object resultOutGateTime = mesMap.get("resultOutGateTime");
  29. if(resultEntryGateTime != null && resultOutGateTime != null){
  30. Date enterDate = (Date) resultEntryGateTime;
  31. Date outDate = (Date) resultOutGateTime;
  32. //计算相差时间
  33. long dTime = outDate.getTime() - enterDate.getTime();
  34. mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
  35. }
  36. if(resultEntryGateTime != null && resultOutGateTime == null){
  37. //如果没有出厂时间则以当前时间减去进厂时间
  38. Date enterDate = (Date) resultEntryGateTime;
  39. long dTime = new Date().getTime() - enterDate.getTime();
  40. mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
  41. }
  42. }
  43. /**
  44. * 查询采购统计报表
  45. * @Author TXF
  46. * @Date 2022/1/6 9:52
  47. * @param map
  48. * @return
  49. **/
  50. public List<Map<String, Object>> getRLFLReport(Map<String, Object> map){
  51. List<Map<String, Object>> mapList = null;
  52. if(DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 5){
  53. mapList = statisticalReportMapper.getFuPurchaseFLRLReport(map);
  54. }else {
  55. mapList = statisticalReportMapper.getAllPurchaseFLRLReport(map);
  56. }
  57. return mapList;
  58. }
  59. @Override
  60. public List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map) {
  61. return statisticalReportMapper.getAllPurchaseFLRLReport(map);
  62. }
  63. /**
  64. * 查询销售统计报表
  65. * @param map
  66. * @return
  67. */
  68. @Override
  69. public List<Map<String, Object>> getAllSaleReport(Map<String, Object> map) {
  70. List<Map<String, Object>> mapList = statisticalReportMapper.getAllSaleReport(map);
  71. for (Map<String, Object> mesMap : mapList) {
  72. calculateDifferenceTime(mesMap);
  73. }
  74. return mapList;
  75. }
  76. @Override
  77. public List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map) {
  78. List<Map<String, Object>> listMap = statisticalReportMapper.getAllSaleReport(map);
  79. for(Map<String, Object> map1 : listMap) {
  80. if ( map1.get("resultEntryGateTime") == null) {
  81. map1.put("transportStatus", "未进厂");
  82. continue;
  83. }
  84. if (map1.get("resultOutGateTime") == null) {
  85. map1.put("transportStatus", "已进厂");
  86. continue;
  87. }
  88. if (map1.get("arrivaladdress") == null) {
  89. map1.put("transportStatus", "运输中");
  90. continue;
  91. }
  92. if (map1.get("receiveTime") == null) {
  93. map1.put("transportStatus", "已抵达");
  94. continue;
  95. } else
  96. map1.put("transportStatus", "已签收");
  97. }
  98. return listMap;
  99. }
  100. /**
  101. * 查询零星物资进厂统计报表
  102. */
  103. @Override
  104. public List<Map<String, Object>> getSporadicSuppliesReportNum1(Map<String, Object> mapValue) {
  105. return statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  106. }
  107. @Override
  108. public List<Map<String, Object>> getSporadicSuppliesReport1(Map<String, Object> mapValue) {
  109. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  110. for (Map<String, Object> mesMap : mapList) {
  111. calculateDifferenceTime(mesMap);
  112. }
  113. return mapList;
  114. }
  115. /**
  116. * 查询零星物资出厂统计报表
  117. */
  118. @Override
  119. public List<Map<String, Object>> getSporadicSuppliesReportNum2(Map<String, Object> mapValue) {
  120. return statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  121. }
  122. @Override
  123. public List<Map<String, Object>> getSporadicSuppliesReport2(Map<String, Object> mapValue) {
  124. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  125. for (Map<String, Object> mesMap : mapList) {
  126. calculateDifferenceTime(mesMap);
  127. }
  128. return mapList;
  129. }
  130. //采购内转统计报表
  131. @Override
  132. public List<Map<String, Object>> getPurInwardReport( Map<String, Object> mapValue) {
  133. List<Map<String, Object>> inwardReportResult = statisticalReportMapper.getInwardReportResult(mapValue);
  134. for (Map<String,Object>inwardReport:inwardReportResult
  135. ) {
  136. BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
  137. BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
  138. BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
  139. //第二次净重减第一次净重
  140. inwardReport.put("newTract",netTract);
  141. calculateDifferenceTime(inwardReport);
  142. }
  143. return inwardReportResult;
  144. }
  145. //采购内转统计报表
  146. @Override
  147. public List<Map<String, Object>> getLXInwardReport( Map<String, Object> mapValue) {
  148. List<Map<String, Object>> lxReportResult = statisticalReportMapper.getLXReportResult(mapValue);
  149. for (Map<String,Object>inwardReport:lxReportResult
  150. ) {
  151. BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
  152. BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
  153. BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
  154. //第二次净重减第一次净重
  155. inwardReport.put("newTract",netTract);
  156. calculateDifferenceTime(inwardReport);
  157. }
  158. return lxReportResult;
  159. }
  160. @Override
  161. public List<Map<String, Object>> getInwardReport(Map<String, Object> mapValue) {
  162. return statisticalReportMapper.getInwardReport(mapValue);
  163. }
  164. @Override
  165. public List<Map<String, Object>> getLoading(Map<String, Object> mapValue) {
  166. return statisticalReportMapper.getLoading(mapValue);
  167. }
  168. @Override
  169. public List<Map<String, Object>> getUnLoading(Map<String, Object> mapValue) {
  170. return statisticalReportMapper.getUnLoading(mapValue);
  171. }
  172. @Override
  173. public List<Map<String, Object>> getLoaderResult(Map<String, Object> mapValue) {
  174. return statisticalReportMapper.getLoaderResult(mapValue);
  175. }
  176. @Override
  177. public List<Map<String, Object>> getCapacityByDefend(Map<String, Object> map) {
  178. return statisticalReportMapper.getCapacityByDefend(map);
  179. }
  180. @Override
  181. public List<Map<String, Object>> getInwardReportForAssemble(Map<String, Object> mapValue) {
  182. return statisticalReportMapper.getInwardReportForAssemble(mapValue);
  183. }
  184. @Override
  185. public List<Map<String, Object>> getLoaderForResultDetail(Map<String, Object> mapValue) {
  186. //判断是否含有装机备注
  187. return statisticalReportMapper.getLoaderForResultDetail(mapValue);
  188. }
  189. }