Browse Source

feat:请购采购更新接口代码提交

master
xieps 1 year ago
parent
commit
a9c45e9737
7 changed files with 177 additions and 0 deletions
  1. +15
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/PurchaseOrderDetailEntity.java
  2. +60
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/PurchaseOrderDetailMapper.xml
  3. +8
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/PurchaseOrderDetailRepository.java
  4. +5
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/PurchaseDemoEAIService.java
  5. +5
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/PurchaseDemoEAIServiceImpl.java
  6. +79
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/purchase/PurchaseOrderUpdateEAIService.java
  7. +5
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/purchase/PurchaseUtil.java

+ 15
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/PurchaseOrderDetailEntity.java View File

@ -31,72 +31,84 @@ public class PurchaseOrderDetailEntity extends BaseMgrEntity<PurchaseOrderDetail
* 请购单号
*/
@SerializedName(value = "purchase_order_no")
@JsonProperty(value = "purchase_order_no")
private String purchaseOrderNo;
/**
* 请购单序号
*/
@SerializedName(value = "purchase_order_seq")
@JsonProperty(value = "purchase_order_seq")
private String purchaseOrderSeq;
/**
* 品号
*/
@SerializedName(value = "item_no")
@JsonProperty(value = "item_no")
private String itemNo;
/**
* 品名
*/
@SerializedName(value = "item_name")
@JsonProperty(value = "item_name")
private String itemName;
/**
* 供应商名称
*/
@SerializedName(value = "supplier_name")
@JsonProperty(value = "supplier_name")
private String supplierName;
/**
* 供应商编号
*/
@SerializedName(value = "supplier_no")
@JsonProperty(value = "supplier_no")
private String supplierNo;
/**
* 请购数量
*/
@SerializedName(value = "requisition_num")
@JsonProperty(value = "requisition_num")
private Integer requisitionNum;
/**
* 采购数量
*/
@SerializedName(value = "purchase_num")
@JsonProperty(value = "purchase_num")
private Integer purchaseNum;
/**
* 采购单价
*/
@SerializedName(value = "purchase_price")
@JsonProperty(value = "purchase_price")
private BigDecimal purchasePrice;
/**
* 金额
*/
@SerializedName(value = "amount")
@JsonProperty(value = "amount")
private BigDecimal amount;
/**
* 采购剩余数量
*/
@SerializedName(value = "purchase_residue_num")
@JsonProperty(value = "purchase_residue_num")
private Integer purchaseResidueNum;
/**
* 采购执行人
*/
@SerializedName(value = "procurement_executor_code")
@JsonProperty(value = "procurement_executor_code")
private String procurementExecutorCode;
/**
@ -117,18 +129,21 @@ public class PurchaseOrderDetailEntity extends BaseMgrEntity<PurchaseOrderDetail
* 异常处理方式
*/
@SerializedName(value = "abnormal_handle_plan")
@JsonProperty(value = "abnormal_handle_plan")
private String abnormalHandlePlan;
/**
* 任务卡状态
*/
@SerializedName(value = "tab_status")
@JsonProperty(value = "tab_status")
private String tabStatus;
/**
* 任务卡类型:1是采购任务,2是交期回复任务,3是异常排除任务
*/
@SerializedName(value = "task_type")
@JsonProperty(value = "task_type")
private String taskType;
}

+ 60
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/PurchaseOrderDetailMapper.xml View File

@ -22,4 +22,64 @@
</update>
<update id="updateBatch">
<foreach collection="list" item="item" index="index" separator=";" open="" close="">
UPDATE cim_purchase_order_detail
<set>
<if test="item.itemNo != null and '' != item.itemNo">
item_no = #{item.itemNo},
</if>
<if test="item.itemName != null and '' != item.itemName">
item_name = #{item.itemName},
</if>
<if test="item.supplierName != null and '' != item.supplierName">
supplier_name = #{item.supplierName},
</if>
<if test="item.supplierNo != null and '' != item.supplierNo">
supplier_no = #{item.supplierNo},
</if>
<if test="item.requisitionNum != null ">
requisition_num = #{item.requisitionNum},
</if>
<if test="item.purchaseNum != null ">
purchase_num = #{item.purchaseNum},
</if>
<if test="item.purchasePrice != null ">
purchase_price = #{item.purchasePrice},
</if>
<if test="item.amount != null ">
amount = #{item.amount},
</if>
<if test="item.purchaseResidueNum != null ">
purchase_residue_num = #{item.purchaseResidueNum},
</if>
<if test="item.procurementExecutorCode != null ">
procurement_executor_code = #{item.procurementExecutorCode},
</if>
<if test="item.purchaseDate != null ">
purchase_date = #{item.purchaseDate},
</if>
<if test="item.expectedDate != null ">
expected_date = #{item.expectedDate},
</if>
<if test="item.abnormalHandlePlan != null and '' != item.abnormalHandlePlan">
abnormal_handle_plan = #{item.abnormalHandlePlan},
</if>
<if test="item.tabStatus != null and '' != item.tabStatus">
tab_status = #{item.tabStatus},
</if>
<if test="item.taskType != null and '' != item.taskType">
task_type = #{item.taskType},
</if>
modified_by = #{item.modifiedBy},
modified_date = #{item.modifiedDate}
</set>
WHERE tenantsid = #{item.tenantSid} AND purchase_order_no = #{item.purchaseOrderNo}
AND purchase_order_seq = #{item.purchaseOrderSeq}
</foreach>
</update>
</mapper>

