fei
12 小时以前 bcb1d905904fd43034f7c95077336e5cb849eff1
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -384,7 +384,13 @@
        }
        assert dataList != null;
      //  System.out.println("++++++++++++++++++++000000");
//        System.out.println(dataList.size());
//                for (ArchiveRecords archiveRecords : dataList) {
//                    System.out.println(dataList.size());
//
//                }
        for (ArchiveRecords archiveRecords : dataList) {
           // physcialService.mySave(physcial);
            archiveRecords.setRecordStatus("未录入");
@@ -430,8 +436,13 @@
        LocalDateTime time = LocalDateTime.now();
        Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
        for(Long id : ids)
            this.baseMapper.updateStatusById("录入完成",id, date);
        for(Long id : ids) {
            // 获取当前用户ID,收回授权
            Long userId = SecurityUtils.getUserId();
            archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
            this.baseMapper.updateStatusById("录入完成", id, date);
        }
        return 0;
    }
@@ -448,21 +459,30 @@
    @Override
    public AjaxResult mySave(ArchiveRecords archiveRecords) {
        // 检查是否有重复数据插入
        System.out.println(archiveRecords.getRecordId()+"aaaaaaaaaaaaaaaaa");
        if(archiveRecords.getRecordId()==null||StringUtils.isEmpty(archiveRecords.getRecordId()))
            throw new RuntimeException("档案号不能为空!");
        LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>();
        lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId());
        List<ArchiveRecords> list = list(lqw);
        if (!list.isEmpty()) {
          //  throw new RuntimeException("请勿新增重复数据");
            //如果有重复数据,则根据recordId进行数据修改
        Long userid = SecurityUtils.getUserId();
        if (!list.isEmpty()&&userid!=1) {
           // throw new RuntimeException("请勿新增重复数据");
            //如果有重复数据,则根据recordId进行数据修改sele
         //   if()
//
                this.baseMapper.update(archiveRecords, lqw);
                return AjaxResult.success();
        }
        else if(!list.isEmpty())
        {
             throw new RuntimeException("请勿新增重复数据");
        }
        else {
        Long userid = SecurityUtils.getUserId();
        if(userid==1) {
            if (save(archiveRecords)) {
                return AjaxResult.success();
@@ -470,8 +490,8 @@
                return AjaxResult.error();
            }
        }
             else
            return AjaxResult.error("档案号不存在!");
       else
            return AjaxResult.error("不是管理员,不能新增记录!");
        }
    }