Compare commits

..

3 Commits

Author SHA1 Message Date
xiao-fajia
e535d73918 扣车管理3 2024-09-06 15:21:28 +08:00
xiao-fajia
ca17aa68bb Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system 2024-09-06 11:33:46 +08:00
xiao-fajia
dc529f7d90 扣车管理2 2024-09-06 11:31:23 +08:00
7 changed files with 181 additions and 12 deletions

View File

@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.rescue.utils.ExcelUtil;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
@ -459,4 +460,27 @@ public class RescueInfoSystem extends BaseController {
public CommonResult listBuckle(){
return success(rescueInfoService.listBuckle());
}
/**
* 查看单个扣车单位信息
* @author 小李
* @date 11:44 2024/9/6
* @param id 部门ID
**/
@GetMapping("/buckle/{id}")
public CommonResult getBuckle(@PathVariable("id") Long id){
return success(rescueInfoService.getBuckle(id));
}
/**
* 还车方法
* @author 小李
* @date 14:48 2024/9/6
* @param returnCarVO 订单信息
**/
@PostMapping("/returnCar")
public CommonResult returnCar(@RequestBody ReturnCarVO returnCarVO){
rescueInfoService.returnCar(returnCarVO);
return CommonResult.ok();
}
}

View File

@ -187,5 +187,4 @@ public class RescueInfo extends TenantBaseDO
@TableField(exist = false)
private List<String> roadIds;
}

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -109,4 +110,21 @@ public interface IRescueInfoService extends IService<RescueInfo>
* @date 10:46 2024/9/5
**/
List<BuckleVO> listBuckle();
/**
* 查看单个扣车单位信息
* @author 小李
* @date 11:44 2024/9/6
* @param id 部门ID
**/
BuckleVO getBuckle(Long id);
/**
* 还车方法
* @author 小李
* @date 14:48 2024/9/6
* @param returnCarVO 订单信息
**/
void returnCar(ReturnCarVO returnCarVO);
}

View File

@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
@ -105,6 +106,9 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
private RedissonDelayQueue redissonDelayQueue;
@Resource
private IRescueDictStaffService rescueDictStaffService;
@Resource
@Lazy
private IRescueInfoDetailService rescueInfoDetailService;
/**
@ -449,7 +453,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 +964,9 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return resList;
}
/** 有问题 */
/**
* 有问题
*/
@Deprecated
public List<MoneyManagement> moneyManagement(RescueInfo rescueInfo) {
List<MoneyManagement> resList = new ArrayList<>();
@ -974,10 +980,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 +1046,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
moneyManagement.setGrossWages(grossWages);
resList.add(moneyManagement);
}
pageNo ++;
pageNo++;
}
return resList;
}
@ -1065,20 +1071,110 @@ 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())){
item.setId(0);
if (ObjectUtil.isEmpty(item.getId())) {
item.setId(0L);
item.setBuckleName("其他");
}
});
/*
计算各自的扣车中(9)已解扣(6)已还车(8)待入库的数量
deductionCount:扣车中(9)
unDeductionCount:已解扣(6)
returnCount:已还车(8)
noLibraryCount:待入库不是前三个就是待入库
*/
buckleVOS.forEach(item -> {
List<RescueInfo> rescueInfos = null;
if (item.getId().equals(0L)) {
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;
}
/**
* 查看单个扣车单位信息
* @author 小李
* @date 11:44 2024/9/6
* @param id 部门ID
**/
@Override
public BuckleVO getBuckle(Long id){
// 直接用上方写好的去查
List<BuckleVO> buckleVOS = listBuckle();
List<BuckleVO> result = buckleVOS.stream().filter(item -> item.getId().equals(id)).collect(Collectors.toList());
if (CollectionUtil.isEmpty(result)){
throw exception0(500, "系统异常");
}
return result.get(0);
}
/**
* 还车方法
* @author 小李
* @date 14:48 2024/9/6
* @param returnCarVO 订单信息
**/
@Override
@DSTransactional
public void returnCar(ReturnCarVO returnCarVO){
// 更新插入一条工单记录因为还车也要拍照什么的
RescueInfoDetail detail = new RescueInfoDetail();
detail.setRescueInfoId(returnCarVO.getId());
// type不知道是什么暂时先不要
// detail.setType()
detail.setTitle("还车");
detail.setRemark(returnCarVO.getRemark());
detail.setImages(returnCarVO.getImages());
Long deptId = getLoginUserDeptId();
detail.setDeptId(deptId);
rescueInfoDetailService.save(detail);
// 更新工单状态为已还车(8)
RescueInfo rescueInfo = new RescueInfo();
rescueInfo.setId(returnCarVO.getId());
rescueInfo.setRescueStatus("8");
baseMapper.updateById(rescueInfo);
}
}

View File

@ -11,11 +11,23 @@ import lombok.Data;
public class BuckleVO {
/** 扣车单位的ID(部门ID) */
private Integer id;
private Long id;
/** 扣车方名称 */
private String buckleName;
/** 扣车数量 */
/** 扣车数量(所有,没入库的也记录,只要是扣车单子) */
private Integer buckleCount;
/** 扣车中 */
private Integer deductionCount;
/** 已解扣 */
private Integer unDeductionCount;
/** 已还车 */
private Integer returnCount;
/** 待入库 */
private Integer noLibraryCount;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.rescue.vo;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
/**
* 还车用的VO
* @author 小李
* @date 15:03 2024/9/6
**/
@Data
public class ReturnCarVO extends RescueInfo {
/** 备注 */
private String remark;
/** 文件Urls */
private String images;
}

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