StatisticalReportImpl.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. package com.steerinfo.dil.service.impl;
  2. import com.google.gson.JsonObject;
  3. import com.steerinfo.dil.mapper.StatisticalReportMapper;
  4. import com.steerinfo.dil.service.IStatisticalReportService;
  5. import com.steerinfo.dil.util.DataChange;
  6. import com.steerinfo.dil.util.PageListAdd;
  7. import com.steerinfo.framework.controller.RESTfulResult;
  8. import oracle.sql.DATE;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Service;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import java.math.BigDecimal;
  13. import java.util.*;
  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. HashSet set = new HashSet<>();
  224. HashSet<Map<String,Object>> filterConsigneeList = new HashSet<>();
  225. HashSet<Map<String,Object>> filterCarrierList = new HashSet<>();
  226. HashSet<Map<String,Object>> filterCapacityList = new HashSet<>();
  227. HashSet<Map<String,Object>> filtermaterialNameList = new HashSet<>();
  228. HashSet<Map<String,Object>> filterorderStatus = new HashSet<>();
  229. HashSet<Map<String,Object>> filteraddressPlace = new HashSet<>();
  230. HashSet<Map<String,Object>> filtermaterialSpe = new HashSet<>();
  231. HashSet<Map<String,Object>> filterSaleRemark = new HashSet<>();
  232. int totalNumber = 0;
  233. for (int j = 0; j < saleSteelReport.size();j++) {
  234. Map<String,Object> stringObjectMap = saleSteelReport.get(j);
  235. stringObjectMap.put("rowKey",j + 1);
  236. if(j == 0) {
  237. stringObjectMap.put("group",j);
  238. }else{
  239. if((saleSteelReport.get(j-1).get("saleOrderMaterialId")).equals(stringObjectMap.get("saleOrderMaterialId"))){
  240. stringObjectMap.put("group",saleSteelReport.get(j-1).get("group"));
  241. }else{
  242. stringObjectMap.put("group",Integer.parseInt(saleSteelReport.get(j-1).get("group").toString()) + 1);
  243. }
  244. }
  245. if( !"取消".equals(stringObjectMap.get("capacityNo")) && !"反审批".equals(stringObjectMap.get("saleOrderStatus")) &&
  246. !"已关闭".equals(stringObjectMap.get("orderStatus"))) {
  247. set.add(stringObjectMap.get("saleOrderMaterialId"));
  248. }
  249. calculateDifferenceTime(stringObjectMap);
  250. //收货客户筛选
  251. Map<String, Object> filterConsigneeMap = new HashMap<>();
  252. filterConsigneeMap.put("text",stringObjectMap.get("consigneeName"));
  253. filterConsigneeMap.put("value",stringObjectMap.get("consigneeName"));
  254. filterConsigneeList.add(filterConsigneeMap);
  255. //承运商筛选
  256. Map<String,Object> filterCarrierMap = new HashMap<>();
  257. filterCarrierMap.put("text",stringObjectMap.get("carrierName"));
  258. filterCarrierMap.put("value",stringObjectMap.get("carrierName"));
  259. filterCarrierList.add(filterCarrierMap);
  260. //车牌号筛选
  261. Map<String,Object> filterCapacityMap = new HashMap<>();
  262. filterCapacityMap.put("text",stringObjectMap.get("newCapacityNo"));
  263. filterCapacityMap.put("value",stringObjectMap.get("newCapacityNo"));
  264. filterCapacityList.add(filterCapacityMap);
  265. //物资筛选
  266. Map<String,Object> filtermaterialNameMap = new HashMap<>();
  267. filtermaterialNameMap.put("text",stringObjectMap.get("materialName"));
  268. filtermaterialNameMap.put("value",stringObjectMap.get("materialName"));
  269. filtermaterialNameList.add(filtermaterialNameMap);
  270. //运单状态筛选
  271. Map<String,Object> filterorderStatusMap = new HashMap<>();
  272. filterorderStatusMap.put("text",stringObjectMap.get("orderStatus"));
  273. filterorderStatusMap.put("value",stringObjectMap.get("orderStatus"));
  274. filterorderStatus.add(filterorderStatusMap);
  275. //收货地址筛选
  276. Map<String,Object> filteraddressPlaceMap = new HashMap<>();
  277. filteraddressPlaceMap.put("text",stringObjectMap.get("addressPlace"));
  278. filteraddressPlaceMap.put("value",stringObjectMap.get("addressPlace"));
  279. filteraddressPlace.add(filteraddressPlaceMap);
  280. //物资规格筛选
  281. Map<String,Object> filtermaterialSpeMap = new HashMap<>();
  282. filtermaterialSpeMap.put("text",stringObjectMap.get("materialSpe"));
  283. filtermaterialSpeMap.put("value",stringObjectMap.get("materialSpe"));
  284. filtermaterialSpe.add(filtermaterialSpeMap);
  285. //摘要筛选
  286. Map<String,Object> filterSaleRemarkMap = new HashMap<>();
  287. filterSaleRemarkMap.put("text",stringObjectMap.get("saleRemark"));
  288. filterSaleRemarkMap.put("value",stringObjectMap.get("saleRemark"));
  289. filterSaleRemark.add(filterSaleRemarkMap);
  290. totalNumber += Integer.parseInt(stringObjectMap.get("materialNum").toString());
  291. String capacityNumbers= (String) stringObjectMap.get("capacityNumbers");
  292. //确认是否有多个收货单位
  293. //if (shippingAddressIds !=null && !("".equals(shippingAddressIds))){
  294. // String[] split = shippingAddressIds.split(",");
  295. // String address="";
  296. // int i=0;
  297. // for (String s : split) {
  298. // i++;
  299. // String getaddress = getaddress(DataChange.dataToBigDecimal(s));
  300. // if (i==1){
  301. // address+="旧地址:"+getaddress+",";
  302. // }else if (i==2){
  303. // address+="新地址:"+getaddress;
  304. // }
  305. // }
  306. // stringObjectMap.put("addressPlace",address);
  307. //}
  308. //确认是否有多个车牌号
  309. if (capacityNumbers!=null &&!("".equals(capacityNumbers))){
  310. String[] split = capacityNumbers.split(",");
  311. String capacityNumber="";
  312. int flag=0;
  313. for (String s : split) {
  314. flag++;
  315. String s1 = getcapacityNumber(DataChange.dataToBigDecimal(s));
  316. if (flag==1){
  317. capacityNumber+="旧车号:"+s1+",";
  318. }else if (flag==2){
  319. capacityNumber+="新车号:"+s1;
  320. break;
  321. }
  322. }
  323. stringObjectMap.put("capacityNo",capacityNumber);
  324. }
  325. }
  326. if(saleSteelReport.size() > 0 && saleSteelReport.get(0) != null){
  327. saleSteelReport.get(0).put("totalCapacity",set.size());
  328. saleSteelReport.get(0).put("totalNumber",totalNumber);
  329. saleSteelReport.get(0).put("filterConsigneeList",filterConsigneeList);
  330. saleSteelReport.get(0).put("filtermaterialNameList",filtermaterialNameList);
  331. saleSteelReport.get(0).put("filterorderStatus",filterorderStatus);
  332. saleSteelReport.get(0).put("filteraddressPlace",filteraddressPlace);
  333. saleSteelReport.get(0).put("filtermaterialSpe",filtermaterialSpe);
  334. saleSteelReport.get(0).put("filterCapacityList",filterCapacityList);
  335. saleSteelReport.get(0).put("filterCarrierList",filterCarrierList);
  336. saleSteelReport.get(0).put("filterSaleRemark",filterSaleRemark);
  337. }
  338. return saleSteelReport;
  339. }
  340. private Set<Map<String, Object>> setListMap(List<Map<String, Object>> list, String name) {
  341. Set<Map<String, Object>> setString = new HashSet<>();
  342. for (Map<String, Object> map : list) {//遍历每条数据
  343. Map<String, Object> map1 = new HashMap<>();
  344. //map.get(name)获取每条数据中对应表头字段的数据
  345. map1.put("text", map.get(name));
  346. if (map.get(name) != null) {
  347. map1.put("value", map.get(name));
  348. setString.add(map1);
  349. }
  350. }
  351. return setString;
  352. }
  353. //public PageListAdd tableColumnData(Integer apiId, List<Map<String, Object>> list, List<Map<String,Object>> data) {
  354. // for (Map<String, Object> columnData : columnDataList) {
  355. // //每个表头字段的过滤条件
  356. // columnData.put("filters", setListMap(data, columnData.get("prop").toString()));
  357. // }
  358. // PageListAdd pageList = new PageListAdd(data);
  359. // pageList.setColumnData(columnDataList);
  360. // return pageList;
  361. //}
  362. @Override
  363. public List<Map<String, Object>> getSaleSteelSpellingReport(Map<String, Object> mapValue) {
  364. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelSpellingReport(mapValue);
  365. return saleSteelReport;
  366. }
  367. @Override
  368. public List<Map<String, Object>> getSaleSteelReportNew(Map<String, Object> mapValue) {
  369. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelReportNew(mapValue);
  370. return saleSteelReport;
  371. }
  372. @Override
  373. public List<Map<String, Object>> getSettledSaleSteelReportNew(Map<String, Object> mapValue) {
  374. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSettledSaleSteelReportNew(mapValue);
  375. return saleSteelReport;
  376. }
  377. @Override
  378. public List<Map<String, Object>> getInwardSaleSteelReport(Map<String, Object> map) {
  379. return statisticalReportMapper.getInwardSaleSteelReport(map);
  380. }
  381. @Override
  382. public List<Map<String, Object>> getInwardSaleSteelOrder(Map<String, Object> map) {
  383. List<Map<String, Object>> results=statisticalReportMapper.getInwardSaleSteelOrder(map);
  384. if(results!=null){
  385. //遍历找到所有已使用的分录
  386. Set<BigDecimal> saleMaterialIds=new HashSet<>();
  387. for(Map<String,Object> temp:results){
  388. if(temp.get("orderId")!=null){
  389. saleMaterialIds.add(DataChange.dataToBigDecimal(temp.get("saleMaterialId")));
  390. }
  391. }
  392. //查询分录已使用但订单id为null的记录
  393. List<Map<String, Object>> disResults=new ArrayList<>();
  394. for(Map<String,Object> temp:results){
  395. if(temp.get("orderId")==null && saleMaterialIds.contains(DataChange.dataToBigDecimal(temp.get("saleMaterialId")))){
  396. disResults.add(temp);
  397. }
  398. }
  399. //删除这些记录,防止重复派单
  400. results.removeAll(disResults);
  401. }
  402. return results;
  403. }
  404. @Override
  405. public Map<String,Object> getSteelReportDetailsBySmId(BigDecimal saleOrderMaterialId) {
  406. //获取主表数据
  407. Map<String,Object> map = statisticalReportMapper.getSteelReportDetailsBySmId(saleOrderMaterialId);
  408. //获取子表数据
  409. List<Map<String,Object>> mapList = statisticalReportMapper.getSteelReportDetailsListBySmId(saleOrderMaterialId);
  410. if (map != null){
  411. if(DataChange.dataToBigDecimal(map.get("orderStatu")).intValue() == 5 && map.get("queueStartTime") != null && DataChange.dataToBigDecimal(map.get("lineSqe")).intValue() == 0){
  412. map.put("orderStatus","排队中");
  413. map.put("orderStatusTime",map.get("queueStartTime"));
  414. }else if(DataChange.dataToBigDecimal(map.get("orderStatu")).intValue() == 5 && DataChange.dataToBigDecimal(map.get("lineSqe")).intValue() != 0 && map.get("outGateTime") == null){
  415. map.put("orderStatus","已进厂");
  416. map.put("orderStatusTime",map.get("entryGateTime"));
  417. }else if(DataChange.dataToBigDecimal(map.get("orderStatu")).intValue() == 5 && map.get("outGateTime") != null){
  418. map.put("orderStatus","已出厂");
  419. map.put("orderStatusTime",map.get("outGateTime"));
  420. }
  421. map.put("mapList",mapList);
  422. }
  423. return map;
  424. }
  425. @Override
  426. public String getaddress(BigDecimal addressid) {
  427. String address = statisticalReportMapper.queryAddress(addressid);
  428. return address;
  429. }
  430. //获取单价
  431. @Override
  432. public BigDecimal getHistoryPrice(BigDecimal priceId) {
  433. BigDecimal bigDecimal = statisticalReportMapper.queryHistoryPrice(priceId);
  434. return bigDecimal;
  435. }
  436. @Override
  437. public String getcapacityNumber(BigDecimal capacitynumber) {
  438. String s = statisticalReportMapper.queryCapacityNumber(capacitynumber);
  439. return s;
  440. }
  441. @Override
  442. public List<Map<String, Object>> loadingSaleSteelReport(Map<String, Object> map) {
  443. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.loadingSaleSteelReport(map);
  444. return saleSteelReport;
  445. }
  446. @Override
  447. public String getStatus(BigDecimal orderId) {
  448. return statisticalReportMapper.getStatus(orderId);
  449. }
  450. @Override
  451. public List<String> getSaleAreaRemark(String saler) {
  452. return statisticalReportMapper.getSaleAreaRemark(saler);
  453. }
  454. @Override
  455. public List<Map<String, Object>> getSaleSteelReportForFinance(Map<String, Object> map) {
  456. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelReportForFinance(map);
  457. return saleSteelReport;
  458. }
  459. @Override
  460. public List<Map<String, Object>> steelTransportReport(Map<String, Object> map) {
  461. List<Map<String, Object>> saleSteelReport = statisticalReportMapper.steelTransportReport(map);
  462. return saleSteelReport;
  463. }
  464. public int testTb() {
  465. //首先查询已经完成的销售钢材有净重的没有saleMaterialId的数据
  466. List<Map<String,Object>> mapList = statisticalReportMapper.getNoSaleterialIdWeight();
  467. for (Map<String,Object> map :mapList) {
  468. BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
  469. BigDecimal weightTaskId = DataChange.dataToBigDecimal(map.get("weightTaskId"));
  470. BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
  471. //根据运输订单号和物资id去查询saleMaterialId的数量,若数量为1则更新,否则记录下来不更新
  472. List<BigDecimal> saleMaterialIds = statisticalReportMapper.getSaleMaterialIds(orderId,materialId);
  473. if(saleMaterialIds.size() > 1) {
  474. System.out.println("该车有问题:" + map.toString());
  475. continue;
  476. }else if(saleMaterialIds.size() ==1 && saleMaterialIds.get(0) != null){
  477. //否则更新计量实绩表
  478. System.out.println("该车正常更新:"+ map.toString());
  479. statisticalReportMapper.updateTw(weightTaskId,DataChange.dataToBigDecimal(saleMaterialIds.get(0)));
  480. }else{
  481. System.out.println("查不到数据"+ map.toString());
  482. }
  483. }
  484. return 0;
  485. }
  486. }