mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +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 lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
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.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||||
@@ -19,11 +20,11 @@ public class ESDocument {
|
|||||||
public String id;
|
public String id;
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||||
private Date createTime;
|
private String createTime;
|
||||||
private Long creator;
|
private Long creator;
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||||
private Date updateTime;
|
private String updateTime;
|
||||||
private Long updater;
|
private Long updater;
|
||||||
private Long organId;
|
private Long organId;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ public interface ESDocumentService {
|
|||||||
* @param documents 要增加的对象集合
|
* @param documents 要增加的对象集合
|
||||||
* @return 批量操作的结果
|
* @return 批量操作的结果
|
||||||
*/
|
*/
|
||||||
<T> BulkResponse bulkCreate(String idxName, List<T> documents) throws Exception;
|
<T> BulkResponse bulkCreate(String idxName, List<?extends ESDocument> documents) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+28
-10
@@ -15,6 +15,11 @@ import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
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.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -32,6 +37,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
private Snowflake snowflake = IdUtil.getSnowflake();
|
private Snowflake snowflake = IdUtil.getSnowflake();
|
||||||
|
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||||
|
ZoneId utc = ZoneId.of("UTC");
|
||||||
|
|
||||||
public ESDocumentServiceImpl(ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
|
public ESDocumentServiceImpl(ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
|
||||||
this.elasticsearchClient = elasticsearchClient;
|
this.elasticsearchClient = elasticsearchClient;
|
||||||
this.elasticsearchAsyncClient = elasticsearchAsyncClient;
|
this.elasticsearchAsyncClient = elasticsearchAsyncClient;
|
||||||
@@ -39,12 +47,13 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> IndexResponse createByFluentDSL(String idxName, String idxId, ESDocument document) throws Exception {
|
public <T> IndexResponse createByFluentDSL(String idxName, String idxId, ESDocument document) throws Exception {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
document.setCreator(loginUser.getId());
|
document.setCreator(loginUser.getId());
|
||||||
document.setUpdater(loginUser.getId());
|
document.setUpdater(loginUser.getId());
|
||||||
document.setOrganId(loginUser.getOrganId());
|
document.setOrganId(loginUser.getOrganId());
|
||||||
document.setCreateTime(new Date());
|
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||||
document.setUpdateTime(new Date());
|
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||||
if (StrUtil.isBlank(document.getId())) {
|
if (StrUtil.isBlank(document.getId())) {
|
||||||
document.setId(snowflake.nextIdStr());
|
document.setId(snowflake.nextIdStr());
|
||||||
}
|
}
|
||||||
@@ -56,6 +65,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BuilderPattern 方式创建文档
|
* BuilderPattern 方式创建文档
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param idxId 索引id
|
* @param idxId 索引id
|
||||||
* @param document 文档对象
|
* @param document 文档对象
|
||||||
@@ -63,11 +73,12 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
@Override
|
@Override
|
||||||
public <T> IndexResponse createByBuilderPattern(String idxName, String idxId, ESDocument document) throws Exception {
|
public <T> IndexResponse createByBuilderPattern(String idxName, String idxId, ESDocument document) throws Exception {
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
document.setCreator(loginUser.getId());
|
document.setCreator(loginUser.getId());
|
||||||
document.setUpdater(loginUser.getId());
|
document.setUpdater(loginUser.getId());
|
||||||
document.setOrganId(loginUser.getOrganId());
|
document.setOrganId(loginUser.getOrganId());
|
||||||
document.setCreateTime(new Date());
|
document.setCreateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||||
document.setUpdateTime(new Date());
|
document.setUpdateTime((now.atZone(utc).format(dateTimeFormatter)));
|
||||||
IndexRequest.Builder<Object> indexReqBuilder = new IndexRequest.Builder<>();
|
IndexRequest.Builder<Object> indexReqBuilder = new IndexRequest.Builder<>();
|
||||||
indexReqBuilder.index(idxName);
|
indexReqBuilder.index(idxName);
|
||||||
if (StrUtil.isBlank(idxId)) {
|
if (StrUtil.isBlank(idxId)) {
|
||||||
@@ -80,6 +91,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* json方式创建文档
|
* json方式创建文档
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param idxId 索引id
|
* @param idxId 索引id
|
||||||
* @param jsonContent json字符串
|
* @param jsonContent json字符串
|
||||||
@@ -99,6 +111,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步方式创建文档
|
* 异步方式创建文档
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param idxId 索引id
|
* @param idxId 索引id
|
||||||
* @param document 文档
|
* @param document 文档
|
||||||
@@ -115,23 +128,25 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量方式创建文档
|
* 批量方式创建文档
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param documents 要增加的对象集合
|
* @param documents 要增加的对象集合
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@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();
|
BulkRequest.Builder br = new BulkRequest.Builder();
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
documents.forEach(document ->{
|
LocalDateTime now = LocalDateTime.now();
|
||||||
ESDocument esDocument = (ESDocument) document;
|
documents.forEach(esDocument -> {
|
||||||
if (StrUtil.isBlank(esDocument.getId())) {
|
if (StrUtil.isBlank(esDocument.getId())) {
|
||||||
esDocument.setId(snowflake.nextIdStr());
|
esDocument.setId(snowflake.nextIdStr());
|
||||||
}
|
}
|
||||||
esDocument.setCreator(loginUser.getId());
|
esDocument.setCreator(loginUser.getId());
|
||||||
esDocument.setCreateTime(date);
|
esDocument.setCreateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||||
esDocument.setUpdater(loginUser.getId());
|
esDocument.setUpdater(loginUser.getId());
|
||||||
esDocument.setUpdateTime(date);
|
esDocument.setUpdateTime(now.atZone(utc).format(dateTimeFormatter));
|
||||||
br.operations(op -> op.index(idx -> idx
|
br.operations(op -> op.index(idx -> idx
|
||||||
.index(idxName)
|
.index(idxName)
|
||||||
.id(esDocument.getId().toString())
|
.id(esDocument.getId().toString())
|
||||||
@@ -141,7 +156,6 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param idxName 索引名称
|
* @param idxName 索引名称
|
||||||
* @param docId 文档id
|
* @param docId 文档id
|
||||||
* @param tClass 返回的类型
|
* @param tClass 返回的类型
|
||||||
@@ -158,6 +172,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文档id查询信息
|
* 文档id查询信息
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param docId 文档id
|
* @param docId 文档id
|
||||||
*/
|
*/
|
||||||
@@ -172,6 +187,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据索引名称和文档id查询ObjectNode
|
* 根据索引名称和文档id查询ObjectNode
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param docId 文档id
|
* @param docId 文档id
|
||||||
*/
|
*/
|
||||||
@@ -187,6 +203,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 单条输出
|
* 单条输出
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param docId 文档id
|
* @param docId 文档id
|
||||||
*/
|
*/
|
||||||
@@ -200,6 +217,7 @@ public class ESDocumentServiceImpl implements ESDocumentService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
|
*
|
||||||
* @param idxName 索引名
|
* @param idxName 索引名
|
||||||
* @param docIds 要删除的文档id集合
|
* @param docIds 要删除的文档id集合
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,6 +65,24 @@
|
|||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-redis</artifactId>
|
<artifactId>cf-spring-boot-starter-redis</artifactId>
|
||||||
</dependency>
|
</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 远程调用相关 -->
|
<!-- RPC 远程调用相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
|
|||||||
+28
@@ -1,5 +1,9 @@
|
|||||||
package com.cf.imes.module.executor.controller.admin.plan;
|
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 org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -38,6 +42,9 @@ public class PlanController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PlanService planService;
|
private PlanService planService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderInputProcessor orderInputProcessor;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建排单")
|
@Operation(summary = "创建排单")
|
||||||
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
|
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
|
||||||
@@ -141,4 +148,25 @@ public class PlanController {
|
|||||||
BeanUtils.toBean(plateByPlanId, PlateResList.class));
|
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;
|
||||||
|
}
|
||||||
+33
-5
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.order;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
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.mybatis.core.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
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.orderItem.OrderItemDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
|
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.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.plate.PlateDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.rawgoods.RawGoodsDO;
|
||||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
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.IBoardProdInfo;
|
||||||
import com.cf.imes.module.executor.util.deviseData.PartsModuleExtra;
|
import com.cf.imes.module.executor.util.deviseData.PartsModuleExtra;
|
||||||
import com.cf.imes.module.executor.util.deviseData.PlateModuleExtra;
|
import com.cf.imes.module.executor.util.deviseData.PlateModuleExtra;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -36,6 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author Beal
|
* @author Beal
|
||||||
* 生产单入库处理器
|
* 生产单入库处理器
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class OrderInputProcessor {
|
public class OrderInputProcessor {
|
||||||
|
|
||||||
@@ -64,6 +68,11 @@ public class OrderInputProcessor {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderModuleExtraMapper orderModuleExtraMapper;
|
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) {
|
public void input(List<Detail> sourceList, Long orderId) {
|
||||||
Long organId = OrganContextHolder.getOrganId();
|
Long organId = OrganContextHolder.getOrganId();
|
||||||
@@ -74,6 +83,7 @@ public class OrderInputProcessor {
|
|||||||
ArrayList<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
ArrayList<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
||||||
ArrayList<OrderItemDO> orderItemDOS = new ArrayList<>();
|
ArrayList<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||||
ArrayList<OrderModuleExtraDO> orderModuleExtraDOS = 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 ->
|
Map<RawGoodsDO, Map<OrderBodyDO, Map<OrderGroupDO, List<Detail>>>> map = sourceList.stream().collect(Collectors.groupingBy(e ->
|
||||||
RawGoodsDO.builder()
|
RawGoodsDO.builder()
|
||||||
.rawGoodsId(e.getIBoardProdInfo().getGoodsId())
|
.rawGoodsId(e.getIBoardProdInfo().getGoodsId())
|
||||||
@@ -224,6 +234,17 @@ public class OrderInputProcessor {
|
|||||||
orderItemDO.setPartsId(0L);
|
orderItemDO.setPartsId(0L);
|
||||||
orderItemDO.setType(1);
|
orderItemDO.setType(1);
|
||||||
plateDOS.add(plateDO);
|
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 {
|
} else {
|
||||||
OrderPartsDO orderPartsDO = OrderPartsDO.builder()
|
OrderPartsDO orderPartsDO = OrderPartsDO.builder()
|
||||||
.id(identifierGenerator.nextId(null).longValue())
|
.id(identifierGenerator.nextId(null).longValue())
|
||||||
@@ -252,13 +273,14 @@ public class OrderInputProcessor {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
batchSaveModel(orderModelDOS);
|
||||||
batchInsert(rawGoodsDOS, orderBodyDOS, orderGroupDOS, orderPartsDOS, plateDOS, orderModuleExtraDOS, orderItemDOS);
|
batchInsert(rawGoodsDOS, orderBodyDOS, orderGroupDOS, orderPartsDOS, plateDOS, orderModuleExtraDOS, orderItemDOS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量保存生产单小板五金数据
|
* 批量保存生产单小板五金数据
|
||||||
|
*
|
||||||
* @param rawGoodsDOS
|
* @param rawGoodsDOS
|
||||||
* @param orderBodyDOS
|
* @param orderBodyDOS
|
||||||
* @param orderGroupDOS
|
* @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 配置项,对应 KafkaProperties 配置类
|
||||||
kafka:
|
kafka:
|
||||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
elasticsearch:
|
||||||
|
uris: 192.168.1.205:9200
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
|
|||||||
+2
@@ -74,6 +74,8 @@ spring:
|
|||||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
kafka:
|
kafka:
|
||||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
elasticsearch:
|
||||||
|
uris: 192.168.1.205:9200
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
xxl:
|
xxl:
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ public class MachineController {
|
|||||||
@Operation(summary = "获得默认机台模板")
|
@Operation(summary = "获得默认机台模板")
|
||||||
@Parameter(name = "machineType", description = "机台类型", required = true, example = "1")
|
@Parameter(name = "machineType", description = "机台类型", required = true, example = "1")
|
||||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||||
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
public CommonResult<CuttingTemplateRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||||
return success(machineTemplateService.getDefaultCutting(machineType));
|
return success(machineTemplateService.getDefaultCutting(machineType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public interface MachineTemplateService {
|
|||||||
|
|
||||||
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
||||||
|
|
||||||
CuttingRespVO getDefaultCutting(Integer machineType);
|
CuttingTemplateRespVO getDefaultCutting(Integer machineType);
|
||||||
|
|
||||||
DrillTemplateRespVO getDefaultDrill();
|
DrillTemplateRespVO getDefaultDrill();
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -197,7 +197,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CuttingRespVO getDefaultCutting(Integer machineType) {
|
public CuttingTemplateRespVO getDefaultCutting(Integer machineType) {
|
||||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||||
.eq(MachineTemplateDO::getIsDefault, Boolean.TRUE)
|
.eq(MachineTemplateDO::getIsDefault, Boolean.TRUE)
|
||||||
.eq(MachineTemplateDO::getMachineType, machineType)
|
.eq(MachineTemplateDO::getMachineType, machineType)
|
||||||
@@ -207,7 +207,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||||
}
|
}
|
||||||
MachineTemplateDO templateDO = machineTemplateDOS.get(0);
|
MachineTemplateDO templateDO = machineTemplateDOS.get(0);
|
||||||
return MachineTemplateConvert.convert(templateDO);
|
return MachineTemplateConvert.convert1(templateDO);
|
||||||
}
|
}
|
||||||
throw exception(DEFAULT_TEMPLATE_NOT_EXISTS);
|
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