丽知:存货基本档案自动分配修改

This commit is contained in:
zhengyf 2024-09-10 15:46:19 +08:00
parent 87b7cca320
commit 69ebe25d37
1 changed files with 29 additions and 20 deletions

View File

@ -13,9 +13,13 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IBdInvbasdocDao; import com.hzya.frame.plugin.lets.dao.IBdInvbasdocDao;
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity; import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
import com.hzya.frame.plugin.lets.u8cdto.GoodsAutoAllotVO; import com.hzya.frame.plugin.lets.u8cdto.GoodsAutoAllotVO;
import com.hzya.frame.plugin.lets.u8cdto.InvBasDocVO;
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto; import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil; import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil; 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.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.u8c.ax.entity.Ass; import com.hzya.frame.u8c.ax.entity.Ass;
@ -76,6 +80,8 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
@Autowired @Autowired
private PushDataByU8cUtil pushDataByU8cUtil; private PushDataByU8cUtil pushDataByU8cUtil;
@Autowired @Autowired
private PushU8CByApiCode pushU8CByApiCode;
@Autowired
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
@Override @Override
@ -124,10 +130,10 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
* 按存货基本档案code * 按存货基本档案code
*/ */
public void start(String invcode) { public void start(String invcode) {
String[] split = invcode.split("_");
try { try {
BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
// bdInvbasdocEntity.setPkInvbasdoc(invcode); bdInvbasdocEntity.setInvcode(split[0]);
bdInvbasdocEntity.setInvcode(invcode);
bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdInvbasdocEntity> bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity); List<BdInvbasdocEntity> bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);
if (bdInvbasdocEntityList.size() == 0) { if (bdInvbasdocEntityList.size() == 0) {
@ -186,7 +192,7 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
public List<BdInvbasdocEntity> filter(List<BdInvbasdocEntity> bdInvbasdocEntityList) { public List<BdInvbasdocEntity> filter(List<BdInvbasdocEntity> bdInvbasdocEntityList) {
List<BdInvbasdocEntity> filterInvbasdocList = new ArrayList<>(); List<BdInvbasdocEntity> filterInvbasdocList = new ArrayList<>();
for (BdInvbasdocEntity bdInvbasdocEntity : bdInvbasdocEntityList) { for (BdInvbasdocEntity bdInvbasdocEntity : bdInvbasdocEntityList) {
String rootAppPk = bdInvbasdocEntity.getInvcode(); String rootAppPk = bdInvbasdocEntity.getInvcode()+"_"+bdInvbasdocEntity.getTs();
boolean isExis = true; boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
@ -215,34 +221,37 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
String createtime = bdInvbasdocEntity.getCreatetime(); String createtime = bdInvbasdocEntity.getCreatetime();
//存货档案主键 //存货档案主键
String pkInvbasdoc = bdInvbasdocEntity.getPkInvbasdoc(); String pkInvbasdoc = bdInvbasdocEntity.getInvcode();
String mapStr = ""; String mapStr = "";
String response = "";
try { try {
List<GoodsAutoAllotVO> goodsAutoAllotVOS = new ArrayList<>();
GoodsAutoAllotVO goodsAutoAllotVO = new GoodsAutoAllotVO(); GoodsAutoAllotVO goodsAutoAllotVO = new GoodsAutoAllotVO();
//存货基本档案主键 //存货基本档案主键
goodsAutoAllotVO.setPk_invbasdoc(pkInvbasdoc); goodsAutoAllotVO.setPk_invbasdoc(pkInvbasdoc);
goodsAutoAllotVOS.add(goodsAutoAllotVO);
Map<String, Object> map = new HashMap<>(); String jsonStr = JSONUtil.toJsonStr(goodsAutoAllotVO);
String jsonStr = JSONUtil.toJsonStr(goodsAutoAllotVOS); mapStr = "{\"invbasdocvo\":["+jsonStr+"]}";
map.put("invbasdocvo", jsonStr);
mapStr = JSONUtil.toJsonStr(map);
String response = pushDataByU8cUtil.pushU8CByPK(OverallConstant.getOverAllValue("bdinvclAllot"), mapStr); ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("bdinvclAllotCode"), mapStr);
System.out.println(response); //两层判断,一层中台转发,一层u8c返回
Attribute attribute = ztResult.getAttribute();
if ("false".equals(ztResult.getFlag())) {
//转发失败
response=JSONUtil.toJsonStr(ztResult.getAttribute());
Assert.state(false, "丽知U8C->存货基本档案自动分配全公司,中台转发失败,失败原因:{}", ztResult.getAttribute());
}
boolean isSuccess = false; boolean isSuccess = false;
if (response != null && !"".equals(response)) { if ("success".equals(attribute.getStatus())) {
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); isSuccess = true;
if ("success".equals(reusltStrDto.getStatus())) { String data = attribute.getData();
isSuccess = true; System.out.println(data);
}
} }
if (!isSuccess) { if (!isSuccess) {
Assert.state(false, "推送U8C--> U8C->存货基本档案自动分配全公司 失败 接口返回结果:{} 接口入参:{}", response, jsonStr); Assert.state(false, "丽知:U8C->存货基本档案自动分配全公司 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr);
} }
//成功 //成功
@ -252,7 +261,7 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(createtime); integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc); integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc+"_"+bdInvbasdocEntity.getTs());
integrationTaskLivingDetailsEntity.setRootAppBill(bdInvbasdocEntity.getInvcode()); integrationTaskLivingDetailsEntity.setRootAppBill(bdInvbasdocEntity.getInvcode());
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
@ -266,7 +275,7 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(createtime); integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc); integrationTaskLivingDetailsEntity.setRootAppPk(pkInvbasdoc+"_"+bdInvbasdocEntity.getTs());
integrationTaskLivingDetailsEntity.setRootAppBill(bdInvbasdocEntity.getInvcode()); integrationTaskLivingDetailsEntity.setRootAppBill(bdInvbasdocEntity.getInvcode());
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);