|  | @@ -2,13 +2,15 @@ package com.bz.smart_city.service.impl.pay;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | -import com.bz.smart_city.commom.model.Pagination;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.commom.util.*;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.dto.LoginUser;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.dto.pay.*;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.entity.User;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.entity.pay.BaseClosingAccountInfo;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.entity.pay.PayInvoiceParam;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.entity.pay.PayInvoiceprinted;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
 | 
	
		
			
				|  |  | +import com.bz.smart_city.service.UserService;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.service.pay.*;
 | 
	
		
			
				|  |  |  import com.bz.smart_city.service.pay.archives.PayBaseCustomerandmeterrelaService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -45,8 +47,12 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
 | 
	
		
			
				|  |  |      PrintInvoiceQueryResultServiceImpl printInvoiceQueryResultService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SnowflakeIdWorker idWorker;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private UserService userService;
 | 
	
		
			
				|  |  |      @Value("${invoice.print.url}")
 | 
	
		
			
				|  |  |      private  String printUrl;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private  BaseClosingAccountInfoService baseClosingAccountInfoService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private Map<String, String> getPrintParam(Integer siteId, Integer customerId) {
 | 
	
		
			
				|  |  |          Map<String, String> map = new HashMap<>();
 | 
	
	
		
			
				|  | @@ -103,11 +109,24 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
 | 
	
		
			
				|  |  |       * @Author:
 | 
	
		
			
				|  |  |       * @Date: 2020/7/28
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    public ReturnPrintResultDto requestPrint(String kpType, String userCode, String payseriesno, String invoicePrintId) {
 | 
	
		
			
				|  |  | +    public ReturnPrintResultDto requestPrint(String siteId, String customerId, String kpType, String userCode, String payseriesno, String invoicePrintId) {
 | 
	
		
			
				|  |  |          LoginUser loginUser = UserUtil.getCurrentUser();
 | 
	
		
			
				|  |  | +        ReturnPrintResultDto returnPrintResultDto = new ReturnPrintResultDto();//开票返回结果信息
 | 
	
		
			
				|  |  |          String name = loginUser.getName();//操作员姓名
 | 
	
		
			
				|  |  | +        if(loginUser==null) {
 | 
	
		
			
				|  |  | +            // User user = userService.findUserByName("系统操作", BigInteger.valueOf(Long.parseLong(siteId)));
 | 
	
		
			
				|  |  | +            //loginUser = new LoginUser();
 | 
	
		
			
				|  |  | +            loginUser.setCustomerId(Integer.valueOf(customerId));
 | 
	
		
			
				|  |  | +            loginUser.setSiteId(Integer.valueOf(siteId));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        BaseClosingAccountInfo baseClosingAccountInfo = baseClosingAccountInfoService.getCurrentCloseInfo(loginUser.getSiteId(),loginUser.getCustomerId());
 | 
	
		
			
				|  |  | +        if(baseClosingAccountInfo==null)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            returnPrintResultDto.setResult("1");//开票失败
 | 
	
		
			
				|  |  | +            returnPrintResultDto.setMsg("开票失败,失败原因:账期信息查询失败");
 | 
	
		
			
				|  |  | +            return returnPrintResultDto;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        ReturnPrintResultDto returnPrintResultDto = new ReturnPrintResultDto();//开票返回结果信息
 | 
	
		
			
				|  |  |          PayInvoiceOrderDto payInvoiceOrderDto = new PayInvoiceOrderDto();//开票订单信息
 | 
	
		
			
				|  |  |          PayEleInvoiceDto payEleInvoiceDto = new PayEleInvoiceDto();//电子发票请求主体信息
 | 
	
		
			
				|  |  |          PayInvoiceprinted oldInvoiceprinted = new PayInvoiceprinted();//原始蓝票信息(红票时处理)
 | 
	
	
		
			
				|  | @@ -244,6 +263,8 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
 | 
	
		
			
				|  |  |              payInvoiceprinted.setTaxnum(payInvoiceOrderDto.getTaxnum());
 | 
	
		
			
				|  |  |              payInvoiceprinted.setSendtype(2);
 | 
	
		
			
				|  |  |              payInvoiceprinted.setInvoiceType(1);
 | 
	
		
			
				|  |  | +            payInvoiceprinted.setYear(baseClosingAccountInfo.getYear());
 | 
	
		
			
				|  |  | +            payInvoiceprinted.setMonth(baseClosingAccountInfo.getMonth());
 | 
	
		
			
				|  |  |              payInvoiceprinted.setPrintNo(payInvoiceOrderDto.getOrderno());
 | 
	
		
			
				|  |  |              payInvoiceprinted.setOrderNo(payInvoiceOrderDto.getOrderno());
 | 
	
		
			
				|  |  |              payInvoiceprinted.setPayseriesno(payseriesno);
 |