Compare commits

..

No commits in common. "e6cd88d54abb392a4abd977959676abcce439d13" and "21a7364a3601dfa4befb56358105342ebe7b7bb0" have entirely different histories.

23 changed files with 140 additions and 399 deletions

View File

@ -20,18 +20,9 @@
<artifactId>zcloud_gbscommon</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.jjb.saas</groupId>
<artifactId>jjb-saas-system-client</artifactId>
<version>1.7.0-SNAPSHOT</version>
</dependency>
<!--Project modules-->
<dependency>
<groupId>com.zcloud.accident</groupId>

View File

@ -1,11 +1,7 @@
package com.zcloud.accident;
import com.jjb.saas.base.starter.bootstart.JJBSpringbootApplication;
import com.jjb.saas.framework.event.consumer.EnableConsumer;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;
/**
* Spring Boot Starter

View File

@ -4,5 +4,3 @@ spring:
- classpath:nacos.yml
- classpath:sdk.yml
- classpath:swagger.yml
server:
port: 8085

View File

@ -20,7 +20,7 @@ spring:
file-extension: yml
shared-configs:
- config-common.yml
# - config-port.yml
- config-port.yml
- config-mq.yml
- config-log.yml
- config-sdk-server.yml

View File

@ -17,6 +17,10 @@
<groupId>com.jjb.saas</groupId>
<artifactId>jjb-saas-framework-adapter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
</dependency>
<dependency>
<groupId>com.zcloud.accident</groupId>

View File

@ -1,15 +1,14 @@
package com.zcloud.accident.web;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.jjb.saas.framework.event.producer.RemoteEventPublisher;
import com.zcloud.accident.api.AccidentServiceI;
import com.zcloud.accident.command.convertor.AccidentExportConvertor;
import com.zcloud.accident.command.convertor.EventExportConvertor;
import com.zcloud.accident.dto.AccidentAddCmd;
import com.zcloud.accident.dto.AccidentCountQry;
import com.zcloud.accident.dto.AccidentPageQry;
@ -17,11 +16,13 @@ import com.zcloud.accident.dto.AccidentUpdateCmd;
import com.zcloud.accident.dto.clientobject.AccidentCO;
import com.zcloud.accident.dto.clientobject.AccidentCountStatCO;
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
import com.zcloud.accident.dto.clientobject.EventExportCO;
import com.zcloud.accident.command.convertor.AccidentExportConvertor;
import com.zcloud.accident.util.ExcelUtils;
import com.zcloud.gbscommon.event.user.ZcUserEvent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.messaging.MessageChannel;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -45,12 +46,11 @@ import java.util.List;
public class AccidentController {
private final AccidentServiceI accidentService;
private final AccidentExportConvertor accidentExportConvertor;
private final EventExportConvertor eventExportConvertor;
private final RemoteEventPublisher remoteEventPublisher ;
@ApiOperation("新增")
@PostMapping("/save")
public SingleResponse<AccidentCO> add(@Validated @RequestBody AccidentAddCmd cmd) {
cmd.setDepartmentId(AuthContext.getOrgId());
SSOUser ssoUser = AuthContext.getCurrentUser();
return accidentService.add(cmd);
}
@ -94,21 +94,10 @@ public class AccidentController {
}
@ApiOperation("导出Excel")
@GetMapping("/export")
public void export(AccidentPageQry qry, HttpServletResponse response) throws IOException {
if(ObjectUtil.isNull(qry.getEqCorpinfoId())){
qry.setEqCorpinfoId(AuthContext.getTenantId());
}
@PostMapping("/export")
public void export(@RequestBody AccidentPageQry qry, HttpServletResponse response) throws IOException {
// 使用listAll方法获取所有符合条件的数据
List<AccidentCO> accidentCOList = accidentService.listAll(qry);
if(qry.getEqType() == 1){
// 转换为导出CO
List<EventExportCO> exportCOList = eventExportConvertor.convertToExportCOList(accidentCOList);
// 生成文件名
String fileName = "事件数据_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
// 调用工具类导出Excel
ExcelUtils.exportExcel(response, EventExportCO.class, fileName, exportCOList);
}else{
// 转换为导出CO
List<AccidentExportCO> exportCOList = accidentExportConvertor.convertToExportCOList(accidentCOList);
// 生成文件名
@ -116,12 +105,18 @@ public class AccidentController {
// 调用工具类导出Excel
ExcelUtils.exportExcel(response, AccidentExportCO.class, fileName, exportCOList);
}
}
@ApiOperation("按照公司和事故类型统计个数")
@PostMapping("/countByCorpinfoAndType")
public MultiResponse<AccidentCountStatCO> countByCorpinfoIdAndIncidentType(@RequestBody AccidentCountQry accidentCountQry) {
return accidentService.countByCorpinfoIdAndIncidentType(accidentCountQry);
}
@GetMapping("/test")
public void test() {
ZcUserEvent zcUserEvent = new ZcUserEvent();
zcUserEvent.setName("hello world");
remoteEventPublisher.sendMessage(zcUserEvent,"zcloud:user:ev2" );
}
}

View File

@ -1,29 +0,0 @@
package com.zcloud.accident.command.convertor;
import com.zcloud.accident.dto.clientobject.AccidentCO;
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
import com.zcloud.accident.dto.clientobject.EventExportCO;
import org.mapstruct.Mapper;
import java.util.List;
/**
*
*/
@Mapper(componentModel = "spring")
public interface EventExportConvertor {
/**
* AccidentCOAccidentExportCO
* @param accidentCO AccidentCO
* @return AccidentExportCO
*/
EventExportCO convertToExportCO(AccidentCO accidentCO);
/**
* AccidentCOAccidentExportCO
* @param accidentCOList AccidentCO
* @return AccidentExportCO
*/
List<EventExportCO> convertToExportCOList(List<AccidentCO> accidentCOList);
}

