|
|
@ -3,7 +3,9 @@ package com.dxhy.order.consumer.modules.manager.controller; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils; |
|
|
|
import com.dxhy.order.constant.*; |
|
|
|
import com.dxhy.order.constant.*; |
|
|
|
|
|
|
|
import com.dxhy.order.consumer.modules.manager.model.dto.ManualPushInvoiceDTO; |
|
|
|
import com.dxhy.order.exception.OrderReceiveException; |
|
|
|
import com.dxhy.order.exception.OrderReceiveException; |
|
|
|
import com.dxhy.order.model.*; |
|
|
|
import com.dxhy.order.model.*; |
|
|
|
import com.dxhy.order.model.newsk.invoiceissue.InvoiceIssueFailDetail; |
|
|
|
import com.dxhy.order.model.newsk.invoiceissue.InvoiceIssueFailDetail; |
|
|
@ -46,8 +48,8 @@ import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Description :接收税控底层数据接口 |
|
|
|
|
|
|
|
* @author :杨士勇 |
|
|
|
* @author :杨士勇 |
|
|
|
|
|
|
|
* @Description :接收税控底层数据接口 |
|
|
|
* @ClassName :InvocieReceiveController |
|
|
|
* @ClassName :InvocieReceiveController |
|
|
|
* @date :2019年6月3日 下午2:54:23 |
|
|
|
* @date :2019年6月3日 下午2:54:23 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -147,7 +149,7 @@ public class InvoiceReceiveController { |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "接收税控发票修复数据", notes = "接收税控发票修复数据-接收税控底层修复的发票数据") |
|
|
|
@ApiOperation(value = "接收税控发票修复数据", notes = "接收税控发票修复数据-接收税控底层修复的发票数据") |
|
|
|
@PostMapping("/receiveRepairedInvoices") |
|
|
|
@PostMapping("/receiveRepairedInvoices") |
|
|
|
public InterfaceData receiveRepairedInvoices(HttpServletRequest request){ |
|
|
|
public InterfaceData receiveRepairedInvoices(HttpServletRequest request) { |
|
|
|
InterfaceData interfaceData = new InterfaceData(); |
|
|
|
InterfaceData interfaceData = new InterfaceData(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
String data = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); |
|
|
|
String data = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); |
|
|
@ -171,15 +173,15 @@ public class InvoiceReceiveController { |
|
|
|
|
|
|
|
|
|
|
|
} catch (OrderReceiveException e) { |
|
|
|
} catch (OrderReceiveException e) { |
|
|
|
log.error("{}接收税控发票修复数据异常:{}", LOGGER_MSG, e.getMessage()); |
|
|
|
log.error("{}接收税控发票修复数据异常:{}", LOGGER_MSG, e.getMessage()); |
|
|
|
return buildReturnData(interfaceData,e.getCode(),e.getMessage(),null); |
|
|
|
return buildReturnData(interfaceData, e.getCode(), e.getMessage(), null); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("{}接收税控发票修复数据异常:{}", LOGGER_MSG, e.getMessage()); |
|
|
|
log.error("{}接收税控发票修复数据异常:{}", LOGGER_MSG, e.getMessage()); |
|
|
|
return buildReturnData(interfaceData,ConfigureConstant.STRING_9999,e.getMessage(),null); |
|
|
|
return buildReturnData(interfaceData, ConfigureConstant.STRING_9999, e.getMessage(), null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private InterfaceData buildReturnData(InterfaceData interfaceData,String code,String msg,Object object){ |
|
|
|
private InterfaceData buildReturnData(InterfaceData interfaceData, String code, String msg, Object object) { |
|
|
|
if(ObjectUtil.isNotNull(object)){ |
|
|
|
if (ObjectUtil.isNotNull(object)) { |
|
|
|
interfaceData.setData(JsonUtils.getInstance().toJsonString(object)); |
|
|
|
interfaceData.setData(JsonUtils.getInstance().toJsonString(object)); |
|
|
|
} |
|
|
|
} |
|
|
|
interfaceData.setReturnCode(code); |
|
|
|
interfaceData.setReturnCode(code); |
|
|
@ -225,9 +227,9 @@ public class InvoiceReceiveController { |
|
|
|
errorMsg = "订单调用底层接口异常:开票点正忙"; |
|
|
|
errorMsg = "订单调用底层接口异常:开票点正忙"; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(ObjectUtil.isNotNull(invoicePushFg)){ |
|
|
|
if (ObjectUtil.isNotNull(invoicePushFg)) { |
|
|
|
InvoiceIssueFailDetail faildetail = invoicePushFg.getFAILDETAIL(); |
|
|
|
InvoiceIssueFailDetail faildetail = invoicePushFg.getFAILDETAIL(); |
|
|
|
if(Objects.nonNull(faildetail) && StringUtils.isNotBlank(faildetail.getSFXYCS())){ |
|
|
|
if (Objects.nonNull(faildetail) && StringUtils.isNotBlank(faildetail.getSFXYCS())) { |
|
|
|
|
|
|
|
|
|
|
|
//根据发票请求流水号查询订单信息
|
|
|
|
//根据发票请求流水号查询订单信息
|
|
|
|
List<String> shList = NsrsbhUtils.transShListByNsrsbh(interfaceData.getTaxpayerNo()); |
|
|
|
List<String> shList = NsrsbhUtils.transShListByNsrsbh(interfaceData.getTaxpayerNo()); |
|
|
@ -239,34 +241,34 @@ public class InvoiceReceiveController { |
|
|
|
return R.error(OrderInfoContentEnum.INVOICE_DATA_BATCH_NULL); |
|
|
|
return R.error(OrderInfoContentEnum.INVOICE_DATA_BATCH_NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TaxEquipmentInfo taxEquipmentInfo = simsBackService.queryTaxEquipment(interfaceData.getTaxpayerNo(),oldOrderInvoiceInfo.getEntId()); |
|
|
|
TaxEquipmentInfo taxEquipmentInfo = simsBackService.queryTaxEquipment(interfaceData.getTaxpayerNo(), oldOrderInvoiceInfo.getEntId()); |
|
|
|
log.debug("{}查询销项后台销方开票状态,返回结果:{}",LOGGER_MSG, JsonUtils.getInstance().toJsonString(taxEquipmentInfo)); |
|
|
|
log.debug("{}查询销项后台销方开票状态,返回结果:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(taxEquipmentInfo)); |
|
|
|
//开票开关
|
|
|
|
//开票开关
|
|
|
|
String invoicingSwitch = ""; |
|
|
|
String invoicingSwitch = ""; |
|
|
|
if(Objects.nonNull(taxEquipmentInfo)){ |
|
|
|
if (Objects.nonNull(taxEquipmentInfo)) { |
|
|
|
invoicingSwitch = taxEquipmentInfo.getFlag(); |
|
|
|
invoicingSwitch = taxEquipmentInfo.getFlag(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(OrderInfoEnum.INVOICE_RETRY_0.getKey().equals(faildetail.getSFXYCS())){ |
|
|
|
if (OrderInfoEnum.INVOICE_RETRY_0.getKey().equals(faildetail.getSFXYCS())) { |
|
|
|
//税控返回'不重试',开票数据不放入延时队列
|
|
|
|
//税控返回'不重试',开票数据不放入延时队列
|
|
|
|
sendDelay = false; |
|
|
|
sendDelay = false; |
|
|
|
|
|
|
|
|
|
|
|
} else if (OrderInfoEnum.INVOICE_RETRY_1.getKey().equals(faildetail.getSFXYCS())){ |
|
|
|
} else if (OrderInfoEnum.INVOICE_RETRY_1.getKey().equals(faildetail.getSFXYCS())) { |
|
|
|
//税控返回'可重试',需要根据企业是否暂停开票判断,开票数据是否放入延时队列
|
|
|
|
//税控返回'可重试',需要根据企业是否暂停开票判断,开票数据是否放入延时队列
|
|
|
|
if(ConfigureConstant.STRING_0.equals(invoicingSwitch)){ |
|
|
|
if (ConfigureConstant.STRING_0.equals(invoicingSwitch)) { |
|
|
|
//企业未暂停开票,开票数据放入延时队列
|
|
|
|
//企业未暂停开票,开票数据放入延时队列
|
|
|
|
sendDelay = true; |
|
|
|
sendDelay = true; |
|
|
|
|
|
|
|
|
|
|
|
} else if (ConfigureConstant.STRING_1.equals(invoicingSwitch)){ |
|
|
|
} else if (ConfigureConstant.STRING_1.equals(invoicingSwitch)) { |
|
|
|
//企业已暂停开票,需要根据暂停开票原因判断开票数据是否放入延时队列
|
|
|
|
//企业已暂停开票,需要根据暂停开票原因判断开票数据是否放入延时队列
|
|
|
|
//如果税控返回的错误信息和销项后台配置的暂停开票原因一致则不放入延时队列
|
|
|
|
//如果税控返回的错误信息和销项后台配置的暂停开票原因一致则不放入延时队列
|
|
|
|
sendDelay = true; |
|
|
|
sendDelay = true; |
|
|
|
if(taxEquipmentInfo.getFlagCode().equals(faildetail.getCWDM())){ |
|
|
|
if (taxEquipmentInfo.getFlagCode().equals(faildetail.getCWDM())) { |
|
|
|
sendDelay = false; |
|
|
|
sendDelay = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if (OrderInfoEnum.INVOICE_RETRY_2.getKey().equals(faildetail.getSFXYCS())){ |
|
|
|
} else if (OrderInfoEnum.INVOICE_RETRY_2.getKey().equals(faildetail.getSFXYCS())) { |
|
|
|
//税控返回'必须重试',开票数据放入延时队列
|
|
|
|
//税控返回'必须重试',开票数据放入延时队列
|
|
|
|
sendDelay = true; |
|
|
|
sendDelay = true; |
|
|
|
|
|
|
|
|
|
|
@ -301,7 +303,7 @@ public class InvoiceReceiveController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(sendDelay){ |
|
|
|
if (sendDelay) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.INVOICE_STATUS_2.getKey().equals(oldOrderInvoiceInfo.getKpzt())) { |
|
|
|
if (OrderInfoEnum.INVOICE_STATUS_2.getKey().equals(oldOrderInvoiceInfo.getKpzt())) { |
|
|
@ -413,16 +415,14 @@ public class InvoiceReceiveController { |
|
|
|
@ApiOperation(value = "手动推送", notes = "开票结果接收-手动推送") |
|
|
|
@ApiOperation(value = "手动推送", notes = "开票结果接收-手动推送") |
|
|
|
@PostMapping("/manualPushInvoice") |
|
|
|
@PostMapping("/manualPushInvoice") |
|
|
|
@SysLog(operation = "手动推送发票数据", operationDesc = "手动推送发票数据", key = "推送发票") |
|
|
|
@SysLog(operation = "手动推送发票数据", operationDesc = "手动推送发票数据", key = "推送发票") |
|
|
|
public R manualPushInvoice(HttpServletRequest request, @ApiParam(name = "ddqqlshArray", value = "订单流水号", required = true) @RequestBody String ddqqlshArray) { |
|
|
|
public R manualPushInvoice(HttpServletRequest request, @ApiParam(name = "ddqqlshArray", value = "订单流水号", required = true) @RequestBody ManualPushInvoiceDTO dto) { |
|
|
|
R r; |
|
|
|
R r; |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (StringUtils.isBlank(ddqqlshArray)) { |
|
|
|
if (dto == null || CollectionUtils.isEmpty(dto.getList())) { |
|
|
|
return R.error(OrderInfoContentEnum.INVOICE_PARAM_ERROR); |
|
|
|
return R.error(OrderInfoContentEnum.INVOICE_PARAM_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Map> idList = JSON.parseArray(ddqqlshArray, Map.class); |
|
|
|
r = invoiceDataService.manualPushInvoice(dto); |
|
|
|
|
|
|
|
|
|
|
|
r = invoiceDataService.manualPushInvoice(idList); |
|
|
|
|
|
|
|
return r; |
|
|
|
return r; |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("{}手动回推发票异常:{}", LOGGER_MSG, e); |
|
|
|
log.error("{}手动回推发票异常:{}", LOGGER_MSG, e); |
|
|
|