|
@@ -679,7 +679,7 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取所有电签关键字的位置
|
|
|
+ * 获取电签关键字的位置
|
|
|
*/
|
|
|
public Map<String, float[]> getKeyPositions(SignKeyVO pdfSignIds,byte[] pdfData) throws Exception {
|
|
|
if (pdfSignIds == null) {
|
|
@@ -709,6 +709,7 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
Map<String, String> dataMap = pdfSignIds.getDataMap();
|
|
|
String keyWord = String.join(",", positions);
|
|
|
List<String> sucessList = new ArrayList<>();
|
|
|
+ Map<String, List<Map<String, Object>>> signatureDataMap = getSignatureData(taskApp.getId() + "", taskApp.getRemarkType(), keyWord);
|
|
|
List<PDFIndexInfo> pdfIndexInfo = PdfAddimgUtil.findKeywordPostions(pdfData, keyWord);
|
|
|
Map<String, List<PDFIndexInfo>> groupBy = pdfIndexInfo.stream().collect(Collectors.groupingBy(da -> Func.toStr(da.getDataInfo()[0])));
|
|
|
for (int i = 0; i < document.getPages().getCount(); i++) {
|
|
@@ -735,6 +736,22 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
float keyh = pageHeight - keyY * pageHeight;
|
|
|
float pyzbx = 0.0f;
|
|
|
float pyzby = 0.0f;
|
|
|
+ List<Map<String, Object>> maps = signatureDataMap.get(pkeyid);
|
|
|
+ if (maps != null && !maps.isEmpty()) {
|
|
|
+ boolean flag = false;
|
|
|
+ for (Map<String, Object> map : maps) {
|
|
|
+ Float pyzbx1 = Func.toFloat(map.get("pyzbx"));
|
|
|
+ Float pyzby1 = Func.toFloat(map.get("pyzby"));
|
|
|
+ if (Math.abs(imgX - keyw - pyzbx1) <= threshold && Math.abs(imgY - keyh - pyzby1) <= threshold) {
|
|
|
+ sucessList.add(pkeyid);
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (taskApp.getRemarkType().equals("3")) { //东方中讯
|
|
|
if (imgH >= 100) {
|
|
|
// 签章
|
|
@@ -784,4 +801,16 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
return dataUserMap;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private Map<String, List<Map<String, Object>>> getSignatureData(String queryId, String signType, String ids) {
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select text_id as keyword, type, pyzbx, pyzby from m_sign_data where query_id = " + queryId);
|
|
|
+ if (ids != null && !ids.isEmpty()) {
|
|
|
+ List<Map<String, Object>> list = jdbcTemplate.queryForList("select text_id as keyword, type, pyzbx, pyzby from m_sign_data where query_id = -1 and user_id = -1 and text_id in (" + ids + ") and sign_type = " + signType);
|
|
|
+ mapList.addAll(list);
|
|
|
+ }
|
|
|
+ if (!mapList.isEmpty()) {
|
|
|
+ return mapList.stream().collect(Collectors.groupingBy(item -> (Func.toStr(item.get("keyword")))));
|
|
|
+ }
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
}
|