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
05a9eed8
Commit
05a9eed8
authored
May 08, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
52176c60
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
8 deletions
+74
-8
EXPersonUser.java
.../yeejoin/amos/boot/module/jxiop/api/dto/EXPersonUser.java
+14
-3
ExStationBasicDto.java
...oin/amos/boot/module/jxiop/api/dto/ExStationBasicDto.java
+4
-0
PersonBasicMapper.xml
...jxiop-api/src/main/resources/mapper/PersonBasicMapper.xml
+1
-1
ExcelController.java
...mos/boot/module/jxiop/biz/controller/ExcelController.java
+13
-3
ExcelServiceImpl.java
.../boot/module/jxiop/biz/service/impl/ExcelServiceImpl.java
+42
-1
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/EXPersonUser.java
View file @
05a9eed8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint
;
import
com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Value
;
import
java.util.Date
;
/**
...
...
@@ -50,6 +54,8 @@ public class EXPersonUser {
@ExcelProperty
(
value
=
"生日"
,
index
=
7
)
@ApiModelProperty
(
value
=
"生日"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
Date
birthday
;
@ExcelProperty
(
value
=
"年龄"
,
index
=
8
)
...
...
@@ -96,8 +102,11 @@ public class EXPersonUser {
@ExcelProperty
(
value
=
"参加工作时间"
,
index
=
17
)
@ApiModelProperty
(
value
=
"参加工作时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
Date
workTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
@ExcelProperty
(
value
=
"进入本单位工作时间"
,
index
=
18
)
@ApiModelProperty
(
value
=
"进入本单位工作时间"
)
private
Date
stationWorkTime
;
...
...
@@ -137,9 +146,9 @@ public class EXPersonUser {
@ApiModelProperty
(
value
=
"技能等级key"
)
private
String
skillLevelKey
;
@ExcelProperty
(
value
=
"专业技术资格等级"
,
index
=
26
)
@ExcelProperty
(
value
=
"专业技
能技
术资格等级"
,
index
=
26
)
@ExplicitConstraint
(
indexNum
=
26
,
source
=
{
"初级"
,
"中级"
,
"副高级"
,
"正高级"
,
"教授级"
})
//固定下拉内容
@ApiModelProperty
(
value
=
"专业技术资格等级"
)
@ApiModelProperty
(
value
=
"专业技
能技
术资格等级"
)
private
String
professionalTechnologyLevelKey
;
@ExcelProperty
(
value
=
"岗位执业鉴定证书"
,
index
=
27
)
...
...
@@ -182,6 +191,8 @@ public class EXPersonUser {
@ExcelProperty
(
value
=
"取证时间"
,
index
=
35
)
@ApiModelProperty
(
value
=
"取证时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
Date
certificateTime
;
@ExcelProperty
(
value
=
"发证机关"
,
index
=
36
)
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/ExStationBasicDto.java
View file @
05a9eed8
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yeejoin.amos.boot.biz.common.excel.CommonExplicitConstraint
;
import
com.yeejoin.amos.boot.biz.common.excel.ExplicitConstraint
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -40,6 +42,8 @@ public class ExStationBasicDto {
private
String
email
;
@ExcelProperty
(
value
=
"运维时间"
,
index
=
7
)
@ApiModelProperty
(
value
=
"运维时间"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
String
devopsTime
;
@ExcelProperty
(
value
=
"运维单位"
,
index
=
8
)
@ApiModelProperty
(
value
=
"运维单位"
)
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/PersonBasicMapper.xml
View file @
05a9eed8
...
...
@@ -144,7 +144,7 @@
person_skill_education.work_name workName,
person_skill_education.professional_technology_name professionalTechnologyName,
person_skill_education.skill_level_key skillLevelKey,
person_skill_education.professional_technology_key professionalTechnologyLevelKey,
person_skill_education.professional_technology_
level_
key professionalTechnologyLevelKey,
person_skill_education.professional_qualification_certificate professionalQualificationCertificate,
person_skill_education.professional_career_certificate professionalCareerCertificate,
person_skill_education.initial_education_key initialEducationKey,
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/ExcelController.java
View file @
05a9eed8
...
...
@@ -6,9 +6,11 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.boot.module.common.api.dto.ExcelDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.ExcelEnums
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.ExcelServiceImpl
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
...
...
@@ -76,14 +78,22 @@ public class ExcelController extends BaseController {
excelEnums
.
getClassUrl
(),
excelEnums
.
getType
());
excelService
.
commonUpload
(
multipartFile
,
excelDto
);
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Runtime
Exception
e
)
{
}
catch
(
InnerInvok
Exception
e
)
{
e
.
printStackTrace
();
throw
new
BadRequest
(
"文件格式不正确或excel 模板不匹配"
);
return
this
.
buildResponseFalse
(
e
.
getMessage
()
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"文件格式不正确或excel 模板不匹配!"
);
}
}
public
ResponseModel
buildResponseFalse
(
String
message
)
{
ResponseModel
response
=
new
ResponseModel
();
response
.
setResult
(
null
);
response
.
setDevMessage
(
"FAILURE"
);
response
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
response
.
setMessage
(
message
);
response
.
setDevMessage
(
message
);
return
response
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/ExcelServiceImpl.java
View file @
05a9eed8
...
...
@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.ExStationBasicDto;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.Util.Constants
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
...
...
@@ -21,7 +23,8 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Service
...
...
@@ -153,6 +156,9 @@ public class ExcelServiceImpl {
fireChemical
.
setPlatformStationId
(
companyModeldata
.
getSequenceNbr
().
toString
());
excelEntityList
.
add
(
fireChemical
);
});
stationBasicServiceImpl
.
saveBatch
(
excelEntityList
);
}
...
...
@@ -206,6 +212,41 @@ private void updateEXPersonUser(MultipartFile multipartFile) throws Exception {
List
<
PersonSkillEducation
>
listPersonSkillEducation
=
new
ArrayList
<>();
List
<
PersonCertificate
>
listPersonCertificate
=
new
ArrayList
<>();
//数据验证
for
(
int
i
=
0
;
i
<
excelDtoList
.
size
();
i
++)
{
//手机号重复
String
regex
=
"0?(13|14|15|18|17)[0-9]{9}"
;
// 正则表达式
if
(
excelDtoList
.
get
(
i
).
getPhone
()!=
null
&&!
excelDtoList
.
get
(
i
).
getPhone
().
matches
(
regex
))
{
throw
new
InnerInvokException
(
"第"
+
(
i
+
2
)
+
"行,手机号码格式错误"
,
"403"
,
"第"
+
(
i
+
2
)
+
"行,手机号码格式错误"
,
403
);
}
//验证数据库重复
QueryWrapper
<
PersonBasic
>
wrapper
=
new
QueryWrapper
();
wrapper
.
eq
(
"phone"
,
excelDtoList
.
get
(
i
).
getPhone
());
List
<
PersonBasic
>
personAccount1
=
personBasicServiceImpl
.
list
(
wrapper
);
if
(!
personAccount1
.
isEmpty
()){
throw
new
InnerInvokException
(
"第"
+
(
i
+
2
)
+
"行,手机号码重复"
,
"403"
,
"第"
+
(
i
+
2
)
+
"行,手机号码重复"
,
403
);
}
//身高和体重 ,字段验证
if
(
excelDtoList
.
get
(
i
).
getWeight
()!=
null
&&(
0
>=
excelDtoList
.
get
(
i
).
getWeight
()||
excelDtoList
.
get
(
i
).
getWeight
()>
200
))
{
throw
new
InnerInvokException
(
"第"
+
(
i
+
2
)
+
"行,体重必须大于0小于等于200"
,
"403"
,
"第"
+
(
i
+
2
)
+
"行,体重必须大于0小于等于200"
,
403
);
}
if
(
excelDtoList
.
get
(
i
).
getHeight
()!=
null
&&(
0
>=
excelDtoList
.
get
(
i
).
getHeight
()||
excelDtoList
.
get
(
i
).
getHeight
()>
200
))
{
throw
new
InnerInvokException
(
"第"
+
(
i
+
2
)
+
"行,身高必须大于0小于等于200"
,
"403"
,
"第"
+
(
i
+
2
)
+
"行,身高必须大于0小于等于200"
,
403
);
}
}
if
(
excelDtoList
!=
null
){
Map
<
Object
,
Long
>
mapGroup
=
excelDtoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
eXPersonUser
->
eXPersonUser
.
getPhone
(),
Collectors
.
counting
()));
List
<
Object
>
stringStream
=
mapGroup
.
entrySet
().
stream
().
filter
(
entry
->
entry
.
getValue
()
>
1
).
map
(
entry
->
entry
.
getKey
()).
collect
(
Collectors
.
toList
());
if
(!
stringStream
.
isEmpty
()){
throw
new
InnerInvokException
(
"导入数据中手机号码存在重复!"
,
"403"
,
"导入数据中手机号码存在重复!"
,
403
);
}
}
for
(
EXPersonUser
exPersonUser
:
excelDtoList
)
{
//根据平台账号获取用户id
QueryWrapper
<
PersonAccount
>
wrapper
=
new
QueryWrapper
();
...
...
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