|
@@ -1,152 +0,0 @@
|
|
|
-package org.springblade.business.controller;
|
|
|
-
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springblade.business.chekPdf.PdfAddimgUtil;
|
|
|
-import org.springblade.business.service.ITaskService;
|
|
|
-import org.springblade.business.vo.ScrSignInfoVO;
|
|
|
-import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springblade.evisa.vo.SignKeyVO;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
-import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
-import java.util.concurrent.ThreadPoolExecutor;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * 清表基础数据表 控制器
|
|
|
- *
|
|
|
- * @author BladeX
|
|
|
- * @since 2022-05-18
|
|
|
- */
|
|
|
-@RestController
|
|
|
-@AllArgsConstructor
|
|
|
-@Api(value = "电签类", tags = "电签类接口")
|
|
|
-@RequestMapping("/archiveFile12312")
|
|
|
-@Slf4j
|
|
|
-public class ChekSignData {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StringRedisTemplate RedisTemplate;
|
|
|
- // jdbc
|
|
|
- private final JdbcTemplate jdbcTemplate;
|
|
|
-
|
|
|
- // 线程池
|
|
|
- @Resource(name = "taskExecutor1")
|
|
|
- private ThreadPoolExecutor executor;
|
|
|
-
|
|
|
- private final ITaskService taskService;
|
|
|
-
|
|
|
- // @Scheduled(cron = "0/10 * * * * ?")
|
|
|
- public void SignInfo() {
|
|
|
- // 质检SQL
|
|
|
- String sql = "SELECT a.id ,a.e_visa_pdf_url,b.process_instance_id,a.contract_id,a.project_id,c.remark_type,b.id as taskId from u_information_query a ,u_task b ,m_project_info c where a.project_id=1792760669353865218 and b.approval_type=1 and c.id=a.project_id and a.`status` in(1,2) and a.is_deleted=0 and a.e_visa_pdf_url is not null and b.form_data_id = a.id and b.`status` in(2) ";
|
|
|
-
|
|
|
- List<ScrSignInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ScrSignInfoVO.class));
|
|
|
- if (query != null && query.size() >= 1 ) {
|
|
|
- for (ScrSignInfoVO dataInfo : query) {
|
|
|
- if (executor.getQueue().size()<=6 ) {
|
|
|
- Long nodeId = dataInfo.getId();
|
|
|
- Boolean aBoolean = RedisTemplate.hasKey("sign-" + nodeId);
|
|
|
-
|
|
|
- if (!aBoolean) {
|
|
|
- RedisTemplate.opsForValue().set("sign-" + nodeId, "1",3600, TimeUnit.SECONDS);
|
|
|
- CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
|
|
|
- try {
|
|
|
- /*===============执行批量任务===============*/
|
|
|
- sctTaskBatch2(dataInfo);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }, executor);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("队列数量" + executor.getQueue().size());
|
|
|
- System.out.println("活跃数量" + executor.getActiveCount());
|
|
|
- System.out.println("总共数量" + executor.getTaskCount());
|
|
|
- System.out.println("完成数量" + executor.getCompletedTaskCount());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void sctTaskBatch2(ScrSignInfoVO taskApp) throws Exception {
|
|
|
-
|
|
|
-
|
|
|
- String pdfUrl = taskApp.getEVisaPdfUrl();
|
|
|
- SignKeyVO pdfSignIds = PdfAddimgUtil.getPdfSignIds(pdfUrl);
|
|
|
- List<String> positions = pdfSignIds.getEVisaConfigList();
|
|
|
-
|
|
|
- String ids = String.join(",", positions);
|
|
|
- List<Map<String, Object>> strategyListByDFZX = getStrategyListByDFZX(taskApp, ids);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- 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";
|
|
|
- List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
- if (mapList != null && mapList.size() > 0) {
|
|
|
- for (Map<String, Object> task : mapList) {
|
|
|
- String taskUserId = Func.toStr(task.get("task_user"));
|
|
|
- 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 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);
|
|
|
- }
|
|
|
- }
|
|
|
- // 添加章
|
|
|
- // if (taskApp.getStatus().equals("2")) {
|
|
|
- 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 '%" + 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 ){
|
|
|
-
|
|
|
- String header = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJ1c2VyX25hbWUiOiJ6aHV3ZWkiLCJyZWFsX25hbWUiOiLnpZ3ngpwiLCJhdmF0YXIiOiIiLCJhdXRob3JpdGllcyI6WyJhZG1pbmlzdHJhdG9yIl0sImNsaWVudF9pZCI6ImNsaWVudCIsInJvbGVfbmFtZSI6ImFkbWluaXN0cmF0b3IiLCJsaWNlbnNlIjoicG93ZXJlZCBieSBibGFkZXgiLCJwb3N0X2lkIjoiIiwidXNlcl9pZCI6IjE3Mzk5NDQ2MTMyNjUxODY4MTgiLCJyb2xlX2lkIjoiMTEyMzU5ODgxNjczODY3NTIwMSIsInBob25lIjoiMTg5ODI4Nzc2MDciLCJzY29wZSI6WyJhbGwiXSwibmlja19uYW1lIjoi56Wd54KcIiwib2F1dGhfaWQiOiIiLCJkZXRhaWwiOnsidHlwZSI6IndlYiJ9LCJleHAiOjE3NDU1OTU2MDksImRlcHRfaWQiOiIxNTkyMzk0MTMxMTc3ODczNDEwIiwianRpIjoiZTMzN2QyNGMtNzkzZC00OTIwLTliMzEtZTU3MDYyNTIyZTBlIiwiYWNjb3VudCI6InpodXdlaSJ9.jihRZbcZrrCArbMcp6ON9H-1uCDn07juxlXPcHLU07A";
|
|
|
- taskService.reSigningEVisa("1", taskApp.getTaskId(), taskApp.getContractId(), taskApp.getProjectId(), 1, header);
|
|
|
- String sql2 = "update u_task set batch=10 where id="+taskApp.getTaskId();
|
|
|
- jdbcTemplate.execute(sql2);
|
|
|
- }
|
|
|
-
|
|
|
- return maps;
|
|
|
- }
|
|
|
-}
|