Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -16,6 +16,7 @@ import okhttp3.*;
|
||||
import com.srs.common.core.domain.AjaxResult; // ✅ RuoYi 的返回结果类
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -38,41 +39,49 @@ import java.util.concurrent.CompletableFuture;
|
||||
@RestController
|
||||
@RequestMapping("/aitutor/aichat")
|
||||
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服务
|
||||
*/
|
||||
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客户端实例
|
||||
@@ -386,12 +395,9 @@ public class AiChatController extends BaseController {
|
||||
// 参数校验和限制
|
||||
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()
|
||||
.url(url)
|
||||
.url(DIFY_API_FEEDBACK_URL + page + "&limit=" + limitValue)
|
||||
.addHeader("Authorization", "Bearer " + DIFY_API_KEY)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.get()
|
||||
@@ -420,27 +426,6 @@ public class AiChatController extends BaseController {
|
||||
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);
|
||||
|
||||
// 提取用户信息
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -476,6 +461,7 @@ public class AiChatController extends BaseController {
|
||||
}
|
||||
|
||||
// 权限标识为辅导员
|
||||
@PreAuthorize("@ss.hasPermi('cph:teacher:list')")
|
||||
@GetMapping("/getMessagesToAdmin")
|
||||
public AjaxResult getMessagesToAdmin(@RequestParam String user,
|
||||
@RequestParam(required = false) String firstId,
|
||||
|
||||
@@ -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) {
|
||||
return toAjax(cphAuditDetailsService.deleteCphAuditDetailsByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 撤销审核
|
||||
*/
|
||||
@PostMapping("/cancelAudit/{ids}")
|
||||
public AjaxResult cancelAudit(@PathVariable Long[] ids) {
|
||||
return toAjax(cphAuditDetailsService.cancelAuditByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +79,5 @@ public interface CphAuditDetailsMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCphAuditDetailsByIds(Long[] ids);
|
||||
public int cancelAudiByIds(Long[] ids);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ public interface ICphAuditDetailsService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCphAuditDetailsByIds(Long[] ids);
|
||||
//撤销
|
||||
public int cancelAuditByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除审核明细信息
|
||||
|
||||
@@ -519,7 +519,10 @@ public class CphAuditDetailsServiceImpl implements ICphAuditDetailsService {
|
||||
public int deleteCphAuditDetailsByIds(Long[] ids) {
|
||||
return cphAuditDetailsMapper.deleteCphAuditDetailsByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cancelAuditByIds(Long[] ids) {
|
||||
return cphAuditDetailsMapper.cancelAudiByIds(ids);
|
||||
}
|
||||
/**
|
||||
* 删除审核明细信息
|
||||
*
|
||||
|
||||
@@ -19,8 +19,10 @@ import com.srs.comprehensive.mapper.ClassCounMapper;
|
||||
import com.srs.comprehensive.mapper.Gxsdxy02JzgxxMapper;
|
||||
import com.srs.comprehensive.mapper.InfoTeacherMapper;
|
||||
import com.srs.comprehensive.util.ListSliceUtil;
|
||||
import com.srs.system.domain.QgzxTeacher;
|
||||
import com.srs.system.domain.SysPost;
|
||||
import com.srs.system.domain.SysUserRole;
|
||||
import com.srs.system.mapper.QgzxTeacherMapper;
|
||||
import com.srs.system.mapper.SysRoleMapper;
|
||||
import com.srs.system.mapper.SysUserMapper;
|
||||
import com.srs.system.mapper.SysUserRoleMapper;
|
||||
@@ -47,6 +49,8 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
||||
{
|
||||
@Autowired
|
||||
private CphTeacherMapper cphTeacherMapper;
|
||||
@Autowired
|
||||
private QgzxTeacherMapper qgzxTeacherMapper;
|
||||
|
||||
@Autowired
|
||||
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
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void sqlserverSynchronousMYSQL(List<Map> list) {
|
||||
//辅导员列表
|
||||
List<CphTeacher> cphTeachers = cphTeacherMapper.selectTeacherList();
|
||||
//教职工列表
|
||||
List<QgzxTeacher> qgzxTeachers = qgzxTeacherMapper.selectTeacherList();
|
||||
//查找重复值
|
||||
List<Map> updateMap = list.stream()
|
||||
.filter(obj1 -> cphTeachers
|
||||
.filter(obj1 -> qgzxTeachers
|
||||
.stream().anyMatch(obj2 -> {
|
||||
Object xhObj = obj1.get("zgh");
|
||||
if (xhObj != null) {
|
||||
@@ -369,8 +480,8 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//添加需要
|
||||
List<String> kshList2 = cphTeachers.stream()
|
||||
.map(CphTeacher::getEmployeeId)
|
||||
List<String> kshList2 = qgzxTeachers.stream()
|
||||
.map(QgzxTeacher::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Map> insertMap = list.stream()
|
||||
@@ -380,68 +491,68 @@ public class CphTeacherServiceImpl implements ICphTeacherService
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
//添加
|
||||
List<CphTeacher> insertStudentList = new ArrayList<>();
|
||||
List<QgzxTeacher> insertStudentList = new ArrayList<>();
|
||||
for (Map map:insertMap){
|
||||
CphTeacher cphTeacher = new CphTeacher();
|
||||
QgzxTeacher qgzxTeacher = new QgzxTeacher();
|
||||
Object xmObj = map.get("xm");
|
||||
if (xmObj != null) {
|
||||
cphTeacher.setName(xmObj.toString());
|
||||
qgzxTeacher.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());
|
||||
qgzxTeacher.setGender(xbObj.toString());
|
||||
}
|
||||
}
|
||||
Object zghObj = map.get("zgh");
|
||||
if (zghObj != null) {
|
||||
cphTeacher.setEmployeeId(zghObj.toString());
|
||||
qgzxTeacher.setEmployeeId(zghObj.toString());
|
||||
}
|
||||
//学院id
|
||||
Object yxdmObj = map.get("yxdm");
|
||||
if (yxdmObj!=null) {
|
||||
Long deptId = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||
Long deptId = qgzxTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||
if (deptId != null) {
|
||||
cphTeacher.setDeptId(deptId);
|
||||
qgzxTeacher.setDeptId(deptId);
|
||||
}
|
||||
}
|
||||
cphTeacher.setStatus("1");
|
||||
cphTeacher.setCreateTime(DateUtils.getNowDate());
|
||||
insertStudentList.add(cphTeacher);
|
||||
qgzxTeacher.setStatus("1");
|
||||
qgzxTeacher.setCreateTime(DateUtils.getNowDate());
|
||||
insertStudentList.add(qgzxTeacher);
|
||||
}
|
||||
if (insertStudentList.size()!=0) {
|
||||
cphTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
||||
qgzxTeacherMapper.insertBatchSomeColumn(insertStudentList);
|
||||
}
|
||||
//修改
|
||||
List<CphTeacher> updateSrsStudent = new ArrayList<>();
|
||||
List<QgzxTeacher> updateSrsStudent = new ArrayList<>();
|
||||
for (Map map:updateMap){
|
||||
CphTeacher cphTeacher = new CphTeacher();
|
||||
QgzxTeacher qgzxTeacher = new QgzxTeacher();
|
||||
Object xmObj = map.get("xm");
|
||||
if (xmObj != null) {
|
||||
cphTeacher.setName(xmObj.toString());
|
||||
qgzxTeacher.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());
|
||||
qgzxTeacher.setGender(xbObj.toString());
|
||||
}
|
||||
}
|
||||
Object zghObj = map.get("zgh");
|
||||
if (zghObj != null) {
|
||||
cphTeacher.setEmployeeId(zghObj.toString());
|
||||
qgzxTeacher.setEmployeeId(zghObj.toString());
|
||||
}
|
||||
//学院id
|
||||
Object yxdmObj = map.get("yxdm");
|
||||
if (yxdmObj!=null) {
|
||||
Long ksh = cphTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||
Long ksh = qgzxTeacherMapper.selectDeptCode(yxdmObj.toString());
|
||||
if (ksh != null) {
|
||||
cphTeacher.setDeptId(ksh);
|
||||
qgzxTeacher.setDeptId(ksh);
|
||||
}
|
||||
}
|
||||
cphTeacher.setUpdateTime(DateUtils.getNowDate());
|
||||
updateSrsStudent.add(cphTeacher);
|
||||
qgzxTeacher.setUpdateTime(DateUtils.getNowDate());
|
||||
updateSrsStudent.add(qgzxTeacher);
|
||||
}
|
||||
/*if (updateSrsStudent.size()!=0) {
|
||||
List<List<CphTeacher>> lists = ListSliceUtil.updateSlice(updateSrsStudent);
|
||||
|
||||
@@ -164,4 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<update id="cancelAudiByIds" parameterType="String">
|
||||
update cph_audit_details set status_code=1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -89,7 +89,7 @@ private static final long serialVersionUID=1L;
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("学院")
|
||||
@TableField("dept_name=false")
|
||||
@TableField(exist=false)
|
||||
@Excel(name = "学院")
|
||||
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.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 教职工信息Mapper接口
|
||||
@@ -59,4 +60,8 @@ public interface QgzxTeacherMapper extends BaseMapper<QgzxTeacher> {
|
||||
* @return 结果
|
||||
*/
|
||||
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"/>
|
||||
where teacher_id = #{teacherId}
|
||||
</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 into qgzx_teacher
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -65,6 +72,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</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 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.comprehensive.domain.CphTeacher;
|
||||
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.SysUserMapper;
|
||||
import com.srs.workstudy.domain.QgzxMoney;
|
||||
@@ -61,6 +63,8 @@ public class QgzxPostServiceImpl extends ServiceImpl<QgzxPostMapper,QgzxPost> im
|
||||
|
||||
@Autowired
|
||||
private CphTeacherMapper _teacherMapper;
|
||||
@Autowired
|
||||
private QgzxTeacherMapper _qgzxteacherMapper;
|
||||
|
||||
@Autowired
|
||||
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)
|
||||
.last("limit 1");
|
||||
CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
||||
QgzxTeacher fzr = _qgzxteacherMapper.selectOne(fzrQuery);
|
||||
if (fzr == null) {
|
||||
throw new Exception("负责人工号不存在");
|
||||
} 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)
|
||||
.last("limit 1");
|
||||
CphTeacher fzr = _teacherMapper.selectOne(fzrQuery);
|
||||
QgzxTeacher fzr = _qgzxteacherMapper.selectOne(fzrQuery);
|
||||
if (fzr == null) {
|
||||
throw new Exception("负责人工号不存在");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user