|
|
|
@ -42,6 +42,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -142,29 +143,40 @@ public class InterfaceServiceImplV6 implements InterfaceServiceV6 { |
|
|
|
|
Map<String,String> queryMap = new HashMap<>(); |
|
|
|
|
queryMap.put("bzdh",bzdh); |
|
|
|
|
List<OrderProcessInfo> orderProcessInfos = orderProcessInfoMapper.queryOrderInfo(queryMap, null, null); |
|
|
|
|
if(orderProcessInfos.size()!=1){ |
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_E.getKey()); |
|
|
|
|
//过滤留下有效订单,且判断有效订单是否存在开票中、已开票
|
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_E.getKey()); |
|
|
|
|
if(orderProcessInfos == null || orderProcessInfos.isEmpty()){ |
|
|
|
|
esOutput.setZMESSAGE("根据报账单号未查询到唯一结算单"); |
|
|
|
|
}else { |
|
|
|
|
OrderProcessInfo orderProcessInfo = orderProcessInfos.get(0); |
|
|
|
|
List<PageRequestVO> pageRequestList = new ArrayList<>(); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return poCommonResponseParam; |
|
|
|
|
} |
|
|
|
|
List<OrderProcessInfo> collect = orderProcessInfos.stream().filter(t -> "0".equals(t.getOrderStatus())).collect(Collectors.toList()); |
|
|
|
|
if(collect.isEmpty()){ |
|
|
|
|
esOutput.setZMESSAGE("账单号已被删除"); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return poCommonResponseParam; |
|
|
|
|
} |
|
|
|
|
List<PageRequestVO> pageRequestList = collect.stream().filter(t -> "0".contains(t.getDdzt())).map(t->{ |
|
|
|
|
PageRequestVO pageRequestVO = new PageRequestVO(); |
|
|
|
|
pageRequestVO.setOrderProcessId(orderProcessInfo.getId()); |
|
|
|
|
pageRequestVO.setXhfNsrsbh(orderProcessInfo.getXhfNsrsbh()); |
|
|
|
|
pageRequestList.add(pageRequestVO); |
|
|
|
|
R back = orderInvoiceController.updateOrderStatus(pageRequestList, "back"); |
|
|
|
|
if("0000".equals(back.get(OrderManagementConstant.CODE))){ |
|
|
|
|
OrderProcessInfo updateOrderProcessInfo = new OrderProcessInfo(); |
|
|
|
|
updateOrderProcessInfo.setId(orderProcessInfo.getId()); |
|
|
|
|
updateOrderProcessInfo.setBhzt(ConfigureConstant.STRING_1); |
|
|
|
|
int i = orderProcessInfoMapper.updateOrderProcessInfoByFpqqlsh(updateOrderProcessInfo, null); |
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey()); |
|
|
|
|
esOutput.setZMESSAGE("驳回状态更新成功"); |
|
|
|
|
}else{ |
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_E.getKey()); |
|
|
|
|
esOutput.setZMESSAGE(back.get(OrderManagementConstant.MESSAGE).toString()); |
|
|
|
|
} |
|
|
|
|
pageRequestVO.setOrderProcessId(t.getId()); |
|
|
|
|
pageRequestVO.setXhfNsrsbh(t.getXhfNsrsbh()); |
|
|
|
|
return pageRequestVO; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
if(pageRequestList.size() != collect.size()){ |
|
|
|
|
esOutput.setZMESSAGE("账单号已在发票系统处理,不允许驳回"); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return poCommonResponseParam; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
R back = orderInvoiceController.updateOrderStatus(pageRequestList, "back"); |
|
|
|
|
if(!"0000".equals(back.get(OrderManagementConstant.CODE))){ |
|
|
|
|
esOutput.setZMESSAGE(back.get(OrderManagementConstant.MESSAGE).toString()); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return poCommonResponseParam; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
esOutput.setZTYPE(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey()); |
|
|
|
|
esOutput.setZMESSAGE("驳回状态更新成功"); |
|
|
|
|
poCommonResponseParam.setES_OUTPUT(esOutput); |
|
|
|
|
return poCommonResponseParam; |
|
|
|
|
} |
|
|
|
|