流程新增业务key,优化
This commit is contained in:
1 parent
56199cbe7c
commit
89715d39f0
10 files changed
+102
-21
No files matched your search
+12
@@ -0,0 +1,12 @@
|
||||
package com.bsd.pjcloud.canteen.constant;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public final class CanteenFlowConstant {
|
||||
|
||||
/**
|
||||
* 包厢预约流程标识
|
||||
*/
|
||||
public static final String bx_marking_flow= "BX_MARKING_FLOW";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.dto.flow;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BxMarkingFlowDto {
|
||||
|
||||
/**
|
||||
* 包厢时间
|
||||
*/
|
||||
private String boxesName;
|
||||
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private String markTime;
|
||||
}
|
||||
+12
-4
@@ -10,6 +10,8 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
import com.bsd.pjcloud.canteen.service.BoxesBookingService;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordParamDto;
|
||||
import org.apache.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -136,13 +138,19 @@ public class BoxesBookingController {
|
||||
|
||||
@PostMapping("/flow-callback")
|
||||
@Operation(summary = "流程节点回调通知")
|
||||
@Inner
|
||||
public R createBooking(@RequestBody ProcessNodeRecordParamDto processNodeRecordParamDto) {
|
||||
|
||||
// String flowId = processNodeRecordParamDto.getFlowId();
|
||||
// BoxesBookingEntity boxesBookingEntity = new BoxesBookingEntity();
|
||||
// boxesBookingEntity.setProcessInstanceId(flowId);
|
||||
// boxesBookingEntity.setCheckStatus();
|
||||
String processInstanceId = processNodeRecordParamDto.getProcessInstanceId();
|
||||
BoxesBookingEntity boxesBookingEntity = new BoxesBookingEntity();
|
||||
boxesBookingEntity.setProcessInstanceId(processInstanceId);
|
||||
boxesBookingEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
System.out.println("***************************");
|
||||
System.out.println(processNodeRecordParamDto.getData());
|
||||
// boxesBookingService.update()
|
||||
LambdaQueryWrapper<BoxesBookingEntity> boxesBookingEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
boxesBookingEntityLambdaQueryWrapper.eq(BoxesBookingEntity::getProcessInstanceId, processInstanceId);
|
||||
boxesBookingService.update(boxesBookingEntity,boxesBookingEntityLambdaQueryWrapper);
|
||||
System.out.println(processNodeRecordParamDto);
|
||||
return R.ok();
|
||||
|
||||
|
||||
+19
-17
@@ -1,6 +1,9 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.constant.CanteenFlowConstant;
|
||||
import com.bsd.pjcloud.canteen.dto.flow.BxMarkingFlowDto;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesBookingEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.BoxesInfoEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.BoxesAvailabilityMapper;
|
||||
@@ -10,13 +13,17 @@ import com.bsd.pjcloud.canteen.service.BoxesBookingService;
|
||||
import com.bsd.pjcloud.canteen.vo.AppMakeSaveReqVO;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowApiFlowService;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessInstanceParamDto;
|
||||
import com.bsd.pjcloud.flow.task.entity.Process;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 包厢预约记录表
|
||||
@@ -35,6 +42,8 @@ public class BoxesBookingServiceImpl extends ServiceImpl<BoxesBookingMapper, Box
|
||||
private final BoxesAvailabilityMapper bookingAvailabilityMapper;
|
||||
|
||||
private final RemoteFlowApiFlowService remoteFlowApiFlowService;
|
||||
|
||||
|
||||
@Override
|
||||
public R createBooking(AppMakeSaveReqVO createReqVO) {
|
||||
BoxesInfoEntity infoDO = boxesInfoMapper.selectById(createReqVO.getBoxesId());
|
||||
@@ -58,24 +67,17 @@ public class BoxesBookingServiceImpl extends ServiceImpl<BoxesBookingMapper, Box
|
||||
booking.setDeptId(infoDO.getDeptId());
|
||||
|
||||
|
||||
//todo 工作流部分,待定
|
||||
// Map<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
// objectObjectHashMap.put("deptId", infoDO.getDeptId());
|
||||
// String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
// new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
// .setBusinessKey(String.valueOf(booking.getId()))
|
||||
// .setVariables(objectObjectHashMap));
|
||||
//
|
||||
//
|
||||
// // 将工作流的编号,更新到 OA 请假单中
|
||||
// BookingDO bookingDO = new BookingDO();
|
||||
// bookingDO.setId(booking.getId());
|
||||
// bookingDO.setProcessInstanceId(processInstanceId);
|
||||
|
||||
// bookingMapper.updateById(bookingDO);
|
||||
// 启动流程
|
||||
// 工作
|
||||
ProcessInstanceParamDto processInstanceParamDto = new ProcessInstanceParamDto();
|
||||
processInstanceParamDto.setFlowId("P20250205113641052EBCRV");
|
||||
R<Process> processByBusinessKey = remoteFlowApiFlowService.getProcessByBusinessKey(CanteenFlowConstant.bx_marking_flow);
|
||||
String flowId = processByBusinessKey.getData().getFlowId();
|
||||
processInstanceParamDto.setFlowId(flowId);
|
||||
|
||||
BxMarkingFlowDto bxMarkingFlowDto = new BxMarkingFlowDto();
|
||||
bxMarkingFlowDto.setBoxesName(infoDO.getName());
|
||||
bxMarkingFlowDto.setMarkTime(createReqVO.getBxDate() + " " + createReqVO.getStartTime() + "-" + createReqVO.getEndTime());
|
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(bxMarkingFlowDto);
|
||||
processInstanceParamDto.setParamMap(stringObjectMap);
|
||||
R<String> stringR = remoteFlowApiFlowService.startProcessInstance(processInstanceParamDto);
|
||||
booking.setCheckStatus("0");
|
||||
booking.setProcessInstanceId(stringR.getData());
|
||||
|
||||
+9
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.flow.task.api.feign;
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessInstanceParamDto;
|
||||
import com.bsd.pjcloud.flow.task.entity.Process;
|
||||
import com.bsd.pjcloud.flow.task.vo.FormGroupVo;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -47,4 +48,12 @@ public interface RemoteFlowApiFlowService {
|
||||
@PostMapping("/process-instance/startProcessInstance")
|
||||
R<String> startProcessInstance(@RequestBody ProcessInstanceParamDto paramDto);
|
||||
|
||||
|
||||
/**
|
||||
* 获取流程数据
|
||||
* @param businessKey 业务key
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/process/getProcessByBusinessKey")
|
||||
R<Process> getProcessByBusinessKey(@RequestParam("businessKey")String businessKey);
|
||||
}
|
||||
+6
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.flow.task.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -135,4 +136,9 @@ public class Process {
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@Schema(description = "业务key")
|
||||
@TableField("business_key")
|
||||
private String businessKey;
|
||||
|
||||
}
|
||||
+2
@@ -27,6 +27,8 @@ public class CombinationGroupController {
|
||||
return combinationGroupService.listGroupWithProcess(page, groupId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有我可以发起的表单组
|
||||
* @return
|
||||
|
||||
+9
@@ -24,6 +24,15 @@ public class ProcessController {
|
||||
return processService.getDetail(flowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程数据
|
||||
* @param businessKey 业务key
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getProcessByBusinessKey")
|
||||
public R<Process> getProcessByBusinessKey(@RequestParam("businessKey")String businessKey) {
|
||||
return processService.getProcessByBusinessKey(businessKey);
|
||||
}
|
||||
/**
|
||||
* 创建流程
|
||||
* @param process
|
||||
|
||||
+7
@@ -43,4 +43,11 @@ public interface IProcessService extends IService<Process> {
|
||||
*/
|
||||
R update(String flowId, String type, Long groupId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据业务key获取流程
|
||||
* @param businessKey
|
||||
* @return
|
||||
*/
|
||||
R<Process> getProcessByBusinessKey(String businessKey);
|
||||
}
|
||||
+8
@@ -224,6 +224,7 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
p.setUniqueId(IdUtil.fastSimpleUUID());
|
||||
p.setAdminList(process.getAdminList());
|
||||
p.setRangeShow(stringBuilder.toString());
|
||||
p.setBusinessKey(process.getBusinessKey());
|
||||
|
||||
this.save(p);
|
||||
|
||||
@@ -259,4 +260,11 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Process> getProcessByBusinessKey(String businessKey) {
|
||||
Process one = this.lambdaQuery().eq(Process::getBusinessKey, businessKey).eq(Process::getHidden, false)
|
||||
.one();
|
||||
return R.ok(one);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user