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 361798c8..93e5d458 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 @@ -41,7 +41,9 @@ public class OverallConstant { prodOverPublic.put("approveqz", "/u8cloud/api/to/transorder/saveapprove");//调拨订单保存即审批 //其他出入库 + prodOverPublic.put("otherinqzCode", "8000370007");//库存其他入库保存即签字 prodOverPublic.put("otherinqz", "/u8cloud/api/ic/otherin/save/sign");//库存其他入库保存即签字 + prodOverPublic.put("otheroutqzCode", "8000370008");//库存其他出库保存即签字 prodOverPublic.put("otheroutqz", "/u8cloud/api/ic/otherout/save/sign");//库存其他出库保存即签字 @@ -58,12 +60,12 @@ public class OverallConstant { } private static void loadDev() { + devOverAll.put("u8cApiUrl", "http://39.170.109.90:9099");//测试U8C devOverAll.put("u8cApiUsercodePK", "admin"); devOverAll.put("u8cApiPasswordPK", "21232f297a57a5a743894a0e4a801fc3"); devOverAll.put("u8cApiTrantypePK", "pk"); devOverAll.put("u8cApiSystemPK", "lz"); - devOverAll.put("u8cApiServiceNamePK", "http://39.170.109.90:9099");//测试U8C devOverAll.put("u8cApiNeedStackTracePK", "Y"); devOverAll.put("u8cApiZdrPK", "0001A210000000000GVS");//单据制单人---测试环境:郑一凡 @@ -71,7 +73,6 @@ public class OverallConstant { devOverAll.put("u8cApiPasswordCode", "e00cf25ad42683b3df678c61f42c6bda"); devOverAll.put("u8cApiTrantypeCode", "code"); devOverAll.put("u8cApiSystemCode", "lz1"); - devOverAll.put("u8cApiServiceNameCode", "http://39.170.109.90:9099");//测试U8C devOverAll.put("u8cApiNeedStackTraceCode", "Y"); devOverAll.put("u8cApiZdrCode", "15932295350");//单据制单人---测试环境:郑一凡 diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java index c4834785..94ee9a12 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java @@ -14,9 +14,13 @@ import com.hzya.frame.plugin.lets.entity.BdRdclEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO; import com.hzya.frame.plugin.lets.u8cdto.BillVO; import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4ADto; +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.dto.InterfaceParamDto; @@ -73,6 +77,8 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { @Autowired private PushDataByU8cUtil pushDataByU8cUtil; @Autowired + private PushU8CByApiCode pushU8CByApiCode; + @Autowired private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; @Autowired @@ -174,12 +180,12 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { System.out.println(stockinOrders); if (stockinOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据单据号[入库完成]:{},未查询到调整出库单",stockinNo); + Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据单据号[入库完成]:{},未查询到调整出库单", stockinNo); } //过滤日志 List filterStockinOrders = filterData(stockinOrders); if (filterStockinOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据单据号[入库完成]:{},该调整出库单已被推送成功,请勿重新推送",stockinNo); + Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据单据号[入库完成]:{},该调整出库单已被推送成功,请勿重新推送", stockinNo); } //推送 @@ -211,12 +217,12 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { System.out.println(stockinOrders); if (stockinOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调整入库单[入库完成]",startTime,endTime); + Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调整入库单[入库完成]", startTime, endTime); } //过滤日志 List filterStockinOrders = filterData(stockinOrders); if (filterStockinOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整入库单[入库完成]已被推送成功,请勿重新推送",startTime,endTime); + Assert.state(false, "丽知:OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整入库单[入库完成]已被推送成功,请勿重新推送", startTime, endTime); } //推送 @@ -256,22 +262,23 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { /** * 推送U8C其它入库单 + * * @param filterStockinOrders */ - public void implement(List filterStockinOrders){ + public void implement(List filterStockinOrders) { for (StockinOrderSearchResponse.StockinOrder stockinOrder : filterStockinOrders) { String mapStr = ""; - String format=""; - String response=""; - String ofsCode=""; - try{ + String format = ""; + String response = ""; + String ofsCode = ""; + try { //主表 StockinOrderSearchResponse.StockinOrder.StockinH ofsHeader = stockinOrder.getHeader(); GeneralBillVO_4ADto generalBillVO_4A = new GeneralBillVO_4ADto(); GeneralBillVO_4ADto.Parentvo parentvo = new GeneralBillVO_4ADto.Parentvo(); //ofs订单号,自定义项19 - ofsCode=ofsHeader.getCode(); + ofsCode = ofsHeader.getCode(); parentvo.setVuserdef19(ofsCode); //pk_corp--公司 @@ -286,13 +293,13 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { //dbilldate--单据日期--oms入库时间 // Date created = ofsHeader.getCreated(); // format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); - format = ofsHeader.getCreated(); - parentvo.setDbilldate(StringUtils.substring(format,0,10)); + format = ofsHeader.getCreated(); + parentvo.setDbilldate(StringUtils.substring(format, 0, 10)); //coperatorid--制单人 String createdBy = ofsHeader.getCreatedBy(); parentvo.setCoperatorid("tbadmin"); //审核时间dauditdate - parentvo.setDauditdate(StringUtils.substring(format,0,10)); + parentvo.setDauditdate(StringUtils.substring(format, 0, 10)); //cdispatcherid--收发类别,ofs过来的写死,20240813(妮姐+万万),就是调整出库,调整入库 BdRdclEntity bdRdclEntity = new BdRdclEntity(); @@ -300,14 +307,14 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { bdRdclEntity.setDr(0); bdRdclEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); List BdRdclEntityList = iBdRdclDao.query(bdRdclEntity); - if(BdRdclEntityList.size()==0){ - Assert.state(false,"查询U8C收发类型:调整入库失败。未查询到U8C收发类型。"); + if (BdRdclEntityList.size() == 0) { + Assert.state(false, "查询U8C收发类型:调整入库失败。未查询到U8C收发类型。"); } String RdclCode = BdRdclEntityList.get(0).getRdcode();//收发类别编码 parentvo.setCdispatcherid(RdclCode); //子表 - List childrenvo=new ArrayList<>(); + List childrenvo = new ArrayList<>(); for (StockinOrderSearchResponse.StockinOrder.StockinB ofsDetail : stockinOrder.getDetails()) { System.out.println(ofsDetail); GeneralBillVO_4ADto.Childrenvo children = new GeneralBillVO_4ADto.Childrenvo(); @@ -332,19 +339,25 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { mapStr = "{\"GeneralBillVO_4A\":[" + dataJson + "]}"; //推送 - response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otherinqz"), mapStr); - System.out.println(response); +// response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otherinqz"), mapStr); + ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("otherinqzCode"), mapStr); + + //两层判断,一层中台转发,一层u8c返回 + if ("false".equals(ztResult.getFlag())) { + //转发失败 + Assert.state(false, "丽知:OFS调整入库--->U8C其它入库.中台转发失败,失败原因:{}", ztResult.getMsg()); + } + Attribute attribute = ztResult.getAttribute(); + System.out.println(attribute); + boolean isSuccess = false; - String vbillcode=""; - if (response != null && !"".equals(response)) { - ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - if ("success".equals(reusltStrDto.getStatus())) { - isSuccess = true; - String data = reusltStrDto.getData(); - GeneralBillVO_4ADto resGeneralBillVO = resultDataHandle(data); - System.out.println(resGeneralBillVO); - vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); - } + String vbillcode = ""; + if ("success".equals(attribute.getStatus())) { + isSuccess = true; + String data = attribute.getData(); + GeneralBillVO_4ADto resGeneralBillVO = resultDataHandle(data); + System.out.println(resGeneralBillVO); + vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); } if (!isSuccess) { Assert.state(false, "推送U8C--> 丽知:OFS调整入库--->U8C其它入库 失败 接口返回结果:{} 接口入参:{}", response, mapStr); @@ -360,16 +373,17 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode); integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode); + integrationTaskLivingDetailsEntity.setDef1(vbillcode); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); logger.error("推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:" + e); ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - String ErrMessage ="推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:"+ reusltStrDto.getErrormsg(); + String ErrMessage = "推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:" + reusltStrDto.getErrormsg(); //失败 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); 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 b21a93a2..1265c611 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 @@ -18,6 +18,9 @@ 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.dto.InterfaceParamDto; @@ -81,6 +84,8 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { @Autowired private PushDataByU8cUtil pushDataByU8cUtil; @Autowired + private PushU8CByApiCode pushU8CByApiCode; + @Autowired private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; @Autowired @@ -176,12 +181,12 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { queryOfsStockoutOrderRequestVO.setPageSize(500L); List stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); if (stockoutOrders == null || stockoutOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据单据号[出库完成]:{},未查询到调整出库单",stockoutNo); + Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据单据号[出库完成]:{},未查询到调整出库单", stockoutNo); } //过滤日志 List filterStockoutOrders = filterData(stockoutOrders); if (filterStockoutOrders == null || filterStockoutOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据单据号[出库完成]:{},该调整出库单已被推送成功,请勿重新推送",stockoutNo); + Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据单据号[出库完成]:{},该调整出库单已被推送成功,请勿重新推送", stockoutNo); } //推送 implement(filterStockoutOrders); @@ -211,13 +216,13 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { queryOfsStockoutOrderRequestVO.setPageSize(500L); List stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); if (stockoutOrders == null || stockoutOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调整出库单[出库完成]",startTime,endTime); + Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调整出库单[出库完成]", startTime, endTime); } //过滤日志 List filterStockoutOrders = filterData(stockoutOrders); if (filterStockoutOrders == null || filterStockoutOrders.size() == 0) { - Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整出库单[出库完成]已被推送成功,请勿重新推送",startTime,endTime); + Assert.state(false, "丽知:OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整出库单[出库完成]已被推送成功,请勿重新推送", startTime, endTime); } //推送 implement(filterStockoutOrders); @@ -232,8 +237,8 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { /** * 过滤成功日志 */ - public List filterData(List stockoutOrders){ - List filterStockoutOrders=new ArrayList<>(); + public List filterData(List stockoutOrders) { + List filterStockoutOrders = new ArrayList<>(); for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : stockoutOrders) { StockoutOrderSearchResponse.StockoutOrder.StockoutH header = stockoutOrder.getHeader(); String rootAppPk = header.getCode(); @@ -256,14 +261,15 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { /** * 丽知:OFS调整出库--->U8C其它出库 + * * @param filterStockoutOrders */ - public void implement(List filterStockoutOrders){ + public void implement(List filterStockoutOrders) { for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : filterStockoutOrders) { String mapStr = ""; - String format=""; - String response=""; - String ofsCode=""; + String format = ""; + String response = ""; + String ofsCode = ""; try { GeneralBillVO_4IDto generalBillVO_4I = new GeneralBillVO_4IDto(); @@ -274,7 +280,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { //ofs订单号,自定义项19 - ofsCode=ofsHeader.getCode(); + ofsCode = ofsHeader.getCode(); parentvo.setVuserdef19(ofsCode); //pk_corp--公司 @@ -291,11 +297,11 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { // Date created = ofsHeader.getCreated(); // format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); format = created1; - parentvo.setDbilldate(StringUtils.substring(format,0,10)); + parentvo.setDbilldate(StringUtils.substring(format, 0, 10)); //coperatorid--制单人 parentvo.setCoperatorid("tbadmin"); //审核时间dauditdate - parentvo.setDauditdate(StringUtils.substring(format,0,10)); + parentvo.setDauditdate(StringUtils.substring(format, 0, 10)); //cdispatcherid--收发类别,ofs过来的写死,20240813(妮姐+万万),就是调整出库,调整入库 BdRdclEntity bdRdclEntity = new BdRdclEntity(); @@ -303,8 +309,8 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { bdRdclEntity.setDr(0); bdRdclEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); List BdRdclEntityList = iBdRdclDao.query(bdRdclEntity); - if(BdRdclEntityList.size()==0){ - Assert.state(false,"查询U8C收发类型:调整出库失败。未查询到U8C收发类型。"); + if (BdRdclEntityList.size() == 0) { + Assert.state(false, "查询U8C收发类型:调整出库失败。未查询到U8C收发类型。"); } String RdclCode = BdRdclEntityList.get(0).getRdcode();//收发类别编码 parentvo.setCdispatcherid(RdclCode); @@ -313,7 +319,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { // parentvo.setIsautopick("Y"); //子表 - List childrenvo=new ArrayList<>(); + List childrenvo = new ArrayList<>(); for (StockoutOrderSearchResponse.StockoutOrder.StockoutB ofsDetail : stockoutOrder.getDetails()) { System.out.println(ofsDetail); GeneralBillVO_4IDto.Childrenvo children = new GeneralBillVO_4IDto.Childrenvo(); @@ -338,22 +344,28 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { generalBillVO_4I.setChildrenvo(childrenvo); String dataJson = JSONUtil.toJsonStr(generalBillVO_4I); mapStr = "{\"GeneralBillVO_4I\":[" + dataJson + "]}"; - response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otheroutqz"), mapStr); - System.out.println(response); +// response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otheroutqz"), mapStr); + ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("otheroutqzCode"), mapStr); + + //两层判断,一层中台转发,一层u8c返回 + if ("false".equals(ztResult.getFlag())) { + //转发失败 + Assert.state(false, "丽知:OFS调整出库--->U8C其它出库.中台转发失败,失败原因:{}", ztResult.getMsg()); + } + Attribute attribute = ztResult.getAttribute(); + System.out.println(attribute); + boolean isSuccess = false; - String vbillcode=""; - if (response != null && !"".equals(response)) { - ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - if ("success".equals(reusltStrDto.getStatus())) { - isSuccess = true; - String data = reusltStrDto.getData(); - GeneralBillVO_4IDto resGeneralBillVO = resultDataHandle(data); - System.out.println(resGeneralBillVO); - vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); - } + String vbillcode = ""; + if ("success".equals(attribute.getStatus())) { + isSuccess = true; + String data = attribute.getData(); + GeneralBillVO_4IDto resGeneralBillVO = resultDataHandle(data); + System.out.println(resGeneralBillVO); + vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); } if (!isSuccess) { - Assert.state(false, "推送U8C--> 丽知:OFS调整入库--->U8C其它入库 失败 接口返回结果:{} 接口入参:{}", response, mapStr); + Assert.state(false, "推送U8C--> 丽知:OFS调整出库--->U8C其它出库 失败 接口返回结果:{} 接口入参:{}", response, mapStr); } //成功 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); @@ -363,18 +375,17 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(format); integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); - integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);//u8c其他出库单号 -// integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);//u8c其他出库单号 + integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode); + integrationTaskLivingDetailsEntity.setDef1(vbillcode);//u8c其他出库单号 integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); logger.error("推送U8C,丽知:OFS调整出库--->U8C其它出库失败,失败原因:" + e); ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - String ErrMessage ="推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:"+ reusltStrDto.getErrormsg(); - + String ErrMessage = "推送U8C,丽知:OFS调整出库--->U8C其它出库失败,失败原因:" + reusltStrDto.getErrormsg(); //失败 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); @@ -404,7 +415,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { StockoutOrderSearchResponse stockoutOrderSearchResponse = SaleOutReturnMessageDto2StockoutOrderSearchResponse(saleOutReturnMessageDto); System.out.println(stockoutOrderSearchResponse); - if(stockoutOrderSearchResponse.getData()==null||stockoutOrderSearchResponse.getData().size()==0){ + if (stockoutOrderSearchResponse.getData() == null || stockoutOrderSearchResponse.getData().size() == 0) { return null; } return stockoutOrderSearchResponse.getData(); @@ -412,21 +423,22 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { /** * 只是命名不一样,为了方便区分,顾转换为stockout + * * @param saleOutReturnMessageDto * @return */ - public StockoutOrderSearchResponse SaleOutReturnMessageDto2StockoutOrderSearchResponse(SaleOutReturnMessageDto saleOutReturnMessageDto){ + public StockoutOrderSearchResponse SaleOutReturnMessageDto2StockoutOrderSearchResponse(SaleOutReturnMessageDto saleOutReturnMessageDto) { StockoutOrderSearchResponse stockoutOrderSearchResponse = new StockoutOrderSearchResponse(); - List data=new ArrayList<>(); - BeanUtils.copyProperties(saleOutReturnMessageDto,stockoutOrderSearchResponse); + List data = new ArrayList<>(); + BeanUtils.copyProperties(saleOutReturnMessageDto, stockoutOrderSearchResponse); for (HeaderDetailsDto saleOutData : saleOutReturnMessageDto.getData()) { HeaderDto saleOutHeader = saleOutData.getHeader(); StockoutOrderSearchResponse.StockoutOrder stockoutOrder = new StockoutOrderSearchResponse.StockoutOrder(); StockoutOrderSearchResponse.StockoutOrder.StockoutH stockoutH = new StockoutOrderSearchResponse.StockoutOrder.StockoutH(); - List stockoutBList=new ArrayList<>(); + List stockoutBList = new ArrayList<>(); for (DetailsDto saleOutDetail : saleOutData.getDetails()) { StockoutOrderSearchResponse.StockoutOrder.StockoutB stockoutB = new StockoutOrderSearchResponse.StockoutOrder.StockoutB(); - BeanUtils.copyProperties(saleOutDetail,stockoutB); + BeanUtils.copyProperties(saleOutDetail, stockoutB); stockoutBList.add(stockoutB); } //创建时间,修改时间,创建人,修改人,赋给表头 @@ -436,7 +448,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { stockoutH.setLastUpdated(stockoutB.getLastUpdated()); stockoutH.setLastUpdatedBy(stockoutB.getLastUpdatedBy()); - BeanUtils.copyProperties(saleOutHeader,stockoutH); + BeanUtils.copyProperties(saleOutHeader, stockoutH); stockoutOrder.setHeader(stockoutH); stockoutOrder.setDetails(stockoutBList); data.add(stockoutOrder); 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 44d1d008..c989a214 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 @@ -145,7 +145,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { boolean isExis = true; IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setRootAppPk(requestVo.getParentvo().getCustcode()); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y_H); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustmandocPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustmandocPluginInitializer.java deleted file mode 100644 index f2bd6ccd..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustmandocPluginInitializer.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.hzya.frame.plugin.lets.plugin.base; - -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.queryvo.CustdocRequestVo; - -import com.hzya.frame.plugin.lets.queryvo.CustmandocRequestVo; -import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo; -import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto; -import com.hzya.frame.plugin.lets.u8cdto.CustmandocEntityDto; -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.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; -import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; -import com.hzya.frame.web.entity.JsonResultEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; - -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.concurrent.locks.ReentrantLock; - -/** - * @Author - * @Date 2024/8/12 15:25 - * @PackageName:com.hzya.frame.plugin.lets.plugin.base - * @ClassName: CustmandocPluginInitializer - * @Description: 客商管理档案 - */ -public class CustmandocPluginInitializer extends PluginBaseEntity { - - Logger logger = LoggerFactory.getLogger(CustmandocPluginInitializer.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 "com.hzya.frame.plugin.lets.plugin.base.CustmandocPluginInitializer"; - } - - @Override - public String getPluginName() { - return "丽知:OFS客商档案--->U8C客商管理档案"; - } - - @Override - public String getPluginLabel() { - return "丽知:U8C客商基本档案--->U8C客商管理档案"; - } - - @Override - public String getPluginType() { - return "1"; - } - - @Autowired - private PushDataByU8cUtil pushDataByU8cUtil; - @Autowired - private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; - @Autowired - private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; - - @Override - public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - return null; - } - - - /** - * 默认推送 - */ - public void start() { - try { - //获取符合条件客商基本档案 - List custdocRequestVos = queryCustDoc(); - implement(custdocRequestVos); - } catch (Exception e) { - logger.error("丽知:U8C客商基本档案 --->U8C客商管理档案 ,start()方法报错:", e); - } - } - - /** - * 查询客商基本档案 - * @return - */ - private List queryCustDoc() { - List custdocRequestVos=null; - try { - String data = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocQuery"), "{}"); - CbdocResultVo cbdocResultVo = JSONObject.parseObject(data, CbdocResultVo.class); - String datastring = cbdocResultVo.getData(); - Map map = JSONObject.parseObject(datastring, Map.class); - Object o = map.get("datas"); - List list = JSONObject.parseArray(JSON.toJSONString(o), CustdocRequestVo.class); - custdocRequestVos = filterData(list); - - } catch (Exception e) { - logger.error("丽知:查询客商基本档案失败", e); - } - return custdocRequestVos; - } - - private List filterData(List list) { - List filterlist = new ArrayList<>(); - for (CustdocRequestVo requestVo : list) { - if("N".equals(requestVo.getParentvo().getDef11())){ - filterlist.add(requestVo); - } - } - return filterlist; - } - - public void implement(List list) { - for (CustdocRequestVo vo : list) { - String mandocjsonString = ""; - //生成业务日期 - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 定义日期格式 - Date date = new Date(System.currentTimeMillis()); // 创建Date对象 - String businessFormat = sdf.format(date); // 将Date对象格式化为字符串 - - CustdocEntityDto parentvo = vo.getParentvo(); - try { - - parentvo.setPk_areacl("F"); - CustmandocRequestVo custmandocRequestVo = new CustmandocRequestVo(); - custmandocRequestVo.setParentvo(parentvo); - custmandocRequestVo.setAddrs(vo.getAddrs()); -// custmandocRequestVo.setBanks(vo.getBanks()); - - CustmandocEntityDto custmandocEntityDto = new CustmandocEntityDto(); - custmandocEntityDto.setCustflag("0"); - CustmandocEntityDto custmandocEntityDto1 = new CustmandocEntityDto(); - custmandocEntityDto1.setCustflag("4"); - List custmandocEntities = new ArrayList<>(); - custmandocEntities.add(custmandocEntityDto); - custmandocEntities.add(custmandocEntityDto1); - custmandocRequestVo.setChildrenvo(custmandocEntities); - HashMap mandocparam = new HashMap<>(); - mandocparam.put("billvo", custmandocRequestVo); - mandocjsonString = JSONObject.toJSONString(mandocparam); - String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custmandocSave"), mandocjsonString); - 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; - updateDoc(vo); - } - } - if (!isSuccess) { - Assert.state(false, "推送U8C-->丽知:U8C客商基本档案 --->U8C客商管理档案 失败 接口返回结果:{} 接口入参:{}", response, mandocjsonString); - } - //成功 - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); - integrationTaskLivingDetailsEntity.setRootAppNewData(mandocjsonString); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(parentvo.getPk_cubasdoc()); - integrationTaskLivingDetailsEntity.setRootAppBill(parentvo.getCustcode()); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - - - } catch (Exception e) { - e.printStackTrace(); - logger.error("丽知:U8C客商基本档案 --->U8C客商管理档案 ,implement()方法报错", e); - //失败 - String ErrMessage = e.getMessage(); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); - integrationTaskLivingDetailsEntity.setRootAppNewData(mandocjsonString); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat); - integrationTaskLivingDetailsEntity.setRootAppPk(parentvo.getPk_cubasdoc()); - integrationTaskLivingDetailsEntity.setRootAppBill(parentvo.getCustcode()); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - } - } - } - - private void updateDoc(CustdocRequestVo custdocRequestVo) { - //已分配 - String pkCubasdoc = custdocRequestVo.getParentvo().getPk_cubasdoc(); - String createtime = custdocRequestVo.getParentvo().getCreatetime(); - - custdocRequestVo.getParentvo().setDef11("Y"); - ArrayList requestVos = new ArrayList<>(); - requestVos.add(custdocRequestVo); - HashMap map = new HashMap<>(); - map.put("custbasvo", requestVos); - String data = JSONObject.toJSONString(map); - try { - String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocUpdate"), data); - - 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, "更新客商基本档案失败 接口返回结果:{} 接口入参:{}", response, data); - } - //成功 - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); - integrationTaskLivingDetailsEntity.setRootAppNewData(data); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(createtime); - integrationTaskLivingDetailsEntity.setRootAppPk(pkCubasdoc); - integrationTaskLivingDetailsEntity.setRootAppBill(pkCubasdoc); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - - } catch (Exception e) { - //失败 - logger.error("U8C->客商基本档案更新updateDoc(CustdocRequestVo custdocRequestVo)方法失败"); - String ErrMessage = e.getMessage(); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); - integrationTaskLivingDetailsEntity.setRootAppNewData(data); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(createtime); - integrationTaskLivingDetailsEntity.setRootAppPk(pkCubasdoc); - integrationTaskLivingDetailsEntity.setRootAppBill(pkCubasdoc); - 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 b9ff19f0..80bc2a39 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 @@ -210,10 +210,6 @@ public class ShopPluginInitializer extends PluginBaseEntity { // parentvo.setCustcode(shopEntity.getCustomerCode()); // parentvo.setCustcode(shopEntity.getBizCode()); // parentvo.setPk_areacl("F"); - //设置还未分配公司 -// parentvo.setDef10("N"); -// //设置还未同步到管理档案 -// parentvo.setDef11("N"); // parentvo.setCustprop("2"); custdocRequestVo.setParentvo(parentvo); @@ -284,7 +280,7 @@ public class ShopPluginInitializer extends PluginBaseEntity { boolean isExis = true; IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setRootAppPk(ofsShopDto.getBizCode()); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y_H); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/queryvo/CustmandocRequestVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/queryvo/CustmandocRequestVo.java deleted file mode 100644 index 38836018..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/queryvo/CustmandocRequestVo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hzya.frame.plugin.lets.queryvo; - -import com.hzya.frame.plugin.lets.entity.BdCumandocEntity; -import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto; -import com.hzya.frame.plugin.lets.u8cdto.CustmandocEntityDto; -import lombok.Data; - -import java.util.List; - -/** - * @Author - * @Date 2024/8/8 15:17 - * @PackageName:com.hzya.frame.plugin.lets.plugin.base.vo - * @ClassName: CustmandocRequestVo - * @Description: TODO - */ -@Data -public class CustmandocRequestVo { - private List addrs; - private List custBanks; - - private List childrenvo; - private CustdocEntityDto parentvo; -} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/CustmandocEntityDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/CustmandocEntityDto.java deleted file mode 100644 index 72922e2b..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/CustmandocEntityDto.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.hzya.frame.plugin.lets.u8cdto; - - -import lombok.Data; - -import java.util.List; - -/** - * @Author - * @Date 2024/8/8 15:15 - * @PackageName:com.hzya.frame.plugin.lets.plugin.base.vo - * @ClassName: BdCumandocEntity - * @Description: 客商管理档案 - */ -@Data -public class CustmandocEntityDto { - // 于客商总公司账期控制 - private boolean acclimitcontrol; - // 呼机 - private String bp; - // 助记码 - private String cmnecode; - // 是否收付协同 - private boolean cooperateflag; - // 合作期限从 - private String cooperatingdayfrom; - // 合作期限到 - private String cooperatingdayto; - // 创建时间 - private String createtime; - // 创建人 - - private String creator; - // 基于客商总公司信用控制 - private boolean creditcontrol; - // 信用等级(填写编码) - private String creditlevel; - // 信用期限 - private int creditlimitnum; - // 信用额度 - private double creditmny; - // 信用保证金 - private double creditmoney; - // 是否信用管制 - private String credlimitflag; - // 客商编码 - private String custcode; - //由于客商管理档案在数据库表中存的两条,所以childrenvo如果传的话需要传两条,这两条数据的客商属性字段必须是这些组合(客户0和4,供应商1和空格,客商2和3),不传childrenvo默认是客户0和4 - private String custflag; - // 客商名称 - private String custname; - // 客商状态 - private String custstate; - - private String def1; - - private String def10; - - private String def11; - - private String def12; - - private String def13; - - private String def14; - private String def15; - - private String def16; - - private String def17; - - private String def18; - - private String def19; - - private String def2; - - private String def20; - - private String def21; - - private String def22; - - private String def23; - - private String def24; - - private String def25; - private String def26; - - private String def27; - - private String def28; - - private String def29; - - private String def3; - - private String def30; - - private String def4; - - private String def5; - - private String def6; - - private String def7; - - private String def8; - - private String def9; - // 发展日期 - private String developdate; - //是否允许异币种核算 - private String diffcurrflag; - // 扣率 - private String discountrate; - // 删除标志 - private int dr; - // 免于帐期检查 - private boolean freeofacclmtcheck; - // 免于信用额度检查 - private boolean freeofcremnycheck; - // 冻结时间 - private String frozendate; - // 是否冻结 - private boolean frozenflag; - - // 等级 - private int grade; - // 内控帐期天数 - private String innerctldays; - // 筹投资单位 - private boolean iounit; - // 是否零售加盟店 - private boolean isagent; - // 是否催款 - private boolean ispromtesettlement; - // 联系人 - private String linkman; - // 备注 - private String memo; - // 手机 - private String mobilephone; - // 修改人 - private String modifier; - // 修改时间 - private String modifytime; - // 地区分类 - private String pk_areacl; - // 库存组织(填写编码) - private String pk_calbody; - // 公司(填写编码) - private String pk_corp; - // 默认交易币种(填写编码) - private String pk_currtype1; - // 开票客商(填写编码) - private String pk_cusmandoc2; - // 发货客商(填写编码) - private String pk_cusmandoc3; - // 默认业务类型(填写编码) - private String pk_defbusitype; - // 默认收付款协议(填写编码) - private String pk_payterm; - // 公司价格分组(填写编码) - private String pk_pricegroupcorp; - // 专管部门(填写编码) - private String pk_respdept1; - // 专管业务员(填写编码) - private String pk_resppsn1; - // 销售组织(填写编码) - private String pk_salestru; - // 发运方式(填写编码) - private String pk_sendtype; - // 结算单位主键(已废弃) - private String pk_settleunit; - // 仓库档案(填写编码) - private String pk_stordoc2; - // 预收款比例 - private int prepaidratio; - // 批准日期 - private String ratifydate; - // 封存标志 - private String sealflag; - // 存货最低售价比例 - private int stockpriceratio; - // 新产品试销保证金 - private double testsalemoney; -} - - - - - - - - - - diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/PushDataByU8cUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/PushDataByU8cUtil.java index 588cb604..b05d8046 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/PushDataByU8cUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/PushDataByU8cUtil.java @@ -40,7 +40,7 @@ public class PushDataByU8cUtil { .setSocketTimeout(300000) // 读取超时时间为60秒 .build(); - HttpPost post = new HttpPost(OverallConstant.getOverAllValue("u8cApiServiceNamePK") + url); + HttpPost post = new HttpPost(OverallConstant.getOverAllValue("u8cApiUrl") + url); post.setHeader("Content-Type", "application/json;charset=UTF-8"); post.setHeader("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")); post.setHeader("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")); @@ -100,7 +100,7 @@ public class PushDataByU8cUtil { .setSocketTimeout(300000) // 读取超时时间为60秒 .build(); - HttpPost post = new HttpPost(OverallConstant.getOverAllValue("u8cApiServiceNameCode") + url); + HttpPost post = new HttpPost(OverallConstant.getOverAllValue("u8cApiUrl") + url); post.setHeader("Content-Type", "application/json;charset=UTF-8"); post.setHeader("usercode", OverallConstant.getOverAllValue("u8cApiUsercodeCode")); post.setHeader("password", OverallConstant.getOverAllValue("u8cApiPasswordCode")); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/Attribute.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/Attribute.java new file mode 100644 index 00000000..fca42d35 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/Attribute.java @@ -0,0 +1,17 @@ +package com.hzya.frame.plugin.lets.util.pushData; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * U8C返回参数 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Attribute { + private String status; + private String taskNumber; + private String data; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java new file mode 100644 index 00000000..dd869fc8 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java @@ -0,0 +1,107 @@ +package com.hzya.frame.plugin.lets.util.pushData; + +import cn.hutool.core.lang.Assert; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.hzya.frame.plugin.lets.constant.OverallConstant; +import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.stereotype.Component; + +/** + * 通过中台推送U8C推送工具类. + */ +@Component +public class PushU8CByApiCode { + + private static String appId = "800037"; + private static String publicKey = "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj";//用安中台 + private static String secretKey = "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=";//用安中台 + + /** + * 发起post请求,传递json类型 + * + * @param apicode 地址 + * @param data 请求参数 + * @return 返回消息 + */ + public ZTResult pushByPK(String apicode, String data) throws Exception { + Assert.notNull(apicode, "请求地址不能为空"); + Assert.notNull(data, "请求参数不能为空(需要JSON格式)"); + + CloseableHttpClient httpclient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(OverallConstant.getOverAllValue("u8cApiUrl")); + httpPost.setHeader("Content-Type", "application/json"); + //u8c + httpPost.setHeader("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")); + httpPost.setHeader("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")); + httpPost.setHeader("trantype", OverallConstant.getOverAllValue("u8cApiTrantypePK")); + httpPost.setHeader("system", OverallConstant.getOverAllValue("u8cApiSystemPK")); + httpPost.setHeader("needStackTrace", OverallConstant.getOverAllValue("u8cApiNeedStackTracePK")); + //中台 + httpPost.setHeader("publicKey", publicKey); + httpPost.setHeader("secretKey", secretKey); + //app + httpPost.setHeader("appId", appId); + httpPost.setHeader("apicode", apicode); + //data + httpPost.setEntity(new StringEntity(data, "UTF-8")); + CloseableHttpResponse response = httpclient.execute(httpPost); + + HttpEntity entity = response.getEntity(); + String result = EntityUtils.toString(entity); + EntityUtils.consume(entity); + ZTResult ztResult = JSON.parseObject(result).toJavaObject(ZTResult.class); + + return ztResult; + } + + /** + * 发起post请求,传递json类型 + *

+ * u8c code模式。 + * + * @param apicode + * @param data 请求参数 + * @return 返回消息 + */ + public ZTResult pushByCode(String apicode, String data) throws Exception { + Assert.notNull(apicode, "请求地址不能为空"); + Assert.notNull(data, "请求参数不能为空(需要JSON格式)"); + + CloseableHttpClient httpclient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(ProfilesActiveConstant.U8C_URL); + httpPost.setHeader("Content-Type", "application/json"); + //u8c + httpPost.setHeader("usercode", OverallConstant.getOverAllValue("u8cApiUsercodeCode")); + httpPost.setHeader("password", OverallConstant.getOverAllValue("u8cApiPasswordCode")); + httpPost.setHeader("trantype", OverallConstant.getOverAllValue("u8cApiTrantypeCode")); + httpPost.setHeader("system", OverallConstant.getOverAllValue("u8cApiSystemCode")); + httpPost.setHeader("needStackTrace", OverallConstant.getOverAllValue("u8cApiNeedStackTraceCode")); + //中台 + httpPost.setHeader("publicKey", publicKey); + httpPost.setHeader("secretKey", secretKey); + //app + httpPost.setHeader("appId", appId); + httpPost.setHeader("apicode", apicode); + //data + httpPost.setEntity(new StringEntity(data, "UTF-8")); + CloseableHttpResponse response = httpclient.execute(httpPost); + HttpEntity entity = response.getEntity(); + String result = EntityUtils.toString(entity); + EntityUtils.consume(entity); + ZTResult ztResult = JSON.parseObject(result).toJavaObject(ZTResult.class); + + return ztResult; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/ZTResult.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/ZTResult.java new file mode 100644 index 00000000..f80fadd0 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/ZTResult.java @@ -0,0 +1,18 @@ +package com.hzya.frame.plugin.lets.util.pushData; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ZTResult { + private String msg; + private String type; + private String flag; + private String status; + private Attribute attribute; + private String headMsg; + +}