Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZTGK
hzsomms
Commits
867f3bf0
Commit
867f3bf0
authored
Oct 25, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.修改bug
parent
36f9d4a4
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
27 deletions
+104
-27
FastenerManagementController.java
.../deviceAsset/controller/FastenerManagementController.java
+14
-0
SignBoardManagementController.java
...deviceAsset/controller/SignBoardManagementController.java
+24
-0
SwitchManagementController.java
...es/deviceAsset/controller/SwitchManagementController.java
+1
-1
TrackBedManagementController.java
.../deviceAsset/controller/TrackBedManagementController.java
+25
-0
SignBoardManagement.java
...jeecg/modules/deviceAsset/entity/SignBoardManagement.java
+5
-1
TrackBedManagement.java
.../jeecg/modules/deviceAsset/entity/TrackBedManagement.java
+3
-0
RailManagementServiceImpl.java
...s/deviceAsset/service/impl/RailManagementServiceImpl.java
+28
-14
CommonController.java
...org/jeecg/modules/system/controller/CommonController.java
+4
-11
No files found.
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/FastenerManagementController.java
View file @
867f3bf0
...
@@ -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
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/SignBoardManagementController.java
View file @
867f3bf0
...
@@ -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
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/SwitchManagementController.java
View file @
867f3bf0
...
@@ -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
.
getByroad
Center
Mileage
()
switchManagement
.
getByroad
End
Mileage
()
);
);
this
.
service
.
edit
(
switchManagement
);
this
.
service
.
edit
(
switchManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/TrackBedManagementController.java
View file @
867f3bf0
...
@@ -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
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/entity/SignBoardManagement.java
View file @
867f3bf0
...
@@ -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
;
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/entity/TrackBedManagement.java
View file @
867f3bf0
...
@@ -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
;
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/RailManagementServiceImpl.java
View file @
867f3bf0
...
@@ -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
+
"】里程冲突"
);
}
}
}
}
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/system/controller/CommonController.java
View file @
867f3bf0
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment