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
ba7fdea5
Commit
ba7fdea5
authored
Dec 24, 2019
by
zuoyh
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'saff_update_feature' into dev
parents
0b825178
862d95b1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
40 deletions
+49
-40
AppShareholderDetailBiz.java
...b/wxiaoqi/security/admin/biz/AppShareholderDetailBiz.java
+47
-38
AppShareholderDetailController.java
...rity/admin/rest/admin/AppShareholderDetailController.java
+2
-2
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppShareholderDetailBiz.java
View file @
ba7fdea5
...
@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
...
@@ -13,6 +13,7 @@ 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.xxfc.platform.im.utils.StringUtil
;
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
;
...
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
...
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -188,16 +190,17 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -188,16 +190,17 @@ 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
userId
,
String
userName
)
{
public
int
importShareholder
(
List
<
String
[]>
shareholderData
)
{
List
<
AppShareholderDetail
>
appShareholderDetail
=
new
ArrayList
<>();
List
<
AppShareholderDetail
>
appShareholderDetail
=
new
ArrayList
<>();
int
threadNums
=
shareholderData
.
size
()
/
BORDER_NUM
==
0
?
1
:
shareholderData
.
size
()
/
BORDER_NUM
;
wrapperData
(
shareholderData
);
/*int threadNums = shareholderData.size() / BORDER_NUM == 0 ? 1 : shareholderData.size() / BORDER_NUM;
CountDownLatch latch = new CountDownLatch(threadNums);
CountDownLatch latch = new CountDownLatch(threadNums);
for (int i = 0; i < threadNums; i++) {
for (int i = 0; i < threadNums; i++) {
int startIndex = i * BORDER_NUM;
int startIndex = i * BORDER_NUM;
int endIndex = i == (threadNums - 1) ? shareholderData.size() : (i + 1) * BORDER_NUM;
int endIndex = i == (threadNums - 1) ? shareholderData.size() : (i + 1) * BORDER_NUM;
List<String[]> subResultDate = shareholderData.subList(startIndex, endIndex);
List<String[]> subResultDate = shareholderData.subList(startIndex, endIndex);
threadPoolTaskExecutor.execute(() -> {
threadPoolTaskExecutor.execute(() -> {
wrapperData
(
subResultDate
);
latch.countDown();
latch.countDown();
});
});
try {
try {
...
@@ -205,7 +208,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -205,7 +208,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
} catch (InterruptedException e) {
} catch (InterruptedException e) {
throw new BaseException("导入数据失败");
throw new BaseException("导入数据失败");
}
}
}
}
*/
return
appShareholderDetail
.
size
();
return
appShareholderDetail
.
size
();
}
}
...
@@ -213,17 +216,21 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -213,17 +216,21 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
* @param subResultDate
* @param subResultDate
*/
*/
private
void
wrapperData
(
List
<
String
[]>
subResultDate
)
{
private
void
wrapperData
(
List
<
String
[]>
subResultDate
)
{
int
size
=
subResultDate
.
get
(
0
).
length
;
subResultDate
.
remove
(
0
);
for
(
String
[]
data
:
subResultDate
)
{
for
(
String
[]
data
:
subResultDate
)
{
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
T
ime
=
data
[
3
];
String
t
ime
=
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
{
Date
relTime
=
formatter
.
parse
(
Time
)
;
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
)
{
if
(
branchCompany
.
getId
()
!=
null
)
{
Integer
positionId
=
branchCompany
.
getId
().
equals
(
1
)
?
HEADQUARTERS_SHAREHOLDER
:
BRANCH_HEADQUARTERS_SHAREHOLDER
;
Integer
positionId
=
branchCompany
.
getId
().
equals
(
1
)
?
HEADQUARTERS_SHAREHOLDER
:
BRANCH_HEADQUARTERS_SHAREHOLDER
;
AppShareholderDetailDTO
appShareholderDetailDTO
=
new
AppShareholderDetailDTO
();
AppShareholderDetailDTO
appShareholderDetailDTO
=
new
AppShareholderDetailDTO
();
//用户表更改其身份
//用户表更改其身份
...
@@ -254,9 +261,11 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
...
@@ -254,9 +261,11 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
BeanUtils
.
copyProperties
(
appShareholderDetailDTO
,
appShareholderDetail
);
mapper
.
insertSelective
(
appShareholderDetail
);
mapper
.
insertSelective
(
appShareholderDetail
);
}
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
log
.
error
(
"股东导入失败:【{}】"
,
e
);
log
.
error
(
"股东导入失败:【{}】"
,
e
);
}
}
}
}
}
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/admin/AppShareholderDetailController.java
View file @
ba7fdea5
...
@@ -44,9 +44,9 @@ public class AppShareholderDetailController {
...
@@ -44,9 +44,9 @@ public class AppShareholderDetailController {
if
(
appShareholderData
.
size
()
<
1
)
{
if
(
appShareholderData
.
size
()
<
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
}
}
appShareholderData
.
remove
(
0
);
//
appShareholderData.remove(0);
try
{
try
{
int
effectSize
=
appShareholderDetailBiz
.
importShareholder
(
appShareholderData
,
Integer
.
valueOf
(
infoFromToken
.
getId
()),
infoFromToken
.
getUniqueName
()
);
int
effectSize
=
appShareholderDetailBiz
.
importShareholder
(
appShareholderData
);
return
ObjectRestResponse
.
succ
(
effectSize
);
return
ObjectRestResponse
.
succ
(
effectSize
);
}
catch
(
BaseException
ex
)
{
}
catch
(
BaseException
ex
)
{
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
...
...
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