丽知:新增其他出入库自动签字
This commit is contained in:
parent
42ef86c389
commit
f32ae06d12
|
@ -52,6 +52,9 @@ public class OverallConstant {
|
|||
prodOverPublic.put("otherinqzCode", "8000370007");//库存其他入库保存即签字
|
||||
prodOverPublic.put("otheroutqzCode", "8000370008");//库存其他出库保存即签字
|
||||
|
||||
prodOverPublic.put("otheroutsignCode", "8000370067");//库存其他出库即签字
|
||||
prodOverPublic.put("otherinsignCode", "8000370068");//库存其他入库即签字
|
||||
|
||||
prodOverPublic.put("custdocSaveCode", "8000370062");//客商档案新增
|
||||
prodOverPublic.put("custdocSave", "/u8cloud/api/uapbd/custdoc/insert");//客商档案新增
|
||||
prodOverPublic.put("custdocQuery", "/u8cloud/api/uapbd/custdoc/query");//客商档案查询
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
package com.hzya.frame.plugin.lets.plugin.adjust;
|
||||
|
||||
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;
|
||||
import com.hzya.frame.plugin.lets.constant.OverallConstant;
|
||||
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||
import com.hzya.frame.plugin.lets.dao.IIcGeneralHDao;
|
||||
import com.hzya.frame.plugin.lets.entity.BdCorpEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.IcGeneralHEntity;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.IcGeneralAuditVO;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
|
||||
import com.hzya.frame.plugin.lets.u8cdto.SpecialbillVO;
|
||||
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
|
||||
import com.hzya.frame.plugin.lets.util.QueryU8CEntityUtil;
|
||||
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.service.OfsUnifiedService;
|
||||
|
@ -16,10 +29,15 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* 组装自动生成的其他出库单自动审核。
|
||||
* 自定义项15:ZZ的单子,查询ic_general_h(其他出入库单)
|
||||
*
|
||||
*/
|
||||
public class OtherOutPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(OtherOutPluginInitializer.class);
|
||||
|
@ -64,6 +82,8 @@ public class OtherOutPluginInitializer extends PluginBaseEntity {
|
|||
private OfsUnifiedService ofsUnifiedService;
|
||||
@Autowired
|
||||
private IIcGeneralHDao iIcGeneralHDao;
|
||||
@Autowired
|
||||
private QueryU8CEntityUtil queryU8CEntityUtil;
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
|
@ -106,12 +126,154 @@ public class OtherOutPluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
public void start(){
|
||||
//获取当前时间
|
||||
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");
|
||||
|
||||
|
||||
}
|
||||
public void start(String vbillcode){
|
||||
try {
|
||||
IcGeneralHEntity icGeneralHEntity = new IcGeneralHEntity();
|
||||
icGeneralHEntity.setVuserdef15("ZZ");
|
||||
icGeneralHEntity.setVbillcode(vbillcode);
|
||||
icGeneralHEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<IcGeneralHEntity> icGeneralHList = iIcGeneralHDao.query(icGeneralHEntity);
|
||||
if(icGeneralHList.size()==0){
|
||||
Assert.state(false, "丽知:其他出库单:{},查询到该单据", vbillcode);
|
||||
}
|
||||
//过滤成功日志
|
||||
List<IcGeneralHEntity> filterIcGeneralHList=filterData(icGeneralHList);
|
||||
|
||||
//推送
|
||||
implement(filterIcGeneralHList);
|
||||
}catch (Exception e){
|
||||
logger.error("丽知:其他出库单自动审核,start()方法报错:"+e);
|
||||
}
|
||||
|
||||
}
|
||||
public void start(String startTime, String endTime){
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单据号过滤
|
||||
* vbillcode+pk_corp
|
||||
* @param icGeneralHList
|
||||
* @return
|
||||
*/
|
||||
public List<IcGeneralHEntity> filterData(List<IcGeneralHEntity> icGeneralHList){
|
||||
List<IcGeneralHEntity> filterIcGeneralHList=new ArrayList<>();
|
||||
for (IcGeneralHEntity icGeneralHEntity : icGeneralHList) {
|
||||
String rootAppPk =icGeneralHEntity.getVbillcode()+"_"+icGeneralHEntity.getPkCorp();
|
||||
boolean isExis = true;
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
|
||||
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
|
||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
|
||||
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {
|
||||
isExis = false;
|
||||
}if (!isExis) {
|
||||
filterIcGeneralHList.add(icGeneralHEntity);
|
||||
}
|
||||
}
|
||||
if (filterIcGeneralHList.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return filterIcGeneralHList;
|
||||
}
|
||||
|
||||
|
||||
public void implement(List<IcGeneralHEntity> filterIcGeneralHList){
|
||||
for (IcGeneralHEntity icGeneralHEntity : filterIcGeneralHList) {
|
||||
|
||||
String mapStr = "";
|
||||
String format = icGeneralHEntity.getDbilldate();
|
||||
String response = "";
|
||||
String ofsCode = "";
|
||||
|
||||
try {
|
||||
System.out.println(icGeneralHEntity);
|
||||
|
||||
IcGeneralAuditVO icGeneralAuditVO = new IcGeneralAuditVO();
|
||||
IcGeneralAuditVO.QueryInfo queryInfo = new IcGeneralAuditVO.QueryInfo();
|
||||
|
||||
//单据号
|
||||
queryInfo.setBillcode(icGeneralHEntity.getVbillcode());
|
||||
//公司
|
||||
BdCorpEntity bdCorpEntity = queryU8CEntityUtil.queryBdCorpByPkCorp(icGeneralHEntity.getPkCorp());
|
||||
if (bdCorpEntity == null) {
|
||||
Assert.state(false,"查询公司主键:{},失败。请检查公司主键",icGeneralHEntity.getPkCorp());
|
||||
}
|
||||
queryInfo.setCorp(bdCorpEntity.getUnitcode());
|
||||
|
||||
//审核人
|
||||
IcGeneralAuditVO.SignInfo signInfo = new IcGeneralAuditVO.SignInfo();
|
||||
signInfo.setCoperator(OverallConstant.getOverAllValue("u8cApiZdrCode"));
|
||||
|
||||
icGeneralAuditVO.setQueryInfo(queryInfo);
|
||||
icGeneralAuditVO.setSignInfo(signInfo);
|
||||
|
||||
// mapStr="{"+ JSONUtil.toJsonStr(icGeneralAuditVO)+"}";
|
||||
mapStr=JSONUtil.toJsonStr(icGeneralAuditVO);
|
||||
System.out.println(mapStr);
|
||||
|
||||
//推送
|
||||
ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("otheroutsignCode"), mapStr);
|
||||
//两层判断,一层中台转发,一层u8c返回
|
||||
if ("false".equals(ztResult.getFlag())) {
|
||||
//转发失败
|
||||
response = JSONUtil.toJsonStr(ztResult.getMsg());
|
||||
Assert.state(false, "丽知:其他出库单自动审核,中台转发失败,失败原因:{}", ztResult.getAttribute());
|
||||
}
|
||||
Attribute attribute = ztResult.getAttribute();
|
||||
System.out.println(attribute);
|
||||
boolean isSuccess = false;
|
||||
if ("success".equals(attribute.getStatus())) {
|
||||
isSuccess = true;
|
||||
}
|
||||
if (!isSuccess) {
|
||||
Assert.state(false, "推送U8C--> 丽知:其他出库单自动审核 失败 接口返回结果:{} 接口入参:{}", response, mapStr);
|
||||
}
|
||||
|
||||
//成功
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
|
||||
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||
integrationTaskLivingDetailsEntity.setBusinessDate(format);
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(icGeneralHEntity.getVbillcode()+"_"+icGeneralHEntity.getPkCorp());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(icGeneralHEntity.getVbillcode());
|
||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error("推送U8C--> 丽知:其他出库单自动审核失败,失败原因:" + e);
|
||||
|
||||
//失败
|
||||
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
|
||||
String ErrMessage = "推送U8C--> 丽知:其他出库单自动审核失败,失败原因:" + reusltStrDto.getErrormsg();
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
|
||||
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||
integrationTaskLivingDetailsEntity.setBusinessDate(format);
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(icGeneralHEntity.getVbillcode()+"_"+icGeneralHEntity.getPkCorp());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(icGeneralHEntity.getVbillcode());
|
||||
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.hzya.frame.WebappApplication;
|
|||
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer;
|
||||
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInZZPluginInitializer;
|
||||
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustOutPluginInitializer;
|
||||
import com.hzya.frame.plugin.lets.plugin.adjust.OtherOutPluginInitializer;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -26,6 +27,8 @@ public class TransferTest {
|
|||
private AdjustOutPluginInitializer adjustOutPluginInitializer;
|
||||
@Autowired
|
||||
private AdjustInZZPluginInitializer adjustInZZPluginInitializerm;
|
||||
@Autowired
|
||||
private OtherOutPluginInitializer otherOutPluginInitializer;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////调拨订单
|
||||
// @Test
|
||||
|
@ -109,4 +112,11 @@ public class TransferTest {
|
|||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////组装单
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////出库审核
|
||||
@Test
|
||||
public void t60(){
|
||||
otherOutPluginInitializer.start("TC2409130004");
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////出库审核
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue