Merge remote-tracking branch 'origin/feature/DM/nflg-bom-transition' into feature/DM/nflg-bom-transition

This commit is contained in:
大米 2024-05-07 15:38:27 +08:00
commit 8bb92c0c7e
2 changed files with 46 additions and 0 deletions

View File

@ -27,11 +27,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.ttzero.excel.entity.ListSheet;
import org.ttzero.excel.entity.Workbook;
import springfox.bean.validators.plugins.schema.NotNullAnnotationPlugin;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
@ -68,6 +70,7 @@ public class EbomApi extends BaseApi {
@Resource
private BomNewPbomParentService bomNewPbomParentService;
private NotNullAnnotationPlugin notNullPlugin;
@PostMapping("workDetailsListByPage")
@ -473,4 +476,15 @@ public class EbomApi extends BaseApi {
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(bomNewEbomParentService.getBomException(query));
}
/**
* 获取对应的原始bom
* @param rowId rowId
* @return 原始bom
*/
@GetMapping("getSource")
@ApiOperation("获取对应的原始bom")
public ResultVO<BomOriginalListVO> getSource(@Valid @RequestParam("rowId") @NotNull Long rowId) {
return ResultVO.success(bomNewEbomParentService.getSource(rowId));
}
}

View File

@ -98,6 +98,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
@Resource
private BomNewEbomUpdateDetailService updateDetailService;
@Resource
private BomNewOriginalParentService originalParentService;
@Resource
private BomNewOriginalChildService originalChildService;
/**
* 获取列表
*
@ -2281,4 +2287,30 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
return datas;
}
public BomOriginalListVO getSource(Long rowId) {
VUtils.isTure(Objects.isNull(rowId) || rowId == 0).throwMessage("无效的数据");
BomNewEbomParentEntity parent = getById(rowId);
if (!Objects.isNull(parent)) {
if (parent.getSourceRowId() != 0) {
BomNewOriginalParentEntity op = originalParentService.getById(parent.getSourceRowId());
if (!Objects.isNull(op)) {
return Convert.convert(BomOriginalListVO.class, op);
}
}
} else {
BomNewEbomChildEntity child = ebomChildService.getById(rowId);
if (!Objects.isNull(child)) {
if (child.getSourceRowId() != 0) {
BomNewOriginalChildEntity oc = originalChildService.getById(child.getSourceRowId());
if (!Objects.isNull(oc)) {
return Convert.convert(BomOriginalListVO.class, oc);
}
}
}
}
return null;
}
}