扣车管理2

This commit is contained in:
xiao-fajia 2024-09-06 11:31:23 +08:00
parent 220a27fd9d
commit dc529f7d90
3 changed files with 68 additions and 9 deletions

View File

@ -449,7 +449,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
rescueInfo.setRescueStatus(null);
}
// 取消订单时删除定时任务
if (null!=rescueInfo && StringUtils.isNotEmpty(rescueInfo.getRescueStatus()) && rescueInfo.getRescueStatus().equals("0")) {
if (null != rescueInfo && StringUtils.isNotEmpty(rescueInfo.getRescueStatus()) && rescueInfo.getRescueStatus().equals("0")) {
redissonDelayQueue.removeAllTasks(rescueInfo.getId());
}
return baseMapper.updateById(rescueInfo);
@ -960,7 +960,9 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return resList;
}
/** 有问题 */
/**
* 有问题
*/
@Deprecated
public List<MoneyManagement> moneyManagement(RescueInfo rescueInfo) {
List<MoneyManagement> resList = new ArrayList<>();
@ -974,10 +976,10 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
rescueTcSmall = Optional.ofNullable(rescueConfig.getRescueTcSmall()).orElse(0d);
}
Integer pageNo = 1;
while (true){
while (true) {
Page<RescueInfo> page = new Page<>(pageNo, 500);
IPage<RescueInfo> rescueInfos = baseMapper.getRescueInfoByDriver(rescueInfo, page);
if (ObjectUtil.isEmpty(rescueInfos) && rescueInfos.getRecords().isEmpty()){
if (ObjectUtil.isEmpty(rescueInfos) && rescueInfos.getRecords().isEmpty()) {
break;
}
for (RescueInfo info : rescueInfos.getRecords()) {
@ -1040,7 +1042,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
moneyManagement.setGrossWages(grossWages);
resList.add(moneyManagement);
}
pageNo ++;
pageNo++;
}
return resList;
}
@ -1065,20 +1067,65 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
/**
* 获取扣车单位和具体数量
*
* @author 小李
* @date 10:46 2024/9/5
**/
@Override
public List<BuckleVO> listBuckle(){
public List<BuckleVO> listBuckle() {
// 查类型是扣车的订单数据分组聚合求总数(查询条件是写死的)
List<BuckleVO> buckleVOS = baseMapper.listBuckle();
// 因为一些奇奇怪怪的原因可能会出现没id的情况那就算在其他里面去
buckleVOS.forEach(item -> {
if (ObjectUtil.isEmpty(item.getId())){
if (ObjectUtil.isEmpty(item.getId())) {
item.setId(0);
item.setBuckleName("其他");
}
});
/*
计算各自的扣车中(9)已解扣(6)已还车(8)待入库的数量
deductionCount:扣车中(9)
unDeductionCount:已解扣(6)
returnCount:已还车(8)
noLibraryCount:待入库不是前三个就是待入库
*/
buckleVOS.forEach(item -> {
List<RescueInfo> rescueInfos = null;
if (item.getId().equals(0)) {
rescueInfos = baseMapper.selectList(new LambdaQueryWrapper<RescueInfo>().and(i -> {
i.eq(RescueInfo::getRescueType, "5")
.isNull(RescueInfo::getDeptId);
}));
} else {
rescueInfos = baseMapper.selectList(new LambdaQueryWrapper<RescueInfo>().and(i -> {
i.eq(RescueInfo::getRescueType, "5")
.eq(RescueInfo::getDeptId, item.getId());
}));
}
int deductionCount = 0, unDeductionCount = 0, returnCount = 0, noLibraryCount = 0;
if (ObjectUtil.isNotEmpty(rescueInfos)) {
for (RescueInfo rescueInfo : rescueInfos) {
switch (rescueInfo.getRescueStatus()) {
case "9":
deductionCount++;
break;
case "6":
unDeductionCount++;
break;
case "8":
returnCount++;
break;
default:
noLibraryCount++;
break;
}
}
}
item.setDeductionCount(deductionCount);
item.setUnDeductionCount(unDeductionCount);
item.setReturnCount(returnCount);
item.setNoLibraryCount(noLibraryCount);
});
return buckleVOS;
}
}

View File

@ -16,6 +16,18 @@ public class BuckleVO {
/** 扣车方名称 */
private String buckleName;
/** 扣车数量 */
/** 扣车数量(所有,没入库的也记录,只要是扣车单子) */
private Integer buckleCount;
/** 扣车中 */
private Integer deductionCount;
/** 已解扣 */
private Integer unDeductionCount;
/** 已还车 */
private Integer returnCount;
/** 待入库 */
private Integer noLibraryCount;
}

View File

@ -370,7 +370,7 @@
(SELECT dept_id,
count(*) AS buckle_count
FROM rescue_info
WHERE rescue_type = '5'
WHERE rescue_type = '5' AND deleted = '0'
GROUP BY dept_id) t1
LEFT JOIN system_dept sd ON t1.dept_id = sd.id
ORDER BY sd.id desc