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
517f3745
Commit
517f3745
authored
Apr 26, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.安装告知作废功能
parent
9b0a2247
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
170 additions
and
7 deletions
+170
-7
IJgInstallationNoticeService.java
...t/module/jg/api/service/IJgInstallationNoticeService.java
+8
-0
JgInstallationNoticeController.java
...ule/jg/biz/controller/JgInstallationNoticeController.java
+11
-0
ICmWorkflowService.java
...n/amos/boot/module/jg/biz/service/ICmWorkflowService.java
+7
-0
IIdxBizJgUseInfoService.java
...s/boot/module/jg/biz/service/IIdxBizJgUseInfoService.java
+2
-1
CmWorkflowServiceImpl.java
...oot/module/jg/biz/service/impl/CmWorkflowServiceImpl.java
+20
-4
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+96
-2
ConstructionInfo.java
...oin/amos/boot/module/ymt/api/entity/ConstructionInfo.java
+7
-0
IdxBizJgConstructionInfo.java
.../boot/module/ymt/api/entity/IdxBizJgConstructionInfo.java
+8
-0
FlowStatusEnum.java
...eejoin/amos/boot/module/ymt/api/enums/FlowStatusEnum.java
+11
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgInstallationNoticeService.java
View file @
517f3745
...
...
@@ -76,4 +76,12 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @return
*/
Map
<
String
,
Object
>
getCompanyType
();
/**
* 作废申请
* @param sequenceNbr 业务唯一标识
* @param cancelReason 作废原因
* @return JgInstallationNoticeDto
*/
JgInstallationNoticeDto
cancelApplication
(
Long
sequenceNbr
,
String
cancelReason
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgInstallationNoticeController.java
View file @
517f3745
...
...
@@ -163,4 +163,15 @@ public class JgInstallationNoticeController extends BaseController {
public
void
generateReport
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
Long
sequenceNbr
)
{
iJgInstallationNoticeService
.
generateInstallationNoticeReport
(
sequenceNbr
,
response
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"安装告知单个作废"
,
notes
=
"安装告知单个作废"
)
@PutMapping
(
value
=
"/cancel/application"
)
public
ResponseModel
<
JgInstallationNoticeDto
>
cancelApplication
(
@RequestBody
JgInstallationNoticeDto
jgInstallationNoticeDto
){
JgInstallationNoticeDto
result
=
iJgInstallationNoticeService
.
cancelApplication
(
jgInstallationNoticeDto
.
getSequenceNbr
(),
jgInstallationNoticeDto
.
getCancelReason
());
return
ResponseHelper
.
buildResponse
(
result
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/ICmWorkflowService.java
View file @
517f3745
...
...
@@ -15,4 +15,11 @@ public interface ICmWorkflowService {
ProcessTaskDTO
rollBack
(
String
processInstanceId
);
ProcessTaskDTO
assign
(
FlowTaskVo
taskVo
);
/**
* 终止流程
* @param processInstanceId 流程实例id
* @return ProcessInstanceDTO
*/
ProcessInstanceDTO
stopProcess
(
String
processInstanceId
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/IIdxBizJgUseInfoService.java
View file @
517f3745
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
java.util.List
;
...
...
@@ -11,7 +12,7 @@ import java.util.List;
* @author system_generator
* @date 2023-08-16
*/
public
interface
IIdxBizJgUseInfoService
{
public
interface
IIdxBizJgUseInfoService
extends
IService
<
IdxBizJgUseInfo
>
{
boolean
saveOrUpdateData
(
IdxBizJgUseInfo
useInfo
);
...
...
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/CmWorkflowServiceImpl.java
View file @
517f3745
...
...
@@ -7,10 +7,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.FlowTaskVo
;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
...
...
@@ -122,4 +119,23 @@ public class CmWorkflowServiceImpl implements ICmWorkflowService {
}
return
processTaskDTO
;
}
@Override
public
ProcessInstanceDTO
stopProcess
(
String
processInstanceId
)
{
ProcessInstanceDTO
processTaskDTO
=
new
ProcessInstanceDTO
();
try
{
log
.
info
(
"开始请求工作流终止流程接口:/stopProcess/{processInstanceId},请求参数:{}"
,
processInstanceId
);
processTaskDTO
=
Workflow
.
taskV2Client
.
stopProcess
(
processInstanceId
).
getResult
();
}
catch
(
InnerInvokException
e
)
{
//拦截无审核人异常信息
String
devMessage
=
getErrorMessage
(
e
);
log
.
error
(
devMessage
);
throw
new
LocalBadRequest
(
devMessage
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用工作流终止流程任接口失败"
,
e
);
throw
new
RuntimeException
(
"调用工作流终止流程任接口失败"
);
}
return
processTaskDTO
;
}
}
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/JgInstallationNoticeServiceImpl.java
View file @
517f3745
...
...
@@ -29,6 +29,7 @@ import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService
;
...
...
@@ -36,6 +37,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import
com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum
;
...
...
@@ -151,6 +153,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
CommonServiceImpl
commonService
;
@Autowired
private
RedissonClient
redissonClient
;
@Autowired
private
IdxBizJgConstructionInfoMapper
constructionInfoMapper
;
@Autowired
private
ESEquipmentCategory
esEquipmentCategory
;
/**
* 根据sequenceNbr查询
...
...
@@ -197,8 +204,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
installationInfo
.
put
(
s
,
ObjectUtils
.
isEmpty
(
installationInfo
.
get
(
s
))
?
new
JSONArray
()
:
parseArray
(
installationInfo
.
get
(
s
).
toString
()));
}
}
if
(
Integer
.
parseInt
(
notice
.
getNoticeStatus
())
=
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
())
{
// 完成时显示历史数据
if
(
Integer
.
parseInt
(
notice
.
getNoticeStatus
())
>
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
())
{
// 完成
及作废
时显示历史数据
JSONObject
hisData
=
commonService
.
queryHistoryData
(
notice
.
getSequenceNbr
());
// 兼容老数据
if
(
hisData
==
null
)
{
...
...
@@ -1153,6 +1160,14 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
idxBizJgUseInfoMapper
.
update
(
idxBizJgUseInfo
,
lambda
);
}
private
void
saveHisDataBeforeUpdate
(
JgInstallationNotice
jgInstallationNotice
)
{
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
Map
<
String
,
Object
>
map
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
jgRelationEquip
.
getEquId
());
commonService
.
saveOrUpdateHistory
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getName
(),
new
JSONObject
(
map
),
jgRelationEquip
.
getEquId
(),
jgInstallationNotice
.
getSequenceNbr
().
toString
());
}
private
void
saveHisDataBeforeUpdate
(
JgInstallationNotice
jgInstallationNotice
,
String
equId
)
{
Map
<
String
,
Object
>
map
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
equId
);
commonService
.
saveOrUpdateHistory
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getName
(),
new
JSONObject
(
map
),
equId
,
jgInstallationNotice
.
getSequenceNbr
().
toString
());
...
...
@@ -1231,4 +1246,82 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return
result
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
JgInstallationNoticeDto
cancelApplication
(
Long
sequenceNbr
,
String
cancelReason
)
{
// 1.更新为已作废
JgInstallationNotice
installationNotice
=
this
.
getById
(
sequenceNbr
);
String
oldNoticeStatus
=
installationNotice
.
getNoticeStatus
();
installationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()));
installationNotice
.
setCancelReason
(
cancelReason
);
installationNotice
.
setCancelDate
(
new
Date
());
installationNotice
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
this
.
updateById
(
installationNotice
);
// 2.更新关联的业务
this
.
processElseDataByStatus
(
Objects
.
requireNonNull
(
FlowStatusEnum
.
getEumByCode
(
Integer
.
parseInt
(
oldNoticeStatus
))),
installationNotice
);
return
null
;
}
private
void
processElseDataByStatus
(
FlowStatusEnum
oldNoticeStatus
,
JgInstallationNotice
installationNotice
)
{
switch
(
oldNoticeStatus
){
case
TO_BE_SUBMITTED:
// 待提交
// 1.写入历史表
this
.
saveHisDataBeforeUpdate
(
installationNotice
);
// 2.删除暂存时生成的待办
commonService
.
deleteTaskModel
(
installationNotice
.
getSequenceNbr
()
+
""
);
break
;
case
TO_BE_FINISHED:
// 已完成
// 1.删除之前完成时同步到一码通的施工信息
this
.
deleteConstructionInfo
(
installationNotice
);
// 2.删除与设备的关系,设备可再次发起安装告知
this
.
clearUseInfoOfEquip
(
installationNotice
);
// 3.清空redis 缓存的流程中及已完成安装告知的设备
this
.
delRepeatUseEquipData
(
installationNotice
);
break
;
default
:
// 流程中(驳回、撤回等)
// 1.待办任务更新为已完成
this
.
finishedTask
(
installationNotice
.
getInstanceId
());
// 2.终止流程
iCmWorkflowService
.
stopProcess
(
installationNotice
.
getInstanceId
());
// 3.写入历史表
this
.
saveHisDataBeforeUpdate
(
installationNotice
);
// 4.清空redis(缓存的流程中及已完成安装告知的设备)
this
.
delRepeatUseEquipData
(
installationNotice
);
}
}
private
void
finishedTask
(
String
instanceId
)
{
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskMap
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskMap
.
put
(
"relationId"
,
instanceId
);
commonService
.
updateTaskModel
(
taskMap
);
}
private
void
deleteConstructionInfo
(
JgInstallationNotice
installationNotice
)
{
constructionInfoMapper
.
delete
(
new
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>().
eq
(
IdxBizJgConstructionInfo:
:
getNoticeId
,
installationNotice
.
getSequenceNbr
()));
}
private
void
clearUseInfoOfEquip
(
JgInstallationNotice
installationNotice
)
{
// 2.1 数据库的的USE_UNIT_CREDIT_CODE赋空
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
installationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
IdxBizJgUseInfo
idxBizJgUseInfo
=
useInfoService
.
getOne
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
()));
idxBizJgUseInfo
.
setUseUnitCreditCode
(
null
);
idxBizJgUseInfo
.
setUseUnitName
(
null
);
useInfoService
.
updateById
(
idxBizJgUseInfo
);
// 2.2 es的USE_UNIT_CREDIT_CODE赋空
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
jgRelationEquip
.
getEquId
());
if
(
optional
.
isPresent
()){
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setUSE_UNIT_CREDIT_CODE
(
null
);
esEquipmentCategoryDto
.
setUSE_UNIT_NAME
(
null
);
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/ConstructionInfo.java
View file @
517f3745
...
...
@@ -65,4 +65,11 @@ public class ConstructionInfo extends AbstractEquipBaseEntity {
private
String
uscDate
;
/**
* 告知业务id-告知作废时使用
*/
@TableField
(
value
=
"\"NOTICE_ID\""
)
private
String
noticeId
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgConstructionInfo.java
View file @
517f3745
...
...
@@ -74,4 +74,12 @@ public class IdxBizJgConstructionInfo extends TzsBaseEntity {
@TableField
(
exist
=
false
)
private
String
supervisoryCode
;
/**
* 告知业务id-告知作废时使用
*/
@TableField
(
value
=
"\"NOTICE_ID\""
)
private
String
noticeId
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/enums/FlowStatusEnum.java
View file @
517f3745
...
...
@@ -65,4 +65,14 @@ public enum FlowStatusEnum {
return
name
;
}
public
static
FlowStatusEnum
getEumByCode
(
int
code
)
{
for
(
FlowStatusEnum
statusEnum
:
FlowStatusEnum
.
values
())
{
if
(
statusEnum
.
getCode
()
==
code
)
{
return
statusEnum
;
}
}
return
null
;
}
}
\ No newline at end of file
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