|
@@ -12,6 +12,7 @@ import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.evisa.service.ScrDataService;
|
|
|
import org.springblade.evisa.utils.PdfAddimgUtil;
|
|
|
import org.springblade.evisa.vo.SignKeyVO;
|
|
@@ -230,16 +231,14 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
|
|
|
// 添加电签策略 -- 安心签
|
|
|
public List<Map<String, Object>> getStrategyListByAXQ(ScrSignInfoVO task, String ids) {
|
|
|
- String sql = "select task_user,count(1) as total,initiative,status,(select count(1) from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "'";
|
|
|
+ String sql = "select task_user,initiative,status,(select count(1) from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "'";
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
ArrayList<String> strArray = new ArrayList();
|
|
|
- int total = 0;
|
|
|
int pCount = 0;
|
|
|
if (mapList != null && mapList.size() >= 1) {
|
|
|
for (int i = 0; i < mapList.size(); i++) {
|
|
|
Map<String, Object> map = mapList.get(i);
|
|
|
if(i==0){
|
|
|
- total = Func.toInt(map.get("total"));
|
|
|
pCount = Func.toInt(map.get("pCount"));
|
|
|
}
|
|
|
if((map.get("initiative")+"").equals("2") && (map.get("status")+"").equals("2")){
|
|
@@ -270,8 +269,8 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
for (int i = 0; i < strArray.size(); i++) {
|
|
|
List<Map<String, Object>> maps2 = null;
|
|
|
if (dqIds.length() > 0) {
|
|
|
- String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + strArray.get(i) + "' and is_deleted=0 ) as sealId from m_textdict_info a where a.type =2 and a.id in (" + dqIds + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + task.getContractId() + " and user_id=" + strArray.get(i) + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
|
|
|
- System.out.println("东方中讯--签字--" + sqlinfo);
|
|
|
+ String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + strArray.get(i) + "' and is_deleted=0 ) as signature_file_url, '1' as type from m_textdict_info a where a.type =2 and a.id in (" + dqIds + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + task.getContractId() + " and user_id=" + strArray.get(i) + " and c.is_deleted=0 ) ) x where x.signature_file_url is not null ";
|
|
|
+ System.out.println("安心签--签字--" + sqlinfo);
|
|
|
maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
}
|
|
|
if(CollectionUtil.isNotEmpty(maps2)) {
|
|
@@ -295,13 +294,19 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
maps.add(keyList.get(0));
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 查询 sign_data 表
|
|
|
+ List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT * from m_sign_data where query_id = ? and text_id in (?) and user_id = ? and type = 1", task.getId(), dqIds, strArray.get(i));
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ System.out.println("1111111111111111111");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- String sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ")";
|
|
|
- System.out.println("东方中讯--签章--" + sqlinfo);
|
|
|
+ String sqlinfo = "SELECT a.id as keyWord,a.pyzbx,a.pyzby,b.certificate_number as sealId, '2' as type from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + task.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + dqIds + ")";
|
|
|
+ System.out.println("安心签--签章--" + sqlinfo);
|
|
|
List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
if(CollectionUtil.isNotEmpty(maps2)) {
|
|
|
Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
@@ -324,6 +329,8 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
maps.add(keyList.get(0));
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ System.out.println("22222222222222222222");
|
|
|
}
|
|
|
}
|
|
|
return maps;
|
|
@@ -409,6 +416,16 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
List<String> positions = pdfSignIds.getEVisaConfigList();
|
|
|
Map<String, String> dataMap = pdfSignIds.getDataMap();
|
|
|
|
|
|
+ Map<String, String> dataMap1 = checkSignByPdf(taskApp, pdfSignIds, pdfData);
|
|
|
+ if (dataMap1 != null && !dataMap1.isEmpty()) {
|
|
|
+ dataMap = dataMap1;
|
|
|
+ } else {
|
|
|
+ String sql2 = "UPDATE u_information_query set chek_status=2 where id='" + taskApp.getId() + "'";
|
|
|
+ jdbcTemplate.execute(sql2);
|
|
|
+ RedisTemplate.delete("chek-" + taskApp.getId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
List<String> sucessUser = new ArrayList<>();
|
|
|
List<String> sucessCompan = new ArrayList<>();
|
|
|
String ids = String.join(",", positions);
|
|
@@ -603,22 +620,6 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// boolean isSign1 = true;
|
|
|
-// //判断个人是否签完
|
|
|
-// List<String> userList = strategyListByDFZX.stream().filter(item -> item.get("type").equals("1")).map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
|
|
|
-// if (!userList.isEmpty()) {
|
|
|
-// Set<String> differentElements = new HashSet<>(userList);
|
|
|
-// sucessUser.forEach(differentElements::remove);
|
|
|
-// if (!differentElements.isEmpty()) {
|
|
|
-// isSign1 = false;
|
|
|
-// StringBuilder sb = new StringBuilder();
|
|
|
-// sb.append("id = ").append(taskApp.getId()).append(", 人总共:").append(userList.size()).append(", 剩下:").append(differentElements.size());
|
|
|
-// for (String element : differentElements) {
|
|
|
-// sb.append(", ").append(element);
|
|
|
-// }
|
|
|
-// System.err.println(sb);
|
|
|
-// }
|
|
|
-// }
|
|
|
if(!sucessUser.isEmpty() && isSign){
|
|
|
for(String user:sucessUser){
|
|
|
for(String mapkey:dataMap.keySet()){
|
|
@@ -632,6 +633,7 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
for(String mapkey:dataMap.keySet()){
|
|
|
String mapval = dataMap.get(mapkey);
|
|
|
if(mapval != null && (mapval.equals(company) || mapval.equals(company+"\r"))){
|
|
|
+// if(mapval != null && mapval.contains(company)){
|
|
|
dataUserMap.remove(mapkey) ;
|
|
|
}
|
|
|
}
|
|
@@ -651,4 +653,77 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
RedisTemplate.delete("chek-" + taskApp.getId());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String, String> checkSignByPdf(ScrSignInfoVO taskApp,SignKeyVO pdfSignIds,byte[] pdfData) throws Exception {
|
|
|
+ int threshold = 5;
|
|
|
+ //转换
|
|
|
+ try (PDDocument document = PDDocument.load(pdfData);) {
|
|
|
+ List<String> positions = pdfSignIds.getEVisaConfigList();
|
|
|
+ Map<String, String> dataMap = pdfSignIds.getDataMap();
|
|
|
+ String keyWord = String.join(",", positions);
|
|
|
+ List<String> sucessList = new ArrayList<>();
|
|
|
+ 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++) {
|
|
|
+ PDPage page = document.getPage(i);
|
|
|
+ List<PDAnnotation> annotations = page.getAnnotations();
|
|
|
+ for (PDAnnotation annotation : annotations) {
|
|
|
+ if (annotation instanceof PDAnnotationWidget) {
|
|
|
+ PDRectangle rect = annotation.getRectangle();
|
|
|
+ float imgW = rect.getWidth();
|
|
|
+ float imgH = rect.getHeight();
|
|
|
+ float imgX = rect.getLowerLeftX() + imgW / 2;
|
|
|
+ float imgY = rect.getLowerLeftY() + imgH / 2;
|
|
|
+ List<PDFIndexInfo> pdfIndexInfos = groupBy.get((i + 1) + ".0");
|
|
|
+ if (pdfIndexInfos != null && !pdfIndexInfos.isEmpty()) {
|
|
|
+ for (PDFIndexInfo pdfInfo : pdfIndexInfos) {
|
|
|
+ String pkeyid = pdfInfo.getPkeyid();
|
|
|
+ float[] dataInfo = pdfInfo.getDataInfo();
|
|
|
+ float keyX = dataInfo[1];
|
|
|
+ float keyY = dataInfo[2];
|
|
|
+ float pageHeight = page.getMediaBox().getHeight();
|
|
|
+ float pageWidth = page.getMediaBox().getWidth();
|
|
|
+
|
|
|
+ float keyw = keyX * pageWidth;
|
|
|
+ float keyh = pageHeight - keyY * pageHeight;
|
|
|
+ float pyzbx = 0.0f;
|
|
|
+ float pyzby = 0.0f;
|
|
|
+ if (taskApp.getRemarkType().equals("3")) { //东方中讯
|
|
|
+
|
|
|
+ } else if (taskApp.getRemarkType().equals("2")) { //东方中讯
|
|
|
+
|
|
|
+ } else {
|
|
|
+ keyw = keyw + pyzbx + 5;
|
|
|
+ keyh = keyh + pyzby;
|
|
|
+ }
|
|
|
+ if (pkeyid.length() < 19) {
|
|
|
+ keyw = keyw - (float) (10 - pkeyid.length() / 2.0);
|
|
|
+ }
|
|
|
+ if (Math.abs(imgX - keyw) <= threshold && Math.abs(imgY - keyh) <= threshold) {
|
|
|
+ sucessList.add(pkeyid);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, String> dataUserMap = new HashMap<>(dataMap);
|
|
|
+ //判断章是否签完
|
|
|
+ if (!sucessList.isEmpty()) {
|
|
|
+ for (String user : sucessList) {
|
|
|
+ for (String mapkey : dataMap.keySet()) {
|
|
|
+ String mapval = dataMap.get(mapkey);
|
|
|
+ if (mapval.contains(user)) {
|
|
|
+ dataUserMap.remove(mapkey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!dataUserMap.isEmpty()) {
|
|
|
+ return dataUserMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|