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
f60f463e
Commit
f60f463e
authored
Jun 30, 2021
by
xinglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)修改查询找不到图片问题
parent
2f24142a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
219 deletions
+174
-219
AircraftDto.java
...com/yeejoin/amos/boot/module/jcs/api/dto/AircraftDto.java
+6
-0
Aircraft.java
...com/yeejoin/amos/boot/module/jcs/api/entity/Aircraft.java
+10
-0
AircraftServiceImpl.java
...boot/module/jcs/biz/service/impl/AircraftServiceImpl.java
+158
-219
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/dto/AircraftDto.java
View file @
f60f463e
...
...
@@ -47,6 +47,9 @@ public class AircraftDto extends BaseDto {
@ApiModelProperty
(
value
=
"发动机类型"
)
private
String
engineType
;
@ApiModelProperty
(
value
=
"发动机类型code"
)
private
String
engineTypeCode
;
@ApiModelProperty
(
value
=
"发动机数量"
)
private
Integer
enginesmNum
;
...
...
@@ -56,6 +59,9 @@ public class AircraftDto extends BaseDto {
@ApiModelProperty
(
value
=
"燃油类型"
)
private
String
fuelType
;
@ApiModelProperty
(
value
=
"燃油类型code"
)
private
String
fuelTypeCode
;
@ApiModelProperty
(
value
=
"最大载油量"
)
private
Double
oilLoadMax
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/entity/Aircraft.java
View file @
f60f463e
...
...
@@ -67,6 +67,11 @@ public class Aircraft extends BaseEntity {
@TableField
(
"engine_type"
)
private
String
engineType
;
/**
* 发动机类型code
*/
@TableField
(
"engine_type_code"
)
private
String
engineTypeCode
;
/**
* 发动机数量
*/
@TableField
(
"enginesm_num"
)
...
...
@@ -82,6 +87,11 @@ public class Aircraft extends BaseEntity {
@TableField
(
"fuel_type"
)
private
String
fuelType
;
/**
* 燃油类型code
*/
@TableField
(
"fuel_type_code"
)
private
String
fuelTypeCode
;
/**
* 最大载油量
*/
@TableField
(
"oil_load_max"
)
...
...
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 @
f60f463e
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
;
...
...
@@ -21,38 +9,48 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.FileInfoModel
;
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
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* 航空器信息服务实现类
*
* @author system_generator
* @date 2021-06-29
*/
* 航空器信息服务实现类
*
* @author system_generator
* @date 2021-06-29
*/
@Service
public
class
AircraftServiceImpl
extends
BaseService
<
AircraftDto
,
Aircraft
,
AircraftMapper
>
implements
IAircraftService
{
/**
*
* <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
);
public
class
AircraftServiceImpl
extends
BaseService
<
AircraftDto
,
Aircraft
,
AircraftMapper
>
implements
IAircraftService
{
/**
* <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>
...
...
@@ -63,23 +61,20 @@ public class AircraftServiceImpl extends BaseService<AircraftDto,Aircraft,Aircra
* @throws Exception
*/
public
AircraftDto
updateAircraft
(
String
agencyCode
,
AircraftDto
model
)
throws
Exception
{
AircraftDto
oldModel
=
this
.
queryBySeq
(
model
.
getSequenceNbr
());
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
);
//删除附件信息
Systemctl
.
fileInfoClient
.
deleteByAlias
(
agencyCode
,
Aircraft
.
class
.
getSimpleName
(),
String
.
valueOf
(
model
.
getSequenceNbr
()),
null
);
//持久化航空器附件信息
saveAircraftFile
(
agencyCode
,
model
);
return
this
.
updateWithModel
(
Bean
.
copyExistPropertis
(
model
,
oldModel
));
}
/**
*
* <pre>
* 根据航空器主键查询
* </pre>
...
...
@@ -87,79 +82,25 @@ public class AircraftServiceImpl extends BaseService<AircraftDto,Aircraft,Aircra
* @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
());
}
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
))
{
aircraftDto
.
setAppearanceImages
(
processToStr
(
fileInfoModels
,
AircraftFileTypeEnum
.
APPEARANCE
.
getCode
()));
aircraftDto
.
setPlaneImages
(
processToStr
(
fileInfoModels
,
AircraftFileTypeEnum
.
PLANE
.
getCode
()));
aircraftDto
.
setRescueImages
(
processToStr
(
fileInfoModels
,
AircraftFileTypeEnum
.
RESCUE
.
getCode
()));
aircraftDto
.
setPositionImages
(
processToStr
(
fileInfoModels
,
AircraftFileTypeEnum
.
POSITION
.
getCode
()));
aircraftDto
.
setModels
(
processToStr
(
fileInfoModels
,
AircraftFileTypeEnum
.
MODEL
.
getCode
()));
}
return
aircraftDto
;
}
/**
*
* <pre>
* 批量删除
* </pre>
...
...
@@ -169,112 +110,110 @@ public class AircraftServiceImpl extends BaseService<AircraftDto,Aircraft,Aircra
* @throws Exception
*/
@Transactional
(
rollbackFor
=
{
Exception
.
class
,
BaseException
.
class
})
public
List
<
Long
>
multDeleteAircraft
(
String
agencyCode
,
String
ids
)
throws
Exception
{
List
<
Long
>
seqs
=
StringUtil
.
String2LongList
(
ids
);
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
);
//删除附件信息
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 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
*/
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
()));
}
/**
*
* <pre>
* 持久化航空器附件信息
* </pre>
*
* @param agencyCode
* @param aircraftDto
* @return
*/
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
()));
}
if
(!
ValidationUtil
.
isEmpty
(
fileInfoModelList
))
{
Systemctl
.
fileInfoClient
.
batchCreateByEntity
(
fileInfoModelList
);
}
return
true
;
}
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
);
}
/**
*
* <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
;
}
return
fileInfoModelList
;
}
/**
* 图片转成逗号分割String
* @param fileInfoModels
* @param fileCategory
* @return
*/
private
String
processToStr
(
List
<
FileInfoModel
>
fileInfoModels
,
String
fileCategory
){
return
fileInfoModels
.
stream
().
filter
(
x
->
fileCategory
.
equals
(
x
.
getFileCategory
())).
map
(
FileInfoModel:
:
getFilename
).
collect
(
Collectors
.
joining
(
","
));
}
}
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