Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 10 months ago
parent
commit
ec8cf0cfac
  1. 5
      hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java
  2. 112
      hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java
  3. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java
  4. 4
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java
  5. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java
  6. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java
  7. 5
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java
  8. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java
  9. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java
  10. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java
  11. 49
      hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java
  12. 3
      hzims-service/equipment/src/main/resources/db/1.0.2.sql
  13. 14
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  14. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java
  15. 26
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  16. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java
  17. 61
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  18. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  19. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectMapper.xml
  20. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  21. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  22. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  23. 8
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java
  24. 19
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java
  25. 67
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java
  26. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java
  27. 35
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  28. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  29. 62
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java
  30. 43
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceExportVO.java
  31. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx
  32. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
  33. 52
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  34. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java
  35. 38
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

5
hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java

@ -0,0 +1,5 @@
package com.hnac.hzims.common.support.constants;
public enum Order {
ASC,DESC;
}

112
hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java

@ -0,0 +1,112 @@
package com.hnac.hzims.common.support.utils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.support.constants.Order;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.util.Assert;
import java.lang.reflect.Field;
import java.util.*;
import java.util.function.Function;
public class Condition extends org.springblade.core.mp.support.Condition {
public static List<Field> getFieldList(Object object) {
Class<?> clazz = object.getClass();
List<Field> fields = Lists.newArrayList();
while (null != clazz){
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
clazz = clazz.getSuperclass();
}
return fields;
}
public static <T> LambdaQueryWrapper<T> getQueryWrapper(Object query, Class<T> clazz, Map<String,? extends Enum<Order>> orderFields) {
QueryWrapper<T> queryWrapper = getQueryWrapper(query,clazz);
List<Field> fields = getFieldList(query);
// 填充排序字段
orderFields.forEach((fieldNames,order) -> {
Func.toStrList(",",fieldNames).stream().forEach(fieldName -> {
Optional<Field> existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny();
if(existField.isPresent()) {
if(Order.ASC.equals(order)) {
queryWrapper.orderByAsc(fieldName);
}
else if(Order.DESC.equals(order)) {
queryWrapper.orderByDesc(fieldName);
}
}
});
});
return queryWrapper.lambda();
}
private static String camel2under(String c) {
String separator = "_";
c = c.replaceAll("([a-z])([A-Z])", "$1" + separator + "$2").toUpperCase();
return c;
}
private static <T> QueryWrapper<T> getQueryWrapper(Object query, Class<T> clazz) {
QueryWrapper qw = new QueryWrapper();
qw.setEntityClass(clazz);
List<Field> fieldList = getFieldList(query);
for(Field field:fieldList){
field.setAccessible(true);
QueryField queryField = field.getAnnotation(QueryField.class);
if(queryField==null) {
continue;
}
Object value;
try {
value = field.get(query);
} catch (Exception e) {
throw new ServiceException("获取属性性出错");
}
if(value == null) {
continue;
}
List list = null;
if(value instanceof List){
list = (List)value;
if(list.size() == 0) {
continue;
}
}
String condition = queryField.condition();
if(Func.isBlank(condition)) {
continue;
}
String fileName = camel2under(field.getName());
if(SqlCondition.EQUAL.equals(condition)) {
qw.eq(fileName, value);
}else if(SqlCondition.LIKE.equals(condition)){
qw.like(fileName,value);
}else if(SqlCondition.LIKE_LEFT.equals(condition)){
qw.likeLeft(fileName,value);
}else if(SqlCondition.LIKE_RIGHT.equals(condition)){
qw.likeRight(fileName,value);
}else if(SqlCondition.NOT_IN.equals(condition)){
String columnName = queryField.columnName();
Assert.isTrue(Func.isBlank(columnName),() -> {
throw new ServiceException("查询不包含条件时需要指定列名");
});
qw.notIn(camel2under(columnName),list);
}else if(SqlCondition.IN.equals(condition)){
String columnName = queryField.columnName();
Assert.isTrue(Func.isBlank(columnName), () -> {
throw new ServiceException("查询包含条件时需要指定列名");
});
qw.in(camel2under(columnName),list);
}
}
return qw;
}
}

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java

@ -20,6 +20,12 @@ public class ParamBackupsDetailEntity extends TenantEntity implements Serializab
@ApiModelProperty("备份主表ID")
private Long backupsId;
@ApiModelProperty("参数分组")
private Long modelClassifyId;
@ApiModelProperty("参数分组名称")
private String modelClassifyName;
@ApiModelProperty("参数名称")
@QueryField(condition = SqlCondition.LIKE)
private String name;

4
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java

@ -71,5 +71,9 @@ public class InspectTaskExportVO {
@ExcelProperty(value = "巡检状态", index = 9)
@ColumnWidth(value = 20)
private String status;
@ApiModelProperty("巡检类型")
@ExcelProperty(value = "巡检类型", index = 10)
@ColumnWidth(value = 20)
private String type;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java

@ -1,5 +1,11 @@
package com.hnac.hzims.safeproduct.constants;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Optional;
/**
* @author xiashandong
* @created 2021/5/27 10:09
@ -11,4 +17,19 @@ public interface DictConstants {
String DANGER_TYPE = "dangerType";
/**危险等级**/
String RISK_LEVEL = "riskLevel";
@AllArgsConstructor
enum DangerSourceTypeEnum {
OPERATION(1,"作业活动"),
EQUIPMENT(2,"设备"),
;
@Getter
private Integer type;
@Getter
private String typeName;
public static String getTypeNameByType(Integer type) {
Optional<DangerSourceTypeEnum> first = Arrays.stream(DangerSourceTypeEnum.class.getEnumConstants()).filter(e -> type.equals(e.getType())).findFirst();
return first.map(DangerSourceTypeEnum::getTypeName).orElse(null);
}
}
}

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java

