首页2
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package com.ruoyi.index.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.index.mapper.BillStatusCountMapper;
|
||||
import com.ruoyi.index.domain.BillStatusCount;
|
||||
import com.ruoyi.index.service.IBillStatusCountService;
|
||||
|
||||
/**
|
||||
* 单据状态统计Service实现
|
||||
*/
|
||||
@Service
|
||||
public class BillStatusCountServiceImpl implements IBillStatusCountService {
|
||||
@Autowired
|
||||
private BillStatusCountMapper billStatusCountMapper;
|
||||
|
||||
/**
|
||||
* 查询所有类型单据的状态统计
|
||||
*
|
||||
* @return 单据状态统计列表
|
||||
*/
|
||||
@Override
|
||||
public List<BillStatusCount> selectAllBillStatusCount() {
|
||||
List<BillStatusCount> resultList = new ArrayList<>();
|
||||
|
||||
// 查询入库单据状态统计
|
||||
List<BillStatusCount> stockinList = billStatusCountMapper.selectStockinStatusCount();
|
||||
if (stockinList != null) {
|
||||
resultList.addAll(stockinList);
|
||||
}
|
||||
|
||||
// 查询出库单据状态统计
|
||||
List<BillStatusCount> stockoutList = billStatusCountMapper.selectStockoutStatusCount();
|
||||
if (stockoutList != null) {
|
||||
resultList.addAll(stockoutList);
|
||||
}
|
||||
|
||||
// 查询盘点单据状态统计
|
||||
List<BillStatusCount> stockcheckList = billStatusCountMapper.selectStockcheckStatusCount();
|
||||
if (stockcheckList != null) {
|
||||
resultList.addAll(stockcheckList);
|
||||
}
|
||||
|
||||
// 按照status降序排序(3、2、1)
|
||||
resultList.sort((a, b) -> b.getStatus().compareTo(a.getStatus()));
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.index.service.impl;
|
||||
|
||||
import com.ruoyi.index.domain.CargoSpaceCount;
|
||||
import com.ruoyi.index.mapper.CargoSpaceCountMapper;
|
||||
import com.ruoyi.index.service.ICargoSpaceCountService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 货位状态统计Service实现
|
||||
*/
|
||||
@Service
|
||||
public class CargoSpaceCountServiceImpl implements ICargoSpaceCountService {
|
||||
@Autowired
|
||||
private CargoSpaceCountMapper cargoSpaceCountMapper;
|
||||
|
||||
/**
|
||||
* 查询各状态货位数量
|
||||
*
|
||||
* @return 货位状态统计对象
|
||||
*/
|
||||
@Override
|
||||
public CargoSpaceCount selectStatusCount() {
|
||||
// 查询各状态货位数量
|
||||
List<Map<String, Object>> statusCounts = cargoSpaceCountMapper.selectStatusCount();
|
||||
|
||||
// 初始化结果数组,默认所有状态数量为0
|
||||
List<Integer> counts = new ArrayList<>();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
counts.add(0);
|
||||
}
|
||||
|
||||
// 填充实际统计数量
|
||||
for (Map<String, Object> count : statusCounts) {
|
||||
int status = Integer.parseInt(count.get("status").toString());
|
||||
long countValue = Long.parseLong(count.get("count").toString());
|
||||
counts.set(status - 1, (int)countValue);
|
||||
}
|
||||
|
||||
// 封装结果
|
||||
CargoSpaceCount result = new CargoSpaceCount();
|
||||
result.setStatusCounts(counts);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.index.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.index.mapper.IndexCountMapper;
|
||||
import com.ruoyi.index.domain.IndexCount;
|
||||
import com.ruoyi.index.service.IIndexCountService;
|
||||
|
||||
/**
|
||||
* 首页统计信息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
@Service
|
||||
public class IndexCountServiceImpl implements IIndexCountService
|
||||
{
|
||||
@Autowired
|
||||
private IndexCountMapper indexCountMapper;
|
||||
|
||||
/**
|
||||
* 查询已完成单据数量统计
|
||||
*
|
||||
* @return 统计结果
|
||||
*/
|
||||
@Override
|
||||
public IndexCount selectFinishCount()
|
||||
{
|
||||
IndexCount indexCount = new IndexCount();
|
||||
indexCount.setStockinCount(indexCountMapper.selectStockinFinishCount());
|
||||
indexCount.setStockoutCount(indexCountMapper.selectStockoutFinishCount());
|
||||
indexCount.setStockcheckCount(indexCountMapper.selectStockcheckFinishCount());
|
||||
return indexCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ruoyi.index.service.impl;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.index.domain.WeekJobCount;
|
||||
import com.ruoyi.index.mapper.WeekJobCountMapper;
|
||||
import com.ruoyi.index.service.IWeekJobCountService;
|
||||
|
||||
/**
|
||||
* 每周作业数量统计Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-05
|
||||
*/
|
||||
@Service
|
||||
public class WeekJobCountServiceImpl implements IWeekJobCountService
|
||||
{
|
||||
@Autowired
|
||||
private WeekJobCountMapper weekJobCountMapper;
|
||||
|
||||
/**
|
||||
* 获取近一周的入库和出库作业数量统计
|
||||
*
|
||||
* @return 近一周的入库和出库作业数量统计
|
||||
*/
|
||||
@Override
|
||||
public WeekJobCount getWeekJobCount()
|
||||
{
|
||||
// 获取当前日期
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
// 获取本周一的日期
|
||||
LocalDate monday = now.with(DayOfWeek.MONDAY);
|
||||
|
||||
// 获取本周日的日期
|
||||
LocalDate sunday = now.with(DayOfWeek.SUNDAY);
|
||||
|
||||
// 格式化日期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String startDate = monday.format(formatter);
|
||||
String endDate = sunday.format(formatter);
|
||||
|
||||
// 初始化一周的数组,默认值为0
|
||||
List<Integer> inJobCounts = Arrays.asList(0, 0, 0, 0, 0, 0, 0);
|
||||
List<Integer> outJobCounts = Arrays.asList(0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
// 查询近一周的入库和出库作业数量
|
||||
List<Integer> queryInCounts = weekJobCountMapper.selectInJobCounts(startDate, endDate);
|
||||
List<Integer> queryOutCounts = weekJobCountMapper.selectOutJobCounts(startDate, endDate);
|
||||
|
||||
// 如果查询结果不为空,更新对应日期的数量
|
||||
if (queryInCounts != null && !queryInCounts.isEmpty()) {
|
||||
inJobCounts = new ArrayList<>(inJobCounts);
|
||||
for (int i = 0; i < queryInCounts.size(); i++) {
|
||||
inJobCounts.set(i, queryInCounts.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (queryOutCounts != null && !queryOutCounts.isEmpty()) {
|
||||
outJobCounts = new ArrayList<>(outJobCounts);
|
||||
for (int i = 0; i < queryOutCounts.size(); i++) {
|
||||
outJobCounts.set(i, queryOutCounts.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// 封装结果
|
||||
WeekJobCount weekJobCount = new WeekJobCount();
|
||||
weekJobCount.setInJobCounts(inJobCounts);
|
||||
weekJobCount.setOutJobCounts(outJobCounts);
|
||||
|
||||
return weekJobCount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user