计划管理相关功能实现
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.*;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
||||
@@ -31,7 +33,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
@RestController
|
||||
@RequestMapping("/base/erp-material")
|
||||
@Validated
|
||||
public class ErpMaterialController {
|
||||
public class ErpMaterialController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -147,7 +149,7 @@ public class ErpMaterialController {
|
||||
@Operation(summary = "通过主物料查询子物料信息")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
|
||||
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
||||
List<ErpMaterialRespVO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||
}
|
||||
|
||||
@@ -156,11 +158,12 @@ public class ErpMaterialController {
|
||||
@Operation(summary = "通过接口查询物料")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<PageResult<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationApiVO vo) {
|
||||
MaterialInfomationPageReqDTO material = new MaterialInfomationPageReqDTO();
|
||||
material.setCode(vo.getMaterialNumber());
|
||||
material.setName(vo.getMaterialName());
|
||||
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
||||
material.setMaterialNumber(vo.getMaterialNumber());
|
||||
material.setMaterialName(vo.getMaterialName());
|
||||
material.setPageSize(vo.getPageSize());
|
||||
material.setPageNo(vo.getPageNo());
|
||||
material.setDeptId(Long.valueOf(vo.getDeptId()));
|
||||
PageResult<ErpMaterialDO> erpMaterialByApi = erpMaterialService.getErpMaterialByApi(material);
|
||||
return success(BeanUtils.toBean(erpMaterialByApi, ErpMaterialRespVO.class));
|
||||
}
|
||||
@@ -168,16 +171,15 @@ public class ErpMaterialController {
|
||||
@GetMapping("/erpMaterial-mainMaterial-code")
|
||||
@Operation(summary = "通过主物料编号查询子物料信息")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<ErpMaterialRespVO> getErpMaterialByMainMaterialByCode(@RequestParam("materialNumber") String code) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByMainMaterialByCode(code), ErpMaterialRespVO.class));
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterialByCode(@RequestParam("materialNumber") String code,@RequestParam(value = "deptId",required = false) String deptId) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByMainMaterialByCode(code,deptId), ErpMaterialRespVO.class));
|
||||
}
|
||||
|
||||
//查询物料
|
||||
@GetMapping("/api-erp-material-code")
|
||||
@Operation(summary = "通过编号接口查询物料")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApiByCode(@RequestParam("materialNumber")String code) {
|
||||
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByApiByCode(code), ErpMaterialRespVO.class));
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApiByCode(@RequestParam("materialNumber")String code,@RequestParam(value = "deptId",required = false) String deptId) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByApiByCode(code,deptId), ErpMaterialRespVO.class));
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import java.util.List;
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ErpMaterialRespVO {
|
||||
@Schema(description = "关联表主键,删除需要使用这个", requiredMode = Schema.RequiredMode.REQUIRED, example = "2038")
|
||||
private Long corrId;
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2038")
|
||||
@ExcelProperty("主键")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialRespDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationRespDTO;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class MaterialAttributeUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 物料属性封装Record(Java 16+)
|
||||
* 物料属性封装Record
|
||||
* 包含所有属性的安全取值
|
||||
*/
|
||||
public record MaterialAttribute(
|
||||
@@ -117,7 +118,7 @@ public class MaterialAttributeUtils {
|
||||
* @param dto 物料信息DTO
|
||||
* @return 封装后的物料属性Record
|
||||
*/
|
||||
public static MaterialAttribute safeExtractAllAttributes(MaterialInfomationRespDTO dto) {
|
||||
public static MaterialAttribute safeExtractAllAttributes(DepartmentMaterialRespDTO dto) {
|
||||
// 1. 空值校验
|
||||
if (dto == null || dto.getFlatAttributes() == null) {
|
||||
return MaterialAttribute.empty();
|
||||
|
||||
@@ -16,5 +16,7 @@ public interface ErpErpMaterialCorrService {
|
||||
List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
|
||||
void deleteBatch(BatchDeleteReqVO reqVO);
|
||||
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds);
|
||||
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,12 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId) {
|
||||
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialId), ErpMaterialCorrRspVO.class);
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds) {
|
||||
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialIds), ErpMaterialCorrRspVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code) {
|
||||
return BeanUtils.toBean(erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentCode, code), ErpMaterialCorrRspVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.service.erp;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
||||
@@ -77,11 +78,11 @@ public interface ErpMaterialService {
|
||||
|
||||
ErpMaterialDO getErpMaterialById(Long id);
|
||||
|
||||
List<ErpMaterialDO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
|
||||
PageResult<ErpMaterialDO> getErpMaterialByApi( MaterialInfomationPageReqDTO material);
|
||||
PageResult<ErpMaterialDO> getErpMaterialByApi( DepartmentMaterialPageReqDTO material);
|
||||
|
||||
ErpMaterialDO getErpMaterialByMainMaterialByCode(String code);
|
||||
List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code,String deptId);
|
||||
|
||||
List <ErpMaterialDO>getErpMaterialByApiByCode(String code);
|
||||
List <ErpMaterialDO>getErpMaterialByApiByCode(String code,String deptId);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user