|
@@ -25,11 +25,13 @@ import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springblade.business.entity.Task;
|
|
|
import org.springblade.business.entity.TaskParallel;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
+import org.springblade.common.constant.EVisaConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.evisa.vo.SealStrategyVO;
|
|
|
import org.springblade.meter.controller.TaskController;
|
|
|
import org.springblade.meter.entity.InterimPayCertificate;
|
|
|
import org.springblade.meter.entity.InterimPayCertificateItem;
|
|
@@ -52,10 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -290,7 +289,7 @@ public class InterimPayCertificateServiceImpl extends BaseServiceImpl<InterimPay
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ filterMaps(maps, task.getProjectId());
|
|
|
if (Func.isNotEmpty(maps) || maps.size() >= 1) {
|
|
|
InputStream ossInputStream = CommonUtil.getOSSInputStream(pdfUrl);
|
|
|
String localPdfPath = FileUtils.getSysLocalFileUrl() + "/pdf/" + task.getId() + ".pdf";
|
|
@@ -319,4 +318,32 @@ public class InterimPayCertificateServiceImpl extends BaseServiceImpl<InterimPay
|
|
|
}
|
|
|
System.out.println("");
|
|
|
}
|
|
|
+
|
|
|
+ public static void filterMaps(List<Map<String, Object>> maps, Object projectId) {
|
|
|
+ // 1. 统计每个 id 出现的次数
|
|
|
+ Map<Object, Integer> idCountMap = new HashMap<>();
|
|
|
+ for (Map<String, Object> map : maps) {
|
|
|
+ Object id = map.get("id");
|
|
|
+ idCountMap.put(id, idCountMap.getOrDefault(id, 0) + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 找出所有重复的 id(出现次数 > 1)
|
|
|
+ Set<Object> duplicateIds = idCountMap.entrySet().stream()
|
|
|
+ .filter(entry -> entry.getValue() > 1)
|
|
|
+ .map(Map.Entry::getKey)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 3. 遍历 maps,删除重复 id 中 project_id 不等于传入值的记录
|
|
|
+ Iterator<Map<String, Object>> iterator = maps.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ Map<String, Object> map = iterator.next();
|
|
|
+ Object id = map.get("id");
|
|
|
+ Object currentProjectId = map.get("project_id");
|
|
|
+
|
|
|
+ // 如果 id 是重复的,并且 project_id 不等于传入的 projectId,则删除
|
|
|
+ if (duplicateIds.contains(id) && !Objects.equals(currentProjectId+"", projectId)) {
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|