From 62eb499b0c969f246d3245d1429a97da4de1ce28 Mon Sep 17 00:00:00 2001
From: 钟日健 <arsn163@163.com>
Date: Mon, 01 Jun 2026 20:46:13 +0800
Subject: [PATCH] feat: 成绩查询增加年龄查询返回
---
src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java | 127 ++++++++++++++++++++++++++++++++++--------
1 files changed, 102 insertions(+), 25 deletions(-)
diff --git a/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java b/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
index c96da46..40106f8 100644
--- a/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
+++ b/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
@@ -4,20 +4,24 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
+import org.springblade.common.utils.arg;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.system.service.MyAsyncService;
import org.springblade.modules.workreport.entity.WorkReport;
import org.springblade.modules.workreport.service.WorkReportService;
import org.springblade.modules.workreport.vo.WorkReportVo;
import org.springframework.web.bind.annotation.*;
import java.sql.Wrapper;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -39,10 +43,12 @@
private final IUserService userService;
private final IDeptService deptService;
+ private final MyAsyncService myAsyncService;
/**
* 自定义分页
- * @param query page,size
+ *
+ * @param query page,size
* @param workReport 工作汇报信息对象
*/
@GetMapping("/page")
@@ -59,22 +65,19 @@
/**
* 自定义分页--接收到的汇报信息page
- * @param query page,size
+ *
+ * @param query page,size
* @param workReport 工作汇报信息对象
*/
@GetMapping("/pageReply")
public R<IPage<WorkReportVo>> pageReply(WorkReportVo workReport, Query query) {
IPage<WorkReportVo> pages = workReportService.selectWorkReplyPage(Condition.getPage(query), workReport);
-// List<WorkReportVo> records = pages.getRecords();
-// for (WorkReportVo record : records) {
-// record.setReplyRealName(getReplyRealName(record));
-// record.setReplyDeptName(getReplyDeptName(record));
-// }
return R.data(pages);
}
/**
* 新增
+ *
* @param workReport 工作汇报信息对象
*/
@PostMapping("/save")
@@ -85,6 +88,7 @@
/**
* 修改
+ *
* @param workReport 工作汇报信息对象
*/
@PostMapping("/update")
@@ -94,31 +98,84 @@
/**
* 新增或修改
+ *
* @param workReport 工作汇报信息对象
*/
@PostMapping("/submit")
public R submit(@RequestBody WorkReport workReport) {
- if (null!=workReport.getId()){
- workReport.setReplyTime(new Date());
- workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
- }else {
+ boolean status = false;
+ if (null == workReport.getId()) {
workReport.setReportTime(new Date());
workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
+ //新增
+ status = workReportService.save(workReport);
+ if (status) {
+ //数据同步
+ String s1 =
+ "insert into sys_work_report(id,type,content,work_desc,report_time,received_ids,dept_id,reply_dept_ids,category,user_id) " +
+ "values(" + "'" + workReport.getId() + "'" + "," +
+ "'" + workReport.getType() + "'" + "," +
+ "'" + workReport.getContent() + "'" + "," +
+ "'" + workReport.getWorkDesc() + "'" + "," +
+ "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReportTime()) + "'" + "," +
+ "'" + workReport.getReceivedIds() + "'" + "," +
+ "'" + workReport.getDeptId() + "'" + "," +
+ "'" + workReport.getReplyDeptIds() + "'" + "," +
+ "'" + workReport.getCategory() + "'" + "," +
+ "'" + workReport.getUserId() + "'" + ")";
+ //FtpUtil.sqlFileUpload(s1);
+ myAsyncService.dataSync(s1);
+ }
+ } else {
+ workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
+ if (null == workReport.getReplyTime()) {
+ workReport.setReplyTime(new Date());
+ }
+
+ //修改
+ status = workReportService.updateById(workReport);
+ if (status) {
+ //内网同步
+ String s1 =
+ "update sys_work_report set type = " + "'" + workReport.getType() + "'" +
+ ",content = " + "'" + workReport.getContent() + "'" +
+ ",work_desc = " + "'" + workReport.getWorkDesc() + "'" +
+ ",received_ids = " + "'" + workReport.getReceivedIds() + "'" +
+ ",reply_content = " + "'" + workReport.getReplyContent() + "'" +
+ ",reply_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReplyTime()) + "'" +
+ ",dept_id = " + "'" + workReport.getDeptId() + "'" +
+ ",reply_dept_ids = " + "'" + workReport.getReplyDeptIds() + "'" +
+ ",category = " + "'" + workReport.getCategory() + "'" +
+ ",user_id = " + "'" + workReport.getUserId() + "'" +
+ " " + "where id = " + "'" + workReport.getId() + "'";
+ //FtpUtil.sqlFileUpload(s1);
+ myAsyncService.dataSync(s1);
+ }
}
- return R.status(workReportService.saveOrUpdate(workReport));
+ return R.status(status);
}
/**
* 删除
+ *
* @param ids 工作汇报信息ids 数组
*/
@PostMapping("/remove")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+ //内网删除
+ List<Long> list = Func.toLongList(ids);
+ list.forEach(id -> {
+ //内网同步
+ String s1 = "delete from sys_work_report where id = " + "'" + id + "'";
+ //FtpUtil.sqlFileUpload(s1);
+ myAsyncService.dataSync(s1);
+ });
return R.status(workReportService.removeByIds(Func.toLongList(ids)));
}
/**
* 详情
+ *
* @param workReport 工作汇报信息对象
*/
@GetMapping("/detail")
@@ -134,23 +191,35 @@
/**
* 获取接收人的单位信息
+ *
* @param detail 汇报详情
* @return
*/
private String getReplyDeptName(WorkReportVo detail) {
- List<String> replyDeptIds = Arrays.asList(detail.getReplyDeptIds().split(","));
- StringBuilder replyDeptNameInfo = new StringBuilder();
- for (String deptId : replyDeptIds) {
- //查询接收人单位信息
- Dept deptDetail = deptService.getById(Long.parseLong(deptId));
- replyDeptNameInfo = replyDeptNameInfo.append(deptDetail.getDeptName()).append(",");
+
+ if (null != detail.getReplyDeptIds() && detail.getReplyDeptIds() != "" && !detail.getReplyDeptIds().isEmpty()) {
+ List<String> replyDeptIds = Arrays.asList(detail.getReplyDeptIds().split(","));
+ StringBuilder replyDeptNameInfo = new StringBuilder();
+ if (replyDeptIds.size() > 0) {
+ for (String deptId : replyDeptIds) {
+ //查询接收人单位信息
+ Dept deptDetail = deptService.getById(Long.parseLong(deptId));
+ if (null != deptDetail) {
+ replyDeptNameInfo = replyDeptNameInfo.append(deptDetail.getDeptName()).append(",");
+ }
+ }
+ if (replyDeptNameInfo.length() > 0) {
+ //截取
+ return replyDeptNameInfo.substring(0, replyDeptNameInfo.length() - 1);
+ }
+ }
}
- //截取
- return replyDeptNameInfo.substring(0, replyDeptNameInfo.length() - 1);
+ return null;
}
/**
* 获取接收人的单位id(dept)信息
+ *
* @param
* @return
*/
@@ -160,12 +229,14 @@
for (String userId : userIds) {
//查询接收人单位信息
User userDetail = userService.getById(userId);
- list.add(userDetail.getDeptId());
+ if (null != userDetail) {
+ list.add(userDetail.getDeptId());
+ }
}
//去重
List<String> collect = list.stream().distinct().collect(Collectors.toList());
//截取
- return String.join(",",collect);
+ return String.join(",", collect);
}
/**
@@ -174,7 +245,7 @@
* @param detail 汇报详情
* @return
*/
- private String getReplyRealName(WorkReportVo detail){
+ private String getReplyRealName(WorkReportVo detail) {
List<String> userIds = Arrays.asList(detail.getReceivedIds().split(","));
StringBuilder replyRealNameInfo = new StringBuilder();
for (String userId : userIds) {
@@ -183,10 +254,16 @@
// user.setCardid(idCardNo);
// User userDetail = userService.getOne(Condition.getQueryWrapper(user));
User userDetail = userService.getById(userId);
- replyRealNameInfo = replyRealNameInfo.append(userDetail.getRealName()).append(",");
+ if (null != userDetail) {
+ replyRealNameInfo = replyRealNameInfo.append(userDetail.getRealName()).append(",");
+ }
+
}
//截取
- return replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1);
+ if (replyRealNameInfo.toString().length() > 0) {
+ return replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1);
+ }
+ return null;
}
}
--
Gitblit v1.9.3