From 5ad4e2b2e881204102cd0a5e96da936db19f39c7 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期五, 11 八月 2023 11:30:47 +0800
Subject: [PATCH] 删除
---
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java | 1
ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml | 2
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java | 55 ++++++++++++++---
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java | 4 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java | 2
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java | 60 +++++++++++++++++--
6 files changed, 105 insertions(+), 19 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java
index 8198d5a..e714ae7 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java
@@ -75,6 +75,10 @@
@JsonInclude(JsonInclude.Include.NON_DEFAULT )
private Integer pageSize;
+ private String delName;
+
+ private String delTime;
+
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
index 0aaf27a..a68a445 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
@@ -9,4 +9,5 @@
private String end;
private String planId;
private String cycle;
+ private String toDay;
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
index c002cd0..817ab72 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
@@ -67,4 +67,6 @@
Results record(ArdAppPatrolpointRecord ardAppPatrolpointRecord);
Results recordMonth(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException;
+
+ Results recordDetails(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException;
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
index 69732dc..89450e6 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
@@ -14,8 +14,10 @@
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellVo;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpoint;
+import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecord;
import com.ruoyi.app.patrolplan.domain.ArdAppPatroluser;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointMapper;
+import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointRecordMapper;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatroluserMapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserVo;
@@ -57,6 +59,9 @@
@Resource
private SysUserMapper sysUserMapper;
+
+ @Resource
+ private ArdAppPatrolpointRecordMapper recordMapper;
/**
* 鏌ヨapp宸℃璁″垝
@@ -156,18 +161,46 @@
@Override
@Transactional
public int deleteArdApp(String id) {
- //ardAppPatroluserMapper.deleteArdAppPatroluserByReserved1(id);
- /*ardAppPatrolpointMapper.deleteArdAppPatrolpointById(id);
- if(ardAppPatrolplanMapper.deleteArdAppPatrolplanByPatroEndTime(id)>0){
- return Results.succeed("鍒犻櫎鎴愬姛锛�");
- }else {
- return Results.error("鍒犻櫎澶辫触锛�");
- }*/
try {
- int result = ardAppPatrolplanMapper.deleteArdAppPatrolplanById(id);//鍒犻櫎宸℃璁″垝
- ardAppPatrolpointMapper.deleteArdAppPatrolpointByPlanId(id);//鍒犻櫎宸℃璁″垝涓嬫寕鐐逛綅
- ardAppPatroluserMapper.deleteArdAppPatroluserByPlanId(id);//鍒犻櫎宸℃璁″垝涓嬫寕鐢ㄦ埛
- return result;
+ Boolean del = false;
+ //鏌ヨ璁″垝鏃堕棿鏄惁缁撴潫
+ ArdAppPatrolplan planList = ardAppPatrolplanMapper.selectById(id);
+ String cycle = planList.getCycle();
+ String end = planList.getPatroEndTime();
+ if(cycle.equals("day")){
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ String date = dateFormat.format(new Date());
+ end = date +" "+end;
+ }
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String toDay = dateFormat.format(new Date());
+ int once = toDay.compareTo(end);
+ if(once<0){
+ del = true;
+ }
+ if(!del){
+ //鏌ヨ鏄惁鏈夋墦鍗¤褰�
+ QueryWrapper<ArdAppPatrolpointRecord> recordQueryWrapper = new QueryWrapper<>();
+ recordQueryWrapper.eq("plan_id",id);
+ List<ArdAppPatrolpointRecord> recordList = recordMapper.selectList(recordQueryWrapper);
+ if(recordList.size()>0){
+ del = true;
+ }
+ }
+ if(del){
+ int result = ardAppPatrolplanMapper.deleteArdAppPatrolplanById(id);//鍒犻櫎宸℃璁″垝
+ ardAppPatrolpointMapper.deleteArdAppPatrolpointByPlanId(id);//鍒犻櫎宸℃璁″垝涓嬫寕鐐逛綅
+ ardAppPatroluserMapper.deleteArdAppPatroluserByPlanId(id);//鍒犻櫎宸℃璁″垝涓嬫寕鐢ㄦ埛
+ return result;
+ }else {
+ String userId = SecurityUtils.getUserId();
+ SysUser sysUser = sysUserMapper.selectUserById(userId);
+ String userName = sysUser.getNickName();
+ planList.setDelName(userName);
+ planList.setDelTime(dateFormat.format(new Date()));
+ int result = ardAppPatrolplanMapper.updateById(planList);
+ return result;
+ }
} catch (Exception e){
e.printStackTrace();
return 0;
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
index 6a5b5f9..f518db1 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
@@ -11,6 +11,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolplan;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecordImg;
+import com.ruoyi.app.patrolplan.domain.ArdAppPatroluser;
import com.ruoyi.app.patrolplan.domain.param.ArdAppPatrolpointRecordParam;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolplanMapper;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointRecordImgMapper;
@@ -167,23 +168,23 @@
Boolean planBoolean = false;
//寰幆姣忎竴澶�
String ymd = year+"-"+monthZero+"-"+di;
- Date ymdDate = dateFormat.parse(ymd);
+// Date ymdDate = dateFormat.parse(ymd);
//鍖归厤璁″垝鏃堕棿
String cycle = ardAppPatrolplan.getCycle();
if(cycle.equals("day")){
String createTime = ardAppPatrolplan.getCreateTime();
- Date beginCreateDate = dateFormat.parse(createTime);
- int d = ymdDate.compareTo(beginCreateDate);
+// Date beginCreateDate = dateFormat.parse(createTime);
+ int d = ymd.compareTo(createTime);
if(d>=0){
planBoolean = true;
}
}else if(cycle.equals("once")){
String onceBegin = ardAppPatrolplan.getPatroBeginTime();
- Date onceBeginDate = dateFormat.parse(onceBegin);
+// Date onceBeginDate = dateFormat.parse(onceBegin);
String onceEnd = ardAppPatrolplan.getPatroEndTime();
- Date onceEndDate = dateFormat.parse(onceEnd);
- int bd = ymdDate.compareTo(onceBeginDate);
- int ed = ymdDate.compareTo(onceEndDate);
+// Date onceEndDate = dateFormat.parse(onceEnd);
+ int bd = ymd.compareTo(onceBegin);
+ int ed = ymd.compareTo(onceEnd);
if(bd>=0 && ed<=0){
planBoolean = true;
}
@@ -226,4 +227,49 @@
return Results.succeed(jsonArray);
}
+ @Override
+ public Results recordDetails(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ //鑾峰彇鍙傛暟
+ String planId = ardAppPatrolpointRecordParam.getPlanId();
+ String toDay = ardAppPatrolpointRecordParam.getToDay();
+ Date toDayDate = dateFormat.parse(toDay);
+ //鏌ヨ璁″垝琛�
+ ArdAppPatrolplan ardAppPatrolplan = patrolplanMapper.selectById(planId);
+ String cycle = ardAppPatrolplan.getCycle();
+ String begin = ardAppPatrolplan.getPatroBeginTime();
+ Date beginDate = dateFormat.parse(begin);
+ String end = ardAppPatrolplan.getPatroEndTime();
+ Date endDate = dateFormat.parse(end);
+ String create = ardAppPatrolplan.getCreateTime();
+ Date createDate = dateFormat.parse(create);
+ if(cycle.equals("day")){
+
+ }else if(cycle.equals("once")){
+ int bd = toDayDate.compareTo(beginDate);
+ int en = toDayDate.compareTo(endDate);
+ if(bd>=0 && en<=0){
+ //浼犲叆鏃堕棿涓鸿璁″垝鍐呮椂闂�
+ String date = dateFormat.format(new Date());
+ Date dateDate = dateFormat.parse(date);
+ int d = toDayDate.compareTo(dateDate);
+ if(d < 0) {
+ //鏌ヨ璁″垝鍐呯殑鍘嗗彶鏁版嵁
+ QueryWrapper<ArdAppPatrolpointRecord> recordQueryWrapper = new QueryWrapper<>();
+ recordQueryWrapper.eq("plan_id", planId).like("record_time", toDay).groupBy("user_id");
+ List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(recordQueryWrapper);
+ return Results.succeed(list);
+ }else if(d > 0){
+ //鏌ヨ璁″垝鍐呯殑鏈潵鏁版嵁
+ QueryWrapper<ArdAppPatroluser> appPatroluserQueryWrapper = new QueryWrapper<>();
+ appPatroluserQueryWrapper.eq("patrolplan_id",planId).groupBy("app_user_id");
+
+ }
+ }else {
+ return Results.succeed("[]");
+ }
+ }
+ return Results.succeed();
+ }
+
}
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
index cfeb44f..05d1447 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
@@ -35,7 +35,7 @@
left join ard_app_patroluser as users on ard_app_patrolplan.id = users.patrolplan_id
left join sys_user on ard_app_patrolplan.user_id = sys_user.user_id
<where>
- ard_app_patrolplan.user_id = #{userId}
+ ard_app_patrolplan.user_id = #{userId} and del_name is null and del_time is null
<if test="cycle != null and cycle != ''"> and cycle = #{cycle}</if>
<if test="planName != null and planName != ''"> and plan_name like '%'||#{planName}||'%'</if>
<if test="patroBeginTime != null and patroBeginTime != ''"> and patro_begin_time >= #{patroBeginTime}</if>
--
Gitblit v1.9.3