|
@@ -40,365 +40,6 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
/**
|
|
|
* 电签检查
|
|
|
*/
|
|
|
- public void sctTaskBatch2(ScrSignInfoVO taskApp) throws Exception {
|
|
|
- int threshold = 5;
|
|
|
-
|
|
|
- String fileUrl = CommonUtil.replaceOssUrl(taskApp.getEVisaPdfUrl());
|
|
|
- String pdfUrl = taskApp.getEVisaPdfUrl();
|
|
|
- InputStream inputStream = CommonUtil.getOSSInputStream(fileUrl);
|
|
|
- InputStream inputStream2 = CommonUtil.getOSSInputStream(fileUrl);
|
|
|
- //转换
|
|
|
- byte[] pdfData = CommonUtil.InputStreamToBytes(inputStream);
|
|
|
-
|
|
|
- PDDocument document = PDDocument.load(inputStream2);
|
|
|
- SignKeyVO pdfSignIds = PdfAddimgUtil.getPdfSignIds(pdfUrl);
|
|
|
- List<String> positions = pdfSignIds.getEVisaConfigList();
|
|
|
- Map<String, String> dataMap = pdfSignIds.getDataMap();
|
|
|
-
|
|
|
- List<String> sucessUser = new ArrayList<>();
|
|
|
- List<String> sucessCompan = new ArrayList<>();
|
|
|
- String ids = String.join(",", positions);
|
|
|
- ids = ids.replaceAll("✹", "");
|
|
|
- String remarkType = taskApp.getRemarkType();
|
|
|
- List<Map<String, Object>> strategyListByDFZX = new ArrayList<>();
|
|
|
- if(remarkType.equals("1")){
|
|
|
- strategyListByDFZX = getStrategyListByAXQ(taskApp, ids);
|
|
|
- } else if (remarkType.equals("2") || remarkType.equals("3")) {
|
|
|
- strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
- }
|
|
|
-
|
|
|
- if(strategyListByDFZX==null || strategyListByDFZX.size()==0){
|
|
|
-
|
|
|
- String sql2 = "UPDATE u_information_query set chek_status=3 where id='"+taskApp.getId()+"'";
|
|
|
- jdbcTemplate.execute(sql2);
|
|
|
-
|
|
|
- RedisTemplate.delete("chek-" + taskApp.getId() + taskApp.getProcessInstanceId());
|
|
|
- System.out.println(taskApp.getProcessInstanceId()+"-"+"总共:" );
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- positions = strategyListByDFZX.stream().map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
|
|
|
- String keyWord = String.join(",", positions);
|
|
|
- List<PDFIndexInfo> pdfIndexInfo = PdfAddimgUtil.findKeywordPostions(pdfData, keyWord);
|
|
|
-
|
|
|
- //根据id分组
|
|
|
- List<Map<String, Object>> list2 = strategyListByDFZX.stream().collect(
|
|
|
- Collectors.collectingAndThen(
|
|
|
- Collectors.toCollection(
|
|
|
- () -> new TreeSet<>(Comparator.comparing(m -> m.get("keyWord").toString()))
|
|
|
- ), ArrayList::new
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
- Map<String, List<Map<String, Object>>> newMap = list2.stream().collect(Collectors.groupingBy(b -> Func.toStr(b.get("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.size() > 0) {
|
|
|
- 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;
|
|
|
-
|
|
|
- List<Map<String, Object>> mapList = newMap.get(pkeyid);
|
|
|
- String keyData = dataMap.get(pkeyid);
|
|
|
- String userId="";
|
|
|
- String type="";
|
|
|
- if (mapList != null && mapList.size() >= 0) {
|
|
|
- Map<String, Object> map = mapList.get(0);
|
|
|
- Float pyzbx = Func.toFloat(map.get("pyzbx"));
|
|
|
- Float pyzby = Func.toFloat(map.get("pyzby"));
|
|
|
- type = map.get("type")+"";
|
|
|
- userId = map.get("userId")+"";
|
|
|
- if(taskApp.getRemarkType().equals("3")){ //东方中讯
|
|
|
- if(type.equals("1")){ //个人签字
|
|
|
- keyw = keyw + pyzbx - 20;
|
|
|
- keyh = keyh + pyzby ;
|
|
|
-
|
|
|
- }else if(type.equals("2")){
|
|
|
- keyw = keyw + pyzbx -21;
|
|
|
- keyh = keyh + pyzby-16;
|
|
|
- if(keyData.indexOf("||")>0){
|
|
|
- keyw += 10;
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(taskApp.getRemarkType().equals("2")){ //东方中讯
|
|
|
- if(imgH>=100){ //个人签字
|
|
|
- keyw = keyw + pyzbx - 20;
|
|
|
- keyh = keyh + pyzby - 15;
|
|
|
- }else{
|
|
|
- keyw = keyw + pyzbx + 10;
|
|
|
- keyh = keyh + pyzby;
|
|
|
- if(keyData.indexOf("||")>0){
|
|
|
- keyw += 10;
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- keyw = keyw + pyzbx +5;
|
|
|
- keyh = keyh + pyzby;
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("type="+type+" imgX:" + "keyid="+pkeyid+"imgX:" + imgX + " keyw:" + keyw + " imgY:" + imgY + " keyh:" + keyh+"-imgH-"+imgH);
|
|
|
- if (Math.abs(imgX - keyw) <= threshold && Math.abs(imgY - keyh) <= threshold) {
|
|
|
- if(type.equals("1")){ //个人
|
|
|
- sucessUser.add(pkeyid);
|
|
|
- }
|
|
|
- if(type.equals("2")){ //企业章
|
|
|
- sucessCompan.add(pkeyid);
|
|
|
- }
|
|
|
- System.out.println("keyid="+pkeyid+"imgX:" + imgX + " keyw:" + keyw + " imgY:" + imgY + " keyh:" + keyh+"-imgH-"+imgH);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- boolean isSign = false;
|
|
|
- //判断章是否签完
|
|
|
- List<String> companList = strategyListByDFZX.stream().filter(item -> item.get("type").equals("2")).map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
|
|
|
- if(companList!=null && companList.size()>0){
|
|
|
- Set<String> differentElements = new HashSet<>(companList);
|
|
|
- differentElements.removeAll(sucessCompan);
|
|
|
- if(differentElements==null || differentElements.size()==0){
|
|
|
- isSign = true ;
|
|
|
- }
|
|
|
- System.out.println(taskApp.getId() +"-"+"章总共:" + companList.size() + "-剩下-" + differentElements.size());
|
|
|
- }else{
|
|
|
- isSign = true ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //判断个人是否签完
|
|
|
- List<String> userList = strategyListByDFZX.stream().filter(item -> item.get("type").equals("1")).map(map -> map.get("keyWord").toString()).collect(Collectors.toList());
|
|
|
- Map<String, String> dataUserMap = new HashMap<>(dataMap);
|
|
|
-
|
|
|
- if(sucessUser!=null && sucessUser.size()>0 && isSign){
|
|
|
- for(String user:sucessUser){
|
|
|
- for(String mapkey:dataMap.keySet()){
|
|
|
- String mapval = dataMap.get(mapkey);
|
|
|
- if(mapval.contains(user)){
|
|
|
- dataUserMap.remove(mapkey) ;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(dataUserMap.keySet()==null || dataUserMap.keySet().size()==0){
|
|
|
- isSign = true ;
|
|
|
- }else{
|
|
|
- isSign = false ;
|
|
|
- }
|
|
|
- System.out.println(taskApp.getId() +"-"+"个人总共:" + sucessUser.size() + "-剩下-" +dataUserMap.keySet().size());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if( isSign){
|
|
|
- String sql2 = "UPDATE u_information_query set chek_status=2 where id='"+taskApp.getId()+"'";
|
|
|
- jdbcTemplate.execute(sql2);
|
|
|
- }else{
|
|
|
- String sql2 = "UPDATE u_information_query set chek_status=3 where id='"+taskApp.getId()+"'";
|
|
|
- jdbcTemplate.execute(sql2);
|
|
|
- }
|
|
|
- RedisTemplate.delete("chek-" + taskApp.getId() + taskApp.getProcessInstanceId());
|
|
|
- // System.out.println(taskApp.getProcessInstanceId()+"-"+"总共:" );
|
|
|
- // System.out.println(taskApp.getId() +"-"+"总共:" + positions.size() + "-剩下-" + differentElements.size());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 添加电签策略 -- 安心签
|
|
|
- public List<Map<String, Object>> getStrategyListByAXQ(ScrSignInfoVO task, String ids) {
|
|
|
- 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 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){
|
|
|
- pCount = Func.toInt(map.get("pCount"));
|
|
|
- }
|
|
|
- if((map.get("initiative")+"").equals("2") && (map.get("status")+"").equals("2")){
|
|
|
- strArray.add(map.get("task_user").toString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
- String[] split = ids.split(",");
|
|
|
- StringBuilder dqIds = new StringBuilder();
|
|
|
- StringBuilder signIds = new StringBuilder();
|
|
|
- for (String id : split) {
|
|
|
- if (id != null && id.contains("✹")) {
|
|
|
- signIds.append(id.substring(1)).append( ",");
|
|
|
- } else {
|
|
|
- dqIds.append(id).append( ",");
|
|
|
- }
|
|
|
- }
|
|
|
- if (dqIds.length()>0) {
|
|
|
- dqIds.deleteCharAt(dqIds.length()-1);
|
|
|
- }
|
|
|
- if (signIds.length()>0) {
|
|
|
- signIds.deleteCharAt(signIds.length()-1);
|
|
|
- }
|
|
|
- if(strArray!=null && strArray.size()>0) {
|
|
|
- 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 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)) {
|
|
|
- Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
|
- .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
- for (String keyId : peopleByAge.keySet()) {
|
|
|
- int exId = 0;
|
|
|
- List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
- if (keyList != null && keyList.size() == 1) {
|
|
|
- maps.addAll(keyList);
|
|
|
- exId = 1;
|
|
|
- } else if (keyList != null && keyList.size() >= 2) {
|
|
|
- for (Map<String, Object> datax : keyList) {
|
|
|
- if ((datax.get("project_id") + "").equals(task.getProjectId())) {
|
|
|
- maps.add(datax);
|
|
|
- exId = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (exId == 0) {
|
|
|
- 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, '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()
|
|
|
- .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
- for (String keyId : peopleByAge.keySet()) {
|
|
|
- int exId = 0;
|
|
|
- List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
- if (keyList != null && keyList.size() == 1) {
|
|
|
- maps.addAll(keyList);
|
|
|
- exId = 1;
|
|
|
- } else if (keyList != null && keyList.size() >= 2) {
|
|
|
- for (Map<String, Object> datax : keyList) {
|
|
|
- if ((datax.get("project_id") + "").equals(task.getProjectId())) {
|
|
|
- maps.add(datax);
|
|
|
- exId = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (exId == 0) {
|
|
|
- maps.add(keyList.get(0));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- System.out.println("22222222222222222222");
|
|
|
- }
|
|
|
- }
|
|
|
- return maps;
|
|
|
- }
|
|
|
-
|
|
|
- // 添加电签策略 -- 东方中讯
|
|
|
- public List<Map<String, Object>> getStrategyListByDFZX(ScrSignInfoVO taskApp, String ids) {
|
|
|
- List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
- List<Map<String, Object>> maps2 = new ArrayList<>();
|
|
|
- // String sql = "select * from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2";
|
|
|
-
|
|
|
- String sql = "select task_user,initiative,status,(select count(1) from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "'";
|
|
|
- List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
-
|
|
|
- int total = mapList.size();
|
|
|
- int pCount = 0;
|
|
|
-
|
|
|
- if (mapList != null && mapList.size() > 0) {
|
|
|
- for (Map<String, Object> task : mapList) {
|
|
|
- String taskUserId = Func.toStr(task.get("task_user"));
|
|
|
- String initiative = Func.toStr(task.get("initiative"));
|
|
|
- String status = Func.toStr(task.get("status"));
|
|
|
- if(initiative.equals("2") && status.equals("2")) {
|
|
|
- String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + taskUserId + "' and is_deleted=0 ) as sealId,'" + taskUserId + "' as userId,'1' as type from m_textdict_info a where a.type =2 and a.id in (" + ids + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + taskApp.getContractId() + " and user_id=" + taskUserId + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
|
|
|
- System.out.println("扫描-签字-sql=" + sqlinfo);
|
|
|
- List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
- maps2.addAll(maps3);
|
|
|
- }
|
|
|
- }
|
|
|
- pCount = Func.toInt(mapList.get(0).get("pCount"));
|
|
|
-
|
|
|
- }
|
|
|
- // 添加章
|
|
|
- if (total==pCount) {
|
|
|
- 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 '%" + taskApp.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
|
|
|
- System.out.println("扫描-签章-sql=" + sqlinfo);
|
|
|
- List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
- if (mapList != null && mapList.size() > 0) {
|
|
|
- maps2.addAll(maps3);
|
|
|
- }
|
|
|
- }
|
|
|
- Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
|
- .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
- for (String keyId : peopleByAge.keySet()) {
|
|
|
- int exId = 0;
|
|
|
- List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
- if (keyList != null && keyList.size() == 1) {
|
|
|
- maps.addAll(keyList);
|
|
|
- exId = 1;
|
|
|
- } else if (keyList != null && keyList.size() >= 2) {
|
|
|
- for (Map<String, Object> datax : keyList) {
|
|
|
- if ((datax.get("project_id") + "").equals(taskApp.getProjectId())) {
|
|
|
- maps.add(datax);
|
|
|
- exId = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (exId == 0) {
|
|
|
- maps.add(keyList.get(0));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(maps!=null & maps.size()==0 && mapList.size()>=4 ){
|
|
|
- System.out.println("123");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return maps;
|
|
|
- }
|
|
|
-
|
|
|
public void sctTaskBatch3(ScrSignInfoVO taskApp) throws Exception {
|
|
|
int threshold = 5;
|
|
|
|
|
@@ -410,7 +51,7 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
byte[] pdfData = CommonUtil.InputStreamToBytes(inputStream);
|
|
|
if(pdfData==null || pdfData.length==0){
|
|
|
System.out.println("123");
|
|
|
- String sql2 = "UPDATE u_information_query set chek_status=2,check_desc='无效的pdf' where id='" + taskApp.getId() + "'";
|
|
|
+ String sql2 = "UPDATE u_information_query set chek_status=4,check_desc='无效的PDF' where id='" + taskApp.getId() + "'";
|
|
|
jdbcTemplate.execute(sql2);
|
|
|
RedisTemplate.delete("chek-" + taskApp.getId());
|
|
|
return;
|
|
@@ -684,6 +325,180 @@ public class ScrDataServiceImpl implements ScrDataService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ // 添加电签策略 -- 安心签
|
|
|
+ public List<Map<String, Object>> getStrategyListByAXQ(ScrSignInfoVO task, String ids) {
|
|
|
+ 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 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){
|
|
|
+ pCount = Func.toInt(map.get("pCount"));
|
|
|
+ }
|
|
|
+ if((map.get("initiative")+"").equals("2") && (map.get("status")+"").equals("2")){
|
|
|
+ strArray.add(map.get("task_user").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
+ String[] split = ids.split(",");
|
|
|
+ StringBuilder dqIds = new StringBuilder();
|
|
|
+ StringBuilder signIds = new StringBuilder();
|
|
|
+ for (String id : split) {
|
|
|
+ if (id != null && id.contains("✹")) {
|
|
|
+ signIds.append(id.substring(1)).append( ",");
|
|
|
+ } else {
|
|
|
+ dqIds.append(id).append( ",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dqIds.length()>0) {
|
|
|
+ dqIds.deleteCharAt(dqIds.length()-1);
|
|
|
+ }
|
|
|
+ if (signIds.length()>0) {
|
|
|
+ signIds.deleteCharAt(signIds.length()-1);
|
|
|
+ }
|
|
|
+ if(strArray!=null && strArray.size()>0) {
|
|
|
+ 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 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)) {
|
|
|
+ Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
|
+ .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
+ for (String keyId : peopleByAge.keySet()) {
|
|
|
+ int exId = 0;
|
|
|
+ List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
+ if (keyList != null && keyList.size() == 1) {
|
|
|
+ maps.addAll(keyList);
|
|
|
+ exId = 1;
|
|
|
+ } else if (keyList != null && keyList.size() >= 2) {
|
|
|
+ for (Map<String, Object> datax : keyList) {
|
|
|
+ if ((datax.get("project_id") + "").equals(task.getProjectId())) {
|
|
|
+ maps.add(datax);
|
|
|
+ exId = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (exId == 0) {
|
|
|
+ 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, '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()
|
|
|
+ .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
+ for (String keyId : peopleByAge.keySet()) {
|
|
|
+ int exId = 0;
|
|
|
+ List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
+ if (keyList != null && keyList.size() == 1) {
|
|
|
+ maps.addAll(keyList);
|
|
|
+ exId = 1;
|
|
|
+ } else if (keyList != null && keyList.size() >= 2) {
|
|
|
+ for (Map<String, Object> datax : keyList) {
|
|
|
+ if ((datax.get("project_id") + "").equals(task.getProjectId())) {
|
|
|
+ maps.add(datax);
|
|
|
+ exId = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (exId == 0) {
|
|
|
+ maps.add(keyList.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println("22222222222222222222");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return maps;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加电签策略 -- 东方中讯
|
|
|
+ public List<Map<String, Object>> getStrategyListByDFZX(ScrSignInfoVO taskApp, String ids) {
|
|
|
+ List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> maps2 = new ArrayList<>();
|
|
|
+ // String sql = "select * from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2";
|
|
|
+
|
|
|
+ String sql = "select task_user,initiative,status,(select count(1) from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "' and initiative=2 and status=2) as pCount from u_task_parallel where process_instance_id = '" + taskApp.getProcessInstanceId() + "'";
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
+
|
|
|
+ int total = mapList.size();
|
|
|
+ int pCount = 0;
|
|
|
+
|
|
|
+ if (mapList != null && mapList.size() > 0) {
|
|
|
+ for (Map<String, Object> task : mapList) {
|
|
|
+ String taskUserId = Func.toStr(task.get("task_user"));
|
|
|
+ String initiative = Func.toStr(task.get("initiative"));
|
|
|
+ String status = Func.toStr(task.get("status"));
|
|
|
+ if(initiative.equals("2") && status.equals("2")) {
|
|
|
+ String sqlinfo = " SELECT * from ( SELECT a.id as keyWord,a.project_id,a.pyzbx ,a.pyzby,(SELECT acc_code from blade_user where id='" + taskUserId + "' and is_deleted=0 ) as sealId,'" + taskUserId + "' as userId,'1' as type from m_textdict_info a where a.type =2 and a.id in (" + ids + ") and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c where c.contract_id=" + taskApp.getContractId() + " and user_id=" + taskUserId + " and c.is_deleted=0 ) ) x where x.sealId is not null ";
|
|
|
+ System.out.println("扫描-签字-sql=" + sqlinfo);
|
|
|
+ List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
+ maps2.addAll(maps3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pCount = Func.toInt(mapList.get(0).get("pCount"));
|
|
|
+
|
|
|
+ }
|
|
|
+ // 添加章
|
|
|
+ if (total==pCount) {
|
|
|
+ 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 '%" + taskApp.getContractId() + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
|
|
|
+ System.out.println("扫描-签章-sql=" + sqlinfo);
|
|
|
+ List<Map<String, Object>> maps3 = jdbcTemplate.queryForList(sqlinfo);
|
|
|
+ if (mapList != null && mapList.size() > 0) {
|
|
|
+ maps2.addAll(maps3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
|
|
|
+ .collect(Collectors.groupingBy(hada -> (Func.toStr(hada.get("keyWord")))));
|
|
|
+ for (String keyId : peopleByAge.keySet()) {
|
|
|
+ int exId = 0;
|
|
|
+ List<Map<String, Object>> keyList = peopleByAge.get(keyId);
|
|
|
+ if (keyList != null && keyList.size() == 1) {
|
|
|
+ maps.addAll(keyList);
|
|
|
+ exId = 1;
|
|
|
+ } else if (keyList != null && keyList.size() >= 2) {
|
|
|
+ for (Map<String, Object> datax : keyList) {
|
|
|
+ if ((datax.get("project_id") + "").equals(taskApp.getProjectId())) {
|
|
|
+ maps.add(datax);
|
|
|
+ exId = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (exId == 0) {
|
|
|
+ maps.add(keyList.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(maps!=null & maps.size()==0 && mapList.size()>=4 ){
|
|
|
+ System.out.println("123");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return maps;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取电签关键字的位置
|
|
|
*/
|