+ 8
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/PurchaseOrderDetailRepository.java View File

@ -15,4 +15,12 @@ import java.util.List;
public interface PurchaseOrderDetailRepository extends BaseRepository<PurchaseOrderDetailEntity> {
public void updateAbnormalHandlePlan(@Param("list") List<PurchaseOrderDetailEntity> list);
/**
* 请购采购更新
*
* @param entityList
*/
void updateBatch(@Param("list") List<PurchaseOrderDetailEntity> entityList);
}

+ 5
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/PurchaseDemoEAIService.java View File

@ -26,4 +26,9 @@ public interface PurchaseDemoEAIService extends DWService {
@EAIService(id = PurchaseUtil.DEMO_PURCHASE_ORDER_ABNORMAL_UPDATE)
DWEAIResult abnormalUpdate(Map<String, String> headers, String messageBody) throws Exception;
@EAIService(id = PurchaseUtil.DEMO_PURCHASE_ORDER_UPDATE)
DWEAIResult purchaseOrderUpdate(Map<String, String> headers, String messageBody) throws Exception;
}

+ 5
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/PurchaseDemoEAIServiceImpl.java View File

@ -34,4 +34,9 @@ public class PurchaseDemoEAIServiceImpl implements PurchaseDemoEAIService {
public DWEAIResult abnormalUpdate(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(PurchaseUtil.DEMO_PURCHASE_ORDER_ABNORMAL_UPDATE, headers, messageBody);
}
@Override
public DWEAIResult purchaseOrderUpdate(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(PurchaseUtil.DEMO_PURCHASE_ORDER_UPDATE, headers, messageBody);
}
}

+ 79
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/purchase/PurchaseOrderUpdateEAIService.java View File

@ -0,0 +1,79 @@
package com.digiwin.athena.app.service.purchase;
import com.digiwin.app.container.exceptions.DWBusinessException;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.entity.PurchaseOrderDetailEntity;
import com.digiwin.athena.app.infra.repository.PurchaseOrderDetailRepository;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.security.SecurityUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.*;
/**
* @Author: xieps
* @Date: 2023/9/5 15:29
* @Version 1.0
* @Description
*/
@Service
@Log4j2
public class PurchaseOrderUpdateEAIService extends AbsEAIService {
@Resource
PurchaseOrderDetailRepository purchaseOrderDetailRepository;
@Override
public String getServiceName() {
return PurchaseUtil.DEMO_PURCHASE_ORDER_UPDATE;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
EAIRequest request = new EAIRequest(messageBody);
List<PurchaseOrderDetailEntity> entityList = request.getToList("purchase_info", PurchaseOrderDetailEntity.class);
//校验请购单号序号 必传
validateParameter(entityList);
//管理字段赋值
entityList.stream().forEach(item -> {
item.setTenantSid(SecurityUtil.getUserProfile().getTenantSid());
item.setModifiedBy(SecurityUtil.getUserProfile().getUserId());
item.setModifiedDate(new Date());
});
//根据单号序号进行批量更新
purchaseOrderDetailRepository.updateBatch(entityList);
return EAIUtil.buildEAIResult(new HashMap<>());
}
/**
* 校验必传参数
*
* @param entityList
*/
private void validateParameter(List<PurchaseOrderDetailEntity> entityList) throws DWBusinessException {
if (Objects.isNull(entityList) || entityList.isEmpty()) {
throw new DWBusinessException("入参数据为空~~");
}
for (PurchaseOrderDetailEntity entity : entityList) {
if (StringUtils.isEmpty(entity.getPurchaseOrderNo())) {
throw new DWBusinessException("请购单号不为空或者NULL~");
}
if (StringUtils.isEmpty(entity.getPurchaseOrderSeq())) {
throw new DWBusinessException("请购单序号不为空或者NULL~");
}
}
}
}

+ 5
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/purchase/PurchaseUtil.java View File

@ -26,4 +26,9 @@ public class PurchaseUtil {
public static final TypeReference<List<PurchaseOrderDetailEntity>> LIST_ENTITY_PURCHASE = new TypeReference<List<PurchaseOrderDetailEntity>>() {
};
/**
* 请购单更新
*/
public static final String DEMO_PURCHASE_ORDER_UPDATE = "demo.purchase.order.update";
}

Loading…
Cancel
Save