Compare commits
3 Commits
09201931a4
...
e535d73918
Author | SHA1 | Date | |
---|---|---|---|
|
e535d73918 | ||
|
ca17aa68bb | ||
|
dc529f7d90 |
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -187,5 +187,4 @@ public class RescueInfo extends TenantBaseDO
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> roadIds;
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
@ -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<>();
|
||||
@ -1065,6 +1071,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
|
||||
/**
|
||||
* 获取扣车单位和具体数量
|
||||
*
|
||||
* @author 小李
|
||||
* @date 10:46 2024/9/5
|
||||
**/
|
||||
@ -1075,10 +1082,99 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
// 因为一些奇奇怪怪的原因,可能会出现没id的情况,那就算在其他里面去
|
||||
buckleVOS.forEach(item -> {
|
||||
if (ObjectUtil.isEmpty(item.getId())) {
|
||||
item.setId(0);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user