From 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 14:36:07 +0800
Subject: [PATCH] 模拟考试修改
---
src/main/java/org/springblade/modules/talk/controller/TalkController.java | 100 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 71 insertions(+), 29 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 90a9890..334d461 100644
--- a/src/main/java/org/springblade/modules/talk/controller/TalkController.java
+++ b/src/main/java/org/springblade/modules/talk/controller/TalkController.java
@@ -24,13 +24,17 @@
import javax.validation.Valid;
-import org.springblade.common.constant.FtpConstant;
+import org.springblade.common.config.FtpConfig;
+import org.springblade.common.utils.DesensitizedUtil;
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.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.information.entity.Information;
+import org.springblade.modules.recordLegalperson.entity.RecordLegalperson;
+import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.talk.entity.Talk;
@@ -42,6 +46,7 @@
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
/**
* 控制器
@@ -56,6 +61,7 @@
public class TalkController extends BladeController {
private final ITalkService talkService;
+ private final MyAsyncService myAsyncService;
/**
* 详情
@@ -97,28 +103,46 @@
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入talk")
public R save(@Valid @RequestBody Talk talk) {
- talkService.save(talk);
+ //脱敏处理
+ Talk talk1 = Objects.requireNonNull(BeanUtil.copy(talk, Talk.class));
+ talk1.setTitle("***");
+ talk1.setRealName(DesensitizedUtil.desensitizedName(talk1.getRealName()));
+ if(null!= talk1.getTalkcontent() && !talk1.getTalkcontent().equals("")){
+ talk1.setTalkcontent("***");
+ }
+ if(null!= talk1.getEvaluate() && !talk1.getEvaluate().equals("")){
+ talk1.setEvaluate("***");
+ }
+ if(null!= talk1.getConclusion() && !talk1.getConclusion().equals("")){
+ talk1.setConclusion("***");
+ }
+ talk1.setImgurl(null);
+
+ boolean save = talkService.save(talk1);
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 + ",";
+ url += FtpConfig.ip + s + ",";
}
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);
+ if (save) {
+ //数据同步
+ String s1 =
+ "insert into sys_talk(id,title,real_name,talkcontent,talktime,conclusion,evaluate,deptid,imgurl) " +
+ "values(" + "'" + talk1.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);
+ myAsyncService.FTP(s1);
+ }
return R.success("新增成功");
}
@@ -129,25 +153,43 @@
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入talk")
public R update(@Valid @RequestBody Talk talk) {
- talkService.updateById(talk);
+ //脱敏处理
+ Talk talk1 = Objects.requireNonNull(BeanUtil.copy(talk, Talk.class));
+ talk1.setTitle("***");
+ talk1.setRealName(DesensitizedUtil.desensitizedName(talk1.getRealName()));
+ if(null!= talk1.getTalkcontent() && !talk1.getTalkcontent().equals("")){
+ talk1.setTalkcontent("***");
+ }
+ if(null!= talk1.getEvaluate() && !talk1.getEvaluate().equals("")){
+ talk1.setEvaluate("***");
+ }
+ if(null!= talk1.getConclusion() && !talk1.getConclusion().equals("")){
+ talk1.setConclusion("***");
+ }
+ talk1.setImgurl(null);
+
+ boolean b = talkService.updateById(talk1);
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 + ",";
+ url += FtpConfig.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);
+ if (b) {
+ 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);
+ myAsyncService.FTP(s1);
+ }
return R.success("修改成功");
}
@@ -174,7 +216,7 @@
list.forEach(id -> {
//内网同步
String s1 = "delete from sys_talk where id = " + "'" + id + "'";
- FtpUtil.sqlFileUpload(s1);
+ myAsyncService.FTP(s1);
});
return R.status(talkService.removeByIds(Func.toLongList(ids)));
}
--
Gitblit v1.9.3