|
|
@@ -113,7 +113,17 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
ids = ids.replaceAll("✹", "");
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList("SELECT * from m_textdict_info where type=6 and is_deleted=0 and id in(" + ids + ")");
|
|
|
if (mapList != null && mapList.size() > 0) {
|
|
|
- taskApp.setSigState(2);
|
|
|
+ if(taskApp.getApprovalType()==5){
|
|
|
+ if(taskApp.getSigType()==1 ){
|
|
|
+ taskApp.setSigState(10);
|
|
|
+ }
|
|
|
+ if(taskApp.getSigType()==2 ){
|
|
|
+ taskApp.setSigState(11);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ taskApp.setSigState(2);
|
|
|
+ }
|
|
|
+
|
|
|
taskApp.setSignSmg("未获取到签字证书信息");
|
|
|
} else {
|
|
|
if (taskApp.getSigType() == 1) {
|
|
|
@@ -180,9 +190,6 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
public void addSignatureTaskBatch(TaskSignInfoVO taskApp) {
|
|
|
// 添加签字任务
|
|
|
if (taskApp.getSigType() == 1) {
|
|
|
@@ -344,9 +351,36 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
updateSql = "update u_contract_log set e_visa_pdf_url='" + taskApp.getLastFilePdfUrl() + "',status='" + taskApp.getSigType() + "',update_time=SYSDATE() where id='" + taskApp.getFormDataId() + "' ";
|
|
|
} else if (taskApp.getApprovalType() == 5) { //中期计量支付证书
|
|
|
// 获取s_interim_pay_certificate 的原始数据
|
|
|
- //taskApp.getPagePdfUrl()
|
|
|
-
|
|
|
-
|
|
|
+ if(taskApp.getSigType()==1){
|
|
|
+ jdbcTemplate.execute("update s_interim_task set status=1,sign_time=SYSDATE() ,pdf_e_url='"+taskApp.getLastFilePdfUrl()+"' where id ="+taskApp.getDId()+"");
|
|
|
+ }else {
|
|
|
+ jdbcTemplate.execute("update s_interim_task set status=2,sign_time=SYSDATE() ,pdf_e_url='"+taskApp.getLastFilePdfUrl()+"' where id ="+taskApp.getDId()+"");
|
|
|
+ }
|
|
|
+ //合并 并且加任务值
|
|
|
+ String sql= "select b.id,data_id,b.status,if(LENGTH(b.pdf_e_url)>=10,pdf_e_url,b.pdf_url) as pdf_url,a.contract_id,project_id from s_interim_pay_certificate a ,s_interim_task b where a.id=b.data_id and a.is_deleted=0 and a.contract_period_id=" + taskApp.getFormDataId();
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ String trialPdf = file_path + "/pdf/" + id + ".pdf";
|
|
|
+ List<String> pdfUrlList = maps.stream().map(e -> e.get("pdf_url")+"").collect(Collectors.toList());
|
|
|
+ List<Map<String, Object>> stateList = maps.stream().filter(e-> (e.get("status")+"").equals("2")).collect(Collectors.toList());
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlList,trialPdf);
|
|
|
+ BladeFile bladeFile = newIOSSClient.uploadFile(id + ".pdf", trialPdf);
|
|
|
+ if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
|
|
|
+ String mardfUrl = bladeFile.getLink();
|
|
|
+ taskApp.setLastFilePdfUrl(mardfUrl);
|
|
|
+ }
|
|
|
+ if(stateList.size()>=maps.size()){
|
|
|
+ taskApp.setSigType(2);
|
|
|
+ }else{
|
|
|
+ taskApp.setSigType(1);
|
|
|
+ // 添加签字
|
|
|
+ String addSqlBatch = "insert into u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name,sign_format,sign_type) \n" +
|
|
|
+ " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',b.approval_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name ,1 as sign_format,1 as sign_type from u_task_parallel a,u_task b where b.`status` in(1,2) and a.process_instance_id=b.process_instance_id \n" +
|
|
|
+ " and b.id="+taskApp.getTaskId()+" and a.parallel_process_instance_id not in(SELECT JSON_EXTRACT(c.json_data, '$.parallelProcessInstanceId') from u_task_batch c)";
|
|
|
+ jdbcTemplate.execute(addSqlBatch);
|
|
|
+ }
|
|
|
updateSql = "update s_interim_pay_certificate set approve_status=" + taskApp.getSigType() + ",update_time=SYSDATE(), raw_url='" + taskApp.getLastFilePdfUrl() + "' where contract_period_id = " + taskApp.getFormDataId();
|
|
|
} else if (taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
updateSql = "update s_material_start_statement set approve_status=" + taskApp.getSigType() + ",update_time=SYSDATE(), raw_url='" + taskApp.getLastFilePdfUrl() + "' where meter_period_id = " + taskApp.getFormDataId();
|
|
|
@@ -365,11 +399,20 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
this.jdbcTemplate.execute("delete from u_task_batch where id in(" + taskApp.getId()+")");
|
|
|
|
|
|
} else { //签字失败
|
|
|
- this.jdbcTemplate.execute("update u_task_parallel set exe_count=(exe_count+1), e_visa_status=99,e_visa_content='" + taskApp.getSignSmg() + "' ,update_time=SYSDATE() where parallel_process_instance_id in (" + taskApp.getParallelProcessInstanceId() + ")");
|
|
|
- this.jdbcTemplate.execute("update u_task set status=1 ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
- if (totalCount >= 3) {
|
|
|
+ if(taskApp.getApprovalType()==5 ){
|
|
|
+ if(taskApp.getSigState()==10){
|
|
|
+ jdbcTemplate.execute("update s_interim_task set status=1 where id ="+taskApp.getDId()+"");
|
|
|
+ } else if (taskApp.getSigState()==1) {
|
|
|
+ jdbcTemplate.execute("update s_interim_task set status=2 where id ="+taskApp.getDId()+"");
|
|
|
+ }
|
|
|
this.jdbcTemplate.execute("delete from u_task_batch where id in(" + taskApp.getId()+")");
|
|
|
- this.jdbcTemplate.execute("update u_information_query set status=1 where id=" + taskApp.getFormDataId());
|
|
|
+ }else{
|
|
|
+ this.jdbcTemplate.execute("update u_task_parallel set exe_count=(exe_count+1), e_visa_status=99,e_visa_content='" + taskApp.getSignSmg() + "' ,update_time=SYSDATE() where parallel_process_instance_id in (" + taskApp.getParallelProcessInstanceId() + ")");
|
|
|
+ this.jdbcTemplate.execute("update u_task set status=1 ,update_time=SYSDATE() where id='" + taskApp.getTaskId() + "'");
|
|
|
+ if (totalCount >= 3) {
|
|
|
+ this.jdbcTemplate.execute("delete from u_task_batch where id in(" + taskApp.getId()+")");
|
|
|
+ this.jdbcTemplate.execute("update u_information_query set status=1 where id=" + taskApp.getFormDataId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
RedisTemplate.delete("sign-" + taskApp.getFormDataId());
|
|
|
@@ -458,25 +501,23 @@ public class EVDataServiceImpl implements EVDataService {
|
|
|
} else if (taskApp.getApprovalType() == 4) { //档案走自定义 搓章的问题
|
|
|
|
|
|
} else if (taskApp.getApprovalType() == 5) {
|
|
|
- map = this.jdbcTemplate.queryForMap("select * from s_interim_pay_certificate where is_deleted=0 and contract_period_id = " + taskApp.getFormDataId());
|
|
|
- String pdfUrl = "";
|
|
|
- //中间计量用逗号拼接pagePdfUrl
|
|
|
- String pageUrl = map.get("page_pdf_url")+"";
|
|
|
- if(StringUtils.isNotEmpty(pageUrl) && pageUrl.length()>=20 ) {
|
|
|
- JSONArray jsonArray = JSONArray.parseArray(pageUrl);
|
|
|
- JSONArray jsonData = new JSONArray();
|
|
|
- for(int i=0;i<jsonArray.size();i++){
|
|
|
- JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
- String state = jsonObject.getString("state");
|
|
|
- String url = jsonObject.getString("url");
|
|
|
- if(state.equals("0") && taskApp.getSigType()==1){ //这个签字
|
|
|
- taskApp.setSignPdfUrl(url);
|
|
|
- }
|
|
|
- if(state.equals("1") && taskApp.getSigType()==2){ //签章
|
|
|
- taskApp.setSignPdfUrl(url);
|
|
|
- }
|
|
|
+ String sql= "select b.id,data_id,b.status,if(LENGTH(b.pdf_e_url)>=10,pdf_e_url,b.pdf_url) as pdf_url,a.contract_id,project_id from s_interim_pay_certificate a ,s_interim_task b where a.id=b.data_id and a.is_deleted=0 and a.contract_period_id = " + taskApp.getFormDataId();
|
|
|
+ if(taskApp.getSigType()==1){ //签字
|
|
|
+ sql += " and b.status =0 ";
|
|
|
+ }
|
|
|
+ if(taskApp.getSigType()==2){ //签章
|
|
|
+ sql += " and b.status =1 ";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> maps = this.jdbcTemplate.queryForList(sql);
|
|
|
+ if(maps!=null && maps.size()>=1){
|
|
|
+ map = maps.get(0);
|
|
|
+ String pdfUrl = map.get("pdf_url")+"";
|
|
|
+ String dId = map.get("id")+"";
|
|
|
+ if(pdfUrl!=null && pdfUrl.length()>=10){
|
|
|
+ taskApp.setSignPdfUrl(pdfUrl);
|
|
|
+ taskApp.setDId(dId);
|
|
|
}
|
|
|
- taskApp.setPagePdfUrl(jsonData);
|
|
|
}
|
|
|
} else if (taskApp.getApprovalType() == 6 || taskApp.getApprovalType() == 7) {
|
|
|
map = this.jdbcTemplate.queryForMap("select * from s_material_start_statement where is_deleted=0 and meter_period_id = " + taskApp.getFormDataId());
|