fei
1 天以前 e899d2709f21b322232fb64778fef296233be3f0
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -11,17 +11,17 @@
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.Archiverecordstouser;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.mapper.DocumentMaterialsMapper;
import com.ruoyi.service.IArchiveCategoryService;
import com.ruoyi.service.IDocumentMaterialsService;
import com.ruoyi.util.ErrorcodeExceptionextends;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
@Service
public class DocumentMaterialsServiceImpl  extends ServiceImpl<DocumentMaterialsMapper, DocumentMaterials> implements IDocumentMaterialsService {
    private LambdaQueryWrapper<DocumentMaterials> buildCondition(DocumentMaterials documentMaterials){
@@ -50,7 +50,8 @@
//                .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
//        lqw.orderByDesc(ZfProperty::getCreateTime);
        // lqw.orderByDesc(ArchiveRecords::isOwnData)
        lqw.orderByDesc(DocumentMaterials::getCreatedAt);
        lqw.orderByAsc(DocumentMaterials::getPageNumber);
        System.out.println("ssssssssssssddd0000000000000000");
        return lqw;
@@ -65,7 +66,7 @@
        List<DocumentMaterials> beanRecords = pageResult.getRecords();//得到查询出来的数据
        System.out.println(beanRecords);
//        beanRecords.forEach(record -> {
//            if (record.getUserId() != null) {
//                SysUser user = userMapper.selectUserById(record.getUserId());
@@ -99,7 +100,6 @@
    public List<DocumentMaterials> selectDocumentMaterialsList(DocumentMaterials documentMaterials) {
        LambdaQueryWrapper<DocumentMaterials> lambdaQueryWrapper = buildCondition(documentMaterials);
        List<DocumentMaterials> beanRecords = list(lambdaQueryWrapper);
        return beanRecords;
    }
@@ -109,7 +109,20 @@
        Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
        documentMaterials.setCreatedAt(date);
        boolean res = this.save(documentMaterials);
        System.out.println(documentMaterials.getFileStyle());
        System.out.println(documentMaterials.getPageNumber());
//        if(documentMaterials.getPageNumber()==null)
//        {
//            documentMaterials.setPageNumber(-1L);
//        }
        boolean res = false;
        try {
             res = this.save(documentMaterials);
        } catch (Exception e) {
            System.out.println(e);
            throw new ErrorcodeExceptionextends(500, "同一个案卷内,不允许页码重复!");
        }
        if(res)
            return 1;
        else
@@ -139,4 +152,35 @@
    public int deleteDocumentMaterialsByMaterialId(String materialId) {
        return 0;
    }
    @Override
    public Long getFiNum(Long pageNumber) {
        return this.baseMapper.getFileNumber(pageNumber);
    }
    @Override
    public int updateByPageNumber(Long pageNumber, Long fileNumber, int width, int height, double fileSize, String url, String format) {
        //根据pageNumber拿到title,然后计算pageOrder
        LambdaQueryWrapper<DocumentMaterials> lqw = new LambdaQueryWrapper<>();
        lqw.eq(pageNumber!=null, DocumentMaterials::getPageNumber, pageNumber);
        List<DocumentMaterials> records = list(lqw);
        Long pageOrder = 1L;
        if(pageNumber.equals(1))
            pageOrder = 1L;
        else {
            Long maxPOrder = this.baseMapper.getMaxPageOrder(records.get(0).getTitle(), pageNumber, records.get(0).getStage());
            if (maxPOrder != null)
                pageOrder = maxPOrder + 1;
        }
        this.baseMapper.updateInfoByPageNumber(pageNumber, fileNumber,pageOrder, width, height, fileSize, url,format);
        return 0;
    }
    @Override
    public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
        return this.baseMapper.getArchiveMatInfo(recordId);
    }
}