Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 4 months ago
parent
commit
5a639d31b0
  1. 9
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskOfflineVO.java
  2. 24
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/InstitutionalEntity.java
  3. 47
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/TrainEntity.java
  4. 26
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/InstitutionalParamVo.java
  5. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/TrainParamVo.java
  6. 20
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/TrainSummaryVo.java
  7. 4
      hzims-service/hzims-basic/pom.xml
  8. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java
  9. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  11. 135
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java
  12. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java
  13. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java
  14. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  15. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/InstitutionalController.java
  16. 57
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/TrainController.java
  17. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java
  18. 15
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.xml
  19. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IInstitutionalService.java
  20. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/ITrainService.java
  21. 30
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/InstitutionalServiceImpl.java
  22. 58
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/TrainServiceImpl.java

9
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskOfflineVO.java

@ -1,8 +1,10 @@
package com.hnac.hzinfo.inspect.task.vo;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
@ -141,5 +143,12 @@ public class TaskOfflineVO extends TenantEntity {
@ApiModelProperty(value = "值班id")
private Long dutyId;
/**
* 路线名称
*/
@ApiModelProperty(value = "路线名称")
@QueryField(condition = SqlCondition.LIKE)
private String routeName;
}

24
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/InstitutionalEntity.java

@ -2,6 +2,7 @@ package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
@ -17,4 +18,27 @@ import org.springblade.core.tenant.mp.TenantEntity;
@ApiModel(value = "制度资料实体类")
public class InstitutionalEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "资料类型 : 0-制度 1-资料")
private Integer dataType;
@ApiModelProperty(value = "文档权限范围 : 0-厂站 1- 完全公开")
private Integer filePurview;
@ApiModelProperty(value = "文档名称")
private String fileName;
@ApiModelProperty(value = "文件说明")
private String fileExplain;
@ApiModelProperty(value = "附件上传地址")
private String dataAttachmentPath;
@ApiModelProperty(value = "附件名称")
private String dataAttachmentName;
}

47
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/TrainEntity.java

@ -1,10 +1,16 @@
package com.hnac.hzims.safeproduct.train.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
@ -12,9 +18,48 @@ import org.springblade.core.tenant.mp.TenantEntity;
* @created 2020/9/8 15:09
**/
@Data
@TableName("hzims_safety_training")
@TableName("hzims_safety_train")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "安全培训实体类")
public class TrainEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "主讲人ID")
private Long speaker;
@ApiModelProperty(value = "主讲人名称")
private String speakerName;
@ApiModelProperty(value = "培训内容")
private String trainContent;
@ApiModelProperty(value = "应到人数")
private Integer answerCount;
@ApiModelProperty(value = "实到人数")
private Integer actualCount;
@ApiModelProperty(value = "培训开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private Date trainStartTime;
@ApiModelProperty(value = "培训结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private Date trainEndTime;
@ApiModelProperty(value = "迟到/缺席人数及原因")
private String lateReason;
@ApiModelProperty(value = "培训附件上次路径")
private String trainAttachmentPath;
@ApiModelProperty(value = "培训附件名称")
private String trainAttachmentName;
}

26
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/InstitutionalParamVo.java

@ -0,0 +1,26 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class InstitutionalParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "资料类型 : 0-制度 1-资料")
private Integer dataType;
@ApiModelProperty(value = "文档名称")
private String fileName;
@ApiModelProperty(value = "文档名称")
private Integer status;
}

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/TrainParamVo.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class TrainParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "培训起止时间")
private String startTime;
@ApiModelProperty(value = "培训结束时间")
private String endTime;
}

20
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/TrainSummaryVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.safeproduct.train.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class TrainSummaryVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "培训次数")
private Integer count;
}

4
hzims-service/hzims-basic/pom.xml

@ -70,12 +70,12 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java

