|
|
|
@ -2,11 +2,13 @@ package com.dxhy.erp.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.druid.sql.ast.statement.SQLIfStatement; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.dxhy.common.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.common.constant.ConfigurerInfo; |
|
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
|
import com.dxhy.common.constant.TransferContant; |
|
|
|
|
import com.dxhy.common.controller.AbstractController; |
|
|
|
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
|
|
|
|
import com.dxhy.common.enums.RespStatusEnum; |
|
|
|
@ -30,6 +32,7 @@ import com.dxhy.erp.utils.HmacSHA1Util; |
|
|
|
|
import com.dxhy.erp.utils.JsonUtils; |
|
|
|
|
import com.dxhy.erp.utils.OpenApiUtils; |
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -1278,46 +1281,6 @@ public class InterfaceController extends AbstractController { |
|
|
|
|
"/po", JSONObject.toJSONString(fpdms),JSONObject.toJSONString(fphms), "transferOut"); |
|
|
|
|
transferOutRecord.setBzdh(JSONObject.toJSONString(bzdhs)); |
|
|
|
|
|
|
|
|
|
boolean fphmNotBlank = list.stream().allMatch(e -> StringUtils.isNotBlank((String)e.get("ZFPHM"))); |
|
|
|
|
boolean fpdmNotBlank = list.stream().allMatch(e -> StringUtils.isNotBlank((String)e.get("ZFPDM"))); |
|
|
|
|
if (!fpdmNotBlank || !fphmNotBlank){ |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
es.setZMESSAGE("传入数据存在没有发票号码或发票代码问题"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
StringBuilder uuids = new StringBuilder(); |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
String invoiceCode =(String) list.get(i).get("ZFPDM"); |
|
|
|
|
String invoiceNo = (String)list.get(i).get("ZFPHM"); |
|
|
|
|
uuids.append(invoiceCode).append(invoiceNo); |
|
|
|
|
if (i<list.size()-1){ |
|
|
|
|
uuids.append(","); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info(uuids.toString()); |
|
|
|
|
String[] ids = uuids.toString().split(","); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
List<BaseTDxRecordInvoice> invoices = baseIReceiptInvoiceService.selectByUuids(ids); |
|
|
|
|
log.info("849查询到发票信息{}",invoices); |
|
|
|
|
invoices = invoices.stream().filter(e->!"0".equals(e.getRzhYesorno())).collect(Collectors.toList()); |
|
|
|
|
log.info("过滤后发票信息{}",invoices); |
|
|
|
|
if (CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
es.setZMESSAGE("底账数据不存在可转出发票"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// for(Map<String ,Object> map:list){
|
|
|
|
|
// String invoiceCode =(String) map.get("ZFPDM");
|
|
|
|
@ -1354,13 +1317,21 @@ public class InterfaceController extends AbstractController { |
|
|
|
|
try{ |
|
|
|
|
/** |
|
|
|
|
* 根据金额判断是转入还是转出 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
String transfer =""; |
|
|
|
|
|
|
|
|
|
List<String> invoiceNoNotExit = Lists.newArrayList(); |
|
|
|
|
List<String> invoiceNotExit = Lists.newArrayList(); |
|
|
|
|
List<String> notRz = Lists.newArrayList(); |
|
|
|
|
List<String> success = Lists.newArrayList(); |
|
|
|
|
for(Map<String,Object> map:list) { |
|
|
|
|
String invoiceCode =(String) map.get("ZFPDM"); |
|
|
|
|
String invoiceNo = (String)map.get("ZFPHM"); |
|
|
|
|
if (StringUtils.isBlank(invoiceNo)){ |
|
|
|
|
invoiceNoNotExit.add((String)map.get("ID")); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
BigDecimal bigDecimal = (BigDecimal) map.get("JXSZC"); |
|
|
|
|
String outReason = (String)map.get("ZZCYY"); |
|
|
|
|
String outTaxPeriod = (String)map.get("BUDAT"); |
|
|
|
@ -1373,20 +1344,21 @@ public class InterfaceController extends AbstractController { |
|
|
|
|
baseInvoiceEditVO.setOutTaxPeriod(outTaxPeriod); |
|
|
|
|
UserInfo userInfo = new UserInfo(); |
|
|
|
|
if(bigDecimal.compareTo(BigDecimal.ZERO)==1){ |
|
|
|
|
transfer = iReceiptOutService.transfer(erpInvoiceData,baseInvoiceEditVO, userInfo); |
|
|
|
|
transfer = iReceiptOutService.transfer(baseInvoiceEditVO, userInfo); |
|
|
|
|
if (TransferContant.INVOICE_NOT_EXIT.equals(transfer)){ |
|
|
|
|
invoiceNotExit.add((String)map.get("ZFPHM")); |
|
|
|
|
}else if (TransferContant.NOT_RZ.equals(transfer)){ |
|
|
|
|
notRz.add((String)map.get("ZFPHM")); |
|
|
|
|
}else if (TransferContant.SUCCESS.equals(transfer)){ |
|
|
|
|
success.add((String)map.get("ZFPHM")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
BaseReceiptOutCancelEditReqVO baseReceiptOutCancelEditReqVO = new BaseReceiptOutCancelEditReqVO(); |
|
|
|
|
baseReceiptOutCancelEditReqVO.setPrimaryKey(uuid); |
|
|
|
|
String s = baseIReceiptInvoiceService.cancelOut(baseReceiptOutCancelEditReqVO); |
|
|
|
|
if(s.equals("取消转出成功")){ |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("S"); |
|
|
|
|
es.setZMESSAGE("处理成功"); |
|
|
|
|
outPut.setES_OUTPUT(es); |
|
|
|
|
transfer = JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
if(TransferContant.CANCEL_SUCCESS.equals(s)){ |
|
|
|
|
success.add((String)map.get("ZFPHM")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1398,7 +1370,17 @@ public class InterfaceController extends AbstractController { |
|
|
|
|
log.error("FI849接口记录保存失败,errormsg:{}",e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return transfer; |
|
|
|
|
StringBuilder message = new StringBuilder(); |
|
|
|
|
message.append("ID:").append(invoiceNoNotExit).append("的发票未传入发票号码,").append("发票号码:") |
|
|
|
|
.append(invoiceNotExit).append("的发票不存在,").append("发票号码:").append(notRz).append("的发票未认证,") |
|
|
|
|
.append("发票号码:").append(success).append("处理成功"); |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|
EsOutPutResp es = new EsOutPutResp(); |
|
|
|
|
es.setSAPKEY(erpInvoiceData.getIS_INPUT().getSAPKEY()); |
|
|
|
|
es.setBSKEY(erpInvoiceData.getIS_INPUT().getBSKEY()); |
|
|
|
|
es.setZTYPE("S"); |
|
|
|
|
es.setZMESSAGE(message.toString()); |
|
|
|
|
return JsonUtils.getInstance().toJsonString(outPut); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("error", e); |
|
|
|
|
OutPut outPut = new OutPut(); |
|
|
|
|