diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java
index 1d7b558c..14bb2d78 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java
@@ -26,6 +26,7 @@ public class ProfilesActiveConstant {
public static final String TYPE_OTHER = "other";
public static final String U8C_URL = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
+//public static final String U8C_URL = "http://ufidahz.com.cn:9067/kangarooDataCenterV3/entranceController/externalCallInterface";
public static final String OFS_URL_TEST = "http://39.98.58.229/api/edi/ofs/in";
public static final String SUPPLIER = "'1','3'";
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.java
index 6c5df8e0..e78811d0 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.java
@@ -103,6 +103,35 @@ public class BdCubasdocEntity extends BaseEntity {
*/
private String end_createtime;
+
+ /**
+ * modifytime开始时间
+ */
+ private String modifytime_start_time;
+
+ /**
+ * modifytime结束时间
+ */
+ private String modifytime_end_time;
+
+
+ public String getModifytime_start_time() {
+ return modifytime_start_time;
+ }
+
+ public void setModifytime_start_time(String modifytime_start_time) {
+ this.modifytime_start_time = modifytime_start_time;
+ }
+
+ public String getModifytime_end_time() {
+ return modifytime_end_time;
+ }
+
+ public void setModifytime_end_time(String modifytime_end_time) {
+ this.modifytime_end_time = modifytime_end_time;
+ }
+
+
public String getStart_createtime() {
return start_createtime;
}
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
index fac3d1c3..c5c502bb 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
@@ -229,6 +229,9 @@
and createtime >= #{start_createtime}
and createtime <= #{end_createtime}
+
+ and ts >= #{modifytime_start_time}
+ and ts <= #{modifytime_end_time}
order by sorts asc
order by ${sort} ${order}
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 0c2d759d..114f9ae6 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
@@ -1,12 +1,16 @@
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 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.dao.IBdCubasdocDao;
import com.hzya.frame.plugin.lets.entity.BdCorpEntity;
+import com.hzya.frame.plugin.lets.entity.BdCubasdocEntity;
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
import com.hzya.frame.plugin.lets.queryvo.CustDocAssginVo;
import com.hzya.frame.plugin.lets.queryvo.CustdocRequestVo;
@@ -14,6 +18,9 @@ import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo;
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.dto.ofsBaseSearch.OfsShopDto;
@@ -74,10 +81,13 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
private PushDataByU8cUtil pushDataByU8cUtil;
@Autowired
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
+ @Autowired
+ private PushU8CByApiCode pushU8CByApiCode;
+ @Autowired
+ private IBdCubasdocDao bdCubasdocDao;
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
- start();
return null;
}
@@ -87,9 +97,27 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
*/
public void start() {
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");
+
//查询要分配的客商
- List list = queryCustDoc();
- List requestVoList = filterShopEntity(list);
+ BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
+ bdCubasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ bdCubasdocEntity.setModifytime_start_time(startTimeStr);
+ bdCubasdocEntity.setModifytime_end_time(endTimeStr);
+
+ List list = bdCubasdocDao.query(bdCubasdocEntity);
+ if (list == null || list.isEmpty()) {
+ return;
+ }
+ List requestVoList = filterShopEntity(list);
+ if (requestVoList == null || requestVoList.isEmpty()) {
+ return;
+ }
//推送:自动分配
implement(requestVoList);
@@ -99,13 +127,72 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
}
+ /**
+ * 按客商基本档案code
+ */
+ public void start(String code) {
+ try {
+ BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
+// bdInvbasdocEntity.setPkInvbasdoc(invcode);
+ bdCubasdocEntity.setCustcode(code);
+ bdCubasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ List query = bdCubasdocDao.query(bdCubasdocEntity);
+ if (query.size() == 0) {
+ Assert.state(false, "U8C->客商基本档案自动分配全公司,客商基本档案编码:{},不存在。", code);
+ }
+ //过滤日志
+ List list = filterShopEntity(query);
+ if (list.size() == 0 || list == null) {
+ Assert.state(false, "U8C->客商基本档案自动分配全公司,客商基本档案编码:{},已被分配,请检查。", code);
+ }
+ //推送:自动分配
+ implement(list);
+
+ } catch (Exception e) {
+ logger.error("丽知:U8C->客商基本档案自动分配全公司,start(String pkInvbasdoc)方法报错:", e);
+ }
+
+ }
+
+ /**
+ * 按时间区间
+ */
+ public void start(String startTime, String endTime) {
+ try {
+ Date business_start = DateUtil.parse(startTime);
+ 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";
+
+ BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
+ bdCubasdocEntity.setModifytime_start_time(start);
+ bdCubasdocEntity.setModifytime_end_time(end);
+ bdCubasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ List query = bdCubasdocDao.query(bdCubasdocEntity);
+ if (query.size() == 0) {
+ Assert.state(false, "U8C->客商基本档案自动分配全公司,按日期:{} - {},未查到客商基本档案。", startTime, endTime);
+ }
+ //过滤日志
+ List list = filterShopEntity(query);
+ if (list.size() == 0 || list == null) {
+ Assert.state(false, "U8C->客商基本档案自动分配全公司,按日期:{} - {},已被分配,请检查。", startTime, endTime);
+ }
+ //推送:自动分配
+ implement(list);
+
+ } catch (Exception e) {
+ logger.error("丽知:U8C->客商基本档案自动分配全公司,start(String startTime, String endTime)方法报错:", e);
+ }
+ }
+
+
/**
* 查询客商基本档案
*
* @return
*/
private List queryCustDoc() {
- List custdocRequestVos = null;
+ List list = null;
try {
String data = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocQuery"), "{}");
CbdocResultVo cbdocResultVo = JSONObject.parseObject(data, CbdocResultVo.class);
@@ -113,38 +200,27 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
Map map = JSONObject.parseObject(datastring, Map.class);
Object o = map.get("datas");
String jsonString = JSONObject.toJSONString(o);
- List list = JSONObject.parseArray(jsonString, CustdocRequestVo.class);
-// custdocRequestVos = filterData(list);
- custdocRequestVos = filterShopEntity(list);
+ list = JSONObject.parseArray(jsonString, CustdocRequestVo.class);
+
+// custdocRequestVos = filterShopEntity(list);
} catch (Exception e) {
logger.error("丽知:U8C->客商基本档案自动分配全公司,查询客商基本档案失败", e);
}
- return custdocRequestVos;
- }
-
- private List filterData(List list) {
- List filterlist = new ArrayList<>();
- for (CustdocRequestVo requestVo : list) {
- //o转为
- if ("N".equals(requestVo.getParentvo().getDef10())) {
- filterlist.add(requestVo);
- }
- }
- return filterlist;
+ return list;
}
//过滤已经分配的
- public List filterShopEntity(List list) {
+ public List filterShopEntity(List list) {
Assert.notNull(list, "不能为空!");
- List shopEntityList = new ArrayList<>();
+ List shopEntityList = new ArrayList<>();
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
- CustdocRequestVo requestVo = list.get(i);
-
- if (requestVo.getParentvo().getCustcode() != null && !"".equals(requestVo.getParentvo().getCustcode().trim())) {
+ BdCubasdocEntity requestVo = list.get(i);
+ String custcode = requestVo.getCustcode();
+ if (custcode != null && !"".equals(custcode)) {
boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
- integrationTaskLivingDetailsEntity.setRootAppPk(requestVo.getParentvo().getCustcode());
+ integrationTaskLivingDetailsEntity.setRootAppPk(custcode);
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
@@ -164,26 +240,27 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
/**
* U8C->客商基本档案自动分配全公司
*/
- public void implement(List list) {
+ public void implement(List list) {
- for (CustdocRequestVo custdocRequestVo : list) {
+ for (BdCubasdocEntity bdCubasdocEntity : list) {
String assginjsonString = "";
- String custcode = custdocRequestVo.getParentvo().getCustcode();
- String createtime = custdocRequestVo.getParentvo().getCreatetime();
-// String custprop = custdocRequestVo.getParentvo().getCustprop();
+ String custcode = bdCubasdocEntity.getCustcode();
+ String createtime = bdCubasdocEntity.getCreatetime();
try {
ArrayList assginvolist = new ArrayList<>();
List bdCorpEntities = null;
//查询公司档案
try {
- String corpresponse = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("bdcorpQuery"), "{}");
- CbdocResultVo cbdocResultVo = JSONObject.parseObject(corpresponse, CbdocResultVo.class);
- if (!"success".equals(cbdocResultVo.getStatus())) {
+// String corpresponse = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("bdcorpQuery"), "{}");
+ ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("bdcorpQueryCode"), "{}");
+// CbdocResultVo cbdocResultVo = JSONObject.parseObject(corpresponse, CbdocResultVo.class);
+ Attribute attribute = ztResult.getAttribute();
+ if (!"success".equals(attribute.getStatus())) {
Assert.state(false, "查询公司档案失败");
}
- String datastring = cbdocResultVo.getData();
- Map map = JSONObject.parseObject(datastring, Map.class);
+ String data = attribute.getData();
+ Map map = JSONObject.parseObject(data, Map.class);
Object o = map.get("datas");
bdCorpEntities = JSONObject.parseArray(JSON.toJSONString(o), BdCorpEntity.class);
@@ -201,35 +278,31 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
assginvolist.add(custDocAssginVo);
}
-// CustDocAssginVo custDocAssginVo = new CustDocAssginVo();
-// custDocAssginVo.setPk_cubasdoc(pkCubasdoc);
-//// custDocAssginVo.setAssignallcorps("Y");
-// custDocAssginVo.setCustprop("2");
-// custDocAssginVo.setPk_corp();
-// assginvolist.add(custDocAssginVo);
HashMap map = new HashMap<>();
map.put("custbasvo", assginvolist);
assginjsonString = JSONObject.toJSONString(map);
- String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocAssign"), assginjsonString);
- System.out.println(response);
+// String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocAssign"), assginjsonString);
+ ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("custdocAssignCode"), assginjsonString);
+ Attribute attribute = ztResult.getAttribute();
+ if ("false".equals(ztResult.getFlag())) {
+ //转发失败
+ Assert.state(false, "丽知:U8C客商档案分配,中台转发失败,失败原因:{}", attribute.getErrormsg());
+ }
+
boolean isSuccess = false;
- if (response != null && !"".equals(response)) {
- ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
- if ("success".equals(reusltStrDto.getStatus())) {
- isSuccess = true;
- //分配成功去更新状态
-// updateDoc(custdocRequestVo);
- }
+ if ("success".equals(attribute.getStatus())) {
+ isSuccess = true;
+// ReusltStrDto reusltStrDto = JSON.parseObject(attribute.getData(), ReusltStrDto.class);
}
if (!isSuccess) {
- Assert.state(false, "推送U8C--> U8C->客商基本档案自动分配全公司 失败 接口返回结果:{} 接口入参:{}", response, assginjsonString);
+ Assert.state(false, "推送U8C--> U8C->客商基本档案自动分配全公司 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), assginjsonString);
}
//成功
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setRootAppNewData(assginjsonString);
- integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
+ integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData());
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
integrationTaskLivingDetailsEntity.setRootAppPk(custcode);
@@ -306,7 +379,6 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}
-
}
}
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 41d33526..4fd25b00 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
@@ -3,6 +3,7 @@ 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;
@@ -15,6 +16,9 @@ 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;
@@ -91,6 +95,9 @@ public class ShopPluginInitializer extends PluginBaseEntity {
@Autowired
private OfsUnifiedService ofsUnifiedService;
+ @Autowired
+ private PushU8CByApiCode pushU8CByApiCode;
+
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
@@ -116,7 +123,7 @@ public class ShopPluginInitializer extends PluginBaseEntity {
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)){
+ } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
}
return null;
@@ -144,7 +151,7 @@ public class ShopPluginInitializer extends PluginBaseEntity {
implementdef(list1);
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("丽知:OFS店铺档案--->U8C客商档案,start()方法报错:", e);
}
}
@@ -213,49 +220,64 @@ public class ShopPluginInitializer extends PluginBaseEntity {
Date date = new Date(System.currentTimeMillis());
String businessFormat = sdf.format(date);
for (OfsShopDto shopEntity : shopEntityList) {
-
+ String response = "";
try {
CustdocEntityDto parentvo = new CustdocEntityDto();
CustdocRequestVo custdocRequestVo = new CustdocRequestVo();
parentvo.setCustname(shopEntity.getName());
parentvo.setCustshortname(shopEntity.getName());
+// parentvo.setPk_corp("0001");
+//
+// parentvo.setPk_areacl("A");
//业务编码
parentvo.setDef1(shopEntity.getBizCode());
custdocRequestVo.setParentvo(parentvo);
//同步u8c
+ ArrayList list = new ArrayList<>();
+ list.add(custdocRequestVo);
HashMap param = new HashMap<>();
- param.put("cbdocvo", custdocRequestVo);
- String jsonString = JSONObject.toJSONString(param);
- String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocSave"), 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(custdocRequestVo));
- }
- // 根据返回结果记录日志
- //成功
- 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(shopEntity.getBizCode());
- integrationTaskLivingDetailsEntity.setRootAppBill(shopEntity.getName());
- integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
- saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+ 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.getName());
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+
+
} catch (Exception e) {
logger.error("丽知:OFS店铺档案--->U8C客商档案,implement()方法报错:", e);
String ErrMessage = e.getMessage();
@@ -282,7 +304,7 @@ public class ShopPluginInitializer extends PluginBaseEntity {
Date date = new Date(System.currentTimeMillis());
String businessFormat = sdf.format(date);
for (OfsShopDto shopEntity : shopEntityList) {
-
+ String response = "";
try {
DefdocRequestVo defdocRequestVo = new DefdocRequestVo();
@@ -300,37 +322,43 @@ public class ShopPluginInitializer extends PluginBaseEntity {
//同步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();
+// 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(shopEntity.getName());
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+
+
} catch (Exception e) {
logger.error("丽知:OFS店铺档案--->自定义档案,implement()方法报错:", e);
String ErrMessage = e.getMessage();
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 c1424ee6..a9548691 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
@@ -17,6 +17,9 @@ import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo;
import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto;
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;
@@ -50,6 +53,8 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
@Autowired
private OfsUnifiedService ofsUnifiedService;
+ @Autowired
+ private PushU8CByApiCode pushU8CByApiCode;
@Override
public void initialize() {
@@ -117,7 +122,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
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)){
+ } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
}
return null;
@@ -212,8 +217,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
BankVo bankVo = new BankVo();
CustdocRequestVo CustdocEntityDto = new CustdocRequestVo();
try {
- //T 设置parentvo
-// parentvo.setPk_areacl("");
+ //设置parentvo
parentvo.setCustname(supplierEntity.getName());
parentvo.setCustshortname(supplierEntity.getName());
@@ -226,34 +230,43 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
param.put("cbdocvo", CustdocEntityDto);
String jsonString = JSONObject.toJSONString(param);
- String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocSave"), jsonString);
- 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(CustdocEntityDto));
- }
- // 根据返回结果记录日志
- //成功
- 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(supplierEntity.getBizCode());
- integrationTaskLivingDetailsEntity.setRootAppBill(supplierEntity.getName());
- integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
- saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+
+// String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocSave"), jsonString);
+ ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("custdocSaveCode"), jsonString);
+ //两层判断,一层中台转发,一层u8c返回
+ Attribute attribute = ztResult.getAttribute();
+ if ("false".equals(ztResult.getFlag())) {
+ //转发失败
+ Assert.state(false, "丽知:OFS供应商档案分类--->U8C客商档案分类.中台转发失败,失败原因:{}", attribute.getErrormsg());
}
+
+ 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 = 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(supplierEntity.getBizCode());
+ integrationTaskLivingDetailsEntity.setRootAppBill(supplierEntity.getName());
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+
+
} catch (Exception e) {
logger.error("丽知:OFS供应商档案--->U8C客商档案,implement()方法报错:", e);
String ErrMessage = e.getMessage();