From 939b5e669c9bab83b7c9aaee3b285d8e09670910 Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期二, 19 七月 2022 17:54:02 +0800 Subject: [PATCH] 事故快报 --- incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java | 107 +++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/exception/AccidentException.java | 38 + incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressInfoRepository.java | 26 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java | 138 ++++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressInfoServiceImpl.java | 48 + incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressFileReqDTO.java | 55 + incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentExpressService.java | 24 incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentExpressInfoMapper.xml | 13 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/AccidentExpressQuery.java | 21 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java | 103 +++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/db/AccidentExpressDBQuery.java | 21 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java | 265 ++++++++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java | 137 ++++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressFileInfoService.java | 19 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressInfoService.java | 24 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressFileInfoRepository.java | 22 incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfo.java | 117 +++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java | 141 ++++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressFileRespDTO.java | 55 + incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentExpressController.java | 68 ++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java | 183 ++++++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfoDO.java | 62 ++ incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java | 35 + incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressFileInfoServiceImpl.java | 41 + 24 files changed, 1,763 insertions(+), 0 deletions(-) diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentExpressController.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentExpressController.java new file mode 100644 index 0000000..07d52b8 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentExpressController.java @@ -0,0 +1,68 @@ +package com.gkhy.safePlatform.incidentManage.controller; + +import com.gkhy.safePlatform.commons.co.ContextCacheUser; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.PageUtils; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentExpressReqDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressDetailRespDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressPageRespDTO; +import com.gkhy.safePlatform.incidentManage.query.AccidentExpressQuery; +import com.gkhy.safePlatform.incidentManage.service.AccidentExpressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/accidentExpress") +public class AccidentExpressController { + + @Autowired + private AccidentExpressService accidentExpressService; + + /** + * 事故快报列表 + */ + @RequestMapping(value = "/page/list" ,method = RequestMethod.POST) + private ResultVO<List<AccidentExpressPageRespDTO>> list (@RequestBody PageQuery<AccidentExpressQuery> pageQuery){ + PageUtils.checkCheck(pageQuery.getPageIndex(), pageQuery.getPageSize()); + return accidentExpressService.selectAccidentExpressList(pageQuery); + } + + /** + * 事故快报新增 + */ + @RequestMapping(value = "/add",method = RequestMethod.POST) + public ResultVO addAccidentExpress(Authentication authentication, @RequestBody AccidentExpressReqDTO AccidentExpressReqDTO) { + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return accidentExpressService.addAccidentExpress(currentUser.getUid(), AccidentExpressReqDTO); + } + + /** + * 事故快报详情 + */ + @RequestMapping(value = "/info/{id}",method = RequestMethod.GET) + public ResultVO<AccidentExpressDetailRespDTO> getAccidentExpressById(@PathVariable("id")Long id){ + return accidentExpressService.getAccidentExpressById(id); + } + + /** + * 事故快报修改 + */ + @RequestMapping(value = "/update",method = RequestMethod.POST) + public ResultVO updateAccidentExpress(Authentication authentication, @RequestBody AccidentExpressReqDTO AccidentExpressReqDTO) { + ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); + return accidentExpressService.updateAccidentExpress(currentUser.getUid(), AccidentExpressReqDTO); + } + + /** + * 事故快报删除/批量删除 + */ + @RequestMapping(value = "/batchDelete/{ids}",method = RequestMethod.GET) + public ResultVO batchDeleteAccidentExpress(@PathVariable("ids")String ids){ + return accidentExpressService.batchDeleteAccidentExpress(ids); + } + +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfo.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfo.java new file mode 100644 index 0000000..1cb7e07 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfo.java @@ -0,0 +1,117 @@ +package com.gkhy.safePlatform.incidentManage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("accident_express_file") +public class AccidentExpressFileInfo{ + + @TableId(type = IdType.AUTO) + private Long id; + + private Boolean delFlag; + + private Date gmtCreate; + + private Date gmtModitify; + + private Long createUid; + + private Long updateUid; + + private Long accidentExpressId; + + private String fileUrl; + + private String fileName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Boolean getDelFlag() { + return delFlag; + } + + public void setDelFlag(Boolean delFlag) { + this.delFlag = delFlag; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + public Long getUpdateUid() { + return updateUid; + } + + public void setUpdateUid(Long updateUid) { + this.updateUid = updateUid; + } + + public Long getAccidentExpressId() { + return accidentExpressId; + } + + public void setAccidentExpressId(Long accidentExpressId) { + this.accidentExpressId = accidentExpressId; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + @Override + public String toString() { + return "AccidentExpressFileInfo{" + + "id=" + id + + ", delFlag=" + delFlag + + ", gmtCreate=" + gmtCreate + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", updateUid=" + updateUid + + ", accidentExpressId=" + accidentExpressId + + ", fileUrl='" + fileUrl + '\'' + + ", fileName='" + fileName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfoDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfoDO.java new file mode 100644 index 0000000..b8d83ed --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressFileInfoDO.java @@ -0,0 +1,62 @@ +package com.gkhy.safePlatform.incidentManage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("accident_express_file") +public class AccidentExpressFileInfoDO{ + + @TableId(type = IdType.AUTO) + private Long id; + + private Long accidentExpressId; + + private String fileUrl; + + private String fileName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getAccidentExpressId() { + return accidentExpressId; + } + + public void setAccidentExpressId(Long accidentExpressId) { + this.accidentExpressId = accidentExpressId; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + @Override + public String toString() { + return "AccidentExpressFileInfo{" + + "id=" + id + + ", accidentExpressId=" + accidentExpressId + + ", fileUrl='" + fileUrl + '\'' + + ", fileName='" + fileName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java new file mode 100644 index 0000000..c242f59 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfo.java @@ -0,0 +1,183 @@ +package com.gkhy.safePlatform.incidentManage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("accident_express") +public class AccidentExpressInfo{ + + @TableId(type = IdType.AUTO) + private Long id; + + private Boolean delFlag; + + private Date gmtCreate; + + private Date gmtModitify; + + private Long createUid; + + private Long updateUid; + + private String emergencyPrecautions; + + private String accidentCausesPreliminaryAnalysis; + + private String accidentBriefProcess; + + private Boolean casualties; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Boolean getDelFlag() { + return delFlag; + } + + public void setDelFlag(Boolean delFlag) { + this.delFlag = delFlag; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + public Long getUpdateUid() { + return updateUid; + } + + public void setUpdateUid(Long updateUid) { + this.updateUid = updateUid; + } + + public String getEmergencyPrecautions() { + return emergencyPrecautions; + } + + public void setEmergencyPrecautions(String emergencyPrecautions) { + this.emergencyPrecautions = emergencyPrecautions; + } + + public String getAccidentCausesPreliminaryAnalysis() { + return accidentCausesPreliminaryAnalysis; + } + + public void setAccidentCausesPreliminaryAnalysis(String accidentAusessPreliminaryAnalysis) { + this.accidentCausesPreliminaryAnalysis = accidentAusessPreliminaryAnalysis; + } + + public String getAccidentBriefProcess() { + return accidentBriefProcess; + } + + public void setAccidentBriefProcess(String accidentBriefProcess) { + this.accidentBriefProcess = accidentBriefProcess; + } + + public Boolean getCasualties() { + return casualties; + } + + public void setCasualties(Boolean casualties) { + this.casualties = casualties; + } + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + @Override + public String toString() { + return "AccidentExpressInfo{" + + "id=" + id + + ", delFlag=" + delFlag + + ", gmtCreate=" + gmtCreate + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", updateUid=" + updateUid + + ", emergencyPrecautions='" + emergencyPrecautions + '\'' + + ", accidentCausesPreliminaryAnalysis='" + accidentCausesPreliminaryAnalysis + '\'' + + ", accidentBriefProcess='" + accidentBriefProcess + '\'' + + ", casualties=" + casualties + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java new file mode 100644 index 0000000..d589fd9 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoDetailDO.java @@ -0,0 +1,141 @@ +package com.gkhy.safePlatform.incidentManage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; +import java.util.List; + +@TableName("accident_express") +public class AccidentExpressInfoDetailDO{ + + @TableId(type = IdType.AUTO) + private Long id; + + private String emergencyPrecautions; + + private String accidentCausesPreliminaryAnalysis; + + private String accidentBriefProcess; + + private Boolean casualties; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + private List<AccidentExpressFileInfoDO> fileList; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public String getEmergencyPrecautions() { + return emergencyPrecautions; + } + + public void setEmergencyPrecautions(String emergencyPrecautions) { + this.emergencyPrecautions = emergencyPrecautions; + } + + public String getAccidentCausesPreliminaryAnalysis() { + return accidentCausesPreliminaryAnalysis; + } + + public void setAccidentCausesPreliminaryAnalysis(String accidentAusessPreliminaryAnalysis) { + this.accidentCausesPreliminaryAnalysis = accidentAusessPreliminaryAnalysis; + } + + public String getAccidentBriefProcess() { + return accidentBriefProcess; + } + + public void setAccidentBriefProcess(String accidentBriefProcess) { + this.accidentBriefProcess = accidentBriefProcess; + } + + public Boolean getCasualties() { + return casualties; + } + + public void setCasualties(Boolean casualties) { + this.casualties = casualties; + } + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + public List<AccidentExpressFileInfoDO> getFileList() { + return fileList; + } + + public void setFileList(List<AccidentExpressFileInfoDO> fileList) { + this.fileList = fileList; + } + + @Override + public String toString() { + return "AccidentExpressInfoDetailDO{" + + "id=" + id + + ", emergencyPrecautions='" + emergencyPrecautions + '\'' + + ", accidentCausesPreliminaryAnalysis='" + accidentCausesPreliminaryAnalysis + '\'' + + ", accidentBriefProcess='" + accidentBriefProcess + '\'' + + ", casualties=" + casualties + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + ", fileList=" + fileList + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java new file mode 100644 index 0000000..5d1904c --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentExpressInfoPageDO.java @@ -0,0 +1,107 @@ +package com.gkhy.safePlatform.incidentManage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("accident_express") +public class AccidentExpressInfoPageDO{ + + @TableId(type = IdType.AUTO) + private Long id; + + private Date gmtModitify; + + private Long createUid; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + @Override + public String toString() { + return "AccidentExpressInfo{" + + "id=" + id + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java new file mode 100644 index 0000000..efbc05c --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/enums/AccidentResultCodes.java @@ -0,0 +1,35 @@ +package com.gkhy.safePlatform.incidentManage.enums; + +public enum AccidentResultCodes{ + + ACCIDENT_EXPRESS_NULL("A1001", "事故快报不可为空"), + ACCIDENT_EXPRESS_NOT_EXIST("A1002", "事故快报不存在"), + + + + ERROR("A3000", "未知错误"); + + private String code; + private String desc; + + private AccidentResultCodes(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public String getCode() { + return this.code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return this.desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/exception/AccidentException.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/exception/AccidentException.java new file mode 100644 index 0000000..08ec37c --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/exception/AccidentException.java @@ -0,0 +1,38 @@ + +package com.gkhy.safePlatform.incidentManage.exception; + +import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes; + +public class AccidentException extends RuntimeException { + private String code; + private String message; + + public AccidentException(AccidentResultCodes error) { + super(error.getDesc()); + this.code = error.getCode(); + this.message = error.getDesc(); + } + + public AccidentException(String code, String message) { + super(message); + this.code = code; + this.message = message; + } + + public String getCode() { + return this.code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMessage() { + return this.message; + } + + public void setMessage(String message) { + this.message = message; + } +} + diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressFileReqDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressFileReqDTO.java new file mode 100644 index 0000000..31a860d --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressFileReqDTO.java @@ -0,0 +1,55 @@ +package com.gkhy.safePlatform.incidentManage.model.dto.req; + + +public class AccidentExpressFileReqDTO{ + + private Long id; + + private Long accidentExpressId; + + private String fileUrl; + + private String fileName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getAccidentExpressId() { + return accidentExpressId; + } + + public void setAccidentExpressId(Long accidentExpressId) { + this.accidentExpressId = accidentExpressId; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + @Override + public String toString() { + return "AccidentExpressFileInfo{" + + "id=" + id + + ", accidentExpressId=" + accidentExpressId + + ", fileUrl='" + fileUrl + '\'' + + ", fileName='" + fileName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java new file mode 100644 index 0000000..5231914 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/req/AccidentExpressReqDTO.java @@ -0,0 +1,137 @@ +package com.gkhy.safePlatform.incidentManage.model.dto.req; + +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfoDO; + +import java.util.Date; +import java.util.List; + +public class AccidentExpressReqDTO{ + + private Long id; + + private String emergencyPrecautions; + + private String accidentCausesPreliminaryAnalysis; + + private String accidentBriefProcess; + + private Boolean casualties; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + private List<AccidentExpressFileReqDTO> fileList; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public String getEmergencyPrecautions() { + return emergencyPrecautions; + } + + public void setEmergencyPrecautions(String emergencyPrecautions) { + this.emergencyPrecautions = emergencyPrecautions; + } + + public String getAccidentCausesPreliminaryAnalysis() { + return accidentCausesPreliminaryAnalysis; + } + + public void setAccidentCausesPreliminaryAnalysis(String accidentAusessPreliminaryAnalysis) { + this.accidentCausesPreliminaryAnalysis = accidentAusessPreliminaryAnalysis; + } + + public String getAccidentBriefProcess() { + return accidentBriefProcess; + } + + public void setAccidentBriefProcess(String accidentBriefProcess) { + this.accidentBriefProcess = accidentBriefProcess; + } + + public Boolean getCasualties() { + return casualties; + } + + public void setCasualties(Boolean casualties) { + this.casualties = casualties; + } + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + public List<AccidentExpressFileReqDTO> getFileList() { + return fileList; + } + + public void setFileList(List<AccidentExpressFileReqDTO> fileList) { + this.fileList = fileList; + } + + @Override + public String toString() { + return "AccidentExpressInfoDetailDO{" + + "id=" + id + + ", emergencyPrecautions='" + emergencyPrecautions + '\'' + + ", accidentCausesPreliminaryAnalysis='" + accidentCausesPreliminaryAnalysis + '\'' + + ", accidentBriefProcess='" + accidentBriefProcess + '\'' + + ", casualties=" + casualties + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + ", fileList=" + fileList + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java new file mode 100644 index 0000000..f652867 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressDetailRespDTO.java @@ -0,0 +1,138 @@ +package com.gkhy.safePlatform.incidentManage.model.dto.resp; + + +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfoDO; + +import java.util.Date; +import java.util.List; + +public class AccidentExpressDetailRespDTO{ + + private Long id; + + private String emergencyPrecautions; + + private String accidentCausesPreliminaryAnalysis; + + private String accidentBriefProcess; + + private Boolean casualties; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + private List<AccidentExpressFileRespDTO> fileList; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public String getEmergencyPrecautions() { + return emergencyPrecautions; + } + + public void setEmergencyPrecautions(String emergencyPrecautions) { + this.emergencyPrecautions = emergencyPrecautions; + } + + public String getAccidentCausesPreliminaryAnalysis() { + return accidentCausesPreliminaryAnalysis; + } + + public void setAccidentCausesPreliminaryAnalysis(String accidentAusessPreliminaryAnalysis) { + this.accidentCausesPreliminaryAnalysis = accidentAusessPreliminaryAnalysis; + } + + public String getAccidentBriefProcess() { + return accidentBriefProcess; + } + + public void setAccidentBriefProcess(String accidentBriefProcess) { + this.accidentBriefProcess = accidentBriefProcess; + } + + public Boolean getCasualties() { + return casualties; + } + + public void setCasualties(Boolean casualties) { + this.casualties = casualties; + } + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + public List<AccidentExpressFileRespDTO> getFileList() { + return fileList; + } + + public void setFileList(List<AccidentExpressFileRespDTO> fileList) { + this.fileList = fileList; + } + + @Override + public String toString() { + return "AccidentExpressInfoDetailDO{" + + "id=" + id + + ", emergencyPrecautions='" + emergencyPrecautions + '\'' + + ", accidentCausesPreliminaryAnalysis='" + accidentCausesPreliminaryAnalysis + '\'' + + ", accidentBriefProcess='" + accidentBriefProcess + '\'' + + ", casualties=" + casualties + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + ", fileList=" + fileList + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressFileRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressFileRespDTO.java new file mode 100644 index 0000000..927fdc5 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressFileRespDTO.java @@ -0,0 +1,55 @@ +package com.gkhy.safePlatform.incidentManage.model.dto.resp; + + +public class AccidentExpressFileRespDTO{ + + private Long id; + + private Long accidentExpressId; + + private String fileUrl; + + private String fileName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getAccidentExpressId() { + return accidentExpressId; + } + + public void setAccidentExpressId(Long accidentExpressId) { + this.accidentExpressId = accidentExpressId; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + @Override + public String toString() { + return "AccidentExpressFileInfo{" + + "id=" + id + + ", accidentExpressId=" + accidentExpressId + + ", fileUrl='" + fileUrl + '\'' + + ", fileName='" + fileName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java new file mode 100644 index 0000000..f7ebe06 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentExpressPageRespDTO.java @@ -0,0 +1,103 @@ +package com.gkhy.safePlatform.incidentManage.model.dto.resp; + + +import java.util.Date; +import java.util.List; + +public class AccidentExpressPageRespDTO{ + + private Long id; + + private Date gmtModitify; + + private Long createUid; + + private String accidentCause; + + private Date occurrenceTime; + + private String occurrencePlace; + + private Long accidentDepartmentId; + + private String accidentName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + + public String getAccidentCause() { + return accidentCause; + } + + public void setAccidentCause(String accidentCause) { + this.accidentCause = accidentCause; + } + + public Date getOccurrenceTime() { + return occurrenceTime; + } + + public void setOccurrenceTime(Date occurrenceTime) { + this.occurrenceTime = occurrenceTime; + } + + public String getOccurrencePlace() { + return occurrencePlace; + } + + public void setOccurrencePlace(String occurrencePlace) { + this.occurrencePlace = occurrencePlace; + } + + public Long getAccidentDepartmentId() { + return accidentDepartmentId; + } + + public void setAccidentDepartmentId(Long accidentDepartmentId) { + this.accidentDepartmentId = accidentDepartmentId; + } + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + @Override + public String toString() { + return "AccidentExpressInfo{" + + "id=" + id + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", accidentCause='" + accidentCause + '\'' + + ", occurrenceTime=" + occurrenceTime + + ", occurrencePlace='" + occurrencePlace + '\'' + + ", accidentDepartmentId=" + accidentDepartmentId + + ", accidentName='" + accidentName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/AccidentExpressQuery.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/AccidentExpressQuery.java new file mode 100644 index 0000000..ebd0de0 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/AccidentExpressQuery.java @@ -0,0 +1,21 @@ +package com.gkhy.safePlatform.incidentManage.query; + +public class AccidentExpressQuery { + + private String accidentName; + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + @Override + public String toString() { + return "AccidentExpressQuery{" + + "accidentName='" + accidentName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/db/AccidentExpressDBQuery.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/db/AccidentExpressDBQuery.java new file mode 100644 index 0000000..19955af --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/query/db/AccidentExpressDBQuery.java @@ -0,0 +1,21 @@ +package com.gkhy.safePlatform.incidentManage.query.db; + +public class AccidentExpressDBQuery { + + private String accidentName; + + public String getAccidentName() { + return accidentName; + } + + public void setAccidentName(String accidentName) { + this.accidentName = accidentName; + } + + @Override + public String toString() { + return "AccidentExpressDBQuery{" + + "accidentName='" + accidentName + '\'' + + '}'; + } +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressFileInfoRepository.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressFileInfoRepository.java new file mode 100644 index 0000000..07fd937 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressFileInfoRepository.java @@ -0,0 +1,22 @@ +package com.gkhy.safePlatform.incidentManage.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfoDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +@Repository +public interface AccidentExpressFileInfoRepository extends BaseMapper<AccidentExpressFileInfo> { + + List<AccidentExpressFileInfoDO> selectByAccidentExpressId(@Param("accidentExpressId") Long accidentExpressId); + + void addAccidentExpressFile(AccidentExpressFileInfo accidentExpressFileInfo); + + void deleteAccidentExpressFileByAccidentExpressId(@Param("accidentExpressId") Long accidentExpressId); + + void deleteAccidentExpressFileByIds(List<Long> ids); +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressInfoRepository.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressInfoRepository.java new file mode 100644 index 0000000..cc6c127 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentExpressInfoRepository.java @@ -0,0 +1,26 @@ +package com.gkhy.safePlatform.incidentManage.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoDetailDO; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoPageDO; +import com.gkhy.safePlatform.incidentManage.query.db.AccidentExpressDBQuery; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface AccidentExpressInfoRepository extends BaseMapper<AccidentExpressInfo> { + + List<AccidentExpressInfoPageDO> selectAccidentExpressList(Page<AccidentExpressInfoPageDO> page, @Param("query") AccidentExpressDBQuery accidentExpressDBQuery); + + void addAccidentExpress(AccidentExpressInfo accidentExpressInfo); + + AccidentExpressInfoDetailDO selectAccidentExpressById(@Param("id") Long id); + + void updateAccidentExpress(AccidentExpressInfo accidentExpressInfo); + + void deleteAccidentExpressById(@Param("id") Long id); +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentExpressService.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentExpressService.java new file mode 100644 index 0000000..1786e4d --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentExpressService.java @@ -0,0 +1,24 @@ +package com.gkhy.safePlatform.incidentManage.service; + +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentExpressReqDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressDetailRespDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressPageRespDTO; +import com.gkhy.safePlatform.incidentManage.query.AccidentExpressQuery; + +import java.util.List; + +public interface AccidentExpressService{ + + SearchResultVO<List<AccidentExpressPageRespDTO>> selectAccidentExpressList(PageQuery<AccidentExpressQuery> query); + + ResultVO addAccidentExpress(Long valueOf, AccidentExpressReqDTO AccidentExpressReqDTO); + + ResultVO<AccidentExpressDetailRespDTO> getAccidentExpressById(Long id); + + ResultVO updateAccidentExpress(Long uid, AccidentExpressReqDTO AccidentExpressReqDTO); + + ResultVO batchDeleteAccidentExpress(String ids); +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressFileInfoService.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressFileInfoService.java new file mode 100644 index 0000000..9db6753 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressFileInfoService.java @@ -0,0 +1,19 @@ +package com.gkhy.safePlatform.incidentManage.service.baseService; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfoDO; + +import java.util.List; + + +public interface AccidentExpressFileInfoService extends IService<AccidentExpressFileInfo> { + + List<AccidentExpressFileInfoDO> selectByAccidentExpressId(Long id); + + void addAccidentExpressFile(AccidentExpressFileInfo AccidentExpressFileInfo); + + void deleteAccidentExpressFileByAccidentExpressId(Long accidentExpressId); + + void deleteAccidentExpressFileByIds(List<Long> deleteList); +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressInfoService.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressInfoService.java new file mode 100644 index 0000000..15c4f31 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentExpressInfoService.java @@ -0,0 +1,24 @@ +package com.gkhy.safePlatform.incidentManage.service.baseService; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoDetailDO; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoPageDO; +import com.gkhy.safePlatform.incidentManage.query.db.AccidentExpressDBQuery; + +import java.util.List; + + +public interface AccidentExpressInfoService extends IService<AccidentExpressInfo> { + + List<AccidentExpressInfoPageDO> selectAccidentExpressList(Page<AccidentExpressInfoPageDO> page, AccidentExpressDBQuery AccidentExpressDBQuery); + + void addAccidentExpress(AccidentExpressInfo AccidentExpressInfo); + + AccidentExpressInfoDetailDO selectAccidentExpressById(Long id); + + void updateAccidentExpress(AccidentExpressInfo AccidentExpressInfo); + + void deleteAccidentExpressById(Long teamId); +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressFileInfoServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressFileInfoServiceImpl.java new file mode 100644 index 0000000..68c0f4e --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressFileInfoServiceImpl.java @@ -0,0 +1,41 @@ +package com.gkhy.safePlatform.incidentManage.service.baseService.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressFileInfoDO; +import com.gkhy.safePlatform.incidentManage.repository.AccidentExpressFileInfoRepository; +import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressFileInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("accidentExpressFileInfoService") +public class AccidentExpressFileInfoServiceImpl extends ServiceImpl<AccidentExpressFileInfoRepository, AccidentExpressFileInfo> implements AccidentExpressFileInfoService { + + @Autowired + private AccidentExpressFileInfoRepository accidentExpressFileInfoRepository; + + + @Override + public List<AccidentExpressFileInfoDO> selectByAccidentExpressId(Long id) { + return accidentExpressFileInfoRepository.selectByAccidentExpressId(id); + } + + @Override + public void addAccidentExpressFile(AccidentExpressFileInfo AccidentExpressFileInfo) { + accidentExpressFileInfoRepository.addAccidentExpressFile(AccidentExpressFileInfo); + } + + @Override + public void deleteAccidentExpressFileByAccidentExpressId(Long accidentExpressId) { + accidentExpressFileInfoRepository.deleteAccidentExpressFileByAccidentExpressId(accidentExpressId); + } + + @Override + public void deleteAccidentExpressFileByIds(List<Long> ids) { + accidentExpressFileInfoRepository.deleteAccidentExpressFileByIds(ids); + } + + +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressInfoServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressInfoServiceImpl.java new file mode 100644 index 0000000..a5e5a88 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentExpressInfoServiceImpl.java @@ -0,0 +1,48 @@ +package com.gkhy.safePlatform.incidentManage.service.baseService.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfo; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoDetailDO; +import com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoPageDO; +import com.gkhy.safePlatform.incidentManage.query.db.AccidentExpressDBQuery; +import com.gkhy.safePlatform.incidentManage.repository.AccidentExpressInfoRepository; +import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("AccidentExpressInfoService") +public class AccidentExpressInfoServiceImpl extends ServiceImpl<AccidentExpressInfoRepository, AccidentExpressInfo> implements AccidentExpressInfoService { + + @Autowired + private AccidentExpressInfoRepository accidentExpressInfoRepository; + + @Override + public List<AccidentExpressInfoPageDO> selectAccidentExpressList(Page<AccidentExpressInfoPageDO> page, AccidentExpressDBQuery AccidentExpressDBQuery) { + return accidentExpressInfoRepository.selectAccidentExpressList(page,AccidentExpressDBQuery); + } + + @Override + public void addAccidentExpress(AccidentExpressInfo AccidentExpressInfo) { + accidentExpressInfoRepository.addAccidentExpress(AccidentExpressInfo); + } + + @Override + public AccidentExpressInfoDetailDO selectAccidentExpressById(Long id) { + return accidentExpressInfoRepository.selectAccidentExpressById(id); + } + + @Override + public void updateAccidentExpress(AccidentExpressInfo AccidentExpressInfo) { + accidentExpressInfoRepository.updateAccidentExpress(AccidentExpressInfo); + } + + @Override + public void deleteAccidentExpressById(Long teamId) { + accidentExpressInfoRepository.deleteAccidentExpressById(teamId); + } + + +} diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java new file mode 100644 index 0000000..418db46 --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java @@ -0,0 +1,265 @@ +package com.gkhy.safePlatform.incidentManage.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.commons.enums.ResultCodes; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; +import com.gkhy.safePlatform.commons.utils.StringUtils; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.incidentManage.entity.*; +import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes; +import com.gkhy.safePlatform.incidentManage.exception.AccidentException; +import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentExpressFileReqDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentExpressReqDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressDetailRespDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressFileRespDTO; +import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentExpressPageRespDTO; +import com.gkhy.safePlatform.incidentManage.query.AccidentExpressQuery; +import com.gkhy.safePlatform.incidentManage.query.db.AccidentExpressDBQuery; +import com.gkhy.safePlatform.incidentManage.service.AccidentExpressService; +import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressFileInfoService; +import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service("accidentExpressService") +public class AccidentExpressServiceImpl implements AccidentExpressService { + + @Autowired + private AccidentExpressInfoService accidentExpressInfoService; + + @Autowired + private AccidentExpressFileInfoService accidentExpressFileInfoService; + + + @Override + public SearchResultVO<List<AccidentExpressPageRespDTO>> selectAccidentExpressList(PageQuery<AccidentExpressQuery> query) { + Long pageIndex = query.getPageIndex(); + Long pageSize = query.getPageSize(); + Page<AccidentExpressInfoPageDO> page = new Page<>(pageIndex, pageSize); + + AccidentExpressDBQuery accidentExpressDBQuery = new AccidentExpressDBQuery(); + if (query.getSearchParams() != null) { + BeanUtils.copyProperties(query.getSearchParams(), accidentExpressDBQuery); + } + + + List<AccidentExpressInfoPageDO> accidentExpressInfoPageDOList = accidentExpressInfoService.selectAccidentExpressList(page, accidentExpressDBQuery); + List<AccidentExpressPageRespDTO> respList = BeanCopyUtils.copyBeanList(accidentExpressInfoPageDOList, AccidentExpressPageRespDTO.class); + + return new SearchResultVO<>( + true, + pageIndex, + pageSize, + page.getTotal(), + respList, + ResultCodes.OK + ); + } + + @Override + public ResultVO addAccidentExpress(Long uid, AccidentExpressReqDTO accidentExpressReqDTO) { + //必填项验证 + checkRequired(accidentExpressReqDTO); + + Date nowDate = new Date(); + //1.新增应急队伍 + AccidentExpressInfo accidentExpressInfo = new AccidentExpressInfo(); + BeanUtils.copyProperties(accidentExpressReqDTO, accidentExpressInfo); + accidentExpressInfo.setDelFlag(false); + accidentExpressInfo.setCreateUid(uid); + accidentExpressInfo.setGmtCreate(nowDate); + accidentExpressInfoService.addAccidentExpress(accidentExpressInfo); + //2.新增应急队伍附件 + if (!CollectionUtils.isEmpty(accidentExpressReqDTO.getFileList())){ + addAccidentExpressFile(accidentExpressInfo.getId(),uid,nowDate,accidentExpressReqDTO.getFileList()); + } + return new ResultVO(ResultCodes.OK); + } + + private void addAccidentExpressFile(Long accidentExpressId ,Long uid , Date nowDate , List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList){ + List<AccidentExpressFileInfo> fileInfoList = BeanCopyUtils.copyBeanList(AccidentExpressFileReqDTOList, AccidentExpressFileInfo.class); + fileInfoList.forEach(AccidentExpressFileInfo -> { + AccidentExpressFileInfo.setAccidentExpressId(accidentExpressId); + AccidentExpressFileInfo.setDelFlag(false); + AccidentExpressFileInfo.setCreateUid(uid); + AccidentExpressFileInfo.setGmtCreate(nowDate); + }); + for (AccidentExpressFileInfo AccidentExpressFileInfo :fileInfoList){ + accidentExpressFileInfoService.addAccidentExpressFile(AccidentExpressFileInfo); + } + } + + @Override + public ResultVO<AccidentExpressDetailRespDTO> getAccidentExpressById(Long id) { + AccidentExpressDetailRespDTO AccidentExpressDetailRespDTO = new AccidentExpressDetailRespDTO(); + //查询是否存在 + AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(id); + if (AccidentExpressInfoDetailDO==null){ + throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST); + }else{ + BeanUtils.copyProperties(AccidentExpressInfoDetailDO,AccidentExpressDetailRespDTO); + //查找对应的附件 + List<AccidentExpressFileInfoDO> AccidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(id); + if (!CollectionUtils.isEmpty(AccidentExpressFileInfoDOList)){ + List<AccidentExpressFileRespDTO> accidentExpressFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentExpressFileInfoDOList , AccidentExpressFileRespDTO.class); + AccidentExpressDetailRespDTO.setFileList(accidentExpressFileRespDTOList); + } + return new ResultVO<>(ResultCodes.OK ,AccidentExpressDetailRespDTO); + } + } + + @Override + public ResultVO updateAccidentExpress(Long uid, AccidentExpressReqDTO accidentExpressReqDTO) { + Date nowDate = new Date(); + //查询是否存在 + AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(accidentExpressReqDTO.getId()); + if (AccidentExpressInfoDetailDO==null){ + throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST); + }else{ + AccidentExpressInfo accidentExpressInfo = new AccidentExpressInfo(); + BeanUtils.copyProperties(accidentExpressReqDTO,accidentExpressInfo); + accidentExpressInfo.setUpdateUid(uid); + accidentExpressInfo.setGmtModitify(nowDate); + accidentExpressInfoService.updateAccidentExpress(accidentExpressInfo); + //修改应急队伍附件 + updateAccidentExpressFile(uid,accidentExpressReqDTO.getId(),nowDate,accidentExpressReqDTO.getFileList()); + return new ResultVO(ResultCodes.OK); + } + } + + private void updateAccidentExpressFile(Long uid ,Long accidentExpressId ,Date nowDate,List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList){ + + List<AccidentExpressFileInfoDO> accidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(accidentExpressId); + List<Long> oldIdsList = accidentExpressFileInfoDOList.stream().map(AccidentExpressFileInfoDO::getId).collect(Collectors.toList()); + List<Long> newIdsList = new ArrayList<>(); + + //新增的附件集合 + List<AccidentExpressFileInfo> addList = new ArrayList<>(); + //删除的附件集合(id) + List<Long> deleteList = new ArrayList<>(); + for (AccidentExpressFileReqDTO AccidentExpressFileReqDTO : AccidentExpressFileReqDTOList){ + //如果不存在id则表示页面新增的附件 + if (AccidentExpressFileReqDTO.getId() == null){ + AccidentExpressFileInfo AccidentExpressFileInfo = new AccidentExpressFileInfo(); + BeanUtils.copyProperties(AccidentExpressFileReqDTO,AccidentExpressFileInfo); + AccidentExpressFileInfo.setDelFlag(false); + AccidentExpressFileInfo.setGmtCreate(nowDate); + AccidentExpressFileInfo.setCreateUid(uid); + AccidentExpressFileInfo.setAccidentExpressId(accidentExpressId); + addList.add(AccidentExpressFileInfo); + } + //如果存在id则判断页面是否删除 + else{ + newIdsList.add(AccidentExpressFileReqDTO.getId()); + } + } + for (Long oldId : oldIdsList){ + if (!newIdsList.contains(oldId)){ + deleteList.add(oldId); + } + } + if (!CollectionUtils.isEmpty(addList)){ + for (AccidentExpressFileInfo AccidentExpressFileInfo : addList){ + accidentExpressFileInfoService.addAccidentExpressFile(AccidentExpressFileInfo); + } + } + if (!CollectionUtils.isEmpty(deleteList)){ + accidentExpressFileInfoService.deleteAccidentExpressFileByIds(deleteList); + } + } + + + @Override + public ResultVO batchDeleteAccidentExpress(String ids) { + if (StringUtils.isBlank(ids)){ + throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NULL); + }else{ + String[] idArr = ids.split(","); + for (String id : idArr) { + deleteAccidentExpress(Long.valueOf(id)); + } + return new ResultVO(ResultCodes.OK); + } + } + + private void deleteAccidentExpress(Long id) { + //查询是否存在 + AccidentExpressInfoDetailDO AccidentExpressInfoDetailDO = accidentExpressInfoService.selectAccidentExpressById(id); + if (AccidentExpressInfoDetailDO==null){ + throw new AccidentException(AccidentResultCodes.ACCIDENT_EXPRESS_NOT_EXIST); + }else{ + accidentExpressInfoService.deleteAccidentExpressById(id); + //删除附件 + accidentExpressFileInfoService.deleteAccidentExpressFileByAccidentExpressId(id); + } + } + + + + + /** + * 验证必填项 + * @return + */ + private void checkRequired(AccidentExpressReqDTO AccidentExpressReqDTO) { + /* //名称 + if (StringUtils.isBlank(AccidentExpressReqDTO.getTeamName())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_NAME_NULL); + } + //级别 + if (StringUtils.isBlank(AccidentExpressReqDTO.getTeamLevel())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_LEVEL_NULL); + } + //负责人 + if (AccidentExpressReqDTO.getPrincipalUid() == null || AccidentExpressReqDTO.getPrincipalUid() == 0) { + throw new EmergencyException(EmergencyResultCodes.TEAM_PRINCIPAL_NULL); + } + //负责人部门 + if (AccidentExpressReqDTO.getPrincipalDepartmentId() == null || AccidentExpressReqDTO.getPrincipalDepartmentId() == 0) { + throw new EmergencyException(EmergencyResultCodes.TEAM_PRINCIPAL_DEPARTMENT_NULL); + } + //负责人手机 + if (StringUtils.isBlank(AccidentExpressReqDTO.getPrincipalPhone())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_PRINCIPAL_PHONE_NULL); + } + //固定电话 + if (StringUtils.isBlank(AccidentExpressReqDTO.getTelephoneNumber())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_TELEPHONE_NUMBER_NULL); + } + //人员列表如果不为空,则需要验证其中的必填项 + if (!CollectionUtils.isEmpty(AccidentExpressReqDTO.getMemberList())){ + for(AccidentExpressMemberReqDTO AccidentExpressMemberReqDTO : AccidentExpressReqDTO.getMemberList()){ + //工号 + if (StringUtils.isBlank(AccidentExpressMemberReqDTO.getJobNumber())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_USER_JOB_NUMBER_NULL); + } + //名称 + if (StringUtils.isBlank(AccidentExpressMemberReqDTO.getName())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_USER_NAME_NULL); + } + //性别 + if (AccidentExpressMemberReqDTO.getGender()==null) { + throw new EmergencyException(EmergencyResultCodes.TEAM_USER_GENDER_NULL); + } + //手机号码 + if (StringUtils.isBlank(AccidentExpressMemberReqDTO.getPhone())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_USER_PHONE_NULL); + } + //职务 + if (StringUtils.isBlank(AccidentExpressMemberReqDTO.getPosition())) { + throw new EmergencyException(EmergencyResultCodes.TEAM_USER_POSITION_NULL); + } + } + }*/ + } + +} diff --git a/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentExpressInfoMapper.xml b/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentExpressInfoMapper.xml new file mode 100644 index 0000000..614dd2e --- /dev/null +++ b/incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentExpressInfoMapper.xml @@ -0,0 +1,13 @@ +<?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.gkhy.safePlatform.goalManage.entity.TestTable"> + + <resultMap id="TestTableMap" type="com.gkhy.safePlatform.goalManage.entity.TestTable"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result property="title" column="title"/> + </resultMap> + + +</mapper> -- Gitblit v1.9.2