救援APP

This commit is contained in:
xiao-fajia 2024-08-23 11:58:09 +08:00
parent 0e7638df23
commit ba59d6cf6b
12 changed files with 245 additions and 200 deletions

View File

@ -11,6 +11,8 @@ import cn.iocoder.yudao.module.rescue.utils.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -38,11 +40,11 @@ public class SysAnnouncementController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('announcement:announcement:list')") @PreAuthorize("@ss.hasPermi('announcement:announcement:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysAnnouncement sysAnnouncement) public CommonResult list(SysAnnouncement sysAnnouncement)
{ {
startPage(); Page<SysAnnouncement> page = new Page<>(1, 10);
List<SysAnnouncement> list = sysAnnouncementService.selectSysAnnouncementList(sysAnnouncement); IPage<SysAnnouncement> list = sysAnnouncementService.selectSysAnnouncementList(sysAnnouncement, page);
return getDataTable(list); return success(list);
} }
/** /**
@ -52,7 +54,7 @@ public class SysAnnouncementController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysAnnouncement sysAnnouncement) public void export(HttpServletResponse response, SysAnnouncement sysAnnouncement)
{ {
List<SysAnnouncement> list = sysAnnouncementService.selectSysAnnouncementList(sysAnnouncement); List<SysAnnouncement> list = sysAnnouncementService.list();
ExcelUtil<SysAnnouncement> util = new ExcelUtil<SysAnnouncement>(SysAnnouncement.class); ExcelUtil<SysAnnouncement> util = new ExcelUtil<SysAnnouncement>(SysAnnouncement.class);
util.exportExcel(response, list, "系统通知数据"); util.exportExcel(response, list, "系统通知数据");
} }
@ -101,15 +103,15 @@ public class SysAnnouncementController extends BaseController
* 查询系统通知列表 * 查询系统通知列表
*/ */
@GetMapping("/getOwnMsg") @GetMapping("/getOwnMsg")
public TableDataInfo getOwnMsg() public CommonResult getOwnMsg()
{ {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
SysAnnouncement sysAnnouncement =new SysAnnouncement(); SysAnnouncement sysAnnouncement =new SysAnnouncement();
sysAnnouncement.setToUserId(loginUser.getId()); sysAnnouncement.setToUserId(loginUser.getId());
startPage(); Page<SysAnnouncement> page = new Page<>(1, 10);
List<SysAnnouncement> list = sysAnnouncementService.selectSysAnnouncementList(sysAnnouncement); IPage<SysAnnouncement> list = sysAnnouncementService.selectSysAnnouncementList(sysAnnouncement, page);
return getDataTable(list); return success(list);
} }
/** /**
* 查询未读条数 * 查询未读条数

View File

@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.appBase.mapper;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement; import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -30,7 +33,7 @@ public interface SysAnnouncementMapper extends BaseMapper<SysAnnouncement>
* @param sysAnnouncement 系统通知 * @param sysAnnouncement 系统通知
* @return 系统通知集合 * @return 系统通知集合
*/ */
public List<SysAnnouncement> selectSysAnnouncementList(SysAnnouncement sysAnnouncement); IPage<SysAnnouncement> selectSysAnnouncementList(@Param("map") SysAnnouncement sysAnnouncement, Page<SysAnnouncement> page);
/** /**

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.appBase.service; package cn.iocoder.yudao.module.appBase.service;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement; import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
@ -27,7 +29,7 @@ public interface ISysAnnouncementService extends IService<SysAnnouncement>
* @param sysAnnouncement 系统通知 * @param sysAnnouncement 系统通知
* @return 系统通知集合 * @return 系统通知集合
*/ */
public List<SysAnnouncement> selectSysAnnouncementList(SysAnnouncement sysAnnouncement); IPage<SysAnnouncement> selectSysAnnouncementList(SysAnnouncement sysAnnouncement, Page<SysAnnouncement> page);
/** /**
* 新增系统通知 * 新增系统通知

View File

@ -10,6 +10,8 @@ import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
import cn.iocoder.yudao.module.rescue.app.controller.admin.AnnouncementSocket; import cn.iocoder.yudao.module.rescue.app.controller.admin.AnnouncementSocket;
import cn.iocoder.yudao.module.rescue.app.controller.admin.UserAnnouncementSocket; import cn.iocoder.yudao.module.rescue.app.controller.admin.UserAnnouncementSocket;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -50,9 +52,9 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
* @return 系统通知 * @return 系统通知
*/ */
@Override @Override
public List<SysAnnouncement> selectSysAnnouncementList(SysAnnouncement sysAnnouncement) public IPage<SysAnnouncement> selectSysAnnouncementList(SysAnnouncement sysAnnouncement, Page<SysAnnouncement> page)
{ {
return baseMapper.selectSysAnnouncementList(sysAnnouncement); return baseMapper.selectSysAnnouncementList(sysAnnouncement, page);
} }
/** /**

View File

@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController; import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo; 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.service.IRescueInfoService; import cn.iocoder.yudao.module.rescue.service.IRescueInfoService;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi;
@ -162,23 +164,23 @@ public class RescueInfoController extends BaseController {
// List<DriverInfo2Dto> list = rescueInfoService.driverListApp(driverInfoDto); // List<DriverInfo2Dto> list = rescueInfoService.driverListApp(driverInfoDto);
// return getDataTable(list); // return getDataTable(list);
// } // }
// /** /**
// * 查询请填写功能名称列表 * 查询请填写功能名称列表
// */ */
// @GetMapping("/driverInMap") @GetMapping("/driverInMap")
// public AjaxResult driverInMap(DriverInfoDto driverInfoDto) public CommonResult driverInMap(DriverInfoDto driverInfoDto)
// { {
// List<DriverInfo2Dto> driverList = rescueInfoService.driverInMap(driverInfoDto); List<DriverInfo2Dto> driverList = rescueInfoService.driverInMap(driverInfoDto);
// return success(driverList); return success(driverList);
// } }
// /** /**
// * 查询请填写功能名称列表 * 查询请填写功能名称列表
// */ */
// @GetMapping("/driverInMap2") @GetMapping("/driverInMap2")
// public AjaxResult driverInMap2() public CommonResult driverInMap2()
// { {
// return success(rescueInfoService.driverInMap2()); return success(rescueInfoService.driverInMap2());
// } }
// /** // /**
// * 获取扣车订单 // * 获取扣车订单
// */ // */
@ -242,12 +244,12 @@ public class RescueInfoController extends BaseController {
// List<RescueInfo> rescueInfos = rescueInfoService.getHcList(rescueInfo); // List<RescueInfo> rescueInfos = rescueInfoService.getHcList(rescueInfo);
// return getDataTable(rescueInfos); // return getDataTable(rescueInfos);
// } // }
// /** /**
// * 获取扣车订单 * 获取扣车订单
// */ */
// @GetMapping("/statisticsInfo") @GetMapping("/statisticsInfo")
// public AjaxResult statisticsInfo(String type) public CommonResult statisticsInfo(String type)
// { {
// return success( rescueInfoService.statisticsInfo(type)); return success( rescueInfoService.statisticsInfo(type));
// } }
} }

View File

@ -315,13 +315,15 @@ public class RescueInfoSystem extends BaseController {
* moneyManagement * moneyManagement
*/ */
@GetMapping("/moneyManagement") @GetMapping("/moneyManagement")
public TableDataInfo moneyManagement(RescueInfo rescueInfo) { public CommonResult moneyManagement(RescueInfo rescueInfo,
startPage(); @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
List<RescueInfo> rescueInfos = rescueInfoService.getRescueInfoByDriver(rescueInfo); @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
TableDataInfo dataTable = getDataTable(rescueInfos); Page<RescueInfo> page = new Page<>(pageNo, pageSize);
List<MoneyManagement> list = rescueInfoService.moneyManagement2(rescueInfos, rescueInfo.getRescueStart()); IPage<RescueInfo> rescueInfos = rescueInfoService.getRescueInfoByDriver(rescueInfo, page);
TableDataInfo dataTable = getDataTable(rescueInfos.getRecords());
List<MoneyManagement> list = rescueInfoService.moneyManagement2(rescueInfos.getRecords(), rescueInfo.getRescueStart());
dataTable.setRows(list); dataTable.setRows(list);
return dataTable; return success(dataTable);
} }
/** /**
@ -333,7 +335,7 @@ public class RescueInfoSystem extends BaseController {
return CommonResult.success(res); return CommonResult.success(res);
} }
@PostMapping("/exportManagement") @GetMapping("/exportManagement")
public void exportManagement(HttpServletResponse response, RescueInfo rescueInfo) { public void exportManagement(HttpServletResponse response, RescueInfo rescueInfo) {
List<MoneyManagement> list = rescueInfoService.moneyManagement(rescueInfo); List<MoneyManagement> list = rescueInfoService.moneyManagement(rescueInfo);
JSONObject jsonObject = rescueInfoService.listData(rescueInfo); JSONObject jsonObject = rescueInfoService.listData(rescueInfo);

View File

@ -59,7 +59,7 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
void deleteOtherInfo2(@Param("rescueId") Long rescueId); void deleteOtherInfo2(@Param("rescueId") Long rescueId);
JSONObject getDriverCarNum(@Param("driverId") Long driverId,@Param("carNum") String carNum,@Param("time") String time); JSONObject getDriverCarNum(@Param("driverId") Long driverId,@Param("carNum") String carNum,@Param("time") String time);
List<RescueInfo> getRescueInfoByDriver(RescueInfo rescueInfo); IPage<RescueInfo> getRescueInfoByDriver(@Param("map") RescueInfo rescueInfo, Page<RescueInfo> page);
List<JSONObject> statisticsInfo(@Param("startTime")String startTime,@Param("endTime")String endTime); List<JSONObject> statisticsInfo(@Param("startTime")String startTime,@Param("endTime")String endTime);
} }

View File

@ -98,7 +98,7 @@ public interface IRescueInfoService extends IService<RescueInfo>
void trajectoryJs(Long rescueId) throws Exception; void trajectoryJs(Long rescueId) throws Exception;
List<MoneyManagement> moneyManagement(RescueInfo rescueInfo); List<MoneyManagement> moneyManagement(RescueInfo rescueInfo);
List<MoneyManagement> moneyManagement2(List<RescueInfo> rescueInfos,String rescueStart); List<MoneyManagement> moneyManagement2(List<RescueInfo> rescueInfos,String rescueStart);
List<RescueInfo> getRescueInfoByDriver(RescueInfo rescueInfo); IPage<RescueInfo> getRescueInfoByDriver(RescueInfo rescueInfo, Page<RescueInfo> page);
List<JSONObject> statisticsInfo(String type); List<JSONObject> statisticsInfo(String type);

View File

@ -2,13 +2,19 @@ package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement; import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService; import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
import cn.iocoder.yudao.module.rescue.domain.*; import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto; import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto; import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.rescue.mapper.RescueInfoMapper; import cn.iocoder.yudao.module.rescue.mapper.RescueInfoMapper;
import cn.iocoder.yudao.module.rescue.service.*;
import cn.iocoder.yudao.module.rescue.utils.RedisUtil;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService; import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO; import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.DeptApi;
@ -19,21 +25,15 @@ import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.rescue.service.*;
import cn.iocoder.yudao.module.rescue.utils.RedisUtil;
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -67,7 +67,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
private IRescueDriverInfoService rescueDriverInfoService; private IRescueDriverInfoService rescueDriverInfoService;
@Resource @Resource
@Lazy @Lazy
private RedisUtil redisCache; private RedisUtil redisCache2;
@Resource @Resource
private IRescueCarInfoService carInfoService; private IRescueCarInfoService carInfoService;
@Resource @Resource
@ -129,8 +129,8 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
//获取当前司机的经纬度 //获取当前司机的经纬度
if (ObjectUtils.isNotEmpty(info.getDriverId())) { if (ObjectUtils.isNotEmpty(info.getDriverId())) {
String driverKey = Redis_Driver_Key + info.getDeptId() + ":" + info.getDriverId(); String driverKey = Redis_Driver_Key + info.getDeptId() + ":" + info.getDriverId();
if (redisCache.hasKey(driverKey)) { if (redisCache2.hasKey(driverKey)) {
JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache.getCacheMap(driverKey))); JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache2.getCacheMap(driverKey)));
Double longitude = driverInfo.getDouble("longitude"); Double longitude = driverInfo.getDouble("longitude");
//纬度 //纬度
Double latitude = driverInfo.getDouble("latitude"); Double latitude = driverInfo.getDouble("latitude");
@ -219,34 +219,31 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
LoginUser user = getLoginUser(); LoginUser user = getLoginUser();
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoList(rescueInfo, page); IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoList(rescueInfo, page);
// for (RescueInfo info : rescueInfos) { for (RescueInfo info : rescueInfos.getRecords()) {
// String dljy_type = dictDataService.getDictDataLabel("dljy_type", info.getRescueType()); String dljy_type = dictDataService.getDictDataLabel("dljy_type", info.getRescueType());
// info.setRescueTypeStr(dljy_type); info.setRescueTypeStr(dljy_type);
// String rescueStatus = dictDataService.getDictDataLabel("jy_status", info.getRescueStatus()); String rescueStatus = dictDataService.getDictDataLabel("jy_status", info.getRescueStatus());
// info.setRescueStatusStr(rescueStatus); info.setRescueStatusStr(rescueStatus);
// //获取当前司机的经纬度 //获取当前司机的经纬度
// if (ObjectUtils.isNotEmpty(info.getDriverId())) { if (ObjectUtils.isNotEmpty(info.getDriverId())) {
// //所在顶级机构 //所在顶级机构
//
// String driverKey = Redis_Driver_Key + user.getTenantId() + ":" + info.getDriverId(); String driverKey = Redis_Driver_Key + user.getTenantId() + ":" + info.getDriverId();
// if (redisCache.hasKey(driverKey)) { if (redisCache2.hasKey(driverKey)) {
// try { try {
// JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache.getCacheMap(driverKey))); JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache2.getCacheMap(driverKey)));
// Double longitude = driverInfo.getDouble("longitude"); Double longitude = driverInfo.getDouble("longitude");
// //纬度 //纬度
// Double latitude = driverInfo.getDouble("latitude"); Double latitude = driverInfo.getDouble("latitude");
// Long distanceMeter = getDistanceMeter(Double.parseDouble(info.getRescueLongitude()), Double.parseDouble(info.getRescueLatitude()), longitude, latitude); Long distanceMeter = getDistanceMeter(Double.parseDouble(info.getRescueLongitude()), Double.parseDouble(info.getRescueLatitude()), longitude, latitude);
// info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue()); info.setDistance(Double.valueOf(distanceMeter * 1.3d).longValue());
// info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5); info.setNeedTime(5 + (distanceMeter / 1000) * 2 + 5);
// } catch (Exception ignored) { } catch (Exception ignored) {
//
// } }
// }
// } }
// } }
//
//
// }
return rescueInfos; return rescueInfos;
} }
@ -585,8 +582,8 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
//获取司机所在经纬度 //获取司机所在经纬度
for (DriverInfo2Dto dto : dtos) { for (DriverInfo2Dto dto : dtos) {
String redisKey2 = Redis_Driver_Key + loginUser.getTenantId() + ":" + dto.getId(); String redisKey2 = Redis_Driver_Key + loginUser.getTenantId() + ":" + dto.getId();
if (redisCache.hasKey(redisKey2)) { if (redisCache2.hasKey(redisKey2)) {
Map<String, Object> cacheMap = redisCache.getCacheMap(redisKey2); Map<String, Object> cacheMap = redisCache2.getCacheMap(redisKey2);
dto.setDriverLatitude(cacheMap.get("latitude").toString()); dto.setDriverLatitude(cacheMap.get("latitude").toString());
dto.setDriverLongitude(cacheMap.get("longitude").toString()); dto.setDriverLongitude(cacheMap.get("longitude").toString());
dto.setDriverPositionInfo(cacheMap.get("positionInfo").toString()); dto.setDriverPositionInfo(cacheMap.get("positionInfo").toString());
@ -602,16 +599,16 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Override @Override
public List<DriverInfo2Dto> driverInMap(DriverInfoDto driverInfoDto) { public List<DriverInfo2Dto> driverInMap(DriverInfoDto driverInfoDto) {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
List<DriverInfo2Dto> dtos = baseMapper.driverListApp(driverInfoDto); List<DriverInfo2Dto> dtos = baseMapper.driverListApp(driverInfoDto);
//处理其余信息 //处理其余信息
//获取司机所在经纬度 //获取司机所在经纬度
int i = 1; int i = 1;
for (DriverInfo2Dto dto : dtos) { for (DriverInfo2Dto dto : dtos) {
String redisKey2 = Redis_Driver_Key + loginUser.getTenantId() + ":" + dto.getId(); String redisKey2 = Redis_Driver_Key + loginUser.getTenantId() + ":" + dto.getId();
if (redisCache.hasKey(redisKey2)) { if (redisCache2.hasKey(redisKey2)) {
try { try {
Map<String, Object> cacheMap = redisCache.getCacheMap(redisKey2); Map<String, Object> cacheMap = redisCache2.getCacheMap(redisKey2);
dto.setDriverLatitude(cacheMap.get("latitude").toString()); dto.setDriverLatitude(cacheMap.get("latitude").toString());
dto.setDriverLongitude(cacheMap.get("longitude").toString()); dto.setDriverLongitude(cacheMap.get("longitude").toString());
dto.setDriverPositionInfo(cacheMap.get("positionInfo").toString()); dto.setDriverPositionInfo(cacheMap.get("positionInfo").toString());
@ -697,7 +694,7 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
public void appointDriver(Long deptId, Long rescueId, String longitude, String latitude) { public void appointDriver(Long deptId, Long rescueId, String longitude, String latitude) {
// //
String redisKey = Redis_Driver_Position_Key + deptId; String redisKey = Redis_Driver_Position_Key + deptId;
Map<String, Object> cacheMap = redisCache.getCacheMap(redisKey); Map<String, Object> cacheMap = redisCache2.getCacheMap(redisKey);
List<Object> cacheList = new ArrayList<>(); List<Object> cacheList = new ArrayList<>();
cacheMap.forEach((key, value) -> cacheList.add(value)); cacheMap.forEach((key, value) -> cacheList.add(value));
if (!CollectionUtil.isEmpty(cacheList)) { if (!CollectionUtil.isEmpty(cacheList)) {
@ -715,10 +712,10 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
driverList = driverList.stream().filter(it -> { driverList = driverList.stream().filter(it -> {
boolean flag = true; boolean flag = true;
String driverKey = Redis_Driver_Key + deptId + ":" + it.getString("driverId"); String driverKey = Redis_Driver_Key + deptId + ":" + it.getString("driverId");
if (!redisCache.hasKey(driverKey)) { if (!redisCache2.hasKey(driverKey)) {
return false; return false;
} }
JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache.getCacheMap(driverKey))); JSONObject driverInfo = (JSONObject) JSONObject.parse(JSONObject.toJSONString(redisCache2.getCacheMap(driverKey)));
//判断司机是否在线且空闲 //判断司机是否在线且空闲
flag = driverInfo.getInteger("status") == 1; flag = driverInfo.getInteger("status") == 1;
if (finalRejectDriverIds.contains(Long.parseLong(it.getString("driverId")))) { if (finalRejectDriverIds.contains(Long.parseLong(it.getString("driverId")))) {
@ -831,8 +828,9 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
announcementService.insertSysAnnouncements(sysAnnouncement); announcementService.insertSysAnnouncements(sysAnnouncement);
} }
public List<RescueInfo> getRescueInfoByDriver(RescueInfo rescueInfo) { @Override
return baseMapper.getRescueInfoByDriver(rescueInfo); public IPage<RescueInfo> getRescueInfoByDriver(RescueInfo rescueInfo, Page<RescueInfo> page) {
return baseMapper.getRescueInfoByDriver(rescueInfo, page);
} }
public List<MoneyManagement> moneyManagement2(List<RescueInfo> rescueInfos, String rescueStart) { public List<MoneyManagement> moneyManagement2(List<RescueInfo> rescueInfos, String rescueStart) {
@ -912,86 +910,87 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
} }
public List<MoneyManagement> moneyManagement(RescueInfo rescueInfo) { public List<MoneyManagement> moneyManagement(RescueInfo rescueInfo) {
List<RescueInfo> rescueInfos = baseMapper.getRescueInfoByDriver(rescueInfo); // List<RescueInfo> rescueInfos = baseMapper.getRescueInfoByDriver(rescueInfo);
List<MoneyManagement> resList = new ArrayList<>(); // List<MoneyManagement> resList = new ArrayList<>();
Double rescueTcBig = 0d; // Double rescueTcBig = 0d;
Double rescueTcMid = 0d; // Double rescueTcMid = 0d;
Double rescueTcSmall = 0d; // Double rescueTcSmall = 0d;
RescueConfig rescueConfig = rescueConfigService.selectRescueConfigByDeptId(); // RescueConfig rescueConfig = rescueConfigService.selectRescueConfigByDeptId();
if (ObjectUtils.isNotEmpty(rescueConfig)) { // if (ObjectUtils.isNotEmpty(rescueConfig)) {
rescueTcBig = Optional.ofNullable(rescueConfig.getRescueTcBig()).orElse(0d); // rescueTcBig = Optional.ofNullable(rescueConfig.getRescueTcBig()).orElse(0d);
rescueTcMid = Optional.ofNullable(rescueConfig.getRescueTcMid()).orElse(0d); // rescueTcMid = Optional.ofNullable(rescueConfig.getRescueTcMid()).orElse(0d);
rescueTcSmall = Optional.ofNullable(rescueConfig.getRescueTcSmall()).orElse(0d); // rescueTcSmall = Optional.ofNullable(rescueConfig.getRescueTcSmall()).orElse(0d);
} // }
for (RescueInfo info : rescueInfos) { // for (RescueInfo info : rescueInfos) {
MoneyManagement moneyManagement = new MoneyManagement(); // MoneyManagement moneyManagement = new MoneyManagement();
moneyManagement.setDriverName(info.getDriverName()); // moneyManagement.setDriverName(info.getDriverName());
Double grossWages = 0d; // Double grossWages = 0d;
Double tempSetMoney = ObjectUtils.isNotEmpty(info.getSetMoney()) ? Double.valueOf(info.getSetMoney()) / 100d : 0d; // Double tempSetMoney = ObjectUtils.isNotEmpty(info.getSetMoney()) ? Double.valueOf(info.getSetMoney()) / 100d : 0d;
Double tempCheckpointMoney = ObjectUtils.isNotEmpty(info.getCheckpointMoney()) ? info.getCheckpointMoney() : 0d; // Double tempCheckpointMoney = ObjectUtils.isNotEmpty(info.getCheckpointMoney()) ? info.getCheckpointMoney() : 0d;
JSONObject monthRescueRefuelRecord = new JSONObject(); // JSONObject monthRescueRefuelRecord = new JSONObject();
monthRescueRefuelRecord.put("refuelMoney", 0); // monthRescueRefuelRecord.put("refuelMoney", 0);
monthRescueRefuelRecord.put("refuelNum", 0); // monthRescueRefuelRecord.put("refuelNum", 0);
monthRescueRefuelRecord.put("refuelDistance", 0); // monthRescueRefuelRecord.put("refuelDistance", 0);
try { // try {
LambdaQueryWrapper<RescueCarInfo> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<RescueCarInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueCarInfo::getRescueCarNum, info.getDriverCarNum()).last("limit 1"); // queryWrapper.eq(RescueCarInfo::getRescueCarNum, info.getDriverCarNum()).last("limit 1");
RescueCarInfo carInfo = carInfoService.getOne(queryWrapper); // RescueCarInfo carInfo = carInfoService.getOne(queryWrapper);
monthRescueRefuelRecord = refuelRecordService.getMonthRescueRefuelRecord(info.getDriverId(), DateUtil.format(info.getRescueTime(), "yyyy-MM"), carInfo.getId()); // monthRescueRefuelRecord = refuelRecordService.getMonthRescueRefuelRecord(info.getDriverId(), DateUtil.format(info.getRescueTime(), "yyyy-MM"), carInfo.getId());
} catch (Exception ignored) { // } catch (Exception ignored) {
} // }
moneyManagement.setLicenseNum(info.getLicenseNum()); // moneyManagement.setLicenseNum(info.getLicenseNum());
moneyManagement.setFeeType(info.getFeeType()); // moneyManagement.setFeeType(info.getFeeType());
moneyManagement.setRescueTime(info.getRescueTime()); // moneyManagement.setRescueTime(info.getRescueTime());
moneyManagement.setDiverCarNum(info.getDriverCarNum()); // moneyManagement.setDiverCarNum(info.getDriverCarNum());
moneyManagement.setSetMoney(tempSetMoney); // moneyManagement.setSetMoney(tempSetMoney);
moneyManagement.setCheckpointMoney(info.getCheckpointMoney()); // moneyManagement.setCheckpointMoney(info.getCheckpointMoney());
moneyManagement.setUpMoney(tempSetMoney - tempCheckpointMoney); // moneyManagement.setUpMoney(tempSetMoney - tempCheckpointMoney);
moneyManagement.setEmptyingDistance(info.getEmptyNum()); // moneyManagement.setEmptyingDistance(info.getEmptyNum());
String carType = "3"; // String carType = "3";
if (StringUtils.isNotEmpty(info.getDriverCarNum())) { // if (StringUtils.isNotEmpty(info.getDriverCarNum())) {
RescueCarInfo carInfo = carInfoService.selectRescueCarInfoByNum(info.getDriverCarNum()); // RescueCarInfo carInfo = carInfoService.selectRescueCarInfoByNum(info.getDriverCarNum());
carType = carInfo.getRescueCarType(); // carType = carInfo.getRescueCarType();
} // }
if (carType.equals("1")) { // if (carType.equals("1")) {
//大车 // //大车
moneyManagement.setRoyaltyRatio(rescueTcBig); // moneyManagement.setRoyaltyRatio(rescueTcBig);
moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcBig); // moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcBig);
} else if (carType.equals("2")) { // } else if (carType.equals("2")) {
//中车 // //中车
moneyManagement.setRoyaltyRatio(rescueTcMid); // moneyManagement.setRoyaltyRatio(rescueTcMid);
moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcMid); // moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcMid);
} else { // } else {
//小车 // //小车
moneyManagement.setRoyaltyRatio(rescueTcSmall); // moneyManagement.setRoyaltyRatio(rescueTcSmall);
moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcSmall); // moneyManagement.setRoyaltyMoney(tempSetMoney * rescueTcSmall);
} // }
//获取当前车 当前驾驶员 这个月跑了几次 // //获取当前车 当前驾驶员 这个月跑了几次
JSONObject driverInfoObj = baseMapper.getDriverCarNum(info.getDriverId(), info.getDriverCarNum(), rescueInfo.getRescueStart()); // JSONObject driverInfoObj = baseMapper.getDriverCarNum(info.getDriverId(), info.getDriverCarNum(), rescueInfo.getRescueStart());
//计算平均燃油费和平均油耗 // //计算平均燃油费和平均油耗
Double avgFuelConsumption = 0d; // Double avgFuelConsumption = 0d;
Double mglYh = 0d; // Double mglYh = 0d;
if (driverInfoObj.getInteger("allNum") != 0) { // if (driverInfoObj.getInteger("allNum") != 0) {
avgFuelConsumption = monthRescueRefuelRecord.getDouble("refuelMoney") / driverInfoObj.getInteger("allNum"); // avgFuelConsumption = monthRescueRefuelRecord.getDouble("refuelMoney") / driverInfoObj.getInteger("allNum");
mglYh = monthRescueRefuelRecord.getDouble("refuelNum") / driverInfoObj.getDouble("allDistance"); // mglYh = monthRescueRefuelRecord.getDouble("refuelNum") / driverInfoObj.getDouble("allDistance");
} // }
moneyManagement.setFuelCost(avgFuelConsumption); // moneyManagement.setFuelCost(avgFuelConsumption);
moneyManagement.setOilConsumption(mglYh); // moneyManagement.setOilConsumption(mglYh);
Double oilSubsidy = Optional.ofNullable(info.getEmptyNum()).orElse(0d) * mglYh; // Double oilSubsidy = Optional.ofNullable(info.getEmptyNum()).orElse(0d) * mglYh;
moneyManagement.setOilSubsidy(oilSubsidy); // moneyManagement.setOilSubsidy(oilSubsidy);
grossWages = grossWages + moneyManagement.getRoyaltyMoney() + oilSubsidy - avgFuelConsumption; // grossWages = grossWages + moneyManagement.getRoyaltyMoney() + oilSubsidy - avgFuelConsumption;
moneyManagement.setGrossWages(grossWages); // moneyManagement.setGrossWages(grossWages);
resList.add(moneyManagement); // resList.add(moneyManagement);
} // }
//
return resList; // return resList;
return null;
} }
@Override @Override
public List<JSONObject> statisticsInfo(String type) { public List<JSONObject> statisticsInfo(String type) {
//所在顶级机构 //所在顶级机构
String startTime; String startTime;
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd") + " 24:00:00"; String endTime = DateUtil.format(new Date(), "yyyy-MM-dd") + " 00:00:00";
if (type.equals("day")) { if (type.equals("day")) {
// //
startTime = DateUtil.format(new Date(), "yyyy-MM-dd") + " 00:00:00"; startTime = DateUtil.format(new Date(), "yyyy-MM-dd") + " 00:00:00";

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.appBase.mapper.SysAnnouncementMapper">
<select id="selectSysAnnouncementList" resultType="cn.iocoder.yudao.module.appBase.domain.SysAnnouncement">
select * from sys_announcement
<where>
<if test="map.type != null and type != ''"> and type = #{map.type}</if>
<if test="map.title != null and title != ''"> and title = #{map.title}</if>
<if test="map.content != null and content != ''"> and content = #{map.content}</if>
<if test="map.toUserId != null "> and to_user_id = #{map.toUserId}</if>
<if test="map.deptId != null "> and dept_id = #{map.deptId}</if>
</where>
order by create_time desc
</select>
<select id="selectSysAnnouncementById" parameterType="Long" resultType="cn.iocoder.yudao.module.appBase.domain.SysAnnouncement">
select * from sys_announcement
where id = #{id}
</select>
<delete id="deleteSysAnnouncementById" parameterType="Long">
delete from sys_announcement where id = #{id}
</delete>
<delete id="deleteSysAnnouncementByIds" parameterType="String">
delete from sys_announcement where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -113,7 +113,6 @@
and ri.driver_id is not null and ri.driver_id is not null
</if> </if>
<if test="rescueStart != null ">and rescue_time like concat(#{rescueStart},'%')</if> <if test="rescueStart != null ">and rescue_time like concat(#{rescueStart},'%')</if>
${params.dataScope}
</where> </where>
</select> </select>
@ -222,15 +221,15 @@
<select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto"> <select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT SELECT
di.*,su.real_name,rci.rescue_car_num di.*,su.nickname as real_name,rci.rescue_car_num
FROM FROM
driver_info di driver_info di
INNER JOIN sys_user su ON di.user_id = su.user_id AND su.del_flag = '0' INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = '0'
left join sys_dept sd on sd.dept_id = di.dept_id left join system_dept sd on sd.id = di.dept_id
inner join rescue_car_info rci on rci.possessor_id = di.id inner join rescue_car_info rci on rci.possessor_id = di.id
WHERE di.auth_status='2' WHERE di.auth_status='2'
<if test="searchValue!=null and searchValue!=''"> <if test="searchValue!=null and searchValue!=''">
and (su.real_name like concat('%',#{searchValue},'%') or di.phonenumber like concat('%',#{searchValue},'%') and (su.nickname like concat('%',#{searchValue},'%') or di.phonenumber like concat('%',#{searchValue},'%')
or rci.rescue_car_num like concat('%',#{searchValue},'%')) or rci.rescue_car_num like concat('%',#{searchValue},'%'))
</if> </if>
order by di.create_time desc order by di.create_time desc
@ -241,9 +240,9 @@
IFNULL(sum(di.driver_status = '3'), 0) as mlNum, IFNULL(sum(di.driver_status = '3'), 0) as mlNum,
IFNULL(sum(di.driver_status = '4'), 0) as lxNum IFNULL(sum(di.driver_status = '4'), 0) as lxNum
FROM driver_info di FROM driver_info di
INNER JOIN sys_user su ON di.user_id = su.user_id INNER JOIN system_users su ON di.user_id = su.id
AND su.del_flag = '0' AND su.deleted = '0'
LEFT JOIN sys_dept sd ON sd.dept_id = di.dept_id LEFT JOIN system_dept sd ON sd.id = di.dept_id
INNER JOIN rescue_car_info rci ON rci.possessor_id = di.id INNER JOIN rescue_car_info rci ON rci.possessor_id = di.id
WHERE di.auth_status = '2' WHERE di.auth_status = '2'
</select> </select>
@ -321,44 +320,42 @@
left join rescue_order_info roi on roi.rescue_info_id = ri.id left join rescue_order_info roi on roi.rescue_info_id = ri.id
where where
driver_id is not null driver_id is not null
<if test="rescueStart != null and rescueEnd != null">and rescue_time between concat(#{rescueStart},' 00:00:00') <if test="map.rescueStart != null and map.rescueEnd != null">and rescue_time between concat(#{map.rescueStart},' 00:00:00')
and concat(#{rescueEnd},' 23:59:59') and concat(#{map.rescueEnd},' 23:59:59')
</if> </if>
<if test="licenseNum != null "> <if test="map.licenseNum != null ">
and ri.license_num like concat('%',#{licenseNum},'%') and ri.license_num like concat('%',#{map.licenseNum},'%')
</if> </if>
<if test="feeType != null "> <if test="map.feeType != null ">
and ri.fee_type = #{feeType} and ri.fee_type = #{map.feeType}
</if> </if>
<if test="flag != null "> <if test="map.flag != null ">
and ri.driver_id is not null and ri.driver_id is not null
</if> </if>
<if test="rescueStart != null and rescueEnd != null">and rescue_time between concat(#{rescueStart},' 00:00:00') <if test="map.rescueStart != null and map.rescueEnd != null">and rescue_time between concat(#{map.rescueStart},' 00:00:00')
and concat(#{rescueEnd},' 23:59:59') and concat(#{map.rescueEnd},' 23:59:59')
</if> </if>
<if test="driverName != null "> <if test="map.driverName != null ">
and ri.driver_name like concat('%',#{driverName},'%') and ri.driver_name like concat('%',#{map.driverName},'%')
</if> </if>
<if test="driverCarNum != null "> <if test="map.driverCarNum != null ">
and ri.driver_car_num like concat('%',#{driverCarNum},'%') and ri.driver_car_num like concat('%',#{map.driverCarNum},'%')
</if> </if>
<if test="rescueStartMonth != null"> <if test="map.rescueStartMonth != null">
and rescue_time like concat(#{rescueStartMonth},'%') and rescue_time like concat(#{map.rescueStartMonth},'%')
</if> </if>
${params.dataScope}
order by ri.driver_name desc order by ri.driver_name desc
</select> </select>
<select id="statisticsInfo" resultType="com.alibaba.fastjson.JSONObject"> <select id="statisticsInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT IFNULL(sum(roi.set_money), 0) / 100 as money, SELECT IFNULL(sum(roi.set_money), 0) / 100 as money,
count(ri.id) as rescueNum, count(ri.id) as rescueNum,
su.real_name as driverName su.nickname as driverName
FROM driver_info di FROM driver_info di
LEFT JOIN rescue_info ri on ri.driver_id = di.id and ri.rescue_time <![CDATA[>=]]> #{startTime} and LEFT JOIN rescue_info ri on ri.driver_id = di.id and ri.rescue_time <![CDATA[>=]]> #{startTime} and
ri.rescue_time <![CDATA[<=]]> #{endTime} ri.rescue_time <![CDATA[<=]]> #{endTime}
LEFT JOIN rescue_order_info roi on ri.id = roi.rescue_info_id LEFT JOIN rescue_order_info roi on ri.id = roi.rescue_info_id
INNER JOIN sys_user su on di.user_id = su.user_id INNER JOIN system_users su on di.user_id = su.id
GROUP BY di.id GROUP BY di.id
ORDER BY rescueNum desc ORDER BY rescueNum desc
</select> </select>

View File

@ -68,16 +68,15 @@
rescue_refuel_record rrr rescue_refuel_record rrr
left join rescue_car_info rci on rci.id = rrr.car_id left join rescue_car_info rci on rci.id = rrr.car_id
left join driver_info di on di.id = rrr.driver_id left join driver_info di on di.id = rrr.driver_id
left join sys_user su on di.user_id = su.user_id left join system_users su on di.user_id = su.id
<where> <where>
<if test="driverName != null "> <if test="driverName != null ">
and su.real_name like concat('%',#{driverName},'%') and su.nickname like concat('%',#{driverName},'%')
</if> </if>
<if test="driverCarNum != null "> <if test="driverCarNum != null ">
and rci.rescue_car_num like concat('%',#{driverCarNum},'%') and rci.rescue_car_num like concat('%',#{driverCarNum},'%')
</if> </if>
<if test="rescueStart">and rrr.record_time like concat(#{rescueStart},'%')</if> <if test="rescueStart">and rrr.record_time like concat(#{rescueStart},'%')</if>
${params.dataScope}
</where> </where>
</select> </select>