|
|
|
@ -14,9 +14,7 @@ import com.dxhy.erp.dao.BaseReceiptOutDao; |
|
|
|
|
import com.dxhy.erp.entity.BaseInvoiceEditVO; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoice; |
|
|
|
|
import com.dxhy.erp.entity.BaseTDxRecordInvoiceOut; |
|
|
|
|
import com.dxhy.erp.model.ErpInvoiceData; |
|
|
|
|
import com.dxhy.erp.model.EsOutPutResp; |
|
|
|
|
import com.dxhy.erp.model.OutPut; |
|
|
|
|
import com.dxhy.erp.model.*; |
|
|
|
|
import com.dxhy.erp.service.BaseIReceiptInvoiceService; |
|
|
|
|
import com.dxhy.erp.service.IReceiptOutService; |
|
|
|
|
import com.dxhy.erp.utils.JsonUtils; |
|
|
|
@ -43,7 +41,7 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
@Resource |
|
|
|
|
BaseIReceiptInvoiceService baseIReceiptInvoiceService; |
|
|
|
|
@Override |
|
|
|
|
public String transfer( BaseInvoiceEditVO condVO, UserInfo userInfo) { |
|
|
|
|
public String transfer( BaseInvoiceEditVO condVO, UserInfo userInfo) throws Exception{ |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
|
|
|
|
|
String idStr = condVO.getPrimaryKey(); |
|
|
|
@ -52,13 +50,7 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
|
|
|
|
|
// first:查询出底账表相关数据
|
|
|
|
|
List<BaseTDxRecordInvoice> invoices = baseIReceiptInvoiceService.selectByUuids(ids); |
|
|
|
|
if(CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
return TransferContant.INVOICE_NOT_EXIT; |
|
|
|
|
} |
|
|
|
|
invoices = invoices.stream().filter(e -> !"0".equals(e.getRzhYesorno())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
return TransferContant.NOT_RZ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// second:根据uuids查询出转出明细并转为map,key=uuid ,value=转出明细
|
|
|
|
|
List<BaseTDxRecordInvoiceOut> outs = listByUuids(ids); |
|
|
|
|
Map<String, BaseTDxRecordInvoiceOut> outMap = |
|
|
|
@ -80,11 +72,34 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
outList.add(e); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
excuteTransferWrite(condList, outList); |
|
|
|
|
|
|
|
|
|
return TransferContant.SUCCESS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public String transferOrcancelOut(List<ZDATAN> zdatans,UserInfo userInfo) throws Exception{ |
|
|
|
|
String result = ""; |
|
|
|
|
for (ZDATAN zdata : zdatans) { |
|
|
|
|
//转出税额大于1则是转出
|
|
|
|
|
if (zdata.getJXSZC().compareTo(BigDecimal.ZERO)==1){ |
|
|
|
|
BaseInvoiceEditVO baseInvoiceEditVO = new BaseInvoiceEditVO(); |
|
|
|
|
baseInvoiceEditVO.setPrimaryKey(zdata.getZFPDM()==null?"":zdata.getZFPDM()+zdata.getZFPHM()); |
|
|
|
|
baseInvoiceEditVO.setOutReason(zdata.getZZCYY()); |
|
|
|
|
baseInvoiceEditVO.setOutTax(zdata.getJXSZC().toPlainString()); |
|
|
|
|
baseInvoiceEditVO.setOutStatus("1"); |
|
|
|
|
baseInvoiceEditVO.setOutTaxPeriod(zdata.getBUDAT()); |
|
|
|
|
this.transfer(baseInvoiceEditVO,userInfo); |
|
|
|
|
}else {//转出税额小于0取消转出
|
|
|
|
|
BaseReceiptOutCancelEditReqVO baseReceiptOutCancelEditReqVO = new BaseReceiptOutCancelEditReqVO(); |
|
|
|
|
baseReceiptOutCancelEditReqVO.setPrimaryKey(zdata.getZFPDM()==null?"":zdata.getZFPDM()+zdata.getZFPHM()); |
|
|
|
|
baseIReceiptInvoiceService.cancelOut(baseReceiptOutCancelEditReqVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return TransferContant.SUCCESS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据uuids查询进项税转出明细 |
|
|
|
|
* |
|
|
|
|