diff --git a/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java index 906245d7..4f58914a 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java +++ b/dxhy-core/src/main/java/com/dxhy/core/dao/mailGather/EmailMaintainDao.java @@ -88,5 +88,6 @@ public interface EmailMaintainDao extends BaseMapper { String getUserName(@Param("userCode") String userCode); + String getUserByUsername(@Param("username") String username); } diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java index 39d12fe3..9db4ec0f 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/EmailMaintainService.java @@ -49,6 +49,7 @@ public interface EmailMaintainService { boolean deleteById(String id); String getUserName(String userCode); + String getUserByUsername(String username); int insertBatch(List entities); diff --git a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java index 4d678356..4c1a166e 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java +++ b/dxhy-core/src/main/java/com/dxhy/core/service/mailGather/impl/EmailMaintainServiceImpl.java @@ -99,6 +99,7 @@ public class EmailMaintainServiceImpl implements EmailMaintainService { */ @Override public boolean update(EmailMaintainVo emailMaintain) { + DynamicContextHolder.push(DbConstant.BASICS_WRITE); emailMaintain.setModifyTime(new Date()); int update = this.emailMaintainDao.update(emailMaintain); return update > 0 ; @@ -121,6 +122,13 @@ public class EmailMaintainServiceImpl implements EmailMaintainService { return emailMaintainDao.getUserName(userCode); } + + @Override + public String getUserByUsername(String username) { + DynamicContextHolder.push("business_itax_read"); + return emailMaintainDao.getUserByUsername(username); + } + @Override public int insertBatch(List entities) { return emailMaintainDao.insertBatch(entities); diff --git a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java index cf12afa9..6df7e37d 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java +++ b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTask.java @@ -150,6 +150,10 @@ public class SnEmailGatherTask { String uid = inbox.getUID(msg); if(StringUtils.isBlank(maintainVo.getEmailUid()) && i+1 == messages.length){ emailMaintainVo.setEmailUid(uid); + buildEmailMaintainVo(emailMaintainVo); + } else if(i+1 == messages.length){ + emailMaintainVo.setEmailUid(uid); + buildEmailMaintainVo(emailMaintainVo); } //增量处理 等于之后就跳过本地循环 if(StringUtils.isNotBlank(maintainVo.getEmailUid()) && maintainVo.getEmailUid().equals(uid)){ @@ -163,6 +167,12 @@ public class SnEmailGatherTask { List> mapList = Lists.newArrayList(); EmailParseUtils.saveAttachment(msg, mapList); log.debug("获取附件的数量:"+mapList.size()); + if(StringUtils.isNotEmpty(maintainVo.getUserId())){ + String username = emailMaintainService.getUserByUsername(maintainVo.getUserId()); + if(StringUtils.isNotEmpty(username)){ + maintainVo.setUserId(username); + } + } for (Map map : mapList) { map.put("emailName",emailName); String pdfStream = map.get("pdfStream"); @@ -223,13 +233,18 @@ public class SnEmailGatherTask { } } + public void buildEmailMaintainVo(EmailMaintainVo emailMaintainVo){ + emailMaintainService.update(emailMaintainVo); + } + + public void buildMsg(MailGatherLogVo gatherLogVo, String type, String msg){ gatherLogVo.setOcrType(type); gatherLogVo.setErrorMsg(msg); mailGatherLogService.insert(gatherLogVo); } - public static Map convertToOcrResult(List openServiceOcrs, Map map,EmailMaintainVo maintainVo){ + public Map convertToOcrResult(List openServiceOcrs, Map map,EmailMaintainVo maintainVo){ List resultToyxVoList = Lists.newArrayList(); Map hashMap = Maps.newHashMap(); String batchId = String.valueOf(System.currentTimeMillis()); @@ -251,7 +266,6 @@ public class SnEmailGatherTask { resultToyxVo.setFileByte(map.get("pdfStream")); resultToyxVo.setEmail(map.get("emailName")); resultToyxVo.setEmployeeId(maintainVo.getUserId()); - resultToyxVoList.add(resultToyxVo); } hashMap.put("list",resultToyxVoList); diff --git a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTaskTest.java b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTaskTest.java index 3c5b6fdb..b730a49a 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTaskTest.java +++ b/dxhy-core/src/main/java/com/dxhy/core/task/SnEmailGatherTaskTest.java @@ -39,8 +39,6 @@ class SnEmailGatherTaskTest { String mail_host = "mail.pop3.host"; String emailName = "745139984@qq.com"; String password = "ncmydeiilzyabfgb"; -// String emailName = "15201210373@163.com"; -// String password = "JKZATQTPHDDQTQSH"; String mailSuffix = emailName.split("@")[1]; //邮箱类型 String mailType = mailSuffix.split("\\.")[0]; diff --git a/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml index 0d695302..f9ea5525 100644 --- a/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml +++ b/dxhy-core/src/main/resources/mapper/mailGather/EmailMaintainMapper.xml @@ -165,6 +165,10 @@ select username from sys_user where loginname = #{userCode} + + diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java b/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java index 4b8bb024..a84f03b8 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java @@ -401,6 +401,7 @@ public class SDNYMainProcessController extends AbstractController { log.info("查询的组织信息为:{}",JSONObject.toJSONString(orgByCompCode)); String company = orgByCompCode.getCompany(); String taxno = orgByCompCode.getTaxno(); + String taxname = orgByCompCode.getTaxname(); String result = ""; @@ -414,6 +415,7 @@ public class SDNYMainProcessController extends AbstractController { TDxInvoiceReimburse reimburse = new TDxInvoiceReimburse(); reimburse.setImageId(imageId); reimburse.setCompCode(compCode); + reimburse.setGfName(taxname); SNSAPObject object = new SNSAPObject(); object.setSYSID("FPXT"); @@ -439,6 +441,12 @@ public class SDNYMainProcessController extends AbstractController { for (SNInvoice invoice : invoiceInfoList) { String fplxdm = ""; String snFplx = ""; + if (invoice.getPurchaserTaxNo() == null || "".equals(invoice.getPurchaserTaxNo())){ + invoice.setPurchaserTaxNo(taxno); + } + if (invoice.getPurchaserName() == null || "".equals(invoice.getPurchaserName())){ + invoice.setPurchaserName(taxname); + } result = snPushCheckRecordService.updateInvoicePoll(company, taxno, reimburse, invoice, fplxdm, imageId, compCode); //价税分离判断 diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java index a1829dff..e17065dd 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java @@ -137,8 +137,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { String kprq = snInvoice.getBillingDate(); String je = snInvoice.getTotalAmount(); + String amountTax = snInvoice.getAmountTax(); String xfsh = snInvoice.getSalesTaxNo(); - String se = snInvoice.getAmountTax(); + String se = snInvoice.getTotalTax(); String gfsbh = snInvoice.getPurchaserTaxNo(); String gfmc = snInvoice.getPurchaserName(); String invoiceType = snInvoice.getInvoiceType(); @@ -161,11 +162,27 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { if (se != null) { recordInvoice.setTaxAmount(new BigDecimal(se)); } + if (amountTax != null){ + recordInvoice.setTotalAmount(new BigDecimal(amountTax)); + } recordInvoice.setXfTaxNo(xfsh); recordInvoice.setGfTaxNo(gfsbh); recordInvoice.setGfName(gfmc); recordInvoice.setCreateDate(new Date().toString()); +// recordInvoice.setGfTaxNo(gfsbh); +// recordInvoice.setGfName(gfmc); + recordInvoice.setRzlx("5"); + recordInvoice.setYqsqStatus("1"); + if(current != null) { + recordInvoice.setYqCurrentPeriod(current.getCurrentTaxPeriod()); + }else{ + SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); + String month = format.format(new Date()); + recordInvoice.setYqCurrentPeriod(month); + } + recordInvoice.setCreateDate(new Date()); + recordInvoice.setYqsqDate(new Date()); recordInvoice.setSourceSystem("2"); recordInvoice.setInvoiceStatus("0"); recordInvoice.setInvoiceType(invoiceType); @@ -194,6 +211,8 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice(); recordInvoice.setImageId(imageId); recordInvoice.setCompCode(compCode); + recordInvoice.setGfTaxNo(snInvoice.getPurchaserTaxNo()); + recordInvoice.setGfName(snInvoice.getPurchaserName()); update = baseTDxRecordInvoiceDao.update(recordInvoice, recordWrapper); diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java index ef4d937a..e44019c8 100644 --- a/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java +++ b/dxhy-extend/src/main/java/com/dxhy/extend/service/pool/ExtInvoicePoolServiceImpl.java @@ -174,7 +174,7 @@ public class ExtInvoicePoolServiceImpl extends MpBaseServiceImpl{}",pageList.get(i).getInAccountStatus()); +// log.info("入账状态====>{}",pageList.get(i).getInAccountStatus()); pageList.get(i).setInvoiceType(InvoiceTypeUtils.invoiceTypeName(pageList.get(i).getInvoiceType())); pageList.get(i).setQsrq(pageList.get(i).getQsrq() == null ? "" : pageList.get(i).getQsrq()); pageList.get(i).setRzrq(pageList.get(i).getRzrq() == null ? "" : pageList.get(i).getRzrq()); diff --git a/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml index 284e7cce..b7ec8776 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml @@ -130,6 +130,7 @@ and t.invoice_source = #{invoiceSource} + and t.invoice_type not in ('91','95','97','99','101','00')