Browse Source

提交:标签

pull/1/head
袁强 3 months ago
parent
commit
4fb627b255
  1. 8
      dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/mqtt/TopicConst.java
  2. 16
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java
  3. 5
      dk-modules/sample/src/main/resources/mapper/AiCompareMapper.xml
  4. 11
      dk-modules/system/src/main/java/org/dromara/system/controller/system/SysPostController.java
  5. 2
      dk-modules/system/src/main/java/org/dromara/system/domain/AiLabel.java
  6. 2
      dk-modules/system/src/main/java/org/dromara/system/domain/AiLabelPost.java
  7. 2
      dk-modules/system/src/main/java/org/dromara/system/domain/bo/AiLabelPostBindBo.java
  8. 2
      dk-modules/system/src/main/java/org/dromara/system/domain/vo/SysPostVo.java
  9. 7
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java
  10. 4
      dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java
  11. 8
      dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java
  12. 1
      dk-modules/system/src/main/java/org/dromara/system/service/ISysPostService.java
  13. 7
      dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java
  14. 29
      dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java
  15. 20
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysPostServiceImpl.java
  16. 6
      dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml

8
dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/mqtt/TopicConst.java

@ -39,4 +39,12 @@ public class TopicConst {
public static final String UP = "/up";
public static final String DOWN = "/down";
public static final String IMAGE = "image/";
// 比对
public static final String COMPARE = "compare";
//画框
public static final String FRAME = "frame";
}

16
dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

