@@ -0,0 +1,15 @@ | |||
package com.tuoheng.admin.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
@RestController | |||
@RequestMapping("/accident") | |||
public class AccidentController { | |||
} |
@@ -0,0 +1,132 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_accident") | |||
public class Accident extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户id | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门id | |||
*/ | |||
private String deptId; | |||
/** | |||
* 巡检任务id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 巡检任务问题ID | |||
*/ | |||
private String inspectionFileId; | |||
/** | |||
* 应急任务ID | |||
*/ | |||
private String accidentInspectionId; | |||
/** | |||
* 公路id | |||
*/ | |||
private String roadId; | |||
/** | |||
* 路段ID | |||
*/ | |||
private String sectionId; | |||
/** | |||
* 问题ID | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题编码 | |||
*/ | |||
private String questionCode; | |||
/** | |||
* 问题名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 是否有伤亡:0:无;1:有 | |||
*/ | |||
private Integer isCasualties; | |||
/** | |||
* 是否影响驾驶安全:0:无;1:有 | |||
*/ | |||
private Integer isDrivingSafety; | |||
/** | |||
* 是否有明火:0:无;1:有 | |||
*/ | |||
private Integer isFire; | |||
/** | |||
* 事故现场描述 | |||
*/ | |||
private String record; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 无人机回仓:0未回仓;1:已回仓 | |||
*/ | |||
private Integer uavReturn; | |||
/** | |||
* 事故状态:1未处理 2处理中 3已忽略 4已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
*处理人 | |||
*/ | |||
private String checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
} |
@@ -0,0 +1,11 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.Accident; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
public interface AccidentMapper extends BaseMapper<Accident> { | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.tuoheng.admin.service.accident; | |||
import com.tuoheng.admin.entity.Accident; | |||
import com.tuoheng.admin.mapper.AccidentMapper; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Accident> implements IAccidentService{ | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.tuoheng.admin.service.accident; | |||
import com.tuoheng.admin.entity.Accident; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.query.SectionQuery; | |||
import com.tuoheng.common.core.common.IBaseService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/17 | |||
*/ | |||
public interface IAccidentService extends IBaseService<Accident> { | |||
} |
@@ -0,0 +1,6 @@ | |||
<?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.tuoheng.admin.mapper.AccidentMapper"> | |||
</mapper> |
@@ -0,0 +1,52 @@ | |||
package com.tuoheng.miniprogram.aspect; | |||
import org.aspectj.lang.ProceedingJoinPoint; | |||
import org.aspectj.lang.annotation.Around; | |||
import org.aspectj.lang.annotation.Aspect; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Component; | |||
/** | |||
* Spring AOP统计请求接口耗时 | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
@Component | |||
@Aspect | |||
public class ServiceLogAspect { | |||
public static final Logger log = LoggerFactory.getLogger(ServiceLogAspect.class); | |||
/** | |||
* AOP通知 | |||
* 1.前置通知:在方法调用之前执行 | |||
* 2.后置通知:在方法正常调用之后执行 | |||
* 3.环绕通知:在方法调用之前和之后,都分别可以执行的通知 | |||
* 4.异常通知:如果在方法调用过程中发生异常,则通知 | |||
* 5.最终通知:在方法调用之后执行 | |||
*/ | |||
@Around("execution(* com.tuoheng.miniprogram.service.impl..*.*(..))") | |||
public Object recordTimeLog(ProceedingJoinPoint joinPoint) throws Throwable{ | |||
log.info("========开始执行{}.{}=======", | |||
joinPoint.getTarget().getClass() | |||
,joinPoint.getSignature().getName()); | |||
//service执行时间 | |||
//记录开始执行时间 | |||
long begin = System.currentTimeMillis(); | |||
//执行目标service | |||
Object result = joinPoint.proceed(); | |||
//记录结束执行时间 | |||
long end = System.currentTimeMillis(); | |||
long takeTime = end - begin; | |||
if(takeTime>3000){ | |||
log.error("======执行结束,耗时:{}毫秒======",takeTime); | |||
}else if(takeTime>2000){ | |||
log.warn("======执行结束,耗时:{}毫秒======",takeTime); | |||
}else { | |||
log.info("======执行结束,耗时:{}毫秒======",takeTime); | |||
} | |||
return result; | |||
} | |||
} |