@ -1,5 +1,7 @@
package com.hnac.hzims.safeproduct.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
@ -7,6 +9,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
@ -23,12 +27,14 @@ public class DangerSourceEntity extends TenantEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("所属机构")
@QueryField(condition = SqlCondition.EQUAL)
private Long refDept;
@ApiModelProperty("所属机构名称")
private String refDeptName;
@ApiModelProperty(value = "危险源库ID")
@QueryField(condition = SqlCondition.EQUAL)
private Long libraryId;
/**
@ -36,15 +42,18 @@ public class DangerSourceEntity extends TenantEntity {
*/
@ApiModelProperty(value = "危险源类型 1=作业活动 2=设备")
@JsonSerialize(nullsUsing = NullSerializer.class)
@QueryField(condition = SqlCondition.EQUAL)
private Integer type;
/**
* 设备ID
*/
@ApiModelProperty(value = "设备ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
@QueryField(condition = SqlCondition.EQUAL)
private Long eqId;
@ApiModelProperty("设备编号")
@QueryField(condition = SqlCondition.LIKE)
private String emCode;
@ApiModelProperty("设备名称")
@ -53,17 +62,20 @@ public class DangerSourceEntity extends TenantEntity {
* 危险源名称
*/
@ApiModelProperty(value = "危险源名称")
@QueryField(condition = SqlCondition.LIKE)
private String name;
/**
* 危险因素
*/
@ApiModelProperty(value = "危险因素")
@QueryField(condition = SqlCondition.LIKE)
private String dangerEle;
/**
* 应用类型
*/
@ApiModelProperty(value = "应用类型")
@QueryField(condition = SqlCondition.EQUAL)
private String applyType;
/**
* 可能导致的事故
@ -80,6 +92,7 @@ public class DangerSourceEntity extends TenantEntity {
*/
@ApiModelProperty(value = "风险等级 10=稍有危险 20=一般危险 30=显著危险 40=高度危险")
@JsonSerialize(nullsUsing = NullSerializer.class)
@QueryField(condition = SqlCondition.EQUAL)
private Integer level;
}

5
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java

@ -1,5 +1,7 @@
package com.hnac.hzims.safeproduct.hazard.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.hnac.hzims.safeproduct.entity.DangerSourceEntity;
import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum;
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO;
@ -23,6 +25,9 @@ public class DangerSourceVO extends DangerSourceEntity {
@ApiModelProperty(value = "危险等级Name")
private String applyTypeName;
@ApiModelProperty(value = "危险源类型名称")
private String typeName;
@ApiModelProperty("创建人名称")
private String createUserName;

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java

@ -47,4 +47,10 @@ public class HygieneRecordDetailVO {
@ApiModelProperty("检查信息列表")
private List<HygieneZoneDetailVO> checkList;
@ApiModelProperty("年份")
private String year;
@ApiModelProperty("月份")
private String month;
}

7
hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java

@ -64,4 +64,11 @@ public class ParamBackupsController extends BladeController {
return R.status(paramBackupsService.updateById(request));
}
@GetMapping("/reductionParam")
@ApiOperation("根据备份ID还原参数")
@ApiOperationSupport(order = 6)
public R reductionParam(@RequestParam @ApiParam(value = "备份ID",required = true) Long id) {
return R.status(paramBackupsService.reductionParam(id));
}
}

4
hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java

@ -5,10 +5,12 @@ import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.emParam.dto.ParamBackupsDTO;
import com.hnac.hzims.emParam.entity.ParamBackupsEntity;
import com.hnac.hzims.emParam.vo.ParamBackupsVO;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
public interface IParamBackupsService extends BaseService<ParamBackupsEntity> {
@ -18,6 +20,8 @@ public interface IParamBackupsService extends BaseService<ParamBackupsEntity> {
Boolean updateById(ParamBackupsDTO request);
Boolean reductionParam(Long id);
default LambdaQueryWrapper<ParamBackupsEntity> getQueryWrapper(ParamBackupsDTO request) {
ParamBackupsEntity paramBackupsEntity = BeanUtil.copy(request, ParamBackupsEntity.class);
LambdaQueryWrapper<ParamBackupsEntity> queryWrapper = Condition.getQueryWrapper(ParamBackupsEntity.class, paramBackupsEntity);

49
hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.emParam.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.emParam.dto.ParamBackupsDTO;
@ -9,12 +10,19 @@ import com.hnac.hzims.emParam.mapper.ParamBackupsDetailMapper;
import com.hnac.hzims.emParam.mapper.ParamBackupsMapper;
import com.hnac.hzims.emParam.service.IParamBackupsDetailService;
import com.hnac.hzims.emParam.service.IParamBackupsService;
import com.hnac.hzims.emParam.vo.ParamBackupsDetailVO;
import com.hnac.hzims.emParam.vo.ParamBackupsVO;
import com.hnac.hzims.emParam.wrapper.ParamBackupsDetailWrapper;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.control.ControlClient;
import com.hnac.hzinfo.sdk.v5.control.dto.ControlBatchDTO;
import com.hnac.hzinfo.sdk.v5.control.dto.Ctrl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
@ -24,7 +32,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.sql.rowset.serial.SerialException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@ -34,6 +44,8 @@ import java.util.stream.Collectors;
public class ParamBackupsServiceImpl extends BaseServiceImpl<ParamBackupsMapper, ParamBackupsEntity> implements IParamBackupsService {
private final IParamBackupsDetailService detailService;
private final ControlClient controlClient;
private final BladeLogger logger;
@Override
@Transactional
@ -86,5 +98,42 @@ public class ParamBackupsServiceImpl extends BaseServiceImpl<ParamBackupsMapper,
return false;
}
@Override
public Boolean reductionParam(Long id) {
ParamBackupsVO backup = this.detail(id);
List<ParamBackupsDetailVO> paramList = backup.getDetailList();
Assert.isTrue(CollectionUtil.isNotEmpty(paramList),() -> {
throw new ServiceException("备份参数不能为空!");
});
Map<Long, List<ParamBackupsDetailVO>> detailMap = paramList.stream().collect(Collectors.groupingBy(ParamBackupsDetailVO::getModelClassifyId));
detailMap.forEach((classifyId,list) -> {
ControlBatchDTO controlBatchDTO = new ControlBatchDTO();
controlBatchDTO.setProjectId(backup.getStationCode());
controlBatchDTO.setDeviceCode(backup.getEmCode());
controlBatchDTO.setDelay(backup.getDelay());
controlBatchDTO.setOperator(String.valueOf(AuthUtil.getUserId()));
controlBatchDTO.setMachineCode(backup.getMachineCode());
List<Ctrl> ctrl = paramList.stream().map(this::convert).collect(Collectors.toList());
controlBatchDTO.setCtrls(ctrl);
log.info("{}", JSON.toJSONString(controlBatchDTO));
Result<Object> result = controlClient.batchSendToDevice(controlBatchDTO);
if(!result.isSuccess()) {
logger.error("equipment:ParamServiceImpl:distribute", "下发参数传参为:" + JSON.toJSONString(controlBatchDTO) + ";下发结果为:" + JSON.toJSONString(result));
throw new ServiceException("参数还原调用下发接口失败,返回结果为:"+result.getMsg());
}
});
return true;
}
private Ctrl convert(ParamBackupsDetailVO param) {
Ctrl result = new Ctrl();
result.setSignage(param.getSignage());
Map params = new HashMap(1){{
put(param.getSignage(),param.getValue());
}};
result.setParams(params);
return result;
}
}

3
hzims-service/equipment/src/main/resources/db/1.0.2.sql

@ -0,0 +1,3 @@
-- 参数分组还原添加字段
alter table `HZIMS_PARAM_BACKUPS_DETAIL` add column `model_classify_id` BIGINT(20) COMMENT '参数分组';
alter table `HZIMS_PARAM_BACKUPS_DETAIL` add column `model_classify_name` BIGINT(20) COMMENT '参数分组名称';

14
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -120,7 +120,7 @@ public class TaskController extends BladeController {
@PostMapping("/listPage")
@ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task")
@ApiOperationSupport(order = 1)
public R<IPage<TaskVo>> listPage(@RequestBody TaskDTO taskDTO) {
public R<BladePage<TaskVo>> listPage(@RequestBody TaskDTO taskDTO) {
return R.data(taskService.page(taskDTO));
}
@ -158,12 +158,12 @@ public class TaskController extends BladeController {
@ApiOperation(value = "巡检任务导出", notes = "传入计划id")
public void exportTaskList(HttpServletResponse response,@RequestBody TaskDTO task) {
try {
if(ObjectUtils.isEmpty(task.getStartTime())&&ObjectUtils.isEmpty(task.getEndTime())){
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
task.setStartTime(firstDay);
task.setEndTime(date);
}
// if(ObjectUtils.isEmpty(task.getStartTime())&&ObjectUtils.isEmpty(task.getEndTime())){
// LocalDateTime date = LocalDateTime.now();
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// task.setStartTime(firstDay);
// task.setEndTime(date);
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.mapper;
import com.hnac.hzinfo.inspect.task.dto.TaskDTO;
import com.hnac.hzinfo.inspect.task.vo.TaskCountVO;
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO;
import org.springblade.core.datascope.annotation.UserDataAuth;
@ -27,6 +28,9 @@ public interface TaskMapper extends UserDataScopeBaseMapper<TaskEntity> {
*/
List<TaskVo> getListPage(@Param("page") IPage<TaskVo> page, @Param("task") TaskListQuery task);
List<TaskVo> getAllPageList(@Param("page") IPage<TaskVo> page, @Param("task") TaskDTO taskDTO);
List<TaskVo> getAllExportList(@Param("task") TaskDTO taskDTO);
List<TaskVo> mainQueryPage(@Param("page") IPage<TaskVo> page, @Param("task") TaskListQuery task);
/**

26
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -173,6 +173,32 @@
</if>
order by t.UPDATE_TIME desc
</select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID as userIds,u.USER_NAME from HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID
and u.IS_DELETED=0
where t.IS_DELETED=0
<if test="task.userId != null ">
and u.USER_ID=#{task.userId}
</if>
<include refid="getTaskListSql"></include>
order by t.UPDATE_TIME desc
</select>
<select id="getAllExportList" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,b.USER_ID as userIds,(SELECT group_concat(u .user_name) FROM HZ_ST_EX_TASK_USER u WHERE t.ID=u.TASK_ID
<if test="task.userId != null ">
and u.USER_ID=#{task.userId}
</if>) AS userNames from HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER b on t.ID=b.TASK_ID
and b.IS_DELETED=0
where t.IS_DELETED=0
<if test="task.userId != null ">
and u.USER_ID=#{task.userId}
</if>
<include refid="getTaskListSql"></include>
GROUP BY t.id
order by t.UPDATE_TIME desc
</select>
<select id="getListPageOfTaskRecord" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.entity.TaskEntity">

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java

@ -64,7 +64,7 @@ public interface ITaskService extends BaseService<TaskEntity> {
*/
List<TaskObjectVO> getTaskById(Long id);
IPage<TaskVo> page(TaskDTO taskDTO);
BladePage<TaskVo> page(TaskDTO taskDTO);
/**
* PC端任务列表

61
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -524,18 +524,24 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
}
@Override
public IPage<TaskVo> page(TaskDTO taskDTO) {
public BladePage<TaskVo> page(TaskDTO taskDTO) {
Query query = new Query();
query.setSize(taskDTO.getSize());
query.setCurrent(taskDTO.getCurrent());
TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class);
LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request);
getQueryWrapper(taskDTO, queryWrapper);
IPage page = this.page(Condition.getPage(query), queryWrapper);
List<TaskEntity> records = page.getRecords();
List<TaskVo> taskVos = getTaskVos(records);
page.setRecords(taskVos);
return page;
IPage<TaskVo> pages = Condition.getPage(query);
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO);
list = list.stream().map(taskVo -> {
// 获取机器人信息
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) {
if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) {
taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId()));
}
}
return taskVo;
}).collect(Collectors.toList());
pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages);
return bladePage;
}
private void getQueryWrapper(TaskDTO taskDTO, LambdaQueryWrapper<TaskEntity> queryWrapper) {
@ -1020,10 +1026,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
@Override
public List<InspectTaskExportVO> exportTaskList(TaskDTO task) {
TaskEntity request = BeanUtil.copy(task,TaskEntity.class);
LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request);
getQueryWrapper(task, queryWrapper);
List<TaskEntity> taskEntities = super.baseMapper.selectList(queryWrapper);
List<TaskVo> taskEntities = super.baseMapper.getAllExportList(task);
List<InspectTaskExportVO> list=new ArrayList<>();
if (CollectionUtils.isNotEmpty(taskEntities)){
list=taskEntities.parallelStream().map(taskVo -> {
@ -1062,22 +1065,26 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} else {
resEntity.setContent("正常");
}
if(ObjectUtil.isNotEmpty(taskVo.getId())) {
List<TaskUserEntity> taskUserList = taskUserService.list(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, taskVo.getId()));
if (CollectionUtil.isNotEmpty(taskUserList)) {
// 获取巡检任务人员名称
String userNames = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId).filter(Func::isNotEmpty)
.map(userId -> {
User user = UserCache.getUser(userId);
if (ObjectUtil.isEmpty(user)) {
return "";
}
return user.getName();
}).collect(Collectors.joining(","));
resEntity.setUserName(userNames);
}
if (ObjectUtil.isNotEmpty(taskVo.getUserNames())) {
resEntity.setUserName(taskVo.getUserNames());
}
// if(ObjectUtil.isNotEmpty(taskVo.getId())) {
// List<TaskUserEntity> taskUserList = taskUserService.list(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, taskVo.getId()));
// if (CollectionUtil.isNotEmpty(taskUserList)) {
// // 获取巡检任务人员名称
// String userNames = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId).filter(Func::isNotEmpty)
// .map(userId -> {
// User user = UserCache.getUser(userId);
// if (ObjectUtil.isEmpty(user)) {
// return "";
// }
// return user.getName();
// }).collect(Collectors.joining(","));
// resEntity.setUserName(userNames);
// }
// }
resEntity.setStatus(Optional.ofNullable(DictCache.getValue(TaskContants.TASK_STATUS, taskVo.getStatus())).orElse(""));
resEntity.setType(Optional.ofNullable(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, taskVo.getStatus())).orElse(""));
return resEntity;
}catch (Exception e){
log.error("巡检导出失败---》param"+taskVo+"报错信息:"+e.getStackTrace());

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java

@ -107,12 +107,12 @@ public class OperDefectStatisticsController extends BladeController {
public void exportDefectList(HttpServletResponse response,@RequestBody OperDefectStatisticsVO entity) {
try {
long timeMillis = System.currentTimeMillis();
if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
entity.setCreateEndTime(new Date());
}
// if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
// LocalDateTime date = LocalDateTime.now();
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
// entity.setCreateEndTime(new Date());
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectMapper.xml

@ -4,7 +4,7 @@
<select id="getStatisticByMonth"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from
SELECT P.DEFECT_LEVEL as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from
hzims_oper_phenomenon P
WHERE DATE_FORMAT(P.CREATE_TIME,'%Y-%m') = #{month}
<if test="createDept != null and createDept.size > 0">
@ -13,16 +13,16 @@
#{item}
</foreach>
</if>
and P.DEFECT_GRADING IS NOT NULL
and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1'
AND P.IS_DELETED = '0'
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING
GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_LEVEL
</select>
<select id="getStatisticBySeveralMonth"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM
SELECT P.DEFECT_LEVEL as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM
from hzims_oper_phenomenon P
WHERE P.CREATE_TIME BETWEEN #{firstMonth} AND #{endMonth}
<if test="createDept != null and createDept.size > 0">
@ -33,13 +33,13 @@
</if>
AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0
and P.DEFECT_GRADING IS NOT NULL
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING
and P.DEFECT_LEVEL IS NOT NULL
GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_LEVEL
</select>
<select id="getRepetStatistics"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsCodeDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.FAULT_CODE,COUNT(P.ID) AS DEFECT_NUM from
SELECT P.DEFECT_LEVEL as defectLevel,P.FAULT_CODE,COUNT(P.ID) AS DEFECT_NUM from
hzims_oper_phenomenon P
WHERE 1=1
<if test="createDept != null and createDept.size > 0">
@ -48,10 +48,10 @@
#{item}
</foreach>
</if>
and P.DEFECT_GRADING IS NOT NULL
and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0
GROUP BY P.DEFECT_GRADING,P.FAULT_CODE
GROUP BY P.DEFECT_LEVEL,P.FAULT_CODE
</select>
<select id="getManageIndex" resultType="java.lang.Integer">
@ -61,7 +61,7 @@
AND P.HANDLE_STATUS = 1
AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0
and P.DEFECT_GRADING IS NOT NULL
and P.DEFECT_LEVEL IS NOT NULL
AND P.ACT_END_TIME &lt;= P.PLAN_END_TIME
<if test="createDept != null and createDept.size > 0">
AND P.CREATE_DEPT in
@ -78,7 +78,7 @@
AND D.HANDLE_STATUS = 1
AND D.IS_DEFECT='1'
AND D.IS_DELETED = 0
and D.DEFECT_GRADING IS NOT NULL
and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -94,7 +94,7 @@
AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0
AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL
and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -110,7 +110,7 @@
AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0
AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL
and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -125,7 +125,7 @@
WHERE DATE_FORMAT(D.CREATE_TIME,'%Y-%m') = #{month}
AND D.IS_DELETED = 0
AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL
and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -1420,17 +1420,18 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// 交接班接班信息填充
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal());
recDTO.setAcceptTime(new Date());
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity();
ImsDutyLogEntity update = imsDutyLogService.getOne(Wrappers.<ImsDutyLogEntity>lambdaQuery()
.eq(ImsDutyLogEntity::getDutyId, imsDutyLogEntity.getDutyId())
.eq(ImsDutyLogEntity::getDutyId, headDutyMain.getId())
.last("limit 1"));
update.setCarryTime(DateUtil.format(new Date(), PATTERN_DATETIME));
imsDutyLogService.updateById(update);
if(ObjectUtil.isNotEmpty(update)) {
update.setCarryTime(DateUtil.format(new Date(), PATTERN_DATETIME));
imsDutyLogService.updateById(update);
// imsDutyLogService.update(Wrappers.<ImsDutyLogEntity>lambdaUpdate()
// .set(ImsDutyLogEntity::getCarryTime, DateUtil.format(new Date(), PATTERN_DATETIME))
// .eq(ImsDutyLogEntity::getDutyId,imsDutyLogEntity.getDutyId())
// );
log.info("更新值班日志");
log.info("更新值班日志");
}
}
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class);
// 更新交班值班

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java

@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity;
import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity;
import com.hnac.hzims.safeproduct.service.IRehearsalPlanService;

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

@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;

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

@ -22,6 +22,7 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -119,4 +120,11 @@ public class DangerSourceController extends BladeController {
public R importDangerSource(@RequestBody HazardInstanceDTO req) {
return R.status(dangerSourceService.importDangerSource(req));
}
@GetMapping("/exportDangerSource")
@ApiOperation("导出危险源")
@ApiOperationSupport(order = 90)
public void exportDangerSource(DangerSourceEntity req, HttpServletResponse response) {
dangerSourceService.exportDangerSource(req,response);
}
}

19
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java

@ -1,6 +1,9 @@
package com.hnac.hzims.safeproduct.hazard.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.common.support.constants.Order;
import com.hnac.hzims.common.support.utils.Condition;
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO;
import com.hnac.hzims.safeproduct.entity.DangerSourceEntity;
import com.hnac.hzims.safeproduct.hazard.dto.HazardInstanceDTO;
@ -13,7 +16,10 @@ import org.springblade.core.tool.api.R;
import org.springblade.system.vo.CreateTableVO;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author xiashandong
@ -44,4 +50,17 @@ public interface IDangerSourceService extends BaseService<DangerSourceEntity> {
List<DangerSourceEntity> safes(String safeInfos);
Boolean importDangerSource(HazardInstanceDTO req);
/**
* 导出危险源
* @param req 筛选条件
* @param response 请求响应
*/
void exportDangerSource(DangerSourceEntity req, HttpServletResponse response);
default LambdaQueryWrapper<DangerSourceEntity> getQueryWrapper(Object req) {
Map<String, Order> param = new HashMap<>();
param.put("create_time,update_time",Order.DESC);
return Condition.getQueryWrapper(req,DangerSourceEntity.class,param);
}
}

67
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java

@ -1,5 +1,8 @@
package com.hnac.hzims.safeproduct.hazard.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -7,8 +10,10 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.common.support.constants.Order;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.operational.maintenance.vo.MaintenanceTaskQueryVO;
import com.hnac.hzims.safeproduct.constants.DictConstants;
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO;
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourcePositionDTO;
@ -25,6 +30,7 @@ import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService;
import com.hnac.hzims.safeproduct.utils.ExcelToolListener;
import com.hnac.hzims.safeproduct.utils.TableJsonUtils;
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO;
import com.hnac.hzims.safeproduct.vo.DangerSourceExportVO;
import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO;
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO;
import com.hnac.hzims.safeproduct.vo.SourceVO;
@ -33,6 +39,7 @@ import com.hnac.hzims.safeproduct.hazard.wrapper.DangerSourceWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.springblade.core.excel.support.ExcelException;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -52,9 +59,12 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -174,28 +184,7 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
@Override
public R<IPage<DangerSourceVO>> pageCondition(DangerSourceEntity req, Query query) {
Wrapper<DangerSourceEntity> queryWrapper = new LambdaQueryWrapper<DangerSourceEntity>() {{
orderByDesc(DangerSourceEntity::getCreateTime);
if (req.getType() != null) {
eq(DangerSourceEntity::getType, req.getType());
}
if (null != req.getEqId()) {
eq(DangerSourceEntity::getEqId, req.getEqId());
}
if (null != req.getLevel()) {
eq(DangerSourceEntity::getLevel, req.getLevel());
}
if (StringUtil.isNotBlank(req.getName())) {
like(DangerSourceEntity::getName, req.getName());
}
if (StringUtil.isNotBlank(req.getDangerEle())) {
like(DangerSourceEntity::getDangerEle, req.getDangerEle());
}
if (StringUtil.isNotBlank(req.getApplyType())) {
eq(DangerSourceEntity::getApplyType, req.getApplyType());
}
}};
IPage page = super.page(Condition.getPage(query), queryWrapper);
IPage page = super.page(Condition.getPage(query), getQueryWrapper(req));
page.setRecords(DangerSourceWrapper.build().listVO(page.getRecords()));
return R.data(page);
}
@ -327,6 +316,8 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
List<DangerSourceEntity> sourceList = req.getHazardList().stream().map(h -> {
DangerSourceEntity result = JSONObject.parseObject(JSON.toJSONString(h), DangerSourceEntity.class);
result.setId(null);
result.setEmCode(req.getEmCode());
result.setEmName(req.getEmName());
result.setLibraryId(h.getId());
result.setRefDept(req.getDeptId());
result.setRefDeptName(req.getDeptName());
@ -342,6 +333,38 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
}
@Override
public void exportDangerSource(DangerSourceEntity req, HttpServletResponse response) {
List<DangerSourceEntity> dangerSourceList = this.list(getQueryWrapper(req));
List<DangerSourceVO> voList = DangerSourceWrapper.build().listVO(dangerSourceList);
List<DangerSourceExportVO> exportVOList = BeanUtil.copy(voList, DangerSourceExportVO.class);
// 设置响应头
// URLEncoder.encode防止中文乱码
String fileName;
try {
fileName = URLEncoder.encode("危险点列表", "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
contentWriteCellStyle.setWrapped(true);
try {
EasyExcel.write(response.getOutputStream(), DangerSourceExportVO.class)
.registerWriteHandler(new HorizontalCellStyleStrategy(new WriteCellStyle(), contentWriteCellStyle))
.autoCloseStream(Boolean.FALSE).sheet("危险点列表")
.doWrite(exportVOList);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public List<SourceVO> listByTenantId(String tenantId) {
return this.baseMapper.listByTenantId(tenantId);
}

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java

@ -29,6 +29,8 @@ public class DangerSourceWrapper extends BaseEntityWrapper<DangerSourceEntity, D
vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null));
vo.setUpdateUserName(Optional.ofNullable(updateUser).map(User::getName).orElse(null));
vo.setApplyTypeName(DictCache.getValue(DictConstants.SAFE_DANGER_SOURCE_APPLY_TYPE, entity.getApplyType()));
vo.setLevelName(DictCache.getValue(DictConstants.RISK_LEVEL, entity.getLevel()));
vo.setTypeName(DictConstants.DangerSourceTypeEnum.getTypeNameByType(entity.getType()));
return vo;
}

35
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -94,7 +94,7 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",");
for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
@ -122,7 +122,7 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",");
for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
@ -138,11 +138,11 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
@Override
public HygieneRecordDetailVO getRecordDetail(Long id) {
HygieneRecordDetailVO recordDetailVO = baseMapper.getRecordDetail(id);
String[] zoneIds = recordDetailVO.getHygieneZoneIds().split(",|,");
String[] results = recordDetailVO.getCheckResult().split(",|,");
String[] scores = recordDetailVO.getComprehensiveScore().split(",|,");
String[] zoneIds = recordDetailVO.getHygieneZoneIds().split(",");
String[] results = recordDetailVO.getCheckResult().split(",");
String[] scores = recordDetailVO.getComprehensiveScore().split(",");
List<HygieneZoneDetailVO> checkDetailVOList = new ArrayList<>();
for (int i = 0; i < zoneIds.length ; i++) {
for (int i = 0; i < zoneIds.length; i++) {
HygieneZoneDetailVO zoneDetailVO = new HygieneZoneDetailVO();
HygieneZoneEntity hygieneZoneEntity = hygieneZoneService.getById(zoneIds[i]);
BeanUtils.copyProperties(hygieneZoneEntity, zoneDetailVO);
@ -169,6 +169,29 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
@Override
public void exportHygieneRecordData(Long id, HttpServletResponse response) {
HygieneRecordDetailVO hygieneRecordDetailVO = this.getRecordDetail(id);
// 数据处理
// 检查项
List<HygieneZoneDetailVO> checkList = hygieneRecordDetailVO.getCheckList();
List<HygieneZoneDetailVO> res = new ArrayList<>();
checkList.forEach(item -> {
String[] checkItem = item.getCheckItem().split(",");
String[] checkItemScore = item.getCheckItemScore().split(",");
for (int i = 0; i < checkItem.length; i++) {
HygieneZoneDetailVO hygieneZoneDetailVO = new HygieneZoneDetailVO();
hygieneZoneDetailVO.setZone(item.getZone());
hygieneZoneDetailVO.setPrincipal(item.getPrincipal());
hygieneZoneDetailVO.setResult(item.getResult());
hygieneZoneDetailVO.setScore(item.getScore());
hygieneZoneDetailVO.setCheckItem(checkItem[i]);
hygieneZoneDetailVO.setCheckItemScore(checkItemScore[i]);
res.add(hygieneZoneDetailVO);
}
});
// 表头
String code = hygieneRecordDetailVO.getCode();
hygieneRecordDetailVO.setYear(code.substring(4, 8));
hygieneRecordDetailVO.setMonth(code.substring(8, 10));
hygieneRecordDetailVO.setCheckList(res);
Map<String, Object> params = BaseUtil.obj2Map(hygieneRecordDetailVO);
String templateFile = "template/卫生自查表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/卫生自查表" + SafeProductConstant.DOCX_SUFFIX;

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

@ -70,7 +70,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
TestEntity test = getTestByCode(testEntity.getCode());
// 获取姓名数组
String people = test.getPeopleName();
String[] person = people.split(",|,");
String[] person = people.split(",");
// 新增参考人员成绩数据
List<TestScoreEntity> scoreList = getReferenceTestScore(test, person);
return R.status(testScoreService.saveBatch(scoreList));
@ -169,7 +169,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
boolean removeByIds = testScoreService.removeByIds(scoreIds);
// 若删除成功,新增新的考试成绩数据
if (removeByIds) {
String[] person = testEntity.getPeopleName().split(",|,");
String[] person = testEntity.getPeopleName().split(",");
// 新增参考人员成绩数据
List<TestScoreEntity> scoreList = getReferenceTestScore(testEntity, person);
return testScoreService.saveBatch(scoreList);

62
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -6,6 +6,10 @@ import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
@ -106,11 +110,15 @@ public class BaseUtil {
* 数据写入
* @param templatePath 模板文件路径
* @param params 数据参数
* @return 文件
*/
public static XWPFDocument fillDocument(String templatePath, Map<String, Object> params) {
XWPFDocument xwpfDocument = null;
try {
xwpfDocument = WordExportUtil.exportWord07(templatePath, params);
if (templatePath.equals("template/卫生自查表.docx")) {
formatHygieneRecordTable(xwpfDocument);
}
} catch (Exception e) {
log.error("数据写入异常: {}", e.getMessage());
e.printStackTrace();
@ -119,6 +127,60 @@ public class BaseUtil {
}
/**
* 卫生自查表格式处理
* @param xwpfDocument word文件类
*/
private static void formatHygieneRecordTable(XWPFDocument xwpfDocument) {
// 获取文档中所有的表格
List<XWPFTable> tableList = xwpfDocument.getTables();
if (tableList.size() > 0) {
// 循环表格
for (XWPFTable table : tableList) {
// 获取表格所有行数
List<XWPFTableRow> rows = table.getRows();
// 第三行到倒数第二行为需合并区域
for (int row = 3; row < rows.size() - 1;) {
XWPFTableCell startCell = rows.get(row).getCell(0);
String startText = startCell.getText();
int index = row + 1;
for (; index < rows.size(); index++) {
XWPFTableCell endCell = rows.get(index).getCell(0);
String endText = endCell.getText();
if (!startText.equals(endText)) {
break;
}
}
mergeCellsVertically(table, 0, row, index - 1);
mergeCellsVertically(table, 1, row, index - 1);
mergeCellsVertically(table, 4, row, index - 1);
mergeCellsVertically(table, 5, row, index - 1);
row = index;
}
}
}
}
/**
* word单元格行合并
* @param table 表格
* @param col 合并行所在列
* @param startRow 开始行
* @param endRow 结束行
*/
public static void mergeCellsVertically(XWPFTable table, int col, int startRow, int endRow) {
for (int i = startRow; i <= endRow; i++) {
XWPFTableCell cell = table.getRow(i).getCell(col);
if (i == startRow) {
// The first merged cell is set with RESTART merge value
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART);
} else {
// Cells which join (merge) the first one, are set with CONTINUE
cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE);
}
}
}
/**
* 读取本地pdf,这里设置的是预览
* @param response 响应类
* @param filePath 文件路径

43
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceExportVO.java

@ -0,0 +1,43 @@
package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode
public class DangerSourceExportVO implements Serializable {
@ExcelProperty(value = "所属站点",index = 0)
@ColumnWidth(value = 25)
private String refDeptName;
@ExcelProperty(value = "危险源类型",index = 1)
@ColumnWidth(value = 15)
private String typeName;
@ExcelProperty(value = "风险等级",index = 2)
@ColumnWidth(value = 20)
private String levelName;
@ExcelProperty(value = "设备",index = 3)
@ColumnWidth(value = 15)
private String emName;
@ExcelProperty(value = "危险源名称",index = 4)
@ColumnWidth(value = 30)
private String name;
@ExcelProperty(value = "危险因素",index = 5)
@ColumnWidth(value = 30)
private String dangerEle;
@ExcelProperty(value = "措施",index = 6)
@ColumnWidth(value = 40)
private String measures;
}

BIN
hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx

Binary file not shown.

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java

@ -106,12 +106,12 @@ public class StandardTicketInfoController extends BladeController {
= "操作票导出")
public void exportStandardTicket(HttpServletResponse response,@RequestBody StandardTicketInfoDto req) {
try {
if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
req.setStartTime(firstDay);
req.setEndTime(date);
}
// if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
// LocalDateTime date = LocalDateTime.now();
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// req.setStartTime(firstDay);
// req.setEndTime(date);
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

52
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -840,30 +840,42 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
exportVO.setTicketType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE, standardTicketInfoEntity.getTicketType())).orElse(null));
exportVO.setCode(Optional.ofNullable(standardTicketInfoEntity.getCode()).orElse(null));
exportVO.setTitle(Optional.ofNullable(standardTicketInfoEntity.getTitle()).orElse(null));
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getIssueOrderPerson())) {
User issueOrderPerson = UserCache.getUser(standardTicketInfoEntity.getIssueOrderPerson());
if (ObjectUtil.isNotEmpty(issueOrderPerson)) {
exportVO.setIssueOrderPerson(issueOrderPerson.getName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getIssueOrderPersonName())) {
exportVO.setIssueOrderPerson(standardTicketInfoEntity.getIssueOrderPersonName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getAccessOrderPerson())) {
User accessOrderPerson = UserCache.getUser(standardTicketInfoEntity.getAccessOrderPerson());
if (ObjectUtil.isNotEmpty(accessOrderPerson)) {
exportVO.setAccessOrderPerson(accessOrderPerson.getName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getAccessOrderPersonName())) {
exportVO.setAccessOrderPerson(standardTicketInfoEntity.getAccessOrderPersonName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getGuardian())) {
User guardian = UserCache.getUser(standardTicketInfoEntity.getGuardian());
if (ObjectUtil.isNotEmpty(guardian)) {
exportVO.setGuardian(guardian.getName());
}
// if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getIssueOrderPerson())) {
// User issueOrderPerson = UserCache.getUser(standardTicketInfoEntity.getIssueOrderPerson());
// if (ObjectUtil.isNotEmpty(issueOrderPerson)) {
// exportVO.setIssueOrderPerson(issueOrderPerson.getName());
// }
// }
// if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getAccessOrderPerson())) {
// User accessOrderPerson = UserCache.getUser(standardTicketInfoEntity.getAccessOrderPerson());
// if (ObjectUtil.isNotEmpty(accessOrderPerson)) {
// exportVO.setAccessOrderPerson(accessOrderPerson.getName());
// }
// }
// if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getGuardian())) {
// User guardian = UserCache.getUser(standardTicketInfoEntity.getGuardian());
// if (ObjectUtil.isNotEmpty(guardian)) {
// exportVO.setGuardian(guardian.getName());
// }
// }
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getGuardianName())) {
exportVO.setGuardian(standardTicketInfoEntity.getGuardianName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getPrincipal())) {
User principal = UserCache.getUser(standardTicketInfoEntity.getPrincipal());
if (ObjectUtil.isNotEmpty(principal)) {
exportVO.setPrincipal(principal.getName());
}
if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getPrincipalName())) {
exportVO.setPrincipal(standardTicketInfoEntity.getPrincipalName());
}
// if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getPrincipal())) {
// User principal = UserCache.getUser(standardTicketInfoEntity.getPrincipal());
// if (ObjectUtil.isNotEmpty(principal)) {
// exportVO.setPrincipal(principal.getName());
// }
// }
exportVO.setStartTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getStartTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
exportVO.setEndTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
exportVO.setIsEvaluate("未评价");

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java

@ -138,14 +138,14 @@ public class WorkTicketInfoController {
= "工作票导出")
public void exportWorkTicket(HttpServletResponse response,@RequestBody WorkTicketInfoDto req) {
try {
if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
LocalDateTime date = LocalDateTime.now();
String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
req.setStartTime(firstDate);
req.setEndTime(nowDate);
}
// if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
// LocalDateTime date = LocalDateTime.now();
// String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// req.setStartTime(firstDate);
// req.setEndTime(nowDate);
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

38
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -1273,31 +1273,29 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
resEntity.setType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE, workTicketInfoVO.getType())).orElse(""));
resEntity.setCode(Optional.ofNullable(workTicketInfoVO.getCode()).orElse(""));
resEntity.setWorkContent(Optional.ofNullable(workTicketInfoVO.getWorkContent()).orElse(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSigner())) {
User user = UserCache.getUser(workTicketInfoVO.getSigner());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setSigner(user.getName());
}
// if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSigner())) {
// User user = UserCache.getUser(workTicketInfoVO.getSigner());
// if (ObjectUtil.isNotEmpty(user)) {
// resEntity.setSigner(user.getName());
// }
// }
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSignerName())) {
resEntity.setSigner(workTicketInfoVO.getSignerName());
}
//负责人-线上和线下
if (Func.isEmpty(workTicketInfoVO.getPrincipal())) {
if (Func.isEmpty(workTicketInfoVO.getPrincipalName())) {
resEntity.setPrincipal(workTicketInfoVO.getPrincipalManual());
} else {
User principal = UserCache.getUser(workTicketInfoVO.getPrincipal());
if (ObjectUtil.isNotEmpty(principal)) {
resEntity.setPrincipal(principal.getName());
}
}
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getLicensor())) {
User user = UserCache.getUser(workTicketInfoVO.getLicensor());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setLicensor(user.getName());
}
resEntity.setPrincipal(workTicketInfoVO.getPrincipalName());
}
workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembers());
if (Func.isNotEmpty(workTicketInfoVO.getClassGroupMembersManual())) {
workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembersManual());
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getLicensorName())) {
resEntity.setLicensor(workTicketInfoVO.getLicensorName());
}
// if (Func.isNotEmpty(workTicketInfoVO.getClassGroupMembersName())){
// workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembersName());
// }else if (Func.isNotEmpty(workTicketInfoVO.getClassGroupMembersManual())) {
// workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembersManual());
// }
resEntity.setClassGroupMembers(Optional.ofNullable(workTicketInfoVO.getClassGroupMembersName()).orElse(workTicketInfoVO.getClassGroupMembersManual() == null ? "" : workTicketInfoVO.getClassGroupMembersManual()));
resEntity.setCreateTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getConfirmWorkTime())) {
@ -1305,7 +1303,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
}
resEntity.setIsEvaluate("未评价");
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getIsEvaluate())&&1==workTicketInfoVO.getIsEvaluate()) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
// TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
eq(TicketInfoEvaluateEntity::getTicketId, workTicketInfoVO.getId());
}}.last(" limit 1"));

Loading…
Cancel
Save