数据库查询和日志优化,修复采购流程问题

- 优化数据库查询逻辑,采用更高效的条件查询方式。
- 修复采购流程中的供应商编码映射问题,确保与U8C系统的客商档案匹配。- 更新业务流程名称,以反映正确的采购流程。
- 日志记录中添加更多上下文信息,方便调试和跟踪。
This commit is contained in:
liuy 2024-09-19 15:29:16 +08:00
parent c850f9a226
commit bab87f833d
10 changed files with 70 additions and 38 deletions

View File

@ -53,6 +53,7 @@
,verifyrule
,ystype
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-BdBusitypeEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdBusitypeEntity">
select
@ -82,6 +83,7 @@
<if test="ts != null and ts != ''"> and ts = #{ts} </if>
<if test="verifyrule != null and verifyrule != ''"> and verifyrule = #{verifyrule} </if>
<if test="ystype != null and ystype != ''"> and ystype = #{ystype} </if>
-- and sts='Y'
</trim>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->

View File

@ -325,12 +325,12 @@ public class ConsignmachiningIn extends PluginBaseEntity {
StringBuilder result = new StringBuilder();
for (StockinOrderSearchResponse.StockinOrder obj : headerDetailsDtoList1) {
StockinOrderSearchResponse.StockinOrder.StockinH header = obj.getHeader();
if (result.length() > 0) {
result.append(",");
}
result.append("'").append(header.getId()).append("'");
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(",");
}
return result.substring(0, result.length());
return result.substring(0, result.length() - 1);
}
return null;
}

View File

@ -322,10 +322,10 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
StringBuilder result = new StringBuilder();
for (HeaderDetailsDto obj : headerDetailsDtos) {
HeaderDto header = obj.getHeader();
if (result.length() > 0) {
result.append(",");
}
result.append("'").append(header.getId()).append("'");
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(",");
}
return result.substring(0, result.length() - 1);
}

View File

@ -359,10 +359,10 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
StringBuilder result = new StringBuilder();
for (HeaderDetailsDto obj : headerDetailsDtoList) {
HeaderDto header = obj.getHeader();
if (result.length() > 0) {
result.append(",");
}
result.append("'").append(header.getId()).append("'");
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(",");
}
return result.substring(0, result.length() - 1);
}

View File

@ -226,7 +226,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setStatus(900L);
// queryOfsSoSaleOutVo.setStatus(900L);
ofsStandardUtil.queryOfsPoOrder(queryOfsSoSaleOutVo, allOfsPoOrderList, 1L);
logger.info("数据返回行数:{}", allOfsPoOrderList.size());
if (allOfsPoOrderList.size() > 0) {
@ -355,10 +355,10 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
StringBuilder result = new StringBuilder();
for (OfsPoOrderData obj : ofsPoOrderDataList) {
OfsPoOrderHeader header = obj.getHeader();
if (result.length() > 0) {
result.append(",");
}
result.append("'").append(header.getId()).append("'");
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(",");
}
return result.substring(0, result.length() - 1);
}
@ -441,7 +441,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
//2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(ofsPoOrderDetails, bdCorpEntity.getPkCorp());
String receivedQty = ofsPoOrderDetails.getRequestQty();//请求数量
String buyPrice = ofsPoOrderDetails.getBuyPrice();//TODO 目前还不确定实际进价
String buyPrice = ofsPoOrderDetails.getDiscountPrice();//实际进价
//原币含税单价
// BigDecimal noriginalcurprice = null;
@ -488,7 +488,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
if (childrenvo != null) {
vordercode = parentvo.getVordercode();
}
logger.info("推送U8C代理品牌采购订单采购U8C采购订单主键{} U8C采购订单编码{}", corderid, vordercode);
logger.info("推送U8C代理品牌采购订单采购U8C采购订单主键{} 采购公司编码:{} 采购公司名称:{} U8C采购订单编码{}", corderid, bdCorpEntity.getUnitcode(), bdCorpEntity.getUnitname(), vordercode);
// 成功记录日志
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
@ -573,7 +573,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
Assert.state(false, "根据O货主编码{}匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size());
}
//采购部门其他
//采购部门业务部门
String deptName = "业务部门";
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c");
@ -603,6 +603,8 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
//2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商
//其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝
String shipFromCode = header.getVendorName();
//TODO 测试
shipFromCode = "dy-off";
Assert.notNull(shipFromCode, "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码(采购)");
Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码(采购)");
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
@ -709,7 +711,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
private BdBusitypeEntity u8cOperationFlow() throws Exception {
//查询业务流程
//2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供
String processName = "代理品牌采购";
String processName = "渠道品牌采购";
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
return bdBusitypeEntity;

View File

@ -18,13 +18,9 @@ import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.*;
import com.hzya.frame.split.SplitListByCountUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
@ -36,7 +32,7 @@ import java.math.BigDecimal;
import java.util.*;
/**
* 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购订单根据业务流程自动生成U8C采购入库
* 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购入库单关联原采购订
*
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
@ -45,9 +41,9 @@ import java.util.*;
* @Date2024/8/19 18:01
* @FilenameProxyPurchase
*/
public class ProxyPurchaseWarehous extends PluginBaseEntity {
public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ProxyPurchaseWarehous.class);
Logger logger = LoggerFactory.getLogger(ProxyPurchaseWarehousWarehouse.class);
@Autowired
private OfsUnifiedService ofsUnifiedService;
@ -350,10 +346,10 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
StringBuilder result = new StringBuilder();
for (StockinOrderSearchResponse.StockinOrder obj : stockinOrderList) {
StockinOrderSearchResponse.StockinOrder.StockinH header = obj.getHeader();
if (result.length() > 0) {
result.append(",");
}
result.append("'").append(header.getId()).append("'");
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(",");
}
return result.substring(0, result.length() - 1);
}

View File

@ -1,7 +1,6 @@
package com.hzya.frame.plugin.lets.util;
import cn.hutool.core.lang.Assert;
import com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;

View File

@ -30,7 +30,7 @@
<bean name="soSaleOutPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB"/>
<bean name="soSaleReturnPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB"/>
<bean name="proxyPurchaseWarehous" class="com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous"/>
<bean name="proxyPurchaseWarehous" class="com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehousWarehouse"/>
<bean name="proxyPurchaseReturn" class="com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseReturn"/>

View File

@ -0,0 +1,35 @@
package com.hzya.frame.plugin.lets.plugin.purchase;
import com.hzya.frame.WebappApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
* @ProjectkangarooDataCenterV3
* @nameProxyPurchaseWarehousOrderTest
* @Date2024/9/19 11:49
* @FilenameProxyPurchaseWarehousOrderTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class ProxyPurchaseWarehousOrderTest {
@Autowired
private ProxyPurchaseWarehousOrder proxyPurchaseWarehousOrder;
@Test
public void startImplementByCode() {
try {
proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2024091800000002");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -7,8 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
@ -22,7 +20,7 @@ import static org.junit.Assert.*;
public class ProxyPurchaseWarehousTest {
@Autowired
private ProxyPurchaseWarehous proxyPurchaseWarehous;
private ProxyPurchaseWarehousWarehouse proxyPurchaseWarehous;
@Test
public void startImplement() {