@ -86,8 +86,7 @@ public class OperAccessLibraryServiceImpl extends ServiceImpl<OperAccessLibraryM
}
@Override
public R<OperAccessLibraryVO>
detail(Long id) {
public R<OperAccessLibraryVO> detail(Long id) {
OperAccessLibraryVO detail = OperAccessLibraryWrapper.build(emInfoClient).entityVO(super.getById(id));
if(StringUtils.isEmpty(detail.getSafeInfos())){
R.data(detail);

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1125,25 +1125,35 @@ public class ImsDutyMainServiceImpl extends ServiceImpl<ImsDutyMainMapper, ImsDu
if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){
//如果是接班,算接班的班组+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(collect)){
continue;
}
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(handerCollect)){
continue;
}
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
}else {
//交接班延迟,交接班组都+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)){
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
}
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(handerCollect)){
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
}
}
}
}
@ -1152,25 +1162,35 @@ public class ImsDutyMainServiceImpl extends ServiceImpl<ImsDutyMainMapper, ImsDu
if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){
//如果是接班,算接班的班组+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(collect)){
continue;
}
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(handerCollect)){
continue;
}
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1);
}else {
//交接班延迟,交接班组都+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1);
if(CollectionUtil.isNotEmpty(collect)) {
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts() + 1);
}
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1);
if(CollectionUtil.isNotEmpty(handerCollect)) {
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList());
DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts() + 1);
}
}
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -368,7 +368,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
String powerTitle = deptName + "水电运维项目各电站发电量环比对比图(万kWh)";
String powerDomainAxis = "发电量";
String powerRangeAxis = "站点名称";
ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 400);
ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 500);
map.put("powerChainHistogram", powerChainHistogram);
//柱状图下添加的表格
ArrayList<HashMap<String, String>> powerMap = new ArrayList<>(powerPercentageVoList.size());

135
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java

@ -34,69 +34,80 @@ import java.util.List;
@Slf4j
public class MonthReportServiceImpl extends ServiceImpl<MonthReportMapper, OperMonthReportEntity> implements IMonthReportService {
private final IOperPersonalMonthReportService operPersonalMonthReportService;
private final IOperStationMonthReportService operStationMonthReportService;
private final ISysClient sysClient;
private final IOperPersonalMonthReportService operPersonalMonthReportService;
private final IOperStationMonthReportService operStationMonthReportService;
private final ISysClient sysClient;
@Override
public StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
StationRunReportAllVO stationReportAllVO = new StationRunReportAllVO();
Dept dept = sysClient.getDept(deptId).getData();
OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>(){{
eq(OperMonthReportEntity::getMonth,month);
eq(OperMonthReportEntity::getStationCode, dept.getId());
eq(OperMonthReportEntity::getIsDeleted, 0);
orderByDesc(OperMonthReportEntity::getObject);
last("limit 1;");
}});
//查询实时数据
if(ObjectUtil.isEmpty(operMonthReportEntity)){
stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
}
//历史查询定时任务生成的数据
else{
stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationRunReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
: operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
}
return stationReportAllVO;
}
@Override
public StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
StationRunReportAllVO stationReportAllVO = new StationRunReportAllVO();
Dept dept = sysClient.getDept(deptId).getData();
OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>() {{
eq(OperMonthReportEntity::getMonth, month);
eq(OperMonthReportEntity::getStationCode, dept.getId());
eq(OperMonthReportEntity::getIsDeleted, 0);
orderByDesc(OperMonthReportEntity::getCreateTime);
last("limit 1;");
}});
//查询实时数据
if (ObjectUtil.isEmpty(operMonthReportEntity)) {
stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
OperMonthReportEntity saved = new OperMonthReportEntity();
saved.setMonth(month);
saved.setType(DictConstant.MONTH_REPORT_STATION);
saved.setCreateDept(deptId);
saved.setStationCode(deptId.toString());
try {
saved.setObject(ObjectHelper.obj2byte(stationReportAllVO));
} catch (IOException e) {
log.error("生成统计月报失败{}", e.toString());
e.printStackTrace();
}
//修改为每运行一次,保存一次
this.save(operMonthReportEntity);
}
}
//历史查询定时任务生成的数据
else {
stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationRunReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
: operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
}
return stationReportAllVO;
}
@Override
public void setStationMonthReportByStationCode(Long deptId, String month){
Dept deptVO = sysClient.getDept(deptId).getData();
log.info("---{}机构---",deptVO.getDeptName());
//查询该电站该月报是否已生成月报
OperMonthReportEntity operMonthReportEntityByMonth = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>() {{
eq(OperMonthReportEntity::getMonth, month);
eq(OperMonthReportEntity::getType, DictConstant.MONTH_REPORT_STATION);
eq(OperMonthReportEntity::getStationCode, deptVO.getId());
eq(OperMonthReportEntity::getIsDeleted, 0);
last("limit 1;");
}});
if (ObjectUtil.isEmpty(operMonthReportEntityByMonth)||month.equals(YearMonth.now().toString())) {
if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)){
this.removeById(operMonthReportEntityByMonth.getId());
}
//按站点生成各电站运维月报
StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class));
if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
operMonthReportEntity.setMonth(month);
operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION);
operMonthReportEntity.setCreateDept(deptVO.getId());
operMonthReportEntity.setStationCode(deptVO.getId().toString());
try {
operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
} catch (IOException e) {
e.printStackTrace();
}
//修改为每运行一次,保存一次
this.save(operMonthReportEntity);
}
} else {
log.info("该月{}已生成月报", deptVO.getDeptName());
}
}
@Override
public void setStationMonthReportByStationCode(Long deptId, String month) {
Dept deptVO = sysClient.getDept(deptId).getData();
log.info("---{}机构---", deptVO.getDeptName());
//查询该电站该月报是否已生成月报
OperMonthReportEntity operMonthReportEntityByMonth = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>() {{
eq(OperMonthReportEntity::getMonth, month);
eq(OperMonthReportEntity::getType, DictConstant.MONTH_REPORT_STATION);
eq(OperMonthReportEntity::getStationCode, deptVO.getId());
eq(OperMonthReportEntity::getIsDeleted, 0);
last("limit 1;");
}});
if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) {
this.removeById(operMonthReportEntityByMonth.getId());
}
//按站点生成各电站运维月报
StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class));
if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
operMonthReportEntity.setMonth(month);
operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION);
operMonthReportEntity.setCreateDept(deptVO.getId());
operMonthReportEntity.setStationCode(deptVO.getId().toString());
try {
operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
} catch (IOException e) {
log.error("生成统计月报失败{}", e.toString());
e.printStackTrace();
}
//修改为每运行一次,保存一次
this.save(operMonthReportEntity);
}
}
}

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java

