|
@@ -227,96 +227,21 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RespR<List<SelfCarInvoice>> getSelfCarInvoicesByApplyIds(ApplQueryInvVo applQueryInvVo) {
|
|
|
+ public RespR<List<B2BInvoiceQueryByApplyModel>> getSelfCarInvoicesByApplyIds(ApplQueryInvVo applQueryInvVo) {
|
|
|
log.info("申请开票开始SelfCarServiceLImpl.getSelfCarInvoicesByApplyIds{}",applQueryInvVo);
|
|
|
- if(!customerService.checkMoneyEnough(applQueryInvVo.getCustomerName())){
|
|
|
- return new RespR(false,"余额不足");
|
|
|
- }
|
|
|
B2BInvoiceQueryByApplyRequest b2BInvoiceQueryRequest = new B2BInvoiceQueryByApplyRequest();
|
|
|
- Customer customer = customerMapper.selectByCustomerName(applQueryInvVo.getCustomerName());
|
|
|
- if(customer == null || customer.getAccstatus().intValue() == 1){
|
|
|
- return new RespR(false,"客户已经停用");
|
|
|
- }
|
|
|
- CustomerRec customerRec = new CustomerRec();
|
|
|
- customerRec.setCustomerName(applQueryInvVo.getCustomerName());
|
|
|
- customerRec.setCompanyName(applQueryInvVo.getCompanyName());
|
|
|
- customerRec = customerRecMapper.selectByCustomerNameAndCompany(customerRec);
|
|
|
- if(customerRec == null || customerRec.getRecStatus().intValue() !=1 ){
|
|
|
- return new RespR(false,"客户未备案");
|
|
|
- }
|
|
|
b2BInvoiceQueryRequest.setCardId(applQueryInvVo.getEtcNum());
|
|
|
- b2BInvoiceQueryRequest.setCompanyNum(customerRec.getCompanyNum());
|
|
|
+ b2BInvoiceQueryRequest.setCompanyNum(applQueryInvVo.getCompanyNum());
|
|
|
b2BInvoiceQueryRequest.setApplyId(applQueryInvVo.getApplId());
|
|
|
RespR<B2BInvoiceQueryByApplyResponse> responseRespR = selfCarInterface.b2bContractQuery(b2BInvoiceQueryRequest);
|
|
|
+
|
|
|
if(responseRespR.getCode() == 1){
|
|
|
log.info("申请开票失败SelfCarServiceLImpl.getSelfCarInvoicesByApplyIds{},msg{}",applQueryInvVo,responseRespR.getMsg());
|
|
|
return new RespR(false,responseRespR.getMsg());
|
|
|
}else{
|
|
|
- B2BInvoiceQueryByApplyResponse response = responseRespR.getData();
|
|
|
- List<B2BInvoiceQueryByApplyModel> b2BInvoiceQueryByApplyModels = response.getResult();
|
|
|
- for(B2BInvoiceQueryByApplyModel b2BInvoiceQueryByApplyModel:b2BInvoiceQueryByApplyModels){
|
|
|
- SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
|
|
|
- BeanUtils.copyProperties(b2BInvoiceQueryByApplyModel,selfCarInvoice);
|
|
|
- selfCarInvoice.setCompanyName(customerRec.getCompanyName());
|
|
|
- selfCarInvoice.setCompanyNum(customerRec.getCompanyNum());
|
|
|
- selfCarInvoice.setCustomerName(customerRec.getCustomerName());
|
|
|
- selfCarInvoice.setBuyerTaxpayerCode(customerRec.getCompanyReferencenum());
|
|
|
- selfCarInvoice.setExStation(b2BInvoiceQueryByApplyModel.getExStationName());
|
|
|
- selfCarInvoice.setEnStation(b2BInvoiceQueryByApplyModel.getEnStationName());
|
|
|
- selfCarInvoice.setInvoiceMakeTime(DateUtil.tTimeToDate(selfCarInvoice.getInvoiceMakeTime()));
|
|
|
- selfCarInvoice.setExTime(DateUtil.tTimeToDate(selfCarInvoice.getExTime()));
|
|
|
- if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
|
|
|
- selfCarInvoiceMapper.insert(selfCarInvoice);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return new RespR(b2BInvoiceQueryByApplyModels);
|
|
|
+ return new RespR(responseRespR.getData().getResult(),responseRespR.getData().getResult().toString());
|
|
|
}
|
|
|
- }
|
|
|
- @Override
|
|
|
- public void getSelfCarInvoicesByApplyIds(SelfCarAppl applQueryInvVo) {
|
|
|
- log.info("申请开票开始SelfCarServiceLImpl.getSelfCarInvoicesByApplyIds{}",applQueryInvVo);
|
|
|
- if(!customerService.checkMoneyEnough(applQueryInvVo.getCustomId())){
|
|
|
- log.info("余额不足{}",applQueryInvVo);
|
|
|
- return ;
|
|
|
- }
|
|
|
- CustomerRec customerRecParam = new CustomerRec();
|
|
|
- customerRecParam.setCustomerName(applQueryInvVo.getCustomId());
|
|
|
- customerRecParam.setCompanyName(applQueryInvVo.getCompanyNum());
|
|
|
- CustomerRec customerRec = customerRecMapper.selectByCustomerNameAndCompanyNum(customerRecParam);
|
|
|
- if(customerRec == null || customerRec.getRecStatus() != 1){
|
|
|
- log.info("备案信息不存在{}",applQueryInvVo);
|
|
|
- return;
|
|
|
- }
|
|
|
- B2BInvoiceQueryByApplyRequest b2BInvoiceQueryRequest = new B2BInvoiceQueryByApplyRequest();
|
|
|
|
|
|
- b2BInvoiceQueryRequest.setCardId(applQueryInvVo.getCardId());
|
|
|
- b2BInvoiceQueryRequest.setCompanyNum(applQueryInvVo.getCompanyNum());
|
|
|
- b2BInvoiceQueryRequest.setApplyId(applQueryInvVo.getApplId());
|
|
|
- RespR<B2BInvoiceQueryByApplyResponse> responseRespR = selfCarInterface.b2bContractQuery(b2BInvoiceQueryRequest);
|
|
|
- if(responseRespR.getCode() == 1){
|
|
|
- log.info("申请开票失败SelfCarServiceLImpl.getSelfCarInvoicesByApplyIds{},msg{}",applQueryInvVo,responseRespR.getMsg());
|
|
|
- }else{
|
|
|
- B2BInvoiceQueryByApplyResponse response = responseRespR.getData();
|
|
|
- List<B2BInvoiceQueryByApplyModel> b2BInvoiceQueryByApplyModels = response.getResult();
|
|
|
- for(B2BInvoiceQueryByApplyModel b2BInvoiceQueryByApplyModel:b2BInvoiceQueryByApplyModels){
|
|
|
- SelfCarInvoice selfCarInvoice = new SelfCarInvoice();
|
|
|
- BeanUtils.copyProperties(b2BInvoiceQueryByApplyModel,selfCarInvoice);
|
|
|
- selfCarInvoice.setCompanyName(customerRec.getCompanyName());
|
|
|
- selfCarInvoice.setCompanyNum(applQueryInvVo.getCompanyNum());
|
|
|
- selfCarInvoice.setCustomerName(applQueryInvVo.getCustomId());
|
|
|
- selfCarInvoice.setBuyerTaxpayerCode(customerRec.getCompanyReferencenum());
|
|
|
- selfCarInvoice.setExStation(b2BInvoiceQueryByApplyModel.getExStationName());
|
|
|
- selfCarInvoice.setEnStation(b2BInvoiceQueryByApplyModel.getEnStationName());
|
|
|
- selfCarInvoice.setInvoiceMakeTime(DateUtil.tTimeToDate(selfCarInvoice.getInvoiceMakeTime()));
|
|
|
- selfCarInvoice.setExTime(DateUtil.tTimeToDate(selfCarInvoice.getExTime()));
|
|
|
- if(selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice)==null || selfCarInvoiceMapper.selectByTradeAndInvoiceMakeTime(selfCarInvoice).size()==0){
|
|
|
- selfCarInvoiceMapper.insert(selfCarInvoice);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
@Override
|
|
|
public RespR<List<B2BInvoiceListModel>> getSelfCarInvoicesByTime(SelfCarDueQueryVo selfCarDueQueryVo,CustomerRec customerRec) {
|