From be91e24a735423f45361c9aea5eb45bb14065aa2 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 24 一月 2024 15:04:22 +0800
Subject: [PATCH] 位置共享审批提交
---
ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
index 85ecd11..562aa77 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
@@ -1,15 +1,12 @@
package com.ruoyi.app.application.service.impl;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.Map;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
@@ -29,6 +26,8 @@
public class ArdAppApplicationServiceImpl implements IArdAppApplicationService {
@Resource
private ArdAppApplicationMapper ardAppApplicationMapper;
+
+ private Map<String,Thread> threadMap = new HashMap();
/**
* 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆
@@ -166,4 +165,53 @@
result.put("SYCars",resultSYCarsPosition);
return result;
}
+
+ @Override
+ public int approvalCheckPosition(String commanderId, Map<String, String> para) {
+ String applicationType = para.get("applicationType");
+ String soilderId = para.get("soilderId");
+ String state = para.get("state");
+ String begin = "";
+ if(state.equals("1")){//state涓�1锛屽嵆鍚屾剰
+ begin = String.valueOf(new Date().getTime());//璁剧疆寮�濮嬫椂闂�
+ int result = ardAppApplicationMapper.updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(commanderId,soilderId,applicationType,begin,state);
+ String key = commanderId + "," + soilderId + "," + applicationType;
+ Thread thread = new Thread(key){//鍒涘缓绾跨▼璁℃椂24灏忔椂
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(24*60*60*1000);
+ //Thread.sleep(3*60*1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ return;
+ }
+ Thread currentThread = Thread.currentThread();
+ String state = "000";//state涓�000锛屽嵆瓒呮椂
+ String commanderId = currentThread.getName().split(",")[0];
+ String soilderId = currentThread.getName().split(",")[1];
+ String applicationType = currentThread.getName().split(",")[2];
+ int result = ardAppApplicationMapper.updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(commanderId,soilderId,applicationType,"",state);
+ threadMap.remove(currentThread.getName());
+ }
+ };
+ thread.start();
+ this.threadMap.put(key,thread);
+ return result;
+ }else if(state.equals("-1")){//state涓�1锛屽嵆椹冲洖
+ int result = ardAppApplicationMapper.updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(commanderId,soilderId,applicationType,"",state);
+ return result;
+ }else if(state.equals("00")){//state涓�00锛屽嵆鎾ら攢
+ String key = commanderId + "," + soilderId + "," + applicationType;
+ try{
+ this.threadMap.get(key).interrupt();//鎾ら攢鍚庣嚎绋嬮攢姣�
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ this.threadMap.remove(key);
+ int result = ardAppApplicationMapper.updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(commanderId,soilderId,applicationType,"",state);
+ return result;
+ }
+ return 0;
+ }
}
--
Gitblit v1.9.3