Browse Source

update: 作业区域管理页面添加安全负责人名称和分管领导名称字段信息

zhongwei
liwen 8 months ago
parent
commit
8fa660d19c
  1. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardWorkVO.java
  2. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java
  3. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java
  4. 47
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/risk/vo/HazardWorkVO.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.risk.vo;
import com.hnac.hzims.safeproduct.risk.entity.HazardWork;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author liwen
* @date 2024-04-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "作业区域管理页面VO类")
public class HazardWorkVO extends HazardWork {
@ApiModelProperty("负责人名称")
private String headName;
@ApiModelProperty("分管领导名称")
private String managerName;
}

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/controller/HazardWorkController.java

@ -1,11 +1,10 @@
package com.hnac.hzims.safeproduct.risk.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.risk.dto.CorrelationDTO;
import com.hnac.hzims.safeproduct.risk.entity.HazardWork;
import com.hnac.hzims.safeproduct.risk.service.HazardWorkService;
import com.hnac.hzims.safeproduct.risk.vo.HazardWorkVO;
import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -68,15 +67,16 @@ public class HazardWorkController {
return R.data(service.getById(id));
}
/**
* 分页
*/
@GetMapping("/pageList")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "分页", notes = "查询条件:item")
public R<IPage<HazardWork>> page(HazardWork entity, Query query) {
return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity)));
public R<IPage<HazardWorkVO>> page(HazardWork entity, Query query) {
IPage<HazardWorkVO> page = service.getHazardWorkPage(entity, query);
return R.data(page);
// return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(entity)));
}
@GetMapping("/getCheckItemByDutyPerson")

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/HazardWorkService.java

@ -1,9 +1,11 @@
package com.hnac.hzims.safeproduct.risk.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.risk.entity.HazardWork;
import com.hnac.hzims.safeproduct.risk.vo.HazardWorkVO;
import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO;
import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import java.util.List;
@ -15,4 +17,12 @@ public interface HazardWorkService extends BaseService<HazardWork> {
boolean deleteBacth(List<Long> workIds);
List<PersonalCheckItemVO> getCheckItemByDutyPerson(Long userId,Long categoryId);
/**
* 查询作业区域页面数据
* @param entity 入参
* @param query 分页类
* @return 作业区域页面
*/
IPage<HazardWorkVO> getHazardWorkPage(HazardWork entity, Query query);
}

47
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardWorkServiceImpl.java

@ -1,6 +1,8 @@
package com.hnac.hzims.safeproduct.risk.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.risk.entity.Correlation;
import com.hnac.hzims.safeproduct.risk.entity.HazardCategory;
import com.hnac.hzims.safeproduct.risk.entity.HazardSource;
@ -10,18 +12,23 @@ import com.hnac.hzims.safeproduct.risk.service.CorrelationService;
import com.hnac.hzims.safeproduct.risk.service.HazardCategoryService;
import com.hnac.hzims.safeproduct.risk.service.HazardSourceService;
import com.hnac.hzims.safeproduct.risk.service.HazardWorkService;
import com.hnac.hzims.safeproduct.risk.vo.HazardWorkVO;
import com.hnac.hzims.safeproduct.risk.vo.PersonalCheckItemVO;
import com.hnac.hzims.safeproduct.risk.vo.StationRiskLevelVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
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.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -38,6 +45,8 @@ public class HazardWorkServiceImpl extends BaseServiceImpl<HazardWorkMapper, Haz
private final HazardSourceService hazardSourceService;
private final HazardCategoryService hazardCategoryService;
private final IUserClient userClient;
/**
* 作业区域删除
* @param workIds
@ -79,4 +88,40 @@ public class HazardWorkServiceImpl extends BaseServiceImpl<HazardWorkMapper, Haz
});
}).collect(Collectors.toList());
}
/**
* 查询作业区域页面数据
*/
@Override
public IPage<HazardWorkVO> getHazardWorkPage(HazardWork entity, Query query) {
IPage<HazardWork> hazardWorkPage = this.page(Condition.getPage(query), Condition.getQueryWrapper(entity));
List<HazardWork> records = hazardWorkPage.getRecords();
List<HazardWorkVO> res = new ArrayList<>();
// 遍历获取负责人和分管领导名称
for (HazardWork record : records) {
HazardWorkVO hazardWorkVO = new HazardWorkVO();
BeanUtil.copyProperties(record, hazardWorkVO);
Long headId = record.getHead();
if (headId != null) {
R<User> header = userClient.userInfoById(headId);
if (header.isSuccess()) {
hazardWorkVO.setHeadName(header.getData().getRealName());
}
}
Long manageId = record.getManage();
if (manageId != null) {
R<User> manager = userClient.userInfoById(headId);
if (manager.isSuccess()) {
hazardWorkVO.setManagerName(manager.getData().getRealName());
}
}
res.add(hazardWorkVO);
}
// 分页
IPage<HazardWorkVO> page = new Page<>(query.getCurrent(), query.getSize());
page.setRecords(res);
page.setTotal(hazardWorkPage.getTotal());
page.setPages(hazardWorkPage.getPages());
return page;
}
}

Loading…
Cancel
Save