@ -10,13 +10,13 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.BatchResult;
import org.dromara.common.core.constant.AiCompareStatusConstants;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.sdk.mqtt.MqttGatewayPublish;
import org.dromara.common.sdk.mqtt.TopicConst;
import org.dromara.sample.wayline.mapper.IAiCompareMapper;
import org.dromara.sample.wayline.mapper.IWaylineJobMapper;
import org.dromara.sample.wayline.model.dto.AiCompareDTO;
@ -48,7 +48,7 @@ public class AiCompareServiceImpl implements IAiCompareService {
private final IAiCompareQueueService aiCompareQueueService;
private final IAiCompareMapper aiCompareMapper;
private final IWaylineJobMapper waylineJobMapper;
private final MqttGatewayPublish mqttGatewayPublish;
@Override
public TableDataInfo<AiCompareEntity> queryPageList(AiCompareDTO bo, PageQuery pageQuery) {
return TableDataInfo.build(aiCompareMapper.selectPage(pageQuery.build(),this.buildAiCompareDTOQueryWrapper(bo)));
@ -112,13 +112,21 @@ public class AiCompareServiceImpl implements IAiCompareService {
aiCompareEntity.setTemplateId(jobEntityList.get(0).getJobId());
}
}
String topic = TopicConst.IMAGE +TopicConst.COMPARE;
// mqttGatewayPublish.publish(topic,byId,1);
insertList.add(aiCompareEntity);
}
List<BatchResult> resultList = aiCompareMapper.insertOrUpdate(insertList, 10);
System.out.println(resultList);
List<Long> list =compareDTOList.stream().map(e->Convert.toLong(e.get("queueId"))).collect(Collectors.toList());
return aiCompareQueueService.updateStatus(list,AiCompareStatusConstants.QUEUW_TYPE_1);
}
public List<Map<String,Object>> listMediaFile(AiCompareEntity aiCompareEntity){
return null;
}
@Override
public Boolean update(Map<String,Object> compareDTO) {

5
dk-modules/sample/src/main/resources/mapper/AiCompareMapper.xml

@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT mf.*,
mfi.file_name as mateFileName,
mfi.file_path as mateFilePath,
mfi.create_time as mateFileDate
mfi.create_time as mateFileDate,
CAST( SUBSTRING_INDEX( SUBSTRING_INDEX( mf.file_name, '_', 3 ), '_', - 1 ) AS UNSIGNED ) AS suffix
FROM
media_file mf
LEFT JOIN ai_compare ai ON ai.job_id = mf.job_id
LEFT JOIN media_file mfi ON mfi.job_id = ai.template_id
WHERE mfi.job_id=#{jobId}
ORDER BY mf.create_time asc
ORDER BY suffix asc
</select>
</mapper>

11
dk-modules/system/src/main/java/org/dromara/system/controller/system/SysPostController.java

@ -10,7 +10,7 @@ import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.bo.AiLablePostBindBo;
import org.dromara.system.domain.bo.AiLabelPostBindBo;
import org.dromara.system.domain.bo.AiLabelPostBo;
import org.dromara.system.domain.bo.SysPostBo;
import org.dromara.system.domain.vo.AiLabelPostVo;
@ -76,17 +76,18 @@ public class SysPostController extends BaseController {
@SaCheckPermission("system:post:add")
@Log(title = "岗位管理-绑定标签", businessType = BusinessType.INSERT)
@PostMapping("/bindLable")
public R<Void> add(@Validated @RequestBody AiLablePostBindBo aiLablePostBindBo) {
public R<Void> add(@Validated @RequestBody AiLabelPostBindBo aiLablePostBindBo) {
return aiLablePostService.insertByBatchBo(aiLablePostBindBo)?R.ok():R.fail();
}
/**
* 标签列表
* 标签列表 -不分页
* @param postId 岗位id
*/
@SaCheckPermission("system:post:list")
@GetMapping("/lableList")
public TableDataInfo<AiLabelPostVo> lableList(AiLabelPostBo post, PageQuery pageQuery) {
return postService.lableList(post, pageQuery);
public R<List<AiLabelPostVo>> lableList(Long postId) {
return R.ok(aiLablePostService.queryListByLabel(postId));
}

2
dk-modules/system/src/main/java/org/dromara/system/domain/AiLabel.java

@ -24,7 +24,7 @@ public class AiLabel {
/**
* id
*/
@TableId(value = "label_id")
@TableId(type = IdType.AUTO)
private Long labelId;
/**

2
dk-modules/system/src/main/java/org/dromara/system/domain/AiLabelPost.java

@ -20,7 +20,7 @@ public class AiLabelPost {
@Serial
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**
* 标签id

2
dk-modules/system/src/main/java/org/dromara/system/domain/bo/AiLablePostBindBo.java → dk-modules/system/src/main/java/org/dromara/system/domain/bo/AiLabelPostBindBo.java

@ -11,7 +11,7 @@ import java.util.List;
*/
@Data
public class AiLablePostBindBo {
public class AiLabelPostBindBo {
@NotNull(message = "postId不能为空")
private Long postId;

2
dk-modules/system/src/main/java/org/dromara/system/domain/vo/SysPostVo.java

@ -93,7 +93,7 @@ public class SysPostVo implements Serializable {
/**
* 标签集合
*/
public List<AiLabelVo> labelList;
public List<AiLabelPostVo> labelList;
@Data
public static class AiLabelVo{

7
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java

@ -37,11 +37,8 @@ public class RemoteLabelPostServicelmpl implements RemoteLabelPostService {
//获取岗位只能Id
SysPostVo sysPostVo = sysPostService.selectLableByList(postCode, deptId);
if(sysPostVo != null){
//根据岗位职能Id获取标签id
List<AiLabelPost> aiLabelPostVos = aiLabelPostService.queryListByLabel(sysPostVo.getPostId());
//根据标签id获取标签
List<AiLabel> aiLabelList = aiLabelService.queryListByLabel(StreamUtils.toList(aiLabelPostVos,AiLabelPost::getLabelId));
return aiLabelList.stream()
List<AiLabelPostVo> postVoList = aiLabelPostService.queryListByLabel(sysPostVo.getPostId());
return postVoList.stream()
.map(aiLabel -> {
RemoteAiLabelPostVo remoteAiLabelPostVo = new RemoteAiLabelPostVo();
remoteAiLabelPostVo.setLabelId(aiLabel.getLabelId());

4
dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java

@ -7,6 +7,8 @@ import org.dromara.system.domain.AiLabelPost;
import org.dromara.system.domain.vo.AiLabelPostVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 职能-标签关系Mapper接口
*
@ -15,4 +17,6 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface AiLabelPostMapper extends BaseMapperPlus<AiLabelPost, AiLabelPostVo> {
Page<AiLabelPostVo> selectAiLabelPostPage(@Param("page") Page<?> page, @Param("ew") QueryWrapper<AiLabelPost> wrapper);
List<AiLabelPostVo> queryListByLabel(@Param("postId") Long postId);
}

8
dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java

@ -2,7 +2,7 @@ package org.dromara.system.service;
import org.dromara.system.domain.AiLabelPost;
import org.dromara.system.domain.bo.AiLabelPostBo;
import org.dromara.system.domain.bo.AiLablePostBindBo;
import org.dromara.system.domain.bo.AiLabelPostBindBo;
import org.dromara.system.domain.vo.AiLabelPostVo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
@ -68,7 +68,9 @@ public interface IAiLabelPostService {
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
List<AiLabelPost> queryListByLabel(Long postId);
List<AiLabelPost> queryListLabel(Long postId);
Boolean insertByBatchBo(AiLablePostBindBo aiLablePostBindBo);
List<AiLabelPostVo> queryListByLabel(Long postId);
Boolean insertByBatchBo(AiLabelPostBindBo aiLablePostBindBo);
}

1
dk-modules/system/src/main/java/org/dromara/system/service/ISysPostService.java

@ -20,6 +20,7 @@ public interface ISysPostService {
TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery);
TableDataInfo<AiLabelPostVo> lableList(AiLabelPostBo bo, PageQuery pageQuery);
List<AiLabelPostVo> lableList(Long postId);
/**
* 查询岗位信息集合
*

7
dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLabelServiceImpl.java

@ -1,5 +1,6 @@
package org.dromara.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -138,8 +139,8 @@ public class AiLabelServiceImpl implements IAiLabelService {
@Override
public List<AiLabel> queryListByLabel(List<Long> labelIds) {
LambdaQueryWrapper<AiLabel> wrapper = new LambdaQueryWrapper<>();
wrapper.in(AiLabel::getLabelId, labelIds);
return this.baseMapper.selectList(wrapper);
QueryWrapper<AiLabel> queryWrapper = new QueryWrapper<>();
queryWrapper.in(!labelIds.isEmpty(),"label_id",labelIds);
return this.baseMapper.selectList(queryWrapper);
}
}

29
dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.system.domain.AiLabelPost;
import org.dromara.system.domain.bo.AiLablePostBindBo;
import org.dromara.system.domain.bo.AiLabelPostBindBo;
import org.dromara.system.domain.vo.AiLabelPostVo;
import org.dromara.system.mapper.AiLabelMapper;
import org.springframework.stereotype.Service;
@ -33,7 +33,7 @@ import java.util.Collection;
public class AiLablePostServiceImpl implements IAiLabelPostService {
private final AiLabelPostMapper baseMapper;
private final AiLabelMapper aiLabelMapper;
private final AiLabelPostMapper aiLabelPostMapper;
/**
* 查询职能-标签关系
@ -128,20 +128,33 @@ public class AiLablePostServiceImpl implements IAiLabelPostService {
}
@Override
public List<AiLabelPost> queryListByLabel(Long postId) {
LambdaQueryWrapper<AiLabelPost> wrapper = new LambdaQueryWrapper<>();
public List<AiLabelPostVo> queryListByLabel(Long postId) {
return aiLabelPostMapper.queryListByLabel(postId);
}
/**
* 保存前的数据校验
*/
private void delPostId(Long postId){
//新增前先删除之前的标签
QueryWrapper<AiLabelPost> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("post_id", postId);
baseMapper.delete(queryWrapper);
}
@Override
public List<AiLabelPost> queryListLabel(Long postId) {
LambdaQueryWrapper<AiLabelPost> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AiLabelPost::getPostId, postId);
return this.baseMapper.selectList(wrapper);
}
@Override
public Boolean insertByBatchBo(AiLablePostBindBo aiLablePostBindBo) {
public Boolean insertByBatchBo(AiLabelPostBindBo aiLabelPostBindBo) {
delPostId(aiLabelPostBindBo.getPostId());
List<AiLabelPost> resultlist = new ArrayList<>();
for (Long labelId : aiLablePostBindBo.getLableIdList()) {
for (Long labelId : aiLabelPostBindBo.getLableIdList()) {
AiLabelPost ailabelPost = new AiLabelPost();
ailabelPost.setPostId(aiLablePostBindBo.getPostId());
ailabelPost.setPostId(aiLabelPostBindBo.getPostId());
ailabelPost.setLabelId(labelId);
resultlist.add(ailabelPost);
}

20
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysPostServiceImpl.java

@ -55,19 +55,10 @@ public class SysPostServiceImpl implements ISysPostService {
Page<SysPostVo> page = baseMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
page.getRecords().forEach(sysPostVo -> {
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(sysPostVo.getPostCode(), sysPostVo.getDeptId());
sysPostVo.setLabelList(postVoList.stream()
.map(aiLabel -> {
SysPostVo.AiLabelVo aiLabelVo = new SysPostVo.AiLabelVo();
aiLabelVo.setLabelId(aiLabel.getLabelId());
aiLabelVo.setLabelEn(aiLabel.getLabelEn());
aiLabelVo.setLabelCn(aiLabel.getLabelCn());
aiLabelVo.setPostId(aiLabel.getPostId());
return aiLabelVo;
})
.toList());
Long postId = sysPostVo.getPostId();
List<AiLabelPostVo> lableList = lableList(postId);
sysPostVo.setLabelList(lableList);
});
return TableDataInfo.build(page);
}
@ -76,6 +67,11 @@ public class SysPostServiceImpl implements ISysPostService {
return aiLablePostService.queryPageList(bo,pageQuery);
}
@Override
public List<AiLabelPostVo> lableList(Long postId) {
return aiLablePostService.queryListByLabel(postId);
}
/**
* 查询岗位信息集合
*

6
dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml

@ -5,6 +5,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="org.dromara.system.mapper.AiLabelPostMapper">
<select id="selectAiLabelPostPage" resultType="org.dromara.system.domain.vo.AiLabelPostVo">
SELECT *,a.label_cn as ,label_en FROM ai_lable_post p inner JOIN ai_label a ON p.label_id = a.label_id ${ew.customSqlSegment}
SELECT *,a.label_cn ,label_en FROM ai_label_post p inner JOIN ai_label a ON p.label_id = a.label_id ${ew.customSqlSegment}
</select>
<select id="queryListByLabel" resultType="org.dromara.system.domain.vo.AiLabelPostVo">
SELECT p.*,a.label_cn ,label_en FROM ai_label_post p inner JOIN ai_label a ON p.label_id = a.label_id
where p.post_id = #{postId}
</select>
</mapper>

Loading…
Cancel
Save