From 10d68158b8b87f46432347fb457dc605410803a3 Mon Sep 17 00:00:00 2001 From: clong <1584238099@qq.com> Date: Fri, 28 Apr 2023 09:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E6=A3=80=E6=96=99=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/dto/order/SalesOrderDetailDTO.java | 86 +++++++++++++++++++ .../infra/entity/SalesOrderDetailEntity.java | 79 +++++++++++++++++ .../SalesOrderDetailRepository.java | 8 ++ .../service/SalesOrderDetailService.java | 7 ++ .../impl/SalesOrderDetailServiceImpl.java | 16 ++++ .../provider/SalesOrderDetailEAIService.java | 41 +++++++++ .../impl/SalesOrderDetailEAIServiceImpl.java | 35 ++++++++ .../SalesOrderDetailCreateEAIService.java | 58 +++++++++++++ .../order/SalesOrderDetailGetEAIService.java | 45 ++++++++++ .../SalesOrderDetailUpdateEAIService.java | 56 ++++++++++++ .../service/order/SalesOrderDetailUtil.java | 24 ++++++ doc/sql/app-20230427-ddl.sql | 16 ++++ 12 files changed, 471 insertions(+) create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/order/SalesOrderDetailDTO.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SalesOrderDetailEntity.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SalesOrderDetailRepository.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SalesOrderDetailService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/impl/SalesOrderDetailServiceImpl.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SalesOrderDetailEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailCreateEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailGetEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUpdateEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUtil.java create mode 100644 doc/sql/app-20230427-ddl.sql diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/order/SalesOrderDetailDTO.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/order/SalesOrderDetailDTO.java new file mode 100644 index 0000000..f8b2ca0 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/order/SalesOrderDetailDTO.java @@ -0,0 +1,86 @@ +package com.digiwin.athena.app.infra.dto.order; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CR-7 + * create: 2023-04-27 14:41 + * Description: + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SalesOrderDetailDTO { + + /** + * 主键id + */ + @SerializedName(value = "id") + private Long id; + + /** + * 订单单号 + */ + @SerializedName(value = "doc_no") + private String docNo; + + /** + * 序号 + */ + @SerializedName(value = "doc_seq") + private String docSeq; + + /** + * 品号 + */ + @SerializedName(value = "item_no") + private String itemNo; + + /** + * 品名 + */ + @SerializedName(value = "item_name") + private String itemName; + + /** + * 规格 + */ + @SerializedName(value = "item_spec") + private String itemSpec; + + /** + * 数量 + */ + @SerializedName(value = "qty") + private Integer qty; + + /** + * 仓库 + */ + @SerializedName(value = "warehouse_name") + private String warehouseName; + + /** + * 储位 + */ + @SerializedName(value = "storage_spaces_name") + private String storageSpacesName; + + + /** + * 1.未检料;2.已检料 + */ + @SerializedName(value = "status") + private Integer status; + + /** + * 租户sid + */ + @SerializedName(value = "tenantSid") + private Integer tenantSid; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SalesOrderDetailEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SalesOrderDetailEntity.java new file mode 100644 index 0000000..454294d --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/SalesOrderDetailEntity.java @@ -0,0 +1,79 @@ +package com.digiwin.athena.app.infra.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CR-7 + * create: 2023-04-27 14:36 + * Description: + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "sales_order_detail", autoResultMap = true) +public class SalesOrderDetailEntity extends BaseMgrEntity { + + /** + * 订单单号 + */ + @SerializedName(value = "doc_no") + private String docNo; + + /** + * 序号 + */ + @SerializedName(value = "doc_seq") + private String docSeq; + + /** + * 品号 + */ + @SerializedName(value = "item_no") + private String itemNo; + + /** + * 品名 + */ + @SerializedName(value = "item_name") + private String itemName; + + /** + * 规格 + */ + @SerializedName(value = "item_spec") + private String itemSpec; + + /** + * 数量 + */ + @SerializedName(value = "qty") + private Integer qty; + + /** + * 仓库 + */ + @SerializedName(value = "warehouse_name") + private String warehouseName; + + /** + * 储位 + */ + @SerializedName(value = "storage_spaces_name") + private String storageSpacesName; + + + /** + * 1.未检料;2.已检料 + */ + @SerializedName(value = "status") + private Integer status; + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SalesOrderDetailRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SalesOrderDetailRepository.java new file mode 100644 index 0000000..da2fb86 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/SalesOrderDetailRepository.java @@ -0,0 +1,8 @@ +package com.digiwin.athena.app.infra.repository; + + +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; + +public interface SalesOrderDetailRepository extends BaseRepository { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SalesOrderDetailService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SalesOrderDetailService.java new file mode 100644 index 0000000..7b07ae1 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/SalesOrderDetailService.java @@ -0,0 +1,7 @@ +package com.digiwin.athena.app.infra.service; + +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +public interface SalesOrderDetailService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/impl/SalesOrderDetailServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/impl/SalesOrderDetailServiceImpl.java new file mode 100644 index 0000000..cb3a70d --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/impl/SalesOrderDetailServiceImpl.java @@ -0,0 +1,16 @@ +package com.digiwin.athena.app.infra.service.impl; + +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.app.infra.repository.SalesOrderDetailRepository; +import com.digiwin.athena.app.infra.service.SalesOrderDetailService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @author CR-7 + * create: 2023-04-27 14:54 + * Description: + */ +@Service +public class SalesOrderDetailServiceImpl extends AbsBaseService implements SalesOrderDetailService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SalesOrderDetailEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SalesOrderDetailEAIService.java new file mode 100644 index 0000000..e784927 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/SalesOrderDetailEAIService.java @@ -0,0 +1,41 @@ +package com.digiwin.athena.app.provider; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.app.service.DWService; +import com.digiwin.app.service.eai.EAIService; +import com.digiwin.athena.app.service.order.SalesOrderDetailUtil; + +import java.util.Map; + +public interface SalesOrderDetailEAIService extends DWService { + + /** + * 检料订单查询 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_GET) + DWEAIResult get(Map headers, String messageBody) throws Exception; + + /** + * 检料订单创建 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_CREATE) + DWEAIResult create(Map headers, String messageBody) throws Exception; + + /** + * 检料订单创建 + * @param headers + * @param messageBody + * @return + * @throws Exception + */ + @EAIService(id = SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_UPDATE) + DWEAIResult update(Map headers, String messageBody) throws Exception; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java new file mode 100644 index 0000000..25905c6 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java @@ -0,0 +1,35 @@ +package com.digiwin.athena.app.provider.impl; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.provider.SalesOrderDetailEAIService; +import com.digiwin.athena.app.service.order.SalesOrderDetailUtil; +import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @author CR-7 + * create: 2023-04-27 14:48 + * Description: + */ +public class SalesOrderDetailEAIServiceImpl implements SalesOrderDetailEAIService { + + @Resource + private EAIServiceContext eaiServiceContext; + + @Override + public DWEAIResult get(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_GET,headers,messageBody); + } + + @Override + public DWEAIResult create(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_CREATE,headers,messageBody); + } + + @Override + public DWEAIResult update(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_UPDATE,headers,messageBody); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailCreateEAIService.java new file mode 100644 index 0000000..0fe645f --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailCreateEAIService.java @@ -0,0 +1,58 @@ +package com.digiwin.athena.app.service.order; + +import com.alibaba.fastjson.TypeReference; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.dto.order.SalesOrderDetailDTO; +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.app.infra.service.SalesOrderDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.EAIUtil; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.generator.SnowflakeWorker; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author CR-7 + * create: 2023-04-27 15:35 + * Description: + */ +@Log4j2 +@Service +public class SalesOrderDetailCreateEAIService extends AbsEAIService { + + @Resource + SalesOrderDetailService salesOrderDetailService; + + + @Override + public String getServiceName() { + return SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_CREATE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + // 入参反序列化 + EAIRequest request = new EAIRequest(messageBody); + List salesOrderDetailDTOList = request.getObject("sales_order_detail", new TypeReference>(){}); + + List salesOrderDetailEntityList = salesOrderDetailDTOList.stream().map(assemble->{ + SalesOrderDetailEntity salesOrderDetailEntity = new SalesOrderDetailEntity(); + BeanUtils.copyProperties(assemble,salesOrderDetailEntity); + salesOrderDetailEntity.setId(SnowflakeWorker.nextId()); + salesOrderDetailEntity.setTenantSid(null); + return salesOrderDetailEntity; + }).collect(Collectors.toList()); + + salesOrderDetailService.saveBatch(salesOrderDetailEntityList); + + return EAIUtil.buildEAIResult(new HashMap<>()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailGetEAIService.java new file mode 100644 index 0000000..87ba15e --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailGetEAIService.java @@ -0,0 +1,45 @@ +package com.digiwin.athena.app.service.order; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.app.infra.service.SalesOrderDetailService; +import com.digiwin.athena.opt.common.eai.EAIUtil; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @author CR-7 + * create: 2023-04-27 15:35 + * Description: + */ +@Log4j2 +@Service +public class SalesOrderDetailGetEAIService extends AbsEAIService { + + @Resource + SalesOrderDetailService salesOrderDetailService; + + + @Override + public String getServiceName() { + return SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_GET; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() + .eq(SalesOrderDetailEntity::getTenantSid,0); + + List list = salesOrderDetailService.list(queryWrapper); + + return EAIUtil.buildEAIResult(new JSONObject().fluentPut("sales_order_detail",list)); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUpdateEAIService.java new file mode 100644 index 0000000..c8e92f3 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUpdateEAIService.java @@ -0,0 +1,56 @@ +package com.digiwin.athena.app.service.order; + + +import com.alibaba.fastjson.TypeReference; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.dto.order.SalesOrderDetailDTO; +import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; +import com.digiwin.athena.app.infra.service.SalesOrderDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.EAIUtil; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author CR-7 + * create: 2023-04-27 15:35 + * Description: + */ +@Log4j2 +@Service +public class SalesOrderDetailUpdateEAIService extends AbsEAIService { + + @Resource + SalesOrderDetailService salesOrderDetailService; + + @Override + public String getServiceName() { + return SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_UPDATE; + } + + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + // 入参反序列化 + EAIRequest request = new EAIRequest(messageBody); + List salesOrderDetailDTOList = request.getObject("sales_order_detail", new TypeReference>(){}); + + List salesOrderDetailEntityList = salesOrderDetailDTOList.stream().map(assemble->{ + SalesOrderDetailEntity salesOrderDetailEntity = new SalesOrderDetailEntity(); + salesOrderDetailEntity.setId(assemble.getId()); + salesOrderDetailEntity.setStatus(2); + return salesOrderDetailEntity; + }).collect(Collectors.toList()); + + salesOrderDetailService.updateBatchById(salesOrderDetailEntityList); + + return EAIUtil.buildEAIResult(new HashMap<>()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUtil.java new file mode 100644 index 0000000..d005c43 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/order/SalesOrderDetailUtil.java @@ -0,0 +1,24 @@ +package com.digiwin.athena.app.service.order; + +/** + * @author CR-7 + * create: 2023-04-27 14:45 + * Description: + */ +public class SalesOrderDetailUtil { + + /** + * 捡料订单查询 + */ + public static final String DEMO_SO_ITEM_INFO_GET = "demo.so.item.card.info.get"; + + /** + * 捡料订单创建 + */ + public static final String DEMO_SO_ITEM_INFO_CREATE = "demo.so.item.card.info.create"; + + /** + * 捡料订单修改 + */ + public static final String DEMO_SO_ITEM_INFO_UPDATE = "demo.so.item.card.info.update"; +} diff --git a/doc/sql/app-20230427-ddl.sql b/doc/sql/app-20230427-ddl.sql new file mode 100644 index 0000000..647d39b --- /dev/null +++ b/doc/sql/app-20230427-ddl.sql @@ -0,0 +1,16 @@ + + -- 订单明细表 +create table `sales_order_detail` ( + `id` bigint(20) not null comment '主键', + `doc_no` varchar(12) default null comment '订单单号', + `doc_seq` varchar(255) default null comment '序号', + `item_no` varchar(12) default null comment '品号', + `item_name` varchar(255) default null comment '品名', + `item_spec` varchar(255) default null comment '规格', + `qty` int(4) default null comment '数量', + `warehouse_name` varchar(255) default null comment '仓库', + `storage_spaces_name` varchar(255) default null comment '储位', + `status` int(1) default null comment '1.未检料;2.已检料', + `tenantSid` int(1) default null comment '租户sid', + primary key (`id`) +) engine=innodb default charset=utf8mb4 comment='订单明细';