mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
executor 服务添加ES依赖,添加对小板造型数据入库处理
This commit is contained in:
+3
-2
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||
@@ -19,11 +20,11 @@ public class ESDocument {
|
||||
public String id;
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date createTime;
|
||||
private String createTime;
|
||||
private Long creator;
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date updateTime;
|
||||
private String updateTime;
|
||||
private Long updater;
|
||||
private Long organId;
|
||||
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public interface ESDocumentService {
|
||||
* @param documents 要增加的对象集合
|
||||
* @return 批量操作的结果
|
||||
*/
|
||||
<T> BulkResponse bulkCreate(String idxName, List<T> documents) throws Exception;
|
||||
<T> BulkResponse bulkCreate(String idxName, List<?extends ESDocument> documents) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+56
-38
@@ -15,6 +15,11 @@ import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,7 +28,7 @@ import java.util.function.BiConsumer;
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
//同步客户端
|
||||
private final ElasticsearchClient elasticsearchClient;
|
||||
|
||||
@@ -32,20 +37,24 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
private Snowflake snowflake = IdUtil.getSnowflake();
|
||||
|
||||
public ESDocumentServiceImpl (ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||
ZoneId utc = ZoneId.of("UTC");
|
||||
|
||||
public ESDocumentServiceImpl(ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
|
||||
this.elasticsearchClient = elasticsearchClient;
|
||||
this.elasticsearchAsyncClient = elasticsearchAsyncClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IndexResponse createByFluentDSL(String idxName, String idxId, ESDocument document) throws Exception {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
document.setCreator(loginUser.getId());
|
||||
document.setUpdater(loginUser.getId());
|
||||
document.setOrganId(loginUser.getOrganId());
|
||||
document.setCreateTime(new Date());
|
||||
document.setUpdateTime(new Date());
|
||||
if(StrUtil.isBlank(document.getId())) {
|
||||
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
if (StrUtil.isBlank(document.getId())) {
|
||||
document.setId(snowflake.nextIdStr());
|
||||
}
|
||||
return elasticsearchClient.index(idx -> idx
|
||||
@@ -56,21 +65,23 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* BuilderPattern 方式创建文档
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
* @param document 文档对象
|
||||
*/
|
||||
@Override
|
||||
public <T> IndexResponse createByBuilderPattern(String idxName, String idxId, ESDocument document) throws Exception {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
document.setCreator(loginUser.getId());
|
||||
document.setUpdater(loginUser.getId());
|
||||
document.setOrganId(loginUser.getOrganId());
|
||||
document.setCreateTime(new Date());
|
||||
document.setUpdateTime(new Date());
|
||||
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
IndexRequest.Builder<Object> indexReqBuilder = new IndexRequest.Builder<>();
|
||||
indexReqBuilder.index(idxName);
|
||||
if(StrUtil.isBlank(idxId)) {
|
||||
if (StrUtil.isBlank(idxId)) {
|
||||
idxId = snowflake.nextIdStr();
|
||||
}
|
||||
indexReqBuilder.id(idxId);
|
||||
@@ -80,13 +91,14 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* json方式创建文档
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
* @param jsonContent json字符串
|
||||
*/
|
||||
@Override
|
||||
public IndexResponse createByJson(String idxName, String idxId, String jsonContent) throws Exception {
|
||||
if(StrUtil.isBlank(idxId)) {
|
||||
if (StrUtil.isBlank(idxId)) {
|
||||
idxId = snowflake.nextIdStr();
|
||||
}
|
||||
String finalIdxId = idxId;
|
||||
@@ -98,11 +110,12 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步方式创建文档
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
* 异步方式创建文档
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param idxId 索引id
|
||||
* @param document 文档
|
||||
* @param action 操作
|
||||
* @param action 操作
|
||||
*/
|
||||
@Override
|
||||
public <T> void createAsync(String idxName, String idxId, T document, BiConsumer<IndexResponse, Throwable> action) {
|
||||
@@ -115,54 +128,56 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* 批量方式创建文档
|
||||
* @param idxName 索引名
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param documents 要增加的对象集合
|
||||
*/
|
||||
|
||||
@Override
|
||||
public <T> BulkResponse bulkCreate(String idxName, List<T> documents) throws Exception {
|
||||
public <T> BulkResponse bulkCreate(String idxName, List<? extends ESDocument> documents) throws Exception {
|
||||
BulkRequest.Builder br = new BulkRequest.Builder();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Date date = new Date();
|
||||
documents.forEach(document ->{
|
||||
ESDocument esDocument = (ESDocument) document;
|
||||
if(StrUtil.isBlank(esDocument.getId())) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
documents.forEach(esDocument -> {
|
||||
if (StrUtil.isBlank(esDocument.getId())) {
|
||||
esDocument.setId(snowflake.nextIdStr());
|
||||
}
|
||||
esDocument.setCreator(loginUser.getId());
|
||||
esDocument.setCreateTime(date);
|
||||
esDocument.setCreateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||
esDocument.setUpdater(loginUser.getId());
|
||||
esDocument.setUpdateTime(date);
|
||||
esDocument.setUpdateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||
br.operations(op -> op.index(idx -> idx
|
||||
.index(idxName)
|
||||
.id(esDocument.getId().toString())
|
||||
.document(esDocument)));
|
||||
});
|
||||
return elasticsearchClient.bulk(br.build());
|
||||
return elasticsearchClient.bulk(br.build());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idxName 索引名称
|
||||
* @param docId 文档id
|
||||
* @param tClass 返回的类型
|
||||
* @param map 修改内容的map
|
||||
* Map<String, Object> map = new HashMap<>();
|
||||
* map.put("age", 35);
|
||||
* 把年龄改成35
|
||||
* @param docId 文档id
|
||||
* @param tClass 返回的类型
|
||||
* @param map 修改内容的map
|
||||
* Map<String, Object> map = new HashMap<>();
|
||||
* map.put("age", 35);
|
||||
* 把年龄改成35
|
||||
*/
|
||||
@Override
|
||||
public <T> Result updateById(String idxName, String docId, Class<T> tClass, Map<String,Object> map) throws IOException {
|
||||
public <T> Result updateById(String idxName, String docId, Class<T> tClass, Map<String, Object> map) throws IOException {
|
||||
UpdateResponse<T> response = elasticsearchClient.update(e -> e.index(idxName).id(docId).doc(map), tClass);
|
||||
return response.result();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档id查询信息
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param docId 文档id
|
||||
* @param docId 文档id
|
||||
*/
|
||||
@Override
|
||||
public <T> T getById(String idxName, String docId,Class<T> tClass) throws IOException {
|
||||
public <T> T getById(String idxName, String docId, Class<T> tClass) throws IOException {
|
||||
GetResponse<T> response = elasticsearchClient.get(g -> g
|
||||
.index(idxName)
|
||||
.id(docId),
|
||||
@@ -172,8 +187,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* 根据索引名称和文档id查询ObjectNode
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param docId 文档id
|
||||
* @param docId 文档id
|
||||
*/
|
||||
@Override
|
||||
public JSONObject getObjectNodeById(String idxName, String docId) throws IOException {
|
||||
@@ -187,8 +203,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* 单条输出
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param docId 文档id
|
||||
* @param docId 文档id
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteById(String idxName, String docId) throws IOException {
|
||||
@@ -200,8 +217,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param idxName 索引名
|
||||
* @param docIds 要删除的文档id集合
|
||||
* @param docIds 要删除的文档id集合
|
||||
*/
|
||||
@Override
|
||||
public BulkResponse bulkDeleteByIds(String idxName, List<String> docIds) throws Exception {
|
||||
|
||||
@@ -65,6 +65,24 @@
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-elasticsearch</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>jakarta.json</groupId>
|
||||
<artifactId>jakarta.json-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.json</groupId>
|
||||
<artifactId>jakarta.json-api</artifactId>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
|
||||
+28
@@ -1,5 +1,9 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan;
|
||||
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.executor.util.RandomUtils;
|
||||
import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.deviseData.IBoardProdInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -38,6 +42,9 @@ public class PlanController {
|
||||
@Resource
|
||||
private PlanService planService;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建排单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
|
||||
@@ -141,4 +148,25 @@ public class PlanController {
|
||||
BeanUtils.toBean(plateByPlanId, PlateResList.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("test")
|
||||
@Operation(summary = "test")
|
||||
public Boolean test() {
|
||||
ArrayList<Detail> details = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Detail detail = RandomUtils.randomPojo(Detail.class);
|
||||
IBoardProdInfo iBoardProdInfo = detail.getIBoardProdInfo();
|
||||
iBoardProdInfo.setRawGoodsId(999L);
|
||||
iBoardProdInfo.setGoodsName("abc");
|
||||
iBoardProdInfo.setMaterial("ccc");
|
||||
iBoardProdInfo.setColor("blue");
|
||||
iBoardProdInfo.setBrand("xxx");
|
||||
iBoardProdInfo.setSpec("xxxx");
|
||||
iBoardProdInfo.setGoodType(1);
|
||||
details.add(detail);
|
||||
}
|
||||
orderInputProcessor.input(details, 999L);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordermodel;
|
||||
|
||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||
import com.cf.imes.module.executor.util.deviseData.HoleDetail;
|
||||
import com.cf.imes.module.executor.util.deviseData.ModelDetail;
|
||||
import com.cf.imes.module.executor.util.deviseData.PointDetail;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
* 生产单 小板的轮廓数据对象
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderModelDO extends ESDocument {
|
||||
/*@Schema(description = "组织id")
|
||||
private Long organId;*/
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "小板id")
|
||||
private Long plateId;
|
||||
@Schema(description = "轮廓明细")
|
||||
private List<ModelDetail> contourDetail;
|
||||
@Schema(description = "点明细")
|
||||
private List<PointDetail> pointDetail;
|
||||
@Schema(description = "孔明细")
|
||||
private HoleDetail holeDetail;
|
||||
@Schema(description = "原始点明细")
|
||||
private List<PointDetail> rawPointDetail;
|
||||
@Schema(description = "侧面轮廓明细")
|
||||
private List<ModelDetail> sideModelDetail;
|
||||
@Schema(description = "侧面孔明细")
|
||||
private List<HoleDetail> sideHoleDetail;
|
||||
}
|
||||
+35
-7
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.order;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
@@ -10,6 +11,7 @@ import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
@@ -24,6 +26,7 @@ import com.cf.imes.module.executor.util.deviseData.Detail;
|
||||
import com.cf.imes.module.executor.util.deviseData.IBoardProdInfo;
|
||||
import com.cf.imes.module.executor.util.deviseData.PartsModuleExtra;
|
||||
import com.cf.imes.module.executor.util.deviseData.PlateModuleExtra;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -36,6 +39,7 @@ import java.util.stream.Collectors;
|
||||
* @author Beal
|
||||
* 生产单入库处理器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OrderInputProcessor {
|
||||
|
||||
@@ -64,6 +68,11 @@ public class OrderInputProcessor {
|
||||
@Resource
|
||||
private OrderModuleExtraMapper orderModuleExtraMapper;
|
||||
|
||||
@Resource
|
||||
private ESDocumentService esDocumentService;
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
|
||||
public void input(List<Detail> sourceList, Long orderId) {
|
||||
Long organId = OrganContextHolder.getOrganId();
|
||||
@@ -74,6 +83,7 @@ public class OrderInputProcessor {
|
||||
ArrayList<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
||||
ArrayList<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||
ArrayList<OrderModuleExtraDO> orderModuleExtraDOS = new ArrayList<>();
|
||||
ArrayList<OrderModelDO> orderModelDOS = new ArrayList<>();
|
||||
Map<RawGoodsDO, Map<OrderBodyDO, Map<OrderGroupDO, List<Detail>>>> map = sourceList.stream().collect(Collectors.groupingBy(e ->
|
||||
RawGoodsDO.builder()
|
||||
.rawGoodsId(e.getIBoardProdInfo().getGoodsId())
|
||||
@@ -148,7 +158,7 @@ public class OrderInputProcessor {
|
||||
.unit(e.getIBoardProdInfo().getUnit())
|
||||
.build()
|
||||
).toList();
|
||||
if(CollectionUtil.isNotEmpty(plateExtras)) {
|
||||
if (CollectionUtil.isNotEmpty(plateExtras)) {
|
||||
orderModuleExtraDOS.add(
|
||||
OrderModuleExtraDO.builder()
|
||||
.orderId(orderId)
|
||||
@@ -159,7 +169,7 @@ public class OrderInputProcessor {
|
||||
.build());
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(partsModuleExtras)) {
|
||||
if (CollectionUtil.isNotEmpty(partsModuleExtras)) {
|
||||
orderModuleExtraDOS.add(
|
||||
OrderModuleExtraDO.builder()
|
||||
.orderId(orderId)
|
||||
@@ -224,6 +234,17 @@ public class OrderInputProcessor {
|
||||
orderItemDO.setPartsId(0L);
|
||||
orderItemDO.setType(1);
|
||||
plateDOS.add(plateDO);
|
||||
orderModelDOS.add(
|
||||
OrderModelDO.builder()
|
||||
.orderId(orderId)
|
||||
.plateId(plateDO.getId())
|
||||
.contourDetail(e.getContourDetail())
|
||||
.pointDetail(e.getPointDetail())
|
||||
.holeDetail(e.getHoleDetail())
|
||||
.rawPointDetail(e.getRawPointDetail())
|
||||
.sideHoleDetail(e.getSideHoleDetail())
|
||||
.sideModelDetail(e.getSideModelDetail())
|
||||
.build());
|
||||
} else {
|
||||
OrderPartsDO orderPartsDO = OrderPartsDO.builder()
|
||||
.id(identifierGenerator.nextId(null).longValue())
|
||||
@@ -252,13 +273,14 @@ public class OrderInputProcessor {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
batchSaveModel(orderModelDOS);
|
||||
batchInsert(rawGoodsDOS, orderBodyDOS, orderGroupDOS, orderPartsDOS, plateDOS, orderModuleExtraDOS, orderItemDOS);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存生产单小板五金数据
|
||||
*
|
||||
* @param rawGoodsDOS
|
||||
* @param orderBodyDOS
|
||||
* @param orderGroupDOS
|
||||
@@ -282,11 +304,17 @@ public class OrderInputProcessor {
|
||||
|
||||
/**
|
||||
* 保存生产单造型数据
|
||||
* @param sourceList
|
||||
* @param orderId
|
||||
*
|
||||
* @param orderModelDOs
|
||||
*/
|
||||
public void saveModel(List<Detail> sourceList, Long orderId) {
|
||||
|
||||
public void batchSaveModel(List<OrderModelDO> orderModelDOs) {
|
||||
try {
|
||||
esDocumentService.bulkCreate(ORDER_PLATE_MODEL, orderModelDOs);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -68,7 +68,8 @@ spring:
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
|
||||
elasticsearch:
|
||||
uris: 192.168.1.205:9200
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
|
||||
+2
@@ -74,6 +74,8 @@ spring:
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
elasticsearch:
|
||||
uris: 192.168.1.205:9200
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class MachineController {
|
||||
@Operation(summary = "获得默认机台模板")
|
||||
@Parameter(name = "machineType", description = "机台类型", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||
public CommonResult<CuttingTemplateRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||
return success(machineTemplateService.getDefaultCutting(machineType));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public interface MachineTemplateService {
|
||||
|
||||
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
||||
|
||||
CuttingRespVO getDefaultCutting(Integer machineType);
|
||||
CuttingTemplateRespVO getDefaultCutting(Integer machineType);
|
||||
|
||||
DrillTemplateRespVO getDefaultDrill();
|
||||
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CuttingRespVO getDefaultCutting(Integer machineType) {
|
||||
public CuttingTemplateRespVO getDefaultCutting(Integer machineType) {
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||
.eq(MachineTemplateDO::getIsDefault, Boolean.TRUE)
|
||||
.eq(MachineTemplateDO::getMachineType, machineType)
|
||||
@@ -207,7 +207,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||
}
|
||||
MachineTemplateDO templateDO = machineTemplateDOS.get(0);
|
||||
return MachineTemplateConvert.convert(templateDO);
|
||||
return MachineTemplateConvert.convert1(templateDO);
|
||||
}
|
||||
throw exception(DEFAULT_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,390 @@
|
||||
{
|
||||
"settings": {},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"contourDetail": {
|
||||
"properties": {
|
||||
"depth": {
|
||||
"type": "short"
|
||||
},
|
||||
"knifeName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"knifeRadius": {
|
||||
"type": "float"
|
||||
},
|
||||
"lineID": {
|
||||
"type": "long"
|
||||
},
|
||||
"modelId": {
|
||||
"type": "long"
|
||||
},
|
||||
"offSetList": {
|
||||
"properties": {
|
||||
"angle": {
|
||||
"type": "float"
|
||||
},
|
||||
"deep": {
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
},
|
||||
"name": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"radius": {
|
||||
"type": "float"
|
||||
},
|
||||
"value": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"originModeling": {
|
||||
"properties": {
|
||||
"addDepth": {
|
||||
"type": "float"
|
||||
},
|
||||
"addLen": {
|
||||
"type": "float"
|
||||
},
|
||||
"addWidth": {
|
||||
"type": "float"
|
||||
},
|
||||
"dir": {
|
||||
"type": "short"
|
||||
},
|
||||
"holes": {
|
||||
"properties": {
|
||||
"buls": {
|
||||
"type": "float"
|
||||
},
|
||||
"pts": {
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "float"
|
||||
},
|
||||
"y": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"knifeRadius": {
|
||||
"type": "short"
|
||||
},
|
||||
"outline": {
|
||||
"properties": {
|
||||
"buls": {
|
||||
"type": "float"
|
||||
},
|
||||
"pts": {
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "float"
|
||||
},
|
||||
"y": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"thickness": {
|
||||
"type": "short"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pointList": {
|
||||
"properties": {
|
||||
"curve": {
|
||||
"type": "long"
|
||||
},
|
||||
"depth": {
|
||||
"type": "long"
|
||||
},
|
||||
"lineId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "float"
|
||||
},
|
||||
"radius": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"typographicFace": {
|
||||
"type": "short"
|
||||
}
|
||||
}
|
||||
},
|
||||
"createTime": {
|
||||
"type": "date"
|
||||
},
|
||||
"creator": {
|
||||
"type": "long"
|
||||
},
|
||||
"holeDetail": {
|
||||
"properties": {
|
||||
"angle": {
|
||||
"type": "float"
|
||||
},
|
||||
"depth": {
|
||||
"type": "float"
|
||||
},
|
||||
"endPoint": {
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
},
|
||||
"holeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"holeType": {
|
||||
"type": "short"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointX2": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY2": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointZ": {
|
||||
"type": "float"
|
||||
},
|
||||
"radius": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"orderId": {
|
||||
"type": "long"
|
||||
},
|
||||
"plateId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointDetail": {
|
||||
"properties": {
|
||||
"curve": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rawPointDetail": {
|
||||
"properties": {
|
||||
"curve": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sideHoleDetail": {
|
||||
"properties": {
|
||||
"angle": {
|
||||
"type": "float"
|
||||
},
|
||||
"depth": {
|
||||
"type": "float"
|
||||
},
|
||||
"endPoint": {
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
},
|
||||
"holeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"holeType": {
|
||||
"type": "short"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointX2": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointY2": {
|
||||
"type": "float"
|
||||
},
|
||||
"pointZ": {
|
||||
"type": "float"
|
||||
},
|
||||
"radius": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sideModelDetail": {
|
||||
"properties": {
|
||||
"depth": {
|
||||
"type": "float"
|
||||
},
|
||||
"knifeName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"knifeRadius": {
|
||||
"type": "float"
|
||||
},
|
||||
"lineID": {
|
||||
"type": "long"
|
||||
},
|
||||
"modelId": {
|
||||
"type": "long"
|
||||
},
|
||||
"offSetList": {
|
||||
"properties": {
|
||||
"angle": {
|
||||
"type": "float"
|
||||
},
|
||||
"deep": {
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
},
|
||||
"name": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"radius": {
|
||||
"type": "float"
|
||||
},
|
||||
"value": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"originModeling": {
|
||||
"properties": {
|
||||
"addDepth": {
|
||||
"type": "long"
|
||||
},
|
||||
"addLen": {
|
||||
"type": "long"
|
||||
},
|
||||
"addWidth": {
|
||||
"type": "long"
|
||||
},
|
||||
"dir": {
|
||||
"type": "long"
|
||||
},
|
||||
"holes": {
|
||||
"properties": {
|
||||
"buls": {
|
||||
"type": "long"
|
||||
},
|
||||
"pts": {
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "float"
|
||||
},
|
||||
"y": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"knifeRadius": {
|
||||
"type": "long"
|
||||
},
|
||||
"outline": {
|
||||
"properties": {
|
||||
"buls": {
|
||||
"type": "long"
|
||||
},
|
||||
"pts": {
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "float"
|
||||
},
|
||||
"y": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"thickness": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pointList": {
|
||||
"properties": {
|
||||
"curve": {
|
||||
"type": "long"
|
||||
},
|
||||
"depth": {
|
||||
"type": "long"
|
||||
},
|
||||
"lineId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointId": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "long"
|
||||
},
|
||||
"pointY": {
|
||||
"type": "long"
|
||||
},
|
||||
"radius": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"typographicFace": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "date"
|
||||
},
|
||||
"updater": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user