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
eaeeb754
Commit
eaeeb754
authored
Jul 19, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加项目资料补充流程审批接口
parent
e548d1fc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
235 additions
and
1 deletion
+235
-1
ProcessTypeEnum.java
...eejoin/amos/boot/module/ugp/api/Enum/ProcessTypeEnum.java
+2
-1
ProjectResourceAuditDto.java
...amos/boot/module/ugp/api/dto/ProjectResourceAuditDto.java
+36
-0
ProjectResource.java
...join/amos/boot/module/ugp/api/entity/ProjectResource.java
+19
-0
ProjectResourceMapper.java
...mos/boot/module/ugp/api/mapper/ProjectResourceMapper.java
+4
-0
ProjectResourceMapper.xml
...p-api/src/main/resources/mapper/ProjectResourceMapper.xml
+7
-0
ProjectController.java
...mos/boot/module/ugp/biz/controller/ProjectController.java
+35
-0
ProjectInitiationServiceImpl.java
...le/ugp/biz/service/impl/ProjectInitiationServiceImpl.java
+132
-0
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Enum/ProcessTypeEnum.java
View file @
eaeeb754
...
...
@@ -12,7 +12,8 @@ public enum ProcessTypeEnum {
项目立项
(
"projectApproval"
,
"项目立项流程"
,
"tz_ugp_project"
),
项目结项
(
"projectClosing"
,
"项目结项流程"
,
""
),
问题处理
(
"problemHandling"
,
"问题处理流程"
,
"tz_ugp_quality_problem"
),
人工处理
(
"manualHandling"
,
"人工处理流程"
,
""
);
人工处理
(
"manualHandling"
,
"人工处理流程"
,
""
),
资料补充
(
"projectResource"
,
"项目资料补充流程"
,
""
);
String
type
;
String
name
;
...
...
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/dto/ProjectResourceAuditDto.java
0 → 100644
View file @
eaeeb754
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
dto
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
@Data
public
class
ProjectResourceAuditDto
{
/**
* 项目id
*/
private
Long
projectId
;
/**
* 项目资源ids
*/
private
List
<
Long
>
resourceIds
;
/**
* 提交审批资源类型
*/
private
String
type
;
/**
* 审批状态
*/
private
String
status
;
/**
* 资源审批信息
*/
private
List
<
Map
<
String
,
Object
>>
resourceObject
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/entity/ProjectResource.java
View file @
eaeeb754
...
...
@@ -51,4 +51,23 @@ public class ProjectResource extends BaseEntity {
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 流程实例id
*/
@TableField
(
"instance_id"
)
private
String
instanceId
;
/**
* 审核状态
*/
@TableField
(
"audit_status"
)
private
String
auditStatus
;
/**
* 备注(最新审批记录)
*/
@TableField
(
"remark"
)
private
String
remark
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/mapper/ProjectResourceMapper.java
View file @
eaeeb754
...
...
@@ -46,4 +46,8 @@ public interface ProjectResourceMapper extends BaseMapper<ProjectResource> {
List
<
ProjectResourceDto
>
getProjectMaterial
(
String
type
,
Set
<
String
>
codes
,
@RequestBody
(
required
=
false
)
ProjectResourceDto
projectResourceDto
);
List
<
ProjectResourceDto
>
getProjectEquipment
(
String
type
,
Set
<
String
>
codes
,
@RequestBody
(
required
=
false
)
ProjectResourceDto
projectResourceDto
);
String
selectInstanceId
(
@Param
(
"projectId"
)
Long
projectId
,
@Param
(
"type"
)
String
type
);
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/resources/mapper/ProjectResourceMapper.xml
View file @
eaeeb754
...
...
@@ -208,4 +208,11 @@
</where>
order by rec_date desc
</select>
<select
id=
"selectInstanceId"
resultType=
"java.lang.String"
>
SELECT instance_id
from tz_ugp_project_resource
where project_id = #{projectId}
and type = #{type}
and audit_status != '流程结束!' LIMIT 1
</select>
</mapper>
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectController.java
View file @
eaeeb754
...
...
@@ -22,11 +22,14 @@ import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import
com.yeejoin.amos.boot.module.ugp.api.entity.InstallNotice
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Project
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.ProjectInitiation
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IProcessRelationService
;
import
com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.*
;
import
com.yeejoin.amos.component.robot.BadRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -85,6 +88,8 @@ public class ProjectController extends BaseController {
@Autowired
IProcessRelationService
iProcessRelationService
;
@Autowired
ProjectResourceMapper
projectResourceMapper
;
/**
* 新增项目信息表
*
...
...
@@ -824,6 +829,36 @@ public class ProjectController extends BaseController {
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"项目资源补充提交"
,
notes
=
"项目资源补充提交"
)
@PostMapping
(
value
=
"/projectResourceSubmit"
)
public
ResponseModel
<
Object
>
projectResourceSubmit
(
@RequestBody
ProjectResourceAuditDto
dto
)
{
String
instanceId
=
projectResourceMapper
.
selectInstanceId
(
dto
.
getProjectId
(),
dto
.
getType
());
if
(!
ObjectUtils
.
isEmpty
(
instanceId
))
{
LambdaQueryWrapper
<
ProjectResource
>
lambda
=
new
QueryWrapper
<
ProjectResource
>().
lambda
();
lambda
.
eq
(
ProjectResource:
:
getInstanceId
,
instanceId
);
List
<
ProjectResource
>
projectResources
=
projectResourceMapper
.
selectList
(
lambda
);
if
(!
ObjectUtils
.
isEmpty
(
projectResources
.
get
(
0
))
&&
!
ObjectUtils
.
isEmpty
(
projectResources
.
get
(
0
).
getAuditStatus
())
&&
"资料提交"
.
equals
(
projectResources
.
get
(
0
).
getAuditStatus
()))
{
// 存在被驳回流程,直接执行
projectInitiationService
.
projectResourceExecute
(
instanceId
,
null
,
dto
.
getType
());
}
else
{
throw
new
BadRequest
(
"存在未结束审核流程!"
);
}
}
else
{
// 启动流程
projectInitiationService
.
projectResourceStart
(
dto
);
}
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"项目资源补充审批执行"
,
notes
=
"项目资源补充审批执行"
)
@PostMapping
(
value
=
"/projectResourceExecute"
)
public
ResponseModel
<
Object
>
projectResourceExecute
(
@RequestBody
ProjectResourceAuditDto
dto
)
{
String
instanceId
=
projectResourceMapper
.
selectInstanceId
(
dto
.
getProjectId
(),
dto
.
getType
());
projectInitiationService
.
projectResourceExecute
(
instanceId
,
dto
.
getStatus
(),
dto
.
getType
());
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/ProjectInitiationServiceImpl.java
View file @
eaeeb754
...
...
@@ -4,6 +4,7 @@ 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.mao.expertSystem.WeldingQualification
;
import
com.mao.expertSystem.material.MyPqr
;
import
com.mao.expertSystem.material.MyWps
;
...
...
@@ -15,10 +16,12 @@ import com.yeejoin.amos.boot.module.ugp.api.Enum.*;
import
com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.OverProjectDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.ProjectInitiationDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.ProjectResourceAuditDto
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.*
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectInitiationMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IProcessRelationService
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IProjectInitiationService
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IProjectResourceService
;
import
com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
...
...
@@ -97,6 +100,16 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
@Resource
private
IProcessRelationService
processRelationService
;
@Resource
private
ProjectResourceServiceImpl
projectResourceService
;
/**
* 項目资源补充流程key
*/
@Value
(
"${params.work.flow.projectResourceKey}"
)
private
String
projectResourceKey
;
/**
* 测试流程使用
* @param
...
...
@@ -710,4 +723,123 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
}
public
void
projectResourceStart
(
ProjectResourceAuditDto
projectResourceAuditDto
)
{
String
instanceId
=
null
;
//启动流程
try
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
projectResourceKey
);
dto
.
setBusinessKey
(
"1"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
ProjectInitiation
projectInitiation
=
new
ProjectInitiation
();
projectInitiation
.
setInstanceId
(
instanceId
);
projectInitiation
.
setType
(
ProcessTypeEnum
.
资料补充
.
getType
());
projectInitiation
.
setTaskName
(
"流程启动!"
);
this
.
save
(
projectInitiation
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"流程启动失败:"
+
e
.
getMessage
());
return
;
}
ArrayList
<
ProjectResource
>
list
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
projectResourceAuditDto
.
getResourceObject
()))
{
String
finalInstanceId
=
instanceId
;
projectResourceAuditDto
.
getResourceObject
().
forEach
(
item
->
{
ProjectResource
projectResource
=
new
ProjectResource
();
projectResource
.
setProjectId
(
projectResourceAuditDto
.
getProjectId
());
projectResource
.
setResourceId
(
Long
.
valueOf
(
String
.
valueOf
(
item
.
get
(
"id"
))));
projectResource
.
setName
(
String
.
valueOf
(
item
.
get
(
"name"
)));
projectResource
.
setType
(
projectResourceAuditDto
.
getType
());
projectResource
.
setStatus
(
"0"
);
projectResource
.
setInstanceId
(!
ObjectUtils
.
isEmpty
(
finalInstanceId
)
?
finalInstanceId
:
null
);
list
.
add
(
projectResource
);
});
}
projectResourceService
.
saveBatch
(
list
);
//执行项目立项流程
projectResourceExecute
(
instanceId
,
null
,
projectResourceAuditDto
.
getType
());
}
public
void
projectResourceExecute
(
String
instanceId
,
String
status
,
String
type
)
{
JSONObject
dataObject
=
null
;
String
taskId
=
null
;
String
taskName
=
""
;
try
{
//执行流程
TaskResultDTO
dto1
=
new
TaskResultDTO
();
dto1
.
setResult
(
status
);
dto1
.
setResultCode
(
"condition"
);
dto1
.
setTaskId
(
instanceId
);
AjaxResult
ajaxResult1
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
if
(!
ObjectUtils
.
isEmpty
(
ajaxResult1
.
get
(
"data"
)))
{
taskId
=
((
Map
)
ajaxResult1
.
get
(
"data"
)).
get
(
"id"
).
toString
();
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto1
);
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
}
ProjectInitiation
projectInitiation
=
new
ProjectInitiation
();
projectInitiation
.
setInstanceId
(
instanceId
);
projectInitiation
.
setTaskId
(
taskId
);
projectInitiation
.
setType
(
ProcessTypeEnum
.
资料补充
.
getType
());
if
(!
ObjectUtils
.
isEmpty
(
dataObject
))
{
projectInitiation
.
setTaskName
(
String
.
valueOf
(
dataObject
.
get
(
"name"
)));
taskName
=
String
.
valueOf
(
dataObject
.
get
(
"name"
));
this
.
save
(
projectInitiation
);
}
else
{
projectInitiation
.
setTaskName
(
"流程结束!"
);
taskName
=
"流程结束!"
;
this
.
save
(
projectInitiation
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
LambdaQueryWrapper
<
ProjectResource
>
lambda
=
new
QueryWrapper
<
ProjectResource
>().
lambda
();
lambda
.
eq
(
ProjectResource:
:
getInstanceId
,
instanceId
);
List
<
ProjectResource
>
projectResources
=
projectResourceService
.
getBaseMapper
().
selectList
(
lambda
);
String
finalTaskName
=
taskName
;
String
auditStatusName
=
getAuditStatusName
(
instanceId
);
projectResources
.
forEach
(
item
->
{
item
.
setAuditStatus
(
auditStatusName
);
if
(
"部门审批"
.
equals
(
finalTaskName
)
&&
"1"
.
equals
(
status
)
&&
"equipment"
.
equals
(
type
))
{
item
.
setStatus
(
"1"
);
}
if
(
"流程结束!"
.
equals
(
auditStatusName
))
{
item
.
setStatus
(
"1"
);
item
.
setRemark
(
auditStatusName
);
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
status
)
&&
!
"流程结束!"
.
equals
(
finalTaskName
))
{
if
(
"1"
.
equals
(
status
))
{
item
.
setRemark
(
finalTaskName
+
":"
+
"通过!"
);
}
else
{
item
.
setRemark
(
finalTaskName
+
":"
+
"驳回!"
);
}
}
else
{
item
.
setRemark
(
finalTaskName
);
}
}
});
projectResourceService
.
saveOrUpdateBatch
(
projectResources
);
}
private
String
getAuditStatusName
(
String
instanceId
)
{
JSONObject
dataObject
=
new
JSONObject
();
String
auditName
=
"流程结束!"
;
try
{
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
auditName
=
dataObject
.
getString
(
"name"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"当前流程名称为空"
);
}
return
auditName
;
}
}
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