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
447cbfe0
Commit
447cbfe0
authored
Mar 04, 2026
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):企业管道导出使用单位不导出资质信息问题处理
parent
64d0f0b7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
42 deletions
+163
-42
TcmServiceFeignClient.java
.../amos/boot/module/jg/biz/feign/TcmServiceFeignClient.java
+8
-0
BaseEquipUsedCheckService.java
...module/jg/biz/service/impl/BaseEquipUsedCheckService.java
+110
-13
JgTableDataExportServiceImpl.java
...ule/jg/biz/service/impl/JgTableDataExportServiceImpl.java
+45
-29
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/feign/TcmServiceFeignClient.java
View file @
447cbfe0
...
...
@@ -29,4 +29,12 @@ public interface TcmServiceFeignClient {
@RequestParam
(
required
=
false
,
defaultValue
=
"all"
)
String
type
,
@RequestBody
Map
<
String
,
Object
>
map
);
/**
* 企业信息列表分页查询
*/
@RequestMapping
(
value
=
"/baseEnterprise/getPageList"
,
method
=
RequestMethod
.
GET
)
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
page
(
@RequestParam
(
"current"
)
int
current
,
@RequestParam
(
"size"
)
int
size
,
@RequestParam
(
"keyword"
)
String
keyword
,
@RequestParam
Map
<
String
,
Object
>
map
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/BaseEquipUsedCheckService.java
View file @
447cbfe0
...
...
@@ -55,38 +55,92 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
}
private
void
setUsingData2Redis
(
String
record
,
String
companyCode
,
Set
<
String
>
equipListOfUsed
)
{
String
redisKey
=
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
());
log
.
info
(
"【setUsingData2Redis】start, record={}, companyCode={}, redisKey={}, thread={}"
,
record
,
companyCode
,
redisKey
,
Thread
.
currentThread
().
getName
());
log
.
info
(
"【setUsingData2Redis】before handle, incoming equipListOfUsed={}"
,
equipListOfUsed
);
try
{
if
(
equipListOfUsed
==
null
||
equipListOfUsed
.
isEmpty
())
{
log
.
info
(
"【setUsingData2Redis】equipListOfUsed is null or empty, init new TreeSet"
);
equipListOfUsed
=
new
TreeSet
<>();
}
equipListOfUsed
.
add
(
record
);
getRedisClient
().
getBucket
(
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
())).
set
(
equipListOfUsed
);
FlowingEquipRedisContext
.
setRedisKeyInfo
(
new
FlowingEquipRedisKeyDTO
(
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
()),
Collections
.
singletonList
(
record
)));
boolean
added
=
equipListOfUsed
.
add
(
record
);
log
.
info
(
"【setUsingData2Redis】after add, added={}, currentSet={}"
,
added
,
equipListOfUsed
);
getRedisClient
()
.
getBucket
(
redisKey
)
.
set
(
equipListOfUsed
);
log
.
info
(
"【setUsingData2Redis】redis set success, redisKey={}, value={}"
,
redisKey
,
equipListOfUsed
);
FlowingEquipRedisContext
.
setRedisKeyInfo
(
new
FlowingEquipRedisKeyDTO
(
redisKey
,
Collections
.
singletonList
(
record
))
);
log
.
info
(
"【setUsingData2Redis】FlowingEquipRedisContext set success, redisKey={}, record={}"
,
redisKey
,
record
);
}
catch
(
Exception
e
)
{
log
.
error
(
"【setUsingData2Redis】Exception, record={}, redisKey={}"
,
record
,
redisKey
,
e
);
throw
e
;
}
log
.
info
(
"【setUsingData2Redis】end, record={}, redisKey={}"
,
record
,
redisKey
);
}
@Override
public
void
registrationRepeatUsedCheck
(
String
record
,
String
companyCode
)
{
RLock
lock
=
getRedisClient
().
getLock
(
this
.
getRepeatUsedCheckLockKey
(
companyCode
,
getApplyBizType
(),
record
));
String
lockKey
=
this
.
getRepeatUsedCheckLockKey
(
companyCode
,
getApplyBizType
(),
record
);
String
redisKey
=
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
());
log
.
info
(
"【registrationRepeatUsedCheck】start, record={}, companyCode={}, lockKey={}, redisKey={}"
,
record
,
companyCode
,
lockKey
,
redisKey
);
RLock
lock
=
getRedisClient
().
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
log
.
info
(
"【registrationRepeatUsedCheck】tryLock result={}, record={}, thread={}"
,
isLocked
,
record
,
Thread
.
currentThread
().
getName
());
if
(!
isLocked
)
{
log
.
error
(
"使用登记证:{}在被其他业务使用,加锁失败
"
,
record
);
log
.
error
(
"使用登记证:{}在被其他业务使用,加锁失败
,lockKey={}"
,
record
,
lockKey
);
throw
new
BadRequest
(
"使用登记证已被其他流程使用,请刷新后重试!"
);
}
RBucket
<
Set
<
String
>>
RBucket
=
getRedisClient
().
getBucket
(
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
()));
Set
<
String
>
equipListOfUsed
=
RBucket
.
get
();
RBucket
<
Set
<
String
>>
rBucket
=
getRedisClient
().
getBucket
(
redisKey
);
Set
<
String
>
equipListOfUsed
=
rBucket
.
get
();
log
.
info
(
"【registrationRepeatUsedCheck】redis before check, redisKey={}, currentValue={}"
,
redisKey
,
equipListOfUsed
);
// 查询当前设备在用的申请单号列表
if
(
equipListOfUsed
!=
null
&&
equipListOfUsed
.
contains
(
record
))
{
log
.
error
(
"使用登记证已被其他流程使用,不允许重复提交,使用登记证ID:{}"
,
record
);
log
.
error
(
"使用登记证已被其他流程使用,不允许重复提交,使用登记证ID={}, redisKey={}, redisValue={}"
,
record
,
redisKey
,
equipListOfUsed
);
throw
new
BadRequest
(
"使用登记证已被其他流程使用,不允许重复提交,请联系管理员!"
);
}
log
.
info
(
"【registrationRepeatUsedCheck】准备写入redis, record={}, redisKey={}"
,
record
,
redisKey
);
setUsingData2Redis
(
record
,
companyCode
,
equipListOfUsed
);
Set
<
String
>
afterSet
=
rBucket
.
get
();
log
.
info
(
"【registrationRepeatUsedCheck】redis after write, redisKey={}, value={}"
,
redisKey
,
afterSet
);
}
catch
(
InterruptedException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
"【registrationRepeatUsedCheck】InterruptedException, record={}"
,
record
,
e
);
Thread
.
currentThread
().
interrupt
();
}
catch
(
Exception
e
)
{
log
.
error
(
"【registrationRepeatUsedCheck】Exception, record={}"
,
record
,
e
);
throw
e
;
}
finally
{
if
(
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
log
.
info
(
"【registrationRepeatUsedCheck】unlock success, record={}, lockKey={}"
,
record
,
lockKey
);
}
else
{
log
.
warn
(
"【registrationRepeatUsedCheck】current thread not holding lock, record={}, lockKey={}"
,
record
,
lockKey
);
}
}
log
.
info
(
"【registrationRepeatUsedCheck】end, record={}"
,
record
);
}
private
String
getRepeatUsedCheckLockKey
(
String
companyCode
,
String
bizType
,
String
record
)
{
...
...
@@ -122,11 +176,54 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
*/
@Override
public
void
delDataForCheckEquipRepeatUsed
(
List
<
String
>
records
,
String
companyCode
)
{
RBucket
<
Set
<
String
>>
rBucket
=
getRedisClient
().
getBucket
(
this
.
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
()));
if
(
records
==
null
||
records
.
isEmpty
())
{
log
.
info
(
"delData: records is null or empty"
);
return
;
}
String
lockKey
=
"lock:"
+
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
());
RLock
lock
=
getRedisClient
().
getLock
(
lockKey
);
boolean
locked
=
false
;
try
{
locked
=
lock
.
tryLock
(
5
,
10
,
TimeUnit
.
SECONDS
);
if
(!
locked
)
{
log
.
warn
(
"delData: cannot acquire lock, key={}"
,
lockKey
);
return
;
}
RBucket
<
Set
<
String
>>
rBucket
=
getRedisClient
()
.
getBucket
(
getFlowingEquipRedisKey
(
companyCode
,
getApplyBizType
()));
Set
<
String
>
equipListOfUsed
=
rBucket
.
get
();
if
(
equipListOfUsed
!=
null
){
equipListOfUsed
=
equipListOfUsed
.
stream
().
filter
(
record
->
!
records
.
contains
(
record
)).
collect
(
Collectors
.
toSet
());
rBucket
.
set
(
equipListOfUsed
);
log
.
info
(
"delData: redis original set={}"
,
equipListOfUsed
);
if
(
equipListOfUsed
==
null
)
{
return
;
}
Set
<
String
>
after
=
equipListOfUsed
.
stream
()
.
filter
(
record
->
!
records
.
contains
(
record
))
.
collect
(
Collectors
.
toSet
());
log
.
info
(
"delData: after filter set={}"
,
after
);
rBucket
.
set
(
after
);
Set
<
String
>
verify
=
rBucket
.
get
();
log
.
info
(
"delData: after set verify redis set={}"
,
verify
);
}
catch
(
Exception
e
)
{
log
.
error
(
"delData error"
,
e
);
}
finally
{
if
(
locked
)
{
try
{
lock
.
unlock
();
}
catch
(
Exception
e
)
{
log
.
error
(
"unlock error"
,
e
);
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgTableDataExportServiceImpl.java
View file @
447cbfe0
...
...
@@ -19,7 +19,6 @@ import com.yeejoin.amos.boot.module.jg.api.enums.RegTypeEnum;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.*
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.CbDataDictTypeHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.JczsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TcmServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IJgTableDataExportService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.DictUtil
;
...
...
@@ -31,6 +30,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
...
...
@@ -39,7 +39,6 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
...
...
@@ -104,8 +103,6 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
@Autowired
IdxBizJgProjectContraptionServiceImplService
idxBizJgProjectContraptionService
;
@Autowired
JczsServiceFeignClient
jczsServiceFeignClient
;
@Autowired
TcmServiceFeignClient
tcmServiceFeignClient
;
@Autowired
private
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
...
...
@@ -777,45 +774,45 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
.
fluentPut
(
"time"
,
new
Date
().
getTime
()));
}
private
List
<
String
>
getEnterSeqs
(
String
ids
,
Map
<
String
,
Object
>
map
)
{
private
List
<
Map
<
String
,
String
>>
getEnterList
(
String
ids
,
Map
<
String
,
Object
>
map
)
{
RequestContextWrapper
contextWrapper
=
RequestContextWrapper
.
capture
();
List
<
String
>
ids
List
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
result
List
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
ids
))
{
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
page
=
jczsServiceFeignClient
.
page
(
1
,
PAGE_SIZE
,
null
,
map
);
// 查询第一页
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
page
=
tcmServiceFeignClient
.
page
(
1
,
PAGE_SIZE
,
null
,
map
);
Page
<
Map
<
String
,
String
>>
pageResult
=
page
.
getResult
();
int
totalPage
=
(
int
)
Math
.
ceil
((
double
)
pageResult
.
getTotal
()
/
PAGE_SIZE
);
List
<
CompletableFuture
<
List
<
String
>>>
futures
=
new
ArrayList
<>();
List
<
String
>
idsCollected
=
pageResult
.
getRecords
().
stream
()
.
map
(
item
->
item
.
getOrDefault
(
"sequenceNbr"
,
""
))
.
map
(
String:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
resultList
.
addAll
(
pageResult
.
getRecords
());
List
<
CompletableFuture
<
List
<
Map
<
String
,
String
>>>>
futures
=
new
ArrayList
<>();
for
(
int
i
=
2
;
i
<=
totalPage
;
i
++)
{
int
pageIndex
=
i
;
CompletableFuture
<
List
<
String
>>
future
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
List
<
Map
<
String
,
String
>>>
future
=
CompletableFuture
.
supplyAsync
(()
->
{
contextWrapper
.
apply
();
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
page1
=
jczsServiceFeignClient
.
page
(
pageIndex
,
PAGE_SIZE
,
null
,
map
);
Page
<
Map
<
String
,
String
>>
resultPage
=
page1
.
getResult
();
return
resultPage
.
getRecords
().
stream
()
.
map
(
item
->
item
.
getOrDefault
(
"sequenceNbr"
,
""
))
.
map
(
String:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
pageData
=
tcmServiceFeignClient
.
page
(
pageIndex
,
PAGE_SIZE
,
null
,
map
);
return
pageData
.
getResult
().
getRecords
();
},
executorService
);
futures
.
add
(
future
);
}
for
(
CompletableFuture
<
List
<
String
>>
future
:
futures
)
{
// 等待所有线程完成
for
(
CompletableFuture
<
List
<
Map
<
String
,
String
>>>
future
:
futures
)
{
try
{
idsCollected
.
addAll
(
future
.
get
());
resultList
.
addAll
(
future
.
get
());
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
log
.
error
(
"分页查询线程执行失败"
,
e
);
}
}
idsList
.
addAll
(
idsCollected
);
}
else
{
idsList
.
addAll
(
Arrays
.
asList
(
ids
.
split
(
","
)));
ResponseModel
<
Page
<
Map
<
String
,
String
>>>
page
=
tcmServiceFeignClient
.
page
(
1
,
PAGE_SIZE
,
ids
,
map
);
resultList
.
addAll
(
page
.
getResult
().
getRecords
());
}
return
ids
List
;
return
result
List
;
}
public
static
<
T
,
R
>
List
<
R
>
batchQuery
(
List
<
T
>
list
,
int
batchSize
,
Function
<
List
<
T
>,
List
<
R
>>
function
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
Collections
.
emptyList
();
...
...
@@ -840,10 +837,29 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
@Override
public
void
enterpriseInformationExport
(
String
uuid
,
String
ids
,
Map
<
String
,
Object
>
map
)
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
List
<
String
>
enterSeqs
=
getEnterSeqs
(
ids
,
map
);
List
<
Map
<
String
,
String
>>
enterInfoWithExport
=
batchQuery
(
enterSeqs
,
500
,
sequenceNbrs
->
tzBaseEnterpriseInfoMapper
.
getEnterInfoWithExport
(
sequenceNbrs
));
List
<
BaseEnterpriseVo
>
exportData
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
enterInfoWithExport
),
BaseEnterpriseVo
.
class
);
List
<
Map
<
String
,
String
>>
enterSeqs
=
getEnterList
(
ids
,
map
);
List
<
Map
<
String
,
String
>>
source
=
enterSeqs
;
boolean
hasUseUnit
=
Optional
.
ofNullable
(
map
.
get
(
"unitTypeList"
))
.
map
(
Object:
:
toString
)
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
map
(
s
->
Arrays
.
stream
(
s
.
split
(
","
))
.
map
(
String:
:
trim
)
.
anyMatch
(
t
->
t
.
contains
(
"使用单位"
)
||
t
.
contains
(
"个人主体"
)))
.
orElse
(
false
);
if
(!
hasUseUnit
)
{
source
=
batchQuery
(
enterSeqs
,
500
,
batch
->
{
List
<
String
>
sequenceNbrs
=
batch
.
stream
()
.
map
(
m
->
m
.
get
(
"sequenceNbr"
))
.
filter
(
ObjectUtils:
:
isNotEmpty
)
.
collect
(
Collectors
.
toList
());
return
tzBaseEnterpriseInfoMapper
.
getEnterInfoWithExport
(
sequenceNbrs
);
}
);
}
List
<
BaseEnterpriseVo
>
exportData
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
source
),
BaseEnterpriseVo
.
class
);
exportData
.
forEach
(
item
->
{
String
categoryJson
=
item
.
getEquipCategory
();
if
(
categoryJson
!=
null
&&
!
categoryJson
.
isEmpty
())
{
...
...
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