Commit 867f3bf0 authored by hkl's avatar hkl

feat:1.修改bug

parent 36f9d4a4
......@@ -15,8 +15,14 @@ import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
import org.jeecg.modules.deviceAsset.service.IFastenerManagementService;
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 javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
/**
......@@ -31,6 +37,13 @@ import java.util.Arrays;
@RequestMapping("/deviceAsset/fastenerManagement")
@Api(tags = "资产管理-扣件管理")
public class FastenerManagementController extends JeecgController<FastenerManagement, IFastenerManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-扣件管理-分页列表查询")
@ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询")
@GetMapping(value = "/list")
......@@ -47,6 +60,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage
@ApiOperation(value = "资产管理-扣件管理-编辑", notes = "资产管理-扣件管理-编辑")
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) {
if (ObjectUtil.isEmpty(fastenerManagement.getId())) {
fastenerManagement.setId(UUIDGenerator.generate());
this.service.save(fastenerManagement);
......
......@@ -17,10 +17,16 @@ import org.jeecg.modules.deviceAsset.entity.SignBoardManagement;
import org.jeecg.modules.deviceAsset.service.ISignBoardManagementService;
import org.jeecg.modules.deviceAsset.vo.FastenerManagementVO;
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.jeecg.common.system.base.controller.JeecgController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
/**
......@@ -35,6 +41,12 @@ import java.util.Arrays;
@RequestMapping("/deviceAsset/signBoardManagement")
@Api(tags = "资产管理-轨行区标识管理")
public class SignBoardManagementController extends JeecgController<SignBoardManagement, ISignBoardManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-轨行区标识管理 -分页列表查询")
@ApiOperation(value = "资产管理-道岔管理-分页列表查询", notes = "资产管理-道岔管理-分页列表查询")
@GetMapping(value = "/list")
......@@ -51,6 +63,18 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana
@ApiOperation(value = "资产管理-轨行区标识管理-编辑", notes = "资产管理-轨行区标识管理-编辑")
@PostMapping(value = "/edit")
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())) {
signBoardManagement.setId(UUIDGenerator.generate());
this.service.save(signBoardManagement);
......
......@@ -55,7 +55,7 @@ public class SwitchManagementController extends JeecgController<SwitchManagement
switchManagement.getLightRailId(),
switchManagement.getLineAliasId(),
switchManagement.getByroadPreMileage(),
switchManagement.getByroadCenterMileage()
switchManagement.getByroadEndMileage()
);
this.service.edit(switchManagement);
......
......@@ -18,10 +18,17 @@ import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.entity.TrackBedManagement;
import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService;
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 javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -35,6 +42,12 @@ import java.util.List;
@RequestMapping("/deviceAsset/trackBedManagement")
@Api(tags = "资产管理-道床管理")
public class TrackBedManagementController extends JeecgController<TrackBedManagement, ITrackBedManagementService> {
@Resource
private ILightRailService lightRailService;
@Resource
private ILineAliasService lineAliasService;
@AutoLog(value = "资产管理-道床管理-分页列表查询")
@ApiOperation(value = "资产管理-道床管理-分页列表查询", notes = "资产管理-道床管理-分页列表查询")
@GetMapping(value = "/list")
......@@ -51,6 +64,18 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage
@ApiOperation(value = "资产管理-道床管理-编辑", notes = "资产管理-道床管理-编辑")
@PostMapping(value = "/edit")
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())) {
trackBedManagement.setId(UUIDGenerator.generate());
this.service.save(trackBedManagement);
......
......@@ -2,9 +2,11 @@ package org.jeecg.modules.deviceAsset.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
......@@ -69,5 +71,7 @@ public class SignBoardManagement implements Serializable {
@TableField("remark")
private String remark;
@ApiModelProperty(value = "线路id")
@TableField(exist = false)
private String lightRailId;
}
......@@ -79,4 +79,7 @@ public class TrackBedManagement implements Serializable {
@TableField("remark")
private String remark;
@ApiModelProperty(value = "线路id")
@TableField(exist = false)
private String lightRailId;
}
......@@ -226,11 +226,13 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(innerRailList);
}
// ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
allRailList.addAll(innerRailList);
}
// // ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
// if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
// isGenerateRule2 = false;
//
// List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
// allRailList.addAll(innerRailList);
// }
}
continue;
}
......@@ -295,11 +297,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(innerRailList);
}
// ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
allRailList.addAll(innerRailList);
}
// // ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
// if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
// List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
// allRailList.addAll(innerRailList);
// }
}
continue;
}
......@@ -613,8 +615,20 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override
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);
// 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)) {
return;
}
......@@ -640,12 +654,12 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
}
// 判断开始里程是否是否冲突
if (currentStartMileage.compareTo(startMileage) <= 0 && currentEndMileage.compareTo(startMileage) >= 0) {
throw JeecgBootException.error("新增单元里程和 "+typeName+"单元【" + typeName + "编号:" + deviceCode + "】里程冲突");
if (currentStartMileage.compareTo(startMileage) < 0 && currentEndMileage.compareTo(startMileage) > 0) {
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 + "】里程冲突");
}
}
......
package org.jeecg.modules.system.controller;
import cn.hutool.core.io.resource.ClassPathResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -14,6 +13,7 @@ import org.jeecg.common.util.filter.FileTypeFilter;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.JeecgBaseConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -254,19 +254,12 @@ public class CommonController {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
excelPath = excelPath.replace("..", "").replace("../", "");
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 + "]不存在..");
}
ClassPathResource classPathResource = new ClassPathResource("templates" + File.separator + "excel" + File.separator + excelPath);
// 设置强制下载不打开
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");
inputStream = new BufferedInputStream(new FileInputStream(filePath));
inputStream = classPathResource.getInputStream();
outputStream = response.getOutputStream();
byte[] buf = new byte[4096];
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