Compare commits

..

No commits in common. "e535d7391818d2b9716d812dc052f221d908aed4" and "09201931a47d08ebd47766a0cd89ccaa490883f7" have entirely different histories.

7 changed files with 12 additions and 181 deletions

View File

@ -20,7 +20,6 @@ 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;
@ -460,27 +459,4 @@ 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,4 +187,5 @@ public class RescueInfo extends TenantBaseDO
@TableField(exist = false)
private List<String> roadIds;
}

View File

@ -8,7 +8,6 @@ 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;
@ -110,21 +109,4 @@ 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,7 +20,6 @@ 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;
@ -106,9 +105,6 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
private RedissonDelayQueue redissonDelayQueue;
@Resource
private IRescueDictStaffService rescueDictStaffService;
@Resource
@Lazy
private IRescueInfoDetailService rescueInfoDetailService;
/**
@ -453,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);
@ -964,9 +960,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
return resList;
}
/**
* 有问题
*/
/** 有问题 */
@Deprecated
public List<MoneyManagement> moneyManagement(RescueInfo rescueInfo) {
List<MoneyManagement> resList = new ArrayList<>();
@ -980,10 +974,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()) {
@ -1046,7 +1040,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
moneyManagement.setGrossWages(grossWages);
resList.add(moneyManagement);
}
pageNo++;
pageNo ++;
}
return resList;
}
@ -1071,110 +1065,20 @@ 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(0L);
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(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,23 +11,11 @@ import lombok.Data;
public class BuckleVO {
/** 扣车单位的ID(部门ID) */
private Long id;
private Integer id;
/** 扣车方名称 */
private String buckleName;
/** 扣车数量(所有,没入库的也记录,只要是扣车单子) */
/** 扣车数量 */
private Integer buckleCount;
/** 扣车中 */
private Integer deductionCount;
/** 已解扣 */
private Integer unDeductionCount;
/** 已还车 */
private Integer returnCount;
/** 待入库 */
private Integer noLibraryCount;
}

View File

@ -1,20 +0,0 @@
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' AND deleted = '0'
WHERE rescue_type = '5'
GROUP BY dept_id) t1
LEFT JOIN system_dept sd ON t1.dept_id = sd.id
ORDER BY sd.id desc