diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnly.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnly.java deleted file mode 100644 index 3d72b9df..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnly.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hzya.frame.plugin.lets.plugin.sales; - -import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.base.PluginBaseEntity; -import com.hzya.frame.web.entity.JsonResultEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * O售后订单(仅退款) -> U8C红字应收单 - * - * @Author:liuyang - * @Package:com.hzya.frame.plugin.lets.plugin.sales - * @Project:kangarooDataCenterV3 - * @name:RefundOnly - * @Date:2024/9/3 17:19 - * @Filename:RefundOnly - */ -public class RefundOnly extends PluginBaseEntity { - - Logger logger = LoggerFactory.getLogger(RefundOnly.class); - - @Override - public void initialize() { - logger.info(getPluginLabel() + "執行初始化方法initialize()"); - } - - @Override - public void destroy() { - logger.info(getPluginLabel() + "執行銷毀方法destroy()"); - } - - @Override - public String getPluginId() { - return "sales.RefundOnly"; - } - - @Override - public String getPluginName() { - return "O售后订单(仅退款)生成U8C红字应收单"; - } - - @Override - public String getPluginLabel() { - return "O售后订单(仅退款)生成U8C红字应收单"; - } - - @Override - public String getPluginType() { - return "3"; - } - - @Override - public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - return null; - } - - -} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java new file mode 100644 index 00000000..84eca303 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java @@ -0,0 +1,149 @@ +package com.hzya.frame.plugin.lets.plugin.sales; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import com.hzya.frame.plugin.lets.util.QueryU8CEntityUtil; +import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil; +import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode; +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.util.Date; + +/** + * O售后订单(仅退款) -> U8C红字应收单 + * + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.plugin.sales + * @Project:kangarooDataCenterV3 + * @name:RefundOnly + * @Date:2024/9/3 17:19 + * @Filename:RefundOnly + */ +public class RefundOnlyPluginInitializer extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(RefundOnlyPluginInitializer.class); + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "sales.RefundOnlyPluginInitializer"; + } + + @Override + public String getPluginName() { + return "丽知:售后订单(仅退款)--->U8C红字应收单"; + } + + @Override + public String getPluginLabel() { + return "丽知:售后订单(仅退款)--->U8C红字应收单"; + } + + @Override + public String getPluginType() { + return "3"; + } + + @Autowired + private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; + @Autowired + private PushU8CByApiCode pushU8CByApiCode; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + @Autowired + private QueryU8CEntityUtil queryU8CEntityUtil; + + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + try { + logger.info("调用:" + getPluginName() + "-插件"); + String prod = "prod"; + String param = String.valueOf(requestJson.get("param")); + if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) { + //按日期 + if (param != null && !"".equals(param)) { + String[] split = param.split("/"); + if (!(split.length == 2)) { + Assert.state(false, "时间格式传递不正确"); + } + Assert.notNull(split[0], "开始时间不能为空"); + Assert.notNull(split[1], "结束时间不能为空"); + start(split[0], split[1]); + } + } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + start(param); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails); + start(integrationTaskLivingDetailsEntity.getRootAppPk()); + } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) { + //默认 + start(); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("executeBusiness方法抛出异常", e); + } + return null; + } + + public void start(){ + try { + //获取当前时间 + Date currentDate = new Date(); + Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10); + Date endTime = DateUtil.offset(currentDate, DateField.MINUTE, -4); + String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"); + String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); + + + }catch (Exception e){ + logger.error("丽知:售后订单(仅退款)--->U8C红字应收单,start()方法报错:"+e); + } + } + public void start(String vbillcode){ + try { + + + + }catch (Exception e){ + logger.error("丽知:售后订单(仅退款)--->U8C红字应收单,start()方法报错:"+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"; + + + + }catch (Exception e){ + logger.error("丽知:售后订单(仅退款)--->U8C红字应收单,start()方法报错:"+e); + } + } + +} \ No newline at end of file diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml index 1dfa4fbe..f816d83e 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml @@ -28,6 +28,9 @@ + + +