Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
ec6f9069
Commit
ec6f9069
authored
Jul 04, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改导入替换人员逻辑
parent
3f0bd8b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
29 deletions
+30
-29
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+30
-29
No files found.
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
ec6f9069
...
...
@@ -58,6 +58,7 @@ import java.time.ZoneId;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -1703,7 +1704,7 @@ public class InsureContorll {
@PostMapping
(
value
=
"/replaceUserPolicy"
)
@ApiOperation
(
value
=
"18.导入替换人员"
,
httpMethod
=
"POST"
,
notes
=
"导入用户"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
replaceUserPolicy
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"policyId"
)
Integer
policyId
,
@RequestParam
(
"planId"
)
String
planId
,
@RequestParam
(
"categoryId"
)
String
categoryId
){
public
Result
<
Object
>
replaceUserPolicy
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"policyId"
)
Integer
policyId
,
@RequestParam
(
"planId"
)
String
planId
,
@RequestParam
(
"categoryId"
)
String
categoryId
)
throws
IOException
,
ParseException
{
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
policyId
).
build
().
selectById
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
XSSFWorkbook
xw
=
null
;
...
...
@@ -1786,12 +1787,17 @@ public class InsureContorll {
continue
;
}
}
originalUser
.
setReplaceUser
(
replaceUser
);
originalList
.
add
(
originalUser
);
}
}
/*验证表格信息*/
/*新被保人用户Id*/
List
<
String
>
userIdList
=
Lists
.
newArrayList
();
/*原被保人*/
List
<
InsureUser
>
originaInuserUserList
=
Lists
.
newArrayList
();
/*新被保人*/
List
<
InsureUser
>
replaceUserList
=
originalList
.
stream
().
map
(
InsureUser:
:
getReplaceUser
).
collect
(
Collectors
.
toList
());
for
(
InsureUser
insureUser
:
originalList
)
{
InsureUser
getInsureUser
=
InsureUser
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsureUser
>().
lambda
()
.
eq
(
InsureUser:
:
getInsuredEContact
,
insureUser
.
getInsuredEContact
()).
eq
(
InsureUser:
:
getInsuredNo
,
insureUser
.
getInsuredNo
())
...
...
@@ -1800,9 +1806,12 @@ public class InsureContorll {
if
(
getInsureUser
==
null
){
return
ResultUtil
.
error
(
insureUser
.
getInsuredEContact
()+
"未投保"
);
}
originaInuserUserList
.
add
(
getInsureUser
);
}
replaceUserList
.
stream
().
forEach
(
insureUser
->{
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
()
.
eq
(
YgglMainEmp:
:
getName
,
insureUser
.
get
ReplaceUser
().
getInsuredName
())
.
eq
(
YgglMainEmp:
:
getZjNum
,
insureUser
.
getReplaceUser
()
.
getInsuredNo
()));
.
eq
(
YgglMainEmp:
:
getName
,
insureUser
.
get
InsuredEContact
())
.
eq
(
YgglMainEmp:
:
getZjNum
,
insureUser
.
getInsuredNo
()));
if
(
ygglMainEmp
==
null
){
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
phone
(
String
.
valueOf
(
System
.
currentTimeMillis
())).
pw
(
Md5
.
md5
(
pwd
)).
regTime
(
new
Date
()).
orgId
(
insurePolicy
.
getOrgCode
()).
username
(
insureUser
.
getInsuredEContact
()).
sts
(
CommonEnum
.
U_STS_ON
.
getType
()).
build
();
qyzxEmpLogin
.
insert
();
...
...
@@ -1815,12 +1824,13 @@ public class InsureContorll {
ygglMainEmp
.
setIsInsure
(
0
);
ygglMainEmp
.
insert
();
}
insureUser
.
setPolicyDateEnd
(
insurePolicy
.
getPolicyDateEnd
());
insureUser
.
setOrgCode
(
ygglMainEmp
.
getOrgCode
());
insureUser
.
setInsuredMobile
(
ygglMainEmp
.
getPhone
());
insureUser
.
setUserId
(
ygglMainEmp
.
getId
());
userIdList
.
add
(
String
.
valueOf
(
ygglMainEmp
.
getId
()));
}
});
/*上传替换文件到保司服务器*/
/*保司返回地址*/
String
url
=
""
;
xw
.
write
(
bos
);
byte
[]
bytes
=
bos
.
toByteArray
();
...
...
@@ -1844,12 +1854,6 @@ public class InsureContorll {
.
requestData
(
JSONObject
.
toJSONString
(
bodyMap
)).
createTime
(
new
Date
()).
requestType
(
1
).
returnBody
(
data
).
requestPath
(
uploadUrl2
)
.
returnCode
(
dataMap
.
get
(
"errcode"
).
toString
()).
returnMsg
(
dataMap
.
get
(
"errmsg"
).
toString
()).
fileUrl
(
url
).
build
().
insert
();
List
<
InsureUser
>
oldInsureUserList
=
insureUserMapper
.
selectListByIds
(
originalList
.
stream
().
map
(
InsureUser:
:
getId
).
toArray
(
String
[]::
new
),
insurePolicy
.
getId
(),
null
);
String
[]
oldUser
=
new
String
[
oldInsureUserList
.
size
()];
for
(
int
i
=
0
;
i
<
oldInsureUserList
.
size
();
i
++)
{
oldUser
[
i
]
=
oldInsureUserList
.
get
(
i
).
getUserId
().
toString
();
}
Integer
price
=
getPrice
(
planId
,
categoryId
);
LocalDateTime
now
=
LocalDateTime
.
now
();
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
...
...
@@ -1877,35 +1881,31 @@ public class InsureContorll {
//TODO 写入日志
return
ResultUtil
.
error
(
"信息填写错误,请查看日志"
);
}
else
{
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
userIdList
.
stream
().
toArray
(
String
[]::
new
));
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
insurePolicy
.
getOrgCode
()).
build
().
selectById
();
ygglMainEmp
List
.
forEach
(
y
->
{
replaceUser
List
.
forEach
(
y
->
{
InsureUser
.
builder
()
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
price
(
price
.
toString
())
/*前端获取的保费*/
.
premium
(
String
.
valueOf
(
price
*
ygglMainEmp
List
.
size
()))
.
batchNo
(
batchData
Map
.
get
(
"import_uuid"
).
toString
())
.
premium
(
String
.
valueOf
(
price
*
replaceUser
List
.
size
()))
.
batchNo
(
batchData
.
get
(
"import_uuid"
).
toString
())
.
benefitBasicPlan
(
planId
)
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
userId
(
y
.
getId
())
.
orgCode
(
y
.
getOrgCode
())
.
benefitOccupationCategory
(
categoryId
)
.
insuredMobile
(
y
.
getPhone
())
.
insuredNo
(
y
.
getZjNum
())
.
tricycleFrameNumber
(
oldInsureUserList
.
get
(
0
).
getTricycleFrameNumber
())
.
insuredEContact
(
y
.
getName
())
.
applicantEmployeeList
(
batchDataMap
.
get
(
"file_url"
).
toString
())
.
policyDateStart
(
oldInsureUserList
.
get
(
0
).
getPolicyDateStart
())
.
policyDateEnd
(
oldInsureUserList
.
get
(
0
).
getPolicyDateEnd
())
.
insuredNo
(
y
.
getInsuredNo
())
.
tricycleFrameNumber
(
y
.
getTricycleFrameNumber
())
.
insuredEContact
(
y
.
getInsuredEContact
())
.
applicantEmployeeList
(
batchData
.
get
(
"file_url"
).
toString
())
.
policyDateStart
(
y
.
getPolicyDateStart
())
.
policyDateEnd
(
y
.
getPolicyDateEnd
())
.
applyType
(
3
)
.
createTime
(
new
Date
())
.
status
(
"1"
).
insureStatus
(
3
).
policyId
(
insurePolicy
.
getId
()).
build
().
insert
();
y
.
setIsInsure
(
1
);
y
.
insertOrUpdate
();
});
o
ldInsure
UserList
.
forEach
(
o
->
{
o
.
setReplaceTransId
(
batchData
Map
.
get
(
"import_uuid"
).
toString
());
o
riginaInuser
UserList
.
forEach
(
o
->
{
o
.
setReplaceTransId
(
batchData
.
get
(
"import_uuid"
).
toString
());
o
.
updateById
();
});
...
...
@@ -1915,6 +1915,7 @@ public class InsureContorll {
return
ResultUtil
.
error
(
"导入失败"
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
CustomException
(
"导入异常"
);
}
finally
{
try
{
...
...
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