智慧保安后台管理-外网-验收版本
zengh
2021-12-04 18f0b4fc281b608acf0e27263c0ffbd8384a5993
src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java
@@ -96,6 +96,17 @@
   }
   /**
    * APP-从业单位查询(派遣单位)
    */
   @GetMapping("/queryDispatcher")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入dispatcher")
   public R<IPage<DispatcherVO>> queryDispatcher(DispatcherVO dispatcher, Query query) {
      IPage<DispatcherVO> pages = dispatcherService.queryDispatcher(Condition.getPage(query), dispatcher);
      return R.data(pages);
   }
   /**
    * 新增
    */
   @PostMapping("/save")
@@ -130,10 +141,21 @@
      dispatcher.setStatus(1);
      Boolean status = dispatcherService.updateById(dispatcher);
      //用户状态改变
      //查询当前用户的派遣记录,是否存在多条未结束派遣的
      Dispatcher dispatcher1 = new Dispatcher();
      dispatcher1.setUserIds(dispatcher.getUserIds());
      List<Dispatcher> dispatcherList = dispatcherService.list(Condition.getQueryWrapper(dispatcher1));
      User user = new User();
      if (dispatcherList.size()<1){
         //用户状态改变
         user.setDispatch("1");
      }else {
         //用户状态改变
         user.setDispatch("0");
      }
      user.setId(Long.parseLong(dispatcher.getUserIds()));
      user.setDispatch("1");
      userService.updateById(user);
      //内网同步
      String s1 =
@@ -192,9 +214,20 @@
            Dispatcher dispatcher1 = dispatcherService.getById(dispatcher.getId());
            if (!dispatcher1.getUserIds().equals(dispatcher.getUserIds())){
               //修改原保安人员的派遣状态
               //查询原保安人员的派遣记录,是否存在多条未结束派遣的
               Dispatcher dispatcher2 = new Dispatcher();
               dispatcher2.setUserIds(dispatcher1.getUserIds());
               dispatcher2.setStatus(0);
               List<Dispatcher> dispatcherList = dispatcherService.list(Condition.getQueryWrapper(dispatcher2));
               User user = new User();
               user.setId(Long.parseLong(dispatcher1.getUserIds()));
               user.setDispatch("1");
               if (dispatcherList.size()<1){
                  //用户状态改变
                  user.setDispatch("1");
               }else {
                  user.setDispatch("0");
               }
               //修改原保安人员用户信息
               userService.updateById(user);
               //修改当前保安人员的派遣状态
@@ -209,7 +242,7 @@
               //内网同步
               String s1 =
                  "update blade_user set dispatch = " + "'" + user.getDispatch() + "'" +
                     " " +"where id = " + "'" + user.getId() + "';"+
                     " " +"where id = " + "'" + user.getId() + "';" +
                  "update sys_dispatcher set dispatcherTime = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(dispatcher.getDispatchertime()) + "'" +
                     ",dispatcher_unit_id = " + "'" + dispatcher.getDispatcherUnitId() + "'" +
                     ",user_ids = " + "'" + dispatcher.getUserIds() + "'" +