feat(accident): 添加事件导出功能并优化事故数据管理
- 新增EventExportConvertor转换器和EventExportCO导出对象 - 实现根据eqType区分事故和事件的导出功能 - 优化AccidentRepositoryImpl数据访问层方法 - 更新DTO对象添加departmentId和reportUser字段 - 修改Excel导出样式配置和列宽设置 - 调整查询条件处理逻辑和数据权限控制 - 优化Mapper层SQL查询语句和数据过滤规则master
parent
835b51f034
commit
e6cd88d54a
|
|
@ -6,10 +6,10 @@ import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.Response;
|
import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
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.auth.utils.AuthContext;
|
||||||
import com.jjb.saas.framework.event.producer.RemoteEventPublisher;
|
|
||||||
import com.zcloud.accident.api.AccidentServiceI;
|
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.AccidentAddCmd;
|
||||||
import com.zcloud.accident.dto.AccidentCountQry;
|
import com.zcloud.accident.dto.AccidentCountQry;
|
||||||
import com.zcloud.accident.dto.AccidentPageQry;
|
import com.zcloud.accident.dto.AccidentPageQry;
|
||||||
|
|
@ -17,13 +17,11 @@ import com.zcloud.accident.dto.AccidentUpdateCmd;
|
||||||
import com.zcloud.accident.dto.clientobject.AccidentCO;
|
import com.zcloud.accident.dto.clientobject.AccidentCO;
|
||||||
import com.zcloud.accident.dto.clientobject.AccidentCountStatCO;
|
import com.zcloud.accident.dto.clientobject.AccidentCountStatCO;
|
||||||
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
|
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
|
||||||
import com.zcloud.accident.command.convertor.AccidentExportConvertor;
|
import com.zcloud.accident.dto.clientobject.EventExportCO;
|
||||||
import com.zcloud.accident.util.ExcelUtils;
|
import com.zcloud.accident.util.ExcelUtils;
|
||||||
import com.zcloud.gbscommon.event.user.ZcUserEvent;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.messaging.MessageChannel;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -47,19 +45,18 @@ import java.util.List;
|
||||||
public class AccidentController {
|
public class AccidentController {
|
||||||
private final AccidentServiceI accidentService;
|
private final AccidentServiceI accidentService;
|
||||||
private final AccidentExportConvertor accidentExportConvertor;
|
private final AccidentExportConvertor accidentExportConvertor;
|
||||||
private final RemoteEventPublisher remoteEventPublisher ;
|
private final EventExportConvertor eventExportConvertor;
|
||||||
|
|
||||||
@ApiOperation("新增")
|
@ApiOperation("新增")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public SingleResponse<AccidentCO> add(@Validated @RequestBody AccidentAddCmd cmd) {
|
public SingleResponse<AccidentCO> add(@Validated @RequestBody AccidentAddCmd cmd) {
|
||||||
|
cmd.setDepartmentId(AuthContext.getOrgId());
|
||||||
return accidentService.add(cmd);
|
return accidentService.add(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public PageResponse<AccidentCO> page(@RequestBody AccidentPageQry qry) {
|
public PageResponse<AccidentCO> page(@RequestBody AccidentPageQry qry) {
|
||||||
if(ObjectUtil.isNull(qry.getEqCorpinfoId())){
|
|
||||||
qry.setEqCorpinfoId(AuthContext.getTenantId());
|
|
||||||
}
|
|
||||||
return accidentService.listPage(qry);
|
return accidentService.listPage(qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,8 +96,19 @@ public class AccidentController {
|
||||||
@ApiOperation("导出Excel")
|
@ApiOperation("导出Excel")
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public void export(AccidentPageQry qry, HttpServletResponse response) throws IOException {
|
public void export(AccidentPageQry qry, HttpServletResponse response) throws IOException {
|
||||||
|
if(ObjectUtil.isNull(qry.getEqCorpinfoId())){
|
||||||
|
qry.setEqCorpinfoId(AuthContext.getTenantId());
|
||||||
|
}
|
||||||
// 使用listAll方法获取所有符合条件的数据
|
// 使用listAll方法获取所有符合条件的数据
|
||||||
List<AccidentCO> accidentCOList = accidentService.listAll(qry);
|
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
|
// 转换为导出CO
|
||||||
List<AccidentExportCO> exportCOList = accidentExportConvertor.convertToExportCOList(accidentCOList);
|
List<AccidentExportCO> exportCOList = accidentExportConvertor.convertToExportCOList(accidentCOList);
|
||||||
// 生成文件名
|
// 生成文件名
|
||||||
|
|
@ -108,6 +116,7 @@ public class AccidentController {
|
||||||
// 调用工具类导出Excel
|
// 调用工具类导出Excel
|
||||||
ExcelUtils.exportExcel(response, AccidentExportCO.class, fileName, exportCOList);
|
ExcelUtils.exportExcel(response, AccidentExportCO.class, fileName, exportCOList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("按照公司和事故类型统计个数")
|
@ApiOperation("按照公司和事故类型统计个数")
|
||||||
@PostMapping("/countByCorpinfoAndType")
|
@PostMapping("/countByCorpinfoAndType")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将AccidentCO转换为AccidentExportCO
|
||||||
|
* @param accidentCO AccidentCO对象
|
||||||
|
* @return AccidentExportCO对象
|
||||||
|
*/
|
||||||
|
EventExportCO convertToExportCO(AccidentCO accidentCO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将AccidentCO列表转换为AccidentExportCO列表
|
||||||
|
* @param accidentCOList AccidentCO列表
|
||||||
|
* @return AccidentExportCO列表
|
||||||
|
*/
|
||||||
|
List<EventExportCO> convertToExportCOList(List<AccidentCO> accidentCOList);
|
||||||
|
}
|
||||||
|
|
@ -49,7 +49,13 @@ public class AccidentQueryExe {
|
||||||
*/
|
*/
|
||||||
public PageResponse<AccidentCO> execute(AccidentPageQry accidentPageQry) {
|
public PageResponse<AccidentCO> execute(AccidentPageQry accidentPageQry) {
|
||||||
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
||||||
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params);
|
String menuPerms = "";
|
||||||
|
if(accidentPageQry.getEqType() == 1){
|
||||||
|
menuPerms = "zcloud-event";
|
||||||
|
}else{
|
||||||
|
menuPerms = "zcloud-accident";
|
||||||
|
}
|
||||||
|
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params,menuPerms);
|
||||||
List<AccidentCO> examCenterCOS = accidentCoConvertor.converDOsToCOs(pageResponse.getData());
|
List<AccidentCO> examCenterCOS = accidentCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +68,13 @@ public class AccidentQueryExe {
|
||||||
*/
|
*/
|
||||||
public List<AccidentCO> listAll(AccidentPageQry accidentPageQry) {
|
public List<AccidentCO> listAll(AccidentPageQry accidentPageQry) {
|
||||||
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
||||||
List<AccidentDO> accidentDOs = accidentRepository.listAll(params);
|
String menuPerms = "";
|
||||||
|
if(accidentPageQry.getEqType() == 1){
|
||||||
|
menuPerms = "zcloud-event";
|
||||||
|
}else{
|
||||||
|
menuPerms = "zcloud-accident";
|
||||||
|
}
|
||||||
|
List<AccidentDO> accidentDOs = accidentRepository.listAll(params,menuPerms);
|
||||||
return accidentCoConvertor.converDOsToCOs(accidentDOs);
|
return accidentCoConvertor.converDOsToCOs(accidentDOs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,8 @@ import java.time.LocalDateTime;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AccidentAddCmd extends Command {
|
public class AccidentAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "主键", name = "id", required = true)
|
@ApiModelProperty(value = "业务主键id", name = "id", required = true)
|
||||||
@NotNull(message = "主键不能为空")
|
private String accidentId;
|
||||||
private Long id;
|
|
||||||
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
||||||
@NotEmpty(message = "事故案号不能为空")
|
@NotEmpty(message = "事故案号不能为空")
|
||||||
private String incidentNumber;
|
private String incidentNumber;
|
||||||
|
|
@ -42,7 +41,6 @@ public class AccidentAddCmd extends Command {
|
||||||
private String incidentLevel;
|
private String incidentLevel;
|
||||||
private String incidentLevelName;
|
private String incidentLevelName;
|
||||||
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
||||||
@NotEmpty(message = "事故性质不能为空")
|
|
||||||
private String incidentNature;
|
private String incidentNature;
|
||||||
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
||||||
@NotEmpty(message = "事故发生地点不能为空")
|
@NotEmpty(message = "事故发生地点不能为空")
|
||||||
|
|
@ -52,16 +50,12 @@ public class AccidentAddCmd extends Command {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime incidentDate;
|
private LocalDateTime incidentDate;
|
||||||
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
||||||
@NotNull(message = "直接经济损失(万元)不能为空")
|
|
||||||
private BigDecimal directLoss;
|
private BigDecimal directLoss;
|
||||||
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
||||||
@NotNull(message = "受伤人数不能为空")
|
|
||||||
private Integer injured;
|
private Integer injured;
|
||||||
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
||||||
@NotNull(message = "死亡人数不能为空")
|
|
||||||
private Integer fatalities;
|
private Integer fatalities;
|
||||||
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
||||||
@NotNull(message = "重伤人数不能为空")
|
|
||||||
private Integer seriouslyInjured;
|
private Integer seriouslyInjured;
|
||||||
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
||||||
@NotEmpty(message = "事故起因不能为空")
|
@NotEmpty(message = "事故起因不能为空")
|
||||||
|
|
@ -78,6 +72,9 @@ public class AccidentAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
||||||
@NotEmpty(message = "整改措施不能为空")
|
@NotEmpty(message = "整改措施不能为空")
|
||||||
private String measures;
|
private String measures;
|
||||||
|
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
|
||||||
|
@NotEmpty(message = "填报人不能为空")
|
||||||
|
private String reportUser;
|
||||||
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
||||||
@NotNull(message = "报出日期不能为空")
|
@NotNull(message = "报出日期不能为空")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
@ -85,5 +82,7 @@ public class AccidentAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
|
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
|
||||||
@NotNull(message = "1事件/2事故不能为空")
|
@NotNull(message = "1事件/2事故不能为空")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "部门id", name = "departmentId")
|
||||||
|
private Long departmentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,13 +40,9 @@ public class AccidentPageQry extends PageQuery {
|
||||||
@ApiModelProperty(value = "事故级别", name = "likeIncidentLevel")
|
@ApiModelProperty(value = "事故级别", name = "likeIncidentLevel")
|
||||||
private String eqIncidentLevel;
|
private String eqIncidentLevel;
|
||||||
@ApiModelProperty(value = "开始时间", name = "geIncidentDate")
|
@ApiModelProperty(value = "开始时间", name = "geIncidentDate")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
private String geIncidentDate;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate geIncidentDate;
|
|
||||||
@ApiModelProperty(value = "结束时间", name = "leIncidentDate")
|
@ApiModelProperty(value = "结束时间", name = "leIncidentDate")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
private String leIncidentDate;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private LocalDate leIncidentDate;
|
|
||||||
@ApiModelProperty(value = "类型1事件2事故", name = "eqType")
|
@ApiModelProperty(value = "类型1事件2事故", name = "eqType")
|
||||||
private Integer eqType;
|
private Integer eqType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,69 +26,47 @@ public class AccidentUpdateCmd extends Command {
|
||||||
@NotNull(message = "主键id不能为空")
|
@NotNull(message = "主键id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
||||||
@NotEmpty(message = "事故案号不能为空")
|
|
||||||
private String incidentNumber;
|
private String incidentNumber;
|
||||||
@ApiModelProperty(value = "事故名称", name = "incidentName", required = true)
|
@ApiModelProperty(value = "事故名称", name = "incidentName", required = true)
|
||||||
@NotEmpty(message = "事故名称不能为空")
|
|
||||||
private String incidentName;
|
private String incidentName;
|
||||||
@ApiModelProperty(value = "事故类型", name = "incidentType", required = true)
|
@ApiModelProperty(value = "事故类型", name = "incidentType", required = true)
|
||||||
@NotEmpty(message = "事故类型不能为空")
|
|
||||||
private String incidentType;
|
private String incidentType;
|
||||||
@ApiModelProperty(value = "事故类型", name = "incidentTypeName", required = true)
|
@ApiModelProperty(value = "事故类型", name = "incidentTypeName", required = true)
|
||||||
@NotEmpty(message = "事故类型不能为空")
|
|
||||||
private String incidentTypeName;
|
private String incidentTypeName;
|
||||||
@ApiModelProperty(value = "公司id", name = "corpinfoId", required = true)
|
|
||||||
@NotNull(message = "公司id不能为空")
|
|
||||||
private Long corpinfoId;
|
|
||||||
@ApiModelProperty(value = "事故级别", name = "incidentLevel", required = true)
|
@ApiModelProperty(value = "事故级别", name = "incidentLevel", required = true)
|
||||||
@NotEmpty(message = "事故级别不能为空")
|
|
||||||
private String incidentLevel;
|
private String incidentLevel;
|
||||||
@ApiModelProperty(value = "事故级别", name = "incidentLevelName", required = true)
|
@ApiModelProperty(value = "事故级别", name = "incidentLevelName", required = true)
|
||||||
@NotEmpty(message = "事故级别不能为空")
|
|
||||||
private String incidentLevelName;
|
private String incidentLevelName;
|
||||||
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
||||||
@NotEmpty(message = "事故性质不能为空")
|
|
||||||
private String incidentNature;
|
private String incidentNature;
|
||||||
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
||||||
@NotEmpty(message = "事故发生地点不能为空")
|
|
||||||
private String location;
|
private String location;
|
||||||
@ApiModelProperty(value = "事故发生时间", name = "incidentDate", required = true)
|
@ApiModelProperty(value = "事故发生时间", name = "incidentDate", required = true)
|
||||||
@NotNull(message = "事故发生时间不能为空")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime incidentDate;
|
private LocalDateTime incidentDate;
|
||||||
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
||||||
@NotNull(message = "直接经济损失(万元)不能为空")
|
|
||||||
private BigDecimal directLoss;
|
private BigDecimal directLoss;
|
||||||
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
||||||
@NotNull(message = "受伤人数不能为空")
|
|
||||||
private Integer injured;
|
private Integer injured;
|
||||||
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
||||||
@NotNull(message = "死亡人数不能为空")
|
|
||||||
private Integer fatalities;
|
private Integer fatalities;
|
||||||
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
||||||
@NotNull(message = "重伤人数不能为空")
|
|
||||||
private Integer seriouslyInjured;
|
private Integer seriouslyInjured;
|
||||||
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
||||||
@NotEmpty(message = "事故起因不能为空")
|
|
||||||
private String cause;
|
private String cause;
|
||||||
@ApiModelProperty(value = "事故概述", name = "summary", required = true)
|
@ApiModelProperty(value = "事故概述", name = "summary", required = true)
|
||||||
@NotEmpty(message = "事故概述不能为空")
|
|
||||||
private String summary;
|
private String summary;
|
||||||
@ApiModelProperty(value = "原因分析及责任认定", name = "analysis", required = true)
|
@ApiModelProperty(value = "原因分析及责任认定", name = "analysis", required = true)
|
||||||
@NotEmpty(message = "原因分析及责任认定不能为空")
|
|
||||||
private String analysis;
|
private String analysis;
|
||||||
@ApiModelProperty(value = "考核建议", name = "suggestions", required = true)
|
@ApiModelProperty(value = "考核建议", name = "suggestions", required = true)
|
||||||
@NotEmpty(message = "考核建议不能为空")
|
|
||||||
private String suggestions;
|
private String suggestions;
|
||||||
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
||||||
@NotEmpty(message = "整改措施不能为空")
|
|
||||||
private String measures;
|
private String measures;
|
||||||
|
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
|
||||||
|
@NotEmpty(message = "填报人不能为空")
|
||||||
|
private String reportUser;
|
||||||
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
||||||
@NotNull(message = "报出日期不能为空")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime reportDate;
|
private LocalDateTime reportDate;
|
||||||
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
|
|
||||||
@NotNull(message = "1事件/2事故不能为空")
|
|
||||||
private Integer type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.jjb.saas.framework.core.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
@ -85,8 +86,11 @@ public class AccidentCO extends ClientObject {
|
||||||
//整改措施
|
//整改措施
|
||||||
@ApiModelProperty(value = "整改措施")
|
@ApiModelProperty(value = "整改措施")
|
||||||
private String measures;
|
private String measures;
|
||||||
|
@ApiModelProperty(value = "填报人")
|
||||||
|
private String reportUser;
|
||||||
//报出日期
|
//报出日期
|
||||||
@ApiModelProperty(value = "报出日期")
|
@ApiModelProperty(value = "报出日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime reportDate;
|
private LocalDateTime reportDate;
|
||||||
//1事件/2事故
|
//1事件/2事故
|
||||||
@ApiModelProperty(value = "1事件/2事故")
|
@ApiModelProperty(value = "1事件/2事故")
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.zcloud.accident.dto.clientobject;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -15,77 +16,90 @@ import java.time.LocalDateTime;
|
||||||
@Data
|
@Data
|
||||||
public class AccidentExportCO {
|
public class AccidentExportCO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属公司")
|
||||||
|
@ExcelProperty(value = "所属公司", index = 0)
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String corpinfoName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故案号")
|
@ApiModelProperty(value = "事故案号")
|
||||||
@ExcelProperty(value = "事故案号", index = 0)
|
@ExcelProperty(value = "事故案号", index = 1)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String incidentNumber;
|
private String incidentNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故名称")
|
@ApiModelProperty(value = "事故名称")
|
||||||
@ExcelProperty(value = "事故名称", index = 1)
|
@ExcelProperty(value = "事故名称", index = 2)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String incidentName;
|
private String incidentName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故类型")
|
@ApiModelProperty(value = "事故类型")
|
||||||
@ExcelProperty(value = "事故类型", index = 2)
|
@ExcelProperty(value = "事故类型", index = 3)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String incidentTypeName;
|
private String incidentTypeName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "公司")
|
|
||||||
@ExcelProperty(value = "公司", index = 3)
|
|
||||||
private String corpinfoName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故级别")
|
@ApiModelProperty(value = "事故级别")
|
||||||
@ExcelProperty(value = "事故级别", index = 4)
|
@ExcelProperty(value = "事故级别", index = 4)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String incidentLevelName;
|
private String incidentLevelName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故性质")
|
|
||||||
@ExcelProperty(value = "事故性质", index = 5)
|
|
||||||
private String incidentNature;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故发生地点")
|
@ApiModelProperty(value = "事故发生地点")
|
||||||
@ExcelProperty(value = "事故发生地点", index = 6)
|
@ExcelProperty(value = "事故发生地点", index = 5)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故发生时间")
|
@ApiModelProperty(value = "事故发生时间")
|
||||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
@ExcelProperty(value = "事故发生时间", index = 7)
|
@ExcelProperty(value = "事故发生时间", index = 6)
|
||||||
|
@ColumnWidth(20)
|
||||||
private LocalDateTime incidentDate;
|
private LocalDateTime incidentDate;
|
||||||
|
|
||||||
@ApiModelProperty(value = "直接经济损失(万元)")
|
@ApiModelProperty(value = "直接经济损失(万元)")
|
||||||
@ExcelProperty(value = "直接经济损失(万元)", index = 8)
|
@ExcelProperty(value = "直接经济损失(万元)", index = 7)
|
||||||
|
@ColumnWidth(20)
|
||||||
private BigDecimal directLoss;
|
private BigDecimal directLoss;
|
||||||
|
|
||||||
@ApiModelProperty(value = "受伤人数")
|
@ApiModelProperty(value = "受伤人数")
|
||||||
@ExcelProperty(value = "受伤人数", index = 9)
|
@ExcelProperty(value = "受伤人数", index = 8)
|
||||||
|
@ColumnWidth(20)
|
||||||
private Integer injured;
|
private Integer injured;
|
||||||
|
|
||||||
@ApiModelProperty(value = "死亡人数")
|
@ApiModelProperty(value = "死亡人数")
|
||||||
@ExcelProperty(value = "死亡人数", index = 10)
|
@ExcelProperty(value = "死亡人数", index = 9)
|
||||||
|
@ColumnWidth(20)
|
||||||
private Integer fatalities;
|
private Integer fatalities;
|
||||||
|
|
||||||
@ApiModelProperty(value = "重伤人数")
|
@ApiModelProperty(value = "重伤人数")
|
||||||
@ExcelProperty(value = "重伤人数", index = 11)
|
@ExcelProperty(value = "重伤人数", index = 10)
|
||||||
|
@ColumnWidth(20)
|
||||||
private Integer seriouslyInjured;
|
private Integer seriouslyInjured;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故起因")
|
@ApiModelProperty(value = "事故起因")
|
||||||
@ExcelProperty(value = "事故起因", index = 12)
|
@ExcelProperty(value = "事故起因", index = 11)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String cause;
|
private String cause;
|
||||||
|
|
||||||
@ApiModelProperty(value = "事故概述")
|
@ApiModelProperty(value = "事故概述")
|
||||||
@ExcelProperty(value = "事故概述", index = 13)
|
@ExcelProperty(value = "事故概述", index = 12)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String summary;
|
private String summary;
|
||||||
|
|
||||||
@ApiModelProperty(value = "原因分析及责任认定")
|
@ApiModelProperty(value = "原因分析及责任认定")
|
||||||
@ExcelProperty(value = "原因分析及责任认定", index = 14)
|
@ExcelProperty(value = "原因分析及责任认定", index = 13)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String analysis;
|
private String analysis;
|
||||||
|
|
||||||
@ApiModelProperty(value = "考核建议")
|
@ApiModelProperty(value = "考核建议")
|
||||||
@ExcelProperty(value = "考核建议", index = 15)
|
@ExcelProperty(value = "考核建议", index = 14)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String suggestions;
|
private String suggestions;
|
||||||
|
|
||||||
@ApiModelProperty(value = "整改措施")
|
@ApiModelProperty(value = "整改措施")
|
||||||
@ExcelProperty(value = "整改措施", index = 16)
|
@ExcelProperty(value = "整改措施", index = 15)
|
||||||
|
@ColumnWidth(20)
|
||||||
private String measures;
|
private String measures;
|
||||||
|
|
||||||
@ApiModelProperty(value = "报出日期")
|
@ApiModelProperty(value = "报出日期")
|
||||||
@ExcelProperty(value = "报出日期", index = 17)
|
@ExcelProperty(value = "报出日期", index = 16)
|
||||||
|
@ColumnWidth(20)
|
||||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime reportDate;
|
private LocalDateTime reportDate;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
@ -17,7 +18,7 @@ import java.time.LocalDateTime;
|
||||||
@Data
|
@Data
|
||||||
public class AccidentE extends BaseE {
|
public class AccidentE extends BaseE {
|
||||||
//主键id
|
//主键id
|
||||||
private Long id;
|
private String accidentId;
|
||||||
//事故案号
|
//事故案号
|
||||||
private String incidentNumber;
|
private String incidentNumber;
|
||||||
//事故名称
|
//事故名称
|
||||||
|
|
@ -54,9 +55,13 @@ public class AccidentE extends BaseE {
|
||||||
private String suggestions;
|
private String suggestions;
|
||||||
//整改措施
|
//整改措施
|
||||||
private String measures;
|
private String measures;
|
||||||
|
//填报人
|
||||||
|
private String reportUser;
|
||||||
//报出日期
|
//报出日期
|
||||||
private LocalDateTime reportDate;
|
private LocalDateTime reportDate;
|
||||||
//1事件/2事故
|
//1事件/2事故
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
//部门id
|
||||||
|
private Long departmentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -86,6 +87,8 @@ public class AccidentDO extends BaseDO {
|
||||||
//整改措施
|
//整改措施
|
||||||
@ApiModelProperty(value = "整改措施")
|
@ApiModelProperty(value = "整改措施")
|
||||||
private String measures;
|
private String measures;
|
||||||
|
@ApiModelProperty(value = "填报人")
|
||||||
|
private String reportUser;
|
||||||
//报出日期
|
//报出日期
|
||||||
@ApiModelProperty(value = "报出日期")
|
@ApiModelProperty(value = "报出日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
@ -93,6 +96,8 @@ public class AccidentDO extends BaseDO {
|
||||||
//1事件/2事故
|
//1事件/2事故
|
||||||
@ApiModelProperty(value = "1事件/2事故")
|
@ApiModelProperty(value = "1事件/2事故")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "部门id")
|
||||||
|
private Long departmentId;
|
||||||
|
|
||||||
public AccidentDO(String accidentId) {
|
public AccidentDO(String accidentId) {
|
||||||
this.accidentId = accidentId;
|
this.accidentId = accidentId;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
package com.zcloud.accident.persistence.mapper;
|
package com.zcloud.accident.persistence.mapper;
|
||||||
|
|
||||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
|
||||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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 org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-infrastructure
|
* web-infrastructure
|
||||||
* @Author fangjiakai
|
*
|
||||||
* @Date 2025-10-29 14:28:43
|
* @Author fangjiakai
|
||||||
*/
|
* @Date 2025-10-29 14:28:43
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@DataScopes({
|
||||||
|
@DataScope(method = "listPage", menuPerms = ""),
|
||||||
|
@DataScope(method = "list", menuPerms = "")})
|
||||||
public interface AccidentMapper extends BaseMapper<AccidentDO> {
|
public interface AccidentMapper extends BaseMapper<AccidentDO> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,6 +31,10 @@ public interface AccidentMapper extends BaseMapper<AccidentDO> {
|
||||||
* @param eqAccidentType
|
* @param eqAccidentType
|
||||||
* @return 统计结果列表,包含corpinfoId、incidentType和count字段
|
* @return 统计结果列表,包含corpinfoId、incidentType和count字段
|
||||||
*/
|
*/
|
||||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds,@Param("eqAccidentType") Integer eqAccidentType);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,16 @@ import java.util.Map;
|
||||||
* @Date 2025-10-29 14:28:45
|
* @Date 2025-10-29 14:28:45
|
||||||
*/
|
*/
|
||||||
public interface AccidentRepository extends BaseRepository<AccidentDO> {
|
public interface AccidentRepository extends BaseRepository<AccidentDO> {
|
||||||
PageResponse<AccidentDO> listPage(Map<String,Object> params);
|
PageResponse<AccidentDO> listPage(Map<String,Object> params,String menuPerms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有符合条件的数据
|
* 获取所有符合条件的数据
|
||||||
|
*
|
||||||
* @param params 查询参数
|
* @param params 查询参数
|
||||||
|
* @param menuPerms
|
||||||
* @return 数据列表
|
* @return 数据列表
|
||||||
*/
|
*/
|
||||||
List<AccidentDO> listAll(Map<String,Object> params);
|
List<AccidentDO> listAll(Map<String,Object> params,String menuPerms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照corpinfoId和incidentType统计个数
|
* 按照corpinfoId和incidentType统计个数
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,48 @@
|
||||||
package com.zcloud.accident.persistence.repository.impl;
|
package com.zcloud.accident.persistence.repository.impl;
|
||||||
|
|
||||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
|
||||||
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.alibaba.cola.dto.PageResponse;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
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.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.persistence.mapper.AccidentMapper;
|
||||||
|
import com.zcloud.accident.persistence.repository.AccidentRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import com.zcloud.gbscommon.utils.Query;
|
import com.zcloud.gbscommon.utils.Query;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-infrastructure
|
* web-infrastructure
|
||||||
* @Author fangjiakai
|
*
|
||||||
* @Date 2025-10-29 14:28:49
|
* @Author fangjiakai
|
||||||
*/
|
* @Date 2025-10-29 14:28:49
|
||||||
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AccidentRepositoryImpl extends BaseRepositoryImpl<AccidentMapper, AccidentDO> implements AccidentRepository {
|
public class AccidentRepositoryImpl extends BaseRepositoryImpl<AccidentMapper, AccidentDO> implements AccidentRepository {
|
||||||
private final AccidentMapper accidentMapper;
|
private final AccidentMapper accidentMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResponse<AccidentDO> listPage(Map<String,Object> params) {
|
public PageResponse<AccidentDO> listPage(Map<String, Object> params,String menuPerms) {
|
||||||
IPage<AccidentDO> iPage = new Query<AccidentDO>().getPage(params);
|
IPage<AccidentDO> iPage = new Query<AccidentDO>().getPage(params);
|
||||||
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
|
IPage<AccidentDO> result = accidentMapper.listPage(iPage, params,menuPerms);
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
IPage<AccidentDO> result = accidentMapper.selectPage(iPage, queryWrapper);
|
|
||||||
return PageHelper.pageToResponse(result, result.getRecords());
|
return PageHelper.pageToResponse(result, result.getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AccidentDO> listAll(Map<String,Object> params) {
|
public List<AccidentDO> listAll(Map<String, Object> params, String menuPerms) {
|
||||||
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
|
return accidentMapper.list(params, menuPerms);
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
return accidentMapper.selectList(queryWrapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
|
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
|
||||||
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds,eqAccidentType);
|
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds, eqAccidentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,70 @@
|
||||||
|
|
||||||
<mapper namespace="com.zcloud.accident.persistence.mapper.AccidentMapper">
|
<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 >= #{params.geIncidentDate}
|
||||||
|
</if>
|
||||||
|
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
|
||||||
|
and incident_date <= #{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 >= #{params.geIncidentDate}
|
||||||
|
</if>
|
||||||
|
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
|
||||||
|
and incident_date <= #{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 id="countByCorpinfoIdAndIncidentType" resultType="com.zcloud.accident.domain.model.AccidentCountStat">
|
||||||
SELECT
|
SELECT
|
||||||
corpinfo_id,
|
corpinfo_id,
|
||||||
|
|
@ -11,6 +75,7 @@
|
||||||
COUNT(*) as count
|
COUNT(*) as count
|
||||||
from accident
|
from accident
|
||||||
<where>
|
<where>
|
||||||
|
and delete_enum = 'FALSE'
|
||||||
<if test="eqAccidentType != null ">
|
<if test="eqAccidentType != null ">
|
||||||
AND type = #{eqAccidentType}
|
AND type = #{eqAccidentType}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue