发票识别bug修改

This commit is contained in:
李贵强 2024-12-18 11:42:14 +08:00
parent 35881d6a33
commit 47cb24fb2d
1 changed files with 23 additions and 11 deletions

View File

@ -56,6 +56,7 @@ import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
import kd.bos.servicehelper.operation.DeleteServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.bos.url.UrlService;
import kd.bos.util.FileNameUtils;
@ -86,7 +87,7 @@ import java.util.stream.Collectors;
*/
public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF7SelectListener {
private static final Log logger = LogFactory.getLog(OAUtils.class);
private static final Log logger = LogFactory.getLog(ReconPayreqFormPlugin.class);
List<String> fileExtendList = new ArrayList<String>(Arrays.asList("png","jpg","jpeg","ofd","pdf","xml"));//发票文件后缀集合
@ -226,7 +227,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
String description = data.getString("description");//发票名称
String qeug_invoicecode = "";//发票代码初始定义
String qeug_invoiceno = "";//发票号码
BigDecimal qeug_notaxamt = BigDecimal.ZERO;//不含税金额
BigDecimal qeug_notaxamt = BigDecimal.ZERO;//不含税金额
BigDecimal qeug_tax = BigDecimal.ZERO;//税额
BigDecimal qeug_amount = BigDecimal.ZERO;//价税合计
Date qeug_bizdate = null;//开票日期
@ -327,9 +328,11 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
String pi_key = result.getString("pi_key");//发票结果key
DynamicObject recon_invoicebill = BusinessDataServiceHelper.newDynamicObject("recon_invoicebill");
// DynamicObject recon_invoicebill1 = BusinessDataServiceHelper.loadSingle("2031274535679975424", "recon_invoicebill");
recon_invoicebill.set("billstatus","C");//单据状态
recon_invoicebill.set("billstatus","A");//单据状态
//所属组织
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, "DOBE")});
//DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, "dobe")});
long rootOrgId = OrgUnitServiceHelper.getRootOrgId();
DynamicObject org = BusinessDataServiceHelper.loadSingle(rootOrgId, "bos_org");
if (null != org) {
recon_invoicebill.set("org",org);
}
@ -410,9 +413,18 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
invoiceentr.set("entry_content",description);//项目名称
invoiceentr.set("entry_notaxamt",qeug_amount);
}
OperationServiceHelper.executeOperate("save","recon_invoicebill",new DynamicObject[]{recon_invoicebill});
OperationServiceHelper.executeOperate("submit","recon_invoicebill",new DynamicObject[]{recon_invoicebill});
OperationServiceHelper.executeOperate("audit","recon_invoicebill",new DynamicObject[]{recon_invoicebill});
OperationResult operationResult = OperationServiceHelper.executeOperate("save", "recon_invoicebill", new DynamicObject[]{recon_invoicebill});
if (!operationResult.isSuccess()){
logger.error(operationResult.getMessage());
}
OperationResult operationResult1 = OperationServiceHelper.executeOperate("submit", "recon_invoicebill", new DynamicObject[]{recon_invoicebill});
if (!operationResult1.isSuccess()){
logger.error(operationResult1.getMessage());
}
OperationResult operationResult2 = OperationServiceHelper.executeOperate("audit", "recon_invoicebill", new DynamicObject[]{recon_invoicebill});
if (!operationResult2.isSuccess()){
logger.error(operationResult2.getMessage());
}
//todo:添加发票信息分录
DynamicObject dynamicObject = invoiceentry.addNew();//新增分录行
//todo:模仿标品新增字段,为接口返回数据反写分录做准备
@ -734,7 +746,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
String oaUrl = System.getProperty("oaurl");
logger.info("密钥接口mc获取的oaUrl\n{}", oaUrl);
String linkUrl =oaUrl+ "/seeyon/rest/token";
// String linkUrl = "http://172.31.254.240:9090/seeyon/rest/token";
//String linkUrl = "http://172.31.254.240:9090/seeyon/rest/token";
//接口请求体
JSONObject linkBody = new JSONObject();
linkBody.put("userName", userName);
@ -765,7 +777,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
logger.info("解析图片接口mc获取的oaUrl\n{}", oaUrl);
String linkUrl = oaUrl+"/seeyon/rest/lexmisciv/kekai/parseOCRData";
System.out.println("test");
// String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/parseOCRData";
//String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/parseOCRData";
//接口请求体
JSONObject linkBody = new JSONObject();
linkBody.put("taxno", taxno);
@ -795,7 +807,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
String oaUrl = System.getProperty("oaurl");
logger.info("保存验真接口mc获取的oaUrl\n{}", oaUrl);
String linkUrl = oaUrl+"/seeyon/rest/lexmisciv/kekai/saveOutInvoice";
// String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/saveOutInvoice";
//String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/saveOutInvoice";
//接口请求体
JSONObject linkBody = new JSONObject();
linkBody.put("taxno", taxno);
@ -826,7 +838,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
String oaUrl = System.getProperty("oaurl");
logger.info("删除接口mc获取的oaUrl\n{}", oaUrl);
String linkUrl = oaUrl+"/seeyon/rest/lexmisciv/kekai/delInvoice";
// String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/delInvoice";
//String linkUrl = "http://172.31.254.240:9090/seeyon/rest/lexmisciv/kekai/delInvoice";
//接口请求体
Map<String, String> saveCheckHeader = new HashMap<>();
saveCheckHeader.put("Content-Type", "application/json");