refactor(buildpackage): 优化公司代码转换逻辑和模糊查询
- 在 OverallConstant 中添加了 "u8c自定义项档案-公司对照" 配置项 - 修改了 BdCubasdocEntity 中的 def1 字段查询方式,改为模糊查询 - 更新了 ConsignmachiningIn 中的公司代码转换逻辑 - 优化了 QueryU8CEntityUtil 中的 queryBdDefDocByPkDefDocList 方法
This commit is contained in:
parent
fd8d287b95
commit
e29b0647f9
|
@ -93,6 +93,7 @@ public class OverallConstant {
|
||||||
devOverAll.put("u8cApiNeedStackTraceCode", "Y");
|
devOverAll.put("u8cApiNeedStackTraceCode", "Y");
|
||||||
devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
||||||
|
|
||||||
|
devOverAll.put("u8c自定义项档案-公司对照", "0001A11000000004XB42");
|
||||||
devOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
devOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
||||||
devOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
devOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
||||||
devOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");
|
devOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");
|
||||||
|
@ -126,6 +127,7 @@ public class OverallConstant {
|
||||||
prodOverAll.put("u8cApiNeedStackTraceCode", "N");
|
prodOverAll.put("u8cApiNeedStackTraceCode", "N");
|
||||||
prodOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
prodOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
||||||
|
|
||||||
|
prodOverAll.put("u8c自定义项档案-公司对照", "0001A11000000004XB42");
|
||||||
prodOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
prodOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
||||||
prodOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
prodOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
||||||
prodOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");
|
prodOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
<if test="custname != null and custname != ''"> and custname = #{custname} </if>
|
<if test="custname != null and custname != ''"> and custname = #{custname} </if>
|
||||||
<if test="custprop != null"> and custprop = #{custprop} </if>
|
<if test="custprop != null"> and custprop = #{custprop} </if>
|
||||||
<if test="custshortname != null and custshortname != ''"> and custshortname = #{custshortname} </if>
|
<if test="custshortname != null and custshortname != ''"> and custshortname = #{custshortname} </if>
|
||||||
<if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
|
<if test="def1 != null and def1 != ''"> and def1 like concat('%',#{def1},'%') </if>
|
||||||
<if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
|
<if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
|
||||||
<if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
|
<if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
|
||||||
<if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>
|
<if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>
|
||||||
|
|
|
@ -106,6 +106,9 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
|
|
||||||
private static final String PROD_FILED = "prod";
|
private static final String PROD_FILED = "prod";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QueryU8CEntityUtil queryU8CEntityUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
@ -566,10 +569,12 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
//委外订单表头公司
|
//委外订单表头公司
|
||||||
String companyCode = header.getCompanyCode();
|
String companyCode = header.getCompanyCode();
|
||||||
Assert.notNull(companyCode, "O表头公司不能为空(物理货主)");
|
Assert.notNull(companyCode, "O表头公司不能为空(物理货主)");
|
||||||
|
String replaceCompanyCode = queryU8CEntityUtil.queryBdDefDocByPkDefDocList(companyCode.trim());
|
||||||
|
|
||||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||||
bdCorpEntity.setDr(0);
|
bdCorpEntity.setDr(0);
|
||||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||||
bdCorpEntity.setUnitcode(companyCode);
|
bdCorpEntity.setUnitcode(replaceCompanyCode);
|
||||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||||
if (bdCorpEntityList.size() == 0) {
|
if (bdCorpEntityList.size() == 0) {
|
||||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C委外订单公司", companyCode);
|
Assert.state(false, "根据O货主编码{},无法匹配到U8C委外订单公司", companyCode);
|
||||||
|
|
|
@ -292,25 +292,29 @@ public class QueryU8CEntityUtil {
|
||||||
* YD 杭州盈达电子商务有限公司
|
* YD 杭州盈达电子商务有限公司
|
||||||
* 都传到 YD,杭州盈达电子商务有限公司
|
* 都传到 YD,杭州盈达电子商务有限公司
|
||||||
* SELECT * FROM BD_DEFDOC WHERE pk_defdoclist=(SELECT pk_defdoclist FROM BD_DEFDOCLIST WHERE doclistcode='GSDY')-- 0001A11000000004XB42
|
* SELECT * FROM BD_DEFDOC WHERE pk_defdoclist=(SELECT pk_defdoclist FROM BD_DEFDOCLIST WHERE doclistcode='GSDY')-- 0001A11000000004XB42
|
||||||
|
*
|
||||||
* @param corpCode 公司编码
|
* @param corpCode 公司编码
|
||||||
* @return corpCode 如果时需要转换的会自动转换,如果不需要返回原始公司编码
|
* @return corpCode 如果时需要转换的会自动转换,如果不需要返回原始公司编码
|
||||||
*/
|
*/
|
||||||
public String queryBdDefDocByPkDefDocList(String corpCode) {
|
public String queryBdDefDocByPkDefDocList(String corpCode) {
|
||||||
Assert.notNull(corpCode, "公司三对一,入参公司不能为空!!!");
|
Assert.notNull(corpCode, "公司三对一,入参公司不能为空!!!");
|
||||||
|
|
||||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||||
bdDefdocEntity.setPkDefdoclist("0001A11000000004XB42");
|
bdDefdocEntity.setPkDefdoclist(OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
|
||||||
bdDefdocEntity.setDr(0);
|
bdDefdocEntity.setDr(0);
|
||||||
bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||||
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
||||||
if (bdDefdocEntityList.size() == 0) {
|
if (bdDefdocEntityList.size() == 0) {
|
||||||
Assert.state(false,"根据:自定义档案列表编码:GSDY,主键:[0001A11000000004XB42],未查询到自定义档案");
|
Assert.state(false, "根据:自定义档案列表编码:GSDY,主键:[{}],未查询到自定义档案", OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
|
||||||
}
|
}
|
||||||
List<String> corpCollect = bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.toList());
|
List<String> corpCollect = bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.toList());
|
||||||
if (corpCollect.contains(corpCode)) {
|
if (corpCollect.contains(corpCode)) {
|
||||||
String memo = bdDefdocEntityList.get(0).getMemo();
|
String memo = bdDefdocEntityList.get(0).getMemo();
|
||||||
String[] split = memo.split(",");
|
String[] split = memo.split(",");
|
||||||
|
if (split.length > 0) {
|
||||||
corpCode = split[0];
|
corpCode = split[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return corpCode;
|
return corpCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,10 @@ class SoSaleOutPluginInitializerToCTest {
|
||||||
// String aaa = "LETS-SH2024101900022025";
|
// String aaa = "LETS-SH2024101900022025";
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
||||||
|
|
||||||
String aaa = "LETS-SH2024101800007483";
|
// String aaa = "LETS-SH2024102200217857";
|
||||||
soSaleOutPluginInitializerToC.startImplementStockByCode(aaa,"stock");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
||||||
|
|
||||||
|
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue