Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
0c0003a7
Commit
0c0003a7
authored
Dec 26, 2019
by
zuoyh
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'saff_update_feature' into dev
parents
2ff4f531
93801ca3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
62 deletions
+111
-62
AppShareholderDetailBiz.java
...b/wxiaoqi/security/admin/biz/AppShareholderDetailBiz.java
+109
-56
AppShareholderDetailController.java
...rity/admin/rest/admin/AppShareholderDetailController.java
+2
-6
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppShareholderDetailBiz.java
View file @
0c0003a7
...
@@ -9,9 +9,11 @@ import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
...
@@ -9,9 +9,11 @@ import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import
com.github.wxiaoqi.security.admin.mapper.AppShareholderDetailMapper
;
import
com.github.wxiaoqi.security.admin.mapper.AppShareholderDetailMapper
;
import
com.github.wxiaoqi.security.admin.vo.AppShareholderDetailVo
;
import
com.github.wxiaoqi.security.admin.vo.AppShareholderDetailVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
...
@@ -263,9 +265,9 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -263,9 +265,9 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
* 批量导入
* 批量导入
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
int
importShareholder
(
List
<
String
[]>
shareholderData
,
Integer
operatorId
)
{
public
Map
<
String
,
Object
>
importShareholder
(
List
<
String
[]>
shareholderData
,
Integer
operatorId
)
{
List
<
AppShareholderDetail
>
appShareholderDetail
=
new
ArrayList
<>();
List
<
AppShareholderDetail
>
appShareholderDetail
=
new
ArrayList
<>();
int
size
=
wrapperData
(
shareholderData
,
operatorId
);
Map
<
String
,
Object
>
mapResult
=
wrapperData
(
shareholderData
,
operatorId
);
/*int threadNums = shareholderData.size() / BORDER_NUM == 0 ? 1 : shareholderData.size() / BORDER_NUM;
/*int threadNums = shareholderData.size() / BORDER_NUM == 0 ? 1 : shareholderData.size() / BORDER_NUM;
CountDownLatch latch = new CountDownLatch(threadNums);
CountDownLatch latch = new CountDownLatch(threadNums);
...
@@ -283,26 +285,48 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -283,26 +285,48 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
throw new BaseException("导入数据失败");
throw new BaseException("导入数据失败");
}
}
}*/
}*/
return
size
;
return
mapResult
;
}
}
/**
/**
* @param subResultDate
* @param subResultDate
*/
*/
private
int
wrapperData
(
List
<
String
[]>
subResultDate
,
Integer
operatorId
)
{
private
Map
<
String
,
Object
>
wrapperData
(
List
<
String
[]>
subResultDate
,
Integer
operatorId
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
1
);
Map
<
String
,
Object
>
errorResultMap
;
List
<
Map
<
String
,
Object
>>
errorResult
=
Lists
.
newArrayList
();
// Map<String, Object> exist;
List
<
Map
<
String
,
Object
>>
existResult
=
Lists
.
newArrayList
();
int
size
=
subResultDate
.
get
(
0
).
length
;
int
size
=
subResultDate
.
get
(
0
).
length
;
int
total
=
0
;
int
total
=
0
;
int
exist
=
0
;
int
error
=
0
;
subResultDate
.
remove
(
0
);
subResultDate
.
remove
(
0
);
for
(
String
[]
data
:
subResultDate
)
{
for
(
String
[]
data
:
subResultDate
)
{
error
++;
data
=
Arrays
.
copyOf
(
data
,
size
);
data
=
Arrays
.
copyOf
(
data
,
size
);
String
name
=
data
[
0
];
String
name
=
data
[
0
];
String
phone
=
data
[
1
];
String
phone
=
data
[
1
];
String
companyName
=
data
[
2
];
String
companyName
=
data
[
2
];
String
time
=
data
[
3
];
String
time
=
data
[
3
];
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
if
(
StringUtils
.
isNotBlank
(
name
)
&&
StringUtils
.
isNotBlank
(
phone
)
&&
StringUtils
.
isNotBlank
(
companyName
))
{
try
{
try
{
total
++;
if
(
StringUtils
.
isBlank
(
phone
))
{
throw
new
BaseException
(
"手机号为空"
);
}
if
(
StringUtils
.
isBlank
(
companyName
))
{
throw
new
BaseException
(
"股东入股公司为空"
);
}
if
(
StringUtils
.
isBlank
(
name
))
{
throw
new
BaseException
(
"股东名称为空"
);
}
if
(
StringUtils
.
isNotBlank
(
name
))
{
name
.
replaceAll
(
" "
,
""
);
}
if
(
StringUtils
.
isNotBlank
(
companyName
))
{
name
.
replaceAll
(
" "
,
""
);
}
Date
relTime
=
StringUtils
.
isNoneBlank
(
time
)
?
formatter
.
parse
(
time
)
:
null
;
Date
relTime
=
StringUtils
.
isNoneBlank
(
time
)
?
formatter
.
parse
(
time
)
:
null
;
BranchCompany
branchCompany
=
vehicleFeign
.
companyId
(
companyName
);
BranchCompany
branchCompany
=
vehicleFeign
.
companyId
(
companyName
);
if
(
branchCompany
!=
null
)
{
if
(
branchCompany
!=
null
)
{
...
@@ -322,6 +346,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -322,6 +346,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
detailBiz
.
updateUserPositionByUserId
(
userId
,
positionId
);
detailBiz
.
updateUserPositionByUserId
(
userId
,
positionId
);
}
}
}
}
exist
++;
appShareholderDetailDTO
.
setUserId
(
userId
);
appShareholderDetailDTO
.
setUserId
(
userId
);
appShareholderDetailDTO
.
setPositionId
(
positionId
);
appShareholderDetailDTO
.
setPositionId
(
positionId
);
appShareholderDetailDTO
.
setCompanyId
(
branchCompany
.
getId
());
appShareholderDetailDTO
.
setCompanyId
(
branchCompany
.
getId
());
...
@@ -333,6 +358,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -333,6 +358,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
appShareholderDetailDTO
.
setCrtTime
(
System
.
currentTimeMillis
());
appShareholderDetailDTO
.
setCrtTime
(
System
.
currentTimeMillis
());
AppShareholderDetail
appShareholderDetail
=
new
AppShareholderDetail
();
AppShareholderDetail
appShareholderDetail
=
new
AppShareholderDetail
();
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
//判断股东表是否有数据,有则不插入
//判断股东表是否有数据,有则不插入
Example
example
=
new
Example
(
AppShareholderDetail
.
class
);
Example
example
=
new
Example
(
AppShareholderDetail
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Example
.
Criteria
criteria
=
example
.
createCriteria
();
...
@@ -343,6 +369,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -343,6 +369,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
}
}
List
<
AppShareholderDetail
>
listappShareholderDetai
=
selectByExample
(
example
);
List
<
AppShareholderDetail
>
listappShareholderDetai
=
selectByExample
(
example
);
if
(
listappShareholderDetai
.
size
()
==
0
)
{
if
(
listappShareholderDetai
.
size
()
==
0
)
{
total
++;
Integer
id
=
appShareholderDetailDTO
.
getId
()
==
null
?
0
:
appShareholderDetailDTO
.
getId
();
Integer
id
=
appShareholderDetailDTO
.
getId
()
==
null
?
0
:
appShareholderDetailDTO
.
getId
();
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
appShareholderDetail
.
setPositionId
(
positionId
);
appShareholderDetail
.
setPositionId
(
positionId
);
...
@@ -353,11 +380,37 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -353,11 +380,37 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
}
}
}
}
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
BaseException
ex
)
{
log
.
error
(
"股东导入失败:【{}】"
,
e
);
errorResultMap
=
new
HashMap
<>(
1
);
errorResultMap
.
put
(
"num"
,
error
);
errorResultMap
.
put
(
"msg"
,
ex
.
getMessage
());
errorResult
.
add
(
errorResultMap
);
}
catch
(
ArrayIndexOutOfBoundsException
ex
)
{
errorResultMap
=
new
HashMap
<>(
1
);
errorResultMap
.
put
(
"num"
,
error
);
String
msg
=
""
;
if
(
StringUtils
.
isEmpty
(
phone
))
{
msg
+=
"手机号码缺失"
;
}
if
(
StringUtils
.
isEmpty
(
companyName
))
{
msg
+=
",股东入股公司确实"
;
}
if
(
StringUtils
.
isEmpty
(
name
))
{
msg
+=
"股东姓名缺失"
;
}
}
errorResultMap
.
put
(
"msg"
,
msg
);
errorResult
.
add
(
errorResultMap
);
}
catch
(
Exception
ex
)
{
errorResultMap
=
new
HashMap
<>(
1
);
errorResultMap
.
put
(
"num"
,
error
);
errorResultMap
.
put
(
"msg"
,
"数据"
+
Arrays
.
toString
(
data
)
+
"保存失败"
);
errorResult
.
add
(
errorResultMap
);
}
}
}
}
return
total
;
result
.
put
(
"success"
,
total
);
result
.
put
(
"error"
,
errorResult
.
size
());
result
.
put
(
"data"
,
errorResult
);
result
.
put
(
"exist"
,
exist
-
total
);
return
result
;
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/admin/AppShareholderDetailController.java
View file @
0c0003a7
...
@@ -51,12 +51,8 @@ public class AppShareholderDetailController {
...
@@ -51,12 +51,8 @@ public class AppShareholderDetailController {
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
}
}
// appShareholderData.remove(0);
// appShareholderData.remove(0);
try
{
return
ObjectRestResponse
.
succ
(
appShareholderDetailBiz
.
importShareholder
(
appShareholderData
,
operatorId
))
int
effectSize
=
appShareholderDetailBiz
.
importShareholder
(
appShareholderData
,
operatorId
);
;
return
ObjectRestResponse
.
succ
(
effectSize
);
}
catch
(
BaseException
ex
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
throw
new
BaseException
(
e
);
}
}
...
...
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