Merge branch 'feature_day_1102' into 'main'

工作许可申请提交工作流管理

See merge request likehai/ytr-god!23
This commit is contained in:
王燕 2023-11-02 17:58:40 +08:00
commit 39fbc9ccec
10 changed files with 441 additions and 3 deletions

View File

@ -101,4 +101,14 @@ public class QyzyPermitReportController extends BaseController
{
return toAjax(qyzyPermitReportService.deleteQyzyPermitReportByIds(ids));
}
/**
* 提交流程
* @param id
* @return
*/
@PostMapping("/subProcess/{id}")
public AjaxResult subProcess(@PathVariable("id") String id){
return toAjax(qyzyPermitReportService.subProcess(id));
}
}

View File

@ -22,6 +22,10 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.god</groupId>
<artifactId>god-system</artifactId>
</dependency>
</dependencies>

View File

@ -0,0 +1,41 @@
package com.god.passenger.operation.listener;
import com.god.common.utils.DateUtils;
import com.god.common.utils.ip.AddressUtils;
import com.god.common.utils.spring.SpringUtils;
import com.god.passenger.operation.service.IQyzyPermitReportService;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.engine.impl.el.FixedValue;
import org.flowable.task.service.delegate.DelegateTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 工作许可申请监听
*
* @author wangyan21
* @date 2023年11月2号
*
*/
@Component("workPermitApplyListener")
public class WorkPermitApplyListener implements TaskListener {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkPermitApplyListener.class);
public FixedValue state;
public FixedValue getState() {
return state;
}
public void setState(FixedValue state) {
this.state = state;
}
@Override
public void notify(DelegateTask delegateTask) {
String processInstanceId = delegateTask.getProcessInstanceId();
IQyzyPermitReportService qyzyPermitReportService= SpringUtils.getBean("qyzyPermitReportService");
qyzyPermitReportService.updateState(processInstanceId,getState().getExpressionText());
LOGGER.info("-->>工作许可审批时间:{},--->>审批状态:{}", DateUtils.dateTimeNow(),getState().toString());
}
}

View File

@ -3,6 +3,7 @@ package com.god.passenger.operation.mapper;
import java.util.List;
import com.god.passenger.operation.domain.QyzyPermitReport;
import org.apache.ibatis.annotations.Param;
/**
* 工作许可报备Mapper接口
@ -58,4 +59,12 @@ public interface QyzyPermitReportMapper {
* @return 结果
*/
public int deleteQyzyPermitReportByIds(String[] ids);
/**
* 更新单据状态
* @param id
* @param eventType
* @return
*/
public int updateState(@Param("id") String id, @Param("eventType") String eventType);
}

View File

@ -58,4 +58,21 @@ public interface IQyzyPermitReportService
* @return 结果
*/
public int deleteQyzyPermitReportById(String id);
/**
* 提交流程
*
* @param id
* @return
*/
public int subProcess(String id);
/**
* 更新单据状态
*
* @param id
* @param state
* @return
*/
public int updateState(String id, String state);
}

View File

@ -1,26 +1,41 @@
package com.god.passenger.operation.service.impl;
import java.util.HashMap;
import java.util.List;
import com.god.common.utils.DateUtils;
import com.god.common.utils.SecurityUtils;
import com.god.common.utils.StringUtils;
import com.god.common.utils.uuid.IdUtils;
import com.god.passenger.operation.listener.WorkPermitApplyListener;
import org.flowable.engine.IdentityService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.god.passenger.operation.mapper.QyzyPermitReportMapper;
import com.god.passenger.operation.domain.QyzyPermitReport;
import com.god.passenger.operation.service.IQyzyPermitReportService;
import javax.annotation.Resource;
/**
* 工作许可报备Service业务层处理
*
* @author wangyan
* @date 2023-10-30
*/
@Service
@Service("qyzyPermitReportService")
public class QyzyPermitReportServiceImpl implements IQyzyPermitReportService {
private static final Logger LOGGER = LoggerFactory.getLogger(QyzyPermitReportServiceImpl.class);
@Autowired
private QyzyPermitReportMapper qyzyPermitReportMapper;
@Resource
private RuntimeService runtimeService;
@Resource
IdentityService identityService;
/**
* 查询工作许可报备
@ -91,4 +106,33 @@ public class QyzyPermitReportServiceImpl implements IQyzyPermitReportService {
public int deleteQyzyPermitReportById(String id) {
return qyzyPermitReportMapper.deleteQyzyPermitReportById(id);
}
/**
* 提交流程
*
* @param id
* @return
*/
public int subProcess(String id) {
Long userId = SecurityUtils.getLoginUser().getUserId();
identityService.setAuthenticatedUserId(String.valueOf(userId));
HashMap<String, Object> variables = new HashMap<>();
variables.put("INITIATOR", String.valueOf(userId));//设置流程发起人
runtimeService.startProcessInstanceByKey("work_permit_apply_two", String.valueOf(id), variables);
QyzyPermitReport qyzyPermitReport = qyzyPermitReportMapper.selectQyzyPermitReportById(id);
qyzyPermitReport.setEventType("待审批");
return qyzyPermitReportMapper.updateQyzyPermitReport(qyzyPermitReport);
}
/**
* 更新单据状态
*
* @param instanceId
* @param state
* @return
*/
public int updateState(String instanceId, String state) {
ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
return qyzyPermitReportMapper.updateState(process.getBusinessKey(), state);
}
}

