智慧保安后台管理-外网项目备份
guoshilong
2024-01-16 6f201b8d3743e246a71f00a9ba98d10b128fae38
src/main/java/org/springblade/modules/dispatcher/controller/DispatcherUnitController.java
@@ -136,27 +136,6 @@
         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,district) " +
                  "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() + "'" + "," +
                  "'" + dispatcherUnit.getDistrict() + "'" + ")";
            myAsyncService.dataSync(s1);
         }
      } else {
         //修改
         status = dispatcherUnitService.updateById(dispatcherUnit);
@@ -167,28 +146,6 @@
         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() + "'" +
                  ",district = " + "'" + dispatcherUnit.getDistrict() + "'" +
                  " " + "where id = " + "'" + dispatcherUnit.getId() + "'";
            myAsyncService.dataSync(s1);
            //内网同步派遣记录修改合同时间
            String s2 =
               "update sys_dispatcher set end_time = " + "'" + endTime + "'" + " " + "where dispatcher_unit_id = " + "'" + ids + "'";
            myAsyncService.dataSync(s2);
         }
      }
      return R.status(status);
   }
@@ -234,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"));
@@ -247,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"));
@@ -260,5 +223,15 @@
      ExcelUtil.export(response, "派遣单位数据导入模板" + DateUtil.time(), "派遣单位数据表", list, DispatcherUnitExcel.class);
   }
   /**
    * 获取所有派遣单位
    * @param dispatcherUnit
    * @return
    */
   @GetMapping("getAll")
   public R getAll(DispatcherUnit dispatcherUnit){
      List<DispatcherUnitVO> list = dispatcherUnitService.getAll(dispatcherUnit);
      return R.data(list);
   }
}