From cc057177b2fb17aee9a173a6adbabdc578fd74c7 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 06 Dec 2021 10:30:44 +0800
Subject: [PATCH] 1.许可

---
 src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java |   47 ++++++++++++++++++++++++++++-------------------
 1 files changed, 28 insertions(+), 19 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 ae73a36..87402aa 100644
--- a/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
+++ b/src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
@@ -97,8 +97,8 @@
 	@PostMapping("/submit")
 	public R submit(@RequestBody WorkReport workReport){
 		boolean status = false;
-		if (null!=workReport.getId()){
-			workReport.setReportTime(new Date());
+		if (null==workReport.getId()){
+//			workReport.setReportTime(new Date());
 			workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
 			//新增
 			status = workReportService.save(workReport);
@@ -119,23 +119,27 @@
 			FtpUtil.sqlFileUpload(s1);
 		}else {
 			workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds()));
-			if (null!=workReport.getReplyTime()){
-				workReport.setReplyTime(new Date());
+			if (null==workReport.getReplyTime()){
+//				workReport.setReplyTime(new Date());
 			}
+
+			//修改
+			status = workReportService.updateById(workReport);
+
 			//内网同步
-			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);
+//			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);
 		}
 		return R.status(status);
 	}
@@ -222,10 +226,15 @@
 //			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.length()>0) {
+			return replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1);
+		}
+		return replyRealNameInfo.toString();
 	}
 
 }

--
Gitblit v1.9.3