From 15a51e0af4a4864fcf30ebd927864147e278181a Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 24 一月 2024 16:29:54 +0800
Subject: [PATCH] 指挥端查看通过的位置共享审批提交
---
ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java | 13 ++++++
ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java | 2 +
ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java | 79 +++++++++++++++++++++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java | 2 +
ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml | 8 ++++
5 files changed, 103 insertions(+), 1 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
index 61de069..9ca3040 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
@@ -157,4 +157,17 @@
return AjaxResult.error();
}
}
+
+ @GetMapping("/getCheckPositionTrue")
+ @ApiOperation("鎸囨尌绔煡鐪嬮�氳繃鐨勭敵璇�")
+ public AjaxResult getCheckPositionTrue() {
+ String commanderId = SecurityUtils.getUserId();
+ try{
+ Map<String,List<Map<String,Object>>> result = ardAppApplicationService.getCheckPositionTrue(commanderId);
+ return AjaxResult.success(result);
+ }catch(Exception e){
+ e.printStackTrace();
+ return AjaxResult.error();
+ }
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
index 5021020..d965391 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
@@ -70,4 +70,6 @@
public int updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(@Param("commanderId")String commanderId,@Param("soilderId")String soilderId,
@Param("applicationType")String applicationType,@Param("begin")String begin,@Param("state")String state);
+
+ public List<Map<String,Object>> selectArdAppApplicationByCommanderIdTrue(String commanderId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
index 27400e1..1ab20f0 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
@@ -68,4 +68,6 @@
public Map<String,List<Map<String,Object>>> getCheckPosition(String usersId);
public int approvalCheckPosition(String commanderId,Map<String,String> para);
+
+ public Map<String,List<Map<String,Object>>> getCheckPositionTrue(String commanderId);
}
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 562aa77..14f8653 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
@@ -14,6 +14,7 @@
import com.ruoyi.app.application.domain.ArdAppApplication;
import com.ruoyi.app.application.service.IArdAppApplicationService;
+import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
@@ -28,6 +29,48 @@
private ArdAppApplicationMapper ardAppApplicationMapper;
private Map<String,Thread> threadMap = new HashMap();
+
+ @PostConstruct
+ public void init(){
+ ArdAppApplication para = new ArdAppApplication();
+ para.setState("1");//鏌ヨ鍚屾剰鐨勭敵璇�
+ List<ArdAppApplication> ardAppApplicationList = ardAppApplicationMapper.selectArdAppApplicationList(para);
+ Date date = new Date();
+ Long now = date.getTime();
+ for(ArdAppApplication ardAppApplication : ardAppApplicationList){
+ Long begin = Long.parseLong(ardAppApplication.getBegin());
+ //鍒ゆ柇鏄惁瓒呮椂
+ if(now - begin <= 24*60*60*1000){//鏈秴鏃朵粠鏂板垱寤虹嚎绋�
+ String key = ardAppApplication.getCommanderId() + "," + ardAppApplication.getSoilderId() + "," + ardAppApplication.getApplicationType();
+ Thread thread = new Thread(key){//鍒涘缓绾跨▼璁℃椂鍓╀綑鏃堕暱
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(24*60*60*1000 - (now - begin));//鍓╀綑鏃堕暱
+ } 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);
+ }else{//瓒呮椂鏇存敼鐘舵��
+ String state = "000";//state涓�000锛屽嵆瓒呮椂
+ String commanderId = ardAppApplication.getCommanderId();
+ String soilderId = ardAppApplication.getSoilderId();
+ String applicationType = ardAppApplication.getApplicationType();
+ int result = ardAppApplicationMapper.updateArdAppApplicationBeginByCommanderIdAndSoilderIdAndType(commanderId,soilderId,applicationType,"",state);
+ }
+ }
+ }
/**
* 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆
@@ -146,8 +189,8 @@
@Override
public Map<String, List<Map<String, Object>>> getCheckPosition(String usersId) {
Map<String, List<Map<String, Object>>> result = new HashMap();
- //鏌ョ湅鎸囨尌绔綅缃敵璇�
List<Map<String,Object>> ardAppApplicationList = ardAppApplicationMapper.selectArdAppApplicationByCommanderId(usersId);
+ //鏌ョ湅鎸囨尌绔綅缃敵璇�
List<Map<String, Object>> resultCommanderPosition = new ArrayList();
for(Map<String, Object> map : ardAppApplicationList){
if(((String)map.get("applicationType")).equals("Commander")){
@@ -214,4 +257,38 @@
}
return 0;
}
+
+ @Override
+ public Map<String, List<Map<String, Object>>> getCheckPositionTrue(String commanderId) {
+ Map<String, List<Map<String, Object>>> result = new HashMap();
+ List<Map<String,Object>> ardAppApplicationList = ardAppApplicationMapper.selectArdAppApplicationByCommanderIdTrue(commanderId);
+ Date date = new Date();
+ //鏌ョ湅鎸囨尌绔綅缃敵璇�
+ List<Map<String, Object>> resultCommanderPosition = new ArrayList();
+ for(Map<String, Object> map : ardAppApplicationList){
+ Long interval = date.getTime() - Long.parseLong((String)map.get("begin"));
+ interval = 24 * 60 * 60 * 1000 - interval;
+ Long hour = interval / (60 * 60 * 1000);
+ Long min = (interval - hour * 60 * 60 * 1000) / (60 * 1000);
+ map.put("time",hour + "鏃�" + min + "鍒�");
+ if(((String)map.get("applicationType")).equals("Commander")){
+ resultCommanderPosition.add(map);
+ }
+ }
+ //鏌ョ湅杞﹁締浣嶇疆鐢宠
+ List<Map<String, Object>> resultSYCarsPosition = new ArrayList();
+ for(Map<String, Object> map : ardAppApplicationList){
+ Long interval = date.getTime() - Long.parseLong((String)map.get("begin"));
+ interval = 24 * 60 * 60 * 1000 - interval;
+ Long hour = interval / (60 * 60 * 1000);
+ Long min = (interval - hour * 60 * 60 * 1000) / (60 * 1000);
+ map.put("time",hour + "鏃�" + min + "鍒�");
+ if(((String)map.get("applicationType")).equals("SYCar")){
+ resultSYCarsPosition.add(map);
+ }
+ }
+ result.put("commander",resultCommanderPosition);
+ result.put("SYCars",resultSYCarsPosition);
+ return result;
+ }
}
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
index 1348a19..37c1dfb 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
@@ -109,4 +109,12 @@
update ard_app_application set begin = #{begin},state = #{state}
where commander_id = #{commanderId} and soilder_id = #{soilderId} and application_type = #{applicationType}
</update>
+
+ <select id="selectArdAppApplicationByCommanderIdTrue" parameterType="java.lang.String" resultType="java.util.Map">
+ select aaa.soilder_id as "soilderId",aaa.commander_id as "commanderId",
+ aaa.reason,aaa.begin,aaa.state,aaa.application_type as "applicationType",
+ su.user_name as "userName",su.nick_name as "nickName" from ard_app_application aaa
+ inner join sys_user su on aaa.soilder_id = su.user_id
+ where commander_id = #{usersId} and state = '1'
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3