diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java index 534eb39e..3f37731c 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java @@ -151,7 +151,7 @@ public class SysLoginController { } List roleList = roleApi.getRoleList(); List roleNames = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).map(item -> item.getName()).collect(Collectors.toList()); - Boolean flag = (loginBody.getType().equals("0") && roleNames.contains("救援业务管理员")) || (loginBody.getType().equals("1") && roleNames.contains("交警")); + Boolean flag = (loginBody.getType().equals("0") && roleNames.contains("救援业务管理员")) || (loginBody.getType().equals("0") && roleNames.contains("交警大队")); // 角色认证登录 if (!flag) { return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST); 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 0c9490c6..2375ccec 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 @@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.rescue.service.IRescueInfoService; import cn.iocoder.yudao.module.rescue.service.IRescueOrderInfoService; 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.staff.entity.CompanyStaff; import cn.iocoder.yudao.module.staff.service.CompanyStaffService; @@ -41,6 +42,8 @@ import javax.validation.Valid; import java.util.*; import java.util.stream.Collectors; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; + @RestController @RequestMapping("/system/rescueInfo") @@ -90,6 +93,9 @@ public class RescueInfoSystem extends BaseController { public CommonResult update(@RequestBody RescueInfo rescueInfo) { if (ObjectUtil.isNotEmpty(rescueInfo.getSetMoney())){ RescueOrderInfo orderInfo = infoService.getById(rescueInfo.getRescueOrderId()); + if (ObjectUtil.isEmpty(orderInfo)){ + throw exception0(500, "订单未成单"); + } orderInfo.setSetMoney(rescueInfo.getSetMoney()); infoService.updateById(orderInfo); } @@ -443,4 +449,14 @@ public class RescueInfoSystem extends BaseController { rescueDictStaffService.saveOrUpdate(rescueDictStaff); return CommonResult.ok(); } + + /** + * 获取扣车单位和具体数量 + * @author 小李 + * @date 10:46 2024/9/5 + **/ + @GetMapping("/buckle") + public CommonResult listBuckle(){ + return success(rescueInfoService.listBuckle()); + } } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java index b8f833df..552b048c 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/mapper/RescueInfoMapper.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.rescue.domain.DriverInfo; import cn.iocoder.yudao.module.rescue.domain.RescueInfo; 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 com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -62,4 +63,10 @@ public interface RescueInfoMapper extends BaseMapper IPage getRescueInfoByDriver(@Param("map") RescueInfo rescueInfo, Page page); List statisticsInfo(@Param("startTime")String startTime,@Param("endTime")String endTime); + /** + * 获取扣车单位和具体数量 + * @author 小李 + * @date 10:46 2024/9/5 + **/ + List listBuckle(); } 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 323712e5..9900cdb8 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 @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.rescue.domain.DriverInfo; import cn.iocoder.yudao.module.rescue.domain.RescueInfo; 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 com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -102,4 +103,10 @@ public interface IRescueInfoService extends IService List statisticsInfo(String type); + /** + * 获取扣车单位和具体数量 + * @author 小李 + * @date 10:46 2024/9/5 + **/ + List listBuckle(); } 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 e3a3d381..5c95a548 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 @@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.rescue.service.*; import cn.iocoder.yudao.module.rescue.utils.RedisUtil; 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.staff.service.CompanyStaffService; import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO; @@ -381,9 +382,12 @@ public class RescueInfoServiceImpl extends ServiceImpl listBuckle(){ + // 查类型是扣车的订单数据,分组聚合求总数(查询条件是写死的) + List buckleVOS = baseMapper.listBuckle(); + // 因为一些奇奇怪怪的原因,可能会出现没id的情况,那就算在其他里面去 + buckleVOS.forEach(item -> { + if (ObjectUtil.isEmpty(item.getId())){ + item.setId(0); + item.setBuckleName("其他"); + } + }); + return buckleVOS; + } } 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 new file mode 100644 index 00000000..94dd5a15 --- /dev/null +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/vo/BuckleVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.rescue.vo; + +import lombok.Data; + +/** + * 用于获取扣车单位和扣车数量 + * @author 小李 + * @date 10:47 2024/9/5 +**/ +@Data +public class BuckleVO { + + /** 扣车单位的ID(部门ID) */ + private Integer id; + + /** 扣车方名称 */ + private String buckleName; + + /** 扣车数量 */ + private Integer buckleCount; +} diff --git a/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml b/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml index 68a89b8a..6bd67f37 100644 --- a/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml +++ b/dl-module-rescue/src/main/resources/mapper/rescue/RescueInfoMapper.xml @@ -89,6 +89,9 @@ and rescue_time between concat(#{map.rescueStart},' 00:00:00') and concat(#{map.rescueEnd},' 23:59:59') + + and if(#{map.deptId} = 0,ri.dept_id is null, ri.dept_id = #{map.deptId} ) + order by ri.create_time desc @@ -359,4 +362,17 @@ ORDER BY rescueNum desc +