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
fa3bc19b
Commit
fa3bc19b
authored
Dec 26, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
eaca49d7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
393 additions
and
84 deletions
+393
-84
JgEnableDisableDto.java
...ejoin/amos/boot/module/jg/api/dto/JgEnableDisableDto.java
+5
-0
WorkFlowStatusEnum.java
...oin/amos/boot/module/jg/api/enums/WorkFlowStatusEnum.java
+9
-1
JgEnableDisableMapper.java
...amos/boot/module/jg/api/mapper/JgEnableDisableMapper.java
+8
-0
JgEnableDisableMapper.xml
...g-api/src/main/resources/mapper/JgEnableDisableMapper.xml
+68
-0
JgEnableDisableController.java
...t/module/jg/biz/controller/JgEnableDisableController.java
+52
-71
JgEnableDisableServiceImpl.java
...odule/jg/biz/service/impl/JgEnableDisableServiceImpl.java
+251
-12
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/dto/JgEnableDisableDto.java
View file @
fa3bc19b
...
@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
...
@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
*
*
...
@@ -75,4 +76,8 @@ public class JgEnableDisableDto extends BaseDto {
...
@@ -75,4 +76,8 @@ public class JgEnableDisableDto extends BaseDto {
@ApiModelProperty
(
value
=
"申请类型(1启用,0停用)"
)
@ApiModelProperty
(
value
=
"申请类型(1启用,0停用)"
)
private
String
applyType
;
private
String
applyType
;
private
List
<
String
>
roleIds
;
private
String
type
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/WorkFlowStatusEnum.java
View file @
fa3bc19b
...
@@ -71,7 +71,15 @@ public enum WorkFlowStatusEnum {
...
@@ -71,7 +71,15 @@ public enum WorkFlowStatusEnum {
UNITCHANGE_SUBMIT
(
"使用单位提交"
,
"unitChangeSubmit"
,
"使用单位待提交"
,
"一级受理已驳回"
,
"使用单位已撤回"
),
UNITCHANGE_SUBMIT
(
"使用单位提交"
,
"unitChangeSubmit"
,
"使用单位待提交"
,
"一级受理已驳回"
,
"使用单位已撤回"
),
UNITCHANGE_RECEIVE
(
"一级受理"
,
"unitChangeReceive"
,
"一级待受理"
,
"二级受理已驳回"
,
"一级受理已撤回"
),
UNITCHANGE_RECEIVE
(
"一级受理"
,
"unitChangeReceive"
,
"一级待受理"
,
"二级受理已驳回"
,
"一级受理已撤回"
),
UNITCHANGE_PRELIMINARY
(
"二级受理"
,
"unitChangePreliminary"
,
"二级待受理"
,
"三级受理已驳回"
,
"二级受理已撤回"
),
UNITCHANGE_PRELIMINARY
(
"二级受理"
,
"unitChangePreliminary"
,
"二级待受理"
,
"三级受理已驳回"
,
"二级受理已撤回"
),
UNITCHANGE_REEXAMINE
(
"三级受理"
,
"unitChangeReexamine"
,
"三级待受理"
,
""
,
""
);
UNITCHANGE_REEXAMINE
(
"三级受理"
,
"unitChangeReexamine"
,
"三级待受理"
,
""
,
""
),
/**
* 停用启用流程
*/
ENABLE_SUBMIT
(
"使用单位提交"
,
"enableSubmit"
,
"待提交"
,
"已驳回"
,
"已撤回"
),
ENABLE_RECEIVE
(
"监管受理"
,
"enableReceive"
,
"待受理"
,
""
,
""
);
private
final
String
name
;
private
final
String
name
;
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgEnableDisableMapper.java
View file @
fa3bc19b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Map
;
/**
/**
* Mapper 接口
* Mapper 接口
...
@@ -11,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -11,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
JgEnableDisableMapper
extends
BaseMapper
<
JgEnableDisable
>
{
public
interface
JgEnableDisableMapper
extends
BaseMapper
<
JgEnableDisable
>
{
Page
<
Map
<
String
,
Object
>>
pageList
(
@Param
(
"page"
)
Page
<
Map
<
String
,
Object
>>
page
,
@Param
(
"dto"
)
JgEnableDisableDto
dto
);
Map
<
String
,
Object
>
getDetail
(
@Param
(
"sequenceNbr"
)
Long
sequenceNbr
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgEnableDisableMapper.xml
View file @
fa3bc19b
...
@@ -2,4 +2,72 @@
...
@@ -2,4 +2,72 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper"
>
<mapper
namespace=
"com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper"
>
<select
id=
"pageList"
resultType=
"java.util.Map"
>
SELECT jed.sequence_nbr as sequenceNbr,
jed.apply_no as applyNo,
date_format(jed.apply_date, '%Y-%m-%d') as applyDate,
CASE
when
jed.apply_type = 1 then '停用'
else '启用' end as applyType,
jri.USE_ORG_CODE as useOrgCode,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as equDefine,
jri.PRODUCT_NAME as productName,
use.USE_UNIT_NAME as useUnitName,
jed.receive_org_name as receiveOrgName,
concat(use."PROVINCE_NAME", '-', use."CITY_NAME", '-', use."COUNTY_NAME", '-', use."ADDRESS") as address,
use."USE_INNER_CODE" as useInnerCode,
jed.audit_status as auditStatus,
date_format(jed.audit_pass_date, '%Y-%m-%d') as auditPassDate,
jed.instance_id as instanceId,
jed.execute_sequence as executeSequence,
jed.next_executor_ids as nextExecutorIds,
jed.promoter
FROM tzs_jg_enable_disable jed
LEFT JOIN tzs_jg_enable_disable_eq jede on jed.sequence_nbr = jede.enable_disable_apply_id
LEFT JOIN idx_biz_jg_register_info jri on jede.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on jri.RECORD = use.RECORD
<where>
<if
test=
"dto.applyNo != null and dto.applyNo != '' "
>
and jed.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if
test=
"dto.applyNo != null and dto.applyNo != '' "
>
and jed.apply_no = #{dto.receiveOrgCode}
</if>
<if
test=
"dto.auditStatus != null and dto.auditStatus != '' "
>
and jed.audit_status = #{dto.auditStatus}
</if>
<if
test=
"dto.type == 'enterprise'"
>
and jed.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
<if
test=
"dto.type == 'supervision'"
>
and jed.receive_org_code = #{dto.useUnitCreditCode}
</if>
<if
test=
"dto.roleIds != null and dto.type == 'supervision'"
>
<foreach
collection=
'dto.roleIds'
item=
'role'
open=
'and ('
close=
')'
separator=
'or'
>
execute_sequence like concat('%',#{role},'%')
</foreach>
</if>
</where>
order by jed.rec_date desc
</select>
<select
id=
"getDetail"
resultType=
"java.util.Map"
>
SELECT jed.sequence_nbr as sequenceNbr,
concat(jed.receive_org_code,'_',jed.receive_org_name) as receiveOrgCode,
concat(use."PROVINCE_NAME", use."CITY_NAME", use."COUNTY_NAME", use."ADDRESS",
use.STREET_NAME) as address,
jri.EQU_CODE as equCode,
jed.apply_type as applyType,
jed.remark,
use.RECORD as record,
jfi.FACTORY_NUM as factoryNum
FROM tzs_jg_enable_disable jed
LEFT JOIN tzs_jg_enable_disable_eq jede on jed.sequence_nbr = jede.enable_disable_apply_id
LEFT JOIN idx_biz_jg_register_info jri on jede.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on jri.RECORD = use.RECORD
LEFT JOIN idx_biz_jg_factory_info jfi on jri.RECORD = jfi.RECORD
where jed.sequence_nbr = #{sequenceNbr}
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgEnableDisableController.java
View file @
fa3bc19b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEnableDisableServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEnableDisableServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
...
@@ -18,8 +26,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...
@@ -18,8 +26,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
/**
*
*
* @author system_generator
* @author system_generator
* @date 2023-12-25
* @date 2023-12-25
*/
*/
...
@@ -37,80 +43,55 @@ public class JgEnableDisableController extends BaseController {
...
@@ -37,80 +43,55 @@ public class JgEnableDisableController extends BaseController {
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
ResponseModel
<
JgEnableDisableDto
>
save
(
@RequestBody
JgEnableDisableDto
model
)
{
public
ResponseModel
<
Object
>
save
(
@RequestBody
JSONObject
map
)
{
model
=
jgEnableDisableServiceImpl
.
createWithModel
(
model
);
jgEnableDisableServiceImpl
.
saveOrUpdate
(
map
);
return
ResponseHelper
.
buildResponse
(
model
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
/**
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
* 根据sequenceNbr更新
@GetMapping
(
value
=
"/page"
)
*
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"使用登记设备关系表分页查询"
,
notes
=
"使用登记设备关系表分页查询"
)
* @param sequenceNbr 主键
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
page
(
@RequestParam
(
value
=
"current"
)
int
current
,
* @return
@RequestParam
(
value
=
"size"
)
int
size
,
*/
JgEnableDisableDto
dto
)
{
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>();
@PutMapping
(
value
=
"/{sequenceNbr}"
)
page
.
setCurrent
(
current
);
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
page
.
setSize
(
size
);
public
ResponseModel
<
JgEnableDisableDto
>
updateBySequenceNbrJgEnableDisable
(
@RequestBody
JgEnableDisableDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
pageList
(
page
,
dto
));
model
.
setSequenceNbr
(
sequenceNbr
);
}
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@PostMapping
(
value
=
"/flowExecute"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除"
,
notes
=
"根据sequenceNbr删除"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"执行流程"
,
notes
=
"执行流程"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
public
ResponseModel
<
Object
>
flowExecute
(
@RequestBody
JSONObject
map
)
{
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
removeById
(
sequenceNbr
));
jgEnableDisableServiceImpl
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"comment"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个"
,
notes
=
"根据sequenceNbr查询单个"
)
public
ResponseModel
<
JgEnableDisableDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
* 列表分页查询
@PostMapping
(
value
=
"/withdraw"
)
*
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"撤回"
,
notes
=
"撤回"
)
* @param current 当前页
public
ResponseModel
<
Object
>
withdraw
(
@RequestBody
JSONObject
map
)
{
* @param current 每页大小
jgEnableDisableServiceImpl
.
withdraw
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
* @return
return
ResponseHelper
.
buildResponse
(
"ok"
);
*/
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<
JgEnableDisableDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
JgEnableDisableDto
>
page
=
new
Page
<
JgEnableDisableDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
queryForJgEnableDisablePage
(
page
));
}
/**
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
* 列表全部数据查询
@DeleteMapping
(
value
=
"/deleteMessage"
)
*
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"删除"
,
notes
=
"删除"
)
* @return
public
ResponseModel
<
Object
>
deleteMessage
(
@RequestParam
(
"sequenceNbr"
)
Long
sequenceNbr
)
{
*/
jgEnableDisableServiceImpl
.
deleteMessage
(
sequenceNbr
);
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
return
ResponseHelper
.
buildResponse
(
"ok"
);
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
}
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
JgEnableDisableDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
queryForJgEnableDisableList
());
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
}
@GetMapping
(
value
=
"/detail"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"详情"
,
notes
=
"详情"
)
public
ResponseModel
<
Object
>
detail
(
@RequestParam
(
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
jgEnableDisableServiceImpl
.
getDetail
(
sequenceNbr
));
}
}
}
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/JgEnableDisableServiceImpl.java
View file @
fa3bc19b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisableEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
/**
/**
* 服务实现类
* 服务实现类
...
@@ -16,18 +43,229 @@ import java.util.List;
...
@@ -16,18 +43,229 @@ import java.util.List;
* @date 2023-12-25
* @date 2023-12-25
*/
*/
@Service
@Service
public
class
JgEnableDisableServiceImpl
extends
BaseService
<
JgEnableDisableDto
,
JgEnableDisable
,
JgEnableDisableMapper
>
implements
IJgEnableDisableService
{
public
class
JgEnableDisableServiceImpl
extends
BaseService
<
JgEnableDisableDto
,
JgEnableDisable
,
JgEnableDisableMapper
>
implements
IJgEnableDisableService
{
/**
* 分页查询
@Autowired
*/
WorkFlowFeignService
workFlowFeginService
;
public
Page
<
JgEnableDisableDto
>
queryForJgEnableDisablePage
(
Page
<
JgEnableDisableDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
@Autowired
RedisUtils
redisUtils
;
@Autowired
JgEnableDisableEqServiceImpl
jgEnableDisableEqService
;
@Autowired
TzsServiceFeignClient
tzsServiceFeignClient
;
private
final
String
WORK_FLOW_KEY
=
"deactivateEnable"
;
public
void
saveOrUpdate
(
JSONObject
map
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
JgEnableDisable
jgEnableDisable
=
new
JgEnableDisable
();
BeanUtil
.
copyProperties
(
map
,
jgEnableDisable
);
jgEnableDisable
.
setApplyDate
(
new
Date
());
String
submit
=
String
.
valueOf
(
map
.
get
(
"submit"
));
String
pageType
=
String
.
valueOf
(
map
.
get
(
"pageType"
));
if
(
map
.
containsKey
(
"receiveOrgCode"
))
{
// 接收机构
String
[]
splitMaintenanceUnitCode
=
String
.
valueOf
(
map
.
getString
(
"receiveOrgCode"
)).
split
(
"_"
);
jgEnableDisable
.
setReceiveOrgCode
(
splitMaintenanceUnitCode
[
0
]);
jgEnableDisable
.
setReceiveOrgName
(
splitMaintenanceUnitCode
[
1
]);
}
jgEnableDisable
.
setUseUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgEnableDisable
.
setUseUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
// 仅保存
if
(
"add"
.
equals
(
pageType
))
{
// 获取申请编号
ResponseModel
<
List
<
String
>>
listResponseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
SYDJ
.
getCode
(),
1
);
if
(!
ObjectUtils
.
isEmpty
(
listResponseModel
))
{
jgEnableDisable
.
setApplyNo
(
listResponseModel
.
getResult
().
get
(
0
));
}
jgEnableDisable
.
setAuditStatus
(
WorkFlowStatusEnum
.
ENABLE_SUBMIT
.
getPass
());
this
.
save
(
jgEnableDisable
);
}
else
{
// 编辑
jgEnableDisable
.
setSequenceNbr
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))));
this
.
baseMapper
.
updateById
(
jgEnableDisable
);
LambdaQueryWrapper
<
JgEnableDisableEq
>
lambda
=
new
QueryWrapper
<
JgEnableDisableEq
>().
lambda
();
lambda
.
eq
(
JgEnableDisableEq:
:
getEnableDisableApplyId
,
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
)));
jgEnableDisableEqService
.
getBaseMapper
().
delete
(
lambda
);
}
// 关联设备表
JgEnableDisableEq
jgEnableDisableEq
=
new
JgEnableDisableEq
();
jgEnableDisableEq
.
setEquId
(
String
.
valueOf
(
map
.
get
(
"record"
)));
jgEnableDisableEq
.
setEnableDisableApplyId
(
jgEnableDisable
.
getSequenceNbr
().
toString
());
jgEnableDisableEqService
.
save
(
jgEnableDisableEq
);
// 提交启动流程
if
(
"1"
.
equals
(
submit
))
{
String
instanceId
=
""
;
if
(
map
.
containsKey
(
"instanceId"
))
{
instanceId
=
map
.
get
(
"instanceId"
).
toString
();
}
else
{
instanceId
=
startByVariable
();
}
if
(!
ObjectUtils
.
isEmpty
(
instanceId
))
{
// 更新数据状态
updateExecuteIds
(
instanceId
,
jgEnableDisable
.
getSequenceNbr
(),
"0"
);
// 执行流程
flowExecute
(
jgEnableDisable
.
getSequenceNbr
(),
instanceId
,
"0"
,
""
);
}
}
}
public
Page
<
Map
<
String
,
Object
>>
pageList
(
Page
<
Map
<
String
,
Object
>>
page
,
JgEnableDisableDto
dto
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
dto
.
setUseUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
return
this
.
baseMapper
.
pageList
(
page
,
dto
);
}
}
/**
* 列表查询 示例
public
String
startByVariable
()
{
*/
String
instanceId
=
""
;
public
List
<
JgEnableDisableDto
>
queryForJgEnableDisableList
()
{
//启动流程
return
this
.
queryForList
(
""
,
false
);
try
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
WORK_FLOW_KEY
);
dto
.
setBusinessKey
(
"submit"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
instanceId
=
((
Map
<?,
?>)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
instanceId
;
}
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
try
{
JSONObject
task
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
JSONObject
taskMessage
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
task
.
get
(
"data"
)));
String
taskId
=
taskMessage
.
getString
(
"id"
);
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
dto
.
setComment
(
comment
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
operate
);
dto
.
setVariable
(
map
);
//执行流程
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// 更新下一步执行人
updateExecuteIds
(
instanceId
,
id
,
operate
);
}
}
public
void
withdraw
(
String
instanceId
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
taskCode
=
""
;
JgEnableDisable
jgEnableDisable
=
new
JgEnableDisable
();
LambdaQueryWrapper
<
JgEnableDisable
>
lambda
=
new
QueryWrapper
<
JgEnableDisable
>().
lambda
();
lambda
.
eq
(
JgEnableDisable:
:
getInstanceId
,
instanceId
);
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
try
{
workFlowFeginService
.
rollBack
(
instanceId
);
JSONObject
taskNoAuth
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
JSONObject
nextTask
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
taskNoAuth
.
get
(
"data"
)));
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
.
get
(
"data"
)))
{
String
nextTaskId
=
nextTask
.
getString
(
"id"
);
FeignClientResult
<
JSONObject
>
nodeInfo
=
workFlowFeginService
.
getNodeInfo
(
nextTaskId
);
JSONObject
result
=
nodeInfo
.
getResult
();
Map
<
String
,
Object
>
taskInfo
=
(
Map
<
String
,
Object
>)
result
.
get
(
"taskInfo"
);
taskCode
=
String
.
valueOf
(
taskInfo
.
get
(
"taskDefinitionKey"
));
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
JSONArray
data
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
<?,
?>)
datum
).
containsKey
(
"groupId"
))
{
roleList
.
add
(((
Map
<?,
?>)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(!
ObjectUtils
.
isEmpty
(
taskCode
))
{
jgEnableDisable
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getRollBack
());
}
String
join
=
String
.
join
(
","
,
roleList
);
jgEnableDisable
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgEnableDisable
.
setNextExecutorIds
(
join
);
this
.
update
(
jgEnableDisable
,
lambda
);
}
public
void
updateExecuteIds
(
String
instanceId
,
Long
sequenceNbr
,
String
operate
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
role
=
""
;
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
JgEnableDisable
jgEnableDisable
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
try
{
// 查询下节点任务
JSONObject
taskNoAuth
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
.
get
(
"data"
)))
{
JSONObject
nextTask
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
taskNoAuth
.
get
(
"data"
)));
String
nextTaskId
=
nextTask
.
getString
(
"id"
);
FeignClientResult
<
JSONObject
>
nodeInfo
=
workFlowFeginService
.
getNodeInfo
(
nextTaskId
);
JSONObject
result
=
nodeInfo
.
getResult
();
Map
<
String
,
Object
>
taskInfo
=
(
Map
<
String
,
Object
>)
result
.
get
(
"taskInfo"
);
taskCode
=
String
.
valueOf
(
taskInfo
.
get
(
"taskDefinitionKey"
));
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
JSONArray
data
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
)
datum
).
containsKey
(
"groupId"
))
{
roleList
.
add
(((
Map
)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(!
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
taskCode
))
{
role
=
String
.
join
(
","
,
roleList
);
jgEnableDisable
.
setNextExecutorIds
(
role
);
jgEnableDisable
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgEnableDisable
.
setInstanceId
(
instanceId
);
jgEnableDisable
.
setApplyDate
(
new
Date
());
if
(!
ObjectUtils
.
isEmpty
(
jgEnableDisable
.
getExecuteSequence
()))
{
jgEnableDisable
.
setExecuteSequence
(
jgEnableDisable
.
getExecuteSequence
()
+
","
+
role
);
}
else
{
jgEnableDisable
.
setExecuteSequence
(
role
);
}
if
(
"0"
.
equals
(
operate
))
{
// 通过操作
jgEnableDisable
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
}
else
{
// 驳回操作
jgEnableDisable
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getReject
());
jgEnableDisable
.
setPromoter
(
null
);
}
}
else
{
jgEnableDisable
.
setAuditStatus
(
taskCode
);
jgEnableDisable
.
setAuditPassDate
(
new
Date
());
}
this
.
getBaseMapper
().
updateById
(
jgEnableDisable
);
}
public
void
deleteMessage
(
Long
sequenceNbr
)
{
this
.
baseMapper
.
deleteById
(
sequenceNbr
);
LambdaQueryWrapper
<
JgEnableDisableEq
>
lambda
=
new
QueryWrapper
<
JgEnableDisableEq
>().
lambda
();
lambda
.
eq
(
JgEnableDisableEq:
:
getEnableDisableApplyId
,
sequenceNbr
);
jgEnableDisableEqService
.
getBaseMapper
().
delete
(
lambda
);
}
public
Map
<
String
,
Object
>
getDetail
(
Long
sequenceNbr
)
{
return
this
.
baseMapper
.
getDetail
(
sequenceNbr
);
}
}
}
\ 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