View File

@ -126,4 +126,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<update id="updateState" parameterType="String">
update qyzy_permit_report
set event_type = #{eventType}
where id = #{id}
</update>
</mapper>

View File

@ -42,3 +42,10 @@ export function delReport(id) {
method: 'delete'
})
}
export function subProcess(id){
return request({
url: '/permit/report/subProcess/'+id,
method: 'post'
})
}

View File

@ -0,0 +1,274 @@
<template>
<div class="app-container">
<!-- 添加或修改工作许可报备对话框 -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="作业名称" prop="workName">
<el-input v-model="form.workName" placeholder="请输入作业名称" />
</el-form-item>
<el-form-item label="申请人" prop="applyName">
<el-input v-model="form.applyName" placeholder="请输入申请人" />
</el-form-item>
<el-form-item label="部门" prop="applyDept">
<el-input v-model="form.applyDept" placeholder="请输入部门" />
</el-form-item>
<el-form-item label="电话" prop="phoneInfo">
<el-input v-model="form.phoneInfo" placeholder="请输入申请人电话" />
</el-form-item>
<el-form-item label="申请日期" prop="applyTime">
<el-date-picker clearable
v-model="form.applyTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择申请日期">
</el-date-picker>
</el-form-item>
<el-form-item label="作业内容" prop="workContent">
<el-input v-model="form.workContent" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-if="showBtn"> </el-button>
<!-- <el-button @click="cancel"> </el-button>-->
</div>
</div>
</template>
<script>
import { listReport, getReport, delReport, addReport, updateReport } from "@/api/operation/report";
export default {
//
name: "WorkApplicationDetail",
props: {
businessInfo: {
type: Object,
default: null
},
doapproved: {
type: Function,
default: null
}
},
watch: {
businessInfo: {
deep: true,
handler(value) {
console.log("-->>查看监听内容:",value);
this.businessId = value.bussinesskey
this.operType = value.operType
if ('detail' === this.operType) {
this.disabled = true
this.showBtn = false
this.edit = true
} else if ('edit' === this.operType) {
this.disabled = true
this.showBtn = false
this.edit = false
} else {
this.disabled = false
this.showBtn = true
this.edit = true
}
//
this.getdetail();
},
immediate: true
}
},
dicts: ['qyzy_event_type','qyzy_apply_status'],
data() {
return {
value: [],
managementIndex: [],
options: [
{
value: '',
label: ''
}],
businessId: '',
operType: '',
disabled: false,
showBtn: false,
deit: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
reportList: [],
//
title: "",
//
open: false,
//
daterangeApplyTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
applyName: null,
applyDept: null,
phoneInfo: null,
applyTime: null,
applyReason: null,
startTime: null,
endTime: null,
workContent: null,
eventType: null,
dataType: "工作许可申请",
applyEvent: null,
workName: null,
hazardInfo: null,
safetyInfo: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
//
getdetail() {
this.reset()
if (this.businessId !== '' && this.businessId != null) {
getReport(this.businessId).then(response => {
this.form = response.data
})
}
},
/** 查询工作许可申请列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeApplyTime && '' != this.daterangeApplyTime) {
this.queryParams.params["beginApplyTime"] = this.daterangeApplyTime[0];
this.queryParams.params["endApplyTime"] = this.daterangeApplyTime[1];
}
listReport(this.queryParams).then(response => {
this.reportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.reset();
this.$emit('close');
},
//
reset() {
this.form = {
id: null,
applyName: null,
applyDept: null,
phoneInfo: null,
applyTime: null,
applyReason: null,
startTime: null,
endTime: null,
workContent: null,
eventType: null,
dataType: null,
createBy: null,
createTime: null,
applyEvent: null,
workName: null,
hazardInfo: null,
safetyInfo: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeApplyTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getReport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工作许可申请";
});
},
/** 提交按钮 */
submitForm() {
// console.log("-->>ID",this.businessId);
if (this.doapproved) {
this.doapproved()
}
// this.$refs["form"].validate(valid => {
// if (valid) {
// if (this.form.id != null) {
// updateReport(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// } else {
// addReport(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
// }
// });
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除工作许可申请编号为"' + ids + '"的数据项?').then(function() {
return delReport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/report/export', {
...this.queryParams
}, `report_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -159,6 +159,13 @@
@click="handleDelete(scope.row)"
v-hasPermi="['system:report:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-user"
@click="handleSub(scope.row)"
>提交审批
</el-button>
</template>
</el-table-column>
</el-table>
@ -251,11 +258,16 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog >
</div>
</template>
<script>
import { listReport, getReport, delReport, addReport, updateReport } from "@/api/operation/report";
import { listReport, getReport, delReport, addReport, updateReport ,subProcess} from "@/api/operation/report";
export default {
//
@ -313,6 +325,20 @@ export default {
this.getList();
},
methods: {
//
handleSub(row) {
this.loading = true
subProcess(row.id).then((response) => {
this.$modal.msgSuccess(response.msg)
this.getList()
this.loading = false
})
},
//
coloseDetail() {
this.open = false
this.getList()
},
/** 查询工作许可申请列表 */
getList() {
this.loading = true;