소스 검색

AI题名冲突

cr 4 일 전
부모
커밋
ebf3a8f314
1개의 변경된 파일120개의 추가작업 그리고 114개의 파일을 삭제
  1. 120 114
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAiNameServiceImpl.java

+ 120 - 114
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAiNameServiceImpl.java

@@ -1,70 +1,71 @@
-///*
-// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
-// *
-// *  Redistribution and use in source and binary forms, with or without
-// *  modification, are permitted provided that the following conditions are met:
-// *
-// *  Redistributions of source code must retain the above copyright notice,
-// *  this list of conditions and the following disclaimer.
-// *  Redistributions in binary form must reproduce the above copyright
-// *  notice, this list of conditions and the following disclaimer in the
-// *  documentation and/or other materials provided with the distribution.
-// *  Neither the name of the dreamlu.net developer nor the names of its
-// *  contributors may be used to endorse or promote products derived from
-// *  this software without specific prior written permission.
-// *  Author: Chill 庄骞 (smallchill@163.com)
-// */
-//package org.springblade.archive.service.impl;
-//
-//
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import org.apache.commons.lang.StringUtils;
-//import org.springblade.archive.entity.ArchiveAiName;
-//import org.springblade.archive.mapper.ArchiveAiNameMapper;
-//import org.springblade.archive.service.IArchiveAiNameService;
-//import org.springblade.archive.vo.ArchiveAiNameVO;
-//import org.springblade.archive.vo.ArchiveAiNameVO1;
-//import org.springblade.common.utils.DeepSeekClient;
-//import org.springblade.core.mp.base.BaseServiceImpl;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.jdbc.core.BeanPropertyRowMapper;
-//import org.springframework.jdbc.core.JdbcTemplate;
-//import org.springframework.scheduling.annotation.Async;
-//import org.springframework.stereotype.Service;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import javax.annotation.Resource;
-//import java.text.SimpleDateFormat;
-//import java.util.*;
-//import java.util.concurrent.Semaphore;
-//import java.util.concurrent.ThreadPoolExecutor;
-//import java.util.stream.Collectors;
-//
-//import static java.util.stream.Collectors.groupingBy;
-//
-///**
-// *  服务实现类
-// *
-// * @author BladeX
-// * @since 2025-07-03
-// */
-//@Service
-//public class ArchiveAiNameServiceImpl extends BaseServiceImpl<ArchiveAiNameMapper, ArchiveAiName> implements IArchiveAiNameService {
-//
-//	 private static String DEEPSEEK_ARCHIVE_NAME = ".这是一段案卷题名,精简案卷题名重复啰嗦的内容,不要加以上内容没有的词语 返回值不要有任何多余得废话,只要结果";
-//	 private static final int MAX_CONCURRENT_REQUESTS = 5;
-//
-//	@Autowired
-//	private JdbcTemplate jdbcTemplate;
-//
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.archive.service.impl;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.entity.ArchiveAiName;
+import org.springblade.archive.mapper.ArchiveAiNameMapper;
+import org.springblade.archive.service.IArchiveAiNameService;
+import org.springblade.archive.vo.ArchiveAiNameVO;
+import org.springblade.archive.vo.ArchiveAiNameVO1;
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.stream.Collectors;
+
+import static java.util.stream.Collectors.groupingBy;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2025-07-03
+ */
+@Service
+public class ArchiveAiNameServiceImpl extends BaseServiceImpl<ArchiveAiNameMapper, ArchiveAiName> implements IArchiveAiNameService {
+
+	 private static String DEEPSEEK_ARCHIVE_NAME = ".这是一段案卷题名,精简案卷题名重复啰嗦的内容,不要加以上内容没有的词语 返回值不要有任何多余得废话,只要结果";
+	 private static final int MAX_CONCURRENT_REQUESTS = 5;
+
+	@Autowired
+	private JdbcTemplate jdbcTemplate;
+
 //	@Autowired
 //	private DeepSeekClient deepSeekClient;
-//
-//	@Resource(name = "taskExecutor1")
-//	private ThreadPoolExecutor executor;
-//
-//	private final Semaphore apiSemaphore = new Semaphore(MAX_CONCURRENT_REQUESTS);
-//
+
+	@Resource(name = "taskExecutor1")
+	private ThreadPoolExecutor executor;
+
+	private final Semaphore apiSemaphore = new Semaphore(MAX_CONCURRENT_REQUESTS);
+
 //	@Override
 //	@Async("taskExecutor1")
 //	@Transactional
@@ -104,52 +105,57 @@
 //			this.updateBatchById(batch);
 //		}
 //	}
-//
-//	@Override
-//	public List<ArchiveAiNameVO> getArchiveAiTask(Long projectId, Long contractId) {
-//		List<ArchiveAiNameVO>list=new ArrayList<>();
-//		List<ArchiveAiName> archiveAiNameList = this.baseMapper.selectList(new LambdaQueryWrapper<>(ArchiveAiName.class).eq(ArchiveAiName::getProjectId, projectId).eq(ArchiveAiName::getContractId, contractId));
-//		if(!archiveAiNameList.isEmpty()){
-//			Map<Long, List<ArchiveAiName>> map = archiveAiNameList.stream().collect(groupingBy(ArchiveAiName::getTaskId));
-//			for (Map.Entry<Long, List<ArchiveAiName>> entry : map.entrySet()) {
-//				ArchiveAiNameVO archiveAiNameVO = new ArchiveAiNameVO();
-//				List<ArchiveAiName> archiveAiNames = entry.getValue();
-//				archiveAiNameVO.setTaskId(entry.getKey());
-//				Date createTime = archiveAiNames.get(0).getCreateTime();
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//				String formattedDate = sdf.format(createTime);
-//				archiveAiNameVO.setTaskTime(formattedDate);
-//				archiveAiNameVO.setNum(archiveAiNames.size());
-//				archiveAiNameVO.setStatus(archiveAiNames.stream().allMatch(ai -> ai.getStatus() >1) ? 2:1);
-//				list.add(archiveAiNameVO);
-//			}
-//		}
-//		return list;
-//	}
-//
-//
-//	@Transactional
-//	public boolean confirmAiName(List<ArchiveAiNameVO1>vos) {
-//		for (ArchiveAiNameVO1 archiveAiName : vos) {
-//			if(archiveAiName.getStatus()==2&& StringUtils.isNotEmpty(archiveAiName.getArchiveNameAi())){
-//				archiveAiName.setStatus(3);
-//				String sql=" update u_archives_auto set name='"+archiveAiName.getArchiveNameAi()+"', colour_status=2  where id="+archiveAiName.getArchiveAutoId();
-//				jdbcTemplate.update(sql);
-//				String sql2="update u_archive_ai_name set status=3 where id="+archiveAiName.getId();
-//				jdbcTemplate.update(sql2);
-//			}
-//		}
-//		Long taskId = vos.get(0).getTaskId();
-//		String sql3="select * from u_archive_ai_name where task_id="+taskId+" and is_deleted=0";
-//		List<ArchiveAiName> list = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(ArchiveAiName.class));
-//		if(list.stream().allMatch(item -> item.getStatus() >= 3)){
-//			deletedArchiveAiTask(taskId);
-//		};
-//		return true;
-//	}
-//
-//	@Override
-//	public Boolean deletedArchiveAiTask(Long taskId) {
-//		return baseMapper.deletedArchiveAiTask(taskId);
-//	}
-//}
+
+    @Override
+    public void syncCreatAiName(List<ArchiveAiName> aiNames) throws IOException {
+
+    }
+
+    @Override
+	public List<ArchiveAiNameVO> getArchiveAiTask(Long projectId, Long contractId) {
+		List<ArchiveAiNameVO>list=new ArrayList<>();
+		List<ArchiveAiName> archiveAiNameList = this.baseMapper.selectList(new LambdaQueryWrapper<>(ArchiveAiName.class).eq(ArchiveAiName::getProjectId, projectId).eq(ArchiveAiName::getContractId, contractId));
+		if(!archiveAiNameList.isEmpty()){
+			Map<Long, List<ArchiveAiName>> map = archiveAiNameList.stream().collect(groupingBy(ArchiveAiName::getTaskId));
+			for (Map.Entry<Long, List<ArchiveAiName>> entry : map.entrySet()) {
+				ArchiveAiNameVO archiveAiNameVO = new ArchiveAiNameVO();
+				List<ArchiveAiName> archiveAiNames = entry.getValue();
+				archiveAiNameVO.setTaskId(entry.getKey());
+				Date createTime = archiveAiNames.get(0).getCreateTime();
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+				String formattedDate = sdf.format(createTime);
+				archiveAiNameVO.setTaskTime(formattedDate);
+				archiveAiNameVO.setNum(archiveAiNames.size());
+				archiveAiNameVO.setStatus(archiveAiNames.stream().allMatch(ai -> ai.getStatus() >1) ? 2:1);
+				list.add(archiveAiNameVO);
+			}
+		}
+		return list;
+	}
+
+
+	@Transactional
+	public boolean confirmAiName(List<ArchiveAiNameVO1>vos) {
+		for (ArchiveAiNameVO1 archiveAiName : vos) {
+			if(archiveAiName.getStatus()==2&& StringUtils.isNotEmpty(archiveAiName.getArchiveNameAi())){
+				archiveAiName.setStatus(3);
+				String sql=" update u_archives_auto set name='"+archiveAiName.getArchiveNameAi()+"', colour_status=2  where id="+archiveAiName.getArchiveAutoId();
+				jdbcTemplate.update(sql);
+				String sql2="update u_archive_ai_name set status=3 where id="+archiveAiName.getId();
+				jdbcTemplate.update(sql2);
+			}
+		}
+		Long taskId = vos.get(0).getTaskId();
+		String sql3="select * from u_archive_ai_name where task_id="+taskId+" and is_deleted=0";
+		List<ArchiveAiName> list = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(ArchiveAiName.class));
+		if(list.stream().allMatch(item -> item.getStatus() >= 3)){
+			deletedArchiveAiTask(taskId);
+		};
+		return true;
+	}
+
+	@Override
+	public Boolean deletedArchiveAiTask(Long taskId) {
+		return baseMapper.deletedArchiveAiTask(taskId);
+	}
+}