diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java index 7af28c4f..062b801e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java @@ -28,8 +28,11 @@ public class OverallConstant { private static void loadPublic() { //存货分类 + prodOverPublic.put("bdinvclSaveCode", "8000370025");//存货分类新增 prodOverPublic.put("bdinvclSave", "/u8cloud/api/uapbd/bdinvcl/save");//存货分类新增 + prodOverPublic.put("bdinvclUpdateCode", "8000370026");//存货分类修改 prodOverPublic.put("bdinvclUpdate", "/u8cloud/api/uapbd/bdinvcl/update");//存货分类修改 + prodOverPublic.put("bdinvclDeleteCode", "8000370027");//存货分类删除 prodOverPublic.put("bdinvclDelete", "/u8cloud/api/uapbd/bdinvcl/delete");//存货分类删除 //存货基本档案 prodOverPublic.put("bdinvclSave", "/u8cloud/api/uapbd/bdinvcl/save");//存货基本档案新增 @@ -58,6 +61,7 @@ public class OverallConstant { prodOverPublic.put("custdocAssign", "/u8cloud/api/uapbd/custdoc/assign");//客商档案分配 prodOverPublic.put("custmandocSave", "/u8cloud/api/uapbd/custmandoc/insert");//客商档案新增 prodOverPublic.put("bdcorpQuery", "/u8cloud/api/uapbd/bdcorp/query");//公司档案查询 + prodOverPublic.put("bddefdoclistsave", "/u8cloud/api/uapbd/bddefdoc/insert");//自定义档案内容查询 } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvclEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvclEntity.java index 48612dc6..53357da7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvclEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvclEntity.java @@ -41,6 +41,7 @@ public class BdInvclEntity extends BaseEntity { private String pk_corp; /** 存货分类主键 */ private String pkInvcl; + private String pk_invcl; /** 封存标志 */ private String sealdate; /** 时间戳 */ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsAdjustOrderRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsAdjustOrderRequestVO.java new file mode 100644 index 00000000..e5536929 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsAdjustOrderRequestVO.java @@ -0,0 +1,32 @@ +package com.hzya.frame.plugin.lets.ofsvo; + +import lombok.Data; + +/** + * ofs调整单查询 + */ +@Data +public class QueryOfsAdjustOrderRequestVO{ + /** 开始时间 */ + private String created_start; + /** 结束时间 */ + private String created_end; + /** 组织 */ + private String clientCode; + /** 调拨订单 */ + private String code; + /** 状态 */ + private String status; + /** 订单类型 */ + private String internalOrderType; + /** 上位系统订单号 */ + private String sourceOrderCode; + /** 货主 */ + private String companyCode; + /** 库存地点 */ + private String facilityCode; + /** 分页页数 */ + private Long pageNo; + /** 每页条数 1-500,默认50 */ + private Long pageSize; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSKUClassRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSKUClassRequestVO.java index 658215a0..5dc3aced 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSKUClassRequestVO.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSKUClassRequestVO.java @@ -14,6 +14,9 @@ public class QueryOfsSKUClassRequestVO { /** 组织 */ private String clientCode; + private String lastUpdated_start; + private String lastUpdated_end; + private String companyCode; private String cInvCCode; private String status; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java index 1265c611..cbff6813 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java @@ -11,6 +11,7 @@ import com.hzya.frame.plugin.lets.constant.OverallConstant; import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; import com.hzya.frame.plugin.lets.dao.IBdRdclDao; import com.hzya.frame.plugin.lets.entity.BdRdclEntity; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsAdjustOrderRequestVO; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO; import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4ADto; @@ -23,7 +24,9 @@ import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode; import com.hzya.frame.plugin.lets.util.pushData.ZTResult; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; +import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSAdjustOrderSearchResponse; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; @@ -365,13 +368,13 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); } if (!isSuccess) { - Assert.state(false, "推送U8C--> 丽知:OFS调整出库--->U8C其它出库 失败 接口返回结果:{} 接口入参:{}", response, mapStr); + Assert.state(false, "推送U8C--> 丽知:OFS调整出库--->U8C其它出库 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr); } //成功 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(format); integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); @@ -473,4 +476,25 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { } return null; } + + + /** + * ofs调整单查询 + * ofs. adjustOrder.search + */ + public void queryOfsAdjustOrders(String ofsAdjustCode) throws Exception { + QueryOfsAdjustOrderRequestVO queryOfsAdjustOrderRequestVO = new QueryOfsAdjustOrderRequestVO(); + queryOfsAdjustOrderRequestVO.setClientCode("LETS"); + queryOfsAdjustOrderRequestVO.setCode(ofsAdjustCode); + queryOfsAdjustOrderRequestVO.setPageNo(1L); + queryOfsAdjustOrderRequestVO.setPageSize(500L); + + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi("ofs.adjustOrder.search"); + interfaceParamDto.setData(JSON.toJSONString(queryOfsAdjustOrderRequestVO)); + OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse =(OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); + System.out.println(ofsAdjustOrderSearchResponse); + + + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java index c989a214..ee38af78 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java @@ -77,6 +77,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + start(); return null; } @@ -158,7 +159,6 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { } } return shopEntityList; - } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java index ca9bb2fb..0c594dce 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java @@ -9,11 +9,17 @@ import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; import com.hzya.frame.plugin.lets.constant.OverallConstant; import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import com.hzya.frame.plugin.lets.dao.IBdInvclDao; +import com.hzya.frame.plugin.lets.dao.impl.BdInvclDaoImpl; import com.hzya.frame.plugin.lets.entity.BdInvclEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSKUClassRequestVO; +import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4IDto; import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto; import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil; import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil; +import com.hzya.frame.plugin.lets.util.pushData.Attribute; +import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode; +import com.hzya.frame.plugin.lets.util.pushData.ZTResult; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; @@ -43,6 +49,11 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.locks.ReentrantLock; +/** + * 丽知:OFS货品档案分类--->U8C货品档案分类(XX-XXX-XXXX) + * 传递时需要区分上下级,需要先XX 在XXXXX 最后XXXXXXXXX + * 分组匹配查询。 + */ public class SKUClassPluginInitializer extends PluginBaseEntity { Logger logger = LoggerFactory.getLogger(SKUClassPluginInitializer.class); @@ -82,20 +93,57 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { @Autowired private PushDataByU8cUtil pushDataByU8cUtil; @Autowired + private PushU8CByApiCode pushU8CByApiCode; + @Autowired private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; @Autowired private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; @Autowired private OfsUnifiedService ofsUnifiedService; + @Autowired + private IBdInvclDao bdInvclDao; + @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + try { + logger.info("调用:" + getPluginName() + "-插件"); + String prod = "prod"; + String param = String.valueOf(requestJson.get("param")); + if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) { + //按日期 + if (param != null && !"".equals(param)) { + String[] split = param.split("/"); + if (!(split.length == 2)) { + Assert.state(false, "时间格式传递不正确"); + } + Assert.notNull(split[0], "开始时间不能为空"); + Assert.notNull(split[1], "结束时间不能为空"); + start(split[0], split[1]); + } + } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + start(param); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails); + start(integrationTaskLivingDetailsEntity.getRootAppPk()); + } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) { + //默认 + start(); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("executeBusiness方法抛出异常", e); + } return null; } /** - * 默认推送 + * 全量拉取。ofs对比u8c, */ public void start() { try { @@ -107,13 +155,15 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); QueryOfsSKUClassRequestVO queryOfsSKUClassRequestVO = new QueryOfsSKUClassRequestVO(); -// queryOfsSKUClassRequestVO.setCreated_start(start); -// queryOfsSKUClassRequestVO.setCreated_end(end); - queryOfsSKUClassRequestVO.setClientCode("LETS"); - queryOfsSKUClassRequestVO.setPageNo(1); - queryOfsSKUClassRequestVO.setPageSize(500); + queryOfsSKUClassRequestVO.setLastUpdated_start(startTimeStr); + queryOfsSKUClassRequestVO.setLastUpdated_end(endTimeStr); List skuClasses = querySkuClass(queryOfsSKUClassRequestVO); - System.out.println(skuClasses); + + //过滤日志 + List filterSKUClasss = filterData(skuClasses); + + //推送 + implement(filterSKUClasss); } catch (Exception e) { @@ -126,7 +176,16 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { */ public void start(String className) { try { - implement(); + QueryOfsSKUClassRequestVO queryOfsSKUClassRequestVO = new QueryOfsSKUClassRequestVO(); + queryOfsSKUClassRequestVO.setCInvCCode(className); + List skuClasses = querySkuClass(queryOfsSKUClassRequestVO); + + //过滤日志 + List filterGoodsClass = filterData(skuClasses); + + //推送 + implement(filterGoodsClass); + } catch (Exception e) { logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,start(String className)方法报错:", e); } @@ -141,115 +200,293 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { Date business_end = DateUtil.parse(endTime); String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00"; String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59"; - - QueryOfsSKUClassRequestVO queryOfsSKUClassRequestVO = new QueryOfsSKUClassRequestVO(); - queryOfsSKUClassRequestVO.setCreated_start(start); - queryOfsSKUClassRequestVO.setCreated_end(end); - queryOfsSKUClassRequestVO.setClientCode("LETS"); - queryOfsSKUClassRequestVO.setPageNo(1); - queryOfsSKUClassRequestVO.setPageSize(500); - querySkuClass(queryOfsSKUClassRequestVO); + queryOfsSKUClassRequestVO.setLastUpdated_start(start); + queryOfsSKUClassRequestVO.setLastUpdated_end(end); + List skuClasses = querySkuClass(queryOfsSKUClassRequestVO); + //过滤日志 + List filterGoodsClass = filterData(skuClasses); + + //推送 + implement(filterGoodsClass); } catch (Exception e) { logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,start(String startTime, String endTime)方法报错:", e); } } - public void filterGoodsClass() { - return; + public List filterData(List skuClasses) { + List filterSKUClasss = new ArrayList<>(); + for (OFSSKUClassSearchResponse.SKUClass skuClass : skuClasses) { + String rootAppPk = skuClass.getCInvCCode()+"_"+skuClass.getLastUpdated(); + boolean isExis = true; + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); + if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { + isExis = false; + } + if (!isExis) { + filterSKUClasss.add(skuClass); + } + } + return filterSKUClasss; } /** * U8C分类规则 XX-XXX-XX,自动截断 * eg: - * 一级:AA - * 二级:AA001,自动识别为AA的下级 - * 三级:AA00101自动识别为AA001的下级 + * 一级:AA + * 二级:AA001,自动识别为AA的下级 的001 + * 三级:AA0010001自动识别为AA001的下级 的0001 */ - public void implement() { - - //生成业务日期 - String businessFormat = ""; - String mapStr=""; - - - String invclasscode=null; - String invclassname=null; - try { - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 定义日期格式 - Date date = new Date(System.currentTimeMillis()); // 创建Date对象 - businessFormat = sdf.format(date); // 将Date对象格式化为字符串 - - - + public void implement(List filterSKUClasss) { + String mapStr=null; + String businessFormat=null; + for (OFSSKUClassSearchResponse.SKUClass skuClass : filterSKUClasss) { + businessFormat=skuClass.getLastUpdated(); List bdInvclEntities = new ArrayList<>(); + try { + String url = null; + System.out.println(skuClass); + String skuId = skuClass.getId(); + //查询该id再u8c是否有数据,没有则是新增,有则是修改 + BdInvclEntity bdInvclEntity = new BdInvclEntity(); + bdInvclEntity.setDr(0); + bdInvclEntity.setForinvname(skuId); + bdInvclEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List bdInvclEntityList = bdInvclDao.query(bdInvclEntity); - BdInvclEntity bdInvclEntity = new BdInvclEntity(); - - //分类编码-invclasscode - invclasscode = "AA004"; - bdInvclEntity.setInvclasscode(invclasscode); - - //分类名称-invclassname - invclassname = "分类名称:AA004"; - - bdInvclEntity.setInvclassname(invclassname); - //公司编码-pk_corp - String pk_corp = "1001"; - bdInvclEntity.setPk_corp(pk_corp); - //分类级别-invclasslevel - bdInvclEntities.add(bdInvclEntity); - - String jsonStr = JSONUtil.toJsonStr(bdInvclEntities); - - Map map = new HashMap<>(); - map.put("invcl", jsonStr); - mapStr = JSONUtil.toJsonStr(map); - - String response = pushDataByU8cUtil.pushU8CByPK(OverallConstant.getOverAllValue("bdinvclSave"), mapStr); - System.out.println(response); - boolean isSuccess = false; - if (response != null && !"".equals(response)) { - ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - if ("success".equals(reusltStrDto.getStatus())) { - isSuccess = true; + BdInvclEntity bdInvcl = new BdInvclEntity(); + if (bdInvclEntityList.size() == 0) { + bdInvclEntity.setForinvname(null); + bdInvclEntity.setInvclasscode(skuClass.getCInvCCode()); + bdInvclEntity.setInvclassname(skuClass.getCInvCName()); + List bdInvclEntityList1 = bdInvclDao.query(bdInvclEntity); + System.out.println(bdInvclEntityList1); + if (bdInvclEntityList1.size()==1) { + //修改 + url = OverallConstant.getOverAllValue("bdinvclUpdateCode"); + bdInvclEntity.setPk_invcl(bdInvclEntityList1.get(0).getPkInvcl()); + }else if (bdInvclEntityList1.size()==0) { + //新增 + url = OverallConstant.getOverAllValue("bdinvclSaveCode"); + } + } else if (bdInvclEntityList.size() == 1) { + //修改 + url = OverallConstant.getOverAllValue("bdinvclUpdateCode"); + bdInvclEntity.setPk_invcl(bdInvclEntityList.get(0).getPkInvcl()); + } else { + Assert.state(false, ""); } + + //组装数据 + //分类编码-invclasscode + bdInvclEntity.setInvclasscode(skuClass.getCInvCCode()); + //分类名称-invclassname + bdInvclEntity.setInvclassname(skuClass.getCInvCName()); + //公司编码-pk_corp + bdInvclEntity.setPk_corp("0001"); + //外文名 forinvname(ofs存货分类id) + bdInvclEntity.setForinvname(skuId); + + //推送 + bdInvclEntities.add(bdInvclEntity); + String jsonStr = JSONUtil.toJsonStr(bdInvclEntities); + Map map = new HashMap<>(); + map.put("invcl", jsonStr); + mapStr = JSONUtil.toJsonStr(map); + ZTResult ztResult = pushU8CByApiCode.pushByCode(url, mapStr); + //两层判断,一层中台转发,一层u8c返回 + if ("false".equals(ztResult.getFlag())) { + //转发失败 + Assert.state(false, "丽知:OFS货品档案分类--->U8C货品档案分类.中台转发失败,失败原因:{}", ztResult.getAttribute().getErrormsg()); + } + Attribute attribute = ztResult.getAttribute(); + System.out.println(attribute); + + boolean isSuccess = false; + String invclasscode = ""; + if ("success".equals(attribute.getStatus())) { + isSuccess = true; + String data = attribute.getData(); + BdInvclEntity resBdInvclEntity = resultDataHandle(data); + System.out.println(resBdInvclEntity); + invclasscode = resBdInvclEntity.getInvclasscode(); + } + if (!isSuccess) { + Assert.state(false, "丽知:OFS货品档案分类--->U8C货品档案分类 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr); + } + //成功 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); + integrationTaskLivingDetailsEntity.setRootAppPk(invclasscode+"_"+businessFormat); + integrationTaskLivingDetailsEntity.setRootAppBill(invclasscode); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + }catch (Exception e){ + e.printStackTrace(); + logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,implement()方法报错:", e); + //失败 + String ErrMessage = e.getMessage(); + + //失败 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); + integrationTaskLivingDetailsEntity.setRootAppPk(skuClass.getCInvCCode()+"_"+businessFormat); + integrationTaskLivingDetailsEntity.setRootAppBill(skuClass.getCInvCCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - if (!isSuccess) { - Assert.state(false, "推送U8C-->丽知:OFS货品档案分类--->U8C货品档案分类失败 接口返回结果:{} 接口入参:{}", response, jsonStr); - } - //成功 - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); - integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(invclasscode); - integrationTaskLivingDetailsEntity.setRootAppBill(invclassname); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - } catch (Exception e) { - e.printStackTrace(); - logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,implement()方法报错:", e); - //失败 - String ErrMessage = e.getMessage(); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); - integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(invclasscode); - integrationTaskLivingDetailsEntity.setRootAppBill(invclassname); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } + } +// +// //查询pk_corp=0001下的所有分类 +// List bdInvclEntities = queryU8CAllInvcl(); +// //将pk_corp=0001下的所有分类分为123级 +// List u8cLevel1 = new ArrayList<>();//length==2 +// List u8cLevel2 = new ArrayList<>();//length==5 +// List u8cLevel3 = new ArrayList<>();//length==9 +// for (BdInvclEntity bdInvclEntity : bdInvclEntities) { +// switch (bdInvclEntity.getInvclasscode().length()) { +// case 2: System.out.println("U8C:1级分类:" + bdInvclEntity.getInvclasscode()); u8cLevel1.add(bdInvclEntity); break; +// case 5: System.out.println("U8C:2级分类:" + bdInvclEntity.getInvclasscode()); u8cLevel2.add(bdInvclEntity); break; +// case 9: System.out.println("U8C:3级分类:" + bdInvclEntity.getInvclasscode()); u8cLevel3.add(bdInvclEntity); break; +// } +// } +// +// List ofsLevel1 = new ArrayList<>();//length==2 +// List ofsLevel2 = new ArrayList<>();//length==5 +// List ofsLevel3 = new ArrayList<>();//length==9 +// for (OFSSKUClassSearchResponse.SKUClass ofsSKUClass : filterSKUClasss) { +// switch (ofsSKUClass.getCInvCCode().length()) { +// case 2: System.out.println("OFS:1级分类:" + ofsSKUClass.getCInvCCode()); ofsLevel1.add(ofsSKUClass); break; +// case 5: System.out.println("OFS:2级分类:" + ofsSKUClass.getCInvCCode()); ofsLevel2.add(ofsSKUClass); break; +// case 9: System.out.println("OFS:3级分类:" + ofsSKUClass.getCInvCCode()); ofsLevel3.add(ofsSKUClass); break; +// } +// } +// System.out.println(1111); +// +// +// //分三次推送,按顺序123 +// if(ofsLevel1!=null&&ofsLevel1.size()>0){ +// specificImplement(ofsLevel1,u8cLevel1); +// } +// if(ofsLevel2!=null&&ofsLevel2.size()>0){ +// specificImplement(ofsLevel2,u8cLevel2); +// } +// if(ofsLevel3!=null&&ofsLevel3.size()>0){ +// specificImplement(ofsLevel3,u8cLevel3); +// } + + +// //生成业务日期 +// String businessFormat = ""; +// String mapStr=""; +// +// +// String invclasscode=null; +// String invclassname=null; +// try { +// +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 定义日期格式 +// Date date = new Date(System.currentTimeMillis()); // 创建Date对象 +// businessFormat = sdf.format(date); // 将Date对象格式化为字符串 +// +// +// +// +// List bdInvclEntities = new ArrayList<>(); +// +// BdInvclEntity bdInvclEntity = new BdInvclEntity(); +// +// //分类编码-invclasscode +// invclasscode = "AA004"; +// bdInvclEntity.setInvclasscode(invclasscode); +// +// //分类名称-invclassname +// invclassname = "分类名称:AA004"; +// +// bdInvclEntity.setInvclassname(invclassname); +// //公司编码-pk_corp +// String pk_corp = "1001"; +// bdInvclEntity.setPk_corp(pk_corp); +// //分类级别-invclasslevel +// bdInvclEntities.add(bdInvclEntity); +// +// String jsonStr = JSONUtil.toJsonStr(bdInvclEntities); +// +// Map map = new HashMap<>(); +// map.put("invcl", jsonStr); +// mapStr = JSONUtil.toJsonStr(map); +// +// String response = pushDataByU8cUtil.pushU8CByPK(OverallConstant.getOverAllValue("bdinvclSave"), mapStr); +// System.out.println(response); +// boolean isSuccess = false; +// if (response != null && !"".equals(response)) { +// ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); +// if ("success".equals(reusltStrDto.getStatus())) { +// isSuccess = true; +// } +// } +// if (!isSuccess) { +// Assert.state(false, "推送U8C-->丽知:OFS货品档案分类--->U8C货品档案分类失败 接口返回结果:{} 接口入参:{}", response, jsonStr); +// } +// //成功 +// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); +// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); +// integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); +// integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); +// integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); +// integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); +// integrationTaskLivingDetailsEntity.setRootAppPk(invclasscode); +// integrationTaskLivingDetailsEntity.setRootAppBill(invclassname); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// +// +// } catch (Exception e) { +// e.printStackTrace(); +// logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,implement()方法报错:", e); +// //失败 +// String ErrMessage = e.getMessage(); +// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); +// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); +// integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); +// integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); +// integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); +// integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); +// integrationTaskLivingDetailsEntity.setRootAppPk(invclasscode); +// integrationTaskLivingDetailsEntity.setRootAppBill(invclassname); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// } +// } + + /** + * 具体推送,支持新增,删除,修改 + * 根据编码和名称对应 + * ofs的id传U8C的forinvname + * + * @param ofsLevel OFS中的存货分类 + * @param u8cLevel U8C中的存货分类 + */ + public void specificImplement(List ofsLevel,List u8cLevel){ + + } @@ -257,19 +494,63 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { * OFS存货分类查询 */ public List querySkuClass(QueryOfsSKUClassRequestVO queryOfsSKUClassRequestVO) throws Exception { + + int pageNo = 1; + int pageSize = 500; + + List all = new ArrayList<>(); + InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); interfaceParamDto.setApi("ofs.inventory.class.search"); queryOfsSKUClassRequestVO.setClientCode("LETS"); + queryOfsSKUClassRequestVO.setPageNo(pageNo); + queryOfsSKUClassRequestVO.setPageSize(pageSize); interfaceParamDto.setData(JSON.toJSONString(queryOfsSKUClassRequestVO)); - OFSSKUClassSearchResponse ofsskuClassSearchResponse =(OFSSKUClassSearchResponse) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); - System.out.println(ofsskuClassSearchResponse); - List data = ofsskuClassSearchResponse.getData(); - if(data==null||data.size()==0){ + OFSSKUClassSearchResponse ofsskuClassSearchResponse = (OFSSKUClassSearchResponse) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); + + all.addAll(ofsskuClassSearchResponse.getData()); + + int count = ofsskuClassSearchResponse.getData().size(); + while (count >= pageSize) {//>=500,可能还有下一页。 + //还有下一页 + pageNo++; + queryOfsSKUClassRequestVO.setPageNo(pageNo); + interfaceParamDto.setData(JSON.toJSONString(queryOfsSKUClassRequestVO)); + OFSSKUClassSearchResponse ofsskuClassSearchResponse1 = (OFSSKUClassSearchResponse) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); + all.addAll(ofsskuClassSearchResponse1.getData()); + count = ofsskuClassSearchResponse1.getData().size(); + } + if (all == null || all.size() == 0) { return null; } - - return data; + return all; } + /** + * 查询u8c中pk_corp=0001下的所有分类(集团) + */ + public List queryU8CAllInvcl() { + BdInvclEntity bdInvclEntity = new BdInvclEntity(); + bdInvclEntity.setDr(0); + bdInvclEntity.setPkCorp("0001"); + bdInvclEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List bdInvclEntityList = bdInvclDao.query(bdInvclEntity); + return bdInvclEntityList; + } + private BdInvclEntity resultDataHandle(String resultData) { + try { + if (resultData != null && !"".equals(resultData)) { + if (resultData.contains("[")) { + resultData = resultData.substring(1, resultData.length() - 1); + } + return JSON.parseObject(resultData, BdInvclEntity.class); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("解析返回参数失败的错误", e); + //如果解析失败,记录原因,但是不能影响结果的记录 + } + return null; + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java index cff6274c..92b59d43 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java @@ -11,15 +11,13 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; import com.hzya.frame.plugin.lets.queryvo.CustdocRequestVo; import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo; -import com.hzya.frame.plugin.lets.resultvo.ShopReturnMessageDto; import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto; +import com.hzya.frame.plugin.lets.u8cdto.DefdocRequestVo; import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil; import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; -import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto; -import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto; import com.hzya.frame.ttxofs.service.OfsUnifiedService; @@ -27,7 +25,6 @@ import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -124,10 +121,13 @@ public class ShopPluginInitializer extends PluginBaseEntity { shopEntity.setLastUpdated_start(startDate); shopEntity.setLastUpdated_end(endDate); shopEntity.setPageNo("1"); - shopEntity.setPageNo("1"); + List list = queryfromofs(shopEntity); List shopEntities = filterShopEntity(list); - implement(shopEntities); + implementcustdoc(shopEntities); + + List list1 = filterShopEntityDef(list); + implementdef(list1); } catch (Exception e) { e.printStackTrace(); @@ -154,10 +154,13 @@ public class ShopPluginInitializer extends PluginBaseEntity { shopEntity.setClientCode("LETS"); List list = queryfromofs(shopEntity); - //过滤数据 - List ofsShopDtoList = filterShopEntity(list); - //同步u8c - implement(ofsShopDtoList); + List shopEntities = filterShopEntity(list); + //同步到客商档案 + implementcustdoc(shopEntities); + + List list1 = filterShopEntityDef(list); + //同步到自定义档案 + implementdef(list1); } catch (Exception e) { logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,startImplement()方法报错:", e); @@ -177,16 +180,20 @@ public class ShopPluginInitializer extends PluginBaseEntity { List list = queryfromofs(shopEntity); //过滤数据 List shopEntities = filterShopEntity(list); - //执行 - implement(shopEntities); + //同步到客商档案 + implementcustdoc(shopEntities); + List list1 = filterShopEntityDef(list); + //同步到自定义档案 + implementdef(list1); } catch (Exception e) { logger.error("丽知:OFS店铺档案--->U8C客商档案,startImplement(String code)方法报错:", e); } } - @Transactional - public void implement(List shopEntityList) { + + + public void implementcustdoc(List shopEntityList) { Assert.notNull(shopEntityList, "shopEntityList不能为空"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -200,9 +207,8 @@ public class ShopPluginInitializer extends PluginBaseEntity { CustdocRequestVo custdocRequestVo = new CustdocRequestVo(); parentvo.setCustname(shopEntity.getName()); parentvo.setCustshortname(shopEntity.getName()); - + //业务编码 parentvo.setDef1(shopEntity.getBizCode()); - custdocRequestVo.setParentvo(parentvo); //同步u8c HashMap param = new HashMap<>(); @@ -256,8 +262,81 @@ public class ShopPluginInitializer extends PluginBaseEntity { logger.error("丽知:OFS店铺档案--->U8C客商档案,implement()方法报错:", e); } } + } + public void implementdef(List shopEntityList) { + Assert.notNull(shopEntityList, "shopEntityList不能为空"); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = new Date(System.currentTimeMillis()); + String businessFormat = sdf.format(date); + for (OfsShopDto shopEntity : shopEntityList) { + + try { + + DefdocRequestVo defdocRequestVo = new DefdocRequestVo(); + defdocRequestVo.setDoccode(shopEntity.getBizCode()); + defdocRequestVo.setDocname(shopEntity.getName()); + defdocRequestVo.setPk_corp("0001"); + //店铺自定义档案主键 + defdocRequestVo.setPk_defdoclist("0001A210000000000XZX"); + //TOB C + defdocRequestVo.setMemo(shopEntity.getBusiness()); + ArrayList requestVos = new ArrayList<>(); + requestVos.add(defdocRequestVo); + HashMap map = new HashMap<>(); + map.put("defdoc", requestVos); + + //同步u8c + String jsonString = JSONObject.toJSONString(map); + String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("bddefdoclistsave"), jsonString); + System.out.println(response); + if (response != null) { + CbdocResultVo cbdocResultVo = JSONObject.parseObject(response, CbdocResultVo.class); + String taskNumber = null; + boolean isSuccess = false; + if ("success".equals(cbdocResultVo.getStatus())) { + isSuccess = true; + taskNumber = cbdocResultVo.getTaskNumber(); + String data = cbdocResultVo.getData(); + } + + if (!isSuccess) { + Assert.state(false, "同步到U8C失败,原因:{} 接口入参:{} {}", JSON.toJSONString(cbdocResultVo), JSON.toJSONString(OverallConstant.getOverAllValue("custdocSave")), JSON.toJSONString(cbdocResultVo)); + } + // 根据返回结果记录日志 + //成功 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(jsonString); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(cbdocResultVo)); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); + integrationTaskLivingDetailsEntity.setRootAppPk("defdoc"+shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getName()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// CbdocResultVo cbdocResultVo1 = JSONObject.parseObject(response, CbdocResultVo.class); +// String errormsg = cbdocResultVo1.getErrormsg(); + } + + } catch (Exception e) { + e.printStackTrace(); + String ErrMessage = e.getMessage(); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSONObject.toJSONString(shopEntity)); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); + integrationTaskLivingDetailsEntity.setRootAppPk("defdoc"+shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getName()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e); + } + } } public List filterShopEntity(List list) { @@ -287,6 +366,33 @@ public class ShopPluginInitializer extends PluginBaseEntity { } + + public List filterShopEntityDef(List list) { + Assert.notNull(list, "不能为空!"); + List shopEntityList = new ArrayList<>(); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + OfsShopDto ofsShopDto = list.get(i); + + if (ofsShopDto.getBizCode() != null && !"".equals(ofsShopDto.getBizCode().trim())) { + boolean isExis = true; + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setRootAppPk("defdoc"+ofsShopDto.getBizCode()); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); + if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { + isExis = false; + } + if (!isExis) { + shopEntityList.add(ofsShopDto); + } + } + } + } + return shopEntityList; + } + public List queryfromofs(OfsShopDto shopEntity) { InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); interfaceParamDto.setApi("ofs.store.search"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java index e4f4185d..62754efe 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java @@ -10,7 +10,7 @@ import com.hzya.frame.plugin.lets.constant.OverallConstant; import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; - +import com.hzya.frame.plugin.lets.queryvo.BankVo; import com.hzya.frame.plugin.lets.queryvo.CustdocRequestVo; import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo; @@ -125,7 +125,6 @@ public class SupplierPluginInitializer extends PluginBaseEntity { OfsSupplierDto supplierEntity = new OfsSupplierDto(); supplierEntity.setClientCode("LETS"); - supplierEntity.setCompanyCode("LETS"); supplierEntity.setPageNo("1"); supplierEntity.setLastUpdated_start(startTimeStr); supplierEntity.setLastUpdated_end(endTimeStr); @@ -151,7 +150,6 @@ public class SupplierPluginInitializer extends PluginBaseEntity { OfsSupplierDto supplierEntity = new OfsSupplierDto(); supplierEntity.setBizCode(code); supplierEntity.setClientCode("LETS"); - supplierEntity.setCompanyCode("LETS"); supplierEntity.setPageNo("1"); List list = queryfromofs(supplierEntity); @@ -174,7 +172,6 @@ public class SupplierPluginInitializer extends PluginBaseEntity { supplierDto.setLastUpdated_start(startTime); supplierDto.setLastUpdated_end(endTime); supplierDto.setClientCode("LETS"); - supplierDto.setCompanyCode("LETS"); supplierDto.setPageNo("1"); List queryfromofs = queryfromofs(supplierDto); //过滤数据 @@ -195,6 +192,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity { String businessFormat = sdf.format(date); for (OfsSupplierDto supplierEntity : shopEntityList) { CustdocEntityDto parentvo = new CustdocEntityDto(); + BankVo bankVo = new BankVo(); CustdocRequestVo CustdocEntityDto = new CustdocRequestVo(); try { //T 设置parentvo @@ -205,6 +203,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity { parentvo.setDef1(supplierEntity.getBizCode()); CustdocEntityDto.setParentvo(parentvo); + // 同步u8c HashMap param = new HashMap<>(); param.put("cbdocvo", CustdocEntityDto); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocListRequestVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocListRequestVo.java new file mode 100644 index 00000000..a334624c --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocListRequestVo.java @@ -0,0 +1,20 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import lombok.Data; + +import java.util.List; + +/** + * @Author sx + * @Date 2024/8/21 10:39 + * @PackageName:com.hzya.frame.plugin.lets.u8cdto + * @ClassName: DefListRequestVo + * @Description: 档案内容实体_返回 + */ +@Data +public class DefdocListRequestVo { + + private List children; + private DefdocParentVo parentvo; + +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocParentVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocParentVo.java new file mode 100644 index 00000000..dd2ab6f3 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocParentVo.java @@ -0,0 +1,26 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +/** + * @Author sx + * @Date 2024/8/21 10:39 + * @PackageName:com.hzya.frame.plugin.lets.u8cdto + * @ClassName: DefDocParentVo + * @Description: + */ +public class DefdocParentVo { + private String docislevflag; + + private String doclistcode; + + private String doclistname; + + private String doclistsystype; + + private String dr; + + private String iscorpcanchg; + + private String pk_defdoclist; + + private String ts; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocRequestVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocRequestVo.java new file mode 100644 index 00000000..2d175a9d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/DefdocRequestVo.java @@ -0,0 +1,32 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import lombok.Data; + +/** + * @Author sx + * @Date 2024/8/21 10:29 + * @PackageName:com.hzya.frame.plugin.lets.u8cdto + * @ClassName: DefdocRequestVo + * @Description: 自定义档案内容 + */ +@Data +public class DefdocRequestVo { + private String doccode; + + private String docname; + + private String docsystype; + private String dr; + private String memo; + + private String pk_corp; + private String pk_defdoc; + + private String pk_defdoc1; + + private String pk_defdoclist; + private String sealflag; + + private String shortname; + private String ts; +} diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java index 29628233..7951dc9b 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java @@ -40,7 +40,11 @@ public class BaseTest { } @Test public void t21(){ - skuClassPluginInitializer.start("2024-08-15","2024-08-16"); + skuClassPluginInitializer.start("ZN001"); + } + @Test + public void t22(){ + skuClassPluginInitializer.start("2024-08-23","2024-08-25"); } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/ShopTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/ShopTest.java index 09424f42..9f67ca8e 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/ShopTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/ShopTest.java @@ -18,6 +18,7 @@ import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierDto; +import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierReturnMessageDto; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import org.checkerframework.checker.units.qual.C; import org.junit.Test; @@ -71,7 +72,7 @@ public class ShopTest { //// String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); //// shopEntity.setLastUpdated_start("2024-03-10 16:06:57"); //// shopEntity.setLastUpdated_end("2024-03-12 16:06:57"); -// shopEntity.setBizCode("hzz"); +//// shopEntity.setBizCode("hzz"); // InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); // interfaceParamDto.setApi("ofs.store.search"); // interfaceParamDto.setData(JSON.toJSONString(shopEntity)); @@ -85,27 +86,6 @@ public class ShopTest { // System.out.println("data = " + data); - OfsSupplierDto shopEntity = new OfsSupplierDto(); -// shopEntity.setLastUpdated_start("2021-08-01 00:00:00"); - shopEntity.setPageNo("1"); - shopEntity.setClientCode("LETS"); - shopEntity.setCompanyCode("LETS"); - shopEntity.setBizCode("983"); - Date currentDate = new Date(); -// shopEntity.setLastUpdated_start("2023-07-27 16:06:57"); -// shopEntity.setLastUpdated_end("2023-07-28 16:06:57"); - InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); - interfaceParamDto.setApi("ofs.vendor.search"); - interfaceParamDto.setData(JSON.toJSONString(shopEntity)); - OfsShopReturnMessageDto unified = null; - try { - unified = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); - } catch (Exception e) { - throw new RuntimeException(e); - } - List data = unified.getData(); - System.out.println("data = " + data); - // SupplierEntity supplierEntity = new SupplierEntity(); // supplierEntity.setPageNo("1"); @@ -121,17 +101,10 @@ public class ShopTest { // } catch (Exception e) { // throw new RuntimeException(e); // } - -// ArrayList shopEntities = new ArrayList<>(); -// ShopEntity shopEntity = new ShopEntity(); -// shopEntity.setBizCode("intoyou-xhs"); -// shopEntity.setName("小红书INTO YOU心慕与你旗舰店-自营1test1a1231"); -// shopEntity.setCustomerCode("testcode211232411"); -// shopEntities.add(shopEntity); -// shopPluginInitializer.implement(shopEntities); -// System.out.println("shopEntities = " + shopEntities); // +//// + // try { // System.out.println("开始推送"); // //分配给所有公司 @@ -169,5 +142,53 @@ public class ShopTest { // custmandocPluginInitializer.implement(list); // custdocAutoAllotPluginInitializer.start(); + + shopPluginInitializer.startImplement("test11123"); +// supplierPluginInitializer.startImplement("test1234"); +// +// OfsShopDto shopEntity = new OfsShopDto(); +//// shopEntity.setLastUpdated_start("2021-08-01 00:00:00"); +// shopEntity.setPageNo("1"); +// shopEntity.setPageSize("500"); +// shopEntity.setClientCode("LETS"); +// shopEntity.setBizCode("test1234"); +//// Date currentDate = new Date(); +//// Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10); +//// Date endTime = DateUtil.offset(currentDate, DateField.MINUTE, -2); +//// String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"); +//// String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); +//// shopEntity.setLastUpdated_start("2024-03-10 16:06:57"); +//// shopEntity.setLastUpdated_end("2024-03-12 16:06:57"); +// InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); +// interfaceParamDto.setApi("ofs.store.search"); +// interfaceParamDto.setData(JSON.toJSONString(shopEntity)); +// OfsShopReturnMessageDto unified = null; +// try { +// unified = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// List data = unified.getData(); +// shopPluginInitializer.startImplement(); + +// OfsSupplierDto shopEntity = new OfsSupplierDto(); +//// shopEntity.setLastUpdated_start("2021-08-01 00:00:00"); +// shopEntity.setPageNo("1"); +// shopEntity.setClientCode("LETS"); +//// shopEntity.setCompanyCode("LETS"); +//// shopEntity.setBizCode("test1234"); +// InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); +// interfaceParamDto.setApi("ofs.vendor.search"); +// interfaceParamDto.setData(JSON.toJSONString(shopEntity)); +// OfsSupplierReturnMessageDto unified = null; +// try { +// unified = (OfsSupplierReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// List data = unified.getData(); +// +// supplierPluginInitializer.implement(data); + } } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java index 6ec4aa37..b32b3917 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java @@ -82,11 +82,16 @@ public class TransferTest { } @Test public void t41(){ - adjustOutPluginInitializer.start("LETS-SH2024080900000001"); + adjustOutPluginInitializer.start("LETS-SH2024082200000008"); } @Test public void t42(){ adjustOutPluginInitializer.start("2024-08-08","2024-08-13"); } + @Test + public void t43() throws Exception { + adjustOutPluginInitializer.queryOfsAdjustOrders("LETS-AH2024082200000001"); + } + } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java index 24f0a3d3..67b37742 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java @@ -4,6 +4,7 @@ import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OFSSKUClassSearchResponse; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OFSSKUSearchResponse; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierReturnMessageDto; +import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSAdjustOrderSearchResponse; import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSTranseferOrderSearchResponse; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean; import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderBean; @@ -45,5 +46,6 @@ public class ApiDtoCacheMap { apiDtoCacheMap.put("ofs.purchaseOrder.search", new OfsPoOrderBean());//采购订单 apiDtoCacheMap.put("ofs.purchaseReturnOrder.search", new PurchaseReturnOrderBean());//采退订单 + apiDtoCacheMap.put("ofs.adjustOrder.search", new OFSAdjustOrderSearchResponse());//调整单 } } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSSKUClassSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSSKUClassSearchResponse.java index 15d09ec0..6d2da8c2 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSSKUClassSearchResponse.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSSKUClassSearchResponse.java @@ -3,7 +3,6 @@ package com.hzya.frame.ttxofs.dto.ofsBaseSearch; import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; import lombok.Data; -import java.util.Date; import java.util.List; /** @@ -18,9 +17,9 @@ public class OFSSKUClassSearchResponse extends ReturnMessageBasics { private String clientCode; private String cInvCCode; private String cInvCName; - private Date created; + private String created; private String createdBy; - private Date lastUpdated; + private String lastUpdated; private String lastUpdatedBy; } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OfsShopDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OfsShopDto.java index 7e83e76e..6f12f7e4 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OfsShopDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OfsShopDto.java @@ -19,6 +19,8 @@ public class OfsShopDto { // 货主编码 private String companyCode; private Integer status; + //业务类型 TOB C + private String business; private String created; diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsTransferOrderSearch/OFSAdjustOrderSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsTransferOrderSearch/OFSAdjustOrderSearchResponse.java new file mode 100644 index 00000000..67cdbc83 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsTransferOrderSearch/OFSAdjustOrderSearchResponse.java @@ -0,0 +1,74 @@ +package com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch; + +import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class OFSAdjustOrderSearchResponse extends ReturnMessageBasics { + private List data; + @Data + public class OFSAdjustOrder{ + private OFSAdjustH header; + private List details; + + @Data + public class OFSAdjustH{ + private String id; + private String clientCode; + private String companyCode; + private String facilityCode; + private String code; + private String adjustType; + private String status; + private String totalLines; + private String totalQty; + private String quantityUM; + private String totalWeight; + private String totalVolume; + private String totalVolumeWeight; + private String weightUM; + private String volumeUM; + private String errorCode; + private String errorDesc; + private String StringernalOrderType; + private String bizChannel; + private String created; + private String createdBy; + private String lastUpdated; + private String lastUpdatedBy; + private String remark; + private String sourcePlatformCode; + } + @Data + public class OFSAdjustB{ + /** id */ + private String id; + private String clientCode; + private String companyCode; + private String facilityCode; + private String adjustOrderId; + private String adjustOrderCode; + private String skuCode; + private String skuName; + private String inventorySts; + private String totalWeight; + private String totalVolume; + private String weightUM; + private String volumeUM; + private String requestQty; + private String hasAdjustQty; + private String waitAdjustQty; + private String created; + private String createdBy; + private String lastUpdated; + private String lastUpdatedBy; + private String totalVolumeWeight; + private String quantityUM; + } + + } + +}