洪城义警-正式版后台
tangzy
2022-02-21 4ad0633f5ad8ec34dcb4b0a652d35868b8e9a2ad
src/main/java/org/springblade/modules/zc/controller/ZcController.java
@@ -171,22 +171,12 @@
   @ApiOperation(value = "新增或修改", notes = "传入zc")
   public R submit(@Valid @RequestBody Zc zc) {
      String type = zc.getType();
      String stype="1";
      String account=zc.getUsername();
      if (type.equals("1")) {
         User user = new User();
         user.setAccount(zc.getUsername());
         user.setPassword(DigestUtil.encrypt(zc.getPassword()));
         user.setRealName(zc.getSname());
         user.setSex(Integer.valueOf(zc.getSex()));
         user.setPhone(zc.getPhone());
         user.setDeptId(zc.getDeptid());
         user.setRoleId(zc.getParentId());
         user.setJurisdiction(zc.getJurisdiction());
         user.setExamination_type("0");
         user.setExamination_mx("正常");
         user.setCardid(zc.getCardid());
         iUserService.saveOrUpdate(user);
         iUserService.updateAcc(stype,account);
      } else {
         iUserService.delete(account);
      }
      return R.status(zcService.saveOrUpdate(zc));
   }
@@ -217,6 +207,21 @@
         throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户 [{}] 已存在!", zc.getUsername()));
      }
      zcService.inster(zc);
      //同时新增到用户表
      User user = new User();
      user.setAccount(zc.getUsername());
      user.setPassword(DigestUtil.encrypt(zc.getPassword()));
      user.setRealName(zc.getSname());
      user.setSex(Integer.valueOf(zc.getSex()));
      user.setPhone(zc.getPhone());
      user.setDeptId(zc.getDeptid());
      user.setRoleId(zc.getParentId());
      user.setJurisdiction(zc.getJurisdiction());
      user.setExamination_type("0");
      user.setExamination_mx("正常");
      user.setCardid(zc.getCardid());
      user.setStype("0");
      iUserService.saveOrUpdate(user);
      String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,deptid,parent_id,jurisdiction,cardid)" +
         "values(" + "'" + zc.getId() + "'" +
         "," + "'" + zc.getUsername() + "'" +
@@ -235,6 +240,7 @@
   /**
    * 用户验证
    *
    * @param username
    * @return
    */
@@ -244,7 +250,7 @@
      if (userCount > 0) {
         throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户{}已存在!", username));
      }
      return R.success("当前用户已存在!");
      return R.success("当前用户不存在!");
   }
}