mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增根据柜体id列表查询小板的造型接口
This commit is contained in:
+11
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate;
|
||||
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -10,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -108,4 +111,12 @@ public class PlateController {
|
||||
public CommonResult<PageResult<PlateRespVO>> getPlatesByOrderId(@Valid PlateTermsPageReqVO pageVO) {
|
||||
return success(plateService.getPlatePageByTerms(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/getPlateModelByBodyId")
|
||||
@Operation(summary = "根据柜体id列表查询小板的造型")
|
||||
@Parameter(name = "bodyIds", description = "柜体id列表", required = true)
|
||||
public CommonResult<List<BodyPlateDetailVO>> getPlateModelByPlateId(@Valid @RequestParam @NotEmpty List<Long> bodyIds) {
|
||||
return success(plateService.getPlateModelByPlateId(bodyIds));
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
* 模块中小板详情包含造型信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BodyPlateDetailVO {
|
||||
@Schema(description = "模块id")
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "造型列表")
|
||||
private List<OrderModelDO> orderModelList;
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
public class BodyPlateIdDTO {
|
||||
private Long bodyId;
|
||||
private Long plateId;
|
||||
}
|
||||
+3
@@ -7,6 +7,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface OptimizePlanService {
|
||||
|
||||
String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
Boolean addRemain(AddRemainReqVO vo);
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
//public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
@Resource
|
||||
private MachineApi machineApi;
|
||||
|
||||
+3
@@ -5,6 +5,7 @@ import javax.validation.*;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
@@ -87,4 +88,6 @@ public interface PlateService {
|
||||
* @return void
|
||||
*/
|
||||
void updatePlateByRawGoodsId(List<GoodsSaveReqVO> createReqVOS);
|
||||
|
||||
List<BodyPlateDetailVO> getPlateModelByPlateId(List<Long> bodyIds);
|
||||
}
|
||||
+74
@@ -1,20 +1,39 @@
|
||||
package com.cf.imes.module.executor.service.plate;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.util.RandomUtils;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -22,7 +41,9 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@@ -32,11 +53,18 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_NOT_EXIST
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@Override
|
||||
public Long createPlate(PlateSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@@ -134,4 +162,50 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<BodyPlateDetailVO> getPlateModelByPlateId(List<Long> bodyIds) {
|
||||
List<BodyPlateIdDTO> list = plateMapper.selectJoinList(BodyPlateIdDTO.class, new MPJLambdaWrapperX<PlateDO>()
|
||||
.selectAs(PlateDO::getId, "plateId")
|
||||
.leftJoin(OrderItemDO.class, OrderItemDO::getPlateId, PlateDO::getId)
|
||||
.in(OrderItemDO::getBodyId, bodyIds)
|
||||
.select(OrderItemDO::getBodyId)
|
||||
);
|
||||
Set<Long> plateIds = list.stream().map(BodyPlateIdDTO::getPlateId).collect(Collectors.toSet());
|
||||
List<OrderModelDO> orderModelDOS = buildRespByPlateIds(plateIds, ORDER_PLATE_MODEL);
|
||||
Map<Long, List<OrderModelDO>> map = orderModelDOS.stream().collect(Collectors.groupingBy(e -> {
|
||||
return list.stream().filter(f -> Objects.equals(f.getPlateId(), e.getPlateId())).map(BodyPlateIdDTO::getBodyId).findAny().orElse(null);
|
||||
}));
|
||||
|
||||
List<BodyPlateDetailVO> bodyPlateDetailVOS = new ArrayList<>();
|
||||
map.entrySet().forEach(e->{
|
||||
bodyPlateDetailVOS.add(BodyPlateDetailVO.builder()
|
||||
.orderModelList(e.getValue())
|
||||
.bodyId(e.getKey())
|
||||
.build()
|
||||
);
|
||||
});
|
||||
return bodyPlateDetailVOS;
|
||||
}
|
||||
|
||||
|
||||
private List<OrderModelDO> buildRespByPlateIds(Collection<Long> plateIds, String index) {
|
||||
List<FieldValue> fieldValues = plateIds.stream().map(FieldValue::of).toList();
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.query(q -> q.terms(b -> b.field("plateId").terms(e->e.value(fieldValues))));
|
||||
try {
|
||||
SearchResponse<OrderModelDO> search = elasticsearchClient.search(builder.build(), OrderModelDO.class);
|
||||
List<Hit<OrderModelDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -15,17 +16,24 @@ import lombok.experimental.Accessors;
|
||||
@NoArgsConstructor
|
||||
public class HoleDetail {
|
||||
|
||||
@Schema(description = "孔ID")
|
||||
private Integer holeId; //孔ID
|
||||
@Schema(description = "孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)")
|
||||
private Integer holeType;// 孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)
|
||||
@Schema(description = "孔面类型(0正面, 1反面, 2侧面)")
|
||||
private Integer faceType; // 孔面类型(0正面, 1反面, 2侧面)
|
||||
private float pointX;
|
||||
private float pointY;
|
||||
private float pointZ;
|
||||
@Schema(description = "孔半径")
|
||||
private float radius; //孔半径
|
||||
@Schema(description = "孔深度")
|
||||
private float depth; //孔深度
|
||||
@Schema(description = "孔末端点")
|
||||
private float endPoint; //孔末端点
|
||||
private float pointX2;
|
||||
private float pointY2;
|
||||
@Schema(description = "角度")
|
||||
private float angle; //角度
|
||||
|
||||
}
|
||||
|
||||
+10
-1
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -17,14 +18,22 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class ModelDetail {//去除order_module_extra
|
||||
|
||||
@Schema(description = "造型ID")
|
||||
private Integer modelId; //造型ID
|
||||
@Schema(description = "纹路ID")
|
||||
private Integer lineID; //纹路ID
|
||||
@Schema(description = "排版面 0正面, 1反面, 2侧面")
|
||||
private Integer typographicFace; //排版面 0正面, 1反面, 2侧面
|
||||
@Schema(description = "刀具名称")
|
||||
private String knifeName; //刀具名称
|
||||
@Schema(description = "刀半径")
|
||||
private float knifeRadius; //刀半径
|
||||
@Schema(description = "深度")
|
||||
private float depth; //深度
|
||||
@Schema(description = "造型数据")
|
||||
private IOriginModelingData originModeling; //造型数据
|
||||
@Schema(description = "点列表")
|
||||
private List<PointList> pointList; //点列表
|
||||
@Schema(description = "偏移量列表 //模块偏移数据")
|
||||
private List<OffSetList> offSetList; //偏移量列表 //模块偏移数据
|
||||
}
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -16,10 +17,16 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
|
||||
public class OffSetList {
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name; //名称
|
||||
@Schema(description = "面向类型(0正面, 1反面, 2侧面)")
|
||||
private Integer faceType;// 面向类型(0正面, 1反面, 2侧面)
|
||||
@Schema(description = "值")
|
||||
private float value; //值
|
||||
@Schema(description = "半径")
|
||||
private float radius;//半径
|
||||
@Schema(description = "深度")
|
||||
private float deep;//深度
|
||||
@Schema(description = "角度")
|
||||
private float angle;//角度
|
||||
}
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.util.deviseData;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,6 +19,8 @@ public class PointDetail {
|
||||
private Integer pointId;
|
||||
private float pointX;
|
||||
private float pointY;
|
||||
@Schema(description = "曲线")
|
||||
private float curve;//曲线
|
||||
@Schema(description = "封边尺寸")
|
||||
private float SealSize;//封边尺寸
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user