Browse Source

# 危险源导入功能修改

zhongwei
haungxing 10 months ago
parent
commit
0df1bc410a
  1. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java
  2. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/dto/HazardInstanceDTO.java

@ -25,6 +25,9 @@ public class HazardInstanceDTO implements Serializable {
@ApiModelProperty("设备名称")
private String emName;
@ApiModelProperty(value = "应用类型")
private String applyType;
@ApiModelProperty("危险源列表")
private List<HazardLibraryDTO> hazardList;

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

@ -326,9 +326,16 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
public Boolean importDangerSource(HazardInstanceDTO req) {
List<DangerSourceEntity> sourceList = req.getHazardList().stream().map(h -> {
DangerSourceEntity result = JSONObject.parseObject(JSON.toJSONString(h), DangerSourceEntity.class);
result.setId(null);
result.setLibraryId(h.getId());
result.setRefDept(req.getDeptId());
result.setRefDeptName(req.getDeptName());
result.setApplyType(req.getApplyType());
result.setCreateTime(null);
result.setCreateDept(null);
result.setCreateUser(null);
result.setUpdateUser(null);
result.setUpdateTime(null);
return result;
}).collect(Collectors.toList());
return this.saveBatch(sourceList);

Loading…
Cancel
Save