救援菜单配置

This commit is contained in:
xiao-fajia 2024-08-19 14:29:27 +08:00
parent c2e7638196
commit 2b0327792b
5 changed files with 101 additions and 98 deletions

View File

@ -1,7 +1,8 @@
package cn.iocoder.yudao.module.rescue.controller.system; package cn.iocoder.yudao.module.rescue.controller.admin;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
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.core.page.TableDataInfo; import cn.iocoder.yudao.module.rescue.core.page.TableDataInfo;
import cn.iocoder.yudao.module.rescue.domain.DriverInfo; import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
@ -25,6 +26,7 @@ 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.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,23 +38,23 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/system/rescueInfo") @RequestMapping("/system/rescueInfo")
public class RescueInfoSystem extends BaseController { public class RescueInfoSystem extends BaseController {
@Autowired @Resource
private IRescueInfoService rescueInfoService; private IRescueInfoService rescueInfoService;
@Autowired @Resource
private DictDataApi dictDataApi; private DictDataApi dictDataApi;
@Autowired @Resource
private IRescueOrderInfoService infoService; private IRescueOrderInfoService infoService;
@Autowired
@Resource
private IRescueInfoDetailService rescueInfoDetailService; private IRescueInfoDetailService rescueInfoDetailService;
/** /**
* 新增道路救援发起 * 新增道路救援发起
*/ */
@PostMapping("/add") @PostMapping("/add")
public CommonResult add(@RequestBody @Valid RescueInfo rescueInfo) public CommonResult add(@RequestBody @Valid RescueInfo rescueInfo) {
{
rescueInfoService.insertRescueInfo(rescueInfo); rescueInfoService.insertRescueInfo(rescueInfo);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -62,22 +64,21 @@ public class RescueInfoSystem extends BaseController {
*/ */
@PostMapping("/update") @PostMapping("/update")
public CommonResult update(@RequestBody RescueInfo rescueInfo) public CommonResult update(@RequestBody RescueInfo rescueInfo) {
{
RescueOrderInfo orderInfo = infoService.getById(rescueInfo.getRescueOrderId()); RescueOrderInfo orderInfo = infoService.getById(rescueInfo.getRescueOrderId());
orderInfo.setSetMoney(rescueInfo.getSetMoney()); orderInfo.setSetMoney(rescueInfo.getSetMoney());
infoService.updateById(orderInfo); infoService.updateById(orderInfo);
rescueInfoService.updateById(rescueInfo); rescueInfoService.updateById(rescueInfo);
return CommonResult.ok(); return CommonResult.ok();
} }
/** /**
* 取消道路救援 * 取消道路救援
*/ */
@PostMapping("/cancel") @PostMapping("/cancel")
public CommonResult cancel(Long id) public CommonResult cancel(Long id) {
{ RescueInfo rescueInfo = new RescueInfo();
RescueInfo rescueInfo =new RescueInfo();
rescueInfo.setId(id); rescueInfo.setId(id);
rescueInfo.setRescueStatus("0"); rescueInfo.setRescueStatus("0");
return CommonResult.success(rescueInfoService.updateRescueInfo(rescueInfo)); return CommonResult.success(rescueInfoService.updateRescueInfo(rescueInfo));
@ -89,34 +90,32 @@ public class RescueInfoSystem extends BaseController {
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RescueInfo rescueInfo, public TableDataInfo list(RescueInfo rescueInfo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
{
startPage(); startPage();
List<RescueInfo> rescueInfos = rescueInfoService.selectRescueListSystem(rescueInfo); List<RescueInfo> rescueInfos = rescueInfoService.selectRescueListSystem(rescueInfo);
TableDataInfo dataTable = getDataTable(rescueInfos); TableDataInfo dataTable = getDataTable(rescueInfos);
return dataTable; return dataTable;
} }
/** /**
* 查询请填写功能名称列表 * 查询请填写功能名称列表
*/ */
@GetMapping("/list2") @GetMapping("/list2")
public TableDataInfo list2(RescueInfo rescueInfo) public TableDataInfo list2(RescueInfo rescueInfo) {
{
startPage(); startPage();
List<RescueInfo> list = rescueInfoService.selectRescueListSystem2(rescueInfo); List<RescueInfo> list = rescueInfoService.selectRescueListSystem2(rescueInfo);
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/watchImg") @GetMapping("/watchImg")
public CommonResult watchImg(@RequestParam("rescueId") Long rescueId) public CommonResult watchImg(@RequestParam("rescueId") Long rescueId) {
{ List<String> resList = new ArrayList<>();
List<String> resList =new ArrayList<>(); RescueInfoDetail rescueInfoDetail = new RescueInfoDetail();
RescueInfoDetail rescueInfoDetail =new RescueInfoDetail();
rescueInfoDetail.setRescueInfoId(rescueId); rescueInfoDetail.setRescueInfoId(rescueId);
List<RescueInfoDetail> details = rescueInfoDetailService.selectRescueInfoDetailList(rescueInfoDetail); List<RescueInfoDetail> details = rescueInfoDetailService.selectRescueInfoDetailList(rescueInfoDetail);
if (CollectionUtil.isNotEmpty(details)){ if (CollectionUtil.isNotEmpty(details)) {
List<String> images = details.stream().filter(it->{ List<String> images = details.stream().filter(it -> {
return StringUtils.isNotEmpty(it.getImages()); return StringUtils.isNotEmpty(it.getImages());
}).map(RescueInfoDetail::getImages).collect(Collectors.toList()); }).map(RescueInfoDetail::getImages).collect(Collectors.toList());
for (String image : images) { for (String image : images) {
@ -134,20 +133,20 @@ public class RescueInfoSystem extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:info:export')") @PreAuthorize("@ss.hasPermi('system:info:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, RescueInfo rescueInfo) public void export(HttpServletResponse response, RescueInfo rescueInfo) {
{
List<RescueInfo> list = rescueInfoService.selectRescueListSystem2(rescueInfo); List<RescueInfo> list = rescueInfoService.selectRescueListSystem2(rescueInfo);
for (RescueInfo info : list) { for (RescueInfo info : list) {
info.setSetMoneyYuan(Double.valueOf(Optional.ofNullable(info.getSetMoney()).orElse(0L))/100); info.setSetMoneyYuan(Double.valueOf(Optional.ofNullable(info.getSetMoney()).orElse(0L)) / 100);
info.setPayMoneyYuan(Double.valueOf(Optional.ofNullable(info.getPayMoney()).orElse(0L))/100); info.setPayMoneyYuan(Double.valueOf(Optional.ofNullable(info.getPayMoney()).orElse(0L)) / 100);
} }
ExcelUtil<RescueInfo> util = new ExcelUtil<RescueInfo>(RescueInfo.class); ExcelUtil<RescueInfo> util = new ExcelUtil<RescueInfo>(RescueInfo.class);
util.exportExcel(response, list, "救援订单数据"); util.exportExcel(response, list, "救援订单数据");
} }
//指派司机 //指派司机
@PostMapping("/designateDriver") @PostMapping("/designateDriver")
public CommonResult designateDriver(Long rescueId,Long driverId) throws Exception { public CommonResult designateDriver(Long rescueId, Long driverId) throws Exception {
rescueInfoService.designateDriver(rescueId,driverId); rescueInfoService.designateDriver(rescueId, driverId);
return CommonResult.success("指派成功"); return CommonResult.success("指派成功");
} }
@ -155,64 +154,62 @@ public class RescueInfoSystem extends BaseController {
* 查询请填写功能名称列表 * 查询请填写功能名称列表
*/ */
@GetMapping("/driverList") @GetMapping("/driverList")
public TableDataInfo driverList(DriverInfoDto driverInfoDto) public TableDataInfo driverList(DriverInfoDto driverInfoDto) {
{
startPage(); startPage();
List<DriverInfo> list = rescueInfoService.driverList(driverInfoDto); List<DriverInfo> list = rescueInfoService.driverList(driverInfoDto);
return getDataTable(list); return getDataTable(list);
} }
@GetMapping("/getDriverById") @GetMapping("/getDriverById")
public CommonResult getDriverById(Long driverId) public CommonResult getDriverById(Long driverId) {
{
return CommonResult.success(rescueInfoService.getDriverById(driverId)); return CommonResult.success(rescueInfoService.getDriverById(driverId));
} }
/** /**
* 新增信息司机 * 新增信息司机
*/ */
@PostMapping("/addDriver") @PostMapping("/addDriver")
public CommonResult addDriver(@RequestBody DriverInfo driverInfo) public CommonResult addDriver(@RequestBody DriverInfo driverInfo) {
{
try { try {
rescueInfoService.addDriver(driverInfo); rescueInfoService.addDriver(driverInfo);
}catch (Exception e){ } catch (Exception e) {
return CommonResult.error(500,e.getMessage()); return CommonResult.error(500, e.getMessage());
} }
return CommonResult.success("新增成功"); return CommonResult.success("新增成功");
} }
/** /**
* 修改信息司机 * 修改信息司机
*/ */
@PostMapping("/updateDriver") @PostMapping("/updateDriver")
public CommonResult updateDriver(@RequestBody DriverInfo driverInfoDto) public CommonResult updateDriver(@RequestBody DriverInfo driverInfoDto) {
{
rescueInfoService.updateDriver(driverInfoDto); rescueInfoService.updateDriver(driverInfoDto);
return CommonResult.success("修改成功"); return CommonResult.success("修改成功");
} }
@PostMapping("/delDriver") @PostMapping("/delDriver")
public CommonResult delDriver(Long[] ids) public CommonResult delDriver(Long[] ids) {
{
rescueInfoService.delDriver(ids); rescueInfoService.delDriver(ids);
return CommonResult.success("删除成功"); return CommonResult.success("删除成功");
} }
//获取扣车地点 //获取扣车地点
@GetMapping("/getKcPosition") @GetMapping("/getKcPosition")
public CommonResult getKcPosition(String searchValue) { public CommonResult getKcPosition(@RequestParam(required = false) String searchValue) {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String dictStr = "kcPosition-"+loginUser.getTenantId(); String dictStr = "kcPosition-" + loginUser.getTenantId();
if (!dictDataApi.exist(dictStr)){ if (!dictDataApi.exist(dictStr)) {
//初始化 //初始化
dictDataApi.createDictType("扣车地点-"+loginUser.getTenantId(),dictStr); dictDataApi.createDictType("扣车地点-" + loginUser.getTenantId(), dictStr);
} }
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(dictStr); List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(dictStr);
if (CollectionUtil.isEmpty(dataList)){ if (CollectionUtil.isEmpty(dataList)) {
dataList =new ArrayList<>(); dataList = new ArrayList<>();
} }
if (StringUtils.isNotEmpty(searchValue)){ if (StringUtils.isNotEmpty(searchValue)) {
dataList = dataList.stream().filter(it->{ dataList = dataList.stream().filter(it -> {
return it.getLabel().contains(searchValue); return it.getLabel().contains(searchValue);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -221,19 +218,18 @@ public class RescueInfoSystem extends BaseController {
//新增扣车地点 //新增扣车地点
@PostMapping("/addKcPosition") @PostMapping("/addKcPosition")
public CommonResult addKcPosition(@RequestBody SysDictData dictData){ public CommonResult addKcPosition(@RequestBody SysDictData dictData) {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String dictStr = "kcPosition-"+loginUser.getTenantId(); String dictStr = "kcPosition-" + loginUser.getTenantId();
dictDataApi.addDictData(dictStr,dictData.getDictLabel(),dictData.getDictValue()); dictDataApi.addDictData(dictStr, dictData.getDictLabel(), dictData.getDictValue(), dictData.getDictSort().intValue());
return CommonResult.ok(); return CommonResult.ok();
} }
//删除扣车地点 //删除扣车地点
@PostMapping("/delKcPosition") @PostMapping("/delKcPosition")
public CommonResult delKcPosition(Long dictId){ public CommonResult delKcPosition(Long dictId) {
dictDataApi.deleteDictDataByIds(new Long[]{dictId}); dictDataApi.deleteDictDataByIds(new Long[]{dictId});
return CommonResult.ok(); return CommonResult.ok();
} }
@ -253,24 +249,22 @@ public class RescueInfoSystem extends BaseController {
} }
//获取救援路段 //获取救援路段
@GetMapping("/getRescueRoad") @GetMapping("/getRescueRoad")
public CommonResult getRescueRoad(String searchValue) throws Exception { public CommonResult getRescueRoad(String searchValue) throws Exception {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String dictStr = "kcPosition-"+loginUser.getTenantId(); String dictStr = "kcRescueRoad-" + loginUser.getTenantId();
if (!dictDataApi.exist(dictStr)){ if (!dictDataApi.exist(dictStr)) {
//初始化 //初始化
dictDataApi.createDictType("道路救援路段-"+loginUser.getTenantId(),dictStr); dictDataApi.createDictType("道路救援路段-" + loginUser.getTenantId(), dictStr);
} }
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(dictStr); List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(dictStr);
if (CollectionUtil.isEmpty(dataList)){ if (CollectionUtil.isEmpty(dataList)) {
dataList =new ArrayList<>(); dataList = new ArrayList<>();
} }
if (StringUtils.isNotEmpty(searchValue)){ if (StringUtils.isNotEmpty(searchValue)) {
dataList = dataList.stream().filter(it->{ dataList = dataList.stream().filter(it -> {
return it.getLabel().contains(searchValue); return it.getLabel().contains(searchValue);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -281,48 +275,47 @@ public class RescueInfoSystem extends BaseController {
@PostMapping("/addRescueRoad") @PostMapping("/addRescueRoad")
public CommonResult addRescueRoad(@RequestBody SysDictData dictData) throws Exception { public CommonResult addRescueRoad(@RequestBody SysDictData dictData) throws Exception {
//当前登录用户 //当前登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String dictStr = "rescue_road-"+loginUser.getTenantId(); String dictStr = "kcRescueRoad-" + loginUser.getTenantId();
dictDataApi.addDictData(dictStr,dictData.getDictLabel(),dictData.getDictValue()); dictDataApi.addDictData(dictStr, dictData.getDictLabel(), dictData.getDictValue(), dictData.getDictSort().intValue());
return CommonResult.ok(); return CommonResult.ok();
} }
//删除救援路段 //删除救援路段
@PostMapping("/delRescueRoad") @PostMapping("/delRescueRoad")
public CommonResult delRescueRoad(Long dictId){ public CommonResult delRescueRoad(Long dictId) {
dictDataApi.deleteDictDataByIds(new Long[]{dictId}); dictDataApi.deleteDictDataByIds(new Long[]{dictId});
return CommonResult.ok(); return CommonResult.ok();
} }
/** /**
* moneyManagement * moneyManagement
*/ */
@GetMapping("/moneyManagement") @GetMapping("/moneyManagement")
public TableDataInfo moneyManagement(RescueInfo rescueInfo) public TableDataInfo moneyManagement(RescueInfo rescueInfo) {
{
startPage(); startPage();
List<RescueInfo> rescueInfos = rescueInfoService.getRescueInfoByDriver(rescueInfo); List<RescueInfo> rescueInfos = rescueInfoService.getRescueInfoByDriver(rescueInfo);
TableDataInfo dataTable = getDataTable(rescueInfos); TableDataInfo dataTable = getDataTable(rescueInfos);
List<MoneyManagement> list = rescueInfoService.moneyManagement2(rescueInfos,rescueInfo.getRescueStart()); List<MoneyManagement> list = rescueInfoService.moneyManagement2(rescueInfos, rescueInfo.getRescueStart());
dataTable.setRows(list); dataTable.setRows(list);
return dataTable; return dataTable;
} }
/** /**
* moneyManagement * moneyManagement
*/ */
@GetMapping("/moneyManagementData") @GetMapping("/moneyManagementData")
public CommonResult moneyManagementData(RescueInfo rescueInfo) public CommonResult moneyManagementData(RescueInfo rescueInfo) {
{
JSONObject res = rescueInfoService.listData(rescueInfo); JSONObject res = rescueInfoService.listData(rescueInfo);
return CommonResult.success(res); return CommonResult.success(res);
} }
@PostMapping("/exportManagement") @PostMapping("/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);
ExcelUtil<MoneyManagement> util = new ExcelUtil<MoneyManagement>(MoneyManagement.class); ExcelUtil<MoneyManagement> util = new ExcelUtil<MoneyManagement>(MoneyManagement.class);
String title = "施救总金额:"+jsonObject.getString("allMoney")+ "元 出车次数:"+jsonObject.getString("allNum") +"次 提成总金额:"+jsonObject.getString("tcAll") +" 元 燃油费小计:"+jsonObject.getString("refuelMoney") +""; String title = "施救总金额:" + jsonObject.getString("allMoney") + "元 出车次数:" + jsonObject.getString("allNum") + "次 提成总金额:" + jsonObject.getString("tcAll") + " 元 燃油费小计:" + jsonObject.getString("refuelMoney") + "";
util.exportExcel(response, list, "救援财务报表",title); util.exportExcel(response, list, "救援财务报表", title);
} }
} }

View File

@ -31,6 +31,7 @@ import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
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.beans.factory.annotation.Autowired;
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;
@ -56,35 +57,36 @@ import static cn.iocoder.yudao.module.rescue.utils.DistanceUtil.getDistanceMeter
@Service @Service
public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper,RescueInfo> implements IRescueInfoService public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper,RescueInfo> implements IRescueInfoService
{ {
@Autowired @Resource
private AdminUserApi userService; private AdminUserApi userService;
@Autowired @Resource
private IDriverInfoService driverInfoService; private IDriverInfoService driverInfoService;
@Autowired @Resource
private IRescueDriverInfoService rescueDriverInfoService; private IRescueDriverInfoService rescueDriverInfoService;
@Autowired @Resource
@Lazy
private RedisUtil redisCache; private RedisUtil redisCache;
@Autowired @Resource
private IRescueCarInfoService carInfoService; private IRescueCarInfoService carInfoService;
@Autowired @Resource
private IRescueInfoDetailService detailService; private IRescueInfoDetailService detailService;
@Autowired @Resource
private DictDataApi dictDataService; private DictDataApi dictDataService;
@Autowired @Resource
private IRescueDriverPositionService positionService; private IRescueDriverPositionService positionService;
@Autowired @Resource
private IRescueOrderInfoService rescueOrderInfoService; private IRescueOrderInfoService rescueOrderInfoService;
@Autowired @Resource
private IRescueDeptDriverService deptDriverService; private IRescueDeptDriverService deptDriverService;
@Autowired @Resource
private ISysAnnouncementService announcementService; private ISysAnnouncementService announcementService;
@Autowired @Resource
private IRescueConfigService rescueConfigService; private IRescueConfigService rescueConfigService;
@Autowired @Resource
private IRescueRefuelRecordService refuelRecordService; private IRescueRefuelRecordService refuelRecordService;
@Autowired @Resource
private DeptApi deptService; private DeptApi deptService;
@Autowired @Resource
private CompanyStaffService staffService; private CompanyStaffService staffService;
@Resource @Resource
private RoleApi roleApi; private RoleApi roleApi;

View File

@ -93,6 +93,6 @@ public interface DictDataApi {
} }
Boolean exist(String dictType); Boolean exist(String dictType);
void createDictType(String name,String type); void createDictType(String name,String type);
void addDictData(String dictType,String label,String value); void addDictData(String dictType,String label,String value, Integer sort);
void deleteDictDataByIds(Long[] ids); void deleteDictDataByIds(Long[] ids);
} }

View File

@ -10,7 +10,14 @@ import lombok.Data;
*/ */
@Data @Data
public class DictDataRespDTO { public class DictDataRespDTO {
/**
* 字典数据编号
*/
private Long id;
/**
* 字典排序
*/
private Integer sort;
/** /**
* 字典标签 * 字典标签
*/ */

View File

@ -86,13 +86,14 @@ public class DictDataApiImpl implements DictDataApi {
* @param value * @param value
*/ */
@Override @Override
public void addDictData(String dictType,String label,String value) { public void addDictData(String dictType,String label,String value, Integer sort) {
DictDataSaveReqVO createReqVO =new DictDataSaveReqVO(); DictDataSaveReqVO createReqVO =new DictDataSaveReqVO();
createReqVO.setStatus(0); createReqVO.setStatus(0);
createReqVO.setDictType(dictType); createReqVO.setDictType(dictType);
createReqVO.setLabel(label); createReqVO.setLabel(label);
createReqVO.setValue(value); createReqVO.setValue(value);
createReqVO.setSort(sort);
dictDataService.createDictData(createReqVO); dictDataService.createDictData(createReqVO);
} }