智慧保安后台管理-外网项目备份
liuyg
2022-02-17 f2032d8331cd8939bb8dd4ef372033a2dcdbc850
src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
@@ -130,11 +130,26 @@
         List<ExportSecurityPaperExcel> list = new ArrayList<>();
         //遍历
         accreditationRecordsVos.forEach(accreditationRecordsVo -> {
            //导出即修改为已制证状态
            AccreditationRecords accreditationRecords1 = new AccreditationRecords();
            accreditationRecords1.setId(accreditationRecordsVo.getId());
            accreditationRecords1.setStatus(2);
            //记录导出时间为制证时间
            accreditationRecords1.setPaperTime(new Date());
            //修改
            this.updateById(accreditationRecords1);
            ExportSecurityPaperExcel excel = new ExportSecurityPaperExcel();
            //数据转换封装
            excel.setRealName(accreditationRecordsVo.getRealName());
            excel.setIdCardNo(accreditationRecordsVo.getIdCardNo());
            excel.setDeptName(accreditationRecordsVo.getDeptName());
            if (accreditationRecordsVo.getSex().equals("1")){
               excel.setSex("男");
            }else {
               excel.setSex("女");
            }
            excel.setPaperTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
            //如果头像有
            if (null != accreditationRecordsVo.getAvatar() && accreditationRecordsVo.getAvatar() != "") {
               try {
@@ -188,7 +203,32 @@
   public List<AccreditationRecordsVo> exportSecurityBookPapers(AccreditationRecordsVo accreditationRecords) {
      //查询数据
      List<AccreditationRecordsVo> accreditationRecordsVos = baseMapper.exportSecurityBookPapers(accreditationRecords);
      System.out.println("accreditationRecordsVos = " + accreditationRecordsVos.size());
//      System.out.println("accreditationRecordsVos = " + accreditationRecordsVos.size());
      return accreditationRecordsVos;
   }
   /**
    * 批量修改为已制证
    * @param accreditationRecords 制证记录信息对象
    */
   @Override
   public boolean batchAccreditation(AccreditationRecordsVo accreditationRecords) {
      //读取ids
      List<String> list = Arrays.asList(accreditationRecords.getIds().split(","));
      //遍历
      list.forEach(id->{
         AccreditationRecords records = new AccreditationRecords();
         records.setStatus(2);
         records.setId(Long.parseLong(id));
         //更新
         this.updateById(records);
         //内网同步
         String s =
            "update sys_accreditation_records set status = " + accreditationRecords.getStatus() + "" +
               "where id = " + "'" + accreditationRecords.getId() + "'";
         FtpUtil.sqlFileUpload(s);
      });
      return true;
   }
}