Browse Source

异常排除更新接口新增

master
郑贵龙 1 year ago
parent
commit
bfeb79a968
2 changed files with 72 additions and 0 deletions
  1. +25
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/PurchaseOrderDetailMapper.xml
  2. +47
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/purchase/PurchaseOrderAbnormalUpdateEAIService.java

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

@ -0,0 +1,25 @@
<?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.infra.repository.PurchaseOrderDetailRepository">
<update id="updateAbnormalHandlePlan">
<foreach collection="list" item="item" index="index" separator=";" open="" close="">
UPDATE cim_purchase_order_detail
<set>
abnormal_handle_plan = #{item.abnormal_handle_plan}
<if test="item.purchaseDate !=null">
,purchase_date = #{item.purchaseDate}
</if>
<if test="item.expectedDate !=null">
,expected_date = #{item.expectedDate}
</if>
</set>
where id = #{item.id}
</foreach>
</update>
</mapper>

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

@ -0,0 +1,47 @@
package com.digiwin.athena.app.service.purchase;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.entity.PurchaseOrderDetailEntity;
import com.digiwin.athena.app.infra.entity.SupplierContactEntity;
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 lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @auther: zhenggl
* @date: 2023/9/4
*/
@Log4j2
@Service
public class PurchaseOrderAbnormalUpdateEAIService extends AbsEAIService {
@Resource
PurchaseOrderDetailRepository purchaseOrderDetailRepository;
@Override
public String getServiceName() {
return PurchaseUtil.DEMO_PURCHASE_ORDER_ABNORMAL_UPDATE;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
// 入参反序列化
EAIRequest request = new EAIRequest(messageBody);
List<PurchaseOrderDetailEntity> purchaseOrderDetailEntities = request.getToList("purchase_order_info", PurchaseOrderDetailEntity.class);
purchaseOrderDetailRepository.updateAbnormalHandlePlan(purchaseOrderDetailEntities);
return EAIUtil.buildEAIResult(new HashMap<>());
}
}

Loading…
Cancel
Save