mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
处理ES字段的mapping映射
This commit is contained in:
-2
@@ -6,8 +6,6 @@ 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;
|
||||
|
||||
|
||||
+10
-10
@@ -37,8 +37,7 @@ public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
|
||||
private Snowflake snowflake = IdUtil.getSnowflake();
|
||||
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||
ZoneId utc = ZoneId.of("UTC");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public ESDocumentServiceImpl(ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
|
||||
this.elasticsearchClient = elasticsearchClient;
|
||||
@@ -47,13 +46,13 @@ public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
|
||||
@Override
|
||||
public <T> IndexResponse createByFluentDSL(String idxName, String idxId, ESDocument document) throws Exception {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Date date = new Date();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
document.setCreator(loginUser.getId());
|
||||
document.setUpdater(loginUser.getId());
|
||||
document.setOrganId(loginUser.getOrganId());
|
||||
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setCreateTime(simpleDateFormat.format(date));
|
||||
document.setUpdateTime(simpleDateFormat.format(date));
|
||||
if (StrUtil.isBlank(document.getId())) {
|
||||
document.setId(snowflake.nextIdStr());
|
||||
}
|
||||
@@ -73,12 +72,12 @@ public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
@Override
|
||||
public <T> IndexResponse createByBuilderPattern(String idxName, String idxId, ESDocument document) throws Exception {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Date date = new Date();
|
||||
document.setCreator(loginUser.getId());
|
||||
document.setUpdater(loginUser.getId());
|
||||
document.setOrganId(loginUser.getOrganId());
|
||||
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||
document.setCreateTime(simpleDateFormat.format(date));
|
||||
document.setUpdateTime(simpleDateFormat.format(date));
|
||||
IndexRequest.Builder<Object> indexReqBuilder = new IndexRequest.Builder<>();
|
||||
indexReqBuilder.index(idxName);
|
||||
if (StrUtil.isBlank(idxId)) {
|
||||
@@ -144,9 +143,10 @@ public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
esDocument.setId(snowflake.nextIdStr());
|
||||
}
|
||||
esDocument.setCreator(loginUser.getId());
|
||||
esDocument.setCreateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||
esDocument.setCreateTime(simpleDateFormat.format(date));
|
||||
esDocument.setUpdater(loginUser.getId());
|
||||
esDocument.setUpdateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||
|
||||
esDocument.setUpdateTime(simpleDateFormat.format(date));
|
||||
br.operations(op -> op.index(idx -> idx
|
||||
.index(idxName)
|
||||
.id(esDocument.getId().toString())
|
||||
|
||||
+19
@@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -163,6 +164,24 @@ public class PlanController {
|
||||
iBoardProdInfo.setBrand("xxx");
|
||||
iBoardProdInfo.setSpec("xxxx");
|
||||
iBoardProdInfo.setGoodType(1);
|
||||
iBoardProdInfo.setWidth((float) 0.0);
|
||||
iBoardProdInfo.setHeight((float) 0.0);
|
||||
iBoardProdInfo.setThickness(5.0);
|
||||
iBoardProdInfo.setSplitWidth(1);
|
||||
iBoardProdInfo.setSplitHeight(1);
|
||||
iBoardProdInfo.setSplitThickness(2);
|
||||
iBoardProdInfo.setSealUp((float) 0.0);
|
||||
iBoardProdInfo.setSealLeft((float) 0.0);
|
||||
iBoardProdInfo.setSealRight((float) 0.0);
|
||||
iBoardProdInfo.setSealDown((float) 0.0);
|
||||
iBoardProdInfo.setTexture(1);
|
||||
iBoardProdInfo.setOpenDoorType(1);
|
||||
iBoardProdInfo.setTypographicFace(1);
|
||||
detail.setMultiNum(23);
|
||||
detail.setDepth(10.0);
|
||||
detail.setHeight(9.0);
|
||||
detail.getContourDetail().forEach(e->e.setTypographicFace(1));
|
||||
detail.getSideModelDetail().forEach(e->e.setTypographicFace(1));
|
||||
details.add(detail);
|
||||
}
|
||||
orderInputProcessor.input(details, 999L);
|
||||
|
||||
+18
-11
@@ -1,7 +1,9 @@
|
||||
package com.cf.imes.module.executor.service.order;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import co.elastic.clients.elasticsearch.core.BulkResponse;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
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;
|
||||
@@ -199,20 +201,20 @@ public class OrderInputProcessor {
|
||||
.plateNo(e.getIBoardProdInfo().getPlateNo())
|
||||
//.type(e.getIBoardProdInfo().)
|
||||
.goodsId(rawGoodsDO.getRawGoodsId())
|
||||
.height(e.getIBoardProdInfo().getHeight())
|
||||
.width(e.getIBoardProdInfo().getWidth())
|
||||
.height(new BigDecimal(e.getIBoardProdInfo().getHeight()))
|
||||
.width(new BigDecimal(e.getIBoardProdInfo().getWidth()))
|
||||
.thickness(new BigDecimal(e.getIBoardProdInfo().getThickness().toString()))
|
||||
.splitHeight(new BigDecimal(e.getIBoardProdInfo().getSplitHeight().toString()))
|
||||
.splitWidth(new BigDecimal(e.getIBoardProdInfo().getSplitWidth().toString()))
|
||||
.splitHeight(new BigDecimal(e.getIBoardProdInfo().getSplitHeight()))
|
||||
.splitWidth(new BigDecimal(e.getIBoardProdInfo().getSplitWidth()))
|
||||
.splitThickness(new BigDecimal(e.getIBoardProdInfo().getThickness().toString()))
|
||||
.sealLeft(e.getIBoardProdInfo().getSealLeft())
|
||||
.sealRight(e.getIBoardProdInfo().getSealRight())
|
||||
.sealUp(e.getIBoardProdInfo().getSealUp())
|
||||
.sealDown(e.getIBoardProdInfo().getSealDown())
|
||||
.area(e.getIBoardProdInfo().getWidth().multiply(e.getIBoardProdInfo().getHeight()))
|
||||
.sealLeft(new BigDecimal(e.getIBoardProdInfo().getSealLeft()))
|
||||
.sealRight(new BigDecimal(e.getIBoardProdInfo().getSealRight()))
|
||||
.sealUp(new BigDecimal(e.getIBoardProdInfo().getSealUp()))
|
||||
.sealDown(new BigDecimal(e.getIBoardProdInfo().getSealDown()))
|
||||
.area(new BigDecimal( String.valueOf(e.getIBoardProdInfo().getWidth())).multiply( new BigDecimal(e.getIBoardProdInfo().getHeight())))
|
||||
.texture(e.getIBoardProdInfo().getTexture())
|
||||
.type(0)
|
||||
.holeFace(e.getHoleDetail().getFaceType())
|
||||
.holeFace(0)
|
||||
.holeArrange(0)
|
||||
.unregularPointCount(0)
|
||||
.frontHoleCount(0)
|
||||
@@ -309,7 +311,12 @@ public class OrderInputProcessor {
|
||||
*/
|
||||
public void batchSaveModel(List<OrderModelDO> orderModelDOs) {
|
||||
try {
|
||||
esDocumentService.bulkCreate(ORDER_PLATE_MODEL, orderModelDOs);
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PLATE_MODEL, orderModelDOs);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if(errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
throw new ServiceException(500,"未知异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"contourDetail": {
|
||||
"properties": {
|
||||
"depth": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"knifeName": {
|
||||
"type": "keyword"
|
||||
@@ -28,7 +28,7 @@
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "keyword"
|
||||
@@ -53,7 +53,7 @@
|
||||
"type": "float"
|
||||
},
|
||||
"dir": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"holes": {
|
||||
"properties": {
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
},
|
||||
"knifeRadius": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"outline": {
|
||||
"properties": {
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
},
|
||||
"thickness": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -123,12 +123,13 @@
|
||||
}
|
||||
},
|
||||
"typographicFace": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"createTime": {
|
||||
"type": "date"
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"creator": {
|
||||
"type": "long"
|
||||
@@ -145,13 +146,13 @@
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"holeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"holeType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
@@ -226,13 +227,13 @@
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"holeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"holeType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"pointX": {
|
||||
"type": "float"
|
||||
@@ -280,7 +281,7 @@
|
||||
"type": "float"
|
||||
},
|
||||
"faceType": {
|
||||
"type": "short"
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "keyword"
|
||||
@@ -380,7 +381,8 @@
|
||||
}
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "date"
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"updater": {
|
||||
"type": "long"
|
||||
|
||||
Reference in New Issue
Block a user