智慧保安后台管理-外网项目备份
src/main/java/org/springblade/modules/directive/controller/DirectiveController.java
@@ -15,6 +15,7 @@
import org.springblade.modules.directive.entity.DirectiveFile;
import org.springblade.modules.directive.service.DirectiveService;
import org.springblade.modules.directive.vo.DirectiveVo;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
@@ -31,6 +32,7 @@
public class DirectiveController {
   private final DirectiveService directiveService;
   private final MyAsyncService myAsyncService;
   /**
    * 自定义分页
@@ -67,16 +69,19 @@
      boolean status = false;
      directive.setSendTime(new Date());
      status = directiveService.save(directive);
      //数据同步
      String s1 =
         "insert into sys_directive(id,type,send_directive_id,receive_directive_ids,send_time,content) " +
            "values(" + "'" + directive.getId() + "'" + "," +
            "'" + directive.getType() + "'" + "," +
            "'" + directive.getSendDirectiveId() + "'" + "," +
            "'" + directive.getReceiveDirectiveIds() + "'" + "," +
            "'" + directive.getSendTime() + "'" + "," +
            "'" + directive.getContent() + "'" + ")";
      FtpUtil.sqlFileUpload(s1);
      if (status){
         //数据同步
         String s1 =
            "insert into sys_directive(id,type,send_directive_id,receive_directive_ids,send_time,content) " +
               "values(" + "'" + directive.getId() + "'" + "," +
               "'" + directive.getType() + "'" + "," +
               "'" + directive.getSendDirectiveId() + "'" + "," +
               "'" + directive.getReceiveDirectiveIds() + "'" + "," +
               "'" + directive.getSendTime() + "'" + "," +
               "'" + directive.getContent() + "'" + ")";
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.dataSync(s1);
      }
      if (status) {
         //新增图片
         if (null != directive.getUrl() && directive.getUrl() != "") {
@@ -96,7 +101,8 @@
                     "'" + directiveFile.getType() + "'" + "," +
                     "'" + directiveFile.getDirectiveId() + "'" + "," +
                     "'" + urls+ "'"+ ")";
               FtpUtil.sqlFileUpload(s2);
               //FtpUtil.sqlFileUpload(s2);
               myAsyncService.dataSync(s2);
               if (!status) {
                  return R.status(false);
               }
@@ -118,14 +124,17 @@
   public R updateDirectiveAndFile(@RequestBody DirectiveVo directive) throws Exception {
      //新增指令信息
      boolean update = directiveService.updateById(directive);
      //内网同步
      String s1 = "update sys_directive set type = " + "'" + directive.getType() + "'" +
         ",send_directive_id = " + "'" + directive.getSendDirectiveId() + "'" +
         ",receive_directive_ids = " + "'" + directive.getReceiveDirectiveIds() + "'" +
         ",send_time = " + "'" + directive.getSendTime() + "'" +
         ",content = " + "'" + directive.getContent() + "'" +
         " " + "where id = " + "'" + directive.getId() + "'";
      FtpUtil.sqlFileUpload(s1);
      if (update) {
         //内网同步
         String s1 = "update sys_directive set type = " + "'" + directive.getType() + "'" +
            ",send_directive_id = " + "'" + directive.getSendDirectiveId() + "'" +
            ",receive_directive_ids = " + "'" + directive.getReceiveDirectiveIds() + "'" +
            ",send_time = " + "'" + directive.getSendTime() + "'" +
            ",content = " + "'" + directive.getContent() + "'" +
            " " + "where id = " + "'" + directive.getId() + "'";
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.dataSync(s1);
      }
      boolean status = false;
      if (update) {
         //先删除图片
@@ -147,7 +156,8 @@
                     "'" + directiveFile.getType() + "'" + "," +
                     "'" + directiveFile.getDirectiveId() + "'" + "," +
                     "'" + urls + "'"+ ")";
               FtpUtil.sqlFileUpload(s2);
               //FtpUtil.sqlFileUpload(s2);
               myAsyncService.dataSync(s2);
               if (!status) {
                  R.status(false);
               }