@ -19,6 +19,7 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -74,7 +75,10 @@ public class DangerSourceController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入dangerSource")
public R<DangerSourceVO> detail(@RequestParam Long id) {
public R<DangerSourceVO> detail(@RequestParam(value = "id",required = false) Long id) {
if(ObjectUtil.isEmpty(id)){
return R.data(new DangerSourceVO());
}
return dangerSourceService.detail(id);
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

@ -135,10 +135,10 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> list = this.list(queryWrapper);
list= list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList());
list = list.stream().filter(s -> s.getScore() != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setActualPeopleNum(list.size());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList());
List<TestScoreEntity> passCollect = list.stream().filter(s -> s.getScore() >= testEntity.getPassingScore()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) {
double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue();
testScoreSumVO.setPercentage(result);

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -22,11 +22,11 @@ import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -84,7 +84,7 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
// 查询关联培训记录
List<TrainRecordEntity> trainRecordList = getRelativeTrainRecord(trainPlanId);
// 若无关联培训记录,直接返回true
if (CollectionUtils.isEmpty(trainRecordList)) {
if (CollectionUtil.isEmpty(trainRecordList)) {
return true;
}
// 删除关联培训记录
@ -207,7 +207,7 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
*/
private String getLastCode(String currentMonth) {
List<TrainRecordEntity> list = getTrainByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
if (CollectionUtil.isEmpty(list)) {
return null;
}
return list.get(0).getCode();

42
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/InstitutionalController.java

@ -1,13 +1,22 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import com.hnac.hzims.safeproduct.train.service.IInstitutionalService;
import com.hnac.hzims.safeproduct.train.vo.InstitutionalParamVo;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
@ -19,6 +28,33 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "制度资料")
public class InstitutionalController extends BladeController {
private final IInstitutionalService institutionalService;
private final IInstitutionalService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增制度资料", notes = "传入TrainEntity")
public R save(@RequestBody InstitutionalEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/update")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "修改制度资料", notes = "传入TrainEntity")
public R update(@RequestBody InstitutionalEntity entity) {
return R.status(service.updateById(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "删除制度资料", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
return R.status(service.removeByIds(Func.toLongList(ids)));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页查询制度资料", notes = "查询条件:entity")
public R<IPage<InstitutionalEntity>> pageCondition(InstitutionalParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}
}

57
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/TrainController.java

@ -1,13 +1,25 @@
package com.hnac.hzims.safeproduct.train.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.service.ITrainService;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
@ -15,9 +27,44 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
@RequestMapping("/train")
@Business(module = Constants.APP_NAME, value = "培训管理")
@Api(value = "培训管理", tags = "培训管理接口")
@Business(module = Constants.APP_NAME, value = "安全培训")
@Api(value = "安全培训", tags = "安全培训接口")
public class TrainController extends BladeController {
private final ITrainService trainService;
private final ITrainService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增安全培训", notes = "传入TrainEntity")
public R save(@RequestBody TrainEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/update")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "修改安全培训", notes = "传入TrainEntity")
public R update(@RequestBody TrainEntity entity) {
return R.status(service.updateById(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "删除安全培训", notes = "ids")
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
return R.status(service.removeByIds(Func.toLongList(ids)));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页查询安全培训", notes = "查询条件:entity")
public R<IPage<TrainEntity>> pageCondition(TrainParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}
@GetMapping("/summary")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "汇总", notes = "查询条件:站点ID、月份")
public R<IPage<TrainSummaryVo>> summary(TrainParamVo params, Query query) {
return R.data(service.summary(params, Condition.getPage(query)));
}
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java

@ -1,6 +1,9 @@
package com.hnac.hzims.safeproduct.train.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.vo.TrainParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
@ -10,4 +13,5 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
public interface TrainMapper extends UserDataScopeBaseMapper<TrainEntity> {
IPage<TrainSummaryVo> summary(TrainParamVo params, IPage<TrainSummaryVo> page);
}

15
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.xml

@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.train.mapper.TrainMapper">
<select id="summary" resultType="com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo">
select * from (select station_id,station_name,count(1) as count
from hzims_safety_train
<where>
is_deleted = 0
<if test="params.stationId != null and params.stationId != ''">
and station_id = #{params.stationId}
</if>
<if test="params.month != null and params.month != ''">
and train_start_time like concat('%', #{params.month}, '%')
</if>
</where>
group by station_id,station_name) a
order by a.count desc
</select>
</mapper>

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/IInstitutionalService.java

@ -1,11 +1,14 @@
package com.hnac.hzims.safeproduct.train.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import com.hnac.hzims.safeproduct.train.vo.InstitutionalParamVo;
/**
* @author ysj
*/
public interface IInstitutionalService extends IService<InstitutionalEntity> {
IPage<InstitutionalEntity> pageCondition(InstitutionalParamVo params, IPage<InstitutionalEntity> page);
}

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/ITrainService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.safeproduct.train.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.vo.TrainParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo;
/**
* @author ysj
*/
public interface ITrainService extends IService<TrainEntity> {
IPage<TrainEntity> pageCondition(TrainParamVo params, IPage<TrainEntity> page);
IPage<TrainSummaryVo> summary(TrainParamVo params, IPage<TrainSummaryVo> page);
}

30
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/InstitutionalServiceImpl.java

@ -1,10 +1,16 @@
package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.InstitutionalEntity;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.mapper.InstitutionalMapper;
import com.hnac.hzims.safeproduct.train.service.IInstitutionalService;
import com.hnac.hzims.safeproduct.train.vo.InstitutionalParamVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
@ -16,4 +22,28 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class InstitutionalServiceImpl extends ServiceImpl<InstitutionalMapper, InstitutionalEntity> implements IInstitutionalService {
/**
* 分页列表查询制度资料
* @param params
* @param page
* @return
*/
@Override
public IPage<InstitutionalEntity> pageCondition(InstitutionalParamVo params, IPage<InstitutionalEntity> page) {
LambdaQueryWrapper<InstitutionalEntity> wrapper = new LambdaQueryWrapper();
wrapper.orderByDesc(InstitutionalEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(InstitutionalEntity::getStationId,params.getStationId());
}
if(ObjectUtil.isNotEmpty(params.getDataType())){
wrapper.eq(InstitutionalEntity::getDataType,params.getDataType());
}
if(ObjectUtil.isNotEmpty(params.getFileName())){
wrapper.like(InstitutionalEntity::getFileName,params.getFileName());
}
if(ObjectUtil.isNotEmpty(params.getStatus())){
wrapper.eq(InstitutionalEntity::getStatus,params.getStatus());
}
return super.page(page,wrapper);
}
}

58
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/TrainServiceImpl.java

@ -0,0 +1,58 @@
package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.mapper.TrainMapper;
import com.hnac.hzims.safeproduct.train.service.ITrainService;
import com.hnac.hzims.safeproduct.train.vo.TrainParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
/**
* 安全培训
* @author ysj
*/
@Service
public class TrainServiceImpl extends ServiceImpl<TrainMapper, TrainEntity> implements ITrainService {
/**
* 分页列表查询安全培训
* @param params
* @param page
* @return
*/
@Override
public IPage<TrainEntity> pageCondition(TrainParamVo params, IPage<TrainEntity> page) {
LambdaQueryWrapper<TrainEntity> wrapper = new LambdaQueryWrapper();
wrapper.orderByDesc(TrainEntity::getCreateTime);
if(StringUtil.isNotBlank(params.getStationId())){
wrapper.eq(TrainEntity::getStationId,params.getStartTime());
}
if(StringUtil.isNotBlank(params.getStartTime())){
wrapper.ge(TrainEntity::getTrainStartTime,params.getStartTime());
}
if(StringUtil.isNotBlank(params.getEndTime())){
wrapper.le(TrainEntity::getTrainEndTime,params.getEndTime());
}
return super.page(page,wrapper);
}
/**
* 分页列表查询安全培训汇总
* @param params
* @param page
* @return
*/
@Override
public IPage<TrainSummaryVo> summary(TrainParamVo params, IPage<TrainSummaryVo> page) {
return this.baseMapper.summary(params,page);
}
}
Loading…
Cancel
Save