增加工单提醒功能

This commit is contained in:
lujiang 2024-08-18 17:19:37 +08:00
parent 6477550b5f
commit 3787fe83a2
15 changed files with 721 additions and 24 deletions

View File

@ -0,0 +1,73 @@
package com.ics.admin.controller;
import com.ics.admin.service.IRepairRemindService;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wf.jwtp.annotation.Logical;
import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.Map;
/**
* 工单提醒
* created at 2024-8-17 21:47
*
* @author lujiang
* @version 1.0.0
* @since 1.0.0
*/
@RestController
@RequestMapping({"/admin/repairRemind", "/app/repairRemind"})
public class RepairRemindController extends BaseController {
@Autowired
private IRepairRemindService repairRemindService;
/**
* 查询工单提醒列表
*/
@RequiresPermissions(value = {"repair:manage:operator", "member:center:view"}, logical = Logical.OR)
@RequestMapping("list")
public R list() {
startPage();
Long userId = getLoginStaffId();
return result(repairRemindService.getRepairRemindList(userId));
}
/**
* 工单提醒 变成已读
*/
@RequiresPermissions(value = {"repair:manage:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("read")
public R read(@RequestBody Map<String, Long> map) {
Long id = map.get("id");
Long userId = getLoginStaffId();
return toAjax(repairRemindService.readRepairRemind(id, userId));
}
/**
* 删除工单提醒
*/
@RequiresPermissions(value = {"repair:manage:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("remove")
public R remove(@RequestBody Map<String, Long> map) {
Long id = map.get("id");
Long userId = getLoginStaffId();
return toAjax(repairRemindService.deleteRepairRemindById(id, userId));
}
/**
* 清空工单提醒
*/
@RequiresPermissions(value = {"repair:manage:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("clear")
public R clear() {
Long userId = getLoginStaffId();
return toAjax(repairRemindService.deleteRepairRemindByUserId(userId));
}
}

View File

@ -0,0 +1,79 @@
package com.ics.admin.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ics.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 工单提醒对象 ics_repair_remind
*
* @author ics
* @date 2024-08-17
*/
@Data
@TableName("ics_repair_remind")
public class RepairRemind extends BaseEntity<RepairRemind> {
private static final long serialVersionUID = -202408172114L;
/**
* 提醒类型
*/
private Integer typeId;
/**
* 工单id
*/
private Long repairId;
/**
* 被提醒用户
*/
private Long userId;
/**
* 提醒内容
*/
private String content;
/**
* 是否已读 0未读 1已读
*/
private Integer read;
/**
* 已读时间
*/
private Date readTime;
/**
* 扩展1
*/
private String ext1;
/**
* 扩展2
*/
private String ext2;
/**
* 扩展3
*/
private String ext3;
public RepairRemind() {
}
public RepairRemind(Long repairId, Long userId, String content, Long createBy, Date createTime) {
this.typeId = 0;
this.repairId = repairId;
this.userId = userId;
this.content = content;
this.read = 0;
this.setDeleteFlag(0);
this.setCreateBy(createBy + "");
this.setCreateTime(createTime);
}
}

View File

@ -77,6 +77,10 @@ public interface RepairMapper {
*/ */
int deleteRepairByIds(String[] ids); int deleteRepairByIds(String[] ids);
/**
* 获取红色超时的工单
*/
List<Repair> getRepairTimeoutRed(Integer day);
/** /**
* 红色告警 * 红色告警
* *
@ -85,7 +89,11 @@ public interface RepairMapper {
int repairTimeoutRed(Integer day); int repairTimeoutRed(Integer day);
/** /**
* 橙色预警 * 获取橙色超时的工单
*/
List<Repair> getRepairTimeoutOrange(Integer day);
/**
* 橙色告警
* *
* @param day 超时大于day天橙色预警 * @param day 超时大于day天橙色预警
*/ */

View File

@ -0,0 +1,78 @@
package com.ics.admin.mapper;
/**
* created at 2024-8-17 21:19
*
* @author lujiang
* @version 1.0.0
* @since 1.0.0
*/
import com.ics.admin.domain.RepairRemind;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工单提醒Mapper接口
*
* @author ics
* @date 2024-08-17
*/
@Mapper
public interface RepairRemindMapper {
/**
* 查询工单提醒
*
* @param id 工单提醒ID
* @return 工单提醒
*/
RepairRemind selectRepairRemindById(Long id);
/**
* 查询工单提醒列表
*
* @param userId 用户id
* @return 工单提醒集合
*/
List<RepairRemind> getRepairRemindByUserId(Long userId);
/**
* 已读工单
* @param repairRemind
* @return
*/
int readRepairRemin(RepairRemind repairRemind);
/**
* 新增工单提醒
*
* @param repairRemind 工单提醒
* @return 结果
*/
int insertRepairRemind(RepairRemind repairRemind);
/**
* 修改工单提醒
*
* @param repairRemind 工单提醒
* @return 结果
*/
int updateRepairRemind(RepairRemind repairRemind);
/**
* 删除工单提醒
*
* @param id 工单提醒ID
* @return 结果
*/
int deleteRepairRemindById(@Param("id") Long id, @Param("userId") Long userId);
/**
* 批量删除工单提醒
*
* @param userId 用户id
* @return 结果
*/
int deleteRepairRemindByUserId(Long userId);
}

View File

@ -0,0 +1,62 @@
package com.ics.admin.service;
import com.ics.admin.domain.RepairRemind;
import java.util.List;
/**
* 工单提醒Service接口
*
* @author ics
* @date 2024-08-17
*/
public interface IRepairRemindService {
/**
* 查询工单提醒
*
* @param id 工单提醒ID
* @return 工单提醒
*/
RepairRemind selectRepairRemindById(Long id);
/**
* 查询工单提醒列表
*
* @param userId 用户id
* @return 工单提醒
*/
List<RepairRemind> getRepairRemindList(Long userId);
/**
* 新增工单提醒
*
* @param repairRemind 工单提醒
* @return 结果
*/
int insertRepairRemind(RepairRemind repairRemind);
/**
* 工单提醒 变为已读
*
* @param id 工单提醒id
* @param userId 用户id
* @return 结果
*/
int readRepairRemind(Long id, Long userId);
/**
* 删除 用户的 所有工单提醒
*
* @param userId 用户id
* @return 结果
*/
int deleteRepairRemindByUserId(Long userId);
/**
* 删除工单提醒信息
*
* @param id 工单提醒ID
* @return 结果
*/
int deleteRepairRemindById(Long id, Long userId);
}

View File

@ -78,9 +78,14 @@ public interface IRepairService {
int deleteRepairById(Long id); int deleteRepairById(Long id);
/** /**
* 工单超时告警 * 工单超时告警 红灯
*/ */
int repairTimeOut(); int repairTimeOutRed();
/**
* 工单超时告警 黄灯
*/
int repairTimeOutOrange();
/** /**
* 工单超时预警 * 工单超时预警

View File

@ -0,0 +1,95 @@
package com.ics.admin.service.impl;
import com.ics.admin.domain.RepairRemind;
import com.ics.admin.mapper.RepairRemindMapper;
import com.ics.admin.service.IRepairRemindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 工单提醒Service业务层处理
*
* @author ics
* @date 2024-08-17
*/
@Service
public class RepairRemindServiceImpl implements IRepairRemindService {
@Autowired
private RepairRemindMapper repairRemindMapper;
/**
* 查询工单提醒
*
* @param id 工单提醒ID
* @return 工单提醒
*/
@Override
public RepairRemind selectRepairRemindById(Long id) {
return repairRemindMapper.selectRepairRemindById(id);
}
/**
* 查询用户工单提醒列表
*
* @param userId 用户id
* @return 工单提醒
*/
@Override
public List<RepairRemind> getRepairRemindList(Long userId) {
return repairRemindMapper.getRepairRemindByUserId(userId);
}
/**
* 新增工单提醒
*
* @param repairRemind 工单提醒
* @return 结果
*/
@Override
public int insertRepairRemind(RepairRemind repairRemind) {
return repairRemindMapper.insertRepairRemind(repairRemind);
}
/**
* 工单提醒 变为已读
*
* @param id 工单提醒id
* @return 结果
*/
@Override
public int readRepairRemind(Long id, Long userId) {
RepairRemind repairRemind = new RepairRemind();
Date now = new Date();
repairRemind.setId(id);
repairRemind.setUserId(userId);//只能改变发给自己的提醒变为已读
repairRemind.setReadTime(now);
repairRemind.setUpdateTime(now);
repairRemind.setUpdateBy(userId + "");
return repairRemindMapper.readRepairRemin(repairRemind);
}
/**
* 删除 用户的 所有工单提醒
*
* @param userId 用户id
* @return 结果
*/
@Override
public int deleteRepairRemindByUserId(Long userId) {
return repairRemindMapper.deleteRepairRemindByUserId(userId);
}
/**
* 删除工单提醒信息
*
* @param id 工单提醒ID
* @return 结果
*/
@Override
public int deleteRepairRemindById(Long id, Long userId) {
return repairRemindMapper.deleteRepairRemindById(id, userId);
}
}

View File

@ -3,14 +3,17 @@ package com.ics.admin.service.impl;
import com.ics.admin.domain.Repair; import com.ics.admin.domain.Repair;
import com.ics.admin.domain.RepairLog; import com.ics.admin.domain.RepairLog;
import com.ics.admin.domain.RepairRelational; import com.ics.admin.domain.RepairRelational;
import com.ics.admin.domain.RepairRemind;
import com.ics.admin.mapper.IcsCustomerStaffMapper; import com.ics.admin.mapper.IcsCustomerStaffMapper;
import com.ics.admin.mapper.RepairAttachMapper; import com.ics.admin.mapper.RepairAttachMapper;
import com.ics.admin.mapper.RepairLogMapper; import com.ics.admin.mapper.RepairLogMapper;
import com.ics.admin.mapper.RepairMapper; import com.ics.admin.mapper.RepairMapper;
import com.ics.admin.mapper.RepairRelationalMapper; import com.ics.admin.mapper.RepairRelationalMapper;
import com.ics.admin.mapper.RepairRemindMapper;
import com.ics.admin.service.IRepairAttachService; import com.ics.admin.service.IRepairAttachService;
import com.ics.admin.service.IRepairService; import com.ics.admin.service.IRepairService;
import com.ics.admin.utils.FlowOperate; import com.ics.admin.utils.FlowOperate;
import com.ics.admin.utils.RepairRemindContent;
import com.ics.common.core.domain.IcsCustomerStaff; import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.utils.StringUtils; import com.ics.common.utils.StringUtils;
import com.ics.system.domain.DictData; import com.ics.system.domain.DictData;
@ -22,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -56,6 +60,12 @@ public class RepairServiceImpl implements IRepairService {
@Autowired @Autowired
private RepairAttachMapper repairAttachMapper; private RepairAttachMapper repairAttachMapper;
@Autowired
private RepairRemindMapper repairRemindMapper;
@Autowired
private RepairRemindContent repairRemindContent;
@Autowired @Autowired
private IRepairAttachService repairAttachService; private IRepairAttachService repairAttachService;
@ -83,6 +93,16 @@ public class RepairServiceImpl implements IRepairService {
return 0; return 0;
} }
/**
* 流程逻辑处理
*
* @param repair 工单实体
* @param currentUserId 当前用户id
* @param files 附件id
* @param content 流程流转反馈内容
* @param operate 操作选择流转
* @return 流程逻辑处理结果
*/
private String processFlow(Repair repair, Long currentUserId, String[] files, String content, FlowOperate operate) { private String processFlow(Repair repair, Long currentUserId, String[] files, String content, FlowOperate operate) {
if (repair == null) return "表单数据为空"; if (repair == null) return "表单数据为空";
IcsCustomerStaff currentUser = customerStaffMapper.selectIcsCustomerStaffById(currentUserId); IcsCustomerStaff currentUser = customerStaffMapper.selectIcsCustomerStaffById(currentUserId);
@ -90,6 +110,7 @@ public class RepairServiceImpl implements IRepairService {
Integer from = -1, to = -1; Integer from = -1, to = -1;
Repair newRepair = repair.getId() == null || repair.getId() == 0L ? repair : repairMapper.selectRepairById(repair.getId());//使用数据库中的表单 Repair newRepair = repair.getId() == null || repair.getId() == 0L ? repair : repairMapper.selectRepairById(repair.getId());//使用数据库中的表单
from = repair.getId() == null || repair.getId() == 0L ? 0 : newRepair.getStatus(); from = repair.getId() == null || repair.getId() == 0L ? 0 : newRepair.getStatus();
Date now = new Date();
//报修 //报修
if (from == 0) { if (from == 0) {
//没有设置维修人员则到派单环节否则到修理工是否接收环节 //没有设置维修人员则到派单环节否则到修理工是否接收环节
@ -105,7 +126,7 @@ public class RepairServiceImpl implements IRepairService {
repair.setWarn(1);//预警默认绿色 repair.setWarn(1);//预警默认绿色
repair.setDeleteFlag(0); repair.setDeleteFlag(0);
repair.setCreateBy(currentUserId.toString()); repair.setCreateBy(currentUserId.toString());
repair.setCreateTime(new Date()); repair.setCreateTime(now);
if (to == 5) { if (to == 5) {
nextUser = customerStaffMapper.selectIcsCustomerStaffById(repair.getRepairUserId()); nextUser = customerStaffMapper.selectIcsCustomerStaffById(repair.getRepairUserId());
repair.setRemark("5110"); repair.setRemark("5110");
@ -128,7 +149,10 @@ public class RepairServiceImpl implements IRepairService {
if (list == null || list.size() == 0) return "没有找到管理员账号"; if (list == null || list.size() == 0) return "没有找到管理员账号";
nextUser = list.get(0); nextUser = list.get(0);
} }
if (FlowOperate.END.equals(operate)) to = 11; if (FlowOperate.END.equals(operate)) {
to = 11;
newRepair.setEndDate(now);
}
} }
//重新派单 //重新派单
if (from == 3) { if (from == 3) {
@ -163,19 +187,84 @@ public class RepairServiceImpl implements IRepairService {
newRepair.setFailureTypeId(repair.getFailureTypeId()); newRepair.setFailureTypeId(repair.getFailureTypeId());
newRepair.setFailureTypeName(repair.getFailureTypeName()); newRepair.setFailureTypeName(repair.getFailureTypeName());
newRepair.setResolve(repair.getResolve()); newRepair.setResolve(repair.getResolve());
newRepair.setEndDate(new Date()); newRepair.setEndDate(now);
} }
newRepair.setStatus(to);//设置状态 newRepair.setStatus(to);//设置状态
processData(newRepair, currentUser, nextUser, from, to, content, files); List<RepairRemind> rList = processRemind(newRepair, currentUser, nextUser, from, to, content);//处理流程提醒
processData(newRepair, currentUser, nextUser, from, to, content, files, rList);
return IRepairService.OK; return IRepairService.OK;
} }
private void processData(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content, String[] files) { private List<RepairRemind> processRemind(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content) {
List<RepairRemind> rList = new ArrayList<>();//流程提醒
Date now = new Date();
if (from == 0) {//报修
if (to == 1)
//提醒派单员
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getP1(), repair.getRepairName()), currentUser.getId(), now));
if (to == 5)
//提醒维修工
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getW1(), repair.getRepairName()), currentUser.getId(), now));
} else if (from == 1) {//派单
if (to == 5) {
//提醒维修工
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getW1(), repair.getRepairName()), currentUser.getId(), now));
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR15(), repair.getRepairName()), currentUser.getId(), now));
}
if (to == 3) {
//提醒管理员
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getM1(), repair.getRepairName(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR1(), repair.getRepairName()), currentUser.getId(), now));
}
if (to == 11)
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR2(), repair.getRepairName(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
} else if (from == 3) {//重新派单
//提醒派单员
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP2(), repair.getRepairName()), currentUser.getId(), now));
} else if (from == 5) {//修理工是否接收
if (to == 1) {
//提醒派单员
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP3(), repair.getRepairName(), currentUser.getUsername(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR3(), repair.getRepairName()), currentUser.getId(), now));
}
if (to == 7)
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR4(), repair.getRepairName(), nextUser.getUsername()), currentUser.getId(), now));
} else if (from == 7) {//修理反馈
//提醒发起人
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR5(), repair.getRepairName()), currentUser.getId(), now));
}
return rList;
}
/**
* 流程数据处理
*
* @param repair 工单
* @param currentUser 当前操作用户
* @param nextUser 下一步用户
* @param from 起步节点id
* @param to 下一步节点id
* @param content 流程反馈内容
* @param files 流程附件id
* @param rList 工单提醒内容
*/
private void processData(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content, String[] files, List<RepairRemind> rList) {
Date now = new Date(); Date now = new Date();
RepairLog oldLog = null; RepairLog oldLog = null;
if (from == 0) { if (from == 0) {
repairMapper.insertRepair(repair); repairMapper.insertRepair(repair);
if (files != null && files.length > 0) repairAttachMapper.updateRepairAttachs(repair.getId(), files);//处理附件 if (files != null && files.length > 0) repairAttachMapper.updateRepairAttachs(repair.getId(), files);//处理附件
//处理工单提醒--start
for (RepairRemind repairRemind : rList) {
repairRemind.setRepairId(repair.getId());
repairRemindMapper.insertRepairRemind(repairRemind);
}
//处理工单提醒--end
} else { } else {
repairMapper.updateRepair(repair); repairMapper.updateRepair(repair);
oldLog = repairLogMapper.selectRepairLogById(repair.getLogId()); oldLog = repairLogMapper.selectRepairLogById(repair.getLogId());
@ -183,6 +272,11 @@ public class RepairServiceImpl implements IRepairService {
oldLog.setCloseTime(now); oldLog.setCloseTime(now);
if (StringUtils.isNotBlank(content)) oldLog.setContent(content); if (StringUtils.isNotBlank(content)) oldLog.setContent(content);
repairLogMapper.updateRepairLog(oldLog); repairLogMapper.updateRepairLog(oldLog);
//处理工单提醒--start
for (RepairRemind repairRemind : rList) {
repairRemindMapper.insertRepairRemind(repairRemind);
}
//处理工单提醒--end
} }
//新增日志 //新增日志
RepairLog repairLog = new RepairLog(); RepairLog repairLog = new RepairLog();
@ -328,15 +422,36 @@ public class RepairServiceImpl implements IRepairService {
return repairMapper.deleteRepairById(id); return repairMapper.deleteRepairById(id);
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int repairTimeOut() { public int repairTimeOutRed() {
List<DictData> list = dictDataService.selectDictDataByType("repair_timeout");
if (list.size() == 4) {
Integer red = Integer.valueOf(list.get(3).getDictValue());
List<Repair> redList = repairMapper.getRepairTimeoutRed(red);
Date now = new Date();
for (Repair repair : redList) {
RepairRemind repairRemind = new RepairRemind(repair.getId(), repair.getRepairUserId(), String.format(repairRemindContent.getTimeRed(), repair.getRepairName()), -1L, now);
repairRemindMapper.insertRepairRemind(repairRemind);
}
if (redList.size() > 0) return repairMapper.repairTimeoutRed(red);
}
return 0;
}
@Transactional(rollbackFor = Exception.class)
@Override
public int repairTimeOutOrange() {
List<DictData> list = dictDataService.selectDictDataByType("repair_timeout"); List<DictData> list = dictDataService.selectDictDataByType("repair_timeout");
if (list.size() == 4) { if (list.size() == 4) {
Integer orange = Integer.valueOf(list.get(2).getDictValue()); Integer orange = Integer.valueOf(list.get(2).getDictValue());
Integer red = Integer.valueOf(list.get(3).getDictValue()); List<Repair> orangeList = repairMapper.getRepairTimeoutOrange(orange);
int r = repairMapper.repairTimeoutRed(red); Date now = new Date();
int o = repairMapper.repairTimeoutOrange(orange); for (Repair repair : orangeList) {
return r + o; RepairRemind repairRemind = new RepairRemind(repair.getId(), repair.getRepairUserId(), String.format(repairRemindContent.getTimeOrange(), repair.getRepairName()), -1L, now);
repairRemindMapper.insertRepairRemind(repairRemind);
}
if (orangeList.size() > 0) return repairMapper.repairTimeoutOrange(orange);
} }
return 0; return 0;
} }
@ -354,7 +469,6 @@ public class RepairServiceImpl implements IRepairService {
return 0; return 0;
} }
@Override @Override
public int removeWarn() { public int removeWarn() {
return repairMapper.removeWarn(); return repairMapper.removeWarn();

View File

@ -0,0 +1,38 @@
package com.ics.admin.utils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* created at 2024-8-17 22:28
*
* @author lujiang
* @version 1.0.0
* @since 1.0.0
*/
@Component
@PropertySource(value = {"classpath:repairRemind.properties"}, encoding = "UTF-8")
@ConfigurationProperties(prefix = "repair.remind")
@Data
public class RepairRemindContent {
private String r1;//1-3
private String r15;//1-5
private String r2;//1-11
private String r3;//5-1
private String r4;//5-7
private String r5;//7-9
private String p1;//0-1
private String p2;//3-1
private String p3;//5-1
private String m1;//1-3
private String w1;//0-5 1-5
private String timeOrange;
private String timeRed;
}

View File

@ -291,15 +291,25 @@
</select> </select>
<!-- 超时告警,按顺序执行 --> <!-- 超时告警,按顺序执行 -->
<select id="getRepairTimeoutRed" resultMap="RepairResult">
<![CDATA[
select * from ics_repair where delete_flag=0 and (status=5 or status=7) and timeout <> 5 and TIMESTAMPDIFF(DAY,preDate,now()) >= #{day}
]]>
</select>
<update id="repairTimeoutRed" parameterType="Integer"> <update id="repairTimeoutRed" parameterType="Integer">
update ics_repair set timeout=5 where delete_flag=0 and status <![CDATA[ < ]]> 9 and preDate is not null and timeout <![CDATA[ <> ]]> 5 and TIMESTAMPDIFF(DAY,preDate,now()) <![CDATA[ >= ]]> #{day} <![CDATA[
update ics_repair set timeout=5 where delete_flag=0 and (status=5 or status=7) and timeout <> 5 and TIMESTAMPDIFF(DAY,preDate,now()) >= #{day}
]]>
</update> </update>
<select id="getRepairTimeoutOrange" resultMap="RepairResult">
<![CDATA[
SELECT * from ics_repair where delete_flag=0 and (status=5 or status=7) and timeout <= 1 and TIMESTAMPDIFF(DAY,preDate,now()) >= #{day}
]]>
</select>
<update id="repairTimeoutOrange" parameterType="Integer"> <update id="repairTimeoutOrange" parameterType="Integer">
update ics_repair set timeout=3 where delete_flag=0 and status <![CDATA[ < ]]> 9 and preDate is not null and timeout <![CDATA[ <= ]]> 1 and TIMESTAMPDIFF(DAY,preDate,now()) <![CDATA[ >= ]]> #{day} <![CDATA[
update ics_repair set timeout=3 where delete_flag=0 and (status=5 or status=7) and timeout <= 1 and TIMESTAMPDIFF(DAY,preDate,now()) >= #{day}
]]>
</update> </update>
</mapper> </mapper>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ics.admin.mapper.RepairRemindMapper">
<resultMap type="com.ics.admin.domain.RepairRemind" id="RepairRemindResult">
<result property="id" column="id" />
<result property="typeId" column="type_id" />
<result property="repairId" column="repair_id" />
<result property="userId" column="user_id" />
<result property="content" column="content" />
<result property="read" column="read" />
<result property="readTime" column="readtime" />
<result property="ext1" column="ext1" />
<result property="ext2" column="ext2" />
<result property="ext3" column="ext3" />
<result property="deleteFlag" column="delete_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="parkId" column="park_id" />
<result property="tenantId" column="tenant_id" />
</resultMap>
<sql id="selectRepairRemindVo">
SELECT id, type_id, repair_id, user_id, content, `read`, readtime, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, park_id, tenant_id FROM ics_repair_remind
</sql>
<select id="getRepairRemindByUserId" parameterType="RepairRemind" resultMap="RepairRemindResult">
<include refid="selectRepairRemindVo"/>
where user_id=#{userId} and delete_flag=0 order by `read` asc,create_time desc
</select>
<select id="selectRepairRemindById" parameterType="Long" resultMap="RepairRemindResult">
<include refid="selectRepairRemindVo"/>
WHERE id = #{id}
</select>
<insert id="insertRepairRemind" parameterType="RepairRemind" useGeneratedKeys="true" keyProperty="id">
INSERT INTO ics_repair_remind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="typeId != null ">type_id,</if>
<if test="repairId != null ">repair_id,</if>
<if test="userId != null ">user_id,</if>
<if test="content != null and content != ''">content,</if>
<if test="read != null ">`read`,</if>
<if test="readTime != null ">readtime,</if>
<if test="ext1 != null and ext1 != ''">ext1,</if>
<if test="ext2 != null and ext2 != ''">ext2,</if>
<if test="ext3 != null and ext3 != ''">ext3,</if>
<if test="deleteFlag != null ">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="parkId != null ">park_id,</if>
<if test="tenantId != null ">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="typeId != null ">#{typeId},</if>
<if test="repairId != null ">#{repairId},</if>
<if test="userId != null ">#{userId},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="read != null ">#{read},</if>
<if test="readTime != null ">#{readTime},</if>
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
<if test="ext2 != null and ext2 != ''">#{ext2},</if>
<if test="ext3 != null and ext3 != ''">#{ext3},</if>
<if test="deleteFlag != null ">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="parkId != null ">#{parkId},</if>
<if test="tenantId != null ">#{tenantId},</if>
</trim>
</insert>
<update id="updateRepairRemind" parameterType="RepairRemind">
UPDATE ics_repair_remind
<trim prefix="SET" suffixOverrides=",">
<if test="typeId != null ">type_id = #{typeId},</if>
<if test="repairId != null ">repair_id = #{repairId},</if>
<if test="userId != null ">user_id = #{userId},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="read != null ">`read` = #{read},</if>
<if test="readTime != null ">readtime = #{readTime},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="parkId != null ">park_id = #{parkId},</if>
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
</trim>
WHERE id = #{id}
</update>
<update id="readRepairRemin" parameterType="RepairRemind">
<![CDATA[
update ics_repair_remind set `read` = 1, readtime = #{readTime}, update_time=#{updateTime}, update_by = #{updateBy} where delete_flag = 0 and id = #{id} and user_id = #{userId}
]]>
</update>
<delete id="deleteRepairRemindById">
<![CDATA[
DELETE FROM ics_repair_remind WHERE delete_flag = 0 and id = #{id} and user_id = #{userId}
]]>
</delete>
<delete id="deleteRepairRemindByUserId" parameterType="Long">
DELETE FROM ics_repair_remind where delete_flag = 0 and user_id = #{userId}
</delete>
</mapper>

View File

@ -0,0 +1,17 @@
#报修人
repair.remind.r1=您的工单《%s》正在重新派单。
repair.remind.r15=您的工单《XXXX 工单名称》已派遣维修人员
repair.remind.r2=您的工单《%s》申请无效原因是%s
repair.remind.r3=您的工单《%s》正在重新派遣维修人员
repair.remind.r4=您的工单《%s》维修人员%s开始处理
repair.remind.r5=您的工单《%s》已经处理完成欢迎您对我们的服务进行评价感谢您的使用
#派单员
repair.remind.p1=您收到工单《%s》需要派遣维修人员处理。
repair.remind.p2=工单《%s》已被管理员修正请派遣维修人员处理。
repair.remind.p3=工单《%s》已被维修人员%s退回原因是%s
#管理员
repair.remind.m1=您收到工单《%s》需要重新派单原因是%s
#维修人员
repair.remind.w1=你收到工单《%s》请尽快处理。
repair.remind.timeOrange=工单《%s》已经超时黄灯告警。
repair.remind.timeRed=工单《%s》已经严重超时红灯告警。

View File

@ -33,8 +33,10 @@ public class RepairTask {
*/ */
public void repairTimeOut() { public void repairTimeOut() {
IRepairService repairService = SpringUtils.getBean(IRepairService.class); IRepairService repairService = SpringUtils.getBean(IRepairService.class);
int num = repairService.repairTimeOut(); //保持顺序
log.info("已对" + num + "个工单超时告警"); int a = repairService.repairTimeOutRed();
int b = repairService.repairTimeOutOrange();
log.info("已对" + (a + b) + "个工单超时告警");
} }
/** /**

View File

@ -24,7 +24,7 @@ public class MyParkLineHandler implements TenantLineHandler {
"sys_sn", "sys_user_role", "sys_dept", "ics_customer_contract_room", "ics_park", "ics_apply_room", "ics_customer_contract_refund_room", "ics_apply_park_file", "sys_sn", "sys_user_role", "sys_dept", "ics_customer_contract_room", "ics_park", "ics_apply_room", "ics_customer_contract_refund_room", "ics_apply_park_file",
"ics_apply_settle_file", "ics_apply_move_in_file", "ics_activity","ics_customer_staff","tb_customer_ticket","tb_reservation","tb_reservation_person", "ics_apply_settle_file", "ics_apply_move_in_file", "ics_activity","ics_customer_staff","tb_customer_ticket","tb_reservation","tb_reservation_person",
"tb_room_content","tb_room_item","tb_room_item_by_room","tb_room_serve_by_room","tb_room_serve","tb_equipment","tb_staff_customer", "tb_room_content","tb_room_item","tb_room_item_by_room","tb_room_serve_by_room","tb_room_serve","tb_equipment","tb_staff_customer",
"tb_room_equipment","tb_room_record","tb_room_serve","tb_showroom","tb_showroom_record","tb_ticket","tb_user_equipment","tb_visitor_person","ics_repair" "tb_room_equipment","tb_room_record","tb_room_serve","tb_showroom","tb_showroom_record","tb_ticket","tb_user_equipment","tb_visitor_person","ics_repair","ics_repair_remind"
}; };
/** /**

View File

@ -24,7 +24,7 @@ public class MyTenantLineHandler implements TenantLineHandler {
"sys_sn", "sys_user_role", "ics_customer_contract_room", "ics_apply_room", "ics_customer_contract_refund_room", "ics_apply_park_file", "sys_sn", "sys_user_role", "ics_customer_contract_room", "ics_apply_room", "ics_customer_contract_refund_room", "ics_apply_park_file",
"ics_apply_settle_file", "ics_apply_move_in_file", "ics_activity","ics_customer_staff","tb_customer_ticket","tb_reservation","tb_reservation_person", "ics_apply_settle_file", "ics_apply_move_in_file", "ics_activity","ics_customer_staff","tb_customer_ticket","tb_reservation","tb_reservation_person",
"tb_room_content","tb_room_item","tb_room_item_by_room","tb_room_serve_by_room","tb_room_serve","tb_equipment","tb_staff_customer", "tb_room_content","tb_room_item","tb_room_item_by_room","tb_room_serve_by_room","tb_room_serve","tb_equipment","tb_staff_customer",
"tb_room_equipment","tb_room_record","tb_room_serve","tb_showroom","tb_showroom_record","tb_ticket","tb_user_equipment","tb_visitor_person","ics_repair" "tb_room_equipment","tb_room_record","tb_room_serve","tb_showroom","tb_showroom_record","tb_ticket","tb_user_equipment","tb_visitor_person","ics_repair","ics_repair_remind"
}; };
/** /**