@ -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; | |||||
} |
@ -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<SalesOrderDetailEntity> { | |||||
/** | |||||
* 订单单号 | |||||
*/ | |||||
@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; | |||||
} |
@ -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<SalesOrderDetailEntity> { | |||||
} |
@ -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<SalesOrderDetailEntity> { | |||||
} |
@ -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<SalesOrderDetailRepository, SalesOrderDetailEntity> implements SalesOrderDetailService { | |||||
} |
@ -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<String, String> headers, String messageBody) throws Exception; | |||||
/** | |||||
* 检料订单创建 | |||||
* @param headers | |||||
* @param messageBody | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@EAIService(id = SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_CREATE) | |||||
DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception; | |||||
/** | |||||
* 检料订单创建 | |||||
* @param headers | |||||
* @param messageBody | |||||
* @return | |||||
* @throws Exception | |||||
*/ | |||||
@EAIService(id = SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_UPDATE) | |||||
DWEAIResult update(Map<String, String> headers, String messageBody) throws Exception; | |||||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||||
return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_GET,headers,messageBody); | |||||
} | |||||
@Override | |||||
public DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception { | |||||
return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_CREATE,headers,messageBody); | |||||
} | |||||
@Override | |||||
public DWEAIResult update(Map<String, String> headers, String messageBody) throws Exception { | |||||
return eaiServiceContext.execute(SalesOrderDetailUtil.DEMO_SO_ITEM_INFO_UPDATE,headers,messageBody); | |||||
} | |||||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||||
// 入参反序列化 | |||||
EAIRequest request = new EAIRequest(messageBody); | |||||
List<SalesOrderDetailDTO> salesOrderDetailDTOList = request.getObject("sales_order_detail", new TypeReference<List<SalesOrderDetailDTO>>(){}); | |||||
List<SalesOrderDetailEntity> 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<>()); | |||||
} | |||||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||||
LambdaQueryWrapper queryWrapper = Wrappers.<SalesOrderDetailEntity>lambdaQuery() | |||||
.eq(SalesOrderDetailEntity::getTenantSid,0); | |||||
List<SalesOrderDetailEntity> list = salesOrderDetailService.list(queryWrapper); | |||||
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("sales_order_detail",list)); | |||||
} | |||||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||||
// 入参反序列化 | |||||
EAIRequest request = new EAIRequest(messageBody); | |||||
List<SalesOrderDetailDTO> salesOrderDetailDTOList = request.getObject("sales_order_detail", new TypeReference<List<SalesOrderDetailDTO>>(){}); | |||||
List<SalesOrderDetailEntity> 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<>()); | |||||
} | |||||
} |
@ -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"; | |||||
} |
@ -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='订单明细'; |