Author | SHA1 | Message | Date |
---|---|---|---|
clong | 8ec49aa89a | Merge branch 'sprint/S3' into release/S3 | 1 year ago |
郑贵龙 | 753df37ea9 | feat:回款时效控制应收,催收,额度,生产接口开发 | 1 year ago |
@ -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<CollectionDetailEntity> | |||
{ | |||
/** 应收单号 */ | |||
@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; | |||
} | |||
} |
@ -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; | |||
} |
@ -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<ProductionDetailsEntity> | |||
{ | |||
/** 工厂编号 */ | |||
@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; | |||
} | |||
} |
@ -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<ReceivablesDetailEntity> | |||
{ | |||
/** 应收单号 */ | |||
@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; | |||
} |
@ -0,0 +1,18 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.digiwin.athena.app.ptc.infra.repository.CollectionDetailRepository"> | |||
<delete id="deleteBatch"> | |||
delete from cim_collection_detail where tenantsid=#{tenantSid} | |||
<foreach collection="list" item="item" index="index" separator=" or" open="" close=""> | |||
( | |||
sales_order = #{item.salesOrder} | |||
and sales_order_number = #{item.salesOrderNumber} | |||
) | |||
</foreach> | |||
</delete> | |||
</mapper> |
@ -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<CollectionDetailEntity> { | |||
void deleteBatch(@Param("list") List<CollectionDetailEntity> list,@Param("tenantSid")Long tenantSid); | |||
} |
@ -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<LimitCreditEntity> { | |||
} |
@ -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<ProductionDetailsEntity> { | |||
} |
@ -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<ReceivablesDetailEntity> { | |||
} |
@ -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<CollectionDetailEntity> { | |||
} |
@ -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<LimitCreditEntity> { | |||
} |
@ -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<ProductionDetailsEntity> { | |||
} |
@ -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<ReceivablesDetailEntity> { | |||
} |
@ -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<CollectionDetailRepository, CollectionDetailEntity> implements CollectionDetailService { | |||
} |
@ -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<LimitCreditRepository, LimitCreditEntity> implements LimitCreditService { | |||
} |
@ -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<ProductionDetailsRepository, ProductionDetailsEntity> implements ProductionDetailsService { | |||
} |
@ -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<ReceivablesDetailRepository, ReceivablesDetailEntity> implements ReceivablesDetailService { | |||
} |
@ -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 { | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = ProductionUtil.PRODUCTION_TASK_UPDATE) | |||
DWEAIResult taskUpdate(Map<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = ProductionUtil.PRODUCTION_TASK_CREATE) | |||
DWEAIResult taskCreate(Map<String, String> headers, String messageBody) throws Exception; | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_CREATE) | |||
DWEAIResult taskCreate(Map<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_UPDATE) | |||
DWEAIResult taskUpdate(Map<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = ReceivablesUtil.RECEIVABLES_TASK_GET) | |||
DWEAIResult initialCreate(Map<String, String> headers, String messageBody) throws Exception; | |||
} |
@ -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; | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_GET,headers,messageBody); | |||
} | |||
@Override | |||
public DWEAIResult taskUpdate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_UPDATE,headers,messageBody); | |||
} | |||
@Override | |||
public DWEAIResult taskCreate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ProductionUtil.PRODUCTION_TASK_CREATE,headers,messageBody); | |||
} | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_GET,headers,messageBody); | |||
} | |||
@Override | |||
public DWEAIResult taskCreate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_CREATE,headers,messageBody); | |||
} | |||
@Override | |||
public DWEAIResult taskUpdate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_TASK_UPDATE,headers,messageBody); | |||
} | |||
@Override | |||
public DWEAIResult initialCreate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(ReceivablesUtil.RECEIVABLES_INITIAL_CREATE,headers,messageBody); | |||
} | |||
} |
@ -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<ProductionDetailsEntity> list = Arrays.asList( | |||
new ProductionDetailsEntity("001", "一号工厂", "一号工厂刘晓鹏"), | |||
new ProductionDetailsEntity("002", "二号工厂", "二号工厂饶文豪"), | |||
new ProductionDetailsEntity("003", "三号工厂", "三号工厂卢人辅")); | |||
@Override | |||
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<ProductionDetailsEntity> productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference<List<ProductionDetailsEntity>>() { | |||
}); | |||
//根据工单单号查询应收表 | |||
List<String> woNoList = productionDetailsEntities.stream().map(ProductionDetailsEntity::getWorkNo).collect(Collectors.toList()); | |||
LambdaQueryWrapper<ReceivablesDetailEntity> receivablesLmq = new LambdaQueryWrapper(); | |||
receivablesLmq.in(ReceivablesDetailEntity::getWorkNo, woNoList); | |||
List<ReceivablesDetailEntity> 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(); | |||
} | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
//根据bk更新状态为已完成 | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<ProductionDetailsEntity> productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference<List<ProductionDetailsEntity>>() {}); | |||
for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { | |||
if (StringUtils.isEmpty(productionDetailsEntity.getWorkNo())){ | |||
throw new DWBusinessException("缺少必填参数"); | |||
} | |||
} | |||
LambdaUpdateWrapper<ProductionDetailsEntity> ump = new LambdaUpdateWrapper<>(); | |||
ump.set(ProductionDetailsEntity::getProductionStatus, TabStatusEnums.COMPLETED.getValue()); | |||
List<String> woNoList = productionDetailsEntities.stream().map(ProductionDetailsEntity::getWorkNo).collect(Collectors.toList()); | |||
ump.in(ProductionDetailsEntity::getWorkNo,woNoList); | |||
productionDetailsService.update(ump); | |||
return buildOK(); | |||
} | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
//根据bk获取数据 | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<ProductionDetailsEntity> productionDetailsEntities = eaiRequest.getObject("get_data", new TypeReference<List<ProductionDetailsEntity>>() {}); | |||
for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { | |||
if (StringUtils.isEmpty(productionDetailsEntity.getWorkNo())){ | |||
throw new DWBusinessException("缺少必填参数"); | |||
} | |||
} | |||
LambdaQueryWrapper<ProductionDetailsEntity> lmq = new LambdaQueryWrapper<>(); | |||
List<String> 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<ProductionDetailsEntity> list = productionDetailsService.list(lmq); | |||
return buildOK("query_result",list); | |||
} | |||
} |
@ -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"; | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<CollectionDetailEntity> receivablesDetailEntities = eaiRequest.getObject("get_data", new TypeReference<List<CollectionDetailEntity>>() {}); | |||
//根据bk删除数据 | |||
//先删除 | |||
collectionDetailRepository.deleteBatch(receivablesDetailEntities, SecurityUtil.getUserProfile().getTenantSid()); | |||
collectionDetailService.saveBatch(receivablesDetailEntities); | |||
return buildOK("query_result",receivablesDetailEntities); | |||
} | |||
} |
@ -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<CollectionDetailEntity> 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<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<CollectionDetailEntity> collectionDetailEntities = eaiRequest.getObject("receivables_info", new TypeReference<List<CollectionDetailEntity>>() {}); | |||
//先删除 | |||
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(); | |||
} | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<CollectionDetailEntity> collectionDetailEntities = eaiRequest.getObject("get_data", new TypeReference<List<CollectionDetailEntity>>() {}); | |||
for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { | |||
if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder())||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ | |||
throw new DWBusinessException("缺少必要参数"); | |||
} | |||
} | |||
LambdaQueryWrapper<CollectionDetailEntity> 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<CollectionDetailEntity> list = collectionDetailService.list(lmq); | |||
return buildOK("query_result",list); | |||
} | |||
} |
@ -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<String, String> headers, String messageBody) throws Exception { | |||
//根据bk更新状态为已完成 | |||
EAIRequest eaiRequest = EAIRequest.build(messageBody); | |||
List<CollectionDetailEntity> collectionDetailEntities = eaiRequest.getObject("get_data", new TypeReference<List<CollectionDetailEntity>>() {}); | |||
for (CollectionDetailEntity collectionDetailEntity : collectionDetailEntities) { | |||
if (StringUtils.isEmpty(collectionDetailEntity.getSalesOrder())||StringUtils.isEmpty(collectionDetailEntity.getSalesOrderNumber())){ | |||
throw new DWBusinessException("缺少必要参数"); | |||
} | |||
} | |||
LambdaUpdateWrapper<CollectionDetailEntity> 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); | |||
} | |||
} |
@ -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"; | |||
} |
@ -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); |