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
181926e9
Commit
181926e9
authored
Jun 21, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.报检规则增加不予处理
parent
ccaea804
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
67 deletions
+130
-67
RuleActionHandler.java
...n/amos/boot/module/jyjc/biz/action/RuleActionHandler.java
+49
-37
InspectionOrgRefreshListener.java
...odule/jyjc/biz/listener/InspectionOrgRefreshListener.java
+24
-28
InspectionEquipInfo.java
...n/amos/boot/module/jyjc/biz/rule/InspectionEquipInfo.java
+3
-0
JyjcInspectionApplicationServiceImpl.java
...iz/service/impl/JyjcInspectionApplicationServiceImpl.java
+11
-2
RuleCommonServiceImpl.java
...t/module/jyjc/biz/service/impl/RuleCommonServiceImpl.java
+43
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/action/RuleActionHandler.java
View file @
181926e9
...
...
@@ -2,22 +2,23 @@ package com.yeejoin.amos.boot.module.jyjc.biz.action;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.
baomidou.mybatisplus.core.toolkit.Wrapper
s
;
import
com.
yeejoin.amos.boot.biz.common.utils.RedisUtil
s
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.InspectionCompanyType
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.LicenceTypeEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.OpenBizTypeEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.TopicEnum
;
import
com.yeejoin.amos.boot.module.jyjc.biz.rule.InspectionEquipInfo
;
import
com.yeejoin.amos.boot.module.jyjc.biz.service.impl.RuleCommonServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseUnitLicence
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseUnitLicenceMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper
;
import
com.yeejoin.amos.component.rule.config.RuleConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
...
...
@@ -26,6 +27,7 @@ import java.time.LocalDate;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -39,26 +41,26 @@ public class RuleActionHandler {
private
final
EmqKeeper
emqKeeper
;
private
final
TzBaseUnitLicenceMapper
baseUnitLicenceMapper
;
private
final
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
;
private
final
UseInfoMapper
useInfoMapper
;
/**
* 特殊独立的区县
*/
private
static
final
String
[]
EXCLUSION_CITY_REGIONS
=
{
"610403"
,
"610581"
};
private
final
RuleCommonServiceImpl
ruleCommonService
;
private
final
RedissonClient
redissonClient
;
private
RedisUtils
redisUtils
;
/**
* 省特检院公司code
* 省特检院
等特殊
公司code
*/
@Value
(
"${
province.inspection.company.code:126100004352004822
}"
)
private
String
province
InspectionCompanyCode
;
@Value
(
"${
special.inspection.company.code:126100004352004822,12100000400001774F,91340100MA8QN8Q40G
}"
)
private
String
special
InspectionCompanyCode
;
public
RuleActionHandler
(
EmqKeeper
emqKeeper
,
TzBaseUnitLicenceMapper
baseUnitLicenceMapper
,
TzBaseEnterpriseInfoMapper
tzBaseEnterpriseInfoMapper
,
UseInfoMapper
useInfoMapper
)
{
RuleCommonServiceImpl
ruleCommonService
,
RedissonClient
redissonClient
,
RedisUtils
redisUtils
)
{
this
.
emqKeeper
=
emqKeeper
;
this
.
baseUnitLicenceMapper
=
baseUnitLicenceMapper
;
this
.
tzBaseEnterpriseInfoMapper
=
tzBaseEnterpriseInfoMapper
;
this
.
useInfoMapper
=
useInfoMapper
;
this
.
ruleCommonService
=
ruleCommonService
;
this
.
redissonClient
=
redissonClient
;
this
.
redisUtils
=
redisUtils
;
}
/**
...
...
@@ -75,17 +77,41 @@ public class RuleActionHandler {
public
void
filterInspectionOrgAction
(
Object
bizObj
,
String
itemCode
,
Boolean
isMatchArea
,
String
defaultInspectionCode
,
String
legalInspectionCodes
,
String
inspectionCompanyType
,
Boolean
isMatchItem
)
{
log
.
info
(
"收到首次提交的检验机构匹配规则回调:请求变量参数:{},核对项目编码:{},是否进行属地过滤:{},默认的检验机构code:{}, 法定的检验机构code:{}, 法定的检验机构code: {},是否需要匹配核准代码:{}"
,
bizObj
,
itemCode
,
isMatchArea
,
defaultInspectionCode
,
legalInspectionCodes
,
inspectionCompanyType
,
isMatchItem
);
InspectionEquipInfo
inspectionEquipInfo
=
(
InspectionEquipInfo
)
bizObj
;
// 规则不支持或者的关系消息会重复故去重处理
RLock
lock
=
redissonClient
.
getLock
(
this
.
buildLockKey
(
"filterInspectionOrgAction"
,
inspectionEquipInfo
.
getUuid
()));
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
if
(!
isLocked
)
{
log
.
warn
(
"规则回填重复丢弃:请求变量参数:{},核对项目编码:{},是否进行属地过滤:{},默认的检验机构code:{}, 法定的检验机构code:{}, 法定的检验机构code: {},是否需要匹配核准代码:{}"
,
bizObj
,
itemCode
,
isMatchArea
,
defaultInspectionCode
,
legalInspectionCodes
,
inspectionCompanyType
,
isMatchItem
);
return
;
}
if
(
redisUtils
.
hasKey
(
this
.
buildRedisDataKey
(
"filterInspectionOrgAction"
,
inspectionEquipInfo
.
getUuid
())))
{
log
.
warn
(
"规则回填重复丢弃:请求变量参数:{},核对项目编码:{},是否进行属地过滤:{},默认的检验机构code:{}, 法定的检验机构code:{}, 法定的检验机构code: {},是否需要匹配核准代码:{}"
,
bizObj
,
itemCode
,
isMatchArea
,
defaultInspectionCode
,
legalInspectionCodes
,
inspectionCompanyType
,
isMatchItem
);
return
;
}
redisUtils
.
set
(
this
.
buildRedisDataKey
(
"filterInspectionOrgAction"
,
inspectionEquipInfo
.
getUuid
()),
inspectionEquipInfo
.
getUuid
(),
3600
);
// 1.获取所有的符合资质条件的单位许可信息
List
<
TzBaseUnitLicence
>
unitLicenceList
=
getBaseUnitLicenceList
(
itemCode
,
isMatchItem
);
// 2.匹配过滤机构信息,默认检验机构(目前检测没配置规则,后续检测也需要配置规则时,需要规则那回调方法新增参数,区分检验还是检测)
List
<
TzBaseEnterpriseInfoDto
>
tzBaseEnterpriseInfoList
=
getInspectionUnitListForFirstCommit
(
unitLicenceList
,
isMatchArea
,
inspectionEquipInfo
.
getRecord
()
,
OpenBizTypeEnum
.
JY
.
getCode
(),
defaultInspectionCode
,
legalInspectionCodes
);
List
<
TzBaseEnterpriseInfoDto
>
tzBaseEnterpriseInfoList
=
getInspectionUnitListForFirstCommit
(
unitLicenceList
,
isMatchArea
,
inspectionEquipInfo
,
OpenBizTypeEnum
.
JY
.
getCode
(),
defaultInspectionCode
,
legalInspectionCodes
);
publishMqttMessage
(
inspectionEquipInfo
.
getComponentKey
(),
tzBaseEnterpriseInfoList
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
|
InterruptedException
e
)
{
log
.
error
(
"Error publishing MQTT message: {}"
,
e
.
getMessage
());
}
finally
{
if
(
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
}
}
}
private
String
buildLockKey
(
String
type
,
String
uuid
)
{
return
String
.
format
(
"%s-%s"
,
type
,
uuid
);
}
private
String
buildRedisDataKey
(
String
type
,
String
uuid
)
{
return
String
.
format
(
"RECEIVED-UUID-RULE:%s-%s"
,
type
,
uuid
);
}
/**
* 规则回调方法-不予受理的检验机构匹配
...
...
@@ -104,7 +130,7 @@ public class RuleActionHandler {
// 1.获取所有的符合资质条件的单位许可信息
List
<
TzBaseUnitLicence
>
unitLicenceList
=
getBaseUnitLicenceList
(
itemCode
,
isMatchItem
);
// 2.匹配过滤机构信息,默认检验机构(目前检测没配置规则,后续检测也需要配置规则时,需要规则那回调方法新增参数,区分检验还是检测)
List
<
TzBaseEnterpriseInfoDto
>
tzBaseEnterpriseInfoList
=
getInspectionUnitListForNoAccept
(
unitLicenceList
,
isMatchArea
,
inspectionEquipInfo
.
getRecord
()
,
OpenBizTypeEnum
.
JY
.
getCode
(),
defaultInspectionCode
,
legalInspectionCodes
,
inspectionCompanyType
);
List
<
TzBaseEnterpriseInfoDto
>
tzBaseEnterpriseInfoList
=
getInspectionUnitListForNoAccept
(
unitLicenceList
,
isMatchArea
,
inspectionEquipInfo
,
OpenBizTypeEnum
.
JY
.
getCode
(),
defaultInspectionCode
,
legalInspectionCodes
,
inspectionCompanyType
);
publishMqttMessage
(
inspectionEquipInfo
.
getComponentKey
(),
tzBaseEnterpriseInfoList
);
}
catch
(
MqttException
e
)
{
log
.
error
(
"Error publishing MQTT message: {}"
,
e
.
getMessage
());
...
...
@@ -128,9 +154,9 @@ public class RuleActionHandler {
return
tzBaseUnitLicences
;
}
private
List
<
TzBaseEnterpriseInfoDto
>
getInspectionUnitListForNoAccept
(
List
<
TzBaseUnitLicence
>
unitLicenceList
,
Boolean
isMatchArea
,
String
record
,
String
openBizType
,
String
defaultInspectionCode
,
String
legalInspectionCodes
,
String
inspectionCompanyType
)
{
private
List
<
TzBaseEnterpriseInfoDto
>
getInspectionUnitListForNoAccept
(
List
<
TzBaseUnitLicence
>
unitLicenceList
,
Boolean
isMatchArea
,
InspectionEquipInfo
inspectionEquipInfo
,
String
openBizType
,
String
defaultInspectionCode
,
String
legalInspectionCodes
,
String
inspectionCompanyType
)
{
// 是否进行属地过滤
String
areaCode
=
isMatchArea
?
this
.
getArea
(
record
)
:
""
;
String
areaCode
=
isMatchArea
?
inspectionEquipInfo
.
getAreaCode
(
)
:
""
;
// 所有符合单位的code
List
<
String
>
unitCodes
=
unitLicenceList
.
stream
().
map
(
TzBaseUnitLicence:
:
getUnitCode
).
collect
(
Collectors
.
toList
());
List
<
TzBaseEnterpriseInfoDto
>
matchEnterpriseInfos
=
new
ArrayList
<>();
...
...
@@ -154,15 +180,15 @@ public class RuleActionHandler {
if
(
matchEnterpriseInfos
.
isEmpty
())
{
log
.
info
(
"指定的默认的检验机构未匹配到,将返回所有的检验机构包括第三方和法定检验机构,省特检院除外"
);
matchEnterpriseInfos
=
tzBaseEnterpriseInfoMapper
.
getInspectionUnitListByCode
(
null
,
null
,
openBizType
);
matchEnterpriseInfos
=
matchEnterpriseInfos
.
stream
().
filter
(
c
->
!
province
InspectionCompanyCode
.
contains
(
c
.
getUseCode
())).
collect
(
Collectors
.
toList
());
matchEnterpriseInfos
=
matchEnterpriseInfos
.
stream
().
filter
(
c
->
!
special
InspectionCompanyCode
.
contains
(
c
.
getUseCode
())).
collect
(
Collectors
.
toList
());
log
.
info
(
"指定的默认的检验机构未匹配到,将返回所有的检验机构包括第三方和法定检验机构,数据为:{}"
,
matchEnterpriseInfos
);
}
return
matchEnterpriseInfos
;
}
private
List
<
TzBaseEnterpriseInfoDto
>
getInspectionUnitListForFirstCommit
(
List
<
TzBaseUnitLicence
>
unitLicenceList
,
Boolean
isMatchArea
,
String
record
,
String
openBizType
,
String
defaultInspectionCode
,
String
legalInspectionCodes
)
{
private
List
<
TzBaseEnterpriseInfoDto
>
getInspectionUnitListForFirstCommit
(
List
<
TzBaseUnitLicence
>
unitLicenceList
,
Boolean
isMatchArea
,
InspectionEquipInfo
inspectionEquipInfo
,
String
openBizType
,
String
defaultInspectionCode
,
String
legalInspectionCodes
)
{
// 是否进行属地过滤
String
areaCode
=
isMatchArea
?
this
.
getArea
(
record
)
:
""
;
String
areaCode
=
isMatchArea
?
inspectionEquipInfo
.
getAreaCode
(
)
:
""
;
// 所有符合单位的code
List
<
String
>
unitCodes
=
unitLicenceList
.
stream
()
.
map
(
TzBaseUnitLicence:
:
getUnitCode
)
...
...
@@ -183,25 +209,11 @@ public class RuleActionHandler {
if
(
matchEnterpriseInfos
.
isEmpty
())
{
log
.
info
(
"指定的默认的检验机构未匹配到,将返回所有的检验机构包括第三方和法定检验机构,省特检院除外"
);
matchEnterpriseInfos
=
tzBaseEnterpriseInfoMapper
.
getInspectionUnitListByCode
(
null
,
null
,
openBizType
);
matchEnterpriseInfos
=
matchEnterpriseInfos
.
stream
().
filter
(
c
->
!
province
InspectionCompanyCode
.
contains
(
c
.
getUseCode
())).
collect
(
Collectors
.
toList
());
matchEnterpriseInfos
=
matchEnterpriseInfos
.
stream
().
filter
(
c
->
!
special
InspectionCompanyCode
.
contains
(
c
.
getUseCode
())).
collect
(
Collectors
.
toList
());
}
return
matchEnterpriseInfos
;
}
private
String
getArea
(
String
record
)
{
UseInfo
equipUseInfo
=
useInfoMapper
.
selectOne
(
Wrappers
.<
UseInfo
>
lambdaQuery
().
select
(
UseInfo:
:
getCity
,
UseInfo:
:
getCounty
).
eq
(
UseInfo:
:
getRecord
,
record
));
if
(
equipUseInfo
==
null
)
{
return
""
;
}
// 特殊地区特殊处理,目前有韩城、杨凌,原因行政区划上是有层级的,但是业务办理时,他们与所在地市是同级别的
if
(
StringUtils
.
isEmpty
(
equipUseInfo
.
getCity
())
||
StringUtils
.
isEmpty
(
equipUseInfo
.
getCounty
()))
{
return
""
;
}
if
(
Arrays
.
asList
(
EXCLUSION_CITY_REGIONS
).
contains
(
equipUseInfo
.
getCounty
()))
{
return
equipUseInfo
.
getCounty
();
}
return
equipUseInfo
.
getCity
();
}
private
void
publishMqttMessage
(
String
componentKey
,
Object
message
)
throws
MqttException
{
log
.
info
(
"报检规则推送到web主题:{}:,消息内容为:{}"
,
String
.
format
(
TopicEnum
.
INSPECTION_LIST_PUSH
.
getTopic
(),
componentKey
),
JSON
.
toJSONString
(
message
));
...
...
@@ -216,7 +228,7 @@ public class RuleActionHandler {
public
List
<
TzBaseEnterpriseInfoDto
>
getInspectionUnitList
(
List
<
TzBaseUnitLicence
>
unitLicenceList
,
Boolean
isMatchArea
,
String
record
,
String
openBizType
)
{
// 是否进行属地过滤
String
areaCode
=
isMatchArea
?
this
.
getArea
(
record
)
:
""
;
String
areaCode
=
isMatchArea
?
ruleCommonService
.
getArea
(
record
)
:
""
;
// 所有符合单位的code
List
<
String
>
unitCodes
=
unitLicenceList
.
stream
().
map
(
TzBaseUnitLicence:
:
getUnitCode
).
collect
(
Collectors
.
toList
());
List
<
TzBaseEnterpriseInfoDto
>
matchEnterpriseInfos
=
new
ArrayList
<>();
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/listener/InspectionOrgRefreshListener.java
View file @
181926e9
...
...
@@ -13,10 +13,10 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.InspectionEquipInfoModel;
import
com.yeejoin.amos.boot.module.jyjc.biz.event.listener.InspectionApplicationPushEventListener
;
import
com.yeejoin.amos.boot.module.jyjc.biz.listener.message.BizMessage
;
import
com.yeejoin.amos.boot.module.jyjc.biz.rule.InspectionEquipInfo
;
import
com.yeejoin.amos.boot.module.jyjc.biz.service.impl.RuleCommonServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.rule.Rule
;
import
com.yeejoin.amos.feign.rule.model.FactBaseModel
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -53,12 +53,13 @@ public class InspectionOrgRefreshListener extends EmqxListener {
@Value
(
"${inspection.rule.project-name:报检规则}"
)
private
String
ruleName
;
@Autowired
private
EmqKeeper
emqKeeper
;
@Autowired
private
RuleTrigger
ruleTrigger
;
@Autowired
private
AmosRequestContext
amosRequestContext
;
@Autowired
private
RegistrationInfoMapper
registrationInfoMapper
;
...
...
@@ -74,13 +75,14 @@ public class InspectionOrgRefreshListener extends EmqxListener {
@Autowired
Sequence
sequence
;
@Autowired
private
static
final
int
repeatTime
=
2
;
private
static
final
int
REPEAT_TIME
=
2
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
RuleCommonServiceImpl
ruleCommonService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
if
(
log
.
isInfoEnabled
())
{
...
...
@@ -105,10 +107,10 @@ public class InspectionOrgRefreshListener extends EmqxListener {
BizMessage
bizMessage
=
BLOCKING_QUEUE
.
take
();
// 解决前端组件在属性变化时重复发送两次问题
if
(!
redisUtils
.
hasKey
(
bizMessage
.
getTopic
()))
{
redisUtils
.
set
(
bizMessage
.
getTopic
(),
true
,
repeatTime
);
redisUtils
.
set
(
bizMessage
.
getTopic
(),
true
,
REPEAT_TIME
);
processBizMessage
(
bizMessage
);
}
else
{
log
.
warn
(
"消息在{}秒内重复,"
,
repeatTime
);
log
.
warn
(
"消息在{}秒内重复,"
,
REPEAT_TIME
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"数据处理失败"
,
e
);
...
...
@@ -133,21 +135,31 @@ public class InspectionOrgRefreshListener extends EmqxListener {
inspectionEquipInfo
.
setRecord
(
equipInfoModel
.
getRecord
());
inspectionEquipInfo
.
setBizType
(
getCategoryByType
(
JYJCTypeEnum
.
of
(
inspectionEquipInfo
.
getInspectionType
())));
inspectionEquipInfo
.
setUuid
(
sequence
.
nextId
()
+
""
);
inspectionEquipInfo
.
setRequestType
(
this
.
buildRequestType
(
equipInfoModel
));
inspectionEquipInfo
.
setTechParams
(
this
.
getTechParams
(
registrationInfo
));
inspectionEquipInfo
.
setAreaCode
(
ruleCommonService
.
getArea
(
equipInfoModel
.
getRecord
()));
JyjcInspectionApplicationNoAcceptLog
jyjcInspectionApplicationNoAcceptLog
=
getLastNoAcceptLog
(
equipInfoModel
);
inspectionEquipInfo
.
setRequestType
(
this
.
buildRequestType
(
equipInfoModel
,
jyjcInspectionApplicationNoAcceptLog
));
inspectionEquipInfo
.
setLastNoAcceptInspectionCode
(
this
.
buildLastNoAcceptInspectionCode
(
jyjcInspectionApplicationNoAcceptLog
));
touchRuleWithApi
(
inspectionEquipInfo
);
}
private
String
buildLastNoAcceptInspectionCode
(
JyjcInspectionApplicationNoAcceptLog
jyjcInspectionApplicationNoAcceptLog
)
{
if
(
jyjcInspectionApplicationNoAcceptLog
!=
null
)
{
return
jyjcInspectionApplicationNoAcceptLog
.
getInspectionUnitCode
();
}
return
""
;
}
private
Map
<
String
,
Object
>
getTechParams
(
RegistrationInfo
registrationInfo
)
{
return
applicationPushEventListener
.
populateEquipInfoWithTechParams
(
registrationInfo
.
getEquList
(),
registrationInfo
.
getRecord
());
}
private
String
buildRequestType
(
InspectionEquipInfoModel
equipInfoModel
)
{
private
String
buildRequestType
(
InspectionEquipInfoModel
equipInfoModel
,
JyjcInspectionApplicationNoAcceptLog
jyjcInspectionApplicationNoAcceptLog
)
{
// 工作台发起申请
if
(
StringUtils
.
isEmpty
(
equipInfoModel
.
getAppSeq
()))
{
return
RequestTypeEnum
.
FIRST_REQUEST
.
getCode
();
}
JyjcInspectionApplicationNoAcceptLog
jyjcInspectionApplicationNoAcceptLog
=
getLastNoAcceptLog
(
equipInfoModel
);
// 没有不予受理请求记录
if
(
jyjcInspectionApplicationNoAcceptLog
==
null
)
{
return
RequestTypeEnum
.
FIRST_REQUEST
.
getCode
();
...
...
@@ -159,7 +171,7 @@ public class InspectionOrgRefreshListener extends EmqxListener {
private
JyjcInspectionApplicationNoAcceptLog
getLastNoAcceptLog
(
InspectionEquipInfoModel
equipInfoModel
)
{
LambdaQueryWrapper
<
JyjcInspectionApplicationNoAcceptLog
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
JyjcInspectionApplicationNoAcceptLog:
:
getApplicationSeq
,
equipInfoModel
.
getAppSeq
());
wrapper
.
orderByDesc
(
JyjcInspectionApplicationNoAcceptLog:
:
get
NoAccept
Date
);
wrapper
.
orderByDesc
(
JyjcInspectionApplicationNoAcceptLog:
:
get
Rec
Date
);
wrapper
.
last
(
"limit 1"
);
wrapper
.
select
(
JyjcInspectionApplicationNoAcceptLog:
:
getApplicationSeq
,
JyjcInspectionApplicationNoAcceptLog:
:
getInspectionUnitCode
);
return
inspectionApplicationNoAcceptLogMapper
.
selectOne
(
wrapper
);
...
...
@@ -172,22 +184,6 @@ public class InspectionOrgRefreshListener extends EmqxListener {
.
eq
(
RegistrationInfo:
:
getRecord
,
record
));
}
private
void
touchRuleWithMsg
(
InspectionEquipInfo
inspectionEquipInfo
)
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"发送规则的消息对象:{}"
,
toJSONString
(
inspectionEquipInfo
));
}
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
// 2.调用规则
try
{
ruleTrigger
.
publish
(
inspectionEquipInfo
,
ruleName
+
"/"
+
inspectionEquipInfo
.
getBizType
(),
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则触发获取报检规则失败"
,
e
);
}
}
private
void
touchRuleWithApi
(
InspectionEquipInfo
inspectionEquipInfo
)
{
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"发送规则的消息对象:{}"
,
toJSONString
(
inspectionEquipInfo
));
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/rule/InspectionEquipInfo.java
View file @
181926e9
...
...
@@ -51,4 +51,7 @@ public class InspectionEquipInfo implements Serializable {
@ApiModelProperty
(
value
=
"最近不受理检验机构code"
)
private
String
lastNoAcceptInspectionCode
;
@ApiModelProperty
(
value
=
"所在区域"
)
private
String
areaCode
;
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcInspectionApplicationServiceImpl.java
View file @
181926e9
...
...
@@ -177,6 +177,12 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
private
static
final
String
SUMMIT_TYPE
=
"0"
;
/**
* 省特检院等特殊公司code
*/
@Value
(
"${shanxi.tjy.code:126100004352004822}"
)
private
String
shanxiCompanyCode
;
@Autowired
RestHighLevelClient
restHighLevelClient
;
...
...
@@ -565,6 +571,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public
Map
<
String
,
Object
>
selectBySeq
(
Long
sequenceNbr
)
{
JyjcInspectionApplicationModel
model
=
this
.
getBaseMapper
().
selectDataBySeq
(
sequenceNbr
);
int
times
=
noAcceptLogService
.
count
(
new
LambdaQueryWrapper
<
JyjcInspectionApplicationNoAcceptLog
>().
eq
(
JyjcInspectionApplicationNoAcceptLog:
:
getApplicationSeq
,
sequenceNbr
).
eq
(
JyjcInspectionApplicationNoAcceptLog:
:
getInspectionUnitCode
,
shanxiCompanyCode
));
Map
<
String
,
Object
>
map
=
BeanUtil
.
beanToMap
(
model
);
List
<
Map
<
String
,
Object
>>
dataByApplicationSeq
=
jyjcInspectionApplicationAttachmentService
.
getBaseMapper
().
getDataByApplicationSeq
(
sequenceNbr
);
Map
<
String
,
Object
>
attMap
=
new
HashMap
<>();
...
...
@@ -599,6 +606,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
map
.
put
(
"equip"
,
arrayList
);
}
map
.
putAll
(
attMap
);
// 陕西特检验院不予首次的次数
map
.
put
(
"sytjybyslcs"
,
times
);
this
.
setPlanData
(
sequenceNbr
,
map
);
return
map
;
}
...
...
@@ -869,7 +878,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
task
.
setTaskId
(
taskId
);
task
.
setComment
(
params
.
getOrDefault
(
"comments"
,
""
).
toString
());
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
"
1
"
);
map
.
put
(
"approvalStatus"
,
"
8
"
);
task
.
setVariable
(
map
);
//执行流程
task
.
setNextExecuteUserCompanyCode
(
model
.
getInspectionUnitCode
());
...
...
@@ -1063,7 +1072,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
TaskModelDto
modelDto
=
new
TaskModelDto
();
BeanUtil
.
copyProperties
(
taskV2Model
,
modelDto
);
modelDto
.
setNextExecuteUser
(
model
.
getNextExecuteIds
());
if
(
model
.
getStatus
().
equals
(
FlowStatusEnum
.
REJECTED
.
getCode
()
+
""
)
||
model
.
getStatus
().
equals
(
FlowStatusEnum
.
NO_ACCEPT
.
getCode
()
+
""
)
)
{
if
(
model
.
getStatus
().
equals
(
FlowStatusEnum
.
REJECTED
.
getCode
()
+
""
))
{
modelDto
.
setPageType
(
"edit"
);
}
TaskMessageDto
obj
=
new
TaskMessageDto
();
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/RuleCommonServiceImpl.java
0 → 100644
View file @
181926e9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
/**
* @author Administrator
*/
@Component
public
class
RuleCommonServiceImpl
{
private
UseInfoMapper
useInfoMapper
;
/**
* 特殊独立的区县
*/
private
static
final
String
[]
EXCLUSION_CITY_REGIONS
=
{
"610403"
,
"610581"
};
public
RuleCommonServiceImpl
(
UseInfoMapper
useInfoMapper
)
{
this
.
useInfoMapper
=
useInfoMapper
;
}
public
String
getArea
(
String
record
)
{
UseInfo
equipUseInfo
=
useInfoMapper
.
selectOne
(
Wrappers
.<
UseInfo
>
lambdaQuery
().
select
(
UseInfo:
:
getCity
,
UseInfo:
:
getCounty
).
eq
(
UseInfo:
:
getRecord
,
record
));
if
(
equipUseInfo
==
null
)
{
return
""
;
}
// 特殊地区特殊处理,目前有韩城、杨凌,原因行政区划上是有层级的,但是业务办理时,他们与所在地市是同级别的
if
(
StringUtils
.
isEmpty
(
equipUseInfo
.
getCity
())
||
StringUtils
.
isEmpty
(
equipUseInfo
.
getCounty
()))
{
return
""
;
}
if
(
Arrays
.
asList
(
EXCLUSION_CITY_REGIONS
).
contains
(
equipUseInfo
.
getCounty
()))
{
return
equipUseInfo
.
getCounty
();
}
return
equipUseInfo
.
getCity
();
}
}
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