外部工作上报代码迁移
This commit is contained in:
parent
667c657f5d
commit
6f88759f8f
|
@ -3,10 +3,8 @@ package com.dite.znpt.context;
|
|||
//import cn.dev33.satoken.stp.StpUtil;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.dite.znpt.domain.vo.PersonnelResp;
|
||||
import com.dite.znpt.domain.vo.PersonResp;
|
||||
import com.dite.znpt.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author wujinsong
|
||||
|
@ -27,7 +25,7 @@ public class UserContext {
|
|||
* @Param []
|
||||
* @Return com.gaea.common.vo.common.UserInfo
|
||||
*/
|
||||
public static PersonnelResp getUserInfo() {
|
||||
public static PersonResp getUserInfo() {
|
||||
// try {
|
||||
// String token = StpUtil.getTokenValue();
|
||||
// if (!StringUtils.isEmpty(token)) {
|
||||
|
@ -44,7 +42,7 @@ public class UserContext {
|
|||
// return userInfo;
|
||||
// }
|
||||
|
||||
PersonnelResp resp = new PersonnelResp();
|
||||
PersonResp resp = new PersonResp();
|
||||
resp.setRoleType("Builder");
|
||||
return resp;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,30 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class OutWorkDefectDTO extends OutWorkDefectEntity {
|
||||
public class OutWorkDefectDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "项目id", example = "797989789797", notes = "项目id")
|
||||
@QueryCondition(func = MatchType.like)
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty(value = "机组id", example = "797989789797", notes = "机组id")
|
||||
@QueryCondition(func = MatchType.like)
|
||||
private String crewId;
|
||||
|
||||
@ApiModelProperty(value = "内业或外业id", example = "797989789797", notes = "内业或外业id")
|
||||
@QueryCondition(func = MatchType.like)
|
||||
private String reportId;
|
||||
|
||||
@ApiModelProperty(value = "图片地址", example = "http://www.images/1.png,http://www.images/1.png", notes = "图片地址")
|
||||
private List<String> urlsList;
|
||||
|
||||
@ApiModelProperty(value = "岗位类型", example = "78979879375", notes = "岗位id")
|
||||
@QueryCondition(func = MatchType.like)
|
||||
private String jobCode;
|
||||
|
||||
@ApiModelProperty(value = "部件编号", example = "GG1", notes = "部件编号")
|
||||
@QueryCondition(func = MatchType.like)
|
||||
|
|
|
@ -99,16 +99,5 @@ public class DefectEntity extends AuditableEntity implements Serializable {
|
|||
@ApiModelProperty("维修建议")
|
||||
@TableField("repair_idea")
|
||||
private String repairIdea;
|
||||
|
||||
@ExcelProperty("距离叶根/叶尖")
|
||||
@ApiModelProperty("距离叶根/叶尖")
|
||||
@TableField("with_leaf")
|
||||
private String withLeaf;
|
||||
|
||||
@ExcelProperty("距离叶根/叶尖xx米")
|
||||
@ApiModelProperty("距离叶根/叶尖xx米")
|
||||
@TableField("with_leaf_distance")
|
||||
private String withLeafDistance;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.dite.znpt.domain.AuditableEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/30 15:54
|
||||
* @Description: 外部工作-缺陷关联表实体类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("gaea_out_work_defect")
|
||||
@ApiModel(value="OutWorkDefectEntity对象", description="外部工作-缺陷关联表")
|
||||
public class OutWorkDefectEntity extends AuditableEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 869306338404475124L;
|
||||
|
||||
@ExcelProperty("id")
|
||||
@ApiModelProperty("id")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@ExcelProperty("外部工作id")
|
||||
@ApiModelProperty("外部工作id")
|
||||
@TableField("out_work_id")
|
||||
private String outWorkId;
|
||||
|
||||
@ExcelProperty("缺陷id")
|
||||
@ApiModelProperty("缺陷id")
|
||||
@TableField("defect_ids")
|
||||
private String defectIds;
|
||||
|
||||
@ExcelProperty("岗位类型")
|
||||
@ApiModelProperty("岗位类型")
|
||||
@TableField("job_code")
|
||||
private String jobCode;
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ import com.dite.znpt.annotations.MatchType;
|
|||
import com.dite.znpt.annotations.QueryCondition;
|
||||
import com.dite.znpt.domain.AuditableEntity;
|
||||
import com.dite.znpt.domain.dto.OutWorkDefectDTO;
|
||||
import com.dite.znpt.typehandle.ArrayObjectTypeHandler;
|
||||
import com.dite.znpt.typehandle.OutworkDefectHandler;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -109,7 +111,7 @@ public class JobOutWork extends AuditableEntity implements Serializable {
|
|||
private String droneFlyerImageQuality;
|
||||
|
||||
@ApiModelProperty(value = "飞手部件列表", example = "[]", notes = "部件列表")
|
||||
@TableField(exist = false)
|
||||
@TableField(typeHandler = OutworkDefectHandler.class)
|
||||
private List<OutWorkDefectDTO> droneFlyerPartsList;
|
||||
|
||||
@ApiModelProperty(value = "飞助工作描述", example = "工作描述工作描述", notes = "飞助工作描述")
|
||||
|
@ -143,7 +145,7 @@ public class JobOutWork extends AuditableEntity implements Serializable {
|
|||
private String flyAidImageQuality;
|
||||
|
||||
@ApiModelProperty(value = "飞助部件列表", example = "[]", notes = "部件列表")
|
||||
@TableField(exist = false)
|
||||
@TableField(typeHandler = OutworkDefectHandler.class)
|
||||
private List<OutWorkDefectDTO> flyAidPartsList;
|
||||
|
||||
@ApiModelProperty(value = "登高工作描述", example = "工作描述工作描述", notes = "登高工作描述")
|
||||
|
@ -181,7 +183,7 @@ public class JobOutWork extends AuditableEntity implements Serializable {
|
|||
private String ascendingImageQuality;
|
||||
|
||||
@ApiModelProperty(value = "登高部件列表", example = "[]", notes = "部件列表")
|
||||
@TableField(exist = false)
|
||||
@TableField(typeHandler = OutworkDefectHandler.class)
|
||||
private List<OutWorkDefectDTO> ascendingPartsList;
|
||||
|
||||
@ApiModelProperty(value = "状态", example = "0草稿 1已提交 2组长提交 3项目经理审批通过", notes = "状态")
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.OutWorkDefectEntity;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/30 15:54
|
||||
* @Description: 外部工作-缺陷关联表数据库访问层
|
||||
*/
|
||||
public interface OutWorkDefectMapper extends BaseMapper<OutWorkDefectEntity> {
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.OutWorkDefectEntity;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/30 15:54
|
||||
* @Description: 外部工作-缺陷关联表服务接口
|
||||
*/
|
||||
public interface OutWorkDefectService extends IService<OutWorkDefectEntity> {
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.domain.entity.OutWorkDefectEntity;
|
||||
import com.dite.znpt.mapper.OutWorkDefectMapper;
|
||||
import com.dite.znpt.service.OutWorkDefectService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/30 15:54
|
||||
* @Description: 外部工作-缺陷关联表服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OutWorkDefectServiceImpl extends ServiceImpl<OutWorkDefectMapper, OutWorkDefectEntity> implements OutWorkDefectService {
|
||||
}
|
|
@ -1,24 +1,30 @@
|
|||
package com.dite.znpt.service.job.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.context.UserContext;
|
||||
import com.dite.znpt.domain.QueryWrapperBuilder;
|
||||
import com.dite.znpt.domain.dto.OutWorkDefectDTO;
|
||||
import com.dite.znpt.domain.entity.DefectEntity;
|
||||
import com.dite.znpt.domain.entity.OutWorkDefectEntity;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.job.DefectDTO;
|
||||
import com.dite.znpt.domain.entity.job.JobInfo;
|
||||
import com.dite.znpt.domain.entity.job.JobOutWork;
|
||||
import com.dite.znpt.domain.vo.OutWorkDefectReq;
|
||||
import com.dite.znpt.domain.vo.job.req.JobInfoReq;
|
||||
import com.dite.znpt.domain.vo.job.req.JobOutWorkReq;
|
||||
import com.dite.znpt.enums.DefectSourceEnum;
|
||||
import com.dite.znpt.enums.Enums;
|
||||
import com.dite.znpt.enums.PartTypeEnum;
|
||||
import com.dite.znpt.enums.RepairStatusEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.JobOutWorkMapper;
|
||||
import com.dite.znpt.service.*;
|
||||
|
@ -34,7 +40,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOutWork> implements JobOutWorkService {
|
||||
public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOutWork> implements JobOutWorkService {
|
||||
@Autowired
|
||||
private TurbineService turbineService;
|
||||
@Autowired
|
||||
|
@ -44,12 +50,11 @@ public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOut
|
|||
@Autowired
|
||||
private ProjectService projectService;
|
||||
@Autowired
|
||||
private OutWorkDefectService outWorkDefectService;
|
||||
@Autowired
|
||||
private DefectService defectService;
|
||||
|
||||
/**
|
||||
* 旧版系统是直接使用在部件表中使用工作id关联,新版:外部工作:使用部件编码关联,若无则写入第一个部件,内部工作(暂时沿用gaea_job_in_work_parts表):使用叶片编码关联,若无,写入第一个叶片
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
|
@ -63,23 +68,6 @@ public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOut
|
|||
}
|
||||
saveOrUpdate(entity);
|
||||
|
||||
List<OutWorkDefectEntity> linkList = outWorkDefectService.lambdaQuery().eq(OutWorkDefectEntity::getOutWorkId, entity.getId()).list();
|
||||
if (CollUtil.isNotEmpty(linkList)) {
|
||||
defectService.lambdaUpdate().in(DefectEntity::getDefectId, linkList.stream().map(OutWorkDefectEntity::getDefectIds)
|
||||
.flatMap(s -> StrUtil.split(s, ",").stream()).collect(Collectors.toList())).remove();
|
||||
}
|
||||
// 飞手部件列表
|
||||
if (CollUtil.isNotEmpty(entity.getDroneFlyerPartsList())) {
|
||||
saveDefect(entity.getDroneFlyerPartsList(), entity.getId(), Enums.EOutWorkType.DRONE_FLYER);
|
||||
}
|
||||
// 飞助部件列表
|
||||
if (CollUtil.isNotEmpty(entity.getFlyAidPartsList())) {
|
||||
saveDefect(entity.getFlyAidPartsList(), entity.getId(), Enums.EOutWorkType.FLYAID);
|
||||
}
|
||||
// 登高部件列表
|
||||
if (CollUtil.isNotEmpty(entity.getAscendingPartsList())) {
|
||||
saveDefect(entity.getAscendingPartsList(), entity.getId(), Enums.EOutWorkType.ASCEND_HEIGHT);
|
||||
}
|
||||
JobInfo jobInfo = jobService.getById(entity.getJobId());
|
||||
turbineService.updateStatus(jobInfo.getCrewId());
|
||||
// 施工人员提交后更新该工作类型状态及提交时间
|
||||
|
@ -94,40 +82,78 @@ public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOut
|
|||
/**
|
||||
* 功能描述:保存缺陷
|
||||
*
|
||||
* @param defectDTOList 实体
|
||||
* @param outWorkId outWorkId
|
||||
* @param workType 无人机飞行
|
||||
* @param jobInfo
|
||||
* @param defectDTOList 实体
|
||||
* @param outWorkId outWorkId
|
||||
* @param workType 无人机飞行
|
||||
* @return
|
||||
* @author cuizhibin
|
||||
* @date 2025/04/30 16:37
|
||||
**/
|
||||
private void saveDefect(List<OutWorkDefectDTO> defectDTOList, String outWorkId, Enums.EOutWorkType workType) {
|
||||
List<DefectEntity> defectList = new ArrayList<>();
|
||||
List<OutWorkDefectEntity> list = defectDTOList.stream().filter(defectDTO -> CollUtil.isNotEmpty(defectDTO.getDefectList())).map(item -> {
|
||||
List<String> defectIds = new ArrayList<>();
|
||||
item.getDefectList().forEach(defectDTO -> {
|
||||
DefectEntity defect = new DefectEntity();
|
||||
defect.setDefectId(IdUtil.simpleUUID());
|
||||
defect.setDescription(defectDTO.getContent());
|
||||
defect.setDefectType(defectDTO.getDefectTypeCode());
|
||||
defect.setDefectLevel(defectDTO.getCriticalityLevelCode());
|
||||
defect.setDefectPosition(defectDTO.getDefectLocation2());
|
||||
defect.setAxial(defectDTO.getDefectSize());
|
||||
defect.setChordwise(defectDTO.getDefectSize2());
|
||||
// todo 若部件不存在,还需要创建部件或查询第一个部件,此处只有叶片的
|
||||
defectList.add(defect);
|
||||
defectIds.add(defect.getDefectId());
|
||||
});
|
||||
|
||||
OutWorkDefectEntity workDefect = BeanUtil.copyProperties(item, OutWorkDefectEntity.class);
|
||||
workDefect.setOutWorkId(outWorkId);
|
||||
workDefect.setJobCode(workType.getValue());
|
||||
workDefect.setDefectIds(StrUtil.join(",", defectIds));
|
||||
return workDefect;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(defectList)) {
|
||||
outWorkDefectService.saveBatch(list);
|
||||
defectService.saveBatch(defectList);
|
||||
*/
|
||||
private List<OutWorkDefectReq> generateDefectList(JobInfo jobInfo, List<OutWorkDefectDTO> defectDTOList, String outWorkId, Enums.EOutWorkType workType) {
|
||||
List<OutWorkDefectReq> list = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(defectDTOList)) {
|
||||
return list;
|
||||
}
|
||||
List<PartEntity> partList = partService.lambdaQuery()
|
||||
.eq(PartEntity::getTurbineId, jobInfo.getCrewId())
|
||||
.in(PartEntity::getPartCode, defectDTOList.stream().map(OutWorkDefectDTO::getCode).toList())
|
||||
.list();
|
||||
Map<String, PartEntity> partMap = partList.stream().collect(Collectors.toMap(PartEntity::getPartCode, Function.identity()));
|
||||
Map<String, PartEntity> turbinePartMap = partList.stream().filter(part -> part.getPartType().equals(PartTypeEnum.VANE_1.getCode()))
|
||||
.collect(Collectors.toMap(PartEntity::getTurbineId, Function.identity(), (v1, v2) -> v1));
|
||||
List<PartEntity> newPartList = new ArrayList<>();
|
||||
for (OutWorkDefectDTO dto : defectDTOList) {
|
||||
if (dto.getStatus() != 1) {
|
||||
continue;
|
||||
}
|
||||
PartEntity partEntity = partMap.get(dto.getCode());
|
||||
// 若部件不存在,还需要创建部件或查询第一个部件,此处只有叶片的
|
||||
if (Objects.isNull(partEntity)) {
|
||||
// 取第一个部件,若不存在则创建
|
||||
partEntity = turbinePartMap.get(jobInfo.getCrewId());
|
||||
if (Objects.isNull(partEntity)) {
|
||||
partEntity = new PartEntity();
|
||||
partEntity.setTurbineId(jobInfo.getCrewId());
|
||||
partEntity.setPartId(IdUtil.simpleUUID());
|
||||
partEntity.setPartName("叶片");
|
||||
partEntity.setPartCode(dto.getCode());
|
||||
partEntity.setPartType(PartTypeEnum.VANE_1.getCode());
|
||||
partEntity.setPartDesc("外部工作自动生成");
|
||||
partMap.put(partEntity.getPartCode(), partEntity);
|
||||
newPartList.add(partEntity);
|
||||
turbinePartMap.put(jobInfo.getCrewId(), partEntity);
|
||||
}
|
||||
}
|
||||
for (DefectDTO defectDTO : dto.getDefectList()) {
|
||||
OutWorkDefectReq defectReq = new OutWorkDefectReq();
|
||||
defectReq.setDescription(defectDTO.getContent());
|
||||
defectReq.setDefectType(defectDTO.getDefectTypeCode());
|
||||
defectReq.setDefectLevel(defectDTO.getCriticalityLevelCode());
|
||||
if (StrUtil.isNotBlank(defectDTO.getDefectLocation1())) {
|
||||
// 1叶根或2叶尖
|
||||
Dict dict = Dict.of("1", "叶根", "2", "叶尖");
|
||||
defectReq.setDefectPosition(StrUtil.format("距{} {}米", dict.getStr(defectDTO.getDefectLocation1()), defectDTO.getDefectLocation1Size()));
|
||||
} else {
|
||||
// 1前缘、2后缘、3 PS面、4 SS面
|
||||
Dict dict = Dict.of("1", "前缘", "2", "后缘", "3", "PS面", "4", "SS面");
|
||||
defectReq.setDefectPosition(dict.getStr(defectDTO.getDefectLocation2()));
|
||||
|
||||
defectReq.setAxial(Integer.valueOf(defectDTO.getDefectSize()));
|
||||
defectReq.setChordwise(Integer.valueOf(defectDTO.getDefectSize2()));
|
||||
}
|
||||
defectReq.setPartId(partEntity.getPartId());
|
||||
defectReq.setImagePath(defectDTO.getFlawUrlList().get(0));
|
||||
defectReq.setRepairStatus(RepairStatusEnum.UNKNOWN.getCode());
|
||||
defectReq.setSource(DefectSourceEnum.OUT_WORK.getCode());
|
||||
list.add(defectReq);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(newPartList)) {
|
||||
partService.saveBatch(newPartList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,42 +161,8 @@ public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOut
|
|||
List<JobOutWork> list = lambdaQuery().eq(JobOutWork::getJobId, dto.getJobId()).list();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new JobOutWork();
|
||||
} else {
|
||||
JobOutWork work = list.get(0);
|
||||
getDefectList(work);
|
||||
return work;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询缺陷
|
||||
*
|
||||
* @author cuizhibin
|
||||
* @date 2025/04/30 16:37
|
||||
**/
|
||||
private void getDefectList(JobOutWork outWork) {
|
||||
List<OutWorkDefectEntity> linkList = outWorkDefectService.lambdaQuery().eq(OutWorkDefectEntity::getOutWorkId, outWork.getId()).list();
|
||||
Map<String, DefectEntity> defectMap = defectService.listByIds(linkList.stream().flatMap(outWorkDefect -> StrUtil.split(outWorkDefect.getDefectIds(), ",").stream())
|
||||
.collect(Collectors.toList()))
|
||||
.stream().collect(Collectors.toMap(DefectEntity::getDefectId, Function.identity()));
|
||||
outWork.setAscendingPartsList(new ArrayList<>());
|
||||
outWork.setFlyAidPartsList(new ArrayList<>());
|
||||
outWork.setAscendingPartsList(new ArrayList<>());
|
||||
for (OutWorkDefectEntity workDefect : linkList) {
|
||||
OutWorkDefectDTO dto = BeanUtil.copyProperties(workDefect, OutWorkDefectDTO.class);
|
||||
dto.setCode("");
|
||||
dto.setUrls("");
|
||||
dto.setStatus(0);
|
||||
dto.setDefectList(new ArrayList<>());
|
||||
|
||||
if (workDefect.getJobCode().equals(Enums.EOutWorkType.DRONE_FLYER.getValue())) {
|
||||
|
||||
} else if (workDefect.getJobCode().equals(Enums.EOutWorkType.FLYAID.getValue())) {
|
||||
|
||||
} else if (workDefect.getJobCode().equals(Enums.EOutWorkType.ASCEND_HEIGHT.getValue())) {
|
||||
|
||||
}
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,6 +226,26 @@ public class JobOutWorkServiceImpl extends ServiceImpl<JobOutWorkMapper, JobOut
|
|||
}
|
||||
workList.forEach(item -> item.setStatus(Enums.EWorkStatus.MANAGER_APPROVAL.getValue()));
|
||||
jobInfo.setStatus(Enums.EWorkStatus.MANAGER_APPROVAL.getValue());
|
||||
|
||||
// 项目经理审批后入缺陷库
|
||||
List<OutWorkDefectReq> defectReqList = new ArrayList<>();
|
||||
for (JobOutWork work : workList) {
|
||||
// 飞手部件列表
|
||||
if (CollUtil.isNotEmpty(work.getDroneFlyerPartsList())) {
|
||||
defectReqList.addAll(generateDefectList(jobInfo, work.getDroneFlyerPartsList(), work.getId(), Enums.EOutWorkType.DRONE_FLYER));
|
||||
}
|
||||
// 飞助部件列表
|
||||
if (CollUtil.isNotEmpty(work.getFlyAidPartsList())) {
|
||||
defectReqList.addAll(generateDefectList(jobInfo, work.getFlyAidPartsList(), work.getId(), Enums.EOutWorkType.FLYAID));
|
||||
}
|
||||
// 登高部件列表
|
||||
if (CollUtil.isNotEmpty(work.getAscendingPartsList())) {
|
||||
defectReqList.addAll(generateDefectList(jobInfo, work.getAscendingPartsList(), work.getId(), Enums.EOutWorkType.ASCEND_HEIGHT));
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(defectReqList)) {
|
||||
defectService.saveOutWorkDefect(defectReqList);
|
||||
}
|
||||
} else if (Enums.ERoleCode.SafetyOfficer.getName().equals(UserContext.getRoleCode())) {
|
||||
workList.forEach(item -> item.setSafetyOfficerStatus(Enums.EAuthStatus.APPROVAL.getVal()));
|
||||
jobInfo.setSafetyOfficerStatus(Enums.EAuthStatus.APPROVAL.getVal());
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.dite.znpt.typehandle;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public abstract class ArrayObjectTypeHandler<T> extends AbstractJsonTypeHandler<List<T>> {
|
||||
|
||||
public ArrayObjectTypeHandler(Class<?> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
protected abstract TypeReference<List<T>> typeReference();
|
||||
|
||||
@Override
|
||||
public List<T> parse(String json) {
|
||||
try {
|
||||
return JacksonTypeHandler.getObjectMapper().readValue(json, typeReference());
|
||||
} catch (IOException var3) {
|
||||
throw new RuntimeException(var3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJson(List<T> obj) {
|
||||
try {
|
||||
return JacksonTypeHandler.getObjectMapper().writeValueAsString(obj);
|
||||
} catch (JsonProcessingException var3) {
|
||||
throw new RuntimeException(var3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.dite.znpt.typehandle;
|
||||
|
||||
|
||||
import com.dite.znpt.domain.dto.OutWorkDefectDTO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class OutworkDefectHandler extends ArrayObjectTypeHandler<OutWorkDefectDTO> {
|
||||
public OutworkDefectHandler(Class<?> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeReference<List<OutWorkDefectDTO>> typeReference() {
|
||||
return new TypeReference<>() {};
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.OutWorkDefectMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.id, a.out_work_id, a.defect_id, a.out_work_type
|
||||
</sql>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue