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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
30 deletions
+31
-30
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+31
-30
No files found.
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
ec6f9069
...
@@ -58,6 +58,7 @@ import java.time.ZoneId;
...
@@ -58,6 +58,7 @@ import java.time.ZoneId;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -1703,7 +1704,7 @@ public class InsureContorll {
...
@@ -1703,7 +1704,7 @@ public class InsureContorll {
@PostMapping
(
value
=
"/replaceUserPolicy"
)
@PostMapping
(
value
=
"/replaceUserPolicy"
)
@ApiOperation
(
value
=
"18.导入替换人员"
,
httpMethod
=
"POST"
,
notes
=
"导入用户"
)
@ApiOperation
(
value
=
"18.导入替换人员"
,
httpMethod
=
"POST"
,
notes
=
"导入用户"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@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
();
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
policyId
).
build
().
selectById
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
XSSFWorkbook
xw
=
null
;
XSSFWorkbook
xw
=
null
;
...
@@ -1786,12 +1787,17 @@ public class InsureContorll {
...
@@ -1786,12 +1787,17 @@ public class InsureContorll {
continue
;
continue
;
}
}
originalUser
.
setReplaceUser
(
replaceUser
);
originalList
.
add
(
originalUser
);
}
}
originalUser
.
setReplaceUser
(
replaceUser
);
originalList
.
add
(
originalUser
);
}
}
/*验证表格信息*/
/*验证表格信息*/
/*新被保人用户Id*/
List
<
String
>
userIdList
=
Lists
.
newArrayList
();
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
)
{
for
(
InsureUser
insureUser
:
originalList
)
{
InsureUser
getInsureUser
=
InsureUser
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsureUser
>().
lambda
()
InsureUser
getInsureUser
=
InsureUser
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsureUser
>().
lambda
()
.
eq
(
InsureUser:
:
getInsuredEContact
,
insureUser
.
getInsuredEContact
()).
eq
(
InsureUser:
:
getInsuredNo
,
insureUser
.
getInsuredNo
())
.
eq
(
InsureUser:
:
getInsuredEContact
,
insureUser
.
getInsuredEContact
()).
eq
(
InsureUser:
:
getInsuredNo
,
insureUser
.
getInsuredNo
())
...
@@ -1800,9 +1806,12 @@ public class InsureContorll {
...
@@ -1800,9 +1806,12 @@ public class InsureContorll {
if
(
getInsureUser
==
null
){
if
(
getInsureUser
==
null
){
return
ResultUtil
.
error
(
insureUser
.
getInsuredEContact
()+
"未投保"
);
return
ResultUtil
.
error
(
insureUser
.
getInsuredEContact
()+
"未投保"
);
}
}
originaInuserUserList
.
add
(
getInsureUser
);
}
replaceUserList
.
stream
().
forEach
(
insureUser
->{
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
()
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
()
.
eq
(
YgglMainEmp:
:
getName
,
insureUser
.
get
ReplaceUser
().
getInsuredName
())
.
eq
(
YgglMainEmp:
:
getName
,
insureUser
.
get
InsuredEContact
())
.
eq
(
YgglMainEmp:
:
getZjNum
,
insureUser
.
getReplaceUser
()
.
getInsuredNo
()));
.
eq
(
YgglMainEmp:
:
getZjNum
,
insureUser
.
getInsuredNo
()));
if
(
ygglMainEmp
==
null
){
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
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
();
qyzxEmpLogin
.
insert
();
...
@@ -1815,12 +1824,13 @@ public class InsureContorll {
...
@@ -1815,12 +1824,13 @@ public class InsureContorll {
ygglMainEmp
.
setIsInsure
(
0
);
ygglMainEmp
.
setIsInsure
(
0
);
ygglMainEmp
.
insert
();
ygglMainEmp
.
insert
();
}
}
insureUser
.
setPolicyDateEnd
(
insurePolicy
.
getPolicyDateEnd
());
insureUser
.
setOrgCode
(
ygglMainEmp
.
getOrgCode
());
insureUser
.
setInsuredMobile
(
ygglMainEmp
.
getPhone
());
insureUser
.
setUserId
(
ygglMainEmp
.
getId
());
userIdList
.
add
(
String
.
valueOf
(
ygglMainEmp
.
getId
()));
userIdList
.
add
(
String
.
valueOf
(
ygglMainEmp
.
getId
()));
});
}
/*上传替换文件到保司服务器*/
/*上传替换文件到保司服务器*/
/*保司返回地址*/
String
url
=
""
;
String
url
=
""
;
xw
.
write
(
bos
);
xw
.
write
(
bos
);
byte
[]
bytes
=
bos
.
toByteArray
();
byte
[]
bytes
=
bos
.
toByteArray
();
...
@@ -1844,12 +1854,6 @@ public class InsureContorll {
...
@@ -1844,12 +1854,6 @@ public class InsureContorll {
.
requestData
(
JSONObject
.
toJSONString
(
bodyMap
)).
createTime
(
new
Date
()).
requestType
(
1
).
returnBody
(
data
).
requestPath
(
uploadUrl2
)
.
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
();
.
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
);
Integer
price
=
getPrice
(
planId
,
categoryId
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
...
@@ -1877,35 +1881,31 @@ public class InsureContorll {
...
@@ -1877,35 +1881,31 @@ public class InsureContorll {
//TODO 写入日志
//TODO 写入日志
return
ResultUtil
.
error
(
"信息填写错误,请查看日志"
);
return
ResultUtil
.
error
(
"信息填写错误,请查看日志"
);
}
else
{
}
else
{
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
userIdList
.
stream
().
toArray
(
String
[]::
new
));
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
insurePolicy
.
getOrgCode
()).
build
().
selectById
();
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
insurePolicy
.
getOrgCode
()).
build
().
selectById
();
ygglMainEmp
List
.
forEach
(
y
->
{
replaceUser
List
.
forEach
(
y
->
{
InsureUser
.
builder
()
InsureUser
.
builder
()
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
price
(
price
.
toString
())
/*前端获取的保费*/
.
price
(
price
.
toString
())
/*前端获取的保费*/
.
premium
(
String
.
valueOf
(
price
*
ygglMainEmp
List
.
size
()))
.
premium
(
String
.
valueOf
(
price
*
replaceUser
List
.
size
()))
.
batchNo
(
batchData
Map
.
get
(
"import_uuid"
).
toString
())
.
batchNo
(
batchData
.
get
(
"import_uuid"
).
toString
())
.
benefitBasicPlan
(
planId
)
.
benefitBasicPlan
(
planId
)
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
userId
(
y
.
getId
())
.
userId
(
y
.
getId
())
.
orgCode
(
y
.
getOrgCode
())
.
orgCode
(
y
.
getOrgCode
())
.
benefitOccupationCategory
(
categoryId
)
.
benefitOccupationCategory
(
categoryId
)
.
insuredMobile
(
y
.
getPhone
())
.
insuredNo
(
y
.
getInsuredNo
())
.
insuredNo
(
y
.
getZjNum
())
.
tricycleFrameNumber
(
y
.
getTricycleFrameNumber
())
.
tricycleFrameNumber
(
oldInsureUserList
.
get
(
0
).
getTricycleFrameNumber
())
.
insuredEContact
(
y
.
getInsuredEContact
())
.
insuredEContact
(
y
.
getName
())
.
applicantEmployeeList
(
batchData
.
get
(
"file_url"
).
toString
())
.
applicantEmployeeList
(
batchDataMap
.
get
(
"file_url"
).
toString
())
.
policyDateStart
(
y
.
getPolicyDateStart
())
.
policyDateStart
(
oldInsureUserList
.
get
(
0
).
getPolicyDateStart
())
.
policyDateEnd
(
y
.
getPolicyDateEnd
())
.
policyDateEnd
(
oldInsureUserList
.
get
(
0
).
getPolicyDateEnd
())
.
applyType
(
3
)
.
applyType
(
3
)
.
createTime
(
new
Date
())
.
createTime
(
new
Date
())
.
status
(
"1"
).
insureStatus
(
3
).
policyId
(
insurePolicy
.
getId
()).
build
().
insert
();
.
status
(
"1"
).
insureStatus
(
3
).
policyId
(
insurePolicy
.
getId
()).
build
().
insert
();
y
.
setIsInsure
(
1
);
y
.
insertOrUpdate
();
});
});
o
ldInsure
UserList
.
forEach
(
o
->
{
o
riginaInuser
UserList
.
forEach
(
o
->
{
o
.
setReplaceTransId
(
batchData
Map
.
get
(
"import_uuid"
).
toString
());
o
.
setReplaceTransId
(
batchData
.
get
(
"import_uuid"
).
toString
());
o
.
updateById
();
o
.
updateById
();
});
});
...
@@ -1915,6 +1915,7 @@ public class InsureContorll {
...
@@ -1915,6 +1915,7 @@ public class InsureContorll {
return
ResultUtil
.
error
(
"导入失败"
);
return
ResultUtil
.
error
(
"导入失败"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
CustomException
(
"导入异常"
);
throw
new
CustomException
(
"导入异常"
);
}
finally
{
}
finally
{
try
{
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