洪城义警-正式版后台
zengh
2022-05-26 a5d956b2f7a744941e4aa01e27b8b4cc75f3ebfc
src/main/java/org/springblade/modules/zc/controller/ZcController.java
@@ -22,6 +22,7 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.common.utils.DesensitizedUtil;
import org.springblade.common.vo.DeptVo;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
@@ -171,10 +172,10 @@
   @ApiOperation(value = "新增或修改", notes = "传入zc")
   public R submit(@Valid @RequestBody Zc zc) {
      String type = zc.getType();
      String stype="1";
      String account=zc.getUsername();
      String stype = "1";
      String account = zc.getUsername();
      if (type.equals("1")) {
         iUserService.updateAcc(stype,account);
         iUserService.updateAcc(stype, account);
         zcService.saveOrUpdate(zc);
      } else {
         iUserService.delete(account);
@@ -183,6 +184,16 @@
      return R.success("成功");
   }
   /**
    * 新增或修改
    */
   @PostMapping("/examineList")
   @ApiOperationSupport(order = 6)
   @ApiOperation(value = "新增或修改", notes = "传入zc")
   public R examineList(@Valid @RequestParam String ids,String names) {
      zcService.updateExamine(ids,Func.toStrList(names));
      return R.success("成功");
   }
   /**
    * 删除
@@ -204,11 +215,60 @@
      SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String times = df.format(new Date());
      zc.setZctime(times);
      //保留未脱敏数据
      String names = zc.getSname();
      String cardids = zc.getCardid();
      String phones = zc.getPhone();
      //数据脱敏处理
      String name = DesensitizedUtil.desensitizedName(zc.getSname());
      String cardid = DesensitizedUtil.desensitizedIdNumber(zc.getCardid());
      String phone = DesensitizedUtil.desensitizedPhoneNumber(zc.getPhone());
      //帐号默认姓+身份证后四位
      zc.setUsername(name.substring(0, 1) + zc.getCardid().substring(zc.getCardid().length() - 4));
      Integer userCount = iUserService.selectCount(zc.getUsername());
      if (userCount > 0) {
         throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户 [{}] 已存在!", zc.getUsername()));
      }
      zc.setSname(name);
      zc.setCardid(cardid);
      zc.setPhone(phone);
      zcService.inster(zc);
      System.out.println("插入id++++++++++++"+zc.getId());
      //内网储存完整数据
      String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,parent_id,jurisdiction,cardid,address)" +
         "values(" + "'" + zc.getId() + "'" +
         "," + "'" + zc.getUsername() + "'" +
         "," + "'" + zc.getPassword() + "'" +
         "," + "'" + names + "'" +
         "," + "'" + zc.getSex() + "'" +
         "," + "'" + phones + "'" +
         "," + "'" + zc.getZctime() + "'" +
         "," + "'" + zc.getParentId() + "'" +
         "," + "'" + zc.getJurisdiction() + "'" +
         "," + "'" + cardids + "'" +
         "," + "'" + zc.getAddress() + "'"
         + ");"
         +
         "insert into act_zc(account,password,real_name,sex,phone,workjurisdiction,role_id,jurisdiction,cardid,address)" +
         "values(" +
         "'" + zc.getUsername() + "'" +
         "," + "'" + zc.getPassword() + "'" +
         "," + "'" + names + "'" +
         "," + "'" + zc.getSex() + "'" +
         "," + "'" + phones + "'" +
         "," + "'" + zc.getWorkjurisdiction() + "'" +
         "," + "'" + zc.getParentId() + "'" +
         "," + "'" + zc.getJurisdiction() + "'" +
         "," + "'" + cardids + "'" +
         "," + "'" + zc.getAddress() + "'"
         + ")";
      System.out.println("插入语句++++++++++++"+s);
      //同时新增到用户表
      User user = new User();
      user.setAccount(zc.getUsername());
@@ -216,26 +276,41 @@
      user.setRealName(zc.getSname());
      user.setSex(Integer.valueOf(zc.getSex()));
      user.setPhone(zc.getPhone());
      user.setDeptId(zc.getDeptid());
      //user.setDeptId(zc.getDeptid());
      user.setRoleId(zc.getParentId());
      user.setJurisdiction(zc.getJurisdiction());
      user.setWorkaddress(zc.getWorkaddress());
      user.setWorkjurisdiction(zc.getWorkjurisdiction());
      user.setExamination_type("0");
      user.setExamination_mx("正常");
      user.setFirstlogin("0");
      user.setCardid(zc.getCardid());
      if (!zc.getSignals().equals("")) {
         user.setSignals(zc.getSignals());
      }
      user.setStype("0");
      if (!zc.getAddress().equals("")) {
         user.setAddress(zc.getAddress());
         user.setJurisdiction(zc.getJurisdiction());
      }
      if (!zc.getJobUnit().equals("")) {
         user.setJobUnit(zc.getJobUnit());
      }
      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() + "'" +
         "," + "'" + zc.getPassword() + "'" +
         "," + "'" + zc.getSname() + "'" +
         "," + "'" + zc.getSex() + "'" +
         "," + "'" + zc.getPhone() + "'" +
         "," + "'" + zc.getZctime() + "'" +
         "," + "'" + zc.getDeptid() + "'" +
         "," + "'" + zc.getParentId() + "'" +
         "," + "'" + zc.getJurisdiction() + "'" +
         "," + "'" + zc.getCardid() + "'" + ")";
//      String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,deptid,parent_id,jurisdiction,cardid,address)" +
//         "values(" + "'" + zc.getId() + "'" +
//         "," + "'" + zc.getUsername() + "'" +
//         "," + "'" + zc.getPassword() + "'" +
//         "," + "'" + zc.getSname() + "'" +
//         "," + "'" + zc.getSex() + "'" +
//         "," + "'" + zc.getPhone() + "'" +
//         "," + "'" + zc.getZctime() + "'" +
//         "," + "'" + zc.getDeptid() + "'" +
//         "," + "'" + zc.getParentId() + "'" +
//         "," + "'" + zc.getJurisdiction() + "'" +
//         "," + "'" + zc.getCardid() + "'" +
//         "," + "'" + zc.getAddress() + "'"
//         + ")";
      FtpUtil.sqlFileUpload(s);
      return R.success("新增成功");
   }