|
@@ -4073,17 +4073,21 @@ public class TaskController extends BladeController {
|
|
|
@Transactional
|
|
|
public void addSignTaskBatch(Report report) {
|
|
|
try {
|
|
|
- // 修改个人电签状态
|
|
|
- String UPSql = "update u_task_parallel a set a.e_visa_status=null,e_visa_content=null where a.process_instance_id = (select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() + ") ";
|
|
|
- String UPSqlJL = " update u_task_parallel a set a.e_visa_status=1,e_visa_content='电签成功' where sort in( SELECT a.fixed_flow_branch_sort from u_task b,u_fixed_flow_link a where b.`status` in(1,2) and b.form_data_id='"+report.getPeriodId()+"' and a.fixed_flow_id=b.fixed_flow_id and a.flow_task_type=2 ) and a.process_instance_id in(SELECT process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id='"+report.getPeriodId()+"')";
|
|
|
- String DeSql = "delete from u_task_batch where task_parallel_id in(select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() + ")";
|
|
|
- //删除以前存在的电签
|
|
|
- String sql = " 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) " + " 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 " + " from u_task_parallel a,u_task b,u_fixed_flow_link c where b.`status` in(1,2) and a.process_instance_id=b.process_instance_id and c.flow_task_type!=2 and a.sort = c.fixed_flow_branch_sort and c.fixed_flow_id=b.fixed_flow_id and (a.e_visa_status is not null or a.e_visa_content is not null or a.`status`=2) and b.form_data_id= '" + report.getPeriodId()+"'";
|
|
|
-
|
|
|
- jdbcTemplate.execute(DeSql);
|
|
|
- jdbcTemplate.execute(UPSql);
|
|
|
- jdbcTemplate.execute(sql);
|
|
|
- jdbcTemplate.execute(UPSqlJL);
|
|
|
+ String selSql = "select * from u_task_parallel a set a.e_visa_status=null,e_visa_content=null where a.process_instance_id = (select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() + ") and a.status=1 and a.e_visa_status is NULL and a.e_visa_content is null ";
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(selSql);
|
|
|
+ if(Func.isEmpty(mapList) || mapList.size()==0) {
|
|
|
+ // 修改个人电签状态
|
|
|
+ String UPSql = "update u_task_parallel a set a.e_visa_status=null,e_visa_content=null where a.process_instance_id = (select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() + ") ";
|
|
|
+ String UPSqlJL = " update u_task_parallel a set a.e_visa_status=1,e_visa_content='电签成功' where sort in( SELECT a.fixed_flow_branch_sort from u_task b,u_fixed_flow_link a where b.`status` in(1,2) and b.form_data_id='" + report.getPeriodId() + "' and a.fixed_flow_id=b.fixed_flow_id and a.flow_task_type=2 ) and a.process_instance_id in(SELECT process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id='" + report.getPeriodId() + "')";
|
|
|
+ String DeSql = "delete from u_task_batch where task_parallel_id in(select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() + ")";
|
|
|
+ //删除以前存在的电签
|
|
|
+ String sql = " 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) " + " 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 " + " from u_task_parallel a,u_task b,u_fixed_flow_link c where b.`status` in(1,2) and a.process_instance_id=b.process_instance_id and c.flow_task_type!=2 and a.sort = c.fixed_flow_branch_sort and c.fixed_flow_id=b.fixed_flow_id and b.form_data_id= '" + report.getPeriodId() + "'";
|
|
|
+
|
|
|
+ jdbcTemplate.execute(DeSql);
|
|
|
+ jdbcTemplate.execute(UPSql);
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
+ jdbcTemplate.execute(UPSqlJL);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
StaticLog.error(e.getMessage());
|
|
|
}
|