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/talk/controller/TalkController.java | 65 ++++++++++++++++++++++++--------
1 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/springblade/modules/talk/controller/TalkController.java b/src/main/java/org/springblade/modules/talk/controller/TalkController.java
index 7c58e37..90a9890 100644
--- a/src/main/java/org/springblade/modules/talk/controller/TalkController.java
+++ b/src/main/java/org/springblade/modules/talk/controller/TalkController.java
@@ -24,6 +24,7 @@
import javax.validation.Valid;
+import org.springblade.common.constant.FtpConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@@ -39,6 +40,7 @@
import springfox.documentation.annotations.ApiIgnore;
import java.text.SimpleDateFormat;
+import java.util.List;
import java.util.Map;
/**
@@ -96,24 +98,27 @@
@ApiOperation(value = "新增", notes = "传入talk")
public R save(@Valid @RequestBody Talk talk) {
talkService.save(talk);
+ String url = "";
String[] split = talk.getImgurl().split(",");
- for (int i=0;i<split.length;i++){
- String s = split[i].substring(0,split[i].indexOf("/"));
- System.out.println(s);
+ for (int i = 0; i < split.length; i++) {
+ String s = split[i].substring(26, split[i].length());
+ url += FtpConstant.ip + s + ",";
}
-// //数据同步
-// String s1 =
-// "insert into sys_talk(id,title,real_name,talkcontent,talktime,conclusion,evaluate,deptid,imgurl) " +
-// "values(" + "'" + talk.getId() + "'" + "," +
-// "'" + talk.getTitle() + "'" + "," +
-// "'" + talk.getRealName() + "'" + "," +
-// "'" + talk.getTalkcontent() + "'" + "," +
-// "'" + new SimpleDateFormat("yyyy-MM-dd").format(talk.getTalktime()) + "'" + "," +
-// "'" + talk.getConclusion() + "'" + "," +
-// "'" + talk.getEvaluate() + "'" + "," +
-// "'" + talk.getDeptid() + "'" + "," +
-// "'" + talk.getImgurl() + "'" + ")";
-// FtpUtil.sqlFileUpload(s1);
+ String substring = url.substring(0, url.length() - 1);
+ talk.setImgurl(substring);
+ //数据同步
+ String s1 =
+ "insert into sys_talk(id,title,real_name,talkcontent,talktime,conclusion,evaluate,deptid,imgurl) " +
+ "values(" + "'" + talk.getId() + "'" + "," +
+ "'" + talk.getTitle() + "'" + "," +
+ "'" + talk.getRealName() + "'" + "," +
+ "'" + talk.getTalkcontent() + "'" + "," +
+ "'" + new SimpleDateFormat("yyyy-MM-dd").format(talk.getTalktime()) + "'" + "," +
+ "'" + talk.getConclusion() + "'" + "," +
+ "'" + talk.getEvaluate() + "'" + "," +
+ "'" + talk.getDeptid() + "'" + "," +
+ "'" + talk.getImgurl() + "'" + ")";
+ FtpUtil.sqlFileUpload(s1);
return R.success("新增成功");
}
@@ -124,7 +129,26 @@
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入talk")
public R update(@Valid @RequestBody Talk talk) {
- return R.status(talkService.updateById(talk));
+ talkService.updateById(talk);
+ String url = "";
+ String[] split = talk.getImgurl().split(",");
+ for (int i = 0; i < split.length; i++) {
+ String s = split[i].substring(26, split[i].length());
+ url += FtpConstant.ip + s + ",";
+ }
+ String substring = url.substring(0, url.length() - 1);
+ talk.setImgurl(substring);
+ String s1 = "update sys_talk set title = " + "'" + talk.getTitle() + "'" +
+ ",real_name = " + "'" + talk.getRealName() + "'" +
+ ",talkcontent = " + "'" + talk.getTalkcontent() + "'" +
+ ",talktime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(talk.getTalktime()) + "'" +
+ ",conclusion = " + "'" + talk.getConclusion() + "'" +
+ ",evaluate = " + "'" + talk.getEvaluate() + "'" +
+ ",deptid = " + "'" + talk.getDeptid() + "'" +
+ ",imgurl = " + "'" + talk.getImgurl() + "'" +
+ " " + "where id = " + "'" + talk.getId() + "'";
+ FtpUtil.sqlFileUpload(s1);
+ return R.success("修改成功");
}
/**
@@ -145,6 +169,13 @@
@ApiOperationSupport(order = 8)
@ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ //内网删除
+ List<Long> list = Func.toLongList(ids);
+ list.forEach(id -> {
+ //内网同步
+ String s1 = "delete from sys_talk where id = " + "'" + id + "'";
+ FtpUtil.sqlFileUpload(s1);
+ });
return R.status(talkService.removeByIds(Func.toLongList(ids)));
}
--
Gitblit v1.9.3