From e535d7391818d2b9716d812dc052f221d908aed4 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Fri, 6 Sep 2024 15:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A3=E8=BD=A6=E7=AE=A1=E7=90=863?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/RescueInfoSystem.java | 24 +++++++++ .../module/rescue/domain/RescueInfo.java | 1 - .../rescue/service/IRescueInfoService.java | 18 +++++++ .../service/impl/RescueInfoServiceImpl.java | 53 ++++++++++++++++++- .../yudao/module/rescue/vo/BuckleVO.java | 2 +- .../yudao/module/rescue/vo/ReturnCarVO.java | 20 +++++++ 6 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/ReturnCarVO.java diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java index 2375ccec..627a5be7 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java @@ -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(); + } } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java index ff3d97f3..7d0ccdba 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java @@ -187,5 +187,4 @@ public class RescueInfo extends TenantBaseDO @TableField(exist = false) private List roadIds; - } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java index 9900cdb8..0edc86d4 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/IRescueInfoService.java @@ -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 * @date 10:46 2024/9/5 **/ List 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); + } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java index c5001a8c..8a78b7ba 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/RescueInfoServiceImpl.java @@ -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 { if (ObjectUtil.isEmpty(item.getId())) { - item.setId(0); + item.setId(0L); item.setBuckleName("其他"); } }); @@ -1091,7 +1095,7 @@ public class RescueInfoServiceImpl extends ServiceImpl { List rescueInfos = null; - if (item.getId().equals(0)) { + if (item.getId().equals(0L)) { rescueInfos = baseMapper.selectList(new LambdaQueryWrapper().and(i -> { i.eq(RescueInfo::getRescueType, "5") .isNull(RescueInfo::getDeptId); @@ -1128,4 +1132,49 @@ public class RescueInfoServiceImpl extends ServiceImpl buckleVOS = listBuckle(); + List 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); + } } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/BuckleVO.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/BuckleVO.java index 2437b0d7..a92f3cf8 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/BuckleVO.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/BuckleVO.java @@ -11,7 +11,7 @@ import lombok.Data; public class BuckleVO { /** 扣车单位的ID(部门ID) */ - private Integer id; + private Long id; /** 扣车方名称 */ private String buckleName; diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/ReturnCarVO.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/ReturnCarVO.java new file mode 100644 index 00000000..8ece334f --- /dev/null +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/ReturnCarVO.java @@ -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; +}