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 fac1989c..babb076e 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
@@ -37,6 +37,7 @@ public class OverallConstant {
prodOverPublic.put("bdinvclUpdate", "/u8cloud/api/uapbd/invbasdoc/update");//存货基本档案修改
prodOverPublic.put("bdinvclSeal", "/u8cloud/api/uapbd/invbasdoc/seal");//存货基本档案封存
prodOverPublic.put("bdinvclUnseal", "/u8cloud/api/uapbd/invbasdoc/unseal");//存货基本档案取消封存
+ prodOverPublic.put("bdinvclAllot", "/u8cloud/api/uapbd/invbasdoc/assign");//存货基本档案自动分配
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 d331ab02..3f92604f 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
@@ -5,6 +5,7 @@ package com.hzya.frame.plugin.lets.constant;
*/
public class ProfilesActiveConstant {
+ public static final String LETS_DATE_SOURCE = "lets_u8c";
public static final String LETS_PROFILES_ACTIVE = "dev";
public static final String LOG_STATUS_Y = "Y";
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java
new file mode 100644
index 00000000..ed266462
--- /dev/null
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java
@@ -0,0 +1,275 @@
+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.google.common.collect.Lists;
+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.IBdInvbasdocDao;
+import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
+import com.hzya.frame.plugin.lets.u8cdto.GoodsAutoAllotVO;
+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.u8c.ax.entity.Ass;
+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.*;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * U8C->存货基本档案自动分配全公司
+ * add by zyd 20240808
+ *
+ * 存货基本档案分配 /u8cloud/api/uapbd/invbasdoc/assign
+ */
+public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
+
+ Logger logger = LoggerFactory.getLogger(GoodsAutoAllotPluginInitializer.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.GoodsAutoAllotPluginInitializer";
+ }
+
+ @Override
+ public String getPluginName() {
+ return "丽知:U8C->存货基本档案自动分配全公司";
+ }
+
+ @Override
+ public String getPluginLabel() {
+ return "丽知:U8C->存货基本档案自动分配全公司";
+ }
+
+ @Override
+ public String getPluginType() {
+ return "1";
+ }
+
+ @Autowired
+ private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao;
+ @Autowired
+ private IBdInvbasdocDao bdInvbasdocDao;
+ @Autowired
+ private PushDataByU8cUtil pushDataByU8cUtil;
+ @Autowired
+ private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
+
+ @Override
+ public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
+ 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, -2);
+ String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss");
+ String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
+
+ BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
+ bdInvbasdocEntity.setCreatetime_start_time(startTimeStr);
+ bdInvbasdocEntity.setCreatetime_end_time(endTimeStr);
+ bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ List bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
+ if (bdInvbasdocEntityList.size() == 0) {
+ return;
+ }
+ //过滤日志
+ List filterInvbasdocList = filter(bdInvbasdocEntityList);
+ if (filterInvbasdocList.size() == 0 || filterInvbasdocList == null) {
+ return;
+ }
+
+ //推送:自动分配
+ implement(filterInvbasdocList);
+
+
+ } catch (Exception e) {
+ logger.error("丽知:U8C->存货基本档案自动分配全公司,start()方法报错:", e);
+ }
+ }
+
+ /**
+ * 按存货基本档案主键
+ */
+ public void start(String pkInvbasdoc) {
+ try {
+ BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
+ bdInvbasdocEntity.setPkInvbasdoc(pkInvbasdoc);
+ bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ List bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
+ if (bdInvbasdocEntityList.size() == 0) {
+ Assert.state(false, "U8C->存货基本档案自动分配全公司,存货基本档案主键:{},不存在。", pkInvbasdoc);
+ }
+ //过滤日志
+ List filterInvbasdocList = filter(bdInvbasdocEntityList);
+ if (filterInvbasdocList.size() == 0 || filterInvbasdocList == null) {
+ Assert.state(false, "U8C->存货基本档案自动分配全公司,存货基本档案主键:{},已被分配,请检查。", pkInvbasdoc);
+ }
+ //推送:自动分配
+ implement(filterInvbasdocList);
+
+ } 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";
+
+ BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
+ bdInvbasdocEntity.setCreatetime_start_time(start);
+ bdInvbasdocEntity.setCreatetime_end_time(end);
+ bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
+ List bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
+ if (bdInvbasdocEntityList.size() == 0) {
+ Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},未查到存货基本档案。", startTime,endTime);
+ }
+ //过滤日志
+ List filterInvbasdocList = filter(bdInvbasdocEntityList);
+ if (filterInvbasdocList.size() == 0 || filterInvbasdocList == null) {
+ Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},已被分配,请检查。", startTime,endTime);
+ }
+ //推送:自动分配
+ implement(filterInvbasdocList);
+
+ } catch (Exception e) {
+ logger.error("丽知:U8C->存货基本档案自动分配全公司,start(String startTime, String endTime)方法报错:", e);
+ }
+ }
+
+ /**
+ * 过滤成功日志
+ *
+ * @return
+ */
+ public List filter(List bdInvbasdocEntityList) {
+ List filterInvbasdocList = new ArrayList<>();
+ for (BdInvbasdocEntity bdInvbasdocEntity : bdInvbasdocEntityList) {
+ String rootAppPk = bdInvbasdocEntity.getPkInvbasdoc();
+ boolean isExis = true;
+ IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
+ integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
+ integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
+ if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {
+ isExis = false;
+ }
+ if (!isExis) {
+ filterInvbasdocList.add(bdInvbasdocEntity);
+ }
+
+ }
+ return filterInvbasdocList;
+ }
+
+ /**
+ * U8C->存货基本档案自动分配全公司
+ *
+ * @param filterInvbasdocList
+ */
+ public void implement(List filterInvbasdocList) {
+ for (BdInvbasdocEntity bdInvbasdocEntity : filterInvbasdocList) {
+ //创建日期
+ String createtime = bdInvbasdocEntity.getCreatetime();
+
+ //存货档案主键
+ String pkInvbasdoc = bdInvbasdocEntity.getPkInvbasdoc();
+
+ String mapStr = "";
+
+ try {
+ List goodsAutoAllotVOS = new ArrayList<>();
+ GoodsAutoAllotVO goodsAutoAllotVO = new GoodsAutoAllotVO();
+ //存货基本档案主键
+ goodsAutoAllotVO.setPk_invbasdoc(pkInvbasdoc);
+
+ goodsAutoAllotVOS.add(goodsAutoAllotVO);
+
+ Map map = new HashMap<>();
+ String jsonStr = JSONUtil.toJsonStr(goodsAutoAllotVOS);
+ map.put("invbasdocvo", jsonStr);
+ mapStr = JSONUtil.toJsonStr(map);
+
+ String response = pushDataByU8cUtil.pushU8CByPK(OverallConstant.getOverAllValue("bdinvclAllot"), mapStr);
+ System.out.println(response);
+ boolean isSuccess = false;
+ if (response != null && !"".equals(response)) {
+ ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
+ if ("success".equals(reusltStrDto.getStatus())) {
+ isSuccess = true;
+ }
+ }
+ if (!isSuccess) {
+ Assert.state(false, "推送U8C--> U8C->存货基本档案自动分配全公司 失败 接口返回结果:{} 接口入参:{}", response, jsonStr);
+ }
+
+ //成功
+ IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
+ integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
+ integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
+ integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
+ integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
+ integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
+ integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc);
+ integrationTaskLivingDetailsEntity.setRootAppBill(pkInvbasdoc);
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("U8C->存货基本档案自动分配全公司implement(List filterInvbasdocList)方法失败");
+ //失败
+ String ErrMessage = e.getMessage();
+ IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
+ integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
+ integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
+ integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
+ integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
+ integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
+ integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc);
+ integrationTaskLivingDetailsEntity.setRootAppBill(pkInvbasdoc);
+ integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
+ saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
+ }
+ }
+ }
+}
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsAutoAllotVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsAutoAllotVO.java
new file mode 100644
index 00000000..c17f4717
--- /dev/null
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsAutoAllotVO.java
@@ -0,0 +1,9 @@
+package com.hzya.frame.plugin.lets.u8cdto;
+
+import lombok.Data;
+
+@Data
+public class GoodsAutoAllotVO {
+ private String pk_invbasdoc;
+ private String pk_corp="all";
+}
diff --git a/buildpackage/src/main/resources/application.yml b/buildpackage/src/main/resources/application.yml
index 19b59c47..8450d6bd 100644
--- a/buildpackage/src/main/resources/application.yml
+++ b/buildpackage/src/main/resources/application.yml
@@ -34,7 +34,8 @@ spring:
# use-suffix-pattern: true
profiles:
# active: @profileActive@
- active: @profile.active@
+ active: lets
+# active: @profile.active@
# active: dev
servlet:
multipart:
diff --git a/buildpackage/src/main/resources/cfgHome/plugin/sowow/spring/spring-sowow-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/sowow/spring/spring-sowow-plugin.xml
index c090e1d3..f1af714d 100644
--- a/buildpackage/src/main/resources/cfgHome/plugin/sowow/spring/spring-sowow-plugin.xml
+++ b/buildpackage/src/main/resources/cfgHome/plugin/sowow/spring/spring-sowow-plugin.xml
@@ -6,5 +6,6 @@
+
\ No newline at end of file
diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java
index 5c60217c..e1714116 100644
--- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java
+++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java
@@ -13,9 +13,16 @@ public class BaseTest {
@Autowired
private GoodsClassPluginInitializer goodsClassPluginInitializer;
+ @Autowired
+ private GoodsAutoAllotPluginInitializer goodsAutoAllotPluginInitializer;
@Test
public void t00(){
goodsClassPluginInitializer.start("666");
}
+
+ @Test
+ public void t01(){
+ goodsAutoAllotPluginInitializer.start("0001A210000000000JOC");
+ }
}