2022-07-19 | songhuangfeng123 | ![]() |
2022-07-19 | songhuangfeng123 | ![]() |
2022-07-19 | SZH | ![]() |
2022-07-19 | songhuangfeng123 | ![]() |
2022-07-19 | SZH | ![]() |
incident-manage/incident-manage-rpc-api/pom.xml
对比新文件 @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>incident-manage</artifactId> <groupId>com.gkhy.safePlatfrom</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>incident-manage-rpc-api</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> </project> incident-manage/incident-manage-rpc-provider/pom.xml
对比新文件 @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>incident-manage</artifactId> <groupId>com.gkhy.safePlatfrom</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>incident-manage-rpc-provider</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> </project> incident-manage/incident-manage-service/pom.xml
对比新文件 @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>incident-manage</artifactId> <groupId>com.gkhy.safePlatfrom</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>incident-manage-service</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> </project> 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); } } 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 + '\'' + '}'; } } 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 + '\'' + '}'; } } 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 + '\'' + '}'; } } 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 + '}'; } } 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 + '\'' + '}'; } } 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; } } 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; } } 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 + '\'' + '}'; } } 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 + '}'; } } 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 + '}'; } } 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 + '\'' + '}'; } } 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 + '\'' + '}'; } } 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 + '\'' + '}'; } } 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 + '\'' + '}'; } } 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); } 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); } 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); } 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); } 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); } 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); } } 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); } } 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); } } }*/ } } 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> incident-manage/pom.xml
对比新文件 @@ -0,0 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>safe-platform</artifactId> <groupId>com.gkhy.safePlatfrom</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>incident-manage</artifactId> <packaging>pom</packaging> <modules> <module>incident-manage-service</module> <module>incident-manage-rpc-api</module> <module>incident-manage-rpc-provider</module> </modules> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> </project> pom.xml
@@ -15,6 +15,7 @@ <module>emergency/emergency-service</module> <module>emergency/emergency-rpc-provider</module> <module>safePlatfrom-out-web</module> <module>incident-manage</module> </modules> <properties> @@ -31,6 +32,10 @@ <guava.version>31.1-jre</guava.version> <account.rpc.model.version>1.0-SNAPSHOT</account.rpc.model.version> <mybatis.plus.version>3.5.2</mybatis.plus.version> <jta.starter.version>2.7.1</jta.starter.version> <rocketmq.starter.version>2.2.2</rocketmq.starter.version> <redission.version>3.17.4</redission.version> <com.alibaba.cloud.version>2.2.8.RELEASE</com.alibaba.cloud.version> </properties> <parent> @@ -100,7 +105,36 @@ <artifactId>mybatis-plus-extension</artifactId> <version>${mybatis.plus.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jta-atomikos</artifactId> <version>${jta.starter.version}</version> </dependency> <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-spring-boot</artifactId> <version>${rocketmq.starter.version}</version> </dependency> <dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-boot-starter</artifactId> <version>${redission.version}</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <version>${com.alibaba.cloud.version}</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> <version>3.1.3</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <version>${com.alibaba.cloud.version}</version> </dependency> </dependencies> </dependencyManagement> @@ -194,6 +228,18 @@ <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> </dependency> <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-spring-boot</artifactId> </dependency> <dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jta-atomikos</artifactId> </dependency> <!-- 安全平台业务组件 --> <dependency> safePlatfrom-out-web/pom.xml
@@ -38,7 +38,29 @@ <artifactId>goal-manage-rpc-provider</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>com.gkhy.safePlatfrom</groupId> <artifactId>incident-manage-service</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>com.gkhy.safePlatfrom</groupId> <artifactId>incident-manage-rpc-provider</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <version>2021.0.1.0</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> </dependencies> safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java
@@ -15,23 +15,18 @@ @Configuration public class DataSourceConfig { @Bean @ConfigurationProperties("spring.datasource.goalmanage") DataSource dsGoalManage(){ return DruidDataSourceBuilder.create().build(); } @Bean @ConfigurationProperties("spring.datasource.emergency") DataSource dsEmergency(){ return DruidDataSourceBuilder.create().build(); } // @Bean // @ConfigurationProperties("spring.datasource.two") // DataSource dsTwo(){ // @ConfigurationProperties("spring.datasource.goalmanage") // DataSource dsGoalManage(){ // return DruidDataSourceBuilder.create().build(); // } // // @Bean // @ConfigurationProperties("spring.datasource.emergency") // DataSource dsEmergency(){ // return DruidDataSourceBuilder.create().build(); // } safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java
对比新文件 @@ -0,0 +1,165 @@ package com.gkhy.safePlatform.config.database; import com.alibaba.druid.filter.stat.StatFilter; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support.http.WebStatFilter; import com.alibaba.druid.wall.WallConfig; import com.alibaba.druid.wall.WallFilter; import com.atomikos.icatch.jta.UserTransactionImp; import com.atomikos.icatch.jta.UserTransactionManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.transaction.jta.JtaTransactionManager; import javax.sql.DataSource; import javax.transaction.UserTransaction; import java.util.Properties; /** * Druid配置 * * */ @Component @Configuration public class DruidConfig { @Value("${spring.datasource.type}") private String datasourceClass; @Bean(name = "dsGoalManage") @Primary @Autowired public DataSource dsAccount(Environment env) { AtomikosDataSourceBean ds = new AtomikosDataSourceBean(); Properties prop = build(env, "spring.datasource.goalmanage."); // ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource"); ds.setXaDataSourceClassName(datasourceClass); ds.setUniqueResourceName("goalmanage"); ds.setPoolSize(2); ds.setXaProperties(prop); return ds; } @Autowired @Primary @Bean(name = "dsEmergency") public AtomikosDataSourceBean dsDoublePrevent(Environment env) { AtomikosDataSourceBean ds = new AtomikosDataSourceBean(); Properties prop = build(env, "spring.datasource.emergency."); // ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource"); ds.setXaDataSourceClassName(datasourceClass); ds.setUniqueResourceName("emergency"); ds.setPoolSize(2); ds.setXaProperties(prop); return ds; } @Autowired @Primary @Bean(name = "dsIncidentManage") public AtomikosDataSourceBean dsSafeCheck(Environment env) { AtomikosDataSourceBean ds = new AtomikosDataSourceBean(); Properties prop = build(env, "spring.datasource.incidentmanage."); ds.setXaDataSourceClassName(datasourceClass); // ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource"); ds.setUniqueResourceName("incidentmanage"); ds.setPoolSize(2); ds.setXaProperties(prop); return ds; } /** * 注入事物管理器 * @return */ @Bean(name = "xatx") public JtaTransactionManager regTransactionManager () { UserTransactionManager userTransactionManager = new UserTransactionManager(); UserTransaction userTransaction = new UserTransactionImp(); return new JtaTransactionManager(userTransaction, userTransactionManager); } private Properties build(Environment env, String prefix) { Properties prop = new Properties(); prop.put("url", env.getProperty(prefix + "url")); prop.put("username", env.getProperty(prefix + "username")); prop.put("password", env.getProperty(prefix + "password")); prop.put("driverClassName", env.getProperty(prefix + "driver-class-name", "")); // prop.put("initialSize", env.getProperty(prefix + "initialSize", Integer.class)); // prop.put("maxActive", env.getProperty(prefix + "maxActive", Integer.class)); // prop.put("minIdle", env.getProperty(prefix + "minIdle", Integer.class)); // prop.put("maxWait", env.getProperty(prefix + "maxWait", Integer.class)); // prop.put("poolPreparedStatements", env.getProperty(prefix + "poolPreparedStatements", Boolean.class)); // // prop.put("maxPoolPreparedStatementPerConnectionSize", // env.getProperty(prefix + "maxPoolPreparedStatementPerConnectionSize", Integer.class)); // // prop.put("maxPoolPreparedStatementPerConnectionSize", // env.getProperty(prefix + "maxPoolPreparedStatementPerConnectionSize", Integer.class)); // prop.put("validationQuery", env.getProperty(prefix + "validationQuery")); // prop.put("validationQueryTimeout", env.getProperty(prefix + "validationQueryTimeout", Integer.class)); // prop.put("testOnBorrow", env.getProperty(prefix + "testOnBorrow", Boolean.class)); // prop.put("testOnReturn", env.getProperty(prefix + "testOnReturn", Boolean.class)); // prop.put("testWhileIdle", env.getProperty(prefix + "testWhileIdle", Boolean.class)); // prop.put("timeBetweenEvictionRunsMillis", // env.getProperty(prefix + "timeBetweenEvictionRunsMillis", Integer.class)); // prop.put("minEvictableIdleTimeMillis", env.getProperty(prefix + "minEvictableIdleTimeMillis", Integer.class)); // prop.put("filters", env.getProperty(prefix + "filters")); return prop; } // @Bean public ServletRegistrationBean druidServlet() { ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*"); //控制台管理用户,加入下面2行 进入druid后台就需要登录 //servletRegistrationBean.addInitParameter("loginUsername", "admin"); //servletRegistrationBean.addInitParameter("loginPassword", "admin"); return servletRegistrationBean; } // @Bean public FilterRegistrationBean filterRegistrationBean() { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(new WebStatFilter()); filterRegistrationBean.addUrlPatterns("/*"); filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); filterRegistrationBean.addInitParameter("profileEnable", "true"); return filterRegistrationBean; } // @Bean public StatFilter statFilter(){ StatFilter statFilter = new StatFilter(); statFilter.setLogSlowSql(true); //slowSqlMillis用来配置SQL慢的标准,执行时间超过slowSqlMillis的就是慢。 statFilter.setMergeSql(true); //SQL合并配置 statFilter.setSlowSqlMillis(1000);//slowSqlMillis的缺省值为3000,也就是3秒。 return statFilter; } // @Bean public WallFilter wallFilter(){ WallFilter wallFilter = new WallFilter(); //允许执行多条SQL WallConfig config = new WallConfig(); config.setMultiStatementAllow(true); wallFilter.setConfig(config); return wallFilter; } } safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java
@@ -23,7 +23,7 @@ import java.util.Arrays; @Configuration @MapperScan(basePackages = {"com.gkhy.safePlatform.emergency","com.gkhy.safePlatform.emergency"}, @MapperScan(basePackages = {"com.gkhy.safePlatform.emergency"}, sqlSessionTemplateRef = "sqlTemplateEmergency",annotationClass = Repository.class) public class MyBatisConfigEmergency { @@ -50,7 +50,7 @@ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); //------------------- Resource[] rs1 = resolver.getResources("classpath*:config/mapper/emergency/**Mapper.xml"); Resource[] rs1 = resolver.getResources("classpath*:config/mapper/emergency/**/**Mapper.xml"); // Resource[] rs2 = resolver.getResources("classpath*:config/mapper/goalManage/**Mapper.xml"); ArrayList<Resource> resourceArrayList = new ArrayList<>(Arrays.asList(rs1)); // resourceArrayList.addAll(new ArrayList<>(Arrays.asList(rs2))); safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigGoalManage.java
@@ -50,7 +50,7 @@ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); //------------------- Resource[] rs1 = resolver.getResources("classpath*:config/mapper/goalManage/**Mapper.xml"); Resource[] rs1 = resolver.getResources("classpath*:config/mapper/goalManage/**/**Mapper.xml"); // Resource[] rs2 = resolver.getResources("classpath*:config/mapper/goalManage/**Mapper.xml"); ArrayList<Resource> resourceArrayList = new ArrayList<>(Arrays.asList(rs1)); // resourceArrayList.addAll(new ArrayList<>(Arrays.asList(rs2))); safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigIncidentManage.java
对比新文件 @@ -0,0 +1,75 @@ package com.gkhy.safePlatform.config.database; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.stereotype.Repository; import javax.sql.DataSource; import java.util.ArrayList; import java.util.Arrays; @Configuration @MapperScan(basePackages = {"com.gkhy.safePlatform.incidentManage"}, sqlSessionTemplateRef = "sqlTemplateIncidentManage",annotationClass = Repository.class) public class MyBatisConfigIncidentManage { @Autowired @Qualifier("dsIncidentManage") DataSource dsIncidentManage; @Autowired private MybatisPlusInterceptor mybatisPlusInterceptor; @Bean(name = "dataSourceIncidentManage") @ConfigurationProperties(prefix = "spring.datasource.incidentmanage") public DruidDataSource dataSourceIncidentManage(){ return DruidDataSourceBuilder.create().build(); } @Bean(name = "sqlFactoryIncidentManage") public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSourceIncidentManage") DruidDataSource dataSource) throws Exception { MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); factoryBean.setDataSource(dataSource); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); //------------------- Resource[] rs1 = resolver.getResources("classpath*:config/mapper/incidentManage/**/**Mapper.xml"); // Resource[] rs2 = resolver.getResources("classpath*:config/mapper/incidentManage/**Mapper.xml"); ArrayList<Resource> resourceArrayList = new ArrayList<>(Arrays.asList(rs1)); // resourceArrayList.addAll(new ArrayList<>(Arrays.asList(rs2))); Resource[] resourceArray = new Resource[resourceArrayList.size()]; resourceArrayList.toArray(resourceArray); factoryBean.setMapperLocations(resourceArray); //------------------- // factoryBean.setMapperLocations(resolver.getResources("classpath*:config/mapper/**/**Mapper.xml")); //设置分页插件 Interceptor[] plugins = {mybatisPlusInterceptor}; factoryBean.setPlugins(plugins); return factoryBean.getObject(); } @Bean(name = "sqlTemplateIncidentManage") public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlFactoryIncidentManage") SqlSessionFactory sqlSessionFactory) { return new SqlSessionTemplate(sqlSessionFactory); } } safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/minioDemo/config/MinioConfig.java
对比新文件 @@ -0,0 +1,90 @@ package com.gkhy.safePlatform.minioDemo.config; import io.minio.MinioClient; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "minio") public class MinioConfig { private String endpoint; private int port; private String accessKey; private String secretKey; private Boolean secure; private String bucketName; private String urlPrefix; @Bean public MinioClient getMinioClient(){ String endpointUrl = "http://"+endpoint+":"+port; MinioClient minioClient = MinioClient.builder().endpoint(endpointUrl) .credentials(accessKey,secretKey) .build(); return minioClient; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getAccessKey() { return accessKey; } public void setAccessKey(String accessKey) { this.accessKey = accessKey; } public String getSecretKey() { return secretKey; } public void setSecretKey(String secretKey) { this.secretKey = secretKey; } public Boolean getSecure() { return secure; } public void setSecure(Boolean secure) { this.secure = secure; } public String getBucketName() { return bucketName; } public void setBucketName(String bucketName) { this.bucketName = bucketName; } public String getUrlPrefix() { return urlPrefix; } public void setUrlPrefix(String urlPrefix) { this.urlPrefix = urlPrefix; } } safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/minioDemo/controller/MinioTest.java
对比新文件 @@ -0,0 +1,31 @@ package com.gkhy.safePlatform.minioDemo.controller; import com.gkhy.safePlatform.minioDemo.service.MinioAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping(value = "/test/file") public class MinioTest { @Autowired private MinioAccessService minioAccessService; @RequestMapping(value = "/up",method = RequestMethod.GET) private Object testFileUpload(){ return minioAccessService.uploadFile(); } @RequestMapping(value = "/assume",method = RequestMethod.GET) public Object testMinioSts(String obj){ return minioAccessService.getObjectUrl(obj); } @RequestMapping(value = "/put/presign",method = RequestMethod.GET) public Object getPutObjectUrl(String obj){ return minioAccessService.getPutUrl(obj); } } safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/minioDemo/service/MinioAccessService.java
对比新文件 @@ -0,0 +1,128 @@ package com.gkhy.safePlatform.minioDemo.service; import com.gkhy.safePlatform.minioDemo.config.MinioConfig; import io.minio.BucketExistsArgs; import io.minio.GetPresignedObjectUrlArgs; import io.minio.MinioClient; import io.minio.UploadObjectArgs; import io.minio.errors.*; import io.minio.http.Method; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.IOException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; @Service public class MinioAccessService { @Resource private MinioConfig minioConfig; @Autowired private MinioClient minioClient; public Object uploadFile(){ try { boolean bucketCheck = minioClient.bucketExists(BucketExistsArgs.builder() .bucket(minioConfig.getBucketName()).build()); if(bucketCheck == true){ minioClient.uploadObject(UploadObjectArgs.builder().bucket(minioConfig.getBucketName()) .object("1.b3dm") .filename("G:\\b3dm\\b3dm60\\Tile_+000_+004\\Tile_+000_+004.b3dm") .build()); System.out.println("上传成功"); } } catch (ServerException e) { e.printStackTrace(); } catch (InsufficientDataException e) { e.printStackTrace(); } catch (ErrorResponseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (InvalidResponseException e) { e.printStackTrace(); } catch (XmlParserException e) { e.printStackTrace(); } catch (InternalException e) { e.printStackTrace(); } return "1"; } public String getObjectUrl(String objectName){ String url = null; try { url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket(minioConfig.getBucketName()) .object(objectName) .expiry(60).build()); } catch (ErrorResponseException e) { e.printStackTrace(); } catch (InsufficientDataException e) { e.printStackTrace(); } catch (InternalException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (InvalidResponseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (XmlParserException e) { e.printStackTrace(); } catch (ServerException e) { e.printStackTrace(); } return url; } public String getPutUrl(String objName){ String url = null; try { Map<String, String> reqParams = new HashMap<>(); reqParams.put("response-content-type", "application/json"); url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder() .method(Method.PUT) .bucket(minioConfig.getBucketName()) .object(objName) .expiry(60*2) .extraQueryParams(reqParams) .build()); } catch (ErrorResponseException e) { e.printStackTrace(); } catch (InsufficientDataException e) { e.printStackTrace(); } catch (InternalException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (InvalidResponseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (XmlParserException e) { e.printStackTrace(); } catch (ServerException e) { e.printStackTrace(); } return url; } } safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
@@ -8,16 +8,25 @@ # mysql spring: jta: transaction-manager-id: txManager datasource: type: com.alibaba.druid.pool.xa.DruidXADataSource emergency: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource goalmanage: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource incidentmanage: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource @@ -27,14 +36,33 @@ password: SEF98uvs98dUAUEF90Udssa database: 0 # Redis 数据库号,默认为 0 timeout: 15000 # Redis 连接超时时间,单位:毫秒。 lettuce: pool: max-active: 4 max-idle: 4 # 对应 RedisProperties.Jedis 内部类 jedis: pool: max-active: 8 # 连接池最大连接数,默认为 8 。使用负数表示没有限制 同一时间最大只能执行8条sql语句,每执行一条语句就会建立一个连接 max-idle: 8 # 默认连接数最大空闲的连接数,默认为 8 。使用负数表示没有限制。 max-active: 4 # 连接池最大连接数,默认为 8 。使用负数表示没有限制 同一时间最大只能执行8条sql语句,每执行一条语句就会建立一个连接 max-idle: 4 # 默认连接数最大空闲的连接数,默认为 8 。使用负数表示没有限制。 min-idle: 0 # 默认连接池最小空闲的连接数,默认为 0 。允许设置 0 和 正数。 max-wait: -1 cloud: nacos: discovery: # server-addr: nacos://121.239.169.27:18848?username=nacos&password=guokehongyu # server-addr: 192.168.0.52:8848?namespace=e07a2454-136b-4498-99eb-09dae3336ebe&username=gkhy_team_safeplatform_dev&password=nacosadmin server-addr: http://192.168.0.52:8848 namespace: e07a2454-136b-4498-99eb-09dae3336ebe username: gkhy_safeplatform_out password: 9485uyJHISes09t enabled: true register-enabled: true config: server-addr: http://192.168.0.52:8848 namespace: e07a2454-136b-4498-99eb-09dae3336ebe username: gkhy_safeplatform_out password: 9485uyJHISes09t mybatis-plus: configuration: @@ -59,14 +87,26 @@ # 取消服务启动检查 check: false rocketmq: name-server: 192.168.0.52:9876 producer: group: gkhy-safeplatform-dev sendMessageTimeout: 300000 consumer: group: gkhy-safeplatform-out-dev topic: demoTopic: gkhy-safeplatform-topic-demo minio: endPoint: 192.168.0.52 port: 9001 accessKey: kH6eiQtNrWqGNb1r secretKey: ff5ykVUJJn0hi5PghsitdGNSsrW0Xrju port: 9000 accessKey: oddER8eSv211WVG3 secretKey: TeaEh8eWNhBbjCYK3G6cIX2QGYECwo7M secure: false bucketName: szh-stu bucketName: safeplatform-dev urlPrefix: http://192.168.0.52/file #用户名 gkhy_team_out_dev #密码 12345678 token: safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml
@@ -8,16 +8,25 @@ # mysql spring: jta: transaction-manager-id: txManager datasource: type: com.alibaba.druid.pool.xa.DruidXADataSource emergency: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource goalmanage: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource incidentmanage: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: gkhy_dev_out_team password: Adsdf675T6AC7yga type: com.alibaba.druid.pool.DruidDataSource @@ -27,14 +36,33 @@ password: SEF98uvs98dUAUEF90Udssa database: 0 # Redis 数据库号,默认为 0 timeout: 15000 # Redis 连接超时时间,单位:毫秒。 lettuce: pool: max-active: 4 max-idle: 4 # 对应 RedisProperties.Jedis 内部类 jedis: pool: max-active: 8 # 连接池最大连接数,默认为 8 。使用负数表示没有限制 同一时间最大只能执行8条sql语句,每执行一条语句就会建立一个连接 max-idle: 8 # 默认连接数最大空闲的连接数,默认为 8 。使用负数表示没有限制。 max-active: 4 # 连接池最大连接数,默认为 8 。使用负数表示没有限制 同一时间最大只能执行8条sql语句,每执行一条语句就会建立一个连接 max-idle: 4 # 默认连接数最大空闲的连接数,默认为 8 。使用负数表示没有限制。 min-idle: 0 # 默认连接池最小空闲的连接数,默认为 0 。允许设置 0 和 正数。 max-wait: -1 cloud: nacos: discovery: # server-addr: nacos://121.239.169.27:18848?username=nacos&password=guokehongyu # server-addr: 192.168.0.52:8848?namespace=e07a2454-136b-4498-99eb-09dae3336ebe&username=gkhy_team_safeplatform_dev&password=nacosadmin server-addr: http://192.168.0.52:8848 namespace: 11ee8fe9-ea10-4f63-9752-c33c7ac36e36 username: gkhy_safeplatform_out password: 9485uyJHISes09t enabled: true register-enabled: true config: server-addr: http://192.168.0.52:8848 namespace: 11ee8fe9-ea10-4f63-9752-c33c7ac36e36 username: gkhy_safeplatform_out password: 9485uyJHISes09t mybatis-plus: configuration: @@ -59,14 +87,26 @@ # 取消服务启动检查 check: false rocketmq: name-server: 192.168.0.52:9876 producer: group: gkhy-safeplatform-dev sendMessageTimeout: 300000 consumer: group: gkhy-safeplatform-out-dev topic: demoTopic: gkhy-safeplatform-topic-demo minio: endPoint: 192.168.0.52 port: 9001 accessKey: kH6eiQtNrWqGNb1r secretKey: ff5ykVUJJn0hi5PghsitdGNSsrW0Xrju port: 9000 accessKey: oddER8eSv211WVG3 secretKey: TeaEh8eWNhBbjCYK3G6cIX2QGYECwo7M secure: false bucketName: szh-stu bucketName: safeplatform-dev urlPrefix: http://192.168.0.52/file #用户名 gkhy_team_out_dev #密码 12345678 token: safePlatfrom-out-web/src/main/resources/config/application.yaml
@@ -5,10 +5,12 @@ # active: prod active: out-dev mybatis-plus: mapper-locations: classpath:config/mapper/**/*.xml #mybatis-plus: # mapper-locations: classpath:config/mapper/**/*.xml logging: config: classpath:config/log/log4j2.xml level: com.gkhy: info com.atomikos: ERROR javax.transaction: ERROR