智慧保安后台管理-外网项目备份
钟日健
2026-06-01 62eb499b0c969f246d3245d1429a97da4de1ce28
src/main/java/org/springblade/modules/dispatcher/controller/DispatcherUnitController.java
@@ -136,61 +136,16 @@
         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," +
                  "serve_type,security_linkman,cell,num) " +
                  "values(" + "'" + dispatcherUnit.getId() + "'" + "," +
                  "'" + dispatcherUnit.getName() + "'" + "," +
                  "'" + dispatcherUnit.getDeptId() + "'" + "," +
                  "'" + dispatcherUnit.getLinkman() + "'" + "," +
                  "'" + dispatcherUnit.getPhone() + "'" + "," +
                  "'" + dispatcherUnit.getJurisdiction() + "'" + "," +
                  "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dispatcherUnit.getCreateTime()) + "'" + "," +
                  "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getStartTime()) + "'" + "," +
                  "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getEndTime()) + "'" + "," +
                  "'" + dispatcherUnit.getServeType() + "'" + "," +
                  "'" + dispatcherUnit.getSecurityLinkman() + "'" + "," +
                  "'" + dispatcherUnit.getCell() + "'" + "," +
                  "'" + dispatcherUnit.getNum() + "'" + ")";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      } else {
         //修改
         status = dispatcherUnitService.updateById(dispatcherUnit);
         //派遣记录修改合同时间
         Long id = dispatcherUnit.getId();
         String ids = String.valueOf(id);
         Date date = dispatcherUnit.getEndTime();
         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() + "'" +
                  ",dept_id = " + "'" + dispatcherUnit.getDeptId() + "'" +
                  ",linkman = " + "'" + dispatcherUnit.getLinkman() + "'" +
                  ",phone = " + "'" + dispatcherUnit.getPhone() + "'" +
                  ",jurisdiction = " + "'" + dispatcherUnit.getJurisdiction() + "'" +
                  ",start_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getStartTime()) + "'" +
                  ",end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcherUnit.getEndTime()) + "'" +
                  ",serve_type = " + "'" + dispatcherUnit.getServeType() + "'" +
                  ",security_linkman = " + "'" + dispatcherUnit.getSecurityLinkman() + "'" +
                  ",cell = " + "'" + dispatcherUnit.getCell() + "'" +
                  ",num = " + "'" + dispatcherUnit.getNum() + "'" +
                  " " + "where id = " + "'" + dispatcherUnit.getId() + "'";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
            //内网同步派遣记录修改合同时间
            String s2 =
               "update sys_dispatcher set end_time = " + "'" + endTime + "'" + " " + "where dispatcher_unit_id = " + "'" + ids + "'";
            //FtpUtil.sqlFileUpload(s2);
            myAsyncService.FTP(s2);
         }
      }
      return R.status(status);
   }
@@ -208,7 +163,7 @@
         //内网同步
         String s1 = "delete from sys_dispatcher_unit where id = " + "'" + id + "'";
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.FTP(s1);
         myAsyncService.dataSync(s1);
      });
      return R.status(dispatcherUnitService.removeByIds(Func.toLongList(ids)));
   }
@@ -236,6 +191,9 @@
      DispatcherUnitExcel unitExcel = new DispatcherUnitExcel();
      unitExcel.setDeptName("****保安服务公司");
      unitExcel.setName("****公司");
      unitExcel.setAddress("*********");
      unitExcel.setLongitude("112.85857823133");
      unitExcel.setLatitude("35.496284586473");
      unitExcel.setLinkman("张三");
      unitExcel.setPhone("13112341234");
      unitExcel.setStartTime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/5/1"));
@@ -249,6 +207,9 @@
      DispatcherUnitExcel unitExcel1 = new DispatcherUnitExcel();
      unitExcel1.setDeptName("****保安服务公司");
      unitExcel1.setName("****公司");
      unitExcel1.setAddress("*********");
      unitExcel1.setLongitude("112.85857823133");
      unitExcel1.setLatitude("35.496284586473");
      unitExcel1.setLinkman("李四");
      unitExcel1.setPhone("13112341234");
      unitExcel1.setStartTime(new SimpleDateFormat("yyyy/MM/dd").parse("2020/10/10"));
@@ -262,5 +223,15 @@
      ExcelUtil.export(response, "派遣单位数据导入模板" + DateUtil.time(), "派遣单位数据表", list, DispatcherUnitExcel.class);
   }
   /**
    * 获取所有派遣单位
    * @param dispatcherUnit
    * @return
    */
   @GetMapping("getAll")
   public R getAll(DispatcherUnitVO dispatcherUnit){
      List<DispatcherUnitVO> list = dispatcherUnitService.getAll(dispatcherUnit);
      return R.data(list);
   }
}