|
|
|
@ -11,10 +11,7 @@ import com.dxhy.common.enums.FplxEnum; |
|
|
|
|
import com.dxhy.common.enums.SNFplxEnum; |
|
|
|
|
import com.dxhy.common.util.InvoiceUtil; |
|
|
|
|
import com.dxhy.common.vo.UserInfo; |
|
|
|
|
import com.dxhy.erp.dao.AreaDao; |
|
|
|
|
import com.dxhy.erp.dao.BaseTDxRecordInvoiceDao; |
|
|
|
|
import com.dxhy.erp.dao.BaseTDxTaxCurrentDao; |
|
|
|
|
import com.dxhy.erp.dao.SysDeptDao; |
|
|
|
|
import com.dxhy.erp.dao.*; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoice; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxTaxCurrent; |
|
|
|
|
import com.dxhy.erp.entity.SysDeptEntity; |
|
|
|
@ -26,7 +23,6 @@ import com.dxhy.erp.entity.kfpt.TokenResponse; |
|
|
|
|
import com.dxhy.erp.entity.sdny.InvoiceDetail; |
|
|
|
|
import com.dxhy.erp.entity.sdny.InvoiceInfo; |
|
|
|
|
import com.dxhy.erp.entity.sdny.SNInvoice; |
|
|
|
|
import com.dxhy.erp.entity.sdny.SNRequestObject; |
|
|
|
|
import com.dxhy.erp.entity.sdny.area.Area; |
|
|
|
|
import com.dxhy.erp.utils.Base64; |
|
|
|
|
import com.dxhy.erp.utils.*; |
|
|
|
@ -35,7 +31,6 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
@ -87,6 +82,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
@Resource |
|
|
|
|
private BaseTDxTaxCurrentDao baseTDxTaxCurrentDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TDxInvoiceReimburseDao invoiceReimburseDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BaseTDxRecordInvoiceDao baseTDxRecordInvoiceDao; |
|
|
|
|
|
|
|
|
@ -106,7 +104,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
|
|
|
|
|
public String pushInvoiceToRecordInvoice(SNInvoice snInvoice, String taxNo, String company,String imageId,String compCode) throws Exception { |
|
|
|
|
|
|
|
|
|
BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice(); |
|
|
|
|
TDxInvoiceReimburse recordInvoice = new TDxInvoiceReimburse(); |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
|
|
|
|
|
SysDeptEntity orgByCompCode = sysDeptDao.getOrgByCompCode(compCode); |
|
|
|
@ -125,7 +123,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
String fpdm = snInvoice.getInvoiceCode(); |
|
|
|
|
String fphm = snInvoice.getInvoiceNumber(); |
|
|
|
|
|
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
QueryWrapper<TDxInvoiceReimburse> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
String uuid = ""; |
|
|
|
|
if (StringUtils.isNoneBlank(fpdm)) { |
|
|
|
|
uuid = fpdm + fphm; |
|
|
|
@ -134,7 +132,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
} |
|
|
|
|
recordWrapper.eq("uuid", uuid); |
|
|
|
|
|
|
|
|
|
BaseTDxRecordInvoice baseTDxRecordInvoice = baseTDxRecordInvoiceDao.selectOne(recordWrapper); |
|
|
|
|
TDxInvoiceReimburse baseTDxRecordInvoice = invoiceReimburseDao.selectOne(recordWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String kprq = snInvoice.getBillingDate(); |
|
|
|
@ -149,9 +147,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
recordInvoice.setUuid(fpdm + fphm); |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
if (kprq != null) { |
|
|
|
|
recordInvoice.setInvoiceDate(sdf.parse(kprq)); |
|
|
|
|
recordInvoice.setInvoiceDate(sdf.format(kprq)); |
|
|
|
|
} else { |
|
|
|
|
recordInvoice.setInvoiceDate(new Date()); |
|
|
|
|
recordInvoice.setInvoiceDate(new Date().toString()); |
|
|
|
|
log.error("开票日期为空.请检查发票"); |
|
|
|
|
} |
|
|
|
|
recordInvoice.setInvoiceCode(fpdm); |
|
|
|
@ -167,17 +165,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
recordInvoice.setXfTaxNo(xfsh); |
|
|
|
|
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.setCreateDate(new Date().toString()); |
|
|
|
|
recordInvoice.setSourceSystem("2"); |
|
|
|
|
recordInvoice.setInvoiceStatus("0"); |
|
|
|
|
recordInvoice.setInvoiceType(invoiceType); |
|
|
|
@ -186,9 +174,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
recordInvoice.setCompCode(compCode); |
|
|
|
|
|
|
|
|
|
if (baseTDxRecordInvoice != null) { |
|
|
|
|
baseTDxRecordInvoiceDao.update(recordInvoice, recordWrapper); |
|
|
|
|
invoiceReimburseDao.update(recordInvoice, recordWrapper); |
|
|
|
|
} else { |
|
|
|
|
baseTDxRecordInvoiceDao.insert(recordInvoice); |
|
|
|
|
invoiceReimburseDao.insert(recordInvoice); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ""; |
|
|
|
|