fei
17 小时以前 29ec9c2a3fd1c1e0b1695edb6275dad765137e69
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -196,11 +196,21 @@
        Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
        archiveRecords.setCreateTime(date);
        System.out.println(archiveRecords.getRecordId());
        //根据档号查询,是否已经有档号,有的话,就不让插入
        LambdaQueryWrapper<ArchiveRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,
                archiveRecords.getRecordId());
        List<ArchiveRecords> lis = list(lambdaQueryWrapper);
        if(!lis.isEmpty())
        {
            return 0;
        }
        archiveRecords.setRecordStatus("未录入");
      //  archiveRecords
        boolean res = this.save(archiveRecords);
        //0表示失败,1表示成功
        if(res)
            return 1;
        else
@@ -272,6 +282,11 @@
        for (ArchiveRecords archiveRecords : dataList) {
           // physcialService.mySave(physcial);
            archiveRecords.setRecordStatus("未录入");
            LocalDateTime time = LocalDateTime.now();
            Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
            archiveRecords.setCreateTime(date);
            this.mySave(archiveRecords);
        }
@@ -284,8 +299,15 @@
    }
    @Override
    public int updateArchiveById(Long id) {
        this.baseMapper.updateStatusById(id);
    public int updateArchiveById(String status, Long id) {
        this.baseMapper.updateStatusById(status, id);
        return 0;
    }
    @Override
    public int updateStatusByIds(Long[] ids) {
        for(Long id : ids)
            this.baseMapper.updateStatusById("录入完成",id);
        return 0;
    }
@@ -309,16 +331,25 @@
        if (list.size() > 0) {
          //  throw new RuntimeException("请勿新增重复数据");
            //如果有重复数据,则根据recordId进行数据修改
            this.baseMapper.update(archiveRecords, lqw);
            return AjaxResult.success();
         //   if()
                this.baseMapper.update(archiveRecords, lqw);
                return AjaxResult.success();
        }
        else {
        Long userid = SecurityUtils.getUserId();
        if(userid==1) {
            if (save(archiveRecords)) {
                return AjaxResult.success();
            } else {
                return AjaxResult.error();
            }
        }
             else
            return AjaxResult.error("档案号不存在!");
        }
    }
}