rev:修改任务参数
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.nl.common.domain.exception.handler;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -29,7 +30,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
class ApiError {
|
||||
|
||||
private Integer status = 400;
|
||||
private String code = "400";
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime timestamp;
|
||||
private String message;
|
||||
@@ -46,7 +47,7 @@ class ApiError {
|
||||
|
||||
public static ApiError error(Integer status, String message){
|
||||
ApiError apiError = new ApiError();
|
||||
apiError.setStatus(status);
|
||||
apiError.setCode(String.valueOf(status));
|
||||
apiError.setMessage(message);
|
||||
return apiError;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,6 @@ public class GlobalExceptionHandler {
|
||||
* 统一返回
|
||||
*/
|
||||
private ResponseEntity<ApiError> buildResponseEntity(ApiError apiError) {
|
||||
return new ResponseEntity<>(apiError, HttpStatus.valueOf(apiError.getStatus()));
|
||||
return new ResponseEntity<>(apiError, HttpStatus.valueOf(Integer.valueOf(apiError.getCode())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SchBaseTaskController {
|
||||
}
|
||||
|
||||
@PutMapping("/operation")
|
||||
public ResponseEntity<Object> update(@RequestBody Map<String, Object> map) {
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject map) {
|
||||
schBaseTaskService.operation(map);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.nl.common.publish.BussEventMulticaster;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.dispatch_manage.task.handler.AbstractTask;
|
||||
import org.nl.wms.dispatch_manage.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.flow_manage.flow.service.deployment.IActReProcdefService;
|
||||
import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
|
||||
import org.nl.wms.flow_manage.monitor.event.FlowStartEvent;
|
||||
import org.nl.wms.md_manage.group_dick.service.IMdGruopDickService;
|
||||
import org.nl.wms.md_manage.group_dick.service.dao.MdGruopDick;
|
||||
@@ -42,6 +44,8 @@ public class GroupDickInStorageTask extends AbstractTask {
|
||||
private IMdPbVehicleMaterService iMdPbVehicleMaterService;
|
||||
@Autowired
|
||||
private IMdGruopDickService iMdGruopDickService;
|
||||
@Autowired
|
||||
private IActReProcdefService iActReProcdefService;
|
||||
|
||||
@Override
|
||||
public JSONObject createTask(JSONObject data) {
|
||||
@@ -59,12 +63,21 @@ public class GroupDickInStorageTask extends AbstractTask {
|
||||
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"组盘信息不存在");
|
||||
}
|
||||
JSONObject mstJ = (JSONObject) JSONObject.toJSON(mst);
|
||||
mstJ.put("stor_code",item.get(0).getStor_code());
|
||||
MdPbVehicleMaterVo vehicleMater = item.get(0);
|
||||
mstJ.put("stor_code", vehicleMater.getStor_code());
|
||||
//更新载具proc_inst_id
|
||||
String currentInstId = vehicleMater.getProc_inst_id();
|
||||
String model_key = "md_group";
|
||||
if (StringUtils.isNotEmpty(currentInstId)){
|
||||
ActReProcdef procdefByInst = iActReProcdefService.getProcdefByInst(currentInstId);
|
||||
if (procdefByInst!=null){
|
||||
model_key = procdefByInst.getModel_key();
|
||||
}
|
||||
}
|
||||
BussEventMulticaster.Publish(
|
||||
new FlowStartEvent("md_group",
|
||||
new FlowStartEvent(model_key,
|
||||
proc_inst_id -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>().set("proc_inst_id",proc_inst_id).eq("vehicle_code",vehicle_code))
|
||||
,new JSONObject(MapOf.of("target_point", point_code1)))
|
||||
,new JSONObject(MapOf.of("start_point", point_code1)))
|
||||
.build("md_group_dick",mst.getId(),mst.getSource_form_type(),mst.getSource_form_id(), mstJ)
|
||||
.build("md_pb_vehicleMater",item)
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.dispatch_manage.task.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.wms.dispatch_manage.task.service.dao.SchBaseTask;
|
||||
@@ -58,6 +59,6 @@ public interface ISchBaseTaskService extends IService<SchBaseTask> {
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
void operation(Map<String, Object> param);
|
||||
void operation(JSONObject param);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.wms.dispatch_manage.task.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@@ -100,8 +103,10 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operation(Map<String, Object> param) {
|
||||
public void operation(JSONObject param) {
|
||||
String taskStatus = param.getString("method_name");
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("status",taskStatus)
|
||||
.eq("task_code",param.getString("task_code")));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.external_system.acs.controller;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.wms.external_system.GateWayService;
|
||||
import org.nl.wms.external_system.dto.InteracteDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,6 +29,6 @@ public class AcsToWmsController {
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> apply(@RequestBody InteracteDto form) {
|
||||
gateWayService.apply(form);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class ExecutionController {
|
||||
jsonObject.put("form_id", actHiExecution.getForm_id());
|
||||
jsonObject.put("form_type", actHiExecution.getForm_type());
|
||||
jsonObject.put("form_data", actHiExecution.getForm_data());
|
||||
jsonObject.put("aux_param", actHiExecution.getAux_param());
|
||||
array.add(jsonObject);
|
||||
}
|
||||
return new ResponseEntity<>(array, HttpStatus.OK);
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.nl.wms.flow_manage.flow.framework.BpmnModel;
|
||||
import org.nl.wms.flow_manage.flow.framework.converter.node.BaseNodeConverter;
|
||||
import org.nl.wms.flow_manage.flow.framework.entity.node.base.impl.FlowNode;
|
||||
import org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.impl.ServerTask;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -24,14 +25,13 @@ public class ServerTaskConverter extends BaseNodeConverter {
|
||||
form.setType(node.getString("type"));
|
||||
form.setCategory(properties.getString("category"));
|
||||
form.setForm_type(properties.getString("form_type"));
|
||||
form.setAuxParam(properties.getJSONObject("auxParam"));
|
||||
JSONObject carry = model.getAuxParam();
|
||||
if (carry!=null){
|
||||
if (form.getAuxParam()!=null){
|
||||
form.getAuxParam().putAll(carry);
|
||||
}else {
|
||||
form.setAuxParam(carry);
|
||||
JSONObject auxParam = properties.getJSONObject("auxParam");
|
||||
if (!CollectionUtils.isEmpty(auxParam)){
|
||||
JSONObject carry = model.getAuxParam();
|
||||
if (carry!=null){
|
||||
auxParam.putAll(carry);
|
||||
}
|
||||
form.setAuxParam(auxParam);
|
||||
}
|
||||
form.setName(properties.getString("name"));
|
||||
form.setDocumentation(properties.getString("documentation"));
|
||||
|
||||
@@ -52,6 +52,7 @@ public abstract class FlowNodeActivityBehavior<T> {
|
||||
.set("activity_id", entity.getActivityId())
|
||||
.set("activity_name", entity.getActivityName())
|
||||
.set("form_type", entity.getForm_type())
|
||||
.set("aux_param", entity.getAuxParam().toString())
|
||||
.set("form_id", entity.getForm_id())
|
||||
.set("remark", "")
|
||||
.set("status", StatusEnum.FLOW_STATUS.code("启动"))
|
||||
@@ -64,6 +65,7 @@ public abstract class FlowNodeActivityBehavior<T> {
|
||||
.eq("proc_inst_id",entity.getProc_inst_id())
|
||||
.set("status", StatusEnum.FLOW_STATUS.code("节点完成"))
|
||||
.set("form_data", entity.getT().toString())
|
||||
.set("aux_param", entity.getAuxParam().toString())
|
||||
.set("form_type",entity.getForm_type())
|
||||
.set("form_id",entity.getForm_id())
|
||||
.set("update_time", DateUtil.now()));
|
||||
@@ -92,6 +94,7 @@ public abstract class FlowNodeActivityBehavior<T> {
|
||||
historyEntity.setForm_type(entity.getForm_type());
|
||||
historyEntity.setForm_id(entity.getForm_id());
|
||||
historyEntity.setForm_data((JSONObject) entity.getT());
|
||||
historyEntity.setAux_param(entity.getAuxParam());
|
||||
historyEntity.setUpdate_time(DateUtil.now());
|
||||
history.save(historyEntity);
|
||||
this.leave(entity);
|
||||
|
||||
@@ -88,6 +88,7 @@ public class EndEventActivityBehavior extends FlowNodeActivityBehavior<JSONObjec
|
||||
entity.setT(parent.getForm_data());
|
||||
entity.setForm_type(parent.getForm_type());
|
||||
entity.setForm_id(parent.getForm_id());
|
||||
entity.setAuxParam(parent.getAux_param());
|
||||
entity.setCurrentFlowElement(flowNode);
|
||||
entity.setDeploymentId(parent.getDeployment_id());
|
||||
entity.setProc_inst_id(parent.getProc_inst_id());
|
||||
|
||||
@@ -80,6 +80,7 @@ public class StartEventActivityBehavior extends FlowNodeActivityBehavior {
|
||||
execution.setParent_id(entity.getParent_id());
|
||||
execution.setForm_id(entity.getForm_id());
|
||||
execution.setForm_data((JSONObject) JSONObject.toJSON(entity.getT()));
|
||||
execution.setAux_param(entity.getAuxParam());
|
||||
execution.setActivity_id(entity.getActivityId());
|
||||
execution.setActivity_name(entity.getActivityName());
|
||||
execution.setCreate_time(DateUtil.now());
|
||||
|
||||
@@ -57,6 +57,8 @@ public class ExecutionEntity<T> implements Cloneable{
|
||||
|
||||
//没有用到?
|
||||
protected BmFormStruc form_struc;
|
||||
//流程全局变量
|
||||
protected JSONObject auxParam = new JSONObject();
|
||||
|
||||
//回调执行
|
||||
protected Consumer callback = null;
|
||||
@@ -76,6 +78,13 @@ public class ExecutionEntity<T> implements Cloneable{
|
||||
this.form_type = form_type;
|
||||
}
|
||||
|
||||
public void setAuxParam(JSONObject auxParam) {
|
||||
if (auxParam == null){
|
||||
auxParam = new JSONObject();
|
||||
}
|
||||
this.auxParam = auxParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.wms.flow_manage.flow.framework.entity.node.impl.task.impl.ServerTa
|
||||
import org.nl.wms.flow_manage.flow.framework.process.nodeType.TypeHandler;
|
||||
import org.nl.wms.flow_manage.flow.framework.process.nodeType.excess.impl.process.classprocess.ClassProcess;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -32,7 +33,14 @@ public class ClassHandler extends TypeHandler<JSONObject,ExecutionEntity<JSONOb
|
||||
if (process==null){
|
||||
throw new BadRequestException("当前serverTask配置的类信息不存在");
|
||||
}
|
||||
JSONObject form = process.process(dto.getT(), flowNode.getAuxParam());
|
||||
JSONObject auxParam = new JSONObject();
|
||||
auxParam.putAll(flowNode.getAuxParam());
|
||||
if (!CollectionUtils.isEmpty(entity.getAuxParam())){
|
||||
auxParam.putAll(entity.getAuxParam());
|
||||
}
|
||||
JSONObject form = process.process(dto.getT(), auxParam);
|
||||
//清空全局配置的数据
|
||||
entity.setAuxParam(new JSONObject());
|
||||
result.put("t",form);
|
||||
//后续:涉及框架的参数提到框架中处理
|
||||
String source_form_type = dto.getForm_type();
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
|
||||
* @Date 2024/5/6 14:34
|
||||
* 出库任务入库任务
|
||||
*/
|
||||
@Service
|
||||
public class OutStorageTaskHandler implements ClassProcess {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -15,4 +15,6 @@ import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
|
||||
public interface IActReProcdefService extends IService<ActReProcdef> {
|
||||
|
||||
ActReProcdef getCurrentVersion(String model_key);
|
||||
|
||||
ActReProcdef getProcdefByInst(String proc_inst_id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.flow_manage.flow.service.deployment.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
|
||||
|
||||
/**
|
||||
@@ -15,4 +16,8 @@ import org.nl.wms.flow_manage.flow.service.deployment.dao.ActReProcdef;
|
||||
public interface ActReProcdefMapper extends BaseMapper<ActReProcdef> {
|
||||
|
||||
ActReProcdef getCurrentVersion(@Param("modelKey") String modelKey, @Param("version")String version);
|
||||
@Select("select act_re_procdef.* from act_re_procdef \n" +
|
||||
"left join act_ru_execution on act_ru_execution.deployment_id = act_re_procdef.deployment_id \n" +
|
||||
"where act_ru_execution.status < '90' and act_ru_execution.deployment_id = #{proc_inst_id} GROUP BY model_key")
|
||||
ActReProcdef getProcdefByInst(String proc_inst_id);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.flow_manage.flow.service.deployment.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.wms.flow_manage.flow.service.deployment.dao.mapper.ActReProcdefMapper;
|
||||
import org.nl.wms.flow_manage.flow.service.deployment.IActReProcdefService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,4 +23,12 @@ public class ActReProcdefServiceImpl extends ServiceImpl<ActReProcdefMapper, Act
|
||||
public ActReProcdef getCurrentVersion(String model_key) {
|
||||
return this.baseMapper.getCurrentVersion(model_key,null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActReProcdef getProcdefByInst(String proc_inst_id) {
|
||||
if (StringUtils.isNotEmpty(proc_inst_id)){
|
||||
return this.baseMapper.getProcdefByInst(proc_inst_id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +97,16 @@ public class ActRuExecution implements Serializable {
|
||||
* 业务类型
|
||||
*/
|
||||
private String form_type;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject aux_param = new JSONObject();
|
||||
/**
|
||||
* 业务数据
|
||||
*/
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject form_data = new JSONObject();;
|
||||
private JSONObject form_data = new JSONObject();
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ActRuExecution> children = new ArrayList<>();
|
||||
|
||||
@@ -62,13 +62,15 @@ public class FlowOperationServiceImpl implements IFlowOperationService {
|
||||
String model_json_string = deployment.getModel_editor_json();
|
||||
//转流程实例:
|
||||
JSONObject model_json = JSONObject.parseObject(model_json_string);
|
||||
BpmnModel bpmnModel = bpmnJSONConverter.convertToBpmnModel(deployment.getModel_key(), deployment.getVersion(), model_json,auxParam);
|
||||
BpmnModel bpmnModel = bpmnJSONConverter.convertToBpmnModel(deployment.getModel_key(), deployment.getVersion(), model_json);
|
||||
System.out.println(bpmnModel.getNodeFlow().size());
|
||||
//auxParam流程扩展数据:1。要么下一个流程才有,要么所有servierTasK都有,要么设置为全局变量消费完就没有,否则一直传递
|
||||
//创建流程参数ExecutionEntity:执行流程
|
||||
ExecutionEntity entity = new ExecutionEntity();
|
||||
entity.setCurrentFlowElement(bpmnModel.getStartEvent());
|
||||
entity.setT(JSONObject.toJSON(dto));
|
||||
entity.setCallback(callback);
|
||||
entity.setAuxParam(auxParam);
|
||||
entity.setForm_type(dto.getForm_type());
|
||||
entity.setForm_id(dto.getForm_id());
|
||||
entity.setStartActivityId(entity.getActivityId());
|
||||
@@ -105,18 +107,11 @@ public class FlowOperationServiceImpl implements IFlowOperationService {
|
||||
JSONObject model_json = JSONObject.parseObject(model_json_string);
|
||||
BpmnModel bpmnModel = bpmnJSONConverter.convertToBpmnModel(deployment.getModel_key(), deployment.getVersion(), model_json);
|
||||
FlowNode flowNode = bpmnModel.getProcesses().get(execution.getActivity_id());
|
||||
if (auxParam!=null){
|
||||
JSONObject param = flowNode.getAuxParam();
|
||||
if (param!=null){
|
||||
flowNode.getAuxParam().putAll(auxParam);
|
||||
}else {
|
||||
flowNode.setAuxParam(auxParam);
|
||||
}
|
||||
}
|
||||
ExecutionEntity entity = new ExecutionEntity();
|
||||
entity.setCurrentFlowElement(flowNode);
|
||||
entity.setProc_inst_id(execution.getProc_inst_id());
|
||||
entity.setParent_id(execution.getParent_id());
|
||||
entity.setAuxParam(execution.getAux_param());
|
||||
entity.setForm_type(execution.getForm_type());
|
||||
entity.setForm_id(execution.getForm_id());
|
||||
entity.setStartActivityId(execution.getActivity_id());
|
||||
|
||||
@@ -70,7 +70,11 @@ public class ActHiExecution implements Serializable {
|
||||
* 业务数据
|
||||
*/
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject form_data = new JSONObject();;
|
||||
private JSONObject form_data = new JSONObject();; /**
|
||||
* 业务数据
|
||||
*/
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject aux_param = new JSONObject();;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -230,8 +230,11 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvOutMapp
|
||||
StIvtIostorinv iostorinv = form.toJavaObject(StIvtIostorinv.class);
|
||||
//查询明细/api/bmFormStruc/getTypes
|
||||
List<StIvtIostorinvdtlVo> dtlVo = iStIvtIostorinvDtlService.getDtlVo(iostorinv.getId());
|
||||
Set<String> vechiles = dtlVo.stream().map(StIvtIostorinvdtlVo::getVehicle_code).collect(Collectors.toSet());
|
||||
//扔一个物料信息进去
|
||||
BussEventMulticaster.Publish(new FlowStartEvent("st_ivt_iostorinv_"+(iostorinv.getIn_storage()?"in":"out"), null,null)
|
||||
BussEventMulticaster.Publish(new FlowStartEvent("st_ivt_iostorinv_"+(iostorinv.getIn_storage()?"in":"out"),
|
||||
proc_inst_id -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
|
||||
.set("proc_inst_id",proc_inst_id).in("vehicle_code",vechiles)),null)
|
||||
.build("st_ivt_iostorinv",iostorinv.getId(),iostorinv.getSource_form_type(),iostorinv.getSource_form_id(),form)
|
||||
.build("st_ivt_iostorinvdtl",dtlVo)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user