智慧保安后台管理-外网项目备份
tangzy
2022-02-24 d4b00c05321d9373a33bfb26618735e2a5868a81
src/main/java/org/springblade/modules/dispatcher/controller/DispatcherUnitController.java
@@ -41,6 +41,7 @@
import org.springblade.modules.dispatcher.vo.DispatcherVO;
import org.springblade.modules.exam.excel.ExamScoreExcel;
import org.springblade.modules.exam.excel.ExamScoreImporter;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -66,6 +67,7 @@
   private final IDispatcherUnitService dispatcherUnitService;
   private final IDispatcherService dispatcherService;
   private final MyAsyncService myAsyncService;
   /**
    * 详情
@@ -98,6 +100,7 @@
   /**
    * 自定义树
    *
    * @param dispatcher
    * @return
    */
@@ -133,7 +136,7 @@
         dispatcherUnit.setCreateTime(new Date());
         //新增
         status = dispatcherUnitService.save(dispatcherUnit);
         if (status) {
         //数据同步
         String s1 =
            "insert into sys_dispatcher_unit(id,name,dept_id,linkman,phone,jurisdiction,create_time,start_time,end_time," +
@@ -151,7 +154,9 @@
               "'" + dispatcherUnit.getSecurityLinkman() + "'" + "," +
               "'" + dispatcherUnit.getCell() + "'" + "," +
               "'" +dispatcherUnit.getNum() + "'" + ")";
         FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      }else {
         //修改
         status = dispatcherUnitService.updateById(dispatcherUnit);
@@ -163,6 +168,7 @@
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         String endTime = sdf.format(date);
         dispatcherService.updateEndtime(endTime,ids);
         if (status) {
         //内网同步
         String s1 =
               "update sys_dispatcher_unit set name = " + "'" + dispatcherUnit.getName() + "'" +
@@ -177,11 +183,14 @@
               ",cell = " + "'" + dispatcherUnit.getCell() + "'" +
               ",num = " + "'" + dispatcherUnit.getNum() + "'" +
               " " +"where id = " + "'" + dispatcherUnit.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         //内网同步派遣记录修改合同时间
         String s2 =
            "update sys_dispatcher set end_time = " + "'" + endTime + "'" +" " + "where dispatcher_unit_id = " + "'" + ids + "'";
         FtpUtil.sqlFileUpload(s2);
            //FtpUtil.sqlFileUpload(s2);
            myAsyncService.FTP(s2);
         }
      }
      return R.status(status);
   }
@@ -198,13 +207,15 @@
      list.forEach(id ->{
         //内网同步
         String s1 = "delete from sys_dispatcher_unit where id = " + "'" + id + "'";
         FtpUtil.sqlFileUpload(s1);
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.FTP(s1);
      });
      return R.status(dispatcherUnitService.removeByIds(Func.toLongList(ids)));
   }
   /**
    * 导入派遣单位数据
    *
    * @param isCovered 1 覆盖  0不覆盖
    * @return
    */