8 changed files with 235 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||||
|
package org.dromara.workflow.api.domain; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class FlowLabelVo { |
||||
|
|
||||
|
|
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 流程类型 |
||||
|
*/ |
||||
|
private String flowType; |
||||
|
|
||||
|
/** |
||||
|
* 流程编码 |
||||
|
*/ |
||||
|
private String flowCode; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package org.dromara.sample.wayline.model.dto; |
||||
|
|
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo; |
||||
|
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; |
||||
|
import org.dromara.sample.wayline.model.entity.AiComparePlateEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @auther yq |
||||
|
* @data 2025/3/29 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode() |
||||
|
public class AiCompareAlertDTO { |
||||
|
|
||||
|
private String fileId; |
||||
|
private String compareId; |
||||
|
|
||||
|
private String jobId; |
||||
|
private String jobName; |
||||
|
|
||||
|
private String discernImgUrl; |
||||
|
|
||||
|
private List<RemoteBusinessAlertVo> handleList; |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package org.dromara.workflow.controller; |
||||
|
|
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.workflow.common.ConditionalOnEnable; |
||||
|
import org.dromara.workflow.domain.FlowLabel; |
||||
|
import org.dromara.workflow.service.FlwLabelService; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
@Tag(name = "流程部门管理") |
||||
|
@ConditionalOnEnable |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/flow/label") |
||||
|
public class FlwLabelController { |
||||
|
|
||||
|
|
||||
|
private final FlwLabelService flwDepartService; |
||||
|
|
||||
|
/** |
||||
|
* 查询流程标签关系 |
||||
|
* flowCode |
||||
|
*/ |
||||
|
@Operation(summary = "查询流程标签关系",description = "查询流程标签关系") |
||||
|
@GetMapping("/{flowCode}/getInfo") |
||||
|
public R<FlowLabel> getInfo(@PathVariable String flowCode) { |
||||
|
return R.ok(flwDepartService.getInfo(flowCode)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 绑定流程标签关系 |
||||
|
* flowCode |
||||
|
*/ |
||||
|
@Operation(summary = "绑定流程标签关系",description = "绑定流程标签关系") |
||||
|
@PostMapping("/bind/label") |
||||
|
public R<FlowLabel> bindLabel(@Validated({AddGroup.class}) @RequestBody FlowLabel flowLabel) { |
||||
|
return R.ok(flwDepartService.bindLabel(flowLabel)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package org.dromara.workflow.domain; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import jakarta.validation.constraints.NotNull; |
||||
|
import lombok.Data; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.workflow.handler.ListTypeHandler; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 部门流程关系表 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName(value = "flow_label",autoResultMap = true) |
||||
|
public class FlowLabel { |
||||
|
|
||||
|
|
||||
|
@TableId(type = IdType.ASSIGN_ID) |
||||
|
private Long id; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 流程编码 |
||||
|
*/ |
||||
|
@NotNull(message = "流程编码不能为空", groups = AddGroup.class) |
||||
|
private String flowCode; |
||||
|
|
||||
|
/** |
||||
|
* 租户编号 |
||||
|
*/ |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** |
||||
|
* 部门id集合 |
||||
|
*/ |
||||
|
@TableField(value = "label_ids",typeHandler = ListTypeHandler.class) |
||||
|
List<String> labelIds; |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package org.dromara.workflow.mapper; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
import org.dromara.workflow.domain.FlowLabel; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface FlwLabelMapper extends BaseMapperPlus<FlowLabel, FlowLabel> { |
||||
|
FlowLabel getFlowLabel(@Param("labelId") String labelId); |
||||
|
|
||||
|
Integer checkFlowLabel(@Param("labelIds") List<String> labelIds); |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package org.dromara.workflow.service; |
||||
|
|
||||
|
import org.dromara.workflow.domain.FlowLabel; |
||||
|
|
||||
|
public interface FlwLabelService { |
||||
|
FlowLabel getInfo(String flowCode); |
||||
|
|
||||
|
FlowLabel bindLabel(FlowLabel flowDepart); |
||||
|
|
||||
|
FlowLabel getFlowLabel(String labelId); |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package org.dromara.workflow.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.dromara.common.core.exception.ServiceException; |
||||
|
import org.dromara.workflow.domain.FlowLabel; |
||||
|
import org.dromara.workflow.mapper.FlwLabelMapper; |
||||
|
import org.dromara.workflow.service.FlwLabelService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class FlwLabelServiceImpl extends ServiceImpl<FlwLabelMapper, FlowLabel> implements FlwLabelService { |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public FlowLabel getInfo(String flowCode) { |
||||
|
LambdaQueryWrapper<FlowLabel> wrapper = new LambdaQueryWrapper<>(); |
||||
|
wrapper.eq(FlowLabel::getFlowCode, flowCode); |
||||
|
|
||||
|
return this.baseMapper.selectOne(wrapper); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public FlowLabel bindLabel(FlowLabel flowDepart) { |
||||
|
LambdaQueryWrapper<FlowLabel> updateWrapper = new LambdaQueryWrapper<>(); |
||||
|
updateWrapper.eq(FlowLabel::getFlowCode, flowDepart.getFlowCode()); |
||||
|
this.baseMapper.delete(updateWrapper); |
||||
|
|
||||
|
if (ObjectUtil.isNotEmpty(flowDepart.getLabelIds())) { |
||||
|
//查询部门是否还存在别的流程
|
||||
|
if (this.baseMapper.checkFlowLabel(flowDepart.getLabelIds()) > 0){ |
||||
|
throw new ServiceException("所选的标签中,已存在在其他流程中,请检查后在提交!"); |
||||
|
} |
||||
|
|
||||
|
this.baseMapper.insert(flowDepart); |
||||
|
} |
||||
|
|
||||
|
return flowDepart; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public FlowLabel getFlowLabel(String labelId) { |
||||
|
return this.baseMapper.getFlowLabel(labelId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.dromara.workflow.mapper.FlwLabelMapper"> |
||||
|
|
||||
|
<select id="getFlowLabel" resultType="org.dromara.workflow.domain.FlowLabel"> |
||||
|
select fd.* from flow_label fd where JSON_CONTAINS(fd.label_ids, #{labelId}) |
||||
|
</select> |
||||
|
|
||||
|
<select id="checkFlowLabel" resultType="java.lang.Integer"> |
||||
|
SELECT |
||||
|
count(1) |
||||
|
FROM flow_label fd |
||||
|
where |
||||
|
<foreach collection="labelIds" item="item" open="(" separator=" OR " close=")"> |
||||
|
JSON_CONTAINS(fd.label_ids, CONCAT('"', #{item}, '"')) |
||||
|
</foreach> |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue