智慧保安后台管理-外网项目备份
tangzy
2022-02-24 d4b00c05321d9373a33bfb26618735e2a5868a81
src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java
@@ -21,6 +21,7 @@
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
@@ -34,6 +35,7 @@
import org.springblade.modules.dispatcher.service.IDispatcherUnitService;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.system.service.MyAsyncService;
import org.springblade.modules.system.vo.UserVO;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -66,6 +68,7 @@
   private final IDispatcherUnitService dispatcherUnitService;
   private final IUserService userService;
   private final MyAsyncService myAsyncService;
   /**
    * 详情
@@ -128,6 +131,7 @@
   /**
    * 结束派遣
    *
    * @param dispatcher
    */
   @PostMapping("/over-dispatcher")
@@ -153,7 +157,6 @@
      userService.updateById(user);
      //内网同步
      String s1 =
         "update sys_dispatcher set status = " + "'" + dispatcher.getStatus() + "'" +
@@ -161,7 +164,8 @@
            " " +"where id = " + "'" + dispatcher.getId() + "';"+
            "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
            " " +"where id = " + "'" + user.getId() + "'";
      FtpUtil.sqlFileUpload(s1);
      //FtpUtil.sqlFileUpload(s1);
      myAsyncService.FTP(s1);
      return R.status(status);
   }
@@ -185,7 +189,7 @@
         //新增派遣记录
         status = dispatcherService.save(dispatcher);
         if (status) {
         //数据同步
         String s1 =
            "insert into sys_dispatcher(id,dispatcherTime,dispatcherAddress,dispatcher_unit_id,user_ids,end_time,dept_id,jurisdiction,create_time,status) " +
@@ -201,7 +205,9 @@
               "'" + dispatcher.getStatus() + "'" + ");" +
               "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
               " " + "where id = " + "'" + user.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      } else {
         dispatcher.setUpdateTime(new Date());
         //查询当前派遣记录
@@ -232,7 +238,7 @@
            //修改
            status = dispatcherService.updateById(dispatcher);
            if (status) {
            //内网同步
            String s1 =
               "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
@@ -248,12 +254,14 @@
                  " " + "where id = " + "'" + dispatcher.getId() + "';" +
               "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" +
                  " " + "where id = " + "'" + user1.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.FTP(s1);
            }
         }else {
            //没有修改保安员,只修改了派遣时间等信息
            //修改
            status = dispatcherService.updateById(dispatcher);
            if (status) {
            //内网同步
            String s1 =
               "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" +
@@ -265,12 +273,13 @@
                  ",dept_id = " + "'" + dispatcher.getDeptId() + "'" +
                  ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" +
                  " " + "where id = " + "'" + dispatcher.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.FTP(s1);
            }
         }
      }
      return R.status(status);
   }
   /**
@@ -327,7 +336,8 @@
                           "'" + dispatcher.getStatus() + "'" + ");" +
                           "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
                           " " + "where id = " + "'" + user.getId() + "'";
                     FtpUtil.sqlFileUpload(s1);
                     //FtpUtil.sqlFileUpload(s1);
                     myAsyncService.FTP(s1);
                  }
               }else {
                  User user = new User();
@@ -352,7 +362,8 @@
                        "'" + dispatcher.getStatus() + "'" + ");" +
                     "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
                        " " + "where id = " + "'" + user.getId() + "'";
                  FtpUtil.sqlFileUpload(s1);
                  //FtpUtil.sqlFileUpload(s1);
                  myAsyncService.FTP(s1);
               }
            }else {
               User user = new User();
@@ -377,7 +388,8 @@
                     "'" + dispatcher.getStatus() + "'" + ");" +
                  "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
                     " " + "where id = " + "'" + user.getId() + "'";
               FtpUtil.sqlFileUpload(s1);
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.FTP(s1);
            }
         });
@@ -453,7 +465,8 @@
                        " " + "where id = " + "'" + dispatcher.getId() + "';" +
                     "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" +
                        " " + "where id = " + "'" + user1.getId() + "'";
                  FtpUtil.sqlFileUpload(s1);
                  //FtpUtil.sqlFileUpload(s1);
                  myAsyncService.FTP(s1);
               }
            }else {
               //修改原保安人员的派遣状态
@@ -497,7 +510,8 @@
                     " " + "where id = " + "'" + dispatcher.getId() + "';" +
                     "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" +
                     " " + "where id = " + "'" + user1.getId() + "'";
               FtpUtil.sqlFileUpload(s1);
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.FTP(s1);
            }
         }else {
            //修改原保安人员的派遣状态
@@ -541,7 +555,8 @@
                  " " + "where id = " + "'" + dispatcher.getId() + "';" +
                  "update blade_user set dispatch = " + "'" + user1.getDispatch() + "'" +
                  " " + "where id = " + "'" + user1.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      }else {
         if (null!=dispatcherUnit.getDistrict() && !dispatcherUnit.getDistrict().equals("") && !dispatcherUnit.getDistrict().equals(-1)) {
@@ -569,7 +584,8 @@
                        ",dept_id = " + "'" + dispatcher.getDeptId() + "'" +
                        ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" +
                        " " + "where id = " + "'" + dispatcher.getId() + "'";
                  FtpUtil.sqlFileUpload(s1);
                  //FtpUtil.sqlFileUpload(s1);
                  myAsyncService.FTP(s1);
               }
            }else {
               //没有修改保安员,只修改了派遣时间等信息
@@ -587,7 +603,8 @@
                     ",dept_id = " + "'" + dispatcher.getDeptId() + "'" +
                     ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" +
                     " " + "where id = " + "'" + dispatcher.getId() + "'";
               FtpUtil.sqlFileUpload(s1);
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.FTP(s1);
            }
         }else {
            //没有修改保安员,只修改了派遣时间等信息
@@ -605,7 +622,8 @@
                  ",dept_id = " + "'" + dispatcher.getDeptId() + "'" +
                  ",jurisdiction = " + "'" + dispatcher.getJurisdiction() + "'" +
                  " " + "where id = " + "'" + dispatcher.getId() + "'";
            FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      }
      return R.status(status);
@@ -624,7 +642,8 @@
      list.forEach(id ->{
         //内网同步
         String s1 = "delete from sys_dispatcher where id = " + "'" + id + "'";
         FtpUtil.sqlFileUpload(s1);
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.FTP(s1);
      });
      return R.status(dispatcherService.removeByIds(Func.toLongList(ids)));
   }