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
326d9b28
Commit
326d9b28
authored
Nov 18, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jyjc):检验检测业务管理初始代码
1.初始代码提交
parent
41a91ff0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
263 additions
and
0 deletions
+263
-0
TZSCommonConstant.java
...os/boot/module/common/api/constant/TZSCommonConstant.java
+2
-0
JyjcOpeningApplication.java
...s/boot/module/jyjc/api/entity/JyjcOpeningApplication.java
+7
-0
JyjcBizManageModel.java
...n/amos/boot/module/jyjc/api/model/JyjcBizManageModel.java
+14
-0
JyjcOpeningApplicationModel.java
...ot/module/jyjc/api/model/JyjcOpeningApplicationModel.java
+3
-0
JyjcBizManageController.java
...t/module/jyjc/biz/controller/JyjcBizManageController.java
+72
-0
JyjcBizManageServiceImpl.java
...odule/jyjc/biz/service/impl/JyjcBizManageServiceImpl.java
+165
-0
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/constant/TZSCommonConstant.java
View file @
326d9b28
...
...
@@ -45,4 +45,6 @@ public class TZSCommonConstant {
*/
public
static
final
String
EQU_CATEGORY_CODE_GDYLRQ
=
"2100"
;
public
static
final
String
SX_PROVINCE_CODE
=
"610000"
;
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/entity/JyjcOpeningApplication.java
View file @
326d9b28
...
...
@@ -47,6 +47,13 @@ public class JyjcOpeningApplication extends BaseEntity {
private
List
<
String
>
detectionRegion
;
/**
* 排除的区域
*/
@TableField
(
value
=
"exclusion_region"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
exclusionRegion
;
/**
* 检测区域名称(冗余)
*/
@TableField
(
"detection_region_name"
)
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/model/JyjcBizManageModel.java
0 → 100644
View file @
326d9b28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
api
.
model
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
JyjcBizManageModel
extends
JyjcOpeningApplicationModel
{
/**
* 区域停(启)用状态
*/
private
String
areaStatus
;
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/model/JyjcOpeningApplicationModel.java
View file @
326d9b28
...
...
@@ -39,6 +39,9 @@ public class JyjcOpeningApplicationModel extends BaseModel {
@TableField
(
value
=
"detection_region"
,
typeHandler
=
FastjsonTypeHandler
.
class
)
private
List
<
String
>
detectionRegion
;
@ApiModelProperty
(
value
=
"排除的区域编码"
)
private
List
<
String
>
exclusionRegion
;
@ApiModelProperty
(
value
=
"检测区域名称(冗余)"
)
private
String
detectionRegionName
;
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/controller/JyjcBizManageController.java
0 → 100644
View file @
326d9b28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jyjc.api.model.JyjcBizManageModel
;
import
com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcBizManageServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.BaseUnitLicence
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
@RestController
@RequestMapping
@Api
(
tags
=
"检验检测业务管理"
)
@RequiredArgsConstructor
public
class
JyjcBizManageController
extends
BaseController
{
private
final
JyjcBizManageServiceImpl
jyjcBizManageService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"检验检测机构开通业务列表,分页"
,
notes
=
"检验检测机构开通业务列表,分页"
)
public
ResponseModel
<
IPage
<?>>
getManageList
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestBody
JyjcBizManageModel
model
)
{
Page
<
JyjcBizManageModel
>
page
=
new
Page
<>(
current
,
size
);
IPage
<?>
res
=
jyjcBizManageService
.
pageList
(
page
,
getSelectedOrgInfo
().
getCompany
(),
model
);
return
ResponseHelper
.
buildResponse
(
res
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{appSeq}/area-enable"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"企业区域启用"
,
notes
=
"企业区域启用"
)
public
ResponseModel
<
Boolean
>
enableBatch
(
@PathVariable
String
appSeq
)
{
return
ResponseHelper
.
buildResponse
(
jyjcBizManageService
.
enable
(
appSeq
,
getSelectedOrgInfo
().
getCompany
()));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{appSeq}/area-disable"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"企业区域停用"
,
notes
=
"企业区域停用"
)
public
ResponseModel
<
Boolean
>
disableBatch
(
@PathVariable
String
appSeq
)
{
return
ResponseHelper
.
buildResponse
(
jyjcBizManageService
.
disable
(
appSeq
,
getSelectedOrgInfo
().
getCompany
()));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/{appSeq}/licence-edit"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"资质停起用"
,
notes
=
"资质停起用"
)
public
ResponseModel
<
Boolean
>
licenceEdit
(
@PathVariable
String
appSeq
,
@RequestBody
List
<
BaseUnitLicence
>
licences
)
{
return
ResponseHelper
.
buildResponse
(
jyjcBizManageService
.
licenceEdit
(
appSeq
,
licences
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{appSeq}/licence-detail"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"资质详情"
,
notes
=
"资质详情"
)
public
ResponseModel
<
List
<
BaseUnitLicence
>>
licenceDetail
(
@PathVariable
String
appSeq
)
{
return
ResponseHelper
.
buildResponse
(
jyjcBizManageService
.
licenceDetail
(
appSeq
));
}
}
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/JyjcBizManageServiceImpl.java
0 → 100644
View file @
326d9b28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
;
import
com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto
;
import
com.yeejoin.amos.boot.module.jyjc.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory
;
import
com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication
;
import
com.yeejoin.amos.boot.module.jyjc.api.model.JyjcBizManageModel
;
import
com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.BaseUnitLicence
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
@Service
@RequiredArgsConstructor
@Slf4j
public
class
JyjcBizManageServiceImpl
{
private
static
final
String
TY
=
"停用"
;
private
static
final
String
QY
=
"启用"
;
private
final
JyjcOpeningApplicationServiceImpl
openingApplicationService
;
private
final
RedissonClient
redissonClient
;
public
IPage
<?>
pageList
(
Page
<
JyjcBizManageModel
>
page
,
CompanyBo
company
,
JyjcOpeningApplicationModel
model
)
{
Page
<
JyjcOpeningApplication
>
pageApp
=
new
Page
<>(
page
.
getCurrent
(),
page
.
getSize
());
LambdaQueryWrapper
<
JyjcOpeningApplication
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
this
.
setIdentify
(
company
,
queryWrapper
);
queryWrapper
.
eq
(
JyjcOpeningApplication:
:
getStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
queryWrapper
.
like
(
StringUtils
.
isNotEmpty
(
model
.
getUnitCodeName
()),
JyjcOpeningApplication:
:
getUnitCodeName
,
model
.
getUnitCodeName
());
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
model
.
getOpenBizType
()),
JyjcOpeningApplication:
:
getOpenBizType
,
model
.
getOpenBizType
());
IPage
<
JyjcOpeningApplication
>
res
=
openingApplicationService
.
page
(
pageApp
,
queryWrapper
);
List
<
JyjcBizManageModel
>
manageModels
=
res
.
getRecords
().
stream
().
map
(
r
->
{
JyjcBizManageModel
bizManageModel
=
BeanUtil
.
copyProperties
(
r
,
JyjcBizManageModel
.
class
);
setAreaStatusByIdentify
(
company
,
r
,
bizManageModel
);
return
bizManageModel
;
}).
collect
(
Collectors
.
toList
());
page
.
setRecords
(
manageModels
);
page
.
setTotal
(
res
.
getTotal
());
return
page
;
}
private
static
void
setAreaStatusByIdentify
(
CompanyBo
company
,
JyjcOpeningApplication
r
,
JyjcBizManageModel
bizManageModel
)
{
if
(
TZSCommonConstant
.
SHAN_XI_REGION_CODE
.
equals
(
company
.
getCompanyCode
()))
{
bizManageModel
.
setAreaStatus
(
QY
);
}
else
{
if
(
r
.
getExclusionRegion
()
!=
null
&&
r
.
getExclusionRegion
().
contains
(
company
.
getCompanyCode
()))
{
bizManageModel
.
setAreaStatus
(
TY
);
}
else
{
bizManageModel
.
setAreaStatus
(
QY
);
}
}
}
private
void
setIdentify
(
CompanyBo
company
,
LambdaQueryWrapper
<
JyjcOpeningApplication
>
queryWrapper
)
{
if
(!
TZSCommonConstant
.
SHAN_XI_REGION_CODE
.
equals
(
company
.
getCompanyCode
()))
{
queryWrapper
.
and
(
w
->
w
.
like
(
JyjcOpeningApplication:
:
getDetectionRegion
,
company
.
getCompanyCode
())
.
or
()
.
like
(
JyjcOpeningApplication:
:
getExclusionRegion
,
company
.
getCompanyCode
()));
}
}
public
Boolean
enable
(
String
appSeq
,
CompanyBo
company
)
{
log
.
info
(
"启用企业区域权限, appSeq: {}, company: {}"
,
appSeq
,
company
.
getCompanyCode
());
String
lockKey
=
"app:region:lock:"
+
appSeq
;
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个单据
if
(!
isLocked
)
{
throw
new
BadRequest
(
"其他机构同时在操作该业务,请稍后重试!"
);
}
JyjcOpeningApplication
openingApplication
=
openingApplicationService
.
getById
(
appSeq
);
List
<
String
>
detectionRegion
=
openingApplication
.
getDetectionRegion
();
Set
<
String
>
detectionRegionSet
=
new
HashSet
<>(
detectionRegion
);
detectionRegionSet
.
add
(
company
.
getCompanyCode
());
List
<
String
>
exclusionRegion
=
openingApplication
.
getExclusionRegion
();
if
(
exclusionRegion
!=
null
)
{
exclusionRegion
.
remove
(
company
.
getCompanyCode
());
}
openingApplicationService
.
update
(
new
LambdaUpdateWrapper
<
JyjcOpeningApplication
>()
.
eq
(
BaseEntity:
:
getSequenceNbr
,
appSeq
)
.
set
(
JyjcOpeningApplication:
:
getDetectionRegion
,
detectionRegionSet
)
.
set
(
JyjcOpeningApplication:
:
getExclusionRegion
,
exclusionRegion
));
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"启用企业区域失败:{}"
,
e
.
getMessage
(),
e
);
}
finally
{
if
(
lock
.
isLocked
()
&&
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
}
}
return
Boolean
.
TRUE
;
}
public
Boolean
disable
(
String
appSeq
,
CompanyBo
company
)
{
log
.
info
(
"禁用企业区域权限, appSeq: {}, company: {}"
,
appSeq
,
company
.
getCompanyCode
());
String
lockKey
=
"app:region:lock:"
+
appSeq
;
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:解决并发问题:多个人同时操作一个单据
if
(!
isLocked
)
{
throw
new
BadRequest
(
"其他机构同时在操作该业务,请稍后重试!"
);
}
JyjcOpeningApplication
openingApplication
=
openingApplicationService
.
getById
(
appSeq
);
List
<
String
>
detectionRegion
=
openingApplication
.
getDetectionRegion
();
if
(
detectionRegion
!=
null
)
{
detectionRegion
.
remove
(
company
.
getCompanyCode
());
}
List
<
String
>
exclusionRegion
=
openingApplication
.
getExclusionRegion
();
Set
<
String
>
exclusionRegionSet
=
new
HashSet
<>(
exclusionRegion
);
exclusionRegion
.
add
(
company
.
getCompanyCode
());
openingApplicationService
.
update
(
new
LambdaUpdateWrapper
<
JyjcOpeningApplication
>()
.
eq
(
BaseEntity:
:
getSequenceNbr
,
appSeq
)
.
set
(
JyjcOpeningApplication:
:
getDetectionRegion
,
detectionRegion
)
.
set
(
JyjcOpeningApplication:
:
getExclusionRegion
,
exclusionRegionSet
));
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"禁用企业区域失败:{}"
,
e
.
getMessage
(),
e
);
}
finally
{
if
(
lock
.
isLocked
()
&&
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
}
}
return
Boolean
.
TRUE
;
}
public
Boolean
licenceEdit
(
String
appSeq
,
List
<
BaseUnitLicence
>
licences
)
{
// openingApplications.forEach(jyjcOpeningApplication -> {
// JyjcInspectionHistory history = inspectionHistoryService.getBySSeq(jyjcOpeningApplication.getSequenceNbr());
// if (history != null) {
// JSONObject hisData = history.getHistoryData();
// List<BaseEnterpriseCertDto> certDtos = hisData.getJSONArray(BizCommonConstant.UNIT_LICENCE_KEY).toJavaList(BaseEnterpriseCertDto.class);
return
Boolean
.
TRUE
;
}
public
List
<
BaseUnitLicence
>
licenceDetail
(
String
appSeq
)
{
return
null
;
}
}
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