|
@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -33,18 +34,13 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.archive.dto.SaveApplyDTO;
|
|
|
import org.springblade.archive.entity.ArchiveProjectConfig;
|
|
|
import org.springblade.archive.entity.ArchivesAuto;
|
|
|
-import org.springblade.archive.service.IArchiveAutoPdfService;
|
|
|
-import org.springblade.archive.service.IArchiveOfflineVersionInfoService;
|
|
|
-import org.springblade.archive.service.IArchiveProjectConfigService;
|
|
|
+import org.springblade.archive.entity.ExpertInspection;
|
|
|
+import org.springblade.archive.service.*;
|
|
|
import org.springblade.archive.utils.ArchiveTreeUtil;
|
|
|
import org.springblade.archive.utils.FileTransJavaDemo;
|
|
|
import org.springblade.archive.utils.FileUtils;
|
|
|
-import org.springblade.archive.vo.ArchiveInspectPreviewVO;
|
|
|
-import org.springblade.archive.vo.ArchivesAutoVO;
|
|
|
+import org.springblade.archive.vo.*;
|
|
|
import org.springblade.archive.mapper.ArchivesAutoMapper;
|
|
|
-import org.springblade.archive.service.IArchivesAutoService;
|
|
|
-import org.springblade.archive.vo.ArchivesAutoVO2;
|
|
|
-import org.springblade.archive.vo.CheckoutVO;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
|
import org.springblade.business.entity.Task;
|
|
|
import org.springblade.business.entity.TaskParallel;
|
|
@@ -96,6 +92,7 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
@@ -138,6 +135,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
private final TaskClient taskClient;
|
|
|
|
|
|
+ private final IExpertInspectionService inspectionService;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -2630,7 +2629,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
task.setContractId(contractInfos.get(0).getId()+"");
|
|
|
task.setStartTime(dto.getStartDate().toString());
|
|
|
task.setReportUser(AuthUtil.getUserId().toString());
|
|
|
- task.setReportUserName(AuthUtil.getUserName());
|
|
|
+ task.setReportUserName(AuthUtil.getNickName());
|
|
|
task.setTaskName(dto.getTaskName());
|
|
|
task.setTaskContent(dto.getTaskContent());
|
|
|
//数据指向设置为专家信息
|
|
@@ -2694,6 +2693,324 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 在线验收-查询节点已经上报的档案,id为节点id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<ArchiveInspectVO> getNodeArchives(Query query,Long nodeId,Long projectId,Integer searchType,String searchValue,Integer type) {
|
|
|
+ IPage<ArchiveInspectVO> page = new Page<>(query.getCurrent(),query.getSize());
|
|
|
+ if (type == 1){
|
|
|
+ return baseMapper.getNodeArchives(page,nodeId,projectId,searchType,searchValue,null);
|
|
|
+ }else {
|
|
|
+ return baseMapper.getNodeArchives(page,nodeId,projectId,searchType,searchValue,AuthUtil.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-抽检统计
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, String> userInspectStats(Long projectId) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ //获取用户归属档案总数
|
|
|
+ Integer t1 = baseMapper.getUserArchiveTotal(projectId, userId);
|
|
|
+ if (t1 == 0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ map.put("total",t1+"");
|
|
|
+ //获取用户归属档案所有已阅总数
|
|
|
+ Integer t2 = baseMapper.getUserReviewedTotal(projectId, userId);
|
|
|
+ if (t2 > t1){
|
|
|
+ throw new ServiceException("数据错误,已阅比总数多");
|
|
|
+ }
|
|
|
+ map.put("reviewed",t2+"");
|
|
|
+ if (t2 == 0){
|
|
|
+ map.put("ratio","0%");
|
|
|
+ }else {
|
|
|
+ map.put("ratio", new BigDecimal(t2).divide(new BigDecimal(t1), 3, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(1) + "%");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-修改抽检状态
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void updateInspectStatus(Long archiveId,Long projectId) {
|
|
|
+ //查看当前档案是否存在有意见的数据,存在则什么都不修改,不存在则修改已抽检,合格
|
|
|
+ long count2 = inspectionService.count(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getIsPass, 0)
|
|
|
+ .eq(ExpertInspection::getArchiveId, archiveId));
|
|
|
+ //修改档案抽检状态
|
|
|
+ if (count2 == 0) {
|
|
|
+ this.update(new LambdaUpdateWrapper<ArchivesAuto>()
|
|
|
+ .set(ArchivesAuto::getIsInspect, 1)
|
|
|
+ .set(ArchivesAuto::getUpdateStatus,2)
|
|
|
+ .eq(ArchivesAuto::getId, archiveId));
|
|
|
+ }
|
|
|
+ //查看当前专家在意见表中是否对当前案卷有数据,如果存在数据则证明抽检过,直接跳过
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ long count = inspectionService.count(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, archiveId));
|
|
|
+ if (count == 0){
|
|
|
+ String userName = AuthUtil.getNickName();
|
|
|
+ //获取档案信息,如果状态未未查阅则修改
|
|
|
+ ArchivesAuto archive = this.getById(archiveId);
|
|
|
+ //查询当前案卷节点的合同段类型
|
|
|
+ Integer unitType;
|
|
|
+ if (archive.getContractId() == null || archive.getContractId() == -1){
|
|
|
+ unitType = 3;
|
|
|
+ }else {
|
|
|
+ ContractInfo contract = contractClient.getContractById(archive.getContractId());
|
|
|
+ unitType = contract.getContractType();
|
|
|
+ }
|
|
|
+ ExpertInspection inspection = new ExpertInspection();
|
|
|
+ inspection.setProjectId(projectId);
|
|
|
+ inspection.setExpertId(userId);
|
|
|
+ inspection.setExpertName(userName);
|
|
|
+ inspection.setIsPass(1);
|
|
|
+ inspection.setUnitType(unitType);
|
|
|
+ inspection.setArchiveId(archiveId);
|
|
|
+ inspection.setArchiveName(archive.getName());
|
|
|
+ inspectionService.save(inspection);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-保存抽检意见
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void saveInspect(ExpertInspection inspection) {
|
|
|
+ //判断是否存在文件id
|
|
|
+ if (inspection.getFileId() == null){
|
|
|
+ throw new ServiceException("未获取到当前的文件id");
|
|
|
+ }
|
|
|
+ //专家基本信息
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ String userName = AuthUtil.getNickName();
|
|
|
+ //获取档案信息,如果状态未未查阅则修改
|
|
|
+ ArchivesAuto archive = this.getById(inspection.getArchiveId());
|
|
|
+ archive.setIsInspect(1);
|
|
|
+ //查询当前案卷节点的合同段类型
|
|
|
+ Integer unitType;
|
|
|
+ if (archive.getContractId() == null || archive.getContractId() == -1){
|
|
|
+ unitType = 3;
|
|
|
+ }else {
|
|
|
+ ContractInfo contract = contractClient.getContractById(archive.getContractId());
|
|
|
+ unitType = contract.getContractType();
|
|
|
+ }
|
|
|
+ //判断是否存在意见
|
|
|
+ Integer isPass = 1;
|
|
|
+ if (StringUtils.isNotBlank(inspection.getOpinion())){
|
|
|
+ isPass = 0;
|
|
|
+ }
|
|
|
+ inspection.setArchiveName(archive.getName());
|
|
|
+ inspection.setExpertId(userId);
|
|
|
+ inspection.setExpertName(userName);
|
|
|
+ inspection.setIsPass(isPass);
|
|
|
+ inspection.setUnitType(unitType);
|
|
|
+ //如果专家对案卷没有意见
|
|
|
+ if (isPass == 1){
|
|
|
+ //判断是否有合格意见,有则直接跳过
|
|
|
+ long count3 = inspectionService.count(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, archive.getId())
|
|
|
+ .eq(ExpertInspection::getIsPass, 1));
|
|
|
+ if (count3 == 0){
|
|
|
+ //先删除当前专家对当前案卷当前文件的意见
|
|
|
+ inspectionService.remove(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, inspection.getArchiveId())
|
|
|
+ .eq(ExpertInspection::getFileId, inspection.getFileId()));
|
|
|
+ //再查看当前专家是否对当前档案有意见
|
|
|
+ long count2 = inspectionService.count(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, archive.getId())
|
|
|
+ .eq(ExpertInspection::getIsPass, 0));
|
|
|
+ //没有就直接保存合格
|
|
|
+ if (count2 == 0) {
|
|
|
+ inspection.setFileId(null);
|
|
|
+ inspectionService.save(inspection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果专家对案卷有意见,先删除当前专家在意见表对当前档案合格的意见
|
|
|
+ inspectionService.remove(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, inspection.getArchiveId())
|
|
|
+ .eq(ExpertInspection::getIsPass, 1));
|
|
|
+ //再去查看意见表是否存在对当前档案当前文件的意见
|
|
|
+ ExpertInspection one = inspectionService.getOne(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getExpertId, userId)
|
|
|
+ .eq(ExpertInspection::getArchiveId, inspection.getArchiveId())
|
|
|
+ .eq(ExpertInspection::getFileId, inspection.getFileId()));
|
|
|
+ //如果不存在数据,然后保存
|
|
|
+ if (one == null) {
|
|
|
+ inspectionService.save(inspection);
|
|
|
+ } else {
|
|
|
+ //如果存在数据,则判断是否存在意见,然后修改
|
|
|
+ one.setIsPass(isPass);
|
|
|
+ one.setOpinion(inspection.getOpinion());
|
|
|
+ inspectionService.updateById(one);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前档案的所有不合格专家意见
|
|
|
+ long count = inspectionService.count(new LambdaQueryWrapper<ExpertInspection>()
|
|
|
+ .eq(ExpertInspection::getArchiveId, archive.getId())
|
|
|
+ .eq(ExpertInspection::getIsPass, 0));
|
|
|
+ if (count > 0){
|
|
|
+ //如果有则修改档案不合格
|
|
|
+ archive.setUpdateStatus(1);
|
|
|
+ }else {
|
|
|
+ //如果没有则修改档案为合格
|
|
|
+ archive.setUpdateStatus(2);
|
|
|
+ }
|
|
|
+ this.updateById(archive);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-抽检记录
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<ExpertInspectionVO> getUserInspectInfo(Query query, Long projectId) {
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ //判断当前用户职位是否为专家组长,专家组长查看所有
|
|
|
+ String userRole = AuthUtil.getUserRole();
|
|
|
+ if ("1656191696348082177".equals(userRole)){
|
|
|
+ userId = null;
|
|
|
+ }
|
|
|
+ IPage<ExpertInspectionVO> page = new Page<>(query.getCurrent(),query.getSize());
|
|
|
+ return baseMapper.getUserInspectInfo(page,projectId,userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-项目抽检统计
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ProjectInspectStatVO projectInspectStat(Long projectId) {
|
|
|
+ //获取当前项目下所有已经申请抽检的案卷
|
|
|
+ List<ArchivesAutoVO3> list = baseMapper.getAllInspectArchive(projectId);
|
|
|
+ if (list == null || list.size() == 0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ ProjectInspectStatVO vo = new ProjectInspectStatVO();
|
|
|
+ List<ProjectInspectStatVO.UnitGroup> groupList = new ArrayList<>();
|
|
|
+ //总抽检率
|
|
|
+ BigDecimal totalRatio = new BigDecimal(0) ;
|
|
|
+ //根据单位类型分组
|
|
|
+ Map<Integer, List<ArchivesAutoVO3>> listMap = list.stream().collect(Collectors.groupingBy(ArchivesAutoVO3::getUnitType));
|
|
|
+ //统计业主
|
|
|
+ List<ArchivesAutoVO3> list1 = listMap.get(3);
|
|
|
+ if (list1 != null && list1.size() > 0){
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup();
|
|
|
+ unitGroup.setTotal(list1.size());
|
|
|
+ list1.removeIf(l-> l.getIsInspect() == 0);
|
|
|
+ unitGroup.setEndInspect(list1.size());
|
|
|
+ list1.removeIf(l->l.getUpdateStatus() == 2);
|
|
|
+ unitGroup.setNeedUpdate(list1.size());
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(unitGroup.getEndInspect()).divide(new BigDecimal(unitGroup.getTotal()), 3, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(1);
|
|
|
+ unitGroup.setInspectRatio(bigDecimal.toString()+"%");
|
|
|
+ unitGroup.setName("业主组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ totalRatio = totalRatio.add(bigDecimal);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup(0,0,0,"0%");
|
|
|
+ unitGroup.setName("业主组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ }
|
|
|
+ //统计监理
|
|
|
+ List<ArchivesAutoVO3> list2 = listMap.get(2);
|
|
|
+ if (list2 != null && list2.size() > 0){
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup();
|
|
|
+ unitGroup.setTotal(list2.size());
|
|
|
+ list2.removeIf(l-> l.getIsInspect() == 0);
|
|
|
+ unitGroup.setEndInspect(list2.size());
|
|
|
+ list2.removeIf(l->l.getUpdateStatus() == 2);
|
|
|
+ unitGroup.setNeedUpdate(list2.size());
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(unitGroup.getEndInspect()).divide(new BigDecimal(unitGroup.getTotal()), 3, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(1);
|
|
|
+ unitGroup.setInspectRatio(bigDecimal.toString()+"%");
|
|
|
+ unitGroup.setName("监理组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ totalRatio = totalRatio.add(bigDecimal);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup(0,0,0,"0%");
|
|
|
+ unitGroup.setName("监理组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ }
|
|
|
+ //统计施工
|
|
|
+ List<ArchivesAutoVO3> list3 = listMap.get(1);
|
|
|
+ if (list3 != null && list3.size() > 0){
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup();
|
|
|
+ unitGroup.setTotal(list3.size());
|
|
|
+ list3.removeIf(l-> l.getIsInspect() == 0);
|
|
|
+ unitGroup.setEndInspect(list3.size());
|
|
|
+ list3.removeIf(l->l.getUpdateStatus() == 2);
|
|
|
+ unitGroup.setNeedUpdate(list3.size());
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(unitGroup.getEndInspect()).divide(new BigDecimal(unitGroup.getTotal()), 3, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(1);
|
|
|
+ unitGroup.setInspectRatio(bigDecimal.toString()+"%");
|
|
|
+ unitGroup.setName("施工组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ totalRatio = totalRatio.add(bigDecimal);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup = new ProjectInspectStatVO.UnitGroup(0,0,0,"0%");
|
|
|
+ unitGroup.setName("施工组");
|
|
|
+ groupList.add(unitGroup);
|
|
|
+ }
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup2 = new ProjectInspectStatVO.UnitGroup(0,0,0,"0%");
|
|
|
+ unitGroup2.setName("声像组");
|
|
|
+ groupList.add(unitGroup2);
|
|
|
+ ProjectInspectStatVO.UnitGroup unitGroup3 = new ProjectInspectStatVO.UnitGroup(0,0,0,"0%");
|
|
|
+ unitGroup3.setName("竣工图组");
|
|
|
+ groupList.add(unitGroup3);
|
|
|
+ vo.setList(groupList);
|
|
|
+ vo.setTotalInspectRatio(totalRatio.toString());
|
|
|
+ //案卷低于100卷,则需要全部抽检完,抽检率必须达到100%,否则则提示抽检率不达标,未达到100%;
|
|
|
+ //案卷高于100卷,所有抽检案卷加起来的抽检率不足10%,则提示抽检率未达到10%
|
|
|
+ if (list.size() <= 100){
|
|
|
+ if (new BigDecimal(100).compareTo(totalRatio) != 0){
|
|
|
+ vo.setTips("预警提示:抽检率未达到验收要求,目前只抽检了"+totalRatio+"%");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (new BigDecimal(10).compareTo(totalRatio) != -1){
|
|
|
+ vo.setTips("预警提示:抽检率未达到验收要求,目前只抽检了"+totalRatio+"%");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线验收-获取档案文件抽检意见
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ExpertInspectionVO getArchiveFileOpinion(Long fileId, Long projectId) {
|
|
|
+ Long userId = AuthUtil.getUserId();
|
|
|
+ String userName = AuthUtil.getNickName();
|
|
|
+ ExpertInspectionVO vo = new ExpertInspectionVO();
|
|
|
+ //获取意见表里当前文件相关意见
|
|
|
+ List<ExpertInspection> list = inspectionService.getListByFileId(fileId,projectId);
|
|
|
+ if (list != null && list.size() > 0){
|
|
|
+ StringBuilder str = new StringBuilder();
|
|
|
+ for (ExpertInspection inspection : list) {
|
|
|
+ str.append(inspection.getExpertName()+":"+inspection.getOpinion()+";");
|
|
|
+ if (userId.equals(inspection.getExpertId())){
|
|
|
+ vo.setOpinion(inspection.getOpinion());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setAllOpinion(str.toString());
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public void deleteFile(String defaultDir,Long id){
|
|
|
String dir = defaultDir+"/"+id;
|
|
|
String file = defaultDir+"/"+id+".zip";
|