TblComplianceReviewController.java
7.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package com.ruoyi.compliancemanagement.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.compliancemanagement.domain.TblComplianceReview;
import com.ruoyi.compliancemanagement.domain.TblContract;
import com.ruoyi.compliancemanagement.domain.bo.TblBusinessWorkflowBo;
import com.ruoyi.compliancemanagement.domain.bo.TblContractBo;
import com.ruoyi.compliancemanagement.model.TblComplianceReviewModel;
import com.ruoyi.compliancemanagement.service.ITblBusinessWorkflowService;
import com.ruoyi.workflow.service.IWfProcessService;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.compliancemanagement.domain.vo.TblComplianceReviewVo;
import com.ruoyi.compliancemanagement.domain.bo.TblComplianceReviewBo;
import com.ruoyi.compliancemanagement.service.ITblComplianceReviewService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 合规审查
*
* @author ruoyi
* @date 2024-07-22
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/compliancemanagement/complianceReview")
public class TblComplianceReviewController extends BaseController {
private final ITblComplianceReviewService iTblComplianceReviewService;
private final IWfProcessService iWfProcessService;
private final ITblBusinessWorkflowService iTblBusinessWorkflowService;
/**
* 查询合规审查列表
*/
@SaCheckPermission("compliancemanagement:complianceReview:list")
@GetMapping("/list")
public TableDataInfo<TblComplianceReviewModel> list(TblComplianceReviewBo bo, PageQuery pageQuery) {
return iTblComplianceReviewService.queryPageList(bo, pageQuery);
}
/**
* 导出合规审查列表
*/
@SaCheckPermission("compliancemanagement:complianceReview:export")
@Log(title = "合规审查", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(TblComplianceReviewBo bo, HttpServletResponse response) {
List<TblComplianceReviewVo> list = iTblComplianceReviewService.queryList(bo);
ExcelUtil.exportExcel(list, "合规审查", TblComplianceReviewVo.class, response);
}
/**
* 获取合规审查详细信息
*
* @param id 主键
*/
@SaCheckPermission("compliancemanagement:complianceReview:query")
@GetMapping("/{id}")
public R<TblComplianceReviewVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(iTblComplianceReviewService.queryById(id));
}
/**
* 新增合规审查
*/
// @SaCheckPermission("compliancemanagement:complianceReview:add")
// @Log(title = "合规审查", businessType = BusinessType.INSERT)
// @RepeatSubmit()
// @PostMapping()
// public R<Void> add(@Validated(AddGroup.class) @RequestBody TblComplianceReviewBo bo) {
// return toAjax(iTblComplianceReviewService.insertByBo(bo));
// }
@Transactional(rollbackFor = Exception.class)
@SaCheckPermission("compliancemanagement:complianceReview:addAndStart")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> addAndStart(
@Validated(AddGroup.class) @RequestBody TblComplianceReviewBo bo) {
String procDefId = "Process_1721285503125:1:020637e9-489a-11ef-a90d-421c839c76ba";
iTblComplianceReviewService.insertByBo(bo);
Long id = bo.getId();
if (id > 0 || id != null){
Map<String, Object> variables = new HashMap<>();
// fromSource用来标识此事项是提交来源是客户端还是移动端
//合同编号
variables.put("contractno", bo.getContractno());
// 合同名称
variables.put("contractName",bo.getContractName());
// 合同类型
variables.put("contractType",Long.valueOf(bo.getContractType()));
// 生效日期
variables.put("effectiveDate", bo.getEffectiveDate());
// 到期日期
variables.put("expirationDate", bo.getExpirationDate());
// 甲方
variables.put("partyA", bo.getPartyA());
// 甲方链接地址
variables.put("partyAAddress", bo.getPartyAAddress());
// 乙方
variables.put("partyB", bo.getPartyB());
// 乙方链接地址
variables.put("partyBAddress", bo.getPartyBAddress());
// 签订日期
variables.put("signingDate", bo.getSigningDate());
// 标的物信息
variables.put("subjectInformation", bo.getSubjectInformation());
// 附件
variables.put("attachments", bo.getAttachments());
// 启动流程
ProcessInstance processInstance = iWfProcessService.startProcessByDefId(procDefId, variables);
if(null != processInstance){
TblBusinessWorkflowBo tblBusinessWorkflowBo = new TblBusinessWorkflowBo();
tblBusinessWorkflowBo.setBusinessId(id);
tblBusinessWorkflowBo.setProcInsId(processInstance.getProcessInstanceId());
tblBusinessWorkflowBo.setProcDefId(procDefId);
tblBusinessWorkflowBo.setDeployId(processInstance.getDeploymentId());
TableName table = TblComplianceReview.class.getAnnotation(TableName.class);
tblBusinessWorkflowBo.setTableName(table.value());
iTblBusinessWorkflowService.insertByBo(tblBusinessWorkflowBo);
}
return R.ok("成功");
}else{
return R.fail("系统故障!");
}
}
/**
* 修改合规审查
*/
@SaCheckPermission("compliancemanagement:complianceReview:edit")
@Log(title = "合规审查", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TblComplianceReviewBo bo) {
return toAjax(iTblComplianceReviewService.updateByBo(bo));
}
/**
* 删除合规审查
*
* @param ids 主键串
*/
@SaCheckPermission("compliancemanagement:complianceReview:remove")
@Log(title = "合规审查", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(iTblComplianceReviewService.deleteWithValidByIds(Arrays.asList(ids), true));
}
}