From 2b0327792b1bd1f858f0d5f019295c170d775fb7 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Mon, 19 Aug 2024 14:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=91=E6=8F=B4=E8=8F=9C=E5=8D=95=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{system => admin}/RescueInfoSystem.java | 153 +++++++++--------- .../service/impl/RescueInfoServiceImpl.java | 32 ++-- .../module/system/api/dict/DictDataApi.java | 2 +- .../system/api/dict/dto/DictDataRespDTO.java | 9 +- .../system/api/dict/DictDataApiImpl.java | 3 +- 5 files changed, 101 insertions(+), 98 deletions(-) rename dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/{system => admin}/RescueInfoSystem.java (71%) diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/system/RescueInfoSystem.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java similarity index 71% rename from dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/system/RescueInfoSystem.java rename to dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java index faaf1df3..f9b0348a 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/system/RescueInfoSystem.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/controller/admin/RescueInfoSystem.java @@ -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 rescueInfos = rescueInfoService.selectRescueListSystem(rescueInfo); TableDataInfo dataTable = getDataTable(rescueInfos); return dataTable; } + /** * 查询【请填写功能名称】列表 */ @GetMapping("/list2") - public TableDataInfo list2(RescueInfo rescueInfo) - { + public TableDataInfo list2(RescueInfo rescueInfo) { startPage(); List list = rescueInfoService.selectRescueListSystem2(rescueInfo); return getDataTable(list); } @GetMapping("/watchImg") - public CommonResult watchImg(@RequestParam("rescueId") Long rescueId) - { - List resList =new ArrayList<>(); - RescueInfoDetail rescueInfoDetail =new RescueInfoDetail(); + public CommonResult watchImg(@RequestParam("rescueId") Long rescueId) { + List resList = new ArrayList<>(); + RescueInfoDetail rescueInfoDetail = new RescueInfoDetail(); rescueInfoDetail.setRescueInfoId(rescueId); List details = rescueInfoDetailService.selectRescueInfoDetailList(rescueInfoDetail); - if (CollectionUtil.isNotEmpty(details)){ - List images = details.stream().filter(it->{ + if (CollectionUtil.isNotEmpty(details)) { + List 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 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 util = new ExcelUtil(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 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 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 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 rescueInfos = rescueInfoService.getRescueInfoByDriver(rescueInfo); TableDataInfo dataTable = getDataTable(rescueInfos); - List list = rescueInfoService.moneyManagement2(rescueInfos,rescueInfo.getRescueStart()); + List 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 list = rescueInfoService.moneyManagement(rescueInfo); + public void exportManagement(HttpServletResponse response, RescueInfo rescueInfo) { + List list = rescueInfoService.moneyManagement(rescueInfo); JSONObject jsonObject = rescueInfoService.listData(rescueInfo); ExcelUtil util = new ExcelUtil(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); } } 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 58b705e2..8c7c63f1 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 @@ -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 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; diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java index aab2bbca..97af785e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java @@ -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); } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataRespDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataRespDTO.java index 9b779226..71393f64 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataRespDTO.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataRespDTO.java @@ -10,7 +10,14 @@ import lombok.Data; */ @Data public class DictDataRespDTO { - + /** + * 字典数据编号 + */ + private Long id; + /** + * 字典排序 + */ + private Integer sort; /** * 字典标签 */ diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java index 608b7adb..64cab128 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java @@ -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); }