|
|
|
@ -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.MoldBrandDO;
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandProductDO;
|
|
|
|
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.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.ErpProductDO;
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
|
|
|
|
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.MoldBrandMapper;
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldBrandProductMapper;
|
|
|
|
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.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.ErpProductService;
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
|
|
|
|
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.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
@ -45,6 +52,12 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private MoldMapper moldMapper;
|
|
|
|
private MoldMapper moldMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldRepairMapper moldRepairMapperRepair;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldRepairLineMapper moldRepairLineMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldTicketResultsMapper moldticketResultsMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private ErpProductUnitService productUnitService;
|
|
|
|
private ErpProductUnitService productUnitService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ErpProductService productService;
|
|
|
|
private ErpProductService productService;
|
|
|
|
@ -122,6 +135,11 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
return new PageResult<>(buildMoldVOList(pageResult.getList()), pageResult.getTotal());
|
|
|
|
return new PageResult<>(buildMoldVOList(pageResult.getList()), pageResult.getTotal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MoldDO> getMoldList() {
|
|
|
|
|
|
|
|
return moldMapper.selectList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<MoldRespVO> buildMoldVOList(List<MoldDO> list) {
|
|
|
|
private List<MoldRespVO> buildMoldVOList(List<MoldDO> list) {
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
|
return Collections.emptyList();
|
|
|
|
return Collections.emptyList();
|
|
|
|
@ -157,7 +175,56 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MoldDO getMold(Long id) {
|
|
|
|
public MoldDO getMold(Long id) {
|
|
|
|
return moldMapper.selectById(id);
|
|
|
|
MoldDO moldDO = moldMapper.selectById(id);
|
|
|
|
|
|
|
|
Map<String,List<MoldRepairLineDO>> 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<MoldTicketResultsDO> inspectionList = moldticketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.INSPECTION.getCode());
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(inspectionList)){
|
|
|
|
|
|
|
|
moldDO.setInspectionList(inspectionList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保养列表
|
|
|
|
|
|
|
|
List<MoldTicketResultsDO> maintainList = moldticketResultsMapper.findByMoldIdAndPlanType(id, MoldPlanTypeEnum.MAINTENANCE.getCode());
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(maintainList)){
|
|
|
|
|
|
|
|
moldDO.setMaintainList(maintainList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维修列表
|
|
|
|
|
|
|
|
List<MoldRepairDO> moldRepairDOS = moldRepairMapperRepair.selectList(
|
|
|
|
|
|
|
|
Wrappers.<MoldRepairDO>lambdaQuery()
|
|
|
|
|
|
|
|
.eq(MoldRepairDO::getMoldId, id));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (MoldRepairDO moldRepairDO : moldRepairDOS) {
|
|
|
|
|
|
|
|
List<MoldRepairLineDO> moldRepairLineDOS = moldRepairLineMapper.selectList(Wrappers.<MoldRepairLineDO>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
|
|
|
|
@Override
|
|
|
|
public List<MoldDO> selectBy(MoldDO reqVO){
|
|
|
|
public List<MoldDO> selectBy(MoldDO reqVO){
|
|
|
|
@ -225,6 +292,16 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
return moldBrandProductMapper.selectById(id);
|
|
|
|
return moldBrandProductMapper.selectById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MoldDO> getAllList() {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MoldBrandDO> getMoldBrandList(Collection<Long> ids) {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void validateMoldBrandProductExists(Long id) {
|
|
|
|
private void validateMoldBrandProductExists(Long id) {
|
|
|
|
if (moldBrandProductMapper.selectById(id) == null) {
|
|
|
|
if (moldBrandProductMapper.selectById(id) == null) {
|
|
|
|
throw exception(MOLD_BRAND_PRODUCT_NOT_EXISTS);
|
|
|
|
throw exception(MOLD_BRAND_PRODUCT_NOT_EXISTS);
|
|
|
|
@ -234,14 +311,4 @@ public class MoldBrandServiceImpl implements MoldBrandService {
|
|
|
|
private void deleteMoldBrandProductByBrandId(Long brandId) {
|
|
|
|
private void deleteMoldBrandProductByBrandId(Long brandId) {
|
|
|
|
moldBrandProductMapper.deleteByBrandId(brandId);
|
|
|
|
moldBrandProductMapper.deleteByBrandId(brandId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MoldDO> getAllList() {
|
|
|
|
|
|
|
|
return moldMapper.selectList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MoldBrandDO> getMoldBrandList(Collection<Long> ids) {
|
|
|
|
|
|
|
|
return moldBrandMapper.selectBatchIds(ids);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|