Przeglądaj źródła

修改一键电签接口请求方式,优化接口响应速度

lvy 2 tygodni temu
rodzic
commit
06bc71c513

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -2603,9 +2603,9 @@ public class TaskController extends BladeController {
     @PostMapping("/reSigningEVisaByUserIds")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "任务管理-一键重签", notes = "传入taskIds、下拉框的contractId、projectId")
-    public R<Object> reSigningEVisaByUserIds(@RequestParam String ids, @RequestParam String userIds) {
+    public R<Object> reSigningEVisaByUserIds(@RequestBody Map<String, String> vo) {
 
-       return taskService.reSigningEVisaByUserIds(ids,userIds);
+       return taskService.reSigningEVisaByUserIds(vo.get("ids"),vo.get("userIds"));
     }
 
 }

+ 8 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -30,6 +30,7 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
@@ -2242,6 +2243,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     @Override
     public R reSigningEVisaByUserIds(String ids, String userIds) {
+        BladeUser user = AuthUtil.getUser();
+        if (user == null || user.getUserId() == null || user.getDeptId() == null || !"1536982621165592577".equals(user.getDeptId())) {
+            return R.fail("权限不足,请联系管理员处理!");
+        }
         if (Func.isEmpty(ids) && ids == null) {
             return R.fail("未获取到taskIds,操作失败!");
         }
@@ -2256,19 +2261,19 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             ids2 = ids2.substring(0, ids2.length() - 1);
         }
 
-        String sqlqu = "update u_information_query set status=2,e_visa_pdf_url='' where id in( " + ids + ") and is_deleted=0 ";
+        String sqlqu = "update u_information_query set status=2,e_visa_pdf_url='' where id in( " + ids + ") and is_deleted=0 and status in (1,2)";
         String sqlForTask = "update u_task set status=2 where form_data_id in( " + ids2 + ") and status in(1,2) and is_deleted=0 ";
         String sqlForTaskPall = "UPDATE u_task_parallel a  set a.is_resign = 1, a.`status`=2 , a.e_visa_status=1 ,a.e_visa_content='电签成功' where a.process_instance_id in(select process_instance_id  from u_task b  where b.form_data_id in( " + ids2 + ") and b.status in(0,1,2) and b.is_deleted = 0)  and a.`status` in(0,1)";
 
         String taskBtech = "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)  " +
                 " 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,SYSDATE(),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.`status` in(2)  and   a.process_instance_id=b.process_instance_id " +
-                " and b.form_data_id in( " + ids2 + ") and a.parallel_process_instance_id not in(SELECT JSON_EXTRACT(c.json_data, '$.parallelProcessInstanceId') from u_task_batch c)";
+                " and b.form_data_id in( " + ids2 + ") and not exists (SELECT 1 from u_task_batch c where c.json_data like CONCAT('%',a.parallel_process_instance_id ,'%'))";
 
         if(userIds!=null && userIds.length()>=1){
             taskBtech += " and b.task_user in("+userIds+")";
             sqlForTaskPall += " and a.task_user in("+userIds+")";
             sqlqu = "update u_information_query a set status = if((select count(1) from u_task_parallel where process_instance_id = ( select process_instance_id  from u_task  where form_data_id = cast(a.id as char) and is_deleted = 0 and status in (1,2) order by id desc limit 1 ) " +
-                    "and `is_deleted` = 0 and task_user not in ( " + userIds + ") and status != 2 and e_visa_status != 1 ) > 0, 1, 2) ,e_visa_pdf_url='' where id in( "+ ids + ") and is_deleted=0 ";
+                    "and `is_deleted` = 0 and task_user not in ( " + userIds + ") and status != 2 and e_visa_status != 1 ) > 0, 1, 2) ,e_visa_pdf_url='' where id in( "+ ids + ") and is_deleted=0 and status in (1,2)";
             sqlForTask = "update u_task a set status = if((select count(1) from u_task_parallel where process_instance_id = a.process_instance_id " +
                     "and `is_deleted` = 0 and task_user not in ( " + userIds + ") and status != 2 and e_visa_status != 1 ) > 0, 1, 2) where form_data_id in( " + ids2 + ") and status in(1,2) and is_deleted=0 ";
         }