123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- package com.steerinfo.dil.service.impl;
- import com.steerinfo.dil.mapper.StatisticalReportMapper;
- import com.steerinfo.dil.service.IStatisticalReportService;
- import com.steerinfo.dil.util.DataChange;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.web.bind.annotation.RequestBody;
- import java.math.BigDecimal;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @ author :TXF
- * @ time :2021/12/14 15:26
- */
- @Service
- public class StatisticalReportImpl implements IStatisticalReportService {
- @Autowired
- StatisticalReportMapper statisticalReportMapper;
- /**
- * 计算相差时间
- * @return
- */
- public void calculateDifferenceTime(Map<String, Object> mesMap){
- Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
- Object resultOutGateTime = mesMap.get("resultOutGateTime");
- if(resultEntryGateTime != null && resultOutGateTime != null){
- Date enterDate = (Date) resultEntryGateTime;
- Date outDate = (Date) resultOutGateTime;
- //计算相差时间
- long dTime = outDate.getTime() - enterDate.getTime();
- mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
- }
- if(resultEntryGateTime != null && resultOutGateTime == null){
- //如果没有出厂时间则以当前时间减去进厂时间
- Date enterDate = (Date) resultEntryGateTime;
- long dTime = new Date().getTime() - enterDate.getTime();
- mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
- }
- }
- /**
- * 查询采购统计报表
- * @Author TXF
- * @Date 2022/1/6 9:52
- * @param map
- * @return
- **/
- public List<Map<String, Object>> getRLFLReport(Map<String, Object> map){
- List<Map<String, Object>> mapList = null;
- if(DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 5){
- mapList = statisticalReportMapper.getFuPurchaseFLRLReport(map);
- }else {
- mapList = statisticalReportMapper.getAllPurchaseFLRLReport(map);
- }
- return mapList;
- }
- @Override
- public List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map) {
- return statisticalReportMapper.getAllPurchaseFLRLReport(map);
- }
- /**
- * 查询销售统计报表
- * @param map
- * @return
- */
- @Override
- public List<Map<String, Object>> getAllSaleReport(Map<String, Object> map) {
- List<Map<String, Object>> mapList = statisticalReportMapper.getAllSaleReport(map);
- for (Map<String, Object> mesMap : mapList) {
- calculateDifferenceTime(mesMap);
- }
- return mapList;
- }
- @Override
- public List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map) {
- return statisticalReportMapper.getAllSaleReport(map);
- }
- /**
- * 查询零星物资进厂统计报表
- */
- @Override
- public List<Map<String, Object>> getSporadicSuppliesReportNum1(Map<String, Object> mapValue) {
- return statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
- }
- @Override
- public List<Map<String, Object>> getSporadicSuppliesReport1(Map<String, Object> mapValue) {
- List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
- for (Map<String, Object> mesMap : mapList) {
- calculateDifferenceTime(mesMap);
- }
- return mapList;
- }
- /**
- * 查询零星物资出厂统计报表
- */
- @Override
- public List<Map<String, Object>> getSporadicSuppliesReportNum2(Map<String, Object> mapValue) {
- return statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
- }
- @Override
- public List<Map<String, Object>> getSporadicSuppliesReport2(Map<String, Object> mapValue) {
- List<Map<String, Object>> mapList = statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
- for (Map<String, Object> mesMap : mapList) {
- calculateDifferenceTime(mesMap);
- }
- return mapList;
- }
- //采购内转统计报表
- @Override
- public List<Map<String, Object>> getPurInwardReport( Map<String, Object> mapValue) {
- List<Map<String, Object>> inwardReportResult = statisticalReportMapper.getInwardReportResult(mapValue);
- for (Map<String,Object>inwardReport:inwardReportResult
- ) {
- BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
- BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
- BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
- //第二次净重减第一次净重
- inwardReport.put("newTract",netTract);
- calculateDifferenceTime(inwardReport);
- }
- return inwardReportResult;
- }
- //采购内转统计报表
- @Override
- public List<Map<String, Object>> getLXInwardReport( Map<String, Object> mapValue) {
- List<Map<String, Object>> lxReportResult = statisticalReportMapper.getLXReportResult(mapValue);
- for (Map<String,Object>inwardReport:lxReportResult
- ) {
- BigDecimal netWeightSecond = DataChange.dataToBigDecimal(inwardReport.get("netWeightSecond"));
- BigDecimal netWeightFirst = DataChange.dataToBigDecimal(inwardReport.get("netWeightFirst"));
- BigDecimal netTract = netWeightSecond.subtract(netWeightFirst).divide(new BigDecimal(1), 2, 4);
- //第二次净重减第一次净重
- inwardReport.put("newTract",netTract);
- calculateDifferenceTime(inwardReport);
- }
- return lxReportResult;
- }
- @Override
- public List<Map<String, Object>> getInwardReport(Map<String, Object> mapValue) {
- return statisticalReportMapper.getInwardReport(mapValue);
- }
- @Override
- public List<Map<String, Object>> getLoading(Map<String, Object> mapValue) {
- return statisticalReportMapper.getLoading(mapValue);
- }
- @Override
- public List<Map<String, Object>> getUnLoading(Map<String, Object> mapValue) {
- return statisticalReportMapper.getUnLoading(mapValue);
- }
- }
|