diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/mold/MoldBrandController.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/mold/MoldBrandController.java index 690796c572..1ace17addc 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/mold/MoldBrandController.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/mold/MoldBrandController.java @@ -118,6 +118,14 @@ public class MoldBrandController { return success(moldBrandService.getMoldPage(pageReqVO, brandId)); } + @GetMapping("/mold/list") + @Operation(summary = "获得模具列表") + @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") + public CommonResult> getMoldList() { + List moldDOList = moldBrandService.getMoldList(); + return success(moldDOList); + } + @PostMapping("/mold/create") @Operation(summary = "创建模具") @PreAuthorize("@ss.hasPermission('erp:mold-brand:create')") diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/mold/MoldDO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/mold/MoldDO.java index 92a1715df2..0595ebbead 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/mold/MoldDO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/mold/MoldDO.java @@ -9,6 +9,9 @@ import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.erp.dal.dataobject.moldrepair.MoldRepairLineDO; +import cn.iocoder.yudao.module.erp.dal.dataobject.moldticketresults.MoldTicketResultsDO; + /** * 模具 DO * @@ -79,4 +82,31 @@ public class MoldDO extends BaseDO { private String fileUrl; + /** + * 点检列表 + */ + @TableField(exist = false) + private List inspectionList; + + /** + * 保养列表 + */ + @TableField(exist = false) + private List maintainList; + + /** + * 维修列表 + */ + @TableField(exist = false) + private Map> repairList; + + @TableField(exist = false) + private String orgType; + @TableField(exist = false) + private Long moldSize; + @TableField(exist = false) + private String brandName; + @TableField(exist = false) + private String moldType; + } \ No newline at end of file diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandService.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandService.java index d79b3a56fa..70d1d6e30a 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandService.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandService.java @@ -80,6 +80,8 @@ public interface MoldBrandService { */ PageResult getMoldPage(PageParam pageReqVO, Long brandId); + List getMoldList(); + /** * 创建模具 * diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandServiceImpl.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandServiceImpl.java index 966cb6db3e..09c9b6168e 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandServiceImpl.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldBrandServiceImpl.java @@ -9,23 +9,30 @@ import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.*; import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandDO; import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandProductDO; import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO; -import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO; +import cn.iocoder.yudao.module.erp.dal.dataobject.moldrepair.MoldRepairDO; +import cn.iocoder.yudao.module.erp.dal.dataobject.moldrepair.MoldRepairLineDO; +import cn.iocoder.yudao.module.erp.dal.dataobject.moldticketresults.MoldTicketResultsDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO; import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldBrandMapper; import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldBrandProductMapper; import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldMapper; +import cn.iocoder.yudao.module.erp.dal.mysql.moldrepair.MoldRepairLineMapper; +import cn.iocoder.yudao.module.erp.dal.mysql.moldrepair.MoldRepairMapper; +import cn.iocoder.yudao.module.erp.dal.mysql.moldticketresults.MoldTicketResultsMapper; +import cn.iocoder.yudao.module.erp.controller.admin.moldticketmanagement.enums.MoldPlanTypeEnum; import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; @@ -45,6 +52,12 @@ public class MoldBrandServiceImpl implements MoldBrandService { @Resource private MoldMapper moldMapper; @Resource + private MoldRepairMapper moldRepairMapperRepair; + @Resource + private MoldRepairLineMapper moldRepairLineMapper; + @Resource + private MoldTicketResultsMapper moldticketResultsMapper; + @Resource private ErpProductUnitService productUnitService; @Resource private ErpProductService productService; @@ -122,6 +135,11 @@ public class MoldBrandServiceImpl implements MoldBrandService { return new PageResult<>(buildMoldVOList(pageResult.getList()), pageResult.getTotal()); } + @Override + public List getMoldList() { + return moldMapper.selectList(); + } + private List buildMoldVOList(List list) { if (CollUtil.isEmpty(list)) { return Collections.emptyList(); @@ -157,7 +175,56 @@ public class MoldBrandServiceImpl implements MoldBrandService { @Override public MoldDO getMold(Long id) { - return moldMapper.selectById(id); + MoldDO moldDO = moldMapper.selectById(id); + Map> moldRepairDOMap=new HashMap<>(); + + // 关联查询品牌表并补充字段 + if (moldDO != null && moldDO.getBrandId() != null) { + MoldBrandDO moldBrandDO = moldBrandMapper.selectById(moldDO.getBrandId()); + if (moldBrandDO != null) { + moldDO.setBrandName(moldBrandDO.getName()); // 品牌名称 + moldDO.setMoldType(moldBrandDO.getMoldType()); // 模具类型 + moldDO.setMoldSize(moldBrandDO.getMoldSize()); // 模具尺寸 + moldDO.setOrgType(moldBrandDO.getOrgType()); // 组织类型 + } + } + + //点检列表 + List inspectionList = moldticketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.INSPECTION.getCode()); + if(CollectionUtils.isNotEmpty(inspectionList)){ + moldDO.setInspectionList(inspectionList); + } + + //保养列表 + List maintainList = moldticketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.MAINTENANCE.getCode()); + if(CollectionUtils.isNotEmpty(maintainList)){ + moldDO.setMaintainList(maintainList); + } + + //维修列表 + List moldRepairDOS = moldRepairMapperRepair.selectList( + Wrappers.lambdaQuery() + .eq(MoldRepairDO::getMoldId, id)); + + for (MoldRepairDO moldRepairDO : moldRepairDOS) { + List moldRepairLineDOS = moldRepairLineMapper.selectList(Wrappers.lambdaQuery() + .eq(MoldRepairLineDO::getRepairId, moldRepairDO.getId()) + .orderByDesc(MoldRepairLineDO::getCreateTime)); + if (!moldRepairLineDOS.isEmpty()) { + // 修复JSON序列化null Key问题(保持原有风格的极简处理) + String repairName = moldRepairDO.getRepairName(); + if (repairName == null || repairName.trim().isEmpty()) { + repairName = "维修单-" + moldRepairDO.getId(); + } + moldRepairDOMap.put(repairName, moldRepairLineDOS); + } + } + + if(CollectionUtils.isNotEmpty(moldRepairDOMap)){ + moldDO.setRepairList(moldRepairDOMap); + } + + return moldDO; } @Override public List selectBy(MoldDO reqVO){ @@ -225,6 +292,16 @@ public class MoldBrandServiceImpl implements MoldBrandService { return moldBrandProductMapper.selectById(id); } + @Override + public List getAllList() { + return Collections.emptyList(); + } + + @Override + public List getMoldBrandList(Collection ids) { + return Collections.emptyList(); + } + private void validateMoldBrandProductExists(Long id) { if (moldBrandProductMapper.selectById(id) == null) { throw exception(MOLD_BRAND_PRODUCT_NOT_EXISTS); @@ -234,14 +311,4 @@ public class MoldBrandServiceImpl implements MoldBrandService { private void deleteMoldBrandProductByBrandId(Long brandId) { moldBrandProductMapper.deleteByBrandId(brandId); } - - @Override - public List getAllList() { - return moldMapper.selectList(); - } - - @Override - public List getMoldBrandList(Collection ids) { - return moldBrandMapper.selectBatchIds(ids); - } } \ No newline at end of file diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldServiceImpl.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldServiceImpl.java index 285b750e90..b751c35bdc 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldServiceImpl.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/mold/MoldServiceImpl.java @@ -1,14 +1,6 @@ package cn.iocoder.yudao.module.erp.service.mold; -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; -import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO; import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandDO; -import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO; -import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO; -import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO; -import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -25,8 +17,6 @@ import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldMapper; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; /** @@ -41,12 +31,6 @@ public class MoldServiceImpl implements MoldService { @Resource private MoldMapper moldMapper; - @Resource - private MoldBrandService moldBrandService; - - @Resource - private ErpProductUnitService productUnitService; - @Override public Long createMold(MoldSaveReqVO createReqVO) { // 插入 @@ -95,46 +79,16 @@ public class MoldServiceImpl implements MoldService { @Override public List validMoldList(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return Collections.emptyList(); - } - List list = moldMapper.selectBatchIds(ids); - Map moldMap = convertMap(list, MoldDO::getId); - for (Long id : ids) { - MoldDO mold = moldMap.get(id); - if (moldMap.get(id) == null) { - throw exception(PRODUCT_NOT_EXISTS); - } - if (CommonStatusEnum.isDisable(mold.getStatus())) { - throw exception(PRODUCT_NOT_ENABLE, mold.getName()); - } - } - return list; + return Collections.emptyList(); } @Override public List getMoldVOList(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return Collections.emptyList(); - } - List list = moldMapper.selectBatchIds(ids); - return buildMoldVOList(list); + return Collections.emptyList(); } @Override public List buildMoldVOList(List list) { - if (CollUtil.isEmpty(list)) { - return Collections.emptyList(); - } - Map brandMap = moldBrandService.getMoldBrandMap( - convertSet(list, MoldDO::getBrandId)); - Map unitMap = productUnitService.getProductUnitMap( - convertSet(list, MoldDO::getUnitId)); - return BeanUtils.toBean(list, MoldRespVO.class, product -> { - MapUtils.findAndThen(brandMap, product.getBrandId(), - category -> product.setBrandName(category.getName())); - MapUtils.findAndThen(unitMap, product.getUnitId(), - unit -> product.setUnitName(unit.getName())); - }); + return Collections.emptyList(); } } \ No newline at end of file diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairLineMapper.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairLineMapper.java index 4c3889e17a..4376da826d 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairLineMapper.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairLineMapper.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepair.MoldRepairLineDO; import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; /** * 设备维修记录行 Mapper @@ -15,6 +16,7 @@ import org.apache.ibatis.annotations.Mapper; * @author 内蒙必硕 */ @Mapper +@Repository("mesMoldRepairLineMapper") public interface MoldRepairLineMapper extends BaseMapperX { default List selectListByRepairId(Long repairId) { diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairMapper.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairMapper.java index 211a194c76..f7e8a93fa3 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairMapper.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldrepair/MoldRepairMapper.java @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO; import com.alibaba.excel.util.StringUtils; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.mes.controller.admin.moldrepair.vo.*; +import org.springframework.stereotype.Repository; /** * 设备维修记录 Mapper @@ -18,6 +19,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.moldrepair.vo.*; * @author 内蒙必硕 */ @Mapper +@Repository("mesMoldRepairMapper") public interface MoldRepairMapper extends BaseMapperX { default PageResult selectPage(MoldRepairPageReqVO reqVO) { diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldticketresults/MoldTicketResultsMapper.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldticketresults/MoldTicketResultsMapper.java index 4511b61bd7..3d1db4254b 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldticketresults/MoldTicketResultsMapper.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/moldticketresults/MoldTicketResultsMapper.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults.MoldTicketRe import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.vo.*; import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; /** * 工单检验结果 Mapper @@ -16,6 +17,7 @@ import org.apache.ibatis.annotations.Param; * @author 内蒙必硕 */ @Mapper +@Repository("mesMoldTicketResultsMapper") public interface MoldTicketResultsMapper extends BaseMapperX { default PageResult selectPage(MoldTicketResultsPageReqVO reqVO) { diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairService.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairService.java index 76db64da0b..470374f646 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairService.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairService.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.moldrepair.vo.MoldRepairPage import cn.iocoder.yudao.module.mes.controller.admin.moldrepair.vo.MoldRepairSaveReqVO; import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepair.MoldRepairDO; import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepair.MoldRepairLineDO; +import cn.iocoder.yudao.module.mes.dal.mysql.moldrepair.MoldRepairLineMapper; import javax.validation.Valid; import java.util.List; diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairServiceImpl.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairServiceImpl.java index 29b515ed8c..92fcf866d8 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairServiceImpl.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldrepair/MoldRepairServiceImpl.java @@ -36,11 +36,11 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; @Slf4j @Service @Validated -public class MoldRepairServiceImpl implements MoldRepairService { +public class MoldRepairServiceImpl implements MoldRepairService { - @Resource + @Resource(name = "mesMoldRepairMapper") private MoldRepairMapper moldRepairMapper; - @Resource + @Resource(name = "mesMoldRepairLineMapper") private MoldRepairLineMapper moldRepairLineMapper; @Override diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldticketresults/MoldTicketResultsServiceImpl.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldticketresults/MoldTicketResultsServiceImpl.java index 0c60ec24e3..6305646b49 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldticketresults/MoldTicketResultsServiceImpl.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/moldticketresults/MoldTicketResultsServiceImpl.java @@ -35,7 +35,7 @@ import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; @Validated public class MoldTicketResultsServiceImpl implements MoldTicketResultsService { - @Resource + @Resource(name = "mesMoldTicketResultsMapper") private MoldTicketResultsMapper moldticketResultsMapper; @Resource