救援菜单配置

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

View File

@ -93,6 +93,6 @@ public interface DictDataApi {
}
Boolean exist(String dictType);
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);
}

View File

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

View File

@ -86,13 +86,14 @@ public class DictDataApiImpl implements DictDataApi {
* @param value
*/
@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();
createReqVO.setStatus(0);
createReqVO.setDictType(dictType);
createReqVO.setLabel(label);
createReqVO.setValue(value);
createReqVO.setSort(sort);
dictDataService.createDictData(createReqVO);
}