Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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
耿迪迪
gassafety-progress
Commits
88ed3bf9
Commit
88ed3bf9
authored
Aug 16, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
气瓶管理
parent
61f97d65
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1066 additions
and
0 deletions
+1066
-0
TGasBottleInfoController.java
...b/controller/gasBottleTrack/TGasBottleInfoController.java
+122
-0
TGasStorageStationInfoController.java
...ller/gasBottleTrack/TGasStorageStationInfoController.java
+6
-0
TGasBottleInfo.java
...rc/main/java/com/zehong/system/domain/TGasBottleInfo.java
+415
-0
TGasBottleInfoMapper.java
...n/java/com/zehong/system/mapper/TGasBottleInfoMapper.java
+61
-0
ITGasBottleInfoService.java
...ava/com/zehong/system/service/ITGasBottleInfoService.java
+69
-0
TGasBottleInfoServiceImpl.java
...zehong/system/service/impl/TGasBottleInfoServiceImpl.java
+177
-0
TGasBottleInfoMapper.xml
...src/main/resources/mapper/system/TGasBottleInfoMapper.xml
+216
-0
No files found.
gassafetyprogress-admin/src/main/java/com/zehong/web/controller/gasBottleTrack/TGasBottleInfoController.java
0 → 100644
View file @
88ed3bf9
package
com
.
zehong
.
web
.
controller
.
gasBottleTrack
;
import
com.zehong.common.annotation.Log
;
import
com.zehong.common.core.controller.BaseController
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.common.core.page.TableDataInfo
;
import
com.zehong.common.enums.BusinessType
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.system.domain.TGasBottleInfo
;
import
com.zehong.system.service.ITGasBottleInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
/**
* 气瓶信息Controller
*
* @author zehong
* @date 2023-08-15
*/
@RestController
@RequestMapping
(
"/gasBottle/info"
)
public
class
TGasBottleInfoController
extends
BaseController
{
@Autowired
private
ITGasBottleInfoService
tGasBottleInfoService
;
/**
* 查询气瓶信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
TGasBottleInfo
tGasBottleInfo
)
{
startPage
();
List
<
TGasBottleInfo
>
list
=
tGasBottleInfoService
.
selectTGasBottleInfoList
(
tGasBottleInfo
);
return
getDataTable
(
list
);
}
/**
* 导出气瓶信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:export')"
)
@Log
(
title
=
"气瓶信息"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
TGasBottleInfo
tGasBottleInfo
)
{
List
<
TGasBottleInfo
>
list
=
tGasBottleInfoService
.
selectTGasBottleInfoList
(
tGasBottleInfo
);
ExcelUtil
<
TGasBottleInfo
>
util
=
new
ExcelUtil
<
TGasBottleInfo
>(
TGasBottleInfo
.
class
);
return
util
.
exportExcel
(
list
,
"气瓶信息数据"
);
}
/**
* 获取气瓶信息详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:query')"
)
@GetMapping
(
value
=
"/{bottleId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"bottleId"
)
Long
bottleId
)
{
return
AjaxResult
.
success
(
tGasBottleInfoService
.
selectTGasBottleInfoById
(
bottleId
));
}
/**
* 新增气瓶信息
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:add')"
)
@Log
(
title
=
"气瓶信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
TGasBottleInfo
tGasBottleInfo
)
{
return
toAjax
(
tGasBottleInfoService
.
insertTGasBottleInfo
(
tGasBottleInfo
));
}
/**
* 修改气瓶信息
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:edit')"
)
@Log
(
title
=
"气瓶信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
TGasBottleInfo
tGasBottleInfo
)
{
return
toAjax
(
tGasBottleInfoService
.
updateTGasBottleInfo
(
tGasBottleInfo
));
}
/**
* 删除气瓶信息
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottle:info:remove')"
)
@Log
(
title
=
"气瓶信息"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{bottleIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
bottleIds
)
{
return
toAjax
(
tGasBottleInfoService
.
deleteTGasBottleInfoByIds
(
bottleIds
));
}
/**
* 储配站导入
* @param file
* @param updateSupport
* @return
* @throws Exception
*/
@PreAuthorize
(
"@ss.hasPermi('gasBottleTrack:storageStationManage:import')"
)
@Log
(
title
=
"储配站维护"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
ExcelUtil
<
TGasBottleInfo
>
util
=
new
ExcelUtil
<>(
TGasBottleInfo
.
class
);
List
<
TGasBottleInfo
>
tGasBottleInfoList
=
util
.
importExcel
(
file
.
getInputStream
());
String
message
=
tGasBottleInfoService
.
importTGasBottleInfo
(
tGasBottleInfoList
,
updateSupport
);
return
AjaxResult
.
success
(
message
);
}
@GetMapping
(
"/importTemplate"
)
public
AjaxResult
importTemplate
(){
ExcelUtil
<
TGasBottleInfo
>
util
=
new
ExcelUtil
<>(
TGasBottleInfo
.
class
);
return
util
.
importTemplateExcel
(
"气瓶数据"
);
}
}
gassafetyprogress-admin/src/main/java/com/zehong/web/controller/gasBottleTrack/TGasStorageStationInfoController.java
View file @
88ed3bf9
...
...
@@ -40,6 +40,12 @@ public class TGasStorageStationInfoController extends BaseController
return
getDataTable
(
list
);
}
@GetMapping
(
"/gasStorageStationList"
)
public
AjaxResult
gasStorageStationList
(
TGasStorageStationInfo
tGasStorageStationInfo
){
List
<
TGasStorageStationInfo
>
list
=
tGasStorageStationInfoService
.
selectTGasStorageStationInfoList
(
tGasStorageStationInfo
);
return
AjaxResult
.
success
(
list
);
}
/**
* 导出储配站信息列表
*/
...
...
gassafetyprogress-system/src/main/java/com/zehong/system/domain/TGasBottleInfo.java
0 → 100644
View file @
88ed3bf9
This diff is collapsed.
Click to expand it.
gassafetyprogress-system/src/main/java/com/zehong/system/mapper/TGasBottleInfoMapper.java
0 → 100644
View file @
88ed3bf9
package
com
.
zehong
.
system
.
mapper
;
import
java.util.List
;
import
com.zehong.system.domain.TGasBottleInfo
;
/**
* 气瓶信息Mapper接口
*
* @author zehong
* @date 2023-08-15
*/
public
interface
TGasBottleInfoMapper
{
/**
* 查询气瓶信息
*
* @param bottleId 气瓶信息ID
* @return 气瓶信息
*/
public
TGasBottleInfo
selectTGasBottleInfoById
(
Long
bottleId
);
/**
* 查询气瓶信息列表
*
* @param tGasBottleInfo 气瓶信息
* @return 气瓶信息集合
*/
public
List
<
TGasBottleInfo
>
selectTGasBottleInfoList
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 新增气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
public
int
insertTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 修改气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
public
int
updateTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 删除气瓶信息
*
* @param bottleId 气瓶信息ID
* @return 结果
*/
public
int
deleteTGasBottleInfoById
(
Long
bottleId
);
/**
* 批量删除气瓶信息
*
* @param bottleIds 需要删除的数据ID
* @return 结果
*/
public
int
deleteTGasBottleInfoByIds
(
Long
[]
bottleIds
);
}
gassafetyprogress-system/src/main/java/com/zehong/system/service/ITGasBottleInfoService.java
0 → 100644
View file @
88ed3bf9
package
com
.
zehong
.
system
.
service
;
import
java.util.List
;
import
com.zehong.system.domain.TGasBottleInfo
;
/**
* 气瓶信息Service接口
*
* @author zehong
* @date 2023-08-15
*/
public
interface
ITGasBottleInfoService
{
/**
* 查询气瓶信息
*
* @param bottleId 气瓶信息ID
* @return 气瓶信息
*/
public
TGasBottleInfo
selectTGasBottleInfoById
(
Long
bottleId
);
/**
* 查询气瓶信息列表
*
* @param tGasBottleInfo 气瓶信息
* @return 气瓶信息集合
*/
public
List
<
TGasBottleInfo
>
selectTGasBottleInfoList
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 新增气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
public
int
insertTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 修改气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
public
int
updateTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
);
/**
* 批量删除气瓶信息
*
* @param bottleIds 需要删除的气瓶信息ID
* @return 结果
*/
public
int
deleteTGasBottleInfoByIds
(
Long
[]
bottleIds
);
/**
* 删除气瓶信息信息
*
* @param bottleId 气瓶信息ID
* @return 结果
*/
public
int
deleteTGasBottleInfoById
(
Long
bottleId
);
/**
* 气瓶数据导出
* @param tGasBottleInfoList 气瓶实体
* @param isUpdateSupport 是否更新
* @return
*/
String
importTGasBottleInfo
(
List
<
TGasBottleInfo
>
tGasBottleInfoList
,
Boolean
isUpdateSupport
);
}
gassafetyprogress-system/src/main/java/com/zehong/system/service/impl/TGasBottleInfoServiceImpl.java
0 → 100644
View file @
88ed3bf9
package
com
.
zehong
.
system
.
service
.
impl
;
import
com.zehong.common.exception.CustomException
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.TGasBottleInfo
;
import
com.zehong.system.domain.TGasStorageStationInfo
;
import
com.zehong.system.mapper.TGasBottleInfoMapper
;
import
com.zehong.system.mapper.TGasStorageStationInfoMapper
;
import
com.zehong.system.service.ITGasBottleInfoService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 气瓶信息Service业务层处理
*
* @author zehong
* @date 2023-08-15
*/
@Service
public
class
TGasBottleInfoServiceImpl
implements
ITGasBottleInfoService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
TGasBottleInfoServiceImpl
.
class
);
@Autowired
private
TGasBottleInfoMapper
tGasBottleInfoMapper
;
@Resource
private
TGasStorageStationInfoMapper
tGasStorageStationInfoMapper
;
/**
* 查询气瓶信息
*
* @param bottleId 气瓶信息ID
* @return 气瓶信息
*/
@Override
public
TGasBottleInfo
selectTGasBottleInfoById
(
Long
bottleId
)
{
return
tGasBottleInfoMapper
.
selectTGasBottleInfoById
(
bottleId
);
}
/**
* 查询气瓶信息列表
*
* @param tGasBottleInfo 气瓶信息
* @return 气瓶信息
*/
@Override
public
List
<
TGasBottleInfo
>
selectTGasBottleInfoList
(
TGasBottleInfo
tGasBottleInfo
)
{
return
tGasBottleInfoMapper
.
selectTGasBottleInfoList
(
tGasBottleInfo
);
}
/**
* 新增气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
@Override
public
int
insertTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
)
{
tGasBottleInfo
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
tGasBottleInfoMapper
.
insertTGasBottleInfo
(
tGasBottleInfo
);
}
/**
* 修改气瓶信息
*
* @param tGasBottleInfo 气瓶信息
* @return 结果
*/
@Override
public
int
updateTGasBottleInfo
(
TGasBottleInfo
tGasBottleInfo
)
{
tGasBottleInfo
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
tGasBottleInfoMapper
.
updateTGasBottleInfo
(
tGasBottleInfo
);
}
/**
* 批量删除气瓶信息
*
* @param bottleIds 需要删除的气瓶信息ID
* @return 结果
*/
@Override
public
int
deleteTGasBottleInfoByIds
(
Long
[]
bottleIds
)
{
return
tGasBottleInfoMapper
.
deleteTGasBottleInfoByIds
(
bottleIds
);
}
/**
* 删除气瓶信息信息
*
* @param bottleId 气瓶信息ID
* @return 结果
*/
@Override
public
int
deleteTGasBottleInfoById
(
Long
bottleId
)
{
return
tGasBottleInfoMapper
.
deleteTGasBottleInfoById
(
bottleId
);
}
/**
* 气瓶数据导出
* @param tGasBottleInfoList 气瓶实体
* @param isUpdateSupport 是否更新
* @return
*/
@Override
public
String
importTGasBottleInfo
(
List
<
TGasBottleInfo
>
tGasBottleInfoList
,
Boolean
isUpdateSupport
){
if
(
StringUtils
.
isNull
(
tGasBottleInfoList
)
||
tGasBottleInfoList
.
size
()
==
0
){
throw
new
CustomException
(
"导入数据不能为空!"
);
}
int
successNum
=
0
;
int
failureNum
=
0
;
StringBuilder
successMsg
=
new
StringBuilder
();
StringBuilder
failureMsg
=
new
StringBuilder
();
for
(
TGasBottleInfo
tGasBottleInfo
:
tGasBottleInfoList
){
try
{
//查询储配站信息
TGasStorageStationInfo
queryGasStorageStationInfo
=
new
TGasStorageStationInfo
();
queryGasStorageStationInfo
.
setStationName
(
tGasBottleInfo
.
getStationName
());
List
<
TGasStorageStationInfo
>
gasStorageStationInfo
=
tGasStorageStationInfoMapper
.
selectTGasStorageStationInfoList
(
queryGasStorageStationInfo
);
if
(
CollectionUtils
.
isEmpty
(
gasStorageStationInfo
)){
failureNum
++;
failureMsg
.
append
(
"<br/>"
+
failureNum
+
"、气瓶条码为 "
+
tGasBottleInfo
.
getBottleCode
()
+
"、储配站"
+
tGasBottleInfo
.
getStationName
()
+
" 不存在请创建或导入"
);
continue
;
}
TGasBottleInfo
gasBottleInfo
=
new
TGasBottleInfo
();
gasBottleInfo
.
setBottleCode
(
tGasBottleInfo
.
getBottleCode
());
List
<
TGasBottleInfo
>
queryGasBottleInfo
=
tGasBottleInfoMapper
.
selectTGasBottleInfoList
(
gasBottleInfo
);
if
(
StringUtils
.
isNull
(
queryGasBottleInfo
)
||
queryGasBottleInfo
.
size
()
==
0
){
tGasBottleInfo
.
setStationId
(
gasStorageStationInfo
.
get
(
0
).
getStationId
());
this
.
insertTGasBottleInfo
(
tGasBottleInfo
);
successNum
++;
successMsg
.
append
(
"<br/>"
+
successNum
+
"、气瓶条码 "
+
tGasBottleInfo
.
getBottleCode
()
+
" 导入成功"
);
}
else
if
(
isUpdateSupport
){
queryGasBottleInfo
.
stream
().
forEach
(
bottleInfo
->{
tGasBottleInfo
.
setBottleId
(
bottleInfo
.
getBottleId
());
tGasBottleInfo
.
setStationId
(
gasStorageStationInfo
.
get
(
0
).
getStationId
());
this
.
updateTGasBottleInfo
(
tGasBottleInfo
);
});
successNum
++;
successMsg
.
append
(
"<br/>"
+
successNum
+
"、气瓶条码 "
+
tGasBottleInfo
.
getBottleCode
()
+
" 更新成功"
);
}
else
{
failureNum
++;
failureMsg
.
append
(
"<br/>"
+
failureNum
+
"、气瓶条码 "
+
tGasBottleInfo
.
getBottleCode
()
+
" 已存在"
);
}
}
catch
(
Exception
e
)
{
failureNum
++;
String
msg
=
"<br/>"
+
failureNum
+
"、气瓶条码 "
+
tGasBottleInfo
.
getBottleCode
()
+
" 导入失败:"
;
failureMsg
.
append
(
msg
+
e
.
getMessage
());
log
.
error
(
msg
,
e
);
}
}
if
(
failureNum
>
0
)
{
failureMsg
.
insert
(
0
,
"很抱歉,导入失败!共 "
+
failureNum
+
" 条数据格式不正确,错误如下:"
);
throw
new
CustomException
(
failureMsg
.
toString
());
}
else
{
successMsg
.
insert
(
0
,
"恭喜您,数据已全部导入成功!共 "
+
successNum
+
" 条,数据如下:"
);
}
return
successMsg
.
toString
();
}
}
gassafetyprogress-system/src/main/resources/mapper/system/TGasBottleInfoMapper.xml
0 → 100644
View file @
88ed3bf9
This diff is collapsed.
Click to expand it.
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