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 42432aa0..6d33baed 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 @@ -64,8 +64,10 @@ public class OverallConstant { prodOverPublic.put("custmandocSave", "/u8cloud/api/uapbd/custmandoc/insert");//客商档案新增 prodOverPublic.put("bdcorpQueryCode", "8000370060");//公司档案查询 prodOverPublic.put("bdcorpQuery", "/u8cloud/api/uapbd/bdcorp/query");//公司档案查询 - prodOverPublic.put("bddefdoclistsaveCode", "8000370061");//自定义档案内容查询 - prodOverPublic.put("bddefdoclistsave", "/u8cloud/api/uapbd/bddefdoc/insert");//自定义档案内容查询 + + + prodOverPublic.put("bddefdoclistsaveCode", "8000370061");//自定义档案内容新增 + prodOverPublic.put("bddefdoclistUpdateCode", "8000370070");//自定义档案内容更新 //应收单 prodOverPublic.put("arapYsInsertApproveCode", "8000370069");//自定义档案内容查询 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 5080b59c..112cc092 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 @@ -9,12 +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.IBdCubasdocDao; +import com.hzya.frame.plugin.lets.dao.IBdDefdocDao; +import com.hzya.frame.plugin.lets.dao.IBdDefdoclistDao; +import com.hzya.frame.plugin.lets.entity.BdCubasdocEntity; +import com.hzya.frame.plugin.lets.entity.BdDefdocEntity; +import com.hzya.frame.plugin.lets.entity.BdDefdoclistEntity; import com.hzya.frame.plugin.lets.queryvo.CustdocRequestVo; -import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo; 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.QueryU8CEntityUtil; 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; @@ -31,7 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -40,10 +44,11 @@ import java.util.concurrent.locks.ReentrantLock; /** * @Author - * @Date 2024/8/6 14:36 + * @Date 2025/01/04 10:58 重写 * @PackageName:com.hzya.frame.plugin.lets.plugin.base * @ClassName: ShopPluginInitializer - * @Description: 店铺->U8C客商档案 + * @Description: 店铺->U8C客商档案,自定义档案新增 + * 根据编码来判断新增还是更新 */ public class ShopPluginInitializer extends PluginBaseEntity { @@ -98,6 +103,10 @@ public class ShopPluginInitializer extends PluginBaseEntity { @Autowired private PushU8CByApiCode pushU8CByApiCode; + @Autowired + private QueryU8CEntityUtil queryU8CEntityUtil; + @Autowired + private IBdCubasdocDao iBdCubasdocDao; @Override @@ -145,15 +154,24 @@ public class ShopPluginInitializer extends PluginBaseEntity { OfsShopDto shopEntity = new OfsShopDto(); shopEntity.setLastUpdated_start(start); shopEntity.setLastUpdated_end(end); - shopEntity.setPageNo("1"); - List list = queryfromofs(shopEntity); - //过滤数据 - List shopEntities = filterShopEntity(list); - implementcustdoc(shopEntities); + if (list == null || list.size() == 0) { + return; + } - List list1 = filterShopEntityDef(list); - implementdef(list1); + //过滤数据,客商基本档案新增 + List filterShopData = filterShop(list); + if (filterShopData == null || filterShopData.size() == 0) { + return; + } + implementShop(filterShopData); + + //过滤数据,自定义项推送 + List filterDefData = filterDef(list); + if (filterDefData == null || filterDefData.size() == 0) { + return; + } + implementDef(filterDefData); } catch (Exception e) { logger.error("丽知:OFS店铺档案--->U8C客商档案,start()方法报错:", e); @@ -176,66 +194,160 @@ public class ShopPluginInitializer extends PluginBaseEntity { OfsShopDto shopEntity = new OfsShopDto(); shopEntity.setLastUpdated_start(startTimeStr); shopEntity.setLastUpdated_end(endTimeStr); - shopEntity.setPageNo("1"); - shopEntity.setClientCode("LETS"); List list = queryfromofs(shopEntity); + if (list == null || list.size() == 0) { + return; + } - List shopEntities = filterShopEntity(list); - //同步到客商档案 - implementcustdoc(shopEntities); + //过滤数据,客商基本档案新增 + List filterShopData = filterShop(list); + if (filterShopData == null || filterShopData.size() == 0) { + return; + } + implementShop(filterShopData); - List list1 = filterShopEntityDef(list); - //同步到自定义档案 - implementdef(list1); + //过滤数据,自定义项推送 + List filterDefData = filterDef(list); + if (filterDefData == null || filterDefData.size() == 0) { + return; + } + implementDef(filterDefData); } catch (Exception e) { - logger.error("丽知:OFS货品档案分类--->U8C货品档案分类,startImplement()方法报错:", e); + logger.error("丽知:OFS店铺档案--->U8C客商档案,startImplement()方法报错:", e); } } /** * 按编码名称 + * coed_lastDate */ public void startImplement(String code) { + String[] split = code.split("_"); try { OfsShopDto shopEntity = new OfsShopDto(); - shopEntity.setBizCode(code); - shopEntity.setClientCode("LETS"); - shopEntity.setPageNo("1"); + shopEntity.setBizCode(split[0]); List list = queryfromofs(shopEntity); - //过滤数据 - List shopEntities = filterShopEntity(list); - //同步到客商档案 - implementcustdoc(shopEntities); - List list1 = filterShopEntityDef(list); - //同步到自定义档案 - implementdef(list1); + if (list == null || list.size() == 0) { + return; + } + + //过滤数据,客商基本档案新增 + List filterShopData = filterShop(list); + if (filterShopData == null || filterShopData.size() == 0) { + return; + } + implementShop(filterShopData); + + //过滤数据,自定义项推送 + List filterDefData = filterDef(list); + if (filterDefData == null || filterDefData.size() == 0) { + return; + } + implementDef(filterDefData); } catch (Exception e) { logger.error("丽知:OFS店铺档案--->U8C客商档案,startImplement(String code)方法报错:", e); } } + /** + * code_lastDate + */ + public List filterShop(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); - public void implementcustdoc(List shopEntityList) { + if (ofsShopDto.getBizCode() != null && !"".equals(ofsShopDto.getBizCode().trim())) { + boolean isExis = true; + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setRootAppPk(ofsShopDto.getBizCode() + "_" + ofsShopDto.getLastUpdated()); + 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 filterDef(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() + "_" + ofsShopDto.getLastUpdated()); + 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 void implementShop(List shopEntityList) { Assert.notNull(shopEntityList, "shopEntityList不能为空"); String businessFormat = null; + CustdocRequestVo res_custdoc = null; + String response = ""; + String url = null; + String pk_cubasdoc = null; + BdCubasdocEntity bdCubasdocEntity_old = null; for (OfsShopDto shopEntity : shopEntityList) { businessFormat = shopEntity.getLastUpdated(); - String response = ""; try { - String lastUpdated = shopEntity.getLastUpdated(); + //查询有无该档案,看更新还是新增 + BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); + bdCubasdocEntity.setPkAreacl("0001A1100000000029X5");//HH + bdCubasdocEntity.setDef1(shopEntity.getBizCode()); + List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); + if (bdCubasdocEntityList.size() == 0) { + //新增 + url = OverallConstant.getOverAllValue("custdocSaveCode"); + } else { + //更新 + url = OverallConstant.getOverAllValue("custdocUpdate"); + pk_cubasdoc = bdCubasdocEntityList.get(0).getPkCubasdoc(); + bdCubasdocEntity_old = bdCubasdocEntityList.get(0); + } CustdocEntityDto parentvo = new CustdocEntityDto(); CustdocRequestVo custdocRequestVo = new CustdocRequestVo(); parentvo.setCustname(shopEntity.getName()); parentvo.setCustshortname(shopEntity.getName()); -// parentvo.setPk_corp("0001"); -// + //地区编码 parentvo.setPk_areacl("HH"); - //业务编码 + //def1:ofs编码 parentvo.setDef1(shopEntity.getBizCode()); + //判断更新或者新增 + if (pk_cubasdoc != null) { + parentvo.setPk_cubasdoc(pk_cubasdoc); + } custdocRequestVo.setParentvo(parentvo); //同步u8c ArrayList list = new ArrayList<>(); @@ -244,25 +356,21 @@ public class ShopPluginInitializer extends PluginBaseEntity { param.put("cbdocvo", list); String jsonString = JSONObject.toJSONString(param); -// response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocSave"), jsonString); - ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("custdocSaveCode"), jsonString); + ZTResult ztResult = pushU8CByApiCode.pushByCode(url, jsonString); Attribute attribute = ztResult.getAttribute(); if ("false".equals(ztResult.getFlag())) { //转发失败 - response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS店铺档案--->U8C客商档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); } - - String taskNumber = null; boolean isSuccess = false; if ("success".equals(attribute.getStatus())) { isSuccess = true; -// CbdocResultVo cbdocResultVo = JSONObject.parseObject(attribute.getData(), CbdocResultVo.class); -// taskNumber = cbdocResultVo.getTaskNumber(); -// String data = attribute.getData(); + String data = attribute.getData(); + List custdocList = JSONUtil.toList(data, CustdocRequestVo.class); + res_custdoc = custdocList.get(0); } if (!isSuccess) { @@ -276,12 +384,15 @@ public class ShopPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setRootAppPk(shopEntity.getBizCode() + "_" + businessFormat); integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getBizCode()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + if (res_custdoc != null) { + integrationTaskLivingDetailsEntity.setNewSystemNumber(res_custdoc.getParentvo().getCustcode()); + integrationTaskLivingDetailsEntity.setNewSystemPrimary(res_custdoc.getParentvo().getPk_cubasdoc()); + } saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - } catch (Exception e) { logger.error("丽知:OFS店铺档案--->U8C客商档案,implement()方法报错:", e); String ErrMessage = e.getMessage(); @@ -291,88 +402,142 @@ public class ShopPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setRootAppPk(shopEntity.getBizCode() + "_" + businessFormat); integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getBizCode()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + if (bdCubasdocEntity_old != null) { + integrationTaskLivingDetailsEntity.setNewSystemNumber(bdCubasdocEntity_old.getCustcode()); + integrationTaskLivingDetailsEntity.setNewSystemPrimary(bdCubasdocEntity_old.getPkCubasdoc()); + } saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - } } } + @Autowired + private IBdDefdoclistDao iBdDefdoclistDao; + @Autowired + private IBdDefdocDao iBdDefdocDao; - public void implementdef(List shopEntityList) { + + public void implementDef(List shopEntityList) { Assert.notNull(shopEntityList, "shopEntityList不能为空"); String businessFormat = null; - for (OfsShopDto shopEntity : shopEntityList) { - String response = ""; - businessFormat = shopEntity.getLastUpdated(); - try { + String url = null; + String pk_defdoc = null; + try { + //查询店铺自定义档案列表 + List defdoclistEntityList = queryU8CEntityUtil.queryBdDefDocListByCode("DP"); + if (defdoclistEntityList == null || defdoclistEntityList.size() == 0) { + Assert.state(false, "根据自定义档案列表编码:DP,未查询到该档案"); + } + if (defdoclistEntityList.size() > 1) { + Assert.state(false, "根据自定义档案列表编码:DP,查询到档案不唯一"); + } + BdDefdoclistEntity bdDefdocListEntity = defdoclistEntityList.get(0); + String defdoclistPk = bdDefdocListEntity.getPkDefdoclist(); + String defdoclistCode = bdDefdocListEntity.getDoclistcode(); + String defdoclistName = bdDefdocListEntity.getDoclistname(); - DefdocRequestVo defdocRequestVo = new DefdocRequestVo(); - defdocRequestVo.setDoccode(shopEntity.getBizCode()); - defdocRequestVo.setDocname(shopEntity.getName()); - defdocRequestVo.setPk_corp("0001"); - //店铺自定义档案主键 -// defdocRequestVo.setPk_defdoclist("0001A210000000000XZX"); - defdocRequestVo.setPk_defdoclist(" 0001A110000000000EBX"); - //TOB C - defdocRequestVo.setMemo(shopEntity.getBusiness()); - ArrayList requestVos = new ArrayList<>(); - requestVos.add(defdocRequestVo); - HashMap map = new HashMap<>(); - map.put("defdoc", requestVos); + for (OfsShopDto shopEntity : shopEntityList) { + + String response = ""; + businessFormat = shopEntity.getLastUpdated(); + try { + + //查询该自定义项,新增或者更新 + List defdocEntityList = queryU8CEntityUtil.queryBdDefDocByListPk(defdoclistPk); + for (BdDefdocEntity bdDefdocEntity : defdocEntityList) { + if (shopEntity.getBizCode().equals(bdDefdocEntity.getDoccode())) { + //更新 + url = OverallConstant.getOverAllValue("bddefdoclistUpdateCode"); + pk_defdoc = bdDefdocEntity.getPkDefdoc(); + } else { + //新增 + url = OverallConstant.getOverAllValue("bddefdoclistsaveCode"); + } + } + + DefdocRequestVo defdocRequestVo = new DefdocRequestVo(); + defdocRequestVo.setDoccode(shopEntity.getBizCode()); + defdocRequestVo.setDocname(shopEntity.getName()); + defdocRequestVo.setPk_corp("0001"); + //店铺自定义档案主键 + defdocRequestVo.setPk_defdoclist(defdoclistPk); + //TOB C + defdocRequestVo.setMemo(shopEntity.getBusiness()); + //更新或新增 + if (pk_defdoc != null) { + defdocRequestVo.setPk_defdoc(pk_defdoc); + } + + ArrayList requestVos = new ArrayList<>(); + requestVos.add(defdocRequestVo); + HashMap map = new HashMap<>(); + map.put("defdoc", requestVos); + + //同步u8c + String jsonString = JSONObject.toJSONString(map); + ZTResult ztResult = pushU8CByApiCode.pushByCode(url, jsonString); + Attribute attribute = ztResult.getAttribute(); + if ("false".equals(ztResult.getFlag())) { + //转发失败 + response = JSONUtil.toJsonStr(ztResult.getAttribute()); + Assert.state(false, "丽知:OFS店铺档案--->U8C自定义档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); + } + + String taskNumber = null; + boolean isSuccess = false; + if ("success".equals(attribute.getStatus())) { + + isSuccess = true; + } + + if (!isSuccess) { + Assert.state(false, "同步到U8C失败,原因:{} 接口入参:{}", attribute.getErrormsg(), jsonString); + } + // 根据返回结果记录日志 + //成功 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(jsonString); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); + integrationTaskLivingDetailsEntity.setRootAppPk("defdoc_" + shopEntity.getBizCode() + "_" + businessFormat); + integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + + + } catch (Exception e) { + logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e); + 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() + "_" + businessFormat); + integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - //同步u8c - String jsonString = JSONObject.toJSONString(map); -// String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("bddefdoclistsaveCode"), jsonString); - ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("bddefdoclistsaveCode"), jsonString); - Attribute attribute = ztResult.getAttribute(); - if ("false".equals(ztResult.getFlag())) { - //转发失败 - response = JSONUtil.toJsonStr(ztResult.getAttribute()); - Assert.state(false, "丽知:OFS店铺档案--->U8C自定义档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); } - - String taskNumber = null; - boolean isSuccess = false; - if ("success".equals(attribute.getStatus())) { - - isSuccess = true; -// String string = attribute.getData(); -// CbdocResultVo cbdocResultVo = JSONObject.parseObject(string, CbdocResultVo.class); -// taskNumber = cbdocResultVo.getTaskNumber(); -// String data = cbdocResultVo.getData(); - } - - if (!isSuccess) { - Assert.state(false, "同步到U8C失败,原因:{} 接口入参:{}", attribute.getErrormsg(), jsonString); - } - // 根据返回结果记录日志 - //成功 - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); - integrationTaskLivingDetailsEntity.setRootAppNewData(jsonString); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk("defdoc_" + shopEntity.getBizCode()); - integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + shopEntity.getBizCode()); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - - - } catch (Exception e) { - logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e); - String ErrMessage = e.getMessage(); + } + } catch (Exception e) { + logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e); + String ErrMessage = e.getMessage(); + for (OfsShopDto ofsShopDto : shopEntityList) { IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); - integrationTaskLivingDetailsEntity.setRootAppNewData(JSONObject.toJSONString(shopEntity)); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSONObject.toJSONString(ofsShopDto)); integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk("defdoc_" + shopEntity.getBizCode()); - integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + shopEntity.getBizCode()); + integrationTaskLivingDetailsEntity.setRootAppPk("defdoc_" + ofsShopDto.getBizCode() + "_" + businessFormat); + integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + ofsShopDto.getBizCode()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); @@ -380,71 +545,43 @@ public class ShopPluginInitializer extends PluginBaseEntity { } } - public List filterShopEntity(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(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 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) { + + List all = new ArrayList<>(); + int pageNo = 1; + int pageSize = 500; + InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto(); interfaceParamDto.setApi("ofs.store.search"); + shopEntity.setClientCode("LETS"); + shopEntity.setStatus(1);//1启用 0未启用 + shopEntity.setPageNo("1"); + shopEntity.setPageNo(String.valueOf(pageNo)); + shopEntity.setPageSize(String.valueOf(pageSize)); interfaceParamDto.setData(JSON.toJSONString(shopEntity)); try { - OfsShopReturnMessageDto unified = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); - List list = unified.getData(); - return list; + OfsShopReturnMessageDto ofsShopSearchResponse = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); + System.out.println(ofsShopSearchResponse); + all.addAll(ofsShopSearchResponse.getData()); + + int count = ofsShopSearchResponse.getData().size(); + while (count >= pageSize) {//>=500,可能还有下一页。 + //还有下一页 + pageNo++; + shopEntity.setPageNo(String.valueOf(pageNo)); + interfaceParamDto.setData(JSON.toJSONString(shopEntity)); + OfsShopReturnMessageDto ofsShopSearchResponse1 = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); + all.addAll(ofsShopSearchResponse1.getData()); + count = ofsShopSearchResponse1.getData().size(); + } + if (all == null || all.size() == 0) { + return null; + } + + } catch (Exception e) { logger.error("丽知:OFS店铺档案查询失败,queryfromofs()方法报错:", e); - return null; } + return all; } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializerbak20250104.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializerbak20250104.java new file mode 100644 index 00000000..f8714431 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializerbak20250104.java @@ -0,0 +1,450 @@ +//package com.hzya.frame.plugin.lets.plugin.base; +// +//import cn.hutool.core.date.DateField; +//import cn.hutool.core.date.DateUtil; +//import cn.hutool.core.lang.Assert; +//import cn.hutool.json.JSONUtil; +//import com.alibaba.fastjson.JSON; +//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.queryvo.CustdocRequestVo; +//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.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.dto.InterfaceParamByU8CApiDto; +//import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopDto; +//import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto; +//import com.hzya.frame.ttxofs.service.OfsUnifiedService; +//import com.hzya.frame.web.entity.BaseResult; +//import com.hzya.frame.web.entity.JsonResultEntity; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +// +//import java.util.ArrayList; +//import java.util.Date; +//import java.util.HashMap; +//import java.util.List; +//import java.util.concurrent.locks.ReentrantLock; +// +///** +// * @Author +// * @Date 2024/8/6 14:36 +// * @PackageName:com.hzya.frame.plugin.lets.plugin.base +// * @ClassName: ShopPluginInitializer +// * @Description: 店铺->U8C客商档案 +// * 根据编码来判断新增还是更新 +// */ +// +//public class ShopPluginInitializerbak20250104 extends PluginBaseEntity { +// Logger logger = LoggerFactory.getLogger(ShopPluginInitializerbak20250104.class); +// +// private static final ReentrantLock LOCK = new ReentrantLock(true); +// +// @Override +// public void initialize() { +// logger.info(getPluginLabel() + "执行初始化方法initialize()"); +// } +// +// @Override +// public void destroy() { +// logger.info(getPluginLabel() + "执行销毁方法destroy()"); +// } +// +// @Override +// public String getPluginId() { +// return "base.ShopPluginInitializer"; +// } +// +// @Override +// public String getPluginName() { +// return "丽知:OFS店铺档案--->U8C客商档案"; +// } +// +// @Override +// public String getPluginLabel() { +// return "丽知:OFS店铺档案--->U8C客商档案"; +// } +// +// @Override +// public String getPluginType() { +// return "1"; +// } +// +// +//// @Autowired +//// private IShopDao shopDao; +// +// @Autowired +// private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; +// @Autowired +// private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; +// +// @Autowired +// private PushDataByU8cUtil pushDataByU8cUtil; +// +// @Autowired +// private OfsUnifiedService ofsUnifiedService; +// +// @Autowired +// private PushU8CByApiCode pushU8CByApiCode; +// +// +// @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], "结束时间不能为空"); +// startImplement(split[0], split[1]); +// } +// } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { +// if (param != null && !"".equals(param)) { +// startImplement(param); +// } +// } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { +// String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id"); +// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); +// startImplement(integrationTaskLivingDetailsEntity.getRootAppPk()); +// } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) { +// startImplement(); +// } +// } catch (Exception e) { +// logger.error("executeBusiness", e); +// } +// return BaseResult.getSuccessMessageEntity("插件执行成功"); +// } +// +// +// public void startImplement(String startDate, String endDate) { +// try { +// Date business_start = DateUtil.parse(startDate); +// Date business_end = DateUtil.parse(endDate); +// String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00"; +// String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59"; +// +// OfsShopDto shopEntity = new OfsShopDto(); +// shopEntity.setLastUpdated_start(start); +// shopEntity.setLastUpdated_end(end); +// shopEntity.setPageNo("1"); +// +// List list = queryfromofs(shopEntity); +// //过滤数据 +// List shopEntities = filterShopEntity(list); +// implementcustdoc(shopEntities); +// +// List list1 = filterShopEntityDef(list); +// implementdef(list1); +// +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案--->U8C客商档案,start()方法报错:", e); +// } +// } +// +// /** +// * 默认推送 +// */ +// public void startImplement() { +// try { +// //获取当前时间 +// 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"); +// +// +// OfsShopDto shopEntity = new OfsShopDto(); +// shopEntity.setLastUpdated_start(startTimeStr); +// shopEntity.setLastUpdated_end(endTimeStr); +// shopEntity.setPageNo("1"); +// shopEntity.setClientCode("LETS"); +// List list = queryfromofs(shopEntity); +// +// List shopEntities = filterShopEntity(list); +// //同步到客商档案 +// implementcustdoc(shopEntities); +// +// List list1 = filterShopEntityDef(list); +// //同步到自定义档案 +// implementdef(list1); +// +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案--->U8C客商档案,startImplement()方法报错:", e); +// } +// } +// +// +// /** +// * 按编码名称 +// */ +// public void startImplement(String code) { +// try { +// OfsShopDto shopEntity = new OfsShopDto(); +// shopEntity.setBizCode(code); +// shopEntity.setClientCode("LETS"); +// shopEntity.setPageNo("1"); +// List list = queryfromofs(shopEntity); +// //过滤数据 +// List shopEntities = filterShopEntity(list); +// //同步到客商档案 +// implementcustdoc(shopEntities); +// List list1 = filterShopEntityDef(list); +// //同步到自定义档案 +// implementdef(list1); +// +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案--->U8C客商档案,startImplement(String code)方法报错:", e); +// } +// } +// +// +// public void implementcustdoc(List shopEntityList) { +// Assert.notNull(shopEntityList, "shopEntityList不能为空"); +// String businessFormat = null; +// String url = null; +// for (OfsShopDto shopEntity : shopEntityList) { +// businessFormat = shopEntity.getLastUpdated(); +// String response = ""; +// try { +// String lastUpdated = shopEntity.getLastUpdated(); +// +// CustdocEntityDto parentvo = new CustdocEntityDto(); +// CustdocRequestVo custdocRequestVo = new CustdocRequestVo(); +// parentvo.setCustname(shopEntity.getName()); +// parentvo.setCustshortname(shopEntity.getName()); +//// parentvo.setPk_corp("0001"); +//// +// parentvo.setPk_areacl("HH"); +// //def1:ofs编码 +// parentvo.setDef1(shopEntity.getBizCode()); +// custdocRequestVo.setParentvo(parentvo); +// //同步u8c +// ArrayList list = new ArrayList<>(); +// list.add(custdocRequestVo); +// HashMap param = new HashMap<>(); +// +// param.put("cbdocvo", list); +// String jsonString = JSONObject.toJSONString(param); +//// response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocSave"), jsonString); +// ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("custdocSaveCode"), jsonString); +// +// Attribute attribute = ztResult.getAttribute(); +// +// if ("false".equals(ztResult.getFlag())) { +// //转发失败 +// response = JSONUtil.toJsonStr(ztResult.getAttribute()); +// Assert.state(false, "丽知:OFS店铺档案--->U8C客商档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); +// } +// +// +// String taskNumber = null; +// boolean isSuccess = false; +// if ("success".equals(attribute.getStatus())) { +// isSuccess = true; +//// CbdocResultVo cbdocResultVo = JSONObject.parseObject(attribute.getData(), CbdocResultVo.class); +//// taskNumber = cbdocResultVo.getTaskNumber(); +//// String data = attribute.getData(); +// } +// +// if (!isSuccess) { +// Assert.state(false, "同步到U8C失败,原因:{} 接口入参:{}", attribute.getErrormsg(), jsonString); +// } +// // 根据返回结果记录日志 +// //成功 +// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); +// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); +// integrationTaskLivingDetailsEntity.setRootAppNewData(jsonString); +// integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); +// integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); +// integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); +// integrationTaskLivingDetailsEntity.setRootAppPk(shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// +// +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案--->U8C客商档案,implement()方法报错:", e); +// 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(shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// +// } +// } +// } +// +// +// public void implementdef(List shopEntityList) { +// Assert.notNull(shopEntityList, "shopEntityList不能为空"); +// String businessFormat = null; +// for (OfsShopDto shopEntity : shopEntityList) { +// String response = ""; +// businessFormat = shopEntity.getLastUpdated(); +// try { +// +// DefdocRequestVo defdocRequestVo = new DefdocRequestVo(); +// defdocRequestVo.setDoccode(shopEntity.getBizCode()); +// defdocRequestVo.setDocname(shopEntity.getName()); +// defdocRequestVo.setPk_corp("0001"); +// //店铺自定义档案主键 +//// defdocRequestVo.setPk_defdoclist("0001A210000000000XZX"); +// defdocRequestVo.setPk_defdoclist(" 0001A110000000000EBX"); +// //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("bddefdoclistsaveCode"), jsonString); +// ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("bddefdoclistsaveCode"), jsonString); +// Attribute attribute = ztResult.getAttribute(); +// if ("false".equals(ztResult.getFlag())) { +// //转发失败 +// response = JSONUtil.toJsonStr(ztResult.getAttribute()); +// Assert.state(false, "丽知:OFS店铺档案--->U8C自定义档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); +// } +// +// String taskNumber = null; +// boolean isSuccess = false; +// if ("success".equals(attribute.getStatus())) { +// +// isSuccess = true; +//// String string = attribute.getData(); +//// CbdocResultVo cbdocResultVo = JSONObject.parseObject(string, CbdocResultVo.class); +//// taskNumber = cbdocResultVo.getTaskNumber(); +//// String data = cbdocResultVo.getData(); +// } +// +// if (!isSuccess) { +// Assert.state(false, "同步到U8C失败,原因:{} 接口入参:{}", attribute.getErrormsg(), jsonString); +// } +// // 根据返回结果记录日志 +// //成功 +// IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); +// integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); +// integrationTaskLivingDetailsEntity.setRootAppNewData(jsonString); +// integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); +// integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); +// integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); +// integrationTaskLivingDetailsEntity.setRootAppPk("defdoc_" + shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setRootAppBill("defdoc_" + shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// +// +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e); +// 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("defdoc_" + shopEntity.getBizCode()); +// integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); +// saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); +// +// } +// } +// } +// +// public List filterShopEntity(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(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 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"); +// interfaceParamDto.setData(JSON.toJSONString(shopEntity)); +// try { +// OfsShopReturnMessageDto unified = (OfsShopReturnMessageDto) ofsUnifiedService.unifiedByU8CApi(interfaceParamDto); +// List list = unified.getData(); +// return list; +// } catch (Exception e) { +// logger.error("丽知:OFS店铺档案查询失败,queryfromofs()方法报错:", e); +// return null; +// } +// } +//} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryU8CEntityUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryU8CEntityUtil.java index 1d77dd60..fe6f6ff7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryU8CEntityUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryU8CEntityUtil.java @@ -468,6 +468,53 @@ public class QueryU8CEntityUtil { } } + /** + * 根据code查询自定义档案列表 + */ + public List queryBdDefDocListByCode(String code){ + BdDefdoclistEntity bdDefdoclistEntity = new BdDefdoclistEntity(); + bdDefdoclistEntity.setDoclistcode(code); + bdDefdoclistEntity.setDr(0); + bdDefdoclistEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List defdoclistEntityList = iBdDefdoclistDao.query(bdDefdoclistEntity); + if(defdoclistEntityList.size()==0){ + return null; + }else { + return defdoclistEntityList; + } + } + + /** + * 根据name查询自定义档案列表 + */ + public List queryBdDefDocListByName(String name){ + BdDefdoclistEntity bdDefdoclistEntity = new BdDefdoclistEntity(); + bdDefdoclistEntity.setDoclistname(name); + bdDefdoclistEntity.setDr(0); + bdDefdoclistEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List defdoclistEntityList = iBdDefdoclistDao.query(bdDefdoclistEntity); + if(defdoclistEntityList.size()==0){ + return null; + }else { + return defdoclistEntityList; + } + } + + /** + * 根据pk查询自定义档案列表 + */ + public List queryBdDefDocListByPk(String pk) { + BdDefdoclistEntity bdDefdoclistEntity = new BdDefdoclistEntity(); + bdDefdoclistEntity.setPkDefdoclist(pk); + bdDefdoclistEntity.setDr(0); + bdDefdoclistEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List defdoclistEntityList = iBdDefdoclistDao.query(bdDefdoclistEntity); + if (defdoclistEntityList.size() == 0) { + return null; + } else { + return defdoclistEntityList; + } + } ////////////////////////////////////////////////////////////////////////////////////////公司自定义档案查询