Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
249ac962
Commit
249ac962
authored
Jun 29, 2021
by
郭武斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)提交航空器信息接口
parent
866d1296
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
352 additions
and
44 deletions
+352
-44
AircraftFileTypeEnum.java
.../amos/boot/module/jcs/api/enums/AircraftFileTypeEnum.java
+56
-0
AircraftController.java
...os/boot/module/jcs/biz/controller/AircraftController.java
+34
-30
AircraftServiceImpl.java
...boot/module/jcs/biz/service/impl/AircraftServiceImpl.java
+261
-13
pom.xml
pom.xml
+1
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/enums/AircraftFileTypeEnum.java
0 → 100644
View file @
249ac962
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
*
* <pre>
* 航空器附件文件类型
* </pre>
*
* @author gwb
* @version $Id: AircraftFileTypeEnum.java, v 0.1 2021年6月29日 下午4:35:34 gwb Exp $
*/
@Getter
@AllArgsConstructor
public
enum
AircraftFileTypeEnum
{
APPEARANCE
(
"APPEARANCE"
,
"外观图"
),
PLANE
(
"PLANE"
,
"平面图"
),
RESCUE
(
"RESCUE"
,
"救援图"
),
POSITION
(
"POSITION"
,
"方位图"
),
MODEL
(
"MODEL"
,
"三维模型"
);
private
String
code
;
private
String
name
;
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
static
AircraftFileTypeEnum
getEnum
(
String
code
)
{
for
(
AircraftFileTypeEnum
status
:
AircraftFileTypeEnum
.
values
())
{
if
(
status
.
getCode
().
equals
(
code
))
{
return
status
;
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/AircraftController.java
View file @
249ac962
...
...
@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -34,46 +35,54 @@ public class AircraftController extends BaseController {
private
AircraftServiceImpl
aircraftServiceImpl
;
/**
* 新增航空器信息
* 新增航空器信息
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增航空器信息"
,
notes
=
"新增航空器信息"
)
public
ResponseModel
<
AircraftDto
>
save
(
@RequestBody
AircraftDto
model
)
public
ResponseModel
<
AircraftDto
>
save
(
@RequestBody
AircraftDto
model
)
throws
Exception
{
if
(
ValidationUtil
.
isEmpty
(
model
)
||
ValidationUtil
.
isEmpty
(
model
.
getAircraftModel
()))
throw
new
BadRequest
(
"参数校验失败."
);
model
=
aircraftServiceImpl
.
create
WithModel
(
model
);
model
=
aircraftServiceImpl
.
create
Aircraft
(
RequestContext
.
getAgencyCode
(),
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
* 根据sequenceNbr更新
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新航空器信息"
,
notes
=
"根据sequenceNbr更新航空器信息"
)
public
ResponseModel
<
AircraftDto
>
updateBySequenceNbrAircraft
(
@RequestBody
AircraftDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<
AircraftDto
>
updateBySequenceNbrAircraft
(
@RequestBody
AircraftDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
throws
Exception
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
update
WithModel
(
model
));
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
update
Aircraft
(
RequestContext
.
getAgencyCode
(),
model
));
}
/**
* 根据sequenceNbr删除
* @param sequenceNbr 主键
* @return
*/
*
* <pre>
* 根据物理主键批量删除航空器信息
* </pre>
*
* @param request
* @param ids
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除航空器信息"
,
notes
=
"根据sequenceNbr删除航空器信息"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
removeById
(
sequenceNbr
));
@DeleteMapping
(
value
=
"/{ids}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据物理主键批量删除航空器信息"
,
notes
=
"根据物理主键批量删除航空器信息"
)
public
ResponseModel
<
List
<
Long
>>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"ids"
)
String
ids
)
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
multDeleteAircraft
(
RequestContext
.
getAgencyCode
(),
ids
));
}
/**
* 根据sequenceNbr查询
* 根据sequenceNbr查询
* @param sequenceNbr 主键
* @return
*/
...
...
@@ -82,10 +91,10 @@ public class AircraftController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个航空器信息"
,
notes
=
"根据sequenceNbr查询单个航空器信息"
)
public
ResponseModel
<
AircraftDto
>
seleteOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
queryBy
Seq
(
sequenceNbr
));
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
queryBy
AircraftSeq
(
RequestContext
.
getAgencyCode
(),
sequenceNbr
));
}
/**
* 列表分页查询
* 列表分页查询
*@param current 当前页
*@param current 每页大小
* @return
...
...
@@ -93,22 +102,17 @@ public class AircraftController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"航空器信息分页查询"
,
notes
=
"航空器信息分页查询"
)
public
ResponseModel
<
Page
<
AircraftDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
public
ResponseModel
<
Page
<
AircraftDto
>>
queryForPage
(
@RequestParam
(
value
=
"aircraftModel"
,
required
=
false
)
String
aircraftModel
,
@RequestParam
(
value
=
"engineType"
,
required
=
false
)
String
engineType
,
@RequestParam
(
value
=
"fuelType"
,
required
=
false
)
String
fuelType
,
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
AircraftDto
>
page
=
new
Page
<
AircraftDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
queryForAircraftPage
(
page
));
}
/**
*列表全部数据查询
*@return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"航空器信息列表全部数据查询"
,
notes
=
"航空器信息列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
AircraftDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
queryForAircraftList
());
return
ResponseHelper
.
buildResponse
(
aircraftServiceImpl
.
queryForAircraftPage
(
page
,
aircraftModel
,
engineType
,
fuelType
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/AircraftServiceImpl.java
View file @
249ac962
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.StringUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.DataNotFound
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.AircraftFileTypeEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.AircraftMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.FileInfoModel
;
/**
* 航空器信息服务实现类
*
...
...
@@ -16,17 +29,252 @@ import java.util.List;
*/
@Service
public
class
AircraftServiceImpl
extends
BaseService
<
AircraftDto
,
Aircraft
,
AircraftMapper
>
implements
IAircraftService
{
/**
* 分页查询
*/
public
Page
<
AircraftDto
>
queryForAircraftPage
(
Page
<
AircraftDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
/**
*
* <pre>
* 保存
* </pre>
*
* @param agencyCode
* @param aircraftDto
* @return
* @throws Exception
*/
public
AircraftDto
createAircraft
(
String
agencyCode
,
AircraftDto
aircraftDto
)
throws
Exception
{
//持久化航空器信息
aircraftDto
=
this
.
createWithModel
(
aircraftDto
);
//持久化航空器附件信息
saveAircraftFile
(
agencyCode
,
aircraftDto
);
return
aircraftDto
;
}
/**
*
* <pre>
* 编辑航空器信息
* </pre>
*
* @param agencyCode
* @param model
* @return
* @throws Exception
*/
public
AircraftDto
updateAircraft
(
String
agencyCode
,
AircraftDto
model
)
throws
Exception
{
AircraftDto
oldModel
=
this
.
queryBySeq
(
model
.
getSequenceNbr
());
if
(
ValidationUtil
.
isEmpty
(
oldModel
))
throw
new
DataNotFound
(
"找不到指定的航空器信息."
);
//删除附件信息
Systemctl
.
fileInfoClient
.
deleteByAlias
(
agencyCode
,
Aircraft
.
class
.
getSimpleName
(),
String
.
valueOf
(
model
.
getSequenceNbr
()),
null
);
//持久化航空器附件信息
saveAircraftFile
(
agencyCode
,
model
);
return
this
.
updateWithModel
(
Bean
.
copyExistPropertis
(
model
,
oldModel
));
}
/**
*
* <pre>
* 根据航空器主键查询
* </pre>
*
* @param seq
* @return
*/
public
AircraftDto
queryByAircraftSeq
(
String
agencyCode
,
Long
seq
)
{
AircraftDto
aircraftDto
=
this
.
queryBySeq
(
seq
);
//填充航空器附件信息
FeignClientResult
<
List
<
FileInfoModel
>>
fileInfoModelResult
=
Systemctl
.
fileInfoClient
.
queryByEntity
(
agencyCode
,
Aircraft
.
class
.
getSimpleName
(),
String
.
valueOf
(
seq
));
List
<
FileInfoModel
>
fileInfoModels
=
fileInfoModelResult
.
getResult
();
if
(
ValidationUtil
.
isEmpty
(
fileInfoModels
))
{
//外观图
StringBuilder
appearanceImages
=
new
StringBuilder
();
//平面图
StringBuilder
planeImages
=
new
StringBuilder
();
//救援图
StringBuilder
rescueImages
=
new
StringBuilder
();
//方位图
StringBuilder
positionImages
=
new
StringBuilder
();
//三维模型
StringBuilder
models
=
new
StringBuilder
();
for
(
FileInfoModel
fileInfoModel
:
fileInfoModels
)
{
if
(
fileInfoModel
.
getFileCategory
().
equals
(
AircraftFileTypeEnum
.
APPEARANCE
.
getCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
appearanceImages
.
toString
()))
{
appearanceImages
.
append
(
","
);
}
appearanceImages
.
append
(
fileInfoModel
.
getFilename
());
}
else
if
(
fileInfoModel
.
getFileCategory
().
equals
(
AircraftFileTypeEnum
.
PLANE
.
getCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
planeImages
.
toString
()))
{
planeImages
.
append
(
","
);
}
planeImages
.
append
(
fileInfoModel
.
getFilename
());
}
else
if
(
fileInfoModel
.
getFileCategory
().
equals
(
AircraftFileTypeEnum
.
RESCUE
.
getCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
rescueImages
.
toString
()))
{
rescueImages
.
append
(
","
);
}
rescueImages
.
append
(
fileInfoModel
.
getFilename
());
}
else
if
(
fileInfoModel
.
getFileCategory
().
equals
(
AircraftFileTypeEnum
.
POSITION
.
getCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
positionImages
.
toString
()))
{
positionImages
.
append
(
","
);
}
positionImages
.
append
(
fileInfoModel
.
getFilename
());
}
else
if
(
fileInfoModel
.
getFileCategory
().
equals
(
AircraftFileTypeEnum
.
MODEL
.
getCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
models
.
toString
()))
{
models
.
append
(
","
);
}
models
.
append
(
fileInfoModel
.
getFilename
());
}
}
aircraftDto
.
setAppearanceImages
(
appearanceImages
.
toString
());
aircraftDto
.
setPlaneImages
(
planeImages
.
toString
());
aircraftDto
.
setRescueImages
(
rescueImages
.
toString
());
aircraftDto
.
setPositionImages
(
positionImages
.
toString
());
aircraftDto
.
setModels
(
models
.
toString
());
}
return
aircraftDto
;
}
/**
*
* <pre>
* 批量删除
* </pre>
*
* @param ids
* @return
* @throws Exception
*/
@Transactional
(
rollbackFor
=
{
Exception
.
class
,
BaseException
.
class
})
public
List
<
Long
>
multDeleteAircraft
(
String
agencyCode
,
String
ids
)
throws
Exception
{
List
<
Long
>
seqs
=
StringUtil
.
String2LongList
(
ids
);
for
(
Long
id
:
seqs
)
{
//删除附件信息
Systemctl
.
fileInfoClient
.
deleteByAlias
(
agencyCode
,
Aircraft
.
class
.
getSimpleName
(),
String
.
valueOf
(
id
),
null
);
//删除航空器信息
this
.
deleteBySeq
(
id
);
}
return
seqs
;
}
/**
*
* <pre>
* 分页查询
* </pre>
*
* @param page
* @return
*/
public
Page
<
AircraftDto
>
queryForAircraftPage
(
Page
<
AircraftDto
>
page
,
String
aircraftModel
,
String
engineType
,
String
fuelType
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
aircraftModel
,
engineType
,
fuelType
);
}
/**
* 列表查询 示例
*
* <pre>
* 持久化航空器附件信息
* </pre>
*
* @param agencyCode
* @param aircraftDto
* @return
*/
public
List
<
AircraftDto
>
queryForAircraftList
()
{
return
this
.
queryForList
(
""
,
false
);
private
boolean
saveAircraftFile
(
String
agencyCode
,
AircraftDto
aircraftDto
)
throws
Exception
{
List
<
FileInfoModel
>
fileInfoModelList
=
new
ArrayList
<
FileInfoModel
>();
//外观图
if
(!
ValidationUtil
.
isEmpty
(
aircraftDto
.
getAppearanceImages
()))
{
List
<
String
>
appearanceImages
=
StringUtil
.
String2List
(
aircraftDto
.
getAppearanceImages
());
fileInfoModelList
.
addAll
(
buildFileInfo
(
agencyCode
,
appearanceImages
,
aircraftDto
,
AircraftFileTypeEnum
.
APPEARANCE
.
getCode
()));
}
//平面图
if
(!
ValidationUtil
.
isEmpty
(
aircraftDto
.
getPlaneImages
()))
{
List
<
String
>
planeImages
=
StringUtil
.
String2List
(
aircraftDto
.
getPlaneImages
());
fileInfoModelList
.
addAll
(
buildFileInfo
(
agencyCode
,
planeImages
,
aircraftDto
,
AircraftFileTypeEnum
.
PLANE
.
getCode
()));
}
//救援图
if
(!
ValidationUtil
.
isEmpty
(
aircraftDto
.
getRescueImages
()))
{
List
<
String
>
rescueImages
=
StringUtil
.
String2List
(
aircraftDto
.
getRescueImages
());
fileInfoModelList
.
addAll
(
buildFileInfo
(
agencyCode
,
rescueImages
,
aircraftDto
,
AircraftFileTypeEnum
.
RESCUE
.
getCode
()));
}
//方位图
if
(!
ValidationUtil
.
isEmpty
(
aircraftDto
.
getPositionImages
()))
{
List
<
String
>
positionImages
=
StringUtil
.
String2List
(
aircraftDto
.
getPositionImages
());
fileInfoModelList
.
addAll
(
buildFileInfo
(
agencyCode
,
positionImages
,
aircraftDto
,
AircraftFileTypeEnum
.
POSITION
.
getCode
()));
}
//三维模型
if
(!
ValidationUtil
.
isEmpty
(
aircraftDto
.
getModels
()))
{
List
<
String
>
models
=
StringUtil
.
String2List
(
aircraftDto
.
getModels
());
fileInfoModelList
.
addAll
(
buildFileInfo
(
agencyCode
,
models
,
aircraftDto
,
AircraftFileTypeEnum
.
MODEL
.
getCode
()));
}
Systemctl
.
fileInfoClient
.
batchCreateByEntity
(
fileInfoModelList
);
return
true
;
}
/**
*
* <pre>
* 构建文件信息
* </pre>
*
* @param agencyCode
* @param images
* @param aircraftDto
* @param fileCategory
* @return
*/
private
List
<
FileInfoModel
>
buildFileInfo
(
String
agencyCode
,
List
<
String
>
images
,
AircraftDto
aircraftDto
,
String
fileCategory
)
throws
Exception
{
List
<
FileInfoModel
>
fileInfoModelList
=
new
ArrayList
<>();
for
(
String
image
:
images
)
{
FileInfoModel
fileInfoModel
=
new
FileInfoModel
();
fileInfoModel
.
setEntityId
(
String
.
valueOf
(
aircraftDto
.
getSequenceNbr
()));
fileInfoModel
.
setEntityType
(
Aircraft
.
class
.
getSimpleName
());
fileInfoModel
.
setFileCategory
(
fileCategory
);
fileInfoModel
.
setFilename
(
image
);
fileInfoModel
.
setAgencyCode
(
agencyCode
);
fileInfoModelList
.
add
(
fileInfoModel
);
}
return
fileInfoModelList
;
}
}
pom.xml
View file @
249ac962
...
...
@@ -28,7 +28,7 @@
<springcloud.version>
Hoxton.SR8
</springcloud.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
<tyboot-version>
1.1.20Ty-SNAPSHOT
</tyboot-version>
<amos.version>
1.4.
7
</amos.version>
<amos.version>
1.4.
8-SNAPSHOT
</amos.version>
</properties>
<dependencies>
...
...
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