diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/CollectionDetailEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/CollectionDetailEntity.java new file mode 100644 index 0000000..8b479a7 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/CollectionDetailEntity.java @@ -0,0 +1,128 @@ +package com.digiwin.athena.app.ptc.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; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * cim_collection_detail + * + * @author zhenggl + * @date 2023-09-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "cim_collection_detail", autoResultMap = true) +public class CollectionDetailEntity extends BaseMgrEntity +{ + + + + /** 应收单号 */ + @SerializedName(value = "receivable_no") + private String receivableNo; + + /** 应收序号 */ + @SerializedName(value = "receivable_non") + private String receivableNon; + + /** 客户编号 */ + @SerializedName(value = "customer_no") + private String customerNo; + + /** 客户名称 */ + @SerializedName(value = "customer_name") + private String customerName; + + /** 状态 */ + @SerializedName(value = "status") + private String status; + + /** 销售单号 */ + @SerializedName(value = "sales_order") + private String salesOrder; + + /** 销售单序号 */ + @SerializedName(value = "sales_order_number") + private String salesOrderNumber; + + /** 合同编号 */ + @SerializedName(value = "contract_no") + private String contractNo; + + /** 含税金额 */ + @SerializedName(value = "amount_tax") + private BigDecimal amountTax; + + /** 品号 */ + @SerializedName(value = "sku_code") + private String skuCode; + + /** 品名 */ + @SerializedName(value = "sku_name") + private String skuName; + + /** 规格 */ + @SerializedName(value = "sku_spec") + private String skuSpec; + + /** 含税单价 */ + @SerializedName(value = "price_tax") + private BigDecimal priceTax; + + /** 数量 */ + @SerializedName(value = "quantity") + private BigDecimal quantity; + + /** 应收日期 */ + @SerializedName(value = "receivable_date") + private Date receivableDate; + + /** 联系人 */ + @SerializedName(value = "contacts") + private String contacts; + + /** 联系方式 */ + @SerializedName(value = "contact_information") + private String contactInformation; + + /** 业务助理 */ + @SerializedName(value = "salesman_assistant") + private String salesmanAssistant; + + /** 业务员 */ + @SerializedName(value = "salesman") + private String salesman; + + /** 业务主管 */ + @SerializedName(value = "salesman_boss") + private String salesmanBoss; + + /** 工单单号 */ + @SerializedName(value = "work_no") + private String workNo; + + /** 生产主管 */ + @SerializedName(value = "produce_boss") + private String produceBoss; + + /** 逾期天数 */ + @SerializedName(value = "overdue_days") + private String overdueDays; + + public CollectionDetailEntity(String customerName, String customerNo, String contacts, String contactInformation) { + this.customerNo = customerNo; + this.customerName = customerName; + this.contacts = contacts; + this.contactInformation = contactInformation; + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/LimitCreditEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/LimitCreditEntity.java new file mode 100644 index 0000000..db10bd9 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/LimitCreditEntity.java @@ -0,0 +1,34 @@ +package com.digiwin.athena.app.ptc.infra.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "cim_limit_credit", autoResultMap = true) +public class LimitCreditEntity { + + /** 客户编号 */ + @SerializedName(value = "customer_no") + private String customerNo; + + /** 客户名称 */ + @SerializedName(value = "customer_name") + private String customerName; + + /** 信用额度 */ + @SerializedName(value = "limit_amount") + private BigDecimal limitAmount; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/PaymentDetailsEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/PaymentDetailsEntity.java index 5cd5e41..e5a1fcc 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/PaymentDetailsEntity.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/PaymentDetailsEntity.java @@ -1,5 +1,6 @@ package com.digiwin.athena.app.ptc.infra.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; import com.google.gson.annotations.SerializedName; @@ -109,4 +110,9 @@ public class PaymentDetailsEntity extends BaseMgrEntity { /** 逾期天数 */ @SerializedName(value = "overdue_days") private Long overdueDays; + + /** 限制金额 */ + @TableField(exist = false) + @SerializedName(value = "limit_amount") + private BigDecimal limitAmount; } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ProductionDetailsEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ProductionDetailsEntity.java new file mode 100644 index 0000000..f180177 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ProductionDetailsEntity.java @@ -0,0 +1,102 @@ +package com.digiwin.athena.app.ptc.infra.entity; + +import java.math.BigDecimal; +import java.util.Date; + +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; + +/** + * cim_production_details + * + * @author zhenggl + * @date 2023-09-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "cim_production_details", autoResultMap = true) +public class ProductionDetailsEntity extends BaseMgrEntity +{ + + + /** 工厂编号 */ + @SerializedName(value = "factory_no") + private String factoryNo; + + /** 工厂名称 */ + @SerializedName(value = "factory_name") + private String factoryName; + + /** 性质 */ + @SerializedName(value = "nature") + private String nature; + + /** 预计产量 */ + @SerializedName(value = "expected_quantity") + private BigDecimal expectedQuantity; + + /** 预计开工日期 */ + @SerializedName(value = "expected_commencement_date") + private Date expectedCommencementDate; + + /** 预计完工日期 */ + @SerializedName(value = "estimated_completion_date") + private Date estimatedCompletionDate; + + /** 生管人员 */ + @SerializedName(value = "production_management_person") + private String productionManagementPerson; + + /** 生管部门 */ + @SerializedName(value = "production_management_department") + private String productionManagementDepartment; + + /** 工单单号 */ + @SerializedName(value = "work_no") + private String workNo; + + /** 状态 */ + @SerializedName(value = "production_status") + private String productionStatus; + + /** 生产批号 */ + @SerializedName(value = "batch_no") + private String batchNo; + + /** 品号 */ + @SerializedName(value = "sku_code") + private String skuCode; + + /** 品名 */ + @SerializedName(value = "sku_name") + private String skuName; + + /** 规格 */ + @SerializedName(value = "sku_spec") + private String skuSpec; + + /** 单位 */ + @SerializedName(value = "unit") + private String unit; + + /** 生产主管 */ + @SerializedName(value = "produce_boss") + private String produceBoss; + + /** 逾期天数 */ + @SerializedName(value = "overdue_days") + private String overdueDays; + + public ProductionDetailsEntity(String factoryNo, String factoryName, String productionManagementPerson) { + this.factoryNo = factoryNo; + this.factoryName = factoryName; + this.productionManagementPerson = productionManagementPerson; + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java new file mode 100644 index 0000000..b394bef --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/entity/ReceivablesDetailEntity.java @@ -0,0 +1,120 @@ +package com.digiwin.athena.app.ptc.infra.entity; + +import java.math.BigDecimal; +import java.util.Date; + +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; + +/** + * cim_receivables_detail + * + * @author zhenggl + * @date 2023-09-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "cim_receivables_detail", autoResultMap = true) +public class ReceivablesDetailEntity extends BaseMgrEntity +{ + + + + /** 应收单号 */ + @SerializedName(value = "receivable_no") + private String receivableNo; + + /** 应收序号 */ + @SerializedName(value = "receivable_non") + private String receivableNon; + + /** 客户编号 */ + @SerializedName(value = "customer_no") + private String customerNo; + + /** 客户名称 */ + @SerializedName(value = "customer_name") + private String customerName; + + /** 状态 */ + @SerializedName(value = "status") + private String status; + + /** 销售单号 */ + @SerializedName(value = "sales_order") + private String salesOrder; + + /** 销售单序号 */ + @SerializedName(value = "sales_order_number") + private String salesOrderNumber; + + /** 合同编号 */ + @SerializedName(value = "contract_no") + private String contractNo; + + /** 含税金额 */ + @SerializedName(value = "amount_tax") + private BigDecimal amountTax; + + /** 品号 */ + @SerializedName(value = "sku_code") + private String skuCode; + + /** 品名 */ + @SerializedName(value = "sku_name") + private String skuName; + + /** 规格 */ + @SerializedName(value = "sku_spec") + private String skuSpec; + + /** 含税单价 */ + @SerializedName(value = "price_tax") + private BigDecimal priceTax; + + /** 数量 */ + @SerializedName(value = "quantity") + private BigDecimal quantity; + + /** 应收日期 */ + @SerializedName(value = "receivable_date") + private Date receivableDate; + + /** 联系人 */ + @SerializedName(value = "contacts") + private String contacts; + + /** 联系方式 */ + @SerializedName(value = "contact_information") + private String contactInformation; + + /** 业务助理 */ + @SerializedName(value = "salesman_assistant") + private String salesmanAssistant; + + /** 业务员 */ + @SerializedName(value = "salesman") + private String salesman; + + /** 业务主管 */ + @SerializedName(value = "salesman_boss") + private String salesmanBoss; + + /** 工单单号 */ + @SerializedName(value = "work_no") + private String workNo; + + /** 逾期天数 */ + @SerializedName(value = "overdue_days") + private String overdueDays; + + + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/CollectionDetailMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/CollectionDetailMapper.xml new file mode 100644 index 0000000..7f70104 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/mapper/CollectionDetailMapper.xml @@ -0,0 +1,18 @@ + + + + + + delete from cim_collection_detail where tenantsid=#{tenantSid} + + ( + sales_order = #{item.salesOrder} + and sales_order_number = #{item.salesOrderNumber} + ) + + + + + diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/CollectionDetailRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/CollectionDetailRepository.java new file mode 100644 index 0000000..faaa1a1 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/CollectionDetailRepository.java @@ -0,0 +1,16 @@ +package com.digiwin.athena.app.ptc.infra.repository; + + +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface CollectionDetailRepository extends BaseRepository { + void deleteBatch(@Param("list") List list,@Param("tenantSid")Long tenantSid); +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/LimitCreditRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/LimitCreditRepository.java new file mode 100644 index 0000000..a152bc5 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/LimitCreditRepository.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.repository; + +import com.digiwin.athena.app.ptc.infra.entity.LimitCreditEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface LimitCreditRepository extends BaseRepository { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ProductionDetailsRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ProductionDetailsRepository.java new file mode 100644 index 0000000..86585bf --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ProductionDetailsRepository.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.repository; + +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ProductionDetailsRepository extends BaseRepository { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java new file mode 100644 index 0000000..a63d366 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/repository/ReceivablesDetailRepository.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.repository; + +import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ReceivablesDetailRepository extends BaseRepository { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/CollectionDetailService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/CollectionDetailService.java new file mode 100644 index 0000000..a351398 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/CollectionDetailService.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.service; + +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface CollectionDetailService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/LimitCreditService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/LimitCreditService.java new file mode 100644 index 0000000..f2ae130 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/LimitCreditService.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.service; + +import com.digiwin.athena.app.ptc.infra.entity.LimitCreditEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface LimitCreditService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ProductionDetailsService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ProductionDetailsService.java new file mode 100644 index 0000000..7c3504d --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ProductionDetailsService.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.service; + +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ProductionDetailsService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ReceivablesDetailService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ReceivablesDetailService.java new file mode 100644 index 0000000..a458041 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/ReceivablesDetailService.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.ptc.infra.service; + +import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ReceivablesDetailService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/CollectionDetailServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/CollectionDetailServiceImpl.java new file mode 100644 index 0000000..a8d253f --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/CollectionDetailServiceImpl.java @@ -0,0 +1,15 @@ +package com.digiwin.athena.app.ptc.infra.service.impl; + +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; +import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +public class CollectionDetailServiceImpl extends AbsBaseService implements CollectionDetailService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/LimitCreditServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/LimitCreditServiceImpl.java new file mode 100644 index 0000000..86a2ad9 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/LimitCreditServiceImpl.java @@ -0,0 +1,15 @@ +package com.digiwin.athena.app.ptc.infra.service.impl; + +import com.digiwin.athena.app.ptc.infra.entity.LimitCreditEntity; +import com.digiwin.athena.app.ptc.infra.repository.LimitCreditRepository; +import com.digiwin.athena.app.ptc.infra.service.LimitCreditService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +public class LimitCreditServiceImpl extends AbsBaseService implements LimitCreditService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ProductionDetailsServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ProductionDetailsServiceImpl.java new file mode 100644 index 0000000..d11b3f0 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ProductionDetailsServiceImpl.java @@ -0,0 +1,15 @@ +package com.digiwin.athena.app.ptc.infra.service.impl; + +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.app.ptc.infra.repository.ProductionDetailsRepository; +import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +public class ProductionDetailsServiceImpl extends AbsBaseService implements ProductionDetailsService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ReceivablesDetailServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ReceivablesDetailServiceImpl.java new file mode 100644 index 0000000..d179cb4 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/infra/service/impl/ReceivablesDetailServiceImpl.java @@ -0,0 +1,15 @@ +package com.digiwin.athena.app.ptc.infra.service.impl; + +import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; +import com.digiwin.athena.app.ptc.infra.repository.ReceivablesDetailRepository; +import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +public class ReceivablesDetailServiceImpl extends AbsBaseService implements ReceivablesDetailService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/LimitCreditEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/LimitCreditEAIService.java new file mode 100644 index 0000000..2f4088e --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/LimitCreditEAIService.java @@ -0,0 +1,10 @@ +package com.digiwin.athena.app.ptc.provider; + +import com.digiwin.app.service.DWService; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface LimitCreditEAIService extends DWService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ProductionDetailsEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ProductionDetailsEAIService.java new file mode 100644 index 0000000..770a003 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ProductionDetailsEAIService.java @@ -0,0 +1,25 @@ +package com.digiwin.athena.app.ptc.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.ptc.service.production.ProductionUtil; + +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ProductionDetailsEAIService extends DWService { + + @EAIService(id = ProductionUtil.PRODUCTION_TASK_GET) + DWEAIResult taskGet(Map headers, String messageBody) throws Exception; + + @EAIService(id = ProductionUtil.PRODUCTION_TASK_UPDATE) + DWEAIResult taskUpdate(Map headers, String messageBody) throws Exception; + + @EAIService(id = ProductionUtil.PRODUCTION_TASK_CREATE) + DWEAIResult taskCreate(Map headers, String messageBody) throws Exception; + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ReceivablesDetailEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ReceivablesDetailEAIService.java new file mode 100644 index 0000000..d38f4df --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/ReceivablesDetailEAIService.java @@ -0,0 +1,27 @@ +package com.digiwin.athena.app.ptc.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.ptc.service.receivables.ReceivablesUtil; + +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public interface ReceivablesDetailEAIService extends DWService { + + @EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_GET) + DWEAIResult taskGet(Map headers, String messageBody) throws Exception; + + @EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_CREATE) + DWEAIResult taskCreate(Map headers, String messageBody) throws Exception; + + @EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_UPDATE) + DWEAIResult taskUpdate(Map headers, String messageBody) throws Exception; + + @EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_GET) + DWEAIResult initialCreate(Map headers, String messageBody) throws Exception; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/LimitCreditEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/LimitCreditEAIServiceImpl.java new file mode 100644 index 0000000..7984633 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/LimitCreditEAIServiceImpl.java @@ -0,0 +1,16 @@ +package com.digiwin.athena.app.ptc.provider.impl; + +import com.digiwin.athena.app.ptc.provider.LimitCreditEAIService; +import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; + +import javax.annotation.Resource; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class LimitCreditEAIServiceImpl implements LimitCreditEAIService { + + @Resource + private EAIServiceContext eaiServiceContext; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ProductionDetailsEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ProductionDetailsEAIServiceImpl.java new file mode 100644 index 0000000..042dac7 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ProductionDetailsEAIServiceImpl.java @@ -0,0 +1,34 @@ +package com.digiwin.athena.app.ptc.provider.impl; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.provider.ProductionDetailsEAIService; +import com.digiwin.athena.app.ptc.service.production.ProductionUtil; +import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class ProductionDetailsEAIServiceImpl implements ProductionDetailsEAIService { + + @Resource + private EAIServiceContext eaiServiceContext; + + @Override + public DWEAIResult taskGet(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_GET,headers,messageBody); + } + + @Override + public DWEAIResult taskUpdate(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_UPDATE,headers,messageBody); + } + + @Override + public DWEAIResult taskCreate(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_CREATE,headers,messageBody); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ReceivablesDetailEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ReceivablesDetailEAIServiceImpl.java new file mode 100644 index 0000000..5a71f22 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/provider/impl/ReceivablesDetailEAIServiceImpl.java @@ -0,0 +1,39 @@ +package com.digiwin.athena.app.ptc.provider.impl; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.provider.ReceivablesDetailEAIService; +import com.digiwin.athena.app.ptc.service.receivables.ReceivablesUtil; +import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class ReceivablesDetailEAIServiceImpl implements ReceivablesDetailEAIService { + + @Resource + private EAIServiceContext eaiServiceContext; + + @Override + public DWEAIResult taskGet(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_GET,headers,messageBody); + } + + @Override + public DWEAIResult taskCreate(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_CREATE,headers,messageBody); + } + + @Override + public DWEAIResult taskUpdate(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_UPDATE,headers,messageBody); + } + + @Override + public DWEAIResult initialCreate(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_INITIAL_CREATE,headers,messageBody); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java index 531cabe..9ce5557 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/paymentdetails/ReceivablesGetEAIService.java @@ -1,8 +1,11 @@ package com.digiwin.athena.app.ptc.service.paymentdetails; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.infra.entity.LimitCreditEntity; import com.digiwin.athena.app.ptc.infra.entity.PaymentDetailsEntity; +import com.digiwin.athena.app.ptc.infra.service.LimitCreditService; import com.digiwin.athena.app.ptc.infra.service.PaymentDetailsService; import com.digiwin.athena.opt.common.eai.service.AbsEAIService; import com.digiwin.athena.opt.common.security.SecurityUtil; @@ -12,6 +15,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; /** * @auther: zhenggl @@ -24,6 +29,9 @@ public class ReceivablesGetEAIService extends AbsEAIService { @Resource private PaymentDetailsService paymentDetailsService; + @Resource + private LimitCreditService limitCreditService; + @Override public String getServiceName() { return PaymentDetailsUtil.RECEIVABLES_GET; @@ -35,6 +43,28 @@ public class ReceivablesGetEAIService extends AbsEAIService { LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); lmq.eq(PaymentDetailsEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); List list = paymentDetailsService.list(lmq); + + if (CollectionUtils.isEmpty(list)){ + return buildOK("query_result",list); + } + + //查询限制额度 + List customerNoList = list.stream().map(PaymentDetailsEntity::getCustomerNo).collect(Collectors.toList()); + LambdaQueryWrapper creditLmq = new LambdaQueryWrapper<>(); + creditLmq.in(LimitCreditEntity::getCustomerNo,customerNoList); + List limitCreditEntityList = limitCreditService.list(creditLmq); + + if (CollectionUtils.isNotEmpty(limitCreditEntityList)){ + for (PaymentDetailsEntity paymentDetailsEntity : list) { + for (LimitCreditEntity limitCreditEntity : limitCreditEntityList) { + if (Objects.nonNull(limitCreditEntity.getLimitAmount())&&paymentDetailsEntity.getCustomerNo().equals(limitCreditEntity.getCustomerNo())){ + paymentDetailsEntity.setLimitAmount(limitCreditEntity.getLimitAmount()); + } + } + } + } + + return buildOK("query_result",list); } } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java new file mode 100644 index 0000000..a1097de --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java @@ -0,0 +1,117 @@ +package com.digiwin.athena.app.ptc.service.production; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.CollectionUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.app.ptc.infra.entity.ReceivablesDetailEntity; +import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService; +import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.util.RedisUtil; +import org.apache.commons.lang.time.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +public class ProductionCreateEAIService extends AbsEAIService { + + @Resource + private ProductionDetailsService productionDetailsService; + + @Resource + private ReceivablesDetailService receivablesDetailService; + + @Autowired + private RedisUtil redisUtil; + + + @Override + public String getServiceName() { + return ProductionUtil.PRODUCTION_TASK_CREATE; + } + + //随机赋值list + List list = Arrays.asList( + new ProductionDetailsEntity("001", "一号工厂", "一号工厂刘晓鹏"), + new ProductionDetailsEntity("002", "二号工厂", "二号工厂饶文豪"), + new ProductionDetailsEntity("003", "三号工厂", "三号工厂卢人辅")); + + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference>() { + }); + + + //根据工单单号查询应收表 + List woNoList = productionDetailsEntities.stream().map(ProductionDetailsEntity::getWorkNo).collect(Collectors.toList()); + LambdaQueryWrapper receivablesLmq = new LambdaQueryWrapper(); + receivablesLmq.in(ReceivablesDetailEntity::getWorkNo, woNoList); + List receivablesDetailEntities = receivablesDetailService.list(receivablesLmq); + + + + + //默认赋值 + for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { + Random random = new Random(); + int randomNumber = random.nextInt(3); + productionDetailsEntity.setFactoryNo(this.list.get(randomNumber).getFactoryNo()); + productionDetailsEntity.setFactoryName(this.list.get(randomNumber).getFactoryName()); + productionDetailsEntity.setProductionManagementPerson(this.list.get(randomNumber).getProductionManagementPerson()); + productionDetailsEntity.setProductionManagementDepartment("生管一部"); + productionDetailsEntity.setProduceBoss("23467345221"); + productionDetailsEntity.setProductionStatus(TabStatusEnums.PENDING.getValue().toString()); + productionDetailsEntity.setNature(String.valueOf(randomNumber)); + String batchNo = cteateBatchNo(); + productionDetailsEntity.setBatchNo("MMDD-"+batchNo); + //预计产量赋值 + if (CollectionUtils.isNotEmpty(list)) { + for (ReceivablesDetailEntity receivablesDetailEntity : receivablesDetailEntities) { + productionDetailsEntity.setExpectedQuantity(receivablesDetailEntity.getQuantity()); + //取应收日期前后5天 + productionDetailsEntity.setExpectedCommencementDate(DateUtils.addDays(receivablesDetailEntity.getReceivableDate(), random.nextInt(11) - 5)); + //取预计开工日期后5-10天 + productionDetailsEntity.setEstimatedCompletionDate(DateUtils.addDays(productionDetailsEntity.getExpectedCommencementDate(), random.nextInt(6) + 5)); + productionDetailsEntity.setSkuCode(receivablesDetailEntity.getSkuCode()); + productionDetailsEntity.setSkuName(receivablesDetailEntity.getSkuName()); + productionDetailsEntity.setSkuSpec(receivablesDetailEntity.getSkuSpec()); + productionDetailsEntity.setUnit("待定"); + } + } + } + + return buildOK(); + } + + private String cteateBatchNo(){ + StringBuilder sb = new StringBuilder(); + Long batchNo; + if (redisUtil.getRedisTemplate().hasKey(ProductionUtil.KEY)) { + batchNo = redisUtil.incrBy(ProductionUtil.KEY, 1); + } else { + redisUtil.setObject(ProductionUtil.KEY, 1); + batchNo = 1L; + } + + int prefix = 5-batchNo.toString().length(); + for (int i = 0; i < prefix; i++) { + sb.append("0"); + } + return sb.append(batchNo).toString(); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTasUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTasUpdateEAIService.java new file mode 100644 index 0000000..6e467e8 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTasUpdateEAIService.java @@ -0,0 +1,59 @@ +package com.digiwin.athena.app.ptc.service.production; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +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; +import java.util.stream.Collectors; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +@Log4j2 +public class ProductionTasUpdateEAIService extends AbsEAIService { + + @Resource + private ProductionDetailsService productionDetailsService; + + @Override + public String getServiceName() { + return ProductionUtil.PRODUCTION_TASK_UPDATE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + //根据bk更新状态为已完成 + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); + + for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { + if (StringUtils.isEmpty(productionDetailsEntity.getWorkNo())){ + throw new DWBusinessException("缺少必填参数"); + } + } + + LambdaUpdateWrapper ump = new LambdaUpdateWrapper<>(); + ump.set(ProductionDetailsEntity::getProductionStatus, TabStatusEnums.COMPLETED.getValue()); + List woNoList = productionDetailsEntities.stream().map(ProductionDetailsEntity::getWorkNo).collect(Collectors.toList()); + ump.in(ProductionDetailsEntity::getWorkNo,woNoList); + + + productionDetailsService.update(ump); + + return buildOK(); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTaskGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTaskGetEAIService.java new file mode 100644 index 0000000..8ebd441 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionTaskGetEAIService.java @@ -0,0 +1,60 @@ +package com.digiwin.athena.app.ptc.service.production; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; +import com.digiwin.athena.app.ptc.infra.entity.ProductionDetailsEntity; +import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +@Log4j2 +public class ProductionTaskGetEAIService extends AbsEAIService { + + @Resource + private ProductionDetailsService productionDetailsService; + + @Override + public String getServiceName() { + return ProductionUtil.PRODUCTION_TASK_GET; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + //根据bk获取数据 + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); + + for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { + if (StringUtils.isEmpty(productionDetailsEntity.getWorkNo())){ + throw new DWBusinessException("缺少必填参数"); + } + } + + LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); + List woNoList = productionDetailsEntities.stream().map(ProductionDetailsEntity::getWorkNo).collect(Collectors.toList()); + lmq.eq(ProductionDetailsEntity::getTenantSid,SecurityUtil.getUserProfile().getTenantSid()); + lmq.eq(ProductionDetailsEntity::getProductionStatus, TabStatusEnums.PENDING.getValue()); + lmq.in(ProductionDetailsEntity::getWorkNo,woNoList); + List list = productionDetailsService.list(lmq); + + + return buildOK("query_result",list); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionUtil.java new file mode 100644 index 0000000..f64cd4a --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionUtil.java @@ -0,0 +1,19 @@ +package com.digiwin.athena.app.ptc.service.production; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class ProductionUtil { + + public static final String PRODUCTION_TASK_GET =" demo.ptc.athenapot.production.task.update"; + + + public static final String PRODUCTION_TASK_UPDATE =" demo.ptc.athenapot.production.task.update"; + + public static final String PRODUCTION_TASK_CREATE ="demo.ptc.athenapot.production.task.create"; + + + public static final String KEY = "demo-ptc-athenaopt"; + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java new file mode 100644 index 0000000..217823e --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesCreateEAIService.java @@ -0,0 +1,49 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +import com.alibaba.fastjson.TypeReference; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; +import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Log4j2 +@Service +public class ReceivablesCreateEAIService extends AbsEAIService { + + @Resource + private CollectionDetailService collectionDetailService; + + @Resource + private CollectionDetailRepository collectionDetailRepository; + + @Override + public String getServiceName() { + return ReceivablesUtil.RECEIVABLES_TASK_CREATE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List receivablesDetailEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); + //根据bk删除数据 + //先删除 + collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); + + collectionDetailService.saveBatch(receivablesDetailEntities); + return buildOK("query_result",receivablesDetailEntities); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java new file mode 100644 index 0000000..ab88599 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java @@ -0,0 +1,90 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +import com.alibaba.fastjson.TypeReference; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository; +import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; +import com.digiwin.athena.opt.common.util.DateUtils; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Log4j2 +@Service +public class ReceivablesInitialCreateEAIService extends AbsEAIService { + + @Resource + private CollectionDetailRepository collectionDetailRepository; + + @Resource + private CollectionDetailService collectionDetailService; + + + @Override + public String getServiceName() { + return ReceivablesUtil.RECEIVABLES_INITIAL_CREATE; + } + + + //随机赋值list + List list = Arrays.asList( + new CollectionDetailEntity("鼎捷A半导体有限公司","dj001","张三","186****9498"), + new CollectionDetailEntity("鼎捷B半导体有限公司","dj002","李四","158****4794"), + new CollectionDetailEntity("鼎捷C半导体有限公司","dj003","王五","150****9529"), + new CollectionDetailEntity("鼎新A半导体有限公司","dj004","赵六","139****0530"), + new CollectionDetailEntity("鼎新B半导体有限公司","dj005","陈七","136****5333"), + new CollectionDetailEntity("鼎新C半导体有限公司","dj006","刘八","188****9299"), + new CollectionDetailEntity("鼎华A半导体有限公司","dj007","韩九","130****3555"), + new CollectionDetailEntity("鼎华B半导体有限公司","dj008","管十一","138****9999"), + new CollectionDetailEntity("鼎华C半导体有限公司","dj009","谢十二","187****6160")); + + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List collectionDetailEntities = eaiRequest.getObject("receivables_info", new TypeReference>() {}); + + //先删除 + collectionDetailRepository.deleteBatch(collectionDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); + Random random = new Random(); + //随机新增 + for (CollectionDetailEntity collectionDetailEntity : list) { + int randomNumber = random.nextInt(100); + int nextInt = random.nextInt(30); + int dayInt = random.nextInt(10); + collectionDetailEntity.setReceivableNo("RE-"+DateUtils.currentTimeString()); + collectionDetailEntity.setReceivableNo("SEQ-"+DateUtils.currentTimeString()); + collectionDetailEntity.setStatus("1"); + collectionDetailEntity.setSalesOrder("SO-"+DateUtils.currentTimeString()); + collectionDetailEntity.setSalesOrderNumber("SON-"+DateUtils.currentTimeString()); + collectionDetailEntity.setContractNo(UUID.randomUUID().toString()); + collectionDetailEntity.setPriceTax(new BigDecimal(String.valueOf(randomNumber))); + collectionDetailEntity.setQuantity(new BigDecimal(String.valueOf(nextInt))); + collectionDetailEntity.setReceivableDate(org.apache.commons.lang.time.DateUtils.addDays(new Date(),dayInt)); + collectionDetailEntity.setSalesmanAssistant("qcsupplierqcuser001"); + collectionDetailEntity.setSalesmanBoss("Sp0001"); + collectionDetailEntity.setSalesman("qcuser001"); + collectionDetailEntity.setProduceBoss("Sp0002"); + collectionDetailEntity.setWorkNo("work-"+DateUtils.currentTimeString()); + collectionDetailEntity.setOverdueDays(String.valueOf(DateUtils.getDayInterval(new Date(),collectionDetailEntity.getReceivableDate()))); + } + + collectionDetailService.saveBatch(list); + + + + return buildOK(); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskGetEAIService.java new file mode 100644 index 0000000..cb7507d --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskGetEAIService.java @@ -0,0 +1,66 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +@Service +@Log4j2 +public class ReceivablesTaskGetEAIService extends AbsEAIService { + + @Resource + private CollectionDetailService collectionDetailService; + + @Override + public String getServiceName() { + return ReceivablesUtil.RECEIVABLES_TASK_GET; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List collectionDetailEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); + + for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { + if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder())||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ + throw new DWBusinessException("缺少必要参数"); + } + } + + LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); + lmq.eq(CollectionDetailEntity::getStatus, TabStatusEnums.PENDING.getValue()); + lmq.eq(CollectionDetailEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); + lmq.and(queryWrapperInner -> { + for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { + queryWrapperInner.or( + wrapper -> wrapper + .eq(CollectionDetailEntity::getSalesOrder, collectionDetailEntity.getSalesOrder()) + .eq(CollectionDetailEntity::getSalesOrderNumber, collectionDetailEntity.getSalesOrderNumber()) + ); + } + + }); + + List list = collectionDetailService.list(lmq); + return buildOK("query_result",list); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskUpdateEAIService.java new file mode 100644 index 0000000..60afcf1 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesTaskUpdateEAIService.java @@ -0,0 +1,64 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; +import com.digiwin.athena.app.ptc.infra.entity.CollectionDetailEntity; +import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import com.digiwin.athena.opt.common.security.SecurityUtil; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class ReceivablesTaskUpdateEAIService extends AbsEAIService { + + @Resource + private CollectionDetailService collectionDetailService; + + @Override + public String getServiceName() { + return ReceivablesUtil.RECEIVABLES_TASK_UPDATE; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + //根据bk更新状态为已完成 + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List collectionDetailEntities = eaiRequest.getObject("get_data", new TypeReference>() {}); + + for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { + if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder())||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ + throw new DWBusinessException("缺少必要参数"); + } + } + + LambdaUpdateWrapper ump = new LambdaUpdateWrapper<>(); + ump.set(CollectionDetailEntity::getStatus, TabStatusEnums.COMPLETED.getValue()); + ump.eq(CollectionDetailEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); + ump.and(queryWrapperInner -> { + for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { + queryWrapperInner.or( + wrapper -> wrapper + .eq(CollectionDetailEntity::getSalesOrder, collectionDetailEntity.getSalesOrder()) + .eq(CollectionDetailEntity::getSalesOrderNumber, collectionDetailEntity.getSalesOrderNumber()) + ); + } + } + ); + collectionDetailService.update(ump); + + return buildOK("query_result",collectionDetailEntities); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesUtil.java new file mode 100644 index 0000000..e15b528 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesUtil.java @@ -0,0 +1,16 @@ +package com.digiwin.athena.app.ptc.service.receivables; + +/** + * @auther: zhenggl + * @date: 2023/9/12 + */ +public class ReceivablesUtil { + + public static final String RECEIVABLES_TASK_GET = "demo.ptc.athenapot.receivables.task.get"; + + public static final String RECEIVABLES_TASK_UPDATE = "demo.ptc.athenapot.receivables.task.update"; + + public static final String RECEIVABLES_TASK_CREATE = "demo.ptc.athenapot.receivables.create"; + + public static final String RECEIVABLES_INITIAL_CREATE = "demo.ptc.athenapot.receivables.initial.create"; +} diff --git a/doc/sql/app-2023-09-12-ddl.sql b/doc/sql/app-2023-09-12-ddl.sql new file mode 100644 index 0000000..79bc4fe --- /dev/null +++ b/doc/sql/app-2023-09-12-ddl.sql @@ -0,0 +1,118 @@ +CREATE TABLE `cim_production_details` ( + `id` bigint(20) NOT NULL, + `factory_no` varchar(50) DEFAULT '' COMMENT '工厂编号', + `factory_name` varchar(50) DEFAULT '' COMMENT '工厂名称', + `nature` varchar(1) DEFAULT '' COMMENT '性质', + `expected_quantity` decimal(15,3) DEFAULT NULL COMMENT '预计产量', + `expected_commencement_date` datetime DEFAULT NULL COMMENT '预计开工日期', + `estimated_completion_date` datetime DEFAULT NULL COMMENT '预计完工日期', + `production_management_person` varchar(50) DEFAULT '' COMMENT '生管人员', + `production_management_department` varchar(50) DEFAULT '' COMMENT '生管部门', + `work_no` varchar(50) DEFAULT '' COMMENT '工单单号', + `production_status` varchar(32) DEFAULT '' COMMENT '状态', + `batch_no` varchar(32) DEFAULT '' COMMENT '生产批号', + `sku_code` varchar(32) DEFAULT '' COMMENT '品号', + `sku_name` varchar(32) DEFAULT '' COMMENT '品名', + `sku_spec` varchar(32) DEFAULT '' COMMENT '规格', + `unit` varchar(32) DEFAULT '' COMMENT '单位', + `produce_boss` varchar(32) DEFAULT '' COMMENT '生产主管', + `overdue_days` varchar(32) DEFAULT '' COMMENT '逾期天数', + `tenantsid` bigint(20) DEFAULT NULL COMMENT '租户sid', + `tenant_id` varchar(20) DEFAULT NULL, + `create_by` varchar(50) DEFAULT NULL, + `create_date` datetime DEFAULT NULL, + `modified_by` varchar(50) DEFAULT NULL, + `modified_date` datetime DEFAULT NULL, + `version` int(11) DEFAULT NULL, + `deleted` tinyint(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE `cim_receivables_detail` ( + `id` bigint(20) NOT NULL, + `receivable_no` varchar(100) DEFAULT '' COMMENT '应收单号', + `receivable_non` varchar(100) DEFAULT '' COMMENT '应收单序号', + `customer_no` varchar(100) DEFAULT '' COMMENT '客户编号', + `customer_name` varchar(100) DEFAULT '' COMMENT '客户名称', + `status` varchar(1) DEFAULT '' COMMENT '状态', + `sales_order` varchar(32) DEFAULT '' COMMENT '销售单号', + `sales_order_number` varchar(32) DEFAULT '' COMMENT '销售单序号', + `contract_no` varchar(100) DEFAULT '' COMMENT '合同编号', + `amount_tax` decimal(15,3) DEFAULT NULL COMMENT '含税金额', + `sku_code` varchar(50) DEFAULT '' COMMENT '品号', + `sku_name` varchar(50) DEFAULT '' COMMENT '品名', + `sku_spec` varchar(50) DEFAULT '' COMMENT '规格', + `price_tax` decimal(15,3) DEFAULT NULL COMMENT '含税单价', + `quantity` decimal(15,3) DEFAULT NULL COMMENT '数量', + `receivable_date` datetime DEFAULT NULL COMMENT '应收日期', + `contacts` varchar(50) DEFAULT '' COMMENT '联系人', + `contact_information` varchar(100) DEFAULT '' COMMENT '联系方式', + `salesman_assistant` varchar(100) DEFAULT '' COMMENT '业务助理', + `salesman` varchar(100) DEFAULT '' COMMENT '业务员', + `salesman_boss` varchar(100) DEFAULT '' COMMENT '业务主管', + `work_no` varchar(100) DEFAULT '' COMMENT '工单单号', + `overdue_days` varchar(50) DEFAULT '' COMMENT '逾期天数', + `tenantsid` bigint(20) DEFAULT NULL COMMENT '租户sid', + `tenant_id` varchar(20) DEFAULT NULL, + `create_by` varchar(50) DEFAULT NULL, + `create_date` datetime DEFAULT NULL, + `modified_by` varchar(50) DEFAULT NULL, + `modified_date` datetime DEFAULT NULL, + `version` int(11) DEFAULT NULL, + `deleted` tinyint(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE `cim_collection_detail` ( + `id` bigint(20) NOT NULL, + `receivable_no` varchar(100) DEFAULT '' COMMENT '应收单号', + `receivable_non` varchar(100) DEFAULT '' COMMENT '应收单序号', + `customer_no` varchar(100) DEFAULT '' COMMENT '客户编号', + `customer_name` varchar(100) DEFAULT '' COMMENT '客户名称', + `status` varchar(1) DEFAULT '' COMMENT '状态', + `sales_order` varchar(32) DEFAULT '' COMMENT '销售单号', + `sales_order_number` varchar(32) DEFAULT '' COMMENT '销售单序号', + `contract_no` varchar(100) DEFAULT '' COMMENT '合同编号', + `amount_tax` decimal(15,3) DEFAULT NULL COMMENT '含税金额', + `sku_code` varchar(50) DEFAULT '' COMMENT '品号', + `sku_name` varchar(50) DEFAULT '' COMMENT '品名', + `sku_spec` varchar(50) DEFAULT '' COMMENT '规格', + `price_tax` decimal(15,3) DEFAULT NULL COMMENT '含税单价', + `quantity` decimal(15,3) DEFAULT NULL COMMENT '数量', + `receivable_date` datetime DEFAULT NULL COMMENT '应收日期', + `contacts` varchar(50) DEFAULT '' COMMENT '联系人', + `contact_information` varchar(100) DEFAULT '' COMMENT '联系方式', + `salesman_assistant` varchar(100) DEFAULT '' COMMENT '业务助理', + `salesman` varchar(100) DEFAULT '' COMMENT '业务员', + `salesman_boss` varchar(100) DEFAULT '' COMMENT '业务主管', + `work_no` varchar(100) DEFAULT '' COMMENT '工单单号', + `overdue_days` varchar(50) DEFAULT '' COMMENT '逾期天数', + `tenantsid` bigint(20) DEFAULT NULL COMMENT '租户sid', + `tenant_id` varchar(20) DEFAULT NULL, + `create_by` varchar(50) DEFAULT NULL, + `create_date` datetime DEFAULT NULL, + `modified_by` varchar(50) DEFAULT NULL, + `modified_date` datetime DEFAULT NULL, + `version` int(11) DEFAULT NULL, + `deleted` tinyint(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE `cim_limit_credit` ( + `id` bigint(20) NOT NULL, + `customer_no` varchar(100) DEFAULT '' COMMENT '客户编号', + `customer_name` varchar(100) DEFAULT '' COMMENT '客户名称', + `limit_amount` decimal(15,3) DEFAULT NULL COMMENT '信用额度', + `tenantsid` bigint(20) DEFAULT NULL COMMENT '租户sid', + `tenant_id` varchar(20) DEFAULT NULL, + `create_by` varchar(50) DEFAULT NULL, + `create_date` datetime DEFAULT NULL, + `modified_by` varchar(50) DEFAULT NULL, + `modified_date` datetime DEFAULT NULL, + `version` int(11) DEFAULT NULL, + `deleted` tinyint(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- 修改问题明细长度 +ALTER TABLE `cim_chat_file` MODIFY COLUMN `question` varchar (500);