StatisticalReportImpl.java 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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> map1 : mapList) {
  72. if ( map1.get("resultEntryGateTime") == null) {
  73. map1.put("transportStatus", "未进厂");
  74. continue;
  75. }
  76. if (map1.get("resultOutGateTime") == null) {
  77. map1.put("transportStatus", "已进厂");
  78. continue;
  79. }
  80. if (map1.get("arrivalAddress") == null) {
  81. map1.put("transportStatus", "已出厂");
  82. continue;
  83. }
  84. if (map1.get("receiptAddress") == null) {
  85. map1.put("transportStatus", "已抵达");
  86. continue;
  87. }
  88. else{
  89. map1.put("transportStatus", "已签收");
  90. }
  91. }
  92. for (Map<String, Object> mesMap : mapList) {
  93. calculateDifferenceTime(mesMap);
  94. }
  95. return mapList;
  96. }
  97. @Override
  98. public List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map) {
  99. List<Map<String, Object>> listMap = statisticalReportMapper.getAllSaleReport(map);
  100. return listMap;
  101. }
  102. /**
  103. * 查询零星物资进厂统计报表
  104. */
  105. @Override
  106. public List<Map<String, Object>> getSporadicSuppliesReportNum1(Map<String, Object> mapValue) {
  107. return statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  108. }
  109. @Override
  110. public List<Map<String, Object>> getSporadicSuppliesReport1(Map<String, Object> mapValue) {
  111. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
  112. for (Map<String, Object> mesMap : mapList) {
  113. calculateDifferenceTime(mesMap);
  114. }
  115. return mapList;
  116. }
  117. /**
  118. * 查询零星物资出厂统计报表
  119. */
  120. @Override
  121. public List<Map<String, Object>> getSporadicSuppliesReportNum2(Map<String, Object> mapValue) {
  122. return statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  123. }
  124. @Override
  125. public List<Map<String, Object>> getSporadicSuppliesReport2(Map<String, Object> mapValue) {
  126. List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
  127. for (Map<String, Object> mesMap : mapList) {
  128. calculateDifferenceTime(mesMap);
  129. }
  130. return mapList;
  131. }
  132. //采购内转统计报表
  133. @Override
  134. public List<Map<String, Object>> getPurInwardReport( Map<String, Object> mapValue) {
  135. List<Map<String, Object>> inwardReportResult = statisticalReportMapper.getInwardReportResult(mapValue);
  136. for (Map<String,Object>inwardReport:inwardReportResult
  137. ) {
  138. if(DataChange.dataToBigDecimal(inwardReport.get("orderType")).intValue() == 10){
  139. inwardReport.put("transRange","化工园区铁专线-焦化二厂");
  140. }else{
  141. inwardReport.put("transRange","化工园区铁专线-达钢厂区");
  142. }
  143. BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
  144. BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
  145. BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
  146. //第二次净重减第一次净重
  147. inwardReport.put("newTract",netTract);
  148. calculateDifferenceTime(inwardReport);
  149. }
  150. return inwardReportResult;
  151. }
  152. //采购内转统计报表
  153. @Override
  154. public List<Map<String, Object>> getLXInwardReport( Map<String, Object> mapValue) {
  155. List<Map<String, Object>> lxReportResult = statisticalReportMapper.getLXReportResult(mapValue);
  156. for (Map<String,Object>inwardReport:lxReportResult
  157. ) {
  158. BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
  159. BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
  160. BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
  161. //第二次净重减第一次净重
  162. inwardReport.put("newTract",netTract);
  163. calculateDifferenceTime(inwardReport);
  164. }
  165. return lxReportResult;
  166. }
  167. @Override
  168. public List<Map<String, Object>> getInwardReport(Map<String, Object> mapValue) {
  169. return statisticalReportMapper.getInwardReport(mapValue);
  170. }
  171. @Override
  172. public List<Map<String, Object>> getLoading(Map<String, Object> mapValue) {
  173. return statisticalReportMapper.getLoading(mapValue);
  174. }
  175. @Override
  176. public List<Map<String, Object>> getUnLoading(Map<String, Object> mapValue) {
  177. return statisticalReportMapper.getUnLoading(mapValue);
  178. }
  179. @Override
  180. public List<Map<String, Object>> getLoaderResult(Map<String, Object> mapValue) {
  181. return statisticalReportMapper.getLoaderResult(mapValue);
  182. }
  183. @Override
  184. public List<Map<String, Object>> getCapacityByDefend(Map<String, Object> map) {
  185. return statisticalReportMapper.getCapacityByDefend(map);
  186. }
  187. @Override
  188. public List<Map<String, Object>> getInwardReportForAssemble(Map<String, Object> mapValue) {
  189. return statisticalReportMapper.getInwardReportForAssemble(mapValue);
  190. }
  191. @Override
  192. public List<Map<String, Object>> getLoaderForResultDetail(Map<String, Object> mapValue) {
  193. //判断是否含有装机备注
  194. return statisticalReportMapper.getLoaderForResultDetail(mapValue);
  195. }
  196. //查看该组织架构下的销售订单统计报表
  197. @Override
  198. public List<Map<String, Object>> getSaleOrderList(Map<String, Object> mapValue) {
  199. return statisticalReportMapper.getSaleOrderList(mapValue);
  200. }
  201. //查看该组织架构下的采购订单统计报表
  202. @Override
  203. public List<Map<String, Object>> getPurchaseOrderList(Map<String, Object> mapValue) {
  204. return statisticalReportMapper.getPurchaseOrderList(mapValue);
  205. }
  206. //查看该组织架构下的采购内转统计报表
  207. @Override
  208. public List<Map<String, Object>> getPurchaseInwardList(Map<String, Object> mapValue) {
  209. return statisticalReportMapper.getPurchaseInwardList(mapValue);
  210. }
  211. //查看该组织架构下的内转统计报表
  212. @Override
  213. public List<Map<String, Object>> getInwardInFactory(Map<String, Object> mapValue) {
  214. return statisticalReportMapper.getInwardInFactory(mapValue);
  215. }
  216. @Override
  217. public List<Map<String, Object>> getOutFactoryInwardList(Map<String, Object> mapValue) {
  218. return statisticalReportMapper.getOutFactoryInwardList(mapValue);
  219. }
  220. @Override
  221. public List<Map<String, Object>> getSaleSteelReport(Map<String, Object> mapValue) {
  222. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelReport(mapValue);
  223. return saleSteelReport;
  224. }
  225. @Override
  226. public List<Map<String, Object>> getInwardSaleSteelReport(Map<String, Object> map) {
  227. return statisticalReportMapper.getInwardSaleSteelReport(map);
  228. }
  229. @Override
  230. public List<Map<String, Object>> getInwardSaleSteelOrder(Map<String, Object> map) {
  231. return statisticalReportMapper.getInwardSaleSteelOrder(map);
  232. }
  233. }