Commit 867f3bf0 authored by hkl's avatar hkl

feat:1.修改bug

parent 36f9d4a4
...@@ -15,8 +15,14 @@ import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO; ...@@ -15,8 +15,14 @@ import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement; import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
import org.jeecg.modules.deviceAsset.service.IFastenerManagementService; import org.jeecg.modules.deviceAsset.service.IFastenerManagementService;
import org.jeecg.modules.deviceAsset.vo.FastenerManagementVO; import org.jeecg.modules.deviceAsset.vo.FastenerManagementVO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
/** /**
...@@ -31,6 +37,13 @@ import java.util.Arrays; ...@@ -31,6 +37,13 @@ import java.util.Arrays;
@RequestMapping("/deviceAsset/fastenerManagement") @RequestMapping("/deviceAsset/fastenerManagement")
@Api(tags = "资产管理-扣件管理") @Api(tags = "资产管理-扣件管理")
public class FastenerManagementController extends JeecgController<FastenerManagement, IFastenerManagementService> { public class FastenerManagementController extends JeecgController<FastenerManagement, IFastenerManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-扣件管理-分页列表查询") @AutoLog(value = "资产管理-扣件管理-分页列表查询")
@ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询") @ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
...@@ -47,6 +60,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage ...@@ -47,6 +60,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage
@ApiOperation(value = "资产管理-扣件管理-编辑", notes = "资产管理-扣件管理-编辑") @ApiOperation(value = "资产管理-扣件管理-编辑", notes = "资产管理-扣件管理-编辑")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) { public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) {
if (ObjectUtil.isEmpty(fastenerManagement.getId())) { if (ObjectUtil.isEmpty(fastenerManagement.getId())) {
fastenerManagement.setId(UUIDGenerator.generate()); fastenerManagement.setId(UUIDGenerator.generate());
this.service.save(fastenerManagement); this.service.save(fastenerManagement);
......
...@@ -17,10 +17,16 @@ import org.jeecg.modules.deviceAsset.entity.SignBoardManagement; ...@@ -17,10 +17,16 @@ import org.jeecg.modules.deviceAsset.entity.SignBoardManagement;
import org.jeecg.modules.deviceAsset.service.ISignBoardManagementService; import org.jeecg.modules.deviceAsset.service.ISignBoardManagementService;
import org.jeecg.modules.deviceAsset.vo.FastenerManagementVO; import org.jeecg.modules.deviceAsset.vo.FastenerManagementVO;
import org.jeecg.modules.deviceAsset.vo.SignBoardManagementVO; import org.jeecg.modules.deviceAsset.vo.SignBoardManagementVO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
/** /**
...@@ -35,6 +41,12 @@ import java.util.Arrays; ...@@ -35,6 +41,12 @@ import java.util.Arrays;
@RequestMapping("/deviceAsset/signBoardManagement") @RequestMapping("/deviceAsset/signBoardManagement")
@Api(tags = "资产管理-轨行区标识管理") @Api(tags = "资产管理-轨行区标识管理")
public class SignBoardManagementController extends JeecgController<SignBoardManagement, ISignBoardManagementService> { public class SignBoardManagementController extends JeecgController<SignBoardManagement, ISignBoardManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-轨行区标识管理 -分页列表查询") @AutoLog(value = "资产管理-轨行区标识管理 -分页列表查询")
@ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询") @ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
...@@ -51,6 +63,18 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana ...@@ -51,6 +63,18 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana
@ApiOperation(value = "资产管理-轨行区标识管理-编辑", notes = "资产管理-轨行区标识管理-编辑") @ApiOperation(value = "资产管理-轨行区标识管理-编辑", notes = "资产管理-轨行区标识管理-编辑")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SignBoardManagement signBoardManagement) { public Result<String> edit(@RequestBody SignBoardManagement signBoardManagement) {
// 1.验证是否超出线路的里程
LightRail lightRail = lightRailService.getById(signBoardManagement.getLightRailId());
LineAlias lineAlias = lineAliasService.getById(signBoardManagement.getLineAliasId());
BigDecimal lightRailEndMileage = lightRail.getUpLineMileage();
if (lineAlias.getLineAliasName().contains("下行")) {
lightRailEndMileage = lightRail.getDownLineMileage();
}
if (signBoardManagement.getMileage().compareTo(lightRailEndMileage) > 0) {
throw JeecgBootException.error("新增道床结束里程超过:" + lightRail.getRailLineName() + "的" + lineAlias.getLineAliasName() + "的结束里程【" + lightRailEndMileage + "】");
}
if (ObjectUtil.isEmpty(signBoardManagement.getId())) { if (ObjectUtil.isEmpty(signBoardManagement.getId())) {
signBoardManagement.setId(UUIDGenerator.generate()); signBoardManagement.setId(UUIDGenerator.generate());
this.service.save(signBoardManagement); this.service.save(signBoardManagement);
......
...@@ -55,7 +55,7 @@ public class SwitchManagementController extends JeecgController<SwitchManagement ...@@ -55,7 +55,7 @@ public class SwitchManagementController extends JeecgController<SwitchManagement
switchManagement.getLightRailId(), switchManagement.getLightRailId(),
switchManagement.getLineAliasId(), switchManagement.getLineAliasId(),
switchManagement.getByroadPreMileage(), switchManagement.getByroadPreMileage(),
switchManagement.getByroadCenterMileage() switchManagement.getByroadEndMileage()
); );
this.service.edit(switchManagement); this.service.edit(switchManagement);
......
...@@ -18,10 +18,17 @@ import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO; ...@@ -18,10 +18,17 @@ import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.entity.TrackBedManagement; import org.jeecg.modules.deviceAsset.entity.TrackBedManagement;
import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService; import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService;
import org.jeecg.modules.deviceAsset.vo.TrackBedManagementVO; import org.jeecg.modules.deviceAsset.vo.TrackBedManagementVO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -35,6 +42,12 @@ import java.util.List; ...@@ -35,6 +42,12 @@ import java.util.List;
@RequestMapping("/deviceAsset/trackBedManagement") @RequestMapping("/deviceAsset/trackBedManagement")
@Api(tags = "资产管理-道床管理") @Api(tags = "资产管理-道床管理")
public class TrackBedManagementController extends JeecgController<TrackBedManagement, ITrackBedManagementService> { public class TrackBedManagementController extends JeecgController<TrackBedManagement, ITrackBedManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-道床管理-分页列表查询") @AutoLog(value = "资产管理-道床管理-分页列表查询")
@ApiOperation(value = "资产管理-道床管理-分页列表查询", notes = "资产管理-道床管理-分页列表查询") @ApiOperation(value = "资产管理-道床管理-分页列表查询", notes = "资产管理-道床管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
...@@ -51,6 +64,18 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage ...@@ -51,6 +64,18 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage
@ApiOperation(value = "资产管理-道床管理-编辑", notes = "资产管理-道床管理-编辑") @ApiOperation(value = "资产管理-道床管理-编辑", notes = "资产管理-道床管理-编辑")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody TrackBedManagement trackBedManagement) { public Result<String> edit(@RequestBody TrackBedManagement trackBedManagement) {
// 1.查询当前车站的上下行里程&获取所有设备
LightRail lightRail = lightRailService.getById(trackBedManagement.getLightRailId());
LineAlias lineAlias = lineAliasService.getById(trackBedManagement.getLineAliasId());
BigDecimal lightRailEndMileage = lightRail.getUpLineMileage();
if (lineAlias.getLineAliasName().contains("下行")) {
lightRailEndMileage = lightRail.getDownLineMileage();
}
if (trackBedManagement.getEndMileage().compareTo(lightRailEndMileage) > 0) {
throw JeecgBootException.error("新增道床结束里程超过:" + lightRail.getRailLineName() + "的" + lineAlias.getLineAliasName() + "的结束里程【" + lightRailEndMileage + "】");
}
if (ObjectUtil.isEmpty(trackBedManagement.getId())) { if (ObjectUtil.isEmpty(trackBedManagement.getId())) {
trackBedManagement.setId(UUIDGenerator.generate()); trackBedManagement.setId(UUIDGenerator.generate());
this.service.save(trackBedManagement); this.service.save(trackBedManagement);
......
...@@ -2,9 +2,11 @@ package org.jeecg.modules.deviceAsset.entity; ...@@ -2,9 +2,11 @@ package org.jeecg.modules.deviceAsset.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
...@@ -69,5 +71,7 @@ public class SignBoardManagement implements Serializable { ...@@ -69,5 +71,7 @@ public class SignBoardManagement implements Serializable {
@TableField("remark") @TableField("remark")
private String remark; private String remark;
@ApiModelProperty(value = "线路id")
@TableField(exist = false)
private String lightRailId;
} }
...@@ -79,4 +79,7 @@ public class TrackBedManagement implements Serializable { ...@@ -79,4 +79,7 @@ public class TrackBedManagement implements Serializable {
@TableField("remark") @TableField("remark")
private String remark; private String remark;
@ApiModelProperty(value = "线路id")
@TableField(exist = false)
private String lightRailId;
} }
...@@ -226,11 +226,13 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -226,11 +226,13 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(innerRailList); allRailList.addAll(innerRailList);
} }
// ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程] // // ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) { // if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId); // isGenerateRule2 = false;
allRailList.addAll(innerRailList); //
} // List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
// allRailList.addAll(innerRailList);
// }
} }
continue; continue;
} }
...@@ -295,11 +297,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -295,11 +297,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(innerRailList); allRailList.addAll(innerRailList);
} }
// ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程] // // ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) { // if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId); // List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
allRailList.addAll(innerRailList); // allRailList.addAll(innerRailList);
} // }
} }
continue; continue;
} }
...@@ -613,8 +615,20 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -613,8 +615,20 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override @Override
public void verifyUnitDeviceConflicts(String unitDeviceId, String lightRailId, String lineAliasId, BigDecimal startMileage, BigDecimal endMileage) { public void verifyUnitDeviceConflicts(String unitDeviceId, String lightRailId, String lineAliasId, BigDecimal startMileage, BigDecimal endMileage) {
// 1. 获取所有设备 // 1.查询当前车站的上下行里程&获取所有设备
LightRail lightRail = lightRailMapper.selectById(lightRailId);
LineAlias lineAlias = lineAliasMapper.selectById(lineAliasId);
List<Map<String, Object>> lineSpecialRail = this.getLineSpecialRail(lightRailId, lineAliasId); List<Map<String, Object>> lineSpecialRail = this.getLineSpecialRail(lightRailId, lineAliasId);
// 1.1 判断单元设备里程是否超过线路里程
BigDecimal lightRailEndMileage = lightRail.getUpLineMileage();
if (lineAlias.getLineAliasName().contains("下行")) {
lightRailEndMileage = lightRail.getDownLineMileage();
}
if (endMileage.compareTo(lightRailEndMileage) > 0) {
throw JeecgBootException.error("新增单元结束里程超过:" + lightRail.getRailLineName() + "的" + lineAlias.getLineAliasName() + "的结束里程【" + lightRailEndMileage + "】");
}
if (ObjectUtil.isEmpty(lineSpecialRail)) { if (ObjectUtil.isEmpty(lineSpecialRail)) {
return; return;
} }
...@@ -640,12 +654,12 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -640,12 +654,12 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
} }
// 判断开始里程是否是否冲突 // 判断开始里程是否是否冲突
if (currentStartMileage.compareTo(startMileage) <= 0 && currentEndMileage.compareTo(startMileage) >= 0) { if (currentStartMileage.compareTo(startMileage) < 0 && currentEndMileage.compareTo(startMileage) > 0) {
throw JeecgBootException.error("新增单元里程和 "+typeName+"单元【" + typeName + "编号:" + deviceCode + "】里程冲突"); throw JeecgBootException.error("新增单元里程和 " + typeName + "单元【" + typeName + "编号:" + deviceCode + "】里程冲突");
} }
// 判断结束里程是否是否冲突 // 判断结束里程是否是否冲突
if (currentStartMileage.compareTo(endMileage) <= 0 && currentEndMileage.compareTo(endMileage) >= 0) { if (currentStartMileage.compareTo(endMileage) < 0 && currentEndMileage.compareTo(endMileage) > 0) {
throw JeecgBootException.error("新增单元里程和【" + typeName + "编号:" + deviceCode + "】里程冲突"); throw JeecgBootException.error("新增单元里程和【" + typeName + "编号:" + deviceCode + "】里程冲突");
} }
} }
......
package org.jeecg.modules.system.controller; package org.jeecg.modules.system.controller;
import cn.hutool.core.io.resource.ClassPathResource;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -14,6 +13,7 @@ import org.jeecg.common.util.filter.FileTypeFilter; ...@@ -14,6 +13,7 @@ import org.jeecg.common.util.filter.FileTypeFilter;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.JeecgBaseConfig; import org.jeecg.config.JeecgBaseConfig;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -254,19 +254,12 @@ public class CommonController { ...@@ -254,19 +254,12 @@ public class CommonController {
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream = null; OutputStream outputStream = null;
try { try {
excelPath = excelPath.replace("..", "").replace("../", ""); ClassPathResource classPathResource = new ClassPathResource("templates" + File.separator + "excel" + File.separator + excelPath);
ClassPathResource classPathResource = new ClassPathResource("templates/excel/" + excelPath);
String filePath = classPathResource.getUrl().getFile();
File file = new File(filePath);
if (!file.exists()) {
response.setStatus(404);
throw new RuntimeException("文件[" + excelPath + "]不存在..");
}
// 设置强制下载不打开 // 设置强制下载不打开
response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"), "iso-8859-1")); response.addHeader("Content-Disposition", "attachment;fileName=" + new String(excelPath.getBytes("UTF-8"), "iso-8859-1"));
response.addHeader("Cache-Control", "no-cache"); response.addHeader("Cache-Control", "no-cache");
inputStream = new BufferedInputStream(new FileInputStream(filePath)); inputStream = classPathResource.getInputStream();
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int len; int len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment