Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.srs.common.core.controller.BaseController;
|
import com.srs.common.core.controller.BaseController;
|
||||||
|
|
||||||
// OkHttp 显式导入
|
// OkHttp 显式导入
|
||||||
import com.srs.common.core.domain.model.LoginUser;
|
|
||||||
import com.srs.common.exception.ServiceException;
|
import com.srs.common.exception.ServiceException;
|
||||||
import com.srs.common.utils.SecurityUtils;
|
import com.srs.common.utils.SecurityUtils;
|
||||||
import com.srs.teacher.domain.dto.ConversationDTO;
|
import com.srs.teacher.domain.dto.ConversationDTO;
|
||||||
@@ -17,15 +16,15 @@ import okhttp3.*;
|
|||||||
import com.srs.common.core.domain.AjaxResult; // ✅ RuoYi 的返回结果类
|
import com.srs.common.core.domain.AjaxResult; // ✅ RuoYi 的返回结果类
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -40,49 +39,69 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/aitutor/aichat")
|
@RequestMapping("/aitutor/aichat")
|
||||||
public class AiChatController extends BaseController {
|
public class AiChatController extends BaseController {
|
||||||
/**
|
|
||||||
* Dify API的URL地址
|
|
||||||
* 用于发送聊天消息请求到Dify服务
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static final String DIFY_API_URL = "http://47.112.118.149:8100/v1/chat-messages";
|
|
||||||
//private static final String DIFY_API_URL = "http://localhost:8080/v1/chat-messages";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dify反馈API的基础URL
|
|
||||||
* 用于提交消息反馈(点赞、点踩等)
|
|
||||||
*/
|
|
||||||
private static final String DIFY_FEEDBACK_BASE_URL = "http://47.112.118.149:8100/v1/messages";
|
|
||||||
//private static final String DIFY_FEEDBACK_BASE_URL = "http://localhost:8080/v1/messages";
|
|
||||||
|
|
||||||
private static final String DIFY_API_HISTORY_URL = "http://47.112.118.149:8100/v1/messages";
|
|
||||||
//private static final String DIFY_API_HISTORY_URL = "http://localhost:8080/v1/messages";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dify会话API的基础URL
|
|
||||||
* 用于获取会话列表
|
|
||||||
*/
|
|
||||||
private static final String DIFY_CONVERSATIONS_URL = "http://47.112.118.149:8100/v1/conversations";
|
|
||||||
//private static final String DIFY_CONVERSATIONS_URL = "http://localhost:8080/v1/conversations";
|
|
||||||
|
|
||||||
//文件上传
|
|
||||||
private static final String DIFY_FILES_URL = "http://47.112.118.149:8100/v1/files/upload";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dify API的访问密钥
|
* Dify API的访问密钥
|
||||||
* 用于身份验证,授权访问Dify服务
|
* 用于身份验证,授权访问Dify服务
|
||||||
*/
|
*/
|
||||||
private static final String DIFY_API_KEY = "app-2wjqcYI9n6igHTVHdH8qXlnh";
|
private static final String DIFY_API_KEY = "app-2wjqcYI9n6igHTVHdH8qXlnh";
|
||||||
//private static final String DIFY_API_KEY = "app-";
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify API的URL地址
|
||||||
|
* 用于发送聊天消息请求到Dify服务
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static final String DIFY_API_URL = "http://47.112.118.149:8100/v1/chat-messages";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify反馈API的基础URL
|
||||||
|
* 用于提交消息反馈(点赞、点踩等)
|
||||||
|
*/
|
||||||
|
private static final String DIFY_FEEDBACK_BASE_URL = "http://47.112.118.149:8100/v1/messages";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify获取反馈API的基础URL
|
||||||
|
* 用于获取消息反馈(点赞、点踩等)
|
||||||
|
*/
|
||||||
|
private static final String DIFY_API_FEEDBACK_URL = "http://47.112.118.149:8100/v1/app/feedbacks?page=";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify消息历史记录API的基础URL
|
||||||
|
* 用于获取消息历史记录
|
||||||
|
*/
|
||||||
|
private static final String DIFY_API_HISTORY_URL = "http://47.112.118.149:8100/v1/messages";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify会话API的基础URL
|
||||||
|
* 用于获取会话列表
|
||||||
|
*/
|
||||||
|
private static final String DIFY_CONVERSATIONS_URL = "http://47.112.118.149:8100/v1/conversations";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify文件上传API的URL地址
|
||||||
|
* 用于上传文件到Dify服务,支持图文多模态理解
|
||||||
|
*/
|
||||||
|
private static final String DIFY_FILES_URL = "http://47.112.118.149:8100/v1/files/upload";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP客户端实例
|
* HTTP客户端实例
|
||||||
* 配置了5分钟的读取超时时间,用于与Dify API进行通信
|
* 配置了5分钟的读取超时时间,用于与Dify API进行通信
|
||||||
*/
|
*/
|
||||||
private final OkHttpClient client = new OkHttpClient.Builder()
|
private final OkHttpClient client = new OkHttpClient.Builder()
|
||||||
.readTimeout(Duration.ofMinutes(5))
|
.connectTimeout(Duration.ofSeconds(5)) // 建连超时
|
||||||
|
.readTimeout(Duration.ofSeconds(12)) // 读超时(服务端应在此内有数据返回)
|
||||||
|
.writeTimeout(Duration.ofSeconds(12)) // 写超时
|
||||||
|
.retryOnConnectionFailure(true)
|
||||||
.build();
|
.build();
|
||||||
|
/** 为本次请求设置 “总超时”(含连接/读写),避免无限挂起 */
|
||||||
|
private Response execWithTimeouts(Request req, int callSecs, int readSecs, int writeSecs) throws IOException {
|
||||||
|
OkHttpClient shortClient = client.newBuilder()
|
||||||
|
.callTimeout(java.time.Duration.ofSeconds(callSecs)) // 整次调用最大时长
|
||||||
|
.readTimeout(java.time.Duration.ofSeconds(readSecs)) // 读超时(这段时间没有字节到达就超时)
|
||||||
|
.writeTimeout(java.time.Duration.ofSeconds(writeSecs)) // 写超时
|
||||||
|
.build();
|
||||||
|
return shortClient.newCall(req).execute();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON对象映射器
|
* JSON对象映射器
|
||||||
@@ -162,8 +181,21 @@ public class AiChatController extends BaseController {
|
|||||||
bodyMap.put("user", currentUsername); // 用户标识
|
bodyMap.put("user", currentUsername); // 用户标识
|
||||||
bodyMap.put("response_mode", "streaming"); // 设置为流式响应模式
|
bodyMap.put("response_mode", "streaming"); // 设置为流式响应模式
|
||||||
|
|
||||||
|
// 如果请求中没有提供conversation_id,则尝试获取或创建一个
|
||||||
|
if (!requestData.containsKey("conversation_id") || requestData.get("conversation_id") == null) {
|
||||||
|
try {
|
||||||
|
List<ConversationDTO> conversations = getConversations(currentUsername, null, 1, "-updated_at");
|
||||||
|
if (conversations != null && !conversations.isEmpty()) {
|
||||||
|
// 使用已有的会话ID
|
||||||
|
bodyMap.put("conversation_id", conversations.get(0).getId());
|
||||||
|
}
|
||||||
|
// 如果没有会话,Dify会自动创建一个新的会话
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("获取用户会话时出错: " + e.getMessage());
|
||||||
|
// 继续执行,让Dify自动创建新会话
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// 如果存在对话ID,则添加到请求参数中
|
// 如果存在对话ID,则添加到请求参数中
|
||||||
if (requestData.containsKey("conversation_id")) {
|
|
||||||
bodyMap.put("conversation_id", requestData.get("conversation_id"));
|
bodyMap.put("conversation_id", requestData.get("conversation_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,12 +407,9 @@ public class AiChatController extends BaseController {
|
|||||||
// 参数校验和限制
|
// 参数校验和限制
|
||||||
int limitValue = Math.min(Math.max(Integer.parseInt(limit), 1), 100);
|
int limitValue = Math.min(Math.max(Integer.parseInt(limit), 1), 100);
|
||||||
|
|
||||||
// 构建请求URL
|
|
||||||
String url = "http://47.112.118.149:8100/v1/app/feedbacks?page=" + page + "&limit=" + limitValue;
|
|
||||||
|
|
||||||
// 构建请求
|
// 构建请求
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(DIFY_API_FEEDBACK_URL + page + "&limit=" + limitValue)
|
||||||
.addHeader("Authorization", "Bearer " + DIFY_API_KEY)
|
.addHeader("Authorization", "Bearer " + DIFY_API_KEY)
|
||||||
.addHeader("Content-Type", "application/json")
|
.addHeader("Content-Type", "application/json")
|
||||||
.get()
|
.get()
|
||||||
@@ -409,27 +438,6 @@ public class AiChatController extends BaseController {
|
|||||||
feedbackItem.put("app_id", feedbackNode.has("app_id") ? feedbackNode.get("app_id").asText() : null);
|
feedbackItem.put("app_id", feedbackNode.has("app_id") ? feedbackNode.get("app_id").asText() : null);
|
||||||
feedbackItem.put("conversation_id", feedbackNode.has("conversation_id") ? feedbackNode.get("conversation_id").asText() : null);
|
feedbackItem.put("conversation_id", feedbackNode.has("conversation_id") ? feedbackNode.get("conversation_id").asText() : null);
|
||||||
|
|
||||||
// 提取用户信息
|
|
||||||
if (feedbackNode.has("from_end_user")) {
|
|
||||||
JsonNode userNode = feedbackNode.get("from_end_user");
|
|
||||||
Map<String, Object> userMap = new HashMap<>();
|
|
||||||
userMap.put("id", userNode.has("id") ? userNode.get("id").asText() : null);
|
|
||||||
userMap.put("name", userNode.has("name") ? userNode.get("name").asText() : null);
|
|
||||||
userMap.put("email", userNode.has("email") ? userNode.get("email").asText() : null);
|
|
||||||
feedbackItem.put("from_end_user", userMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提取消息内容
|
|
||||||
if (feedbackNode.has("message")) {
|
|
||||||
JsonNode messageNode = feedbackNode.get("message");
|
|
||||||
Map<String, Object> messageMap = new HashMap<>();
|
|
||||||
messageMap.put("id", messageNode.has("id") ? messageNode.get("id").asText() : null);
|
|
||||||
messageMap.put("query", messageNode.has("query") ? messageNode.get("query").asText() : null);
|
|
||||||
messageMap.put("answer", messageNode.has("answer") ? messageNode.get("answer").asText() : null);
|
|
||||||
messageMap.put("created_at", messageNode.has("created_at") ? messageNode.get("created_at").asLong() : null);
|
|
||||||
feedbackItem.put("message", messageMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
feedbackList.add(feedbackItem);
|
feedbackList.add(feedbackItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,219 +472,60 @@ public class AiChatController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @GetMapping("/history")
|
|
||||||
public AjaxResult getHistoryMessagesToAdmin(@RequestParam String user,
|
|
||||||
@RequestParam(required = false) String firstId,
|
|
||||||
@RequestParam(defaultValue = "20") int limit) {
|
|
||||||
//调用查询会话
|
|
||||||
String conversation_id = conversations(user);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会话历史消息的端点
|
|
||||||
* <p>
|
|
||||||
* 该方法接收客户端发送的请求,获取指定会话的历史消息记录。
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* //@param conversation_id 会话ID
|
|
||||||
*
|
|
||||||
* @param firstId 当前页第一条聊天记录的ID,默认null
|
|
||||||
* @param limit 一次请求返回多少条记录,默认20条
|
|
||||||
* @return AjaxResult 返回会话历史消息的结果
|
|
||||||
*/
|
|
||||||
@GetMapping("/history")
|
|
||||||
public AjaxResult getHistoryMessages(
|
|
||||||
//@RequestParam(required = false) String conversation_id,
|
|
||||||
@RequestParam(required = false) String firstId,
|
|
||||||
@RequestParam(defaultValue = "20") int limit) {
|
|
||||||
try {
|
|
||||||
/* // 获取当前用户
|
|
||||||
String currentUsername = SecurityUtils.getLoginUser().getUsername();
|
|
||||||
// 获取会话列表的id
|
|
||||||
String conversation_id = conversations(currentUsername);
|
|
||||||
if(conversation_id == null){
|
|
||||||
return error("没有会话");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
// 验证conversationId是否为空
|
|
||||||
/*if (conversation_id == null || conversation_id.trim().isEmpty()) {
|
|
||||||
return error("会话ID不能为空后端");
|
|
||||||
}*/
|
|
||||||
String conversation_id = "8fb04ac4-ac9f-470b-9ac4-fee1ebec6412";
|
|
||||||
String currentUsername = SecurityUtils.getLoginUser().getUsername();
|
|
||||||
System.out.println(currentUsername);
|
|
||||||
System.out.println(conversation_id);
|
|
||||||
|
|
||||||
// 构建请求参数
|
|
||||||
HttpUrl.Builder urlBuilder = HttpUrl.parse(DIFY_API_HISTORY_URL).newBuilder();
|
|
||||||
urlBuilder.addQueryParameter("conversation_id", conversation_id);
|
|
||||||
urlBuilder.addQueryParameter("user", currentUsername);
|
|
||||||
if (firstId != null) {
|
|
||||||
urlBuilder.addQueryParameter("first_id", firstId);
|
|
||||||
}
|
|
||||||
urlBuilder.addQueryParameter("limit", String.valueOf(limit));
|
|
||||||
System.out.println(currentUsername);
|
|
||||||
// 构建HTTP请求
|
|
||||||
Request request = new Request.Builder()
|
|
||||||
.url(urlBuilder.build())
|
|
||||||
.addHeader("Authorization", "Bearer " + DIFY_API_KEY)
|
|
||||||
.get()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// 执行HTTP请求
|
|
||||||
try (Response response = client.newCall(request).execute()) {
|
|
||||||
// 检查响应是否成功
|
|
||||||
if (!response.isSuccessful()) {
|
|
||||||
return error("Dify 请求失败: " + response.code() + " " + response.message());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析JSON响应
|
|
||||||
JsonNode rootNode = mapper.readTree(response.body().string());
|
|
||||||
boolean hasMore = rootNode.path("has_more").asBoolean(false);
|
|
||||||
List<Map<String, Object>> data = mapper.convertValue(rootNode.path("data"), List.class);
|
|
||||||
|
|
||||||
// 构建返回结果
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("limit", limit);
|
|
||||||
result.put("has_more", hasMore);
|
|
||||||
result.put("data", data);
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
return error("获取会话历史消息失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会话列表
|
|
||||||
* <p>
|
|
||||||
* 该方法用于获取当前用户的会话列表,默认返回最近的 20 条。
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param user 用户标识符,由开发者定义规则,需保证用户标识在应用内唯一
|
|
||||||
* @param lastId 当前页最后一条记录的 ID,默认 null
|
|
||||||
* @param limit 一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条
|
|
||||||
* @param sortBy 排序字段,默认 -updated_at (按更新时间倒序排列)
|
|
||||||
* @return AjaxResult 返回会话列表的结果
|
|
||||||
*/
|
|
||||||
/*@GetMapping("/getConversationsToUser")
|
|
||||||
public AjaxResult getConversationsToUser(
|
|
||||||
@RequestParam String user,
|
|
||||||
@RequestParam(required = false) String lastId,
|
|
||||||
@RequestParam(defaultValue = "20") int limit,
|
|
||||||
@RequestParam(defaultValue = "-updated_at") String sortBy) {
|
|
||||||
try {
|
|
||||||
// 获取当前用户
|
|
||||||
String currentUsername = SecurityUtils.getLoginUser().getUsername();
|
|
||||||
// 获取会话列表的id
|
|
||||||
String conversation_id = conversations(currentUsername);
|
|
||||||
|
|
||||||
return AjaxResult.success(conversation_id);*/
|
|
||||||
/*// 参数校验
|
|
||||||
if (user == null || user.trim().isEmpty()) {
|
|
||||||
return error("用户标识不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 限制limit的范围在1-100之间
|
|
||||||
if (limit < 1 || limit > 100) {
|
|
||||||
return error("limit参数必须在1到100之间");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建请求参数
|
|
||||||
HttpUrl.Builder urlBuilder = HttpUrl.parse(DIFY_CONVERSATIONS_URL).newBuilder();
|
|
||||||
urlBuilder.addQueryParameter("user", user);
|
|
||||||
if (lastId != null) {
|
|
||||||
urlBuilder.addQueryParameter("last_id", lastId);
|
|
||||||
}
|
|
||||||
urlBuilder.addQueryParameter("limit", String.valueOf(limit));
|
|
||||||
urlBuilder.addQueryParameter("sort_by", sortBy);
|
|
||||||
|
|
||||||
// 构建HTTP请求
|
|
||||||
Request request = new Request.Builder()
|
|
||||||
.url(urlBuilder.build())
|
|
||||||
.addHeader("Authorization", "Bearer " + DIFY_API_KEY)
|
|
||||||
.get()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// 执行HTTP请求
|
|
||||||
try (Response response = client.newCall(request).execute()) {
|
|
||||||
// 检查响应是否成功
|
|
||||||
if (!response.isSuccessful()) {
|
|
||||||
return error("Dify 请求失败: " + response.code() + " " + response.message());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析JSON响应
|
|
||||||
JsonNode rootNode = mapper.readTree(response.body().string());
|
|
||||||
int resLimit = rootNode.path("limit").asInt();
|
|
||||||
boolean hasMore = rootNode.path("has_more").asBoolean(false);
|
|
||||||
List<Map<String, Object>> data = new ArrayList<>();
|
|
||||||
|
|
||||||
// 解析会话列表数据
|
|
||||||
JsonNode dataArray = rootNode.path("data");
|
|
||||||
if (dataArray.isArray()) {
|
|
||||||
for (JsonNode conversationNode : dataArray) {
|
|
||||||
Map<String, Object> conversation = new HashMap<>();
|
|
||||||
conversation.put("id", conversationNode.path("id").asText());
|
|
||||||
conversation.put("name", conversationNode.path("name").asText());
|
|
||||||
conversation.put("inputs", mapper.convertValue(conversationNode.path("inputs"), Map.class));
|
|
||||||
conversation.put("status", conversationNode.path("status").asText());
|
|
||||||
conversation.put("introduction", conversationNode.path("introduction").asText());
|
|
||||||
conversation.put("created_at", conversationNode.path("created_at").asLong());
|
|
||||||
conversation.put("updated_at", conversationNode.path("updated_at").asLong());
|
|
||||||
data.add(conversation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建返回结果
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("limit", resLimit);
|
|
||||||
result.put("has_more", hasMore);
|
|
||||||
result.put("data", data);
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
}*/
|
|
||||||
/* } catch (IOException e) {
|
|
||||||
return error("获取会话列表失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
// 权限标识为辅导员
|
// 权限标识为辅导员
|
||||||
|
@PreAuthorize("@ss.hasPermi('cph:teacher:list')")
|
||||||
@GetMapping("/getMessagesToAdmin")
|
@GetMapping("/getMessagesToAdmin")
|
||||||
public AjaxResult getMessagesToAdmin(@RequestParam String user,
|
public AjaxResult getMessagesToAdmin(@RequestParam String user,
|
||||||
@RequestParam(required = false) String lastId,
|
@RequestParam(required = false) String firstId,
|
||||||
@RequestParam(defaultValue = "20") int limit,
|
@RequestParam(defaultValue = "20") int limit,
|
||||||
@RequestParam(defaultValue = "-updated_at") String sortBy) {
|
@RequestParam(defaultValue = "-updated_at") String sortBy) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<ConversationDTO> conversations = getConversations(user);
|
List<ConversationDTO> conversations = getConversations(user);
|
||||||
|
|
||||||
if (conversations == null || conversations.isEmpty()) {
|
if (conversations == null || conversations.isEmpty()) {
|
||||||
return AjaxResult.error("暂无会话记录");
|
return AjaxResult.error("暂无会话记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
String conversation_id = conversations.get(0).getId();
|
String conversation_id = conversations.get(0).getId();
|
||||||
System.out.println(conversation_id);
|
Map<String, Object> result = getConversationHistoryMessages(conversation_id, user, firstId, limit);
|
||||||
return success(getConversationHistoryMessages(conversation_id, user, null, 20));
|
|
||||||
|
AjaxResult successResult = success(result);
|
||||||
|
return successResult;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return AjaxResult.error("网络请求失败,请稍后重试",error());
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("网络请求失败,请稍后重试");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("请求处理失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 权限标识为学生
|
// 权限标识为学生
|
||||||
@GetMapping("/getMessagesToUser")
|
@GetMapping("/getMessagesToUser")
|
||||||
public AjaxResult getMessagesToUser(@RequestParam(required = false) String lastId,
|
public AjaxResult getMessagesToUser(@RequestParam(required = false) String firstId,
|
||||||
@RequestParam(defaultValue = "20") int limit,
|
@RequestParam(defaultValue = "20") int limit,
|
||||||
@RequestParam(defaultValue = "-updated_at") String sortBy) {
|
@RequestParam(defaultValue = "-updated_at") String sortBy) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String user = SecurityUtils.getLoginUser().getUsername();
|
String user = SecurityUtils.getLoginUser().getUsername();
|
||||||
List<ConversationDTO> conversations = getConversations(user);
|
List<ConversationDTO> conversations = getConversations(user);
|
||||||
|
|
||||||
if (conversations == null || conversations.isEmpty()) {
|
if (conversations == null || conversations.isEmpty()) {
|
||||||
return AjaxResult.error("暂无会话记录");
|
return AjaxResult.error("暂无会话记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
String conversation_id = conversations.get(0).getId();
|
String conversation_id = conversations.get(0).getId();
|
||||||
return success(getConversationHistoryMessages(conversation_id, user, null, 20));
|
Map<String, Object> result = getConversationHistoryMessages(conversation_id, user, firstId, limit);
|
||||||
|
|
||||||
|
AjaxResult successResult = success(result);
|
||||||
|
return successResult;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
return AjaxResult.error("网络请求失败,请稍后重试");
|
return AjaxResult.error("网络请求失败,请稍后重试");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("请求处理失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,13 +551,14 @@ public class AiChatController extends BaseController {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 执行请求
|
// 执行请求
|
||||||
try (Response response = client.newCall(request).execute()) {
|
try (Response response = execWithTimeouts(request, 8, 8, 8)) {
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
throw new IOException("Dify API 请求失败: " + response.code() + " " + response.message());
|
throw new IOException("Dify API 请求失败: " + response.code() + " " + response.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取响应体
|
// 读取响应体
|
||||||
String responseBodyString = response.body().string();
|
String responseBodyString = response.body().string();
|
||||||
|
System.out.println("Raw Response: " + responseBodyString); // 打印原始数据
|
||||||
JsonNode rootNode = mapper.readTree(responseBodyString);
|
JsonNode rootNode = mapper.readTree(responseBodyString);
|
||||||
|
|
||||||
// 提取 data 数组
|
// 提取 data 数组
|
||||||
@@ -738,11 +588,11 @@ public class AiChatController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ConversationDTO> getConversations(String user) throws IOException {
|
public List<ConversationDTO> getConversations(String user) throws IOException {
|
||||||
return getConversations(user, null, 0, null);
|
return getConversations(user, null, 1, "-updated_at");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConversationDTO> getConversations(String user, String lastId) throws IOException {
|
public List<ConversationDTO> getConversations(String user, String lastId) throws IOException {
|
||||||
return getConversations(user, lastId, 0, null);
|
return getConversations(user, lastId, 1, "-updated_at");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConversationDTO> getConversations(String user, Integer limit, String sortBy) throws IOException {
|
public List<ConversationDTO> getConversations(String user, Integer limit, String sortBy) throws IOException {
|
||||||
@@ -785,7 +635,7 @@ public class AiChatController extends BaseController {
|
|||||||
.get()
|
.get()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = client.newCall(request).execute()) {
|
try (Response response = execWithTimeouts(request, 8, 8, 8)) {
|
||||||
|
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
String body = response.body() != null ? response.body().string() : "No body";
|
String body = response.body() != null ? response.body().string() : "No body";
|
||||||
@@ -822,7 +672,6 @@ public class AiChatController extends BaseController {
|
|||||||
result.put("data", data);
|
result.put("data", data);
|
||||||
result.put("has_more", hasMore);
|
result.put("has_more", hasMore);
|
||||||
result.put("limit", finalLimit);
|
result.put("limit", finalLimit);
|
||||||
|
|
||||||
return result; // 直接返回,调用方直接丢给前端
|
return result; // 直接返回,调用方直接丢给前端
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -844,8 +693,7 @@ public class AiChatController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*//**
|
|
||||||
* 文件上传接口
|
* 文件上传接口
|
||||||
* <p>
|
* <p>
|
||||||
* 上传文件并在发送消息时使用,可实现图文多模态理解。支持应用程序所支持的所有格式。
|
* 上传文件并在发送消息时使用,可实现图文多模态理解。支持应用程序所支持的所有格式。
|
||||||
@@ -855,7 +703,7 @@ public class AiChatController extends BaseController {
|
|||||||
* @param file 要上传的文件
|
* @param file 要上传的文件
|
||||||
* @param user 用户标识,用于定义终端用户的身份
|
* @param user 用户标识,用于定义终端用户的身份
|
||||||
* @return 包含文件信息的统一响应结果
|
* @return 包含文件信息的统一响应结果
|
||||||
*//*
|
*/
|
||||||
@PostMapping("/files/upload")
|
@PostMapping("/files/upload")
|
||||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file,
|
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file,
|
||||||
@RequestParam("user") String user) {
|
@RequestParam("user") String user) {
|
||||||
@@ -903,5 +751,5 @@ public class AiChatController extends BaseController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return AjaxResult.error("文件上传异常: " + e.getMessage());
|
return AjaxResult.error("文件上传异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.srs.web.controller.common;
|
||||||
|
|
||||||
|
import com.srs.common.core.controller.BaseController;
|
||||||
|
import com.srs.common.core.domain.AjaxResult;
|
||||||
|
import com.srs.common.core.domain.entity.SysUser;
|
||||||
|
import com.srs.common.core.domain.model.LoginUser;
|
||||||
|
import com.srs.common.utils.WeChatUtil;
|
||||||
|
import com.srs.framework.web.service.TokenService;
|
||||||
|
import com.srs.system.domain.StudentMentalRating;
|
||||||
|
import com.srs.system.mapper.StudentMentalRatingMapper;
|
||||||
|
import com.srs.system.mapper.SysUserMapper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dify心理问题发送企业微信 知无涯
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/wechat")
|
||||||
|
public class WeChatMentalAlertController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WeChatUtil weChatUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private StudentMentalRatingMapper studentMentalRatingMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理心理预警通知请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/mentalAlert")
|
||||||
|
public AjaxResult handleMentalAlert(@RequestBody MentalAlertRequest request,
|
||||||
|
HttpServletRequest httpRequest) {
|
||||||
|
|
||||||
|
// 校验 token 是否有效
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(httpRequest);
|
||||||
|
if (loginUser == null) {
|
||||||
|
return AjaxResult.error("Token无效或已过期");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询辅导员信息
|
||||||
|
SysUser teacher = sysUserMapper.selectTeacherByStuNo(request.getUserId());
|
||||||
|
if (teacher == null || !StringUtils.hasText(teacher.getUserName())) {
|
||||||
|
log.error("辅导员信息不完整,学号: {}", request.getUserId());
|
||||||
|
return AjaxResult.error("未分配辅导员或信息不完整");
|
||||||
|
}
|
||||||
|
/* 保存学生心理问题评级 */
|
||||||
|
StudentMentalRating record = new StudentMentalRating();
|
||||||
|
record.setStudentId(request.getUserId());
|
||||||
|
record.setRating(request.getRating());
|
||||||
|
studentMentalRatingMapper.insert(record);
|
||||||
|
|
||||||
|
// 构建并发送消息
|
||||||
|
try {
|
||||||
|
String content = buildContent(request, teacher);
|
||||||
|
weChatUtil.sendTextMessage(teacher.getUserName(), content);
|
||||||
|
return AjaxResult.success("消息已发送至辅导员");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发送企业微信失败", e);
|
||||||
|
return AjaxResult.error("发送失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建企业微信消息内容
|
||||||
|
*/
|
||||||
|
private String buildContent(MentalAlertRequest request, SysUser teacher) {
|
||||||
|
String teacherName = StringUtils.hasText(teacher.getNickName())
|
||||||
|
? teacher.getNickName()
|
||||||
|
: teacher.getUserName();
|
||||||
|
return String.format(
|
||||||
|
"【心理预警通知】\n" +
|
||||||
|
"辅导员:%s(%s)\n" +
|
||||||
|
"学生姓名:%s\n" +
|
||||||
|
"学号:%s\n" +
|
||||||
|
"问题描述:%s\n" +
|
||||||
|
"AI建议:%s\n" +
|
||||||
|
"心理问题评级:%s",
|
||||||
|
teacherName,
|
||||||
|
teacher.getUserName(),
|
||||||
|
request.getUserName(),
|
||||||
|
request.getUserId(),
|
||||||
|
request.getStudentQuestion(),
|
||||||
|
request.getAiAnswer(),
|
||||||
|
request.getRating()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class MentalAlertRequest {
|
||||||
|
private String userId; // 学生学号
|
||||||
|
private String userName; // 学生姓名
|
||||||
|
private String studentQuestion; // 学生提问内容
|
||||||
|
private String aiAnswer; // AI回复内容
|
||||||
|
private String rating; // 心理问题评级
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部学生心理评级记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/rating/all")
|
||||||
|
public AjaxResult allRatings() {
|
||||||
|
return AjaxResult.success(studentMentalRatingMapper.selectAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据学号获取全部记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/rating/{stuNo}")
|
||||||
|
public AjaxResult listByStuNo(@PathVariable String stuNo) {
|
||||||
|
return AjaxResult.success(studentMentalRatingMapper.selectByStuNo(stuNo));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -284,4 +284,11 @@ public class CphAuditDetailsController extends BaseController {
|
|||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(cphAuditDetailsService.deleteCphAuditDetailsByIds(ids));
|
return toAjax(cphAuditDetailsService.deleteCphAuditDetailsByIds(ids));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 撤销审核
|
||||||
|
*/
|
||||||
|
@PostMapping("/cancelAudit/{id}")
|
||||||
|
public AjaxResult cancelAudit(@PathVariable("id") Long id) {
|
||||||
|
return toAjax(cphAuditDetailsService.cancelAuditById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,9 @@ public class CphGoodApplyController extends BaseController {
|
|||||||
Object total = ajaxResult.get("data");
|
Object total = ajaxResult.get("data");
|
||||||
Page page = (Page) total;
|
Page page = (Page) total;
|
||||||
list.add("rwgl-" + page.getTotal());
|
list.add("rwgl-" + page.getTotal());
|
||||||
|
String username = new String();
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('home:fdy:undo1')")
|
@PreAuthorize("@ss.hasPermi('home:fdy:undo1')")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.srs.dormitory.controller;
|
package com.srs.web.controller.dormitory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.srs.routine.controller;
|
package com.srs.web.controller.routine;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.srs.teacher.controller;
|
package com.srs.web.controller.teacher;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|||||||
@@ -79,4 +79,6 @@ public interface CphAuditDetailsMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteCphAuditDetailsByIds(Long[] ids);
|
public int deleteCphAuditDetailsByIds(Long[] ids);
|
||||||
|
public int cancelAuditById(Long id);
|
||||||
|
public int cancelCphAudiDetailsById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ public interface ICphAuditDetailsService
|
|||||||
*/
|
*/
|
||||||
public int auditOpera(CphAuditDetails cphAuditDetails);
|
public int auditOpera(CphAuditDetails cphAuditDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量同意
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量同意
|
* 批量同意
|
||||||
* @param
|
* @param
|
||||||
@@ -99,6 +105,8 @@ public interface ICphAuditDetailsService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteCphAuditDetailsByIds(Long[] ids);
|
public int deleteCphAuditDetailsByIds(Long[] ids);
|
||||||
|
//撤销
|
||||||
|
public int cancelAuditById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除审核明细信息
|
* 删除审核明细信息
|
||||||
|
|||||||
@@ -435,8 +435,8 @@ public class CphAuditDetailsServiceImpl implements ICphAuditDetailsService {
|
|||||||
temp.setId(cphAuditDetails.getProjectId());
|
temp.setId(cphAuditDetails.getProjectId());
|
||||||
temp.setAuditStatus(cphAuditDetails.getStatusCode().toString());
|
temp.setAuditStatus(cphAuditDetails.getStatusCode().toString());
|
||||||
cphIamService.updateCphIam(temp);
|
cphIamService.updateCphIam(temp);
|
||||||
|
Long statusCode=cphAuditDetailsMapper.selectCphAuditDetailsById(cphAuditDetails.getId()).getStatusCode();
|
||||||
if (cphAuditDetails.getStatusCode() == 6L)//判断审核状态是否完成
|
if (statusCode == 6L)//判断审核状态是否完成
|
||||||
{
|
{
|
||||||
SrsStudent stu = _stuService.selectSrsStudentByStuId(cphAuditDetails.getSubmitterId());
|
SrsStudent stu = _stuService.selectSrsStudentByStuId(cphAuditDetails.getSubmitterId());
|
||||||
SrsAddRecord srsAddRecord = new SrsAddRecord();//加分记录表
|
SrsAddRecord srsAddRecord = new SrsAddRecord();//加分记录表
|
||||||
@@ -519,7 +519,13 @@ public class CphAuditDetailsServiceImpl implements ICphAuditDetailsService {
|
|||||||
public int deleteCphAuditDetailsByIds(Long[] ids) {
|
public int deleteCphAuditDetailsByIds(Long[] ids) {
|
||||||
return cphAuditDetailsMapper.deleteCphAuditDetailsByIds(ids);
|
return cphAuditDetailsMapper.deleteCphAuditDetailsByIds(ids);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int cancelAuditById(Long id) {
|
||||||
|
int result=0;
|
||||||
|
result=cphAuditDetailsMapper.cancelAuditById(id);
|
||||||
|
result+= cphAuditDetailsMapper.cancelCphAudiDetailsById(id);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 删除审核明细信息
|
* 删除审核明细信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ import com.srs.comprehensive.mapper.ClassCounMapper;
|
|||||||
import com.srs.comprehensive.mapper.Gxsdxy02JzgxxMapper;
|
import com.srs.comprehensive.mapper.Gxsdxy02JzgxxMapper;
|
||||||
import com.srs.comprehensive.mapper.InfoTeacherMapper;
|
import com.srs.comprehensive.mapper.InfoTeacherMapper;
|
||||||
import com.srs.comprehensive.util.ListSliceUtil;
|
import com.srs.comprehensive.util.ListSliceUtil;
|
||||||
|
import com.srs.system.domain.QgzxTeacher;
|
||||||
import com.srs.system.domain.SysPost;
|
import com.srs.system.domain.SysPost;
|
||||||
import com.srs.system.domain.SysUserRole;
|
import com.srs.system.domain.SysUserRole;
|
||||||
|
import com.srs.system.mapper.QgzxTeacherMapper;
|
||||||
import com.srs.system.mapper.SysRoleMapper;
|
import com.srs.system.mapper.SysRoleMapper;
|
||||||
import com.srs.system.mapper.SysUserMapper;
|
import com.srs.system.mapper.SysUserMapper;
|
||||||
import com.srs.system.mapper.SysUserRoleMapper;
|
import com.srs.system.mapper.SysUserRoleMapper;
|
||||||
@@ -47,6 +49,8 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private CphTeacherMapper cphTeacherMapper;
|
private CphTeacherMapper cphTeacherMapper;
|
||||||
|
@Autowired
|
||||||
|
private QgzxTeacherMapper qgzxTeacherMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Gxsdxy02JzgxxMapper teacherMapper;
|
private Gxsdxy02JzgxxMapper teacherMapper;
|
||||||
@@ -350,14 +354,121 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
}
|
}
|
||||||
|
|
||||||
//同步辅导员
|
//同步辅导员
|
||||||
|
// @Override
|
||||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
|
// public void sqlserverSynchronousMYSQL(List<Map> list) {
|
||||||
|
// //辅导员列表
|
||||||
|
// List<CphTeacher> cphTeachers = cphTeacherMapper.selectTeacherList();
|
||||||
|
// //查找重复值
|
||||||
|
// List<Map> updateMap = list.stream()
|
||||||
|
// .filter(obj1 -> cphTeachers
|
||||||
|
// .stream().anyMatch(obj2 -> {
|
||||||
|
// Object xhObj = obj1.get("zgh");
|
||||||
|
// if (xhObj != null) {
|
||||||
|
// String zgh = xhObj.toString();
|
||||||
|
// return obj2.getEmployeeId().equals(zgh);
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// //添加需要
|
||||||
|
// List<String> kshList2 = cphTeachers.stream()
|
||||||
|
// .map(CphTeacher::getEmployeeId)
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// List<Map> insertMap = list.stream()
|
||||||
|
// .filter(obj -> {
|
||||||
|
// Object xhObj = obj.get("zgh");
|
||||||
|
// return xhObj != null && !kshList2.contains(xhObj.toString());
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// //添加
|
||||||
|
// List<CphTeacher> insertStudentList = new ArrayList<>();
|
||||||
|
// for (Map map:insertMap){
|
||||||
|
// CphTeacher cphTeacher = new CphTeacher();
|
||||||
|
// Object xmObj = map.get("xm");
|
||||||
|
// if (xmObj != null) {
|
||||||
|
// cphTeacher.setName(xmObj.toString());
|
||||||
|
// }
|
||||||
|
// Object xbObj = map.get("xb");
|
||||||
|
// if (xbObj != null) {
|
||||||
|
// String s = xbObj.toString();
|
||||||
|
// if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
|
// cphTeacher.setGender(xbObj.toString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Object zghObj = map.get("zgh");
|
||||||
|
// if (zghObj != null) {
|
||||||
|
// cphTeacher.setEmployeeId(zghObj.toString());
|
||||||
|
// }
|
||||||
|
// //学院id
|
||||||
|
// Object yxdmObj = map.get("yxdm");
|
||||||
|
// if (yxdmObj!=null) {
|
||||||
|
// Long deptId = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
|
// if (deptId != null) {
|
||||||
|
// cphTeacher.setDeptId(deptId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// cphTeacher.setStatus("1");
|
||||||
|
// cphTeacher.setCreateTime(DateUtils.getNowDate());
|
||||||
|
// insertStudentList.add(cphTeacher);
|
||||||
|
// }
|
||||||
|
// if (insertStudentList.size()!=0) {
|
||||||
|
// cphTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
||||||
|
// }
|
||||||
|
// //修改
|
||||||
|
// List<CphTeacher> updateSrsStudent = new ArrayList<>();
|
||||||
|
// for (Map map:updateMap){
|
||||||
|
// CphTeacher cphTeacher = new CphTeacher();
|
||||||
|
// Object xmObj = map.get("xm");
|
||||||
|
// if (xmObj != null) {
|
||||||
|
// cphTeacher.setName(xmObj.toString());
|
||||||
|
// }
|
||||||
|
// Object xbObj = map.get("xb");
|
||||||
|
// if (xbObj != null) {
|
||||||
|
// String s = xbObj.toString();
|
||||||
|
// if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
|
// cphTeacher.setGender(xbObj.toString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Object zghObj = map.get("zgh");
|
||||||
|
// if (zghObj != null) {
|
||||||
|
// cphTeacher.setEmployeeId(zghObj.toString());
|
||||||
|
// }
|
||||||
|
// //学院id
|
||||||
|
// Object yxdmObj = map.get("yxdm");
|
||||||
|
// if (yxdmObj!=null) {
|
||||||
|
// Long ksh = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
|
// if (ksh != null) {
|
||||||
|
// cphTeacher.setDeptId(ksh);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// cphTeacher.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
// updateSrsStudent.add(cphTeacher);
|
||||||
|
// }
|
||||||
|
// /*if (updateSrsStudent.size()!=0) {
|
||||||
|
// List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
||||||
|
// if (lists != null) {
|
||||||
|
// for (List<CphTeacher> studentList : lists) {
|
||||||
|
// cphTeacherMapper.updateSrsClassList(studentList);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }*/
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
//同步教职工表
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void sqlserverSynchronousMYSQL(List<Map> list) {
|
public void sqlserverSynchronousMYSQL(List<Map> list) {
|
||||||
//辅导员列表
|
//教职工列表
|
||||||
List<CphTeacher> cphTeachers = cphTeacherMapper.selectTeacherList();
|
List<QgzxTeacher> qgzxTeachers = qgzxTeacherMapper.selectTeacherList();
|
||||||
//查找重复值
|
//查找重复值
|
||||||
List<Map> updateMap = list.stream()
|
List<Map> updateMap = list.stream()
|
||||||
.filter(obj1 -> cphTeachers
|
.filter(obj1 -> qgzxTeachers
|
||||||
.stream().anyMatch(obj2 -> {
|
.stream().anyMatch(obj2 -> {
|
||||||
Object xhObj = obj1.get("zgh");
|
Object xhObj = obj1.get("zgh");
|
||||||
if (xhObj != null) {
|
if (xhObj != null) {
|
||||||
@@ -369,8 +480,8 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
//添加需要
|
//添加需要
|
||||||
List<String> kshList2 = cphTeachers.stream()
|
List<String> kshList2 = qgzxTeachers.stream()
|
||||||
.map(CphTeacher::getEmployeeId)
|
.map(QgzxTeacher::getEmployeeId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<Map> insertMap = list.stream()
|
List<Map> insertMap = list.stream()
|
||||||
@@ -380,68 +491,68 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//添加
|
//添加
|
||||||
List<CphTeacher> insertStudentList = new ArrayList<>();
|
List<QgzxTeacher> insertStudentList = new ArrayList<>();
|
||||||
for (Map map:insertMap){
|
for (Map map:insertMap){
|
||||||
CphTeacher cphTeacher = new CphTeacher();
|
QgzxTeacher qgzxTeacher = new QgzxTeacher();
|
||||||
Object xmObj = map.get("xm");
|
Object xmObj = map.get("xm");
|
||||||
if (xmObj != null) {
|
if (xmObj != null) {
|
||||||
cphTeacher.setName(xmObj.toString());
|
qgzxTeacher.setName(xmObj.toString());
|
||||||
}
|
}
|
||||||
Object xbObj = map.get("xb");
|
Object xbObj = map.get("xb");
|
||||||
if (xbObj != null) {
|
if (xbObj != null) {
|
||||||
String s = xbObj.toString();
|
String s = xbObj.toString();
|
||||||
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
cphTeacher.setGender(xbObj.toString());
|
qgzxTeacher.setGender(xbObj.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object zghObj = map.get("zgh");
|
Object zghObj = map.get("zgh");
|
||||||
if (zghObj != null) {
|
if (zghObj != null) {
|
||||||
cphTeacher.setEmployeeId(zghObj.toString());
|
qgzxTeacher.setEmployeeId(zghObj.toString());
|
||||||
}
|
}
|
||||||
//学院id
|
//学院id
|
||||||
Object yxdmObj = map.get("yxdm");
|
Object yxdmObj = map.get("yxdm");
|
||||||
if (yxdmObj!=null) {
|
if (yxdmObj!=null) {
|
||||||
Long deptId = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
Long deptId = qgzxTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
if (deptId != null) {
|
if (deptId != null) {
|
||||||
cphTeacher.setDeptId(deptId);
|
qgzxTeacher.setDeptId(deptId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cphTeacher.setStatus("1");
|
qgzxTeacher.setStatus("1");
|
||||||
cphTeacher.setCreateTime(DateUtils.getNowDate());
|
qgzxTeacher.setCreateTime(DateUtils.getNowDate());
|
||||||
insertStudentList.add(cphTeacher);
|
insertStudentList.add(qgzxTeacher);
|
||||||
}
|
}
|
||||||
if (insertStudentList.size()!=0) {
|
if (insertStudentList.size()!=0) {
|
||||||
cphTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
qgzxTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
||||||
}
|
}
|
||||||
//修改
|
//修改
|
||||||
List<CphTeacher> updateSrsStudent = new ArrayList<>();
|
List<QgzxTeacher> updateSrsStudent = new ArrayList<>();
|
||||||
for (Map map:updateMap){
|
for (Map map:updateMap){
|
||||||
CphTeacher cphTeacher = new CphTeacher();
|
QgzxTeacher qgzxTeacher = new QgzxTeacher();
|
||||||
Object xmObj = map.get("xm");
|
Object xmObj = map.get("xm");
|
||||||
if (xmObj != null) {
|
if (xmObj != null) {
|
||||||
cphTeacher.setName(xmObj.toString());
|
qgzxTeacher.setName(xmObj.toString());
|
||||||
}
|
}
|
||||||
Object xbObj = map.get("xb");
|
Object xbObj = map.get("xb");
|
||||||
if (xbObj != null) {
|
if (xbObj != null) {
|
||||||
String s = xbObj.toString();
|
String s = xbObj.toString();
|
||||||
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
if (!Objects.equals(s, "NULL") && !Objects.equals(s, "null")&&!Objects.equals(s," ")) {
|
||||||
cphTeacher.setGender(xbObj.toString());
|
qgzxTeacher.setGender(xbObj.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object zghObj = map.get("zgh");
|
Object zghObj = map.get("zgh");
|
||||||
if (zghObj != null) {
|
if (zghObj != null) {
|
||||||
cphTeacher.setEmployeeId(zghObj.toString());
|
qgzxTeacher.setEmployeeId(zghObj.toString());
|
||||||
}
|
}
|
||||||
//学院id
|
//学院id
|
||||||
Object yxdmObj = map.get("yxdm");
|
Object yxdmObj = map.get("yxdm");
|
||||||
if (yxdmObj!=null) {
|
if (yxdmObj!=null) {
|
||||||
Long ksh = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
Long ksh = qgzxTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||||
if (ksh != null) {
|
if (ksh != null) {
|
||||||
cphTeacher.setDeptId(ksh);
|
qgzxTeacher.setDeptId(ksh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cphTeacher.setUpdateTime(DateUtils.getNowDate());
|
qgzxTeacher.setUpdateTime(DateUtils.getNowDate());
|
||||||
updateSrsStudent.add(cphTeacher);
|
updateSrsStudent.add(qgzxTeacher);
|
||||||
}
|
}
|
||||||
/*if (updateSrsStudent.size()!=0) {
|
/*if (updateSrsStudent.size()!=0) {
|
||||||
List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
||||||
|
|||||||
@@ -164,4 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
<update id="cancelAuditById" parameterType="Long">
|
||||||
|
update cph_iam set audit_status=1 where id=#{id}
|
||||||
|
</update>
|
||||||
|
<update id="cancelCphAudiDetailsById" parameterType="Long">
|
||||||
|
update cph_audit_details set status_code=1 where project_id=#{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -491,6 +491,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select concat('zx-',count(a.id)) as `all`
|
select concat('zx-',count(a.id)) as `all`
|
||||||
from srs_zxj_apply as a
|
from srs_zxj_apply as a
|
||||||
where a.`step` = 3
|
where a.`step` = 3
|
||||||
|
<!-- 知无涯 教务困难资助-->
|
||||||
|
union
|
||||||
|
select concat('knzz-',count(a.id)) as `all`
|
||||||
|
from knzz_tufa_apply as a
|
||||||
|
where a.apply_status = 1
|
||||||
|
/*宁博 6、困难资助-国家励志奖学金-学工审核代办*/
|
||||||
|
union
|
||||||
|
select concat('knzzgl-',count(a.id)) as `all`
|
||||||
|
from knzz_gl_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countStuUnDo" resultType="String" parameterType="String">
|
<select id="countStuUnDo" resultType="String" parameterType="String">
|
||||||
@@ -517,6 +528,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select concat('zx-',count(a.id)) as `all`
|
select concat('zx-',count(a.id)) as `all`
|
||||||
from srs_zxj_apply as a
|
from srs_zxj_apply as a
|
||||||
where a.`step` = 4 and a.xh = #{stuNo}
|
where a.`step` = 4 and a.xh = #{stuNo}
|
||||||
|
<!-- 知无涯 学生困难资助申请驳回-->
|
||||||
|
union
|
||||||
|
select concat('knzz-',count(a.id)) as `all`
|
||||||
|
from knzz_tufa_apply as a
|
||||||
|
where a.apply_status = 6 and a.stu_no = #{stuNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
@@ -564,6 +580,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
LEFT JOIN sys_menu m on rm.menu_id = m.menu_id
|
LEFT JOIN sys_menu m on rm.menu_id = m.menu_id
|
||||||
where r.role_key ='stumanger' and m.component = 'poverty/xw'
|
where r.role_key ='stumanger' and m.component = 'poverty/xw'
|
||||||
)
|
)
|
||||||
|
<!-- 知无涯 学务困难资助 -->
|
||||||
|
union
|
||||||
|
select concat('knzz-',count(a.id)) as `all`
|
||||||
|
from knzz_tufa_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1 and b.dept_id = #{id}
|
||||||
|
/*宁博 6、困难资助-国家励志奖学金-学务审核代办*/
|
||||||
|
union
|
||||||
|
select concat('knzzgl-',count(a.id)) as `all`
|
||||||
|
from knzz_gl_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1 and b.dept_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countFdyUnDo" resultType="String" parameterType="String">
|
<select id="countFdyUnDo" resultType="String" parameterType="String">
|
||||||
@@ -610,6 +638,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
left join sys_dept as c on b.dept_code = c.dept_code
|
left join sys_dept as c on b.dept_code = c.dept_code
|
||||||
left join view_stu_info as d on a.stu_no = d.stu_no
|
left join view_stu_info as d on a.stu_no = d.stu_no
|
||||||
where b.zdls_no = #{tNo} and a.apply_status = '1'
|
where b.zdls_no = #{tNo} and a.apply_status = '1'
|
||||||
|
<!-- 知无涯 辅导员困难资助-->
|
||||||
|
union
|
||||||
|
select concat('knzz-',count(a.id)) as `all`
|
||||||
|
from knzz_tufa_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1 and b.t_no = #{tNo}
|
||||||
|
<!-- 知无涯 统计待审核的离校申请 -->
|
||||||
|
union
|
||||||
|
select concat('leave-',count(a.return_school_id)) as `all`
|
||||||
|
from sur_itinerary as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.leave_status = 1 and b.t_no = #{tNo}
|
||||||
|
/*宁博 10、假期去向-学生返校-辅导员审核代办*/
|
||||||
|
union
|
||||||
|
select concat('return-',count(a.return_school_id)) as `all`
|
||||||
|
from sur_itinerary as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.status = '1' and b.t_no = #{tNo}
|
||||||
|
/*宁博 6、困难资助-国家励志奖学金-辅导员审核代办*/
|
||||||
|
union
|
||||||
|
select concat('knzzgl-',count(a.id)) as `all`
|
||||||
|
from knzz_gl_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1 and b.t_no = #{tNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
@@ -633,6 +685,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
LEFT JOIN sys_menu m on rm.menu_id = m.menu_id
|
LEFT JOIN sys_menu m on rm.menu_id = m.menu_id
|
||||||
where r.role_key ='Junior_college_leader'
|
where r.role_key ='Junior_college_leader'
|
||||||
)
|
)
|
||||||
|
<!-- 知无涯 书记困难资助-->
|
||||||
|
union
|
||||||
|
select concat('knzz-',count(a.id)) as `all`
|
||||||
|
from knzz_tufa_apply as a
|
||||||
|
left join view_stu_info as b on a.stu_no = b.stu_no
|
||||||
|
where a.apply_status = 1 and b.dept_id = #{id}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ private static final long serialVersionUID=1L;
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@ApiModelProperty("学院")
|
@ApiModelProperty("学院")
|
||||||
@TableField("dept_name=false")
|
@TableField(exist=false)
|
||||||
@Excel(name = "学院")
|
@Excel(name = "学院")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.srs.system.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.srs.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生心理问题评级表 知无涯
|
||||||
|
*/
|
||||||
|
public class StudentMentalRating extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String studentId;
|
||||||
|
private String rating;
|
||||||
|
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudentId() {
|
||||||
|
return studentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudentId(String studentId) {
|
||||||
|
this.studentId = studentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRating() {
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRating(String rating) {
|
||||||
|
this.rating = rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date updatedTime;
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.srs.system.domain.QgzxTeacher;
|
import com.srs.system.domain.QgzxTeacher;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 教职工信息Mapper接口
|
* 教职工信息Mapper接口
|
||||||
@@ -59,4 +60,8 @@ public interface QgzxTeacherMapper extends BaseMapper<QgzxTeacher> {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteQgzxTeacherByTeacherIds(Long[] teacherIds);
|
int deleteQgzxTeacherByTeacherIds(Long[] teacherIds);
|
||||||
|
|
||||||
|
public List<QgzxTeacher> selectTeacherList();
|
||||||
|
Long selectDeptCode(String ksh);
|
||||||
|
Integer insertBatchSomeColumn(@Param("list")List<QgzxTeacher> entityList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.srs.system.mapper;
|
||||||
|
|
||||||
|
import com.srs.system.domain.StudentMentalRating;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface StudentMentalRatingMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号查询 知无涯
|
||||||
|
*/
|
||||||
|
StudentMentalRating selectByStudentId(String studentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入
|
||||||
|
*/
|
||||||
|
int insert(StudentMentalRating record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按学号更新评级
|
||||||
|
*/
|
||||||
|
int updateRatingByStudentId(StudentMentalRating record);
|
||||||
|
|
||||||
|
/** 全部记录 */
|
||||||
|
List<StudentMentalRating> selectAll();
|
||||||
|
|
||||||
|
/** 单学号全部记录 */
|
||||||
|
List<StudentMentalRating> selectByStuNo(@Param("stuNo") String stuNo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectQgzxTeacherVo"/>
|
<include refid="selectQgzxTeacherVo"/>
|
||||||
where teacher_id = #{teacherId}
|
where teacher_id = #{teacherId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectTeacherList" resultType="com.srs.system.domain.QgzxTeacher">
|
||||||
|
select * from qgzx_teacher
|
||||||
|
</select>
|
||||||
|
<select id="selectDeptCode" resultType="java.lang.Long">
|
||||||
|
select a.dept_id
|
||||||
|
from sys_dept as a
|
||||||
|
where dept_code = #{ksh}
|
||||||
|
</select>
|
||||||
<insert id="insertQgzxTeacher" parameterType="QgzxTeacher" useGeneratedKeys="true" keyProperty="teacherId">
|
<insert id="insertQgzxTeacher" parameterType="QgzxTeacher" useGeneratedKeys="true" keyProperty="teacherId">
|
||||||
insert into qgzx_teacher
|
insert into qgzx_teacher
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -65,6 +72,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertBatchSomeColumn">
|
||||||
|
insert into qgzx_teacher(name,gender,age,employee_id,dept_id,status,create_time)
|
||||||
|
values
|
||||||
|
<foreach item="entity" collection="List" separator="," open="(" close=")">
|
||||||
|
(
|
||||||
|
<if test="entity.name != null and entity.name != ''">#{entity.name},</if>
|
||||||
|
<if test="entity.gender != null and entity.gender != ''">#{entity.gender},</if>
|
||||||
|
<if test="entity.age!=null">#{entity.age},</if>
|
||||||
|
<if test="entity.employeeId != null and entity.employeeId != ''">#{entity.employeeId},</if>
|
||||||
|
<if test="entity.deptId!=null">#{entity.deptId},</if>
|
||||||
|
<if test="entity.status != null and entity.status != ''">#{entity.status},</if>
|
||||||
|
<if test="entity.createTime!=null">#{entity.createTime},</if>
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateQgzxTeacher" parameterType="QgzxTeacher">
|
<update id="updateQgzxTeacher" parameterType="QgzxTeacher">
|
||||||
update qgzx_teacher
|
update qgzx_teacher
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?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="com.srs.system.mapper.StudentMentalRatingMapper">
|
||||||
|
<!-- 添加 知无涯-->
|
||||||
|
<select id="selectByStudentId" resultType="com.srs.system.domain.StudentMentalRating">
|
||||||
|
SELECT id, student_id, rating, created_time, updated_time
|
||||||
|
FROM student_mental_rating
|
||||||
|
WHERE student_id = #{studentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.srs.system.domain.StudentMentalRating"
|
||||||
|
useGeneratedKeys="true" keyProperty="id">
|
||||||
|
INSERT INTO student_mental_rating(student_id, rating)
|
||||||
|
VALUES (#{studentId}, #{rating})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRatingByStudentId" parameterType="com.srs.system.domain.StudentMentalRating">
|
||||||
|
UPDATE student_mental_rating
|
||||||
|
SET rating = #{rating}
|
||||||
|
WHERE student_id = #{studentId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 心理查询全部:知无涯 -->
|
||||||
|
<select id="selectAll" resultType="com.srs.system.domain.StudentMentalRating">
|
||||||
|
SELECT id,
|
||||||
|
student_id AS studentId,
|
||||||
|
rating,
|
||||||
|
created_time AS createdTime,
|
||||||
|
updated_time AS updatedTime
|
||||||
|
FROM student_mental_rating
|
||||||
|
ORDER BY created_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据学号查询心理:知无涯 -->
|
||||||
|
<select id="selectByStuNo" resultType="com.srs.system.domain.StudentMentalRating">
|
||||||
|
SELECT id,
|
||||||
|
student_id AS studentId,
|
||||||
|
rating,
|
||||||
|
created_time AS createdTime,
|
||||||
|
updated_time AS updatedTime
|
||||||
|
FROM student_mental_rating
|
||||||
|
WHERE student_id = #{stuNo}
|
||||||
|
ORDER BY created_time DESC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -8,6 +8,8 @@ import com.srs.common.core.domain.entity.SysUser;
|
|||||||
import com.srs.common.enums.QgzxApplyStatus;
|
import com.srs.common.enums.QgzxApplyStatus;
|
||||||
import com.srs.comprehensive.domain.CphTeacher;
|
import com.srs.comprehensive.domain.CphTeacher;
|
||||||
import com.srs.comprehensive.mapper.CphTeacherMapper;
|
import com.srs.comprehensive.mapper.CphTeacherMapper;
|
||||||
|
import com.srs.system.domain.QgzxTeacher;
|
||||||
|
import com.srs.system.mapper.QgzxTeacherMapper;
|
||||||
import com.srs.system.mapper.SysDeptMapper;
|
import com.srs.system.mapper.SysDeptMapper;
|
||||||
import com.srs.system.mapper.SysUserMapper;
|
import com.srs.system.mapper.SysUserMapper;
|
||||||
import com.srs.workstudy.domain.QgzxMoney;
|
import com.srs.workstudy.domain.QgzxMoney;
|
||||||
@@ -61,6 +63,8 @@ public class QgzxPostServiceImpl extends ServiceImpl<QgzxPostMapper,QgzxPost> im
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CphTeacherMapper _teacherMapper;
|
private CphTeacherMapper _teacherMapper;
|
||||||
|
@Autowired
|
||||||
|
private QgzxTeacherMapper _qgzxteacherMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper _userMapper;
|
private SysUserMapper _userMapper;
|
||||||
@@ -383,10 +387,14 @@ public class QgzxPostServiceImpl extends ServiceImpl<QgzxPostMapper,QgzxPost> im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryWrapper<CphTeacher> fzrQuery = new QueryWrapper<>();
|
// QueryWrapper<CphTeacher> fzrQuery = new QueryWrapper<>();
|
||||||
|
// fzrQuery.eq("employee_id", param.fzrNo)
|
||||||
|
// .last("limit 1");
|
||||||
|
// CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
||||||
|
QueryWrapper<QgzxTeacher> fzrQuery = new QueryWrapper<>();
|
||||||
fzrQuery.eq("employee_id", param.fzrNo)
|
fzrQuery.eq("employee_id", param.fzrNo)
|
||||||
.last("limit 1");
|
.last("limit 1");
|
||||||
CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
QgzxTeacher fzr = _qgzxteacherMapper.selectOne(fzrQuery);
|
||||||
if (fzr == null) {
|
if (fzr == null) {
|
||||||
throw new Exception("负责人工号不存在");
|
throw new Exception("负责人工号不存在");
|
||||||
} else {
|
} else {
|
||||||
@@ -437,10 +445,14 @@ public class QgzxPostServiceImpl extends ServiceImpl<QgzxPostMapper,QgzxPost> im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryWrapper<CphTeacher> fzrQuery = new QueryWrapper<>();
|
// QueryWrapper<CphTeacher> fzrQuery = new QueryWrapper<>();
|
||||||
|
// fzrQuery.eq("employee_id", param.fzrNo)
|
||||||
|
// .last("limit 1");
|
||||||
|
// CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
||||||
|
QueryWrapper<QgzxTeacher> fzrQuery = new QueryWrapper<>();
|
||||||
fzrQuery.eq("employee_id", param.fzrNo)
|
fzrQuery.eq("employee_id", param.fzrNo)
|
||||||
.last("limit 1");
|
.last("limit 1");
|
||||||
CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
QgzxTeacher fzr = _qgzxteacherMapper.selectOne(fzrQuery);
|
||||||
if (fzr == null) {
|
if (fzr == null) {
|
||||||
throw new Exception("负责人工号不存在");
|
throw new Exception("负责人工号不存在");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user