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
4935d753
Commit
4935d753
authored
Jul 30, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
0f52741f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
71 deletions
+50
-71
IKeySiteService.java
.../amos/boot/module/common/api/service/IKeySiteService.java
+3
-3
KeySiteController.java
.../boot/module/common/biz/controller/KeySiteController.java
+2
-2
MaintenanceCompanyController.java
...e/common/biz/controller/MaintenanceCompanyController.java
+0
-2
KeySiteServiceImpl.java
...ot/module/common/biz/service/impl/KeySiteServiceImpl.java
+7
-30
MaintenanceCompanyServiceImpl.java
...ommon/biz/service/impl/MaintenanceCompanyServiceImpl.java
+4
-33
SourceFileServiceImpl.java
...module/common/biz/service/impl/SourceFileServiceImpl.java
+33
-0
ExcelController.java
.../amos/boot/module/jcs/biz/controller/ExcelController.java
+1
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IKeySiteService.java
View file @
4935d753
...
...
@@ -19,7 +19,7 @@ public interface IKeySiteService {
* @param id
* @return
*/
public
boolean
deleteb
yId
(
Long
id
);
public
boolean
deleteB
yId
(
Long
id
);
/**
* 保存
* @param model
...
...
@@ -36,7 +36,7 @@ public boolean update (KeySite keySite);
* 获取机场单位组织结构树,包含单位下部门数量的统计
* @return
*/
public
List
<
OrgUsrTreeDto
>
getOrg
u
serTree
();
public
List
<
OrgUsrTreeDto
>
getOrg
U
serTree
();
/**
*
* @return
...
...
@@ -51,5 +51,5 @@ public KeySiteDto getSequenceNbr(Long sequenceNbr);
public
List
<
KeySiteExcleDto
>
exportToExcel
();
public
boolean
saveExcle
(
List
<
KeySiteExcleDto
>
excelDtoList
);
public
boolean
saveExcel
(
List
<
KeySiteExcleDto
>
excelDtoList
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/KeySiteController.java
View file @
4935d753
...
...
@@ -94,7 +94,7 @@ public class KeySiteController extends BaseController {
@DeleteMapping
(
value
=
"delete/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除重点部位"
,
notes
=
"根据sequenceNbr删除重点部位"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
keySiteService
.
delete
b
yId
(
sequenceNbr
));
return
ResponseHelper
.
buildResponse
(
keySiteService
.
delete
B
yId
(
sequenceNbr
));
}
/**
...
...
@@ -151,7 +151,7 @@ public class KeySiteController extends BaseController {
@GetMapping
(
value
=
"/getOrguserTree"
)
public
ResponseModel
<
List
<
OrgMenuDto
>>
getOrguserTree
()
throws
Exception
{
List
<
OrgMenuDto
>
menus
=
iOrgUsrService
.
getTree
(
null
,
keySiteService
.
getOrg
u
serTree
(),
OrgUsrTreeDto
.
class
.
getName
(),
keySiteService
.
getOrg
U
serTree
(),
OrgUsrTreeDto
.
class
.
getName
(),
"getSequenceNbr"
,
2
,
"getBizOrgName"
,
"getParentId"
,
"getNum"
);
return
ResponseHelper
.
buildResponse
(
menus
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/MaintenanceCompanyController.java
View file @
4935d753
...
...
@@ -49,8 +49,6 @@ public class MaintenanceCompanyController extends BaseController {
@Autowired
MaintenanceCompanyServiceImpl
maintenanceCompanyServiceImpl
;
SourceFileServiceImpl
sourceFileService
;
@Autowired
IMaintenanceCompanyService
maintenanceCompanyService
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/KeySiteServiceImpl.java
View file @
4935d753
...
...
@@ -56,17 +56,19 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
/**
* 列表查询 示例
*/
@Override
public
List
<
KeySiteDto
>
queryForKeySiteList
()
{
return
keySiteMapper
.
getKeySiteList
();
}
@Override
public
List
<
KeySiteExcleDto
>
exportToExcel
()
{
List
<
KeySiteDto
>
list
=
this
.
queryForKeySiteList
();
return
JSONArray
.
parseArray
(
JSONArray
.
toJSONString
(
list
),
KeySiteExcleDto
.
class
);
}
@Override
public
boolean
delete
b
yId
(
Long
id
)
{
public
boolean
delete
B
yId
(
Long
id
)
{
KeySite
keySite
=
keySiteMapper
.
selectById
(
id
);
if
(
keySite
==
null
)
{
return
false
;
...
...
@@ -85,37 +87,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
KeySite
keySite
=
new
KeySite
();
Bean
.
copyExistPropertis
(
model
,
keySite
);
this
.
save
(
keySite
);
this
.
saveAttachments
(
model
);
sourceFileService
.
saveAttachments
(
model
.
getSequenceNbr
(),
model
.
getAttachments
()
);
// TODO Auto-generated method stub
return
model
;
}
public
void
saveAttachments
(
KeySiteDto
keySiteDto
)
{
if
(!
ValidationUtil
.
isEmpty
(
keySiteDto
.
getAttachments
()))
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
keySiteDto
.
getAttachments
();
attachmentMap
.
entrySet
().
forEach
(
entry
->
{
List
<
AttachmentDto
>
atts
=
entry
.
getValue
();
sourceFiles
.
addAll
(
attachment2SourceFile
(
entry
.
getKey
(),
atts
));
});
sourceFileService
.
saveSourceFile
(
keySiteDto
.
getSequenceNbr
(),
sourceFiles
);
}
}
private
List
<
SourceFile
>
attachment2SourceFile
(
String
type
,
List
<
AttachmentDto
>
attachmentDtoList
)
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
attachmentDtoList
))
{
attachmentDtoList
.
forEach
(
a
->
{
SourceFile
s
=
new
SourceFile
();
s
.
setFilePath
(
a
.
getUrl
());
s
.
setFileName
(
a
.
getName
());
s
.
setFileCategory
(
type
);
sourceFiles
.
add
(
s
);
});
}
return
sourceFiles
;
}
@Override
public
boolean
update
(
KeySite
keySite
)
{
keySite
.
setIsDelete
(
false
);
int
num
=
keySiteMapper
.
updateById
(
keySite
);
...
...
@@ -126,7 +103,7 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public
List
<
OrgUsrTreeDto
>
getOrg
u
serTree
()
{
public
List
<
OrgUsrTreeDto
>
getOrg
U
serTree
()
{
return
orgUsrMapper
.
getCompanyAndCountDepartment
();
}
...
...
@@ -136,7 +113,7 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public
boolean
saveExc
le
(
List
<
KeySiteExcleDto
>
excelDtoList
)
{
public
boolean
saveExc
el
(
List
<
KeySiteExcleDto
>
excelDtoList
)
{
List
<
KeySite
>
excelList
=
new
ArrayList
<
KeySite
>();
for
(
KeySiteExcleDto
keySiteExcleDto
:
excelDtoList
)
{
KeySite
keySiteDto
=
new
KeySite
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/MaintenanceCompanyServiceImpl.java
View file @
4935d753
...
...
@@ -116,7 +116,7 @@ public class MaintenanceCompanyServiceImpl
try
{
this
.
save
(
maintenanceCompany
);
s
aveAttachments
(
maintenanceCompany
);
s
ourceFileService
.
saveAttachments
(
maintenanceCompany
.
getSequenceNbr
(),
maintenanceCompany
.
getAttachments
()
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
...
...
@@ -144,7 +144,7 @@ public class MaintenanceCompanyServiceImpl
try
{
this
.
save
(
maintenanceCompany
);
s
aveAttachments
(
maintenanceCompany
);
s
ourceFileService
.
saveAttachments
(
maintenanceCompany
.
getSequenceNbr
(),
maintenanceCompany
.
getAttachments
()
);
}
catch
(
Exception
e
)
{
return
false
;
}
...
...
@@ -152,35 +152,6 @@ public class MaintenanceCompanyServiceImpl
}
/**
* 保存附件
*/
public
void
saveAttachments
(
MaintenanceCompany
maintenanceCompany
)
{
if
(!
ValidationUtil
.
isEmpty
(
maintenanceCompany
.
getAttachments
()))
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
maintenanceCompany
.
getAttachments
();
attachmentMap
.
entrySet
().
forEach
(
entry
->
{
List
<
AttachmentDto
>
atts
=
entry
.
getValue
();
sourceFiles
.
addAll
(
attachment2SourceFile
(
entry
.
getKey
(),
atts
));
});
sourceFileService
.
saveSourceFile
(
maintenanceCompany
.
getSequenceNbr
(),
sourceFiles
);
}
}
private
List
<
SourceFile
>
attachment2SourceFile
(
String
type
,
List
<
AttachmentDto
>
attachmentDtoList
)
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
attachmentDtoList
))
{
attachmentDtoList
.
forEach
(
a
->
{
SourceFile
s
=
new
SourceFile
();
s
.
setFilePath
(
a
.
getUrl
());
s
.
setFileName
(
a
.
getName
());
s
.
setFileCategory
(
type
);
sourceFiles
.
add
(
s
);
});
}
return
sourceFiles
;
}
/**
* 添加动态表单信息
*
* @param maintenanceCompany
...
...
@@ -212,7 +183,7 @@ public class MaintenanceCompanyServiceImpl
try
{
this
.
save
(
maintenanceCompany
);
s
aveAttachments
(
maintenanceCompany
);
s
ourceFileService
.
saveAttachments
(
maintenanceCompany
.
getSequenceNbr
(),
maintenanceCompany
.
getAttachments
()
);
}
catch
(
Exception
e
)
{
return
false
;
}
...
...
@@ -488,7 +459,7 @@ public class MaintenanceCompanyServiceImpl
this
.
updateById
(
model
);
// 更新附件
s
aveAttachments
(
model
);
s
ourceFileService
.
saveAttachments
(
model
.
getSequenceNbr
(),
model
.
getAttachments
()
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/SourceFileServiceImpl.java
View file @
4935d753
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.SourceFileDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.SourceFile
;
import
com.yeejoin.amos.boot.module.common.api.mapper.SourceFileMapper
;
...
...
@@ -11,12 +13,14 @@ import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
/**
...
...
@@ -76,4 +80,32 @@ public class SourceFileServiceImpl extends BaseService<SourceFileDto, SourceFile
boolean
flag
=
this
.
saveOrUpdateBatch
(
sourceFiles
);
return
flag
?
sourceFiles
:
Collections
.
EMPTY_LIST
;
}
/**
* 保存附件
*/
public
void
saveAttachments
(
Long
sequenceNbr
,
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
)
{
if
(!
ValidationUtil
.
isEmpty
(
attachmentMap
))
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
attachmentMap
.
entrySet
().
forEach
(
entry
->
{
List
<
AttachmentDto
>
attachments
=
entry
.
getValue
();
sourceFiles
.
addAll
(
attachment2SourceFile
(
entry
.
getKey
(),
attachments
));
});
saveSourceFile
(
sequenceNbr
,
sourceFiles
);
}
}
private
List
<
SourceFile
>
attachment2SourceFile
(
String
type
,
List
<
AttachmentDto
>
attachmentDtoList
)
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
attachmentDtoList
))
{
attachmentDtoList
.
forEach
(
a
->
{
SourceFile
s
=
new
SourceFile
();
s
.
setFilePath
(
a
.
getUrl
());
s
.
setFileName
(
a
.
getName
());
s
.
setFileCategory
(
type
);
sourceFiles
.
add
(
s
);
});
}
return
sourceFiles
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/ExcelController.java
View file @
4935d753
...
...
@@ -285,7 +285,7 @@ public class ExcelController extends BaseController {
private
void
excelImportkeySite
(
MultipartFile
multipartFile
,
String
wbry
)
throws
Exception
{
List
<
KeySiteExcleDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
KeySiteExcleDto
.
class
,
1
);
keySiteService
.
saveExc
le
(
excelDtoList
);
keySiteService
.
saveExc
el
(
excelDtoList
);
}
...
...
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