View File

@ -49,13 +49,7 @@ public class AccidentQueryExe {
*/
public PageResponse<AccidentCO> execute(AccidentPageQry accidentPageQry) {
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
String menuPerms = "";
if(accidentPageQry.getEqType() == 1){
menuPerms = "zcloud-event";
}else{
menuPerms = "zcloud-accident";
}
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params,menuPerms);
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params);
List<AccidentCO> examCenterCOS = accidentCoConvertor.converDOsToCOs(pageResponse.getData());
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
@ -68,13 +62,7 @@ public class AccidentQueryExe {
*/
public List<AccidentCO> listAll(AccidentPageQry accidentPageQry) {
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
String menuPerms = "";
if(accidentPageQry.getEqType() == 1){
menuPerms = "zcloud-event";
}else{
menuPerms = "zcloud-accident";
}
List<AccidentDO> accidentDOs = accidentRepository.listAll(params,menuPerms);
List<AccidentDO> accidentDOs = accidentRepository.listAll(params);
return accidentCoConvertor.converDOsToCOs(accidentDOs);
}
/**
@ -83,7 +71,7 @@ public class AccidentQueryExe {
* @return
*/
public MultiResponse<AccidentCountStatCO> countByCorpinfoIdAndIncidentType(AccidentCountQry accidentCountQry) {
List<com.zcloud.accident.domain.model.AccidentCountStat> resultList = accidentGateway.countByCorpinfoIdAndIncidentType(accidentCountQry.getCorpinfoIds(),accidentCountQry.getEqAccidentType());
List<com.zcloud.accident.domain.model.AccidentCountStat> resultList = accidentGateway.countByCorpinfoIdAndIncidentType(accidentCountQry.getCorpinfoIds());
List<AccidentCountStatCO> coList = accidentCountStatConvertor.convertToCOList(resultList);
return MultiResponse.of(coList);
}

View File

@ -24,8 +24,9 @@ import java.time.LocalDateTime;
@NoArgsConstructor
@AllArgsConstructor
public class AccidentAddCmd extends Command {
@ApiModelProperty(value = "业务主键id", name = "id", required = true)
private String accidentId;
@ApiModelProperty(value = "主键", name = "id", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
@NotEmpty(message = "事故案号不能为空")
private String incidentNumber;
@ -41,6 +42,7 @@ public class AccidentAddCmd extends Command {
private String incidentLevel;
private String incidentLevelName;
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
@NotEmpty(message = "事故性质不能为空")
private String incidentNature;
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
@NotEmpty(message = "事故发生地点不能为空")
@ -50,12 +52,16 @@ public class AccidentAddCmd extends Command {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime incidentDate;
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
@NotNull(message = "直接经济损失(万元)不能为空")
private BigDecimal directLoss;
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
@NotNull(message = "受伤人数不能为空")
private Integer injured;
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
@NotNull(message = "死亡人数不能为空")
private Integer fatalities;
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
@NotNull(message = "重伤人数不能为空")
private Integer seriouslyInjured;
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
@NotEmpty(message = "事故起因不能为空")
@ -72,9 +78,6 @@ public class AccidentAddCmd extends Command {
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
@NotEmpty(message = "整改措施不能为空")
private String measures;
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
@NotEmpty(message = "填报人不能为空")
private String reportUser;
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
@NotNull(message = "报出日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -82,7 +85,5 @@ public class AccidentAddCmd extends Command {
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
@NotNull(message = "1事件/2事故不能为空")
private Integer type;
@ApiModelProperty(value = "部门id", name = "departmentId")
private Long departmentId;
}

View File

@ -17,6 +17,4 @@ public class AccidentCountQry extends Query {
@ApiModelProperty(value = "公司ID列表")
private List<String> corpinfoIds;
@ApiModelProperty(value = "类型")
private Integer eqAccidentType;
}

View File

@ -4,10 +4,8 @@ import com.alibaba.cola.dto.PageQuery;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -29,8 +27,6 @@ public class AccidentPageQry extends PageQuery {
* - `le`:
* - `ne`: SQL!=
*/
@ApiModelProperty(value = "所属企业", name = "eqCorpinfoId")
private Long eqCorpinfoId;
@ApiModelProperty(value = "事故名称", name = "likeIncidentName")
private String likeIncidentName;
@ApiModelProperty(value = "事故地点", name = "likeLocation")
@ -40,9 +36,11 @@ public class AccidentPageQry extends PageQuery {
@ApiModelProperty(value = "事故级别", name = "likeIncidentLevel")
private String eqIncidentLevel;
@ApiModelProperty(value = "开始时间", name = "geIncidentDate")
private String geIncidentDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime geIncidentDate;
@ApiModelProperty(value = "结束时间", name = "leIncidentDate")
private String leIncidentDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime leIncidentDate;
@ApiModelProperty(value = "类型1事件2事故", name = "eqType")
private Integer eqType;
}

View File

@ -26,47 +26,69 @@ public class AccidentUpdateCmd extends Command {
@NotNull(message = "主键id不能为空")
private Long id;
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
@NotEmpty(message = "事故案号不能为空")
private String incidentNumber;
@ApiModelProperty(value = "事故名称", name = "incidentName", required = true)
@NotEmpty(message = "事故名称不能为空")
private String incidentName;
@ApiModelProperty(value = "事故类型", name = "incidentType", required = true)
@NotEmpty(message = "事故类型不能为空")
private String incidentType;
@ApiModelProperty(value = "事故类型", name = "incidentTypeName", required = true)
@NotEmpty(message = "事故类型不能为空")
private String incidentTypeName;
@ApiModelProperty(value = "公司id", name = "corpinfoId", required = true)
@NotNull(message = "公司id不能为空")
private Long corpinfoId;
@ApiModelProperty(value = "事故级别", name = "incidentLevel", required = true)
@NotEmpty(message = "事故级别不能为空")
private String incidentLevel;
@ApiModelProperty(value = "事故级别", name = "incidentLevelName", required = true)
@NotEmpty(message = "事故级别不能为空")
private String incidentLevelName;
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
@NotEmpty(message = "事故性质不能为空")
private String incidentNature;
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
@NotEmpty(message = "事故发生地点不能为空")
private String location;
@ApiModelProperty(value = "事故发生时间", name = "incidentDate", required = true)
@NotNull(message = "事故发生时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime incidentDate;
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
@NotNull(message = "直接经济损失(万元)不能为空")
private BigDecimal directLoss;
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
@NotNull(message = "受伤人数不能为空")
private Integer injured;
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
@NotNull(message = "死亡人数不能为空")
private Integer fatalities;
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
@NotNull(message = "重伤人数不能为空")
private Integer seriouslyInjured;
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
@NotEmpty(message = "事故起因不能为空")
private String cause;
@ApiModelProperty(value = "事故概述", name = "summary", required = true)
@NotEmpty(message = "事故概述不能为空")
private String summary;
@ApiModelProperty(value = "原因分析及责任认定", name = "analysis", required = true)
@NotEmpty(message = "原因分析及责任认定不能为空")
private String analysis;
@ApiModelProperty(value = "考核建议", name = "suggestions", required = true)
@NotEmpty(message = "考核建议不能为空")
private String suggestions;
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
@NotEmpty(message = "整改措施不能为空")
private String measures;
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
@NotEmpty(message = "填报人不能为空")
private String reportUser;
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
@NotNull(message = "报出日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportDate;
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
@NotNull(message = "1事件/2事故不能为空")
private Integer type;
}

View File

@ -6,7 +6,6 @@ import com.jjb.saas.framework.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -86,11 +85,8 @@ public class AccidentCO extends ClientObject {
//整改措施
@ApiModelProperty(value = "整改措施")
private String measures;
@ApiModelProperty(value = "填报人")
private String reportUser;
//报出日期
@ApiModelProperty(value = "报出日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportDate;
//1事件/2事故
@ApiModelProperty(value = "1事件/2事故")

View File

@ -2,7 +2,6 @@ package com.zcloud.accident.dto.clientobject;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -16,91 +15,77 @@ import java.time.LocalDateTime;
@Data
public class AccidentExportCO {
@ApiModelProperty(value = "所属公司")
@ExcelProperty(value = "所属公司", index = 0)
@ColumnWidth(20)
private String corpinfoName;
@ApiModelProperty(value = "事故案号")
@ExcelProperty(value = "事故案号", index = 1)
@ColumnWidth(20)
@ExcelProperty(value = "事故案号", index = 0)
private String incidentNumber;
@ApiModelProperty(value = "事故名称")
@ExcelProperty(value = "事故名称", index = 2)
@ColumnWidth(20)
@ExcelProperty(value = "事故名称", index = 1)
private String incidentName;
@ApiModelProperty(value = "事故类型")
@ExcelProperty(value = "事故类型", index = 3)
@ColumnWidth(20)
@ExcelProperty(value = "事故类型", index = 2)
private String incidentTypeName;
@ApiModelProperty(value = "公司")
@ExcelProperty(value = "公司", index = 3)
private String corpinfoName;
@ApiModelProperty(value = "事故级别")
@ExcelProperty(value = "事故级别", index = 4)
@ColumnWidth(20)
private String incidentLevelName;
@ApiModelProperty(value = "事故性质")
@ExcelProperty(value = "事故性质", index = 5)
private String incidentNature;
@ApiModelProperty(value = "事故发生地点")
@ExcelProperty(value = "事故发生地点", index = 5)
@ColumnWidth(20)
@ExcelProperty(value = "事故发生地点", index = 6)
private String location;
@ApiModelProperty(value = "事故发生时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "事故发生时间", index = 6)
@ColumnWidth(20)
@ExcelProperty(value = "事故发生时间", index = 7,format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime incidentDate;
@ApiModelProperty(value = "直接经济损失(万元)")
@ExcelProperty(value = "直接经济损失(万元)", index = 7)
@ColumnWidth(20)
@ExcelProperty(value = "直接经济损失(万元)", index = 8)
private BigDecimal directLoss;
@ApiModelProperty(value = "受伤人数")
@ExcelProperty(value = "受伤人数", index = 8)
@ColumnWidth(20)
@ExcelProperty(value = "受伤人数", index = 9)
private Integer injured;
@ApiModelProperty(value = "死亡人数")
@ExcelProperty(value = "死亡人数", index = 9)
@ColumnWidth(20)
@ExcelProperty(value = "死亡人数", index = 10)
private Integer fatalities;
@ApiModelProperty(value = "重伤人数")
@ExcelProperty(value = "重伤人数", index = 10)
@ColumnWidth(20)
@ExcelProperty(value = "重伤人数", index = 11)
private Integer seriouslyInjured;
@ApiModelProperty(value = "事故起因")
@ExcelProperty(value = "事故起因", index = 11)
@ColumnWidth(20)
@ExcelProperty(value = "事故起因", index = 12)
private String cause;
@ApiModelProperty(value = "事故概述")
@ExcelProperty(value = "事故概述", index = 12)
@ColumnWidth(20)
@ExcelProperty(value = "事故概述", index = 13)
private String summary;
@ApiModelProperty(value = "原因分析及责任认定")
@ExcelProperty(value = "原因分析及责任认定", index = 13)
@ColumnWidth(20)
@ExcelProperty(value = "原因分析及责任认定", index = 14)
private String analysis;
@ApiModelProperty(value = "考核建议")
@ExcelProperty(value = "考核建议", index = 14)
@ColumnWidth(20)
@ExcelProperty(value = "考核建议", index = 15)
private String suggestions;
@ApiModelProperty(value = "整改措施")
@ExcelProperty(value = "整改措施", index = 15)
@ColumnWidth(20)
@ExcelProperty(value = "整改措施", index = 16)
private String measures;
@ApiModelProperty(value = "报出日期")
@ExcelProperty(value = "报出日期", index = 16)
@ColumnWidth(20)
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "报出日期", index = 17,format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportDate;
}

View File

@ -1,107 +0,0 @@
package com.zcloud.accident.dto.clientobject;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
* Excel
*/
@Data
public class EventExportCO {
@ApiModelProperty(value = "所属公司")
@ExcelProperty(value = "所属公司", index = 0)
@ColumnWidth(20)
private String corpinfoName;
@ApiModelProperty(value = "事件案号")
@ExcelProperty(value = "事件案号", index = 1)
@ColumnWidth(20)
private String incidentNumber;
@ApiModelProperty(value = "事件名称")
@ExcelProperty(value = "事件名称", index = 2)
@ColumnWidth(20)
private String incidentName;
@ApiModelProperty(value = "事件类型")
@ExcelProperty(value = "事件类型", index = 3)
@ColumnWidth(20)
private String incidentTypeName;
@ApiModelProperty(value = "事件级别")
@ExcelProperty(value = "事件级别", index = 4)
@ColumnWidth(20)
private String incidentLevelName;
@ApiModelProperty(value = "事件发生地点")
@ExcelProperty(value = "事件发生地点", index = 5)
@ColumnWidth(20)
private String location;
@ApiModelProperty(value = "事件发生时间")
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "事件发生时间", index = 6)
@ColumnWidth(20)
private LocalDateTime incidentDate;
@ApiModelProperty(value = "直接经济损失(万元)")
@ExcelProperty(value = "直接经济损失(万元)", index = 7)
@ColumnWidth(20)
private BigDecimal directLoss;
@ApiModelProperty(value = "受伤人数")
@ExcelProperty(value = "受伤人数", index = 8)
@ColumnWidth(20)
private Integer injured;
@ApiModelProperty(value = "死亡人数")
@ExcelProperty(value = "死亡人数", index = 9)
@ColumnWidth(20)
private Integer fatalities;
@ApiModelProperty(value = "重伤人数")
@ExcelProperty(value = "重伤人数", index = 10)
@ColumnWidth(20)
private Integer seriouslyInjured;
@ApiModelProperty(value = "事件起因")
@ExcelProperty(value = "事件起因", index = 11)
@ColumnWidth(20)
private String cause;
@ApiModelProperty(value = "事件概述")
@ExcelProperty(value = "事件概述", index = 12)
@ColumnWidth(20)
private String summary;
@ApiModelProperty(value = "原因分析及责任认定")
@ExcelProperty(value = "原因分析及责任认定", index = 13)
@ColumnWidth(20)
private String analysis;
@ApiModelProperty(value = "考核建议")
@ExcelProperty(value = "考核建议", index = 14)
@ColumnWidth(20)
private String suggestions;
@ApiModelProperty(value = "整改措施")
@ExcelProperty(value = "整改措施", index = 15)
@ColumnWidth(20)
private String measures;
@ApiModelProperty(value = "报出日期")
@ExcelProperty(value = "报出日期", index = 16)
@ColumnWidth(20)
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
private LocalDateTime reportDate;
}

View File

@ -30,11 +30,9 @@ public interface AccidentGateway {
/**
* corpinfoIdincidentType
*
* @param corpinfoIds ID
* @param eqAccidentType
* @return corpinfoIdincidentTypecount
*/
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType);
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds);
}

View File

@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -18,7 +17,7 @@ import java.time.LocalDateTime;
@Data
public class AccidentE extends BaseE {
//主键id
private String accidentId;
private Long id;
//事故案号
private String incidentNumber;
//事故名称
@ -55,13 +54,9 @@ public class AccidentE extends BaseE {
private String suggestions;
//整改措施
private String measures;
//填报人
private String reportUser;
//报出日期
private LocalDateTime reportDate;
//1事件/2事故
private Integer type;
//部门id
private Long departmentId;
}

View File

@ -1,17 +1,18 @@
package com.zcloud.accident.gatewayimpl;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.accident.domain.gateway.AccidentGateway;
import com.zcloud.accident.domain.model.AccidentE;
import com.zcloud.accident.domain.model.AccidentCountStat;
import com.zcloud.accident.persistence.dataobject.AccidentDO;
import com.zcloud.accident.persistence.repository.AccidentRepository;
import com.zcloud.gbscommon.utils.Tools;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* web-infrastructure
@ -25,10 +26,8 @@ public class AccidentGatewayImpl implements AccidentGateway {
@Override
public Boolean add(AccidentE accidentE) {
AccidentDO d = new AccidentDO();
BeanUtils.copyProperties(accidentE, d);
d.setCorpinfoId(AuthContext.getTenantId());
d.setCorpinfoName(AuthContext.getCurrentUser().getTenantName());
AccidentDO d = new AccidentDO(Tools.get32UUID());
BeanUtils.copyProperties(accidentE, d, "accidentId");
accidentRepository.save(d);
return true;
}
@ -52,8 +51,8 @@ public class AccidentGatewayImpl implements AccidentGateway {
}
@Override
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
return accidentRepository.countByCorpinfoIdAndIncidentType(corpinfoIds,eqAccidentType);
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds) {
return accidentRepository.countByCorpinfoIdAndIncidentType(corpinfoIds);
}
}

View File

@ -8,7 +8,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.sql.Date;
import java.time.LocalDateTime;
@ -87,8 +86,6 @@ public class AccidentDO extends BaseDO {
//整改措施
@ApiModelProperty(value = "整改措施")
private String measures;
@ApiModelProperty(value = "填报人")
private String reportUser;
//报出日期
@ApiModelProperty(value = "报出日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -96,8 +93,6 @@ public class AccidentDO extends BaseDO {
//1事件/2事故
@ApiModelProperty(value = "1事件/2事故")
private Integer type;
@ApiModelProperty(value = "部门id")
private Long departmentId;
public AccidentDO(String accidentId) {
this.accidentId = accidentId;

View File

@ -1,40 +1,26 @@
package com.zcloud.accident.persistence.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.datascope.annotation.DataScope;
import com.jjb.saas.framework.datascope.annotation.DataScopes;
import com.zcloud.accident.domain.model.AccidentCountStat;
import com.zcloud.accident.persistence.dataobject.AccidentDO;
import com.zcloud.accident.domain.model.AccidentCountStat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* web-infrastructure
*
* @Author fangjiakai
* @Date 2025-10-29 14:28:43
*/
* web-infrastructure
* @Author fangjiakai
* @Date 2025-10-29 14:28:43
*/
@Mapper
@DataScopes({
@DataScope(method = "listPage", menuPerms = ""),
@DataScope(method = "list", menuPerms = "")})
public interface AccidentMapper extends BaseMapper<AccidentDO> {
/**
* corpinfoIdincidentType
*
* @param corpinfoIds ID
* @param eqAccidentType
* @return corpinfoIdincidentTypecount
*/
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds, @Param("eqAccidentType") Integer eqAccidentType);
IPage<AccidentDO> listPage(IPage<AccidentDO> iPage, @Param("params") Map<String, Object> params,String menuPerms);
List<AccidentDO> list(@Param("params") Map<String, Object> params, String menuPerms);
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds);
}

View File

@ -15,24 +15,20 @@ import java.util.Map;
* @Date 2025-10-29 14:28:45
*/
public interface AccidentRepository extends BaseRepository<AccidentDO> {
PageResponse<AccidentDO> listPage(Map<String,Object> params,String menuPerms);
PageResponse<AccidentDO> listPage(Map<String,Object> params);
/**
*
*
* @param params
* @param menuPerms
* @return
*/
List<AccidentDO> listAll(Map<String,Object> params,String menuPerms);
List<AccidentDO> listAll(Map<String,Object> params);
/**
* corpinfoIdincidentType
*
* @param corpinfoIds ID
* @param eqAccidentType
* @return corpinfoIdincidentTypecount
*/
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds,@Param("eqAccidentType") Integer eqAccidentType);
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds);
}

View File

@ -1,48 +1,52 @@
package com.zcloud.accident.persistence.repository.impl;
import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.accident.domain.model.AccidentCountStat;
import com.zcloud.accident.persistence.dataobject.AccidentDO;
import com.zcloud.accident.domain.model.AccidentCountStat;
import com.zcloud.accident.persistence.mapper.AccidentMapper;
import com.zcloud.accident.persistence.repository.AccidentRepository;
import com.alibaba.cola.dto.PageResponse;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* web-infrastructure
*
* @Author fangjiakai
* @Date 2025-10-29 14:28:49
*/
* web-infrastructure
* @Author fangjiakai
* @Date 2025-10-29 14:28:49
*/
@Service
@RequiredArgsConstructor
public class AccidentRepositoryImpl extends BaseRepositoryImpl<AccidentMapper, AccidentDO> implements AccidentRepository {
private final AccidentMapper accidentMapper;
@Override
public PageResponse<AccidentDO> listPage(Map<String, Object> params,String menuPerms) {
public PageResponse<AccidentDO> listPage(Map<String,Object> params) {
IPage<AccidentDO> iPage = new Query<AccidentDO>().getPage(params);
IPage<AccidentDO> result = accidentMapper.listPage(iPage, params,menuPerms);
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
queryWrapper.orderByDesc("create_time");
IPage<AccidentDO> result = accidentMapper.selectPage(iPage, queryWrapper);
return PageHelper.pageToResponse(result, result.getRecords());
}
@Override
public List<AccidentDO> listAll(Map<String, Object> params, String menuPerms) {
return accidentMapper.list(params, menuPerms);
public List<AccidentDO> listAll(Map<String,Object> params) {
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
queryWrapper.orderByDesc("create_time");
return accidentMapper.selectList(queryWrapper);
}
@Override
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds, eqAccidentType);
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds) {
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds);
}
}

View File

@ -4,70 +4,6 @@
<mapper namespace="com.zcloud.accident.persistence.mapper.AccidentMapper">
<select id="listPage" resultType="com.zcloud.accident.persistence.dataobject.AccidentDO">
select * from accident
<where>
and delete_enum = 'FALSE'
<if test="params.eqCorpinfoId != null">
and tenant_id = #{params.eqCorpinfoId}
</if>
<if test="params.likeIncidentName != null and params.likeIncidentName != ''" >
and incident_name like concat('%',#{params.likeIncidentName},'%')
</if>
<if test="params.likeLocation != null and params.likeLocation != ''">
and location like concat('%',#{params.likeLocation},'%')
</if>
<if test="params.eqIncidentType != null and params.eqIncidentType != ''">
and incident_type = #{params.eqIncidentType}
</if>
<if test="params.eqIncidentLevel != null and params.eqIncidentLevel != ''">
and incident_level = #{params.eqIncidentLevel}
</if>
<if test="params.geIncidentDate != null and params.geIncidentDate != ''">
and incident_date &gt;= #{params.geIncidentDate}
</if>
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
and incident_date &lt;= #{params.leIncidentDate}
</if>
<if test="params.eqType != null">
and type = #{params.eqType}
</if>
</where>
order by create_time desc
</select>
<select id="list" resultType="com.zcloud.accident.persistence.dataobject.AccidentDO">
select * from accident
<where>
and delete_enum = 'FALSE'
<if test="params.eqCorpinfoId != null">
and tenant_id = #{params.eqCorpinfoId}
</if>
<if test="params.likeIncidentName != null and params.likeIncidentName != ''" >
and incident_name like concat('%',#{params.likeIncidentName},'%')
</if>
<if test="params.likeLocation != null and params.likeLocation != ''">
and location like concat('%',#{params.likeLocation},'%')
</if>
<if test="params.eqIncidentType != null and params.eqIncidentType != ''">
and incident_type = #{params.eqIncidentType}
</if>
<if test="params.eqIncidentLevel != null and params.eqIncidentLevel != ''">
and incident_level = #{params.eqIncidentLevel}
</if>
<if test="params.geIncidentDate != null and params.geIncidentDate != ''">
and incident_date &gt;= #{params.geIncidentDate}
</if>
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
and incident_date &lt;= #{params.leIncidentDate}
</if>
<if test="params.eqType != null">
and type = #{params.eqType}
</if>
</where>
order by create_time desc
</select>
<select id="countByCorpinfoIdAndIncidentType" resultType="com.zcloud.accident.domain.model.AccidentCountStat">
SELECT
corpinfo_id,
@ -75,10 +11,6 @@
COUNT(*) as count
from accident
<where>
and delete_enum = 'FALSE'
<if test="eqAccidentType != null ">
AND type = #{eqAccidentType}
</if>
<if test="corpinfoIds != null and !corpinfoIds.isEmpty() and corpinfoIds.size()>0">
AND corpinfo_id IN
<foreach collection="corpinfoIds" item="item" open="(" separator="," close=")">