1.巡检触发流程
1.1 startEvent
baseNo
baseName
eventDesc
eventOccurTime
location
eventReportPerson
device
devicePoint
level
patrolErrorIds
startMethod
1.2 scriptTask(groovy)
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import groovy.json.*
def jsonSlurper = new JsonSlurper()
def reportPerson = execution.getVariable("eventReportPerson")
def reportPerson_array = []
def reportPerson_json = jsonSlurper.parseText(reportPerson)
reportPerson_array = reportPerson_json.value
execution.setVariable("initiator", reportPerson_array[0])
def processInstanceId = execution.getVariable("processInstanceId")
def patrolErrorIds = execution.getVariable("patrolErrorIds")
def patrolErrorIds_array = patrolErrorIds.split(",")
patrolErrorIds_array.each { s ->
def params = [
"processInstanceId": processInstanceId,
"id" : s,
]
def path = 'http://dcom-http:8080/bj/process/patrolError/updateProcess'
def http = new HTTPBuilder(path)
http.request(Method.POST) {
requestContentType = ContentType.JSON
body = params
response.failure = { resp ->
org.slf4j.LoggerFactory.getLogger("--->from groovy ").warn("Request failed with status ${resp.status}")
}
}
}
1.3 gateWay 判定条件
${startMethod=='manual'}
${startMethod=='patrol'}
${startMethod=='dcim'}
2.派发触发工具领用
2.1 startEvent
baseNo
initiator = "systemAuto"
baseName
startDepartment
startDateTime
endDateTime
applyInfo
distributor
toolsID
2.2 scriptTask(groovy)
def distributor = execution.getVariable("distributor");
execution.setVariable("initiator", distributor);
2.3 gateWay 判定条件
${initiator=='systemAuto'}
${initiator!='systemAuto'}
3.管理流程
3.1 scriptTask(groovy)
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import groovy.json.*
def jsonSlurper = new JsonSlurper()
def file_json = execution.getVariable('file')
def file = jsonSlurper.parseText(file_json)
def projectName_json = execution.getVariable('projectName')
def projectName = jsonSlurper.parseText(projectName_json)
def projectName_ID = projectName.value[0]
def params = [
reportId : execution.getVariable('baseName'),
dataCenter : projectName_ID,
reportPerson : execution.getVariable('person'),
submitTime : System.currentTimeMillis(),
yesterdaySummary : execution.getVariable('yesterdaySummary'),
todayPlan : execution.getVariable('todayPlan'),
riskAndQuestionNum: execution.getVariable('riskAndQuestionNum'),
riskAndQuestion : execution.getVariable('riskAndQuestion'),
others : execution.getVariable('others'),
fileId : file.url.join(','),
fileName : file.name.join(',')
]
org.slf4j.LoggerFactory.getLogger("--->from groovy updateDailyReport:").info("params:$params");
def path = 'http://dcom-http:8080/bj/dailyReport/add'
def http = new HTTPBuilder(path)
http.request(Method.POST) {
requestContentType = ContentType.JSON
body = params
response.failure = { resp ->
org.slf4j.LoggerFactory.getLogger("--->from groovy ").warn("Update Daily Report file Request failed with status ${resp.status}")
}
}
execution.removeVariable('file')
execution.removeVariable('projectName')
execution.removeVariable('person')
execution.removeVariable('yesterdaySummary')
execution.removeVariable('todayPlan')
execution.removeVariable('riskAndQuestionNum')
execution.removeVariable('riskAndQuestion')
execution.removeVariable('others')