Ver código fonte

发票打印相关

609324174@qq.com 4 anos atrás
pai
commit
e990bab0db

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayPayReceivedMapper.java

@@ -2,6 +2,7 @@ package com.bz.smart_city.dao.pay;
 
 import com.bz.smart_city.dto.pay.PayPayReceivedDto;
 import com.bz.smart_city.dto.pay.PayPayReceivedListDto;
+import com.bz.smart_city.dto.pay.PayReceivedInvoiceDto;
 import com.bz.smart_city.entity.pay.PayPayReceived;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -40,4 +41,6 @@ public interface PayPayReceivedMapper {
     void cancelCheckAgentPayseriesno(@Param("payseriesno") String payseriesno, @Param("siteId")Integer siteId, @Param("customerId")Integer customerId);
 
     void update(PayPayReceived payReceived);
+
+    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(@Param("payseriesno") String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
 }

+ 18 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayEleInvoiceDto.java

@@ -0,0 +1,18 @@
+package com.bz.smart_city.dto.pay;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * @ClassName PayEleInvoiceDto
+ * @Description: 电子发票信息
+ * @Author :WYY
+ * @Date 2020/7/28
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "电子发票主体信息")
+public class PayEleInvoiceDto {
+    private String identity;
+    private PayInvoiceOrderDto order;
+}

+ 51 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayInvoiceOrderDetailDto.java

@@ -0,0 +1,51 @@
+package com.bz.smart_city.dto.pay;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName PayInvoiceOrderDetailDto
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/28
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "电子发票明细")
+public class PayInvoiceOrderDetailDto {
+    @ApiModelProperty(name = "商品名称",notes = "商品名称,最大长度90")
+    private String goodsname;
+    @ApiModelProperty(name = "数量",notes = "冲红时位负数,数量小数点后8位,最大长度16")
+    private String num;
+    @ApiModelProperty(name = "单价",notes = "冲红时位正数,数量小数点后8位,最大长度16")
+    private String price;
+    @ApiModelProperty(name = "单价含税标志",notes = "单价含税标志0 不含税 1含税")
+    private String hsbz;
+    @ApiModelProperty(name = "税率",notes = "最大长度10")
+    private String taxrate;
+    @ApiModelProperty(name = "规格型号",notes = "规格型号,最大长度40")
+    private String spec;
+    @ApiModelProperty(name = "单位",notes = "单位,最大长度22")
+    private String unit;
+    @ApiModelProperty(name = "税收分类编码",notes = "税收分类编码,最大长度19")
+    private String spbm;
+    @ApiModelProperty(name = "自行编码",notes = "自行编码,最大长度20")
+    private String zsbm;
+    @ApiModelProperty(name = "发票行性质",notes = "发票行性质,最大长度1")
+    private String fphxz;
+    @ApiModelProperty(name = "优惠政策标识",notes = "优惠政策标识")
+    private String yhzcbs;
+    @ApiModelProperty(name = "增值税特殊管理",notes = "增值税特殊管理,最大长度50")
+    private String zzstsgl;
+    @ApiModelProperty(name = "零税率标识",notes = "零税率标识,最大长度1")
+    private String lslbs;
+    @ApiModelProperty(name = "扣除额",notes = "扣除额,最大长度16.2")
+    private String kce;
+    @ApiModelProperty(name = "不含税金额",notes = "不含税金额红票为负,最大长度16.2")
+    private String taxfreeamt;
+    @ApiModelProperty(name = "税额",notes = "税额红票为负,最大长度16.2")
+    private String tax;
+    @ApiModelProperty(name = "含税金额",notes = "含税金额红票为负,最大长度16.2")
+    private String taxamt;
+}

+ 74 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayInvoiceOrderDto.java

@@ -0,0 +1,74 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @ClassName PayInvoiceOrderDto
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/28
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "电子发票详细订单信息")
+public class PayInvoiceOrderDto {
+    @ApiModelProperty(name = "购方名称", notes = "必填,最大长度100")
+    private String buyername;
+    @ApiModelProperty(name = "购方税号",notes = "企业要填,个人可为空,最大长度20")
+    private String taxnum;
+    @ApiModelProperty(name = "购方手机",notes = "必填,开票成功后短信提醒,最大长度20")
+    private String phone;
+    @ApiModelProperty(name = "购方地址",notes = "企业要填,个人可为空,最大长度100")
+    private String address;
+    @ApiModelProperty(name = "购方银行账号",notes = "企业要填,个人可为空,最大长度100")
+    private String account;
+    @ApiModelProperty(name = "购方电话",notes = "开票成功后短信提醒,最大长度20")
+    private String telephone;
+    @ApiModelProperty(name = "订单号",notes = "必填,最大长度20")
+    private String orderno;
+    @ApiModelProperty(name = "开票时间",notes = "必填")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private LocalDateTime invoicedate;
+    @ApiModelProperty(name = "开票员",notes = "必填,最大长度20")
+    private String clerk;
+
+    @ApiModelProperty(name = "销方银行账号",notes = "最大长度100")
+    private String saleaccount;
+    @ApiModelProperty(name = "销方电话",notes = "最大长度20")
+    private String salephone;
+    @ApiModelProperty(name = "销方地址",notes = "最大长度80")
+    private String saleaddress;
+    @ApiModelProperty(name = "销方税号",notes = "必填,最大长度20")
+    private String saletaxnum;
+    @ApiModelProperty(name = "开票类型",notes = "必填 1正票 2红票,最大长度1")
+    private String kptype;
+    @ApiModelProperty(name = "备注信息",notes = "冲红时必须在备注中注定“对应正数发票代码:X号码Y“”,最大长度230")
+    private String message;
+    @ApiModelProperty(name = "收款人",notes = "最大长度20")
+    private String payee;
+    @ApiModelProperty(name = "复核人",notes = "最大长度20")
+    private String checker;
+    @ApiModelProperty(name = "对应蓝票发票代码",notes = "红票必填左补0,最大长度12")
+    private String fpdm;
+    @ApiModelProperty(name = "对应蓝票发票号码",notes = "红票必填左补0,最大长度8")
+    private String fphm;
+    @ApiModelProperty(name = "推送方式",notes = "推送方式-1不推送0邮箱1手机2邮箱手机,最大长度2")
+    private String tsfs;
+    @ApiModelProperty(name = "推送邮箱",notes = "推送邮箱,最大长度50")
+    private String email;
+    @ApiModelProperty(name = "清单标志",notes = "清单标志;0自动 1打印清单")
+    private String qdbz;
+    @ApiModelProperty(name = "发票种类",notes = "发票种类p电子增值税普通发票c增值税普通发票纸票s增值税专用发票")
+    private String invoiceLine;
+    @ApiModelProperty(name = "红字信息表编号",notes = "专票冲红时必填,且必须备注“开具红字增值税专用发票信息表编号”")
+    private String billInfoNo;
+    @ApiModelProperty(name = "电子发票明细",notes = "电子发票明细")
+    private List<PayInvoiceOrderDetailDto> detail;
+
+}

+ 40 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayReceivedInvoiceDto.java

@@ -0,0 +1,40 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @ClassName PayReceivedInvoiceDto
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/29
+ * @Version V1.0
+ **/
+@Data
+@ApiModel(value = "实收交易信息")
+public class PayReceivedInvoiceDto {
+    @ApiModelProperty(example = "W0123456789012004081314",notes = "交易流水号")
+    private String payseriesno;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间", hidden = true)
+    private LocalDateTime createDate;
+    @ApiModelProperty(example = "1", notes = "阶梯")
+    private int ladderlevel;
+    @ApiModelProperty(example = "1", notes = "支付方式")
+    private int payway;
+    @ApiModelProperty(example = "支付宝", notes = "支付方式名称")
+    private String paywayname;
+    @ApiModelProperty(example = "100.00", notes = "实收金额")
+    private BigDecimal receivedamount;
+    @ApiModelProperty(example = "2.57", notes = "单价")
+    private BigDecimal price;
+    @ApiModelProperty(example = "1", notes = "费用类型")
+    private Integer feetype;
+    @ApiModelProperty(example = "水费", notes = "费用名称")
+    private String feetypename;
+}

+ 175 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/IssueElectronicInvoiceServiceImpl.java

@@ -0,0 +1,175 @@
+package com.bz.smart_city.service.impl.pay;
+
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.pay.*;
+import com.bz.smart_city.entity.pay.PayBaseAccount;
+import com.bz.smart_city.entity.pay.PayInvoiceParam;
+import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
+import com.bz.smart_city.service.pay.PayBaseAccountService;
+import com.bz.smart_city.service.pay.PayBaseConfigService;
+import com.bz.smart_city.service.pay.PayInvoiceParamService;
+import com.bz.smart_city.service.pay.PayPayReceivedService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.*;
+
+/**
+ * @ClassName IssueElectronicInvoiceServiceImpl
+ * @Description: TODO
+ * @Author :WYY
+ * @Date 2020/7/28
+ * @Version V1.0
+ **/
+@Service
+public class IssueElectronicInvoiceServiceImpl {
+    @Autowired
+    PayBaseConfigService payBaseConfigService;
+    @Autowired
+    PayInvoiceParamService payInvoiceParamService;
+    @Autowired
+    PayBaseAccountService payBaseAccountService;
+    @Autowired
+    PayPayReceivedService payPayReceivedService;
+
+    private Map<String, String> getPrintParam() {
+        Map<String, String> map = new HashMap<>();
+        //查询销方参数
+        Pagination<PayBaseConfigDto> payBaseConfigDtoPagination = payBaseConfigService.getAll("PRINT_", 1, 15);
+        List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigDtoPagination.getList();
+        for (PayBaseConfigDto item : payBaseConfigDtos) {
+            switch (item.getName()) {
+                case "PRINT_INVOICE_ADDRESS":
+                    map.put("saleAddress", item.getValue());
+                    break;
+                case "PRINT_INVOICE_PHONE":
+                    map.put("salePhone", item.getValue());
+                    break;
+                case "PRINT_INVOICE_ACCEPTERBANKNUM":
+                    map.put("saleAccount", item.getValue());
+                    break;
+                case "PRINT_INVOICE_IDENTITY":
+                    map.put("saleIdentity", item.getValue());
+                    break;
+                case "PRINT_EMAIL":
+                    map.put("saleEmail", item.getValue());
+                    break;
+                case "PRINT_INVOICE_ADMINISTERNUM":
+                    map.put("saleCode", item.getValue());
+                    break;
+                case "PRINT_INVOICE_CHECKER":
+                    map.put("saleChecker", item.getValue());
+                    break;
+            }
+        }
+        return map;
+    }
+
+    private Map<Integer, PayInvoiceParam> getInvoiceParam() {
+        Map<Integer, PayInvoiceParam> map = new HashMap<>();
+        List<PayInvoiceParam> payInvoiceParams = payInvoiceParamService.findList(null);
+        for (PayInvoiceParam item : payInvoiceParams) {
+            map.put(item.getFeetype(), item);
+        }
+        return map;
+    }
+    public BigDecimal saveTwoDecimal(BigDecimal d){
+        BigDecimal a =d.setScale(2,BigDecimal.ROUND_HALF_UP);
+        return a;
+    }
+    public BigDecimal saveEightDecimal(BigDecimal d){
+        BigDecimal a =d.setScale(8,BigDecimal.ROUND_HALF_UP);
+        return a;
+    }
+    /**
+     * @MethodName:
+     * @Description: TODO
+     * @Param: kpType 开票类型  1 正票 2 红票  userCode 用户号 payseriesno 缴费流水号
+     * @Return:
+     * @Author:
+     * @Date: 2020/7/28
+     **/
+    @Async
+    public void requestPrint(String kpType,String userCode,String payseriesno) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        String name = loginUser.getName();//操作员姓名
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+
+        Map<String, String> invoiceParam = getPrintParam();//发票参数
+        PayEleInvoiceDto payEleInvoiceDto = new PayEleInvoiceDto();
+        payEleInvoiceDto.setIdentity(invoiceParam.get("saleIdentity"));
+
+        Map<Integer, PayInvoiceParam> invoiceMap = getInvoiceParam();//税率相关参数
+
+        PayInvoiceOrderDto payInvoiceOrderDto = new PayInvoiceOrderDto();//开票订单信息
+        payInvoiceOrderDto.setSaleaccount(invoiceParam.get("saleAccount"));//销方银行账号
+        payInvoiceOrderDto.setSalephone(invoiceParam.get("salePhone"));//销方电话
+        payInvoiceOrderDto.setSaleaddress(invoiceParam.get("saleAddress"));//销方地址
+        payInvoiceOrderDto.setSaletaxnum(invoiceParam.get("saleCode"));//销方税号
+        payInvoiceOrderDto.setChecker(invoiceParam.get("saleChecker"));//复核人
+        payInvoiceOrderDto.setClerk(name);//开票人
+        payInvoiceOrderDto.setPayee(name);//收款人
+        payInvoiceOrderDto.setKptype(kpType);//开票类型
+        payInvoiceOrderDto.setTsfs("2");//推送方式
+        //查询购方相关信息
+        PayBaseCustomerandmeterrela payBaseAccount = new PayBaseCustomerandmeterrela();
+        payInvoiceOrderDto.setBuyername(payBaseAccount.getAccountname());//购方名称
+        payInvoiceOrderDto.setPhone(payBaseAccount.getTelephone());//电话
+        payInvoiceOrderDto.setAddress(payBaseAccount.getAddress());//地址
+        payInvoiceOrderDto.setAccount(payBaseAccount.getBankaccount());//银行账号
+        payInvoiceOrderDto.setTelephone(payBaseAccount.getTelephone());//电话
+
+        List<PayInvoiceOrderDetailDto> orderDetailDtos = new ArrayList<>();
+        //循环加入明细
+        List<PayReceivedInvoiceDto> payReceivedInvoiceDtos = payPayReceivedService.findInvoiceReceivedByPayseriesno(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        //将水费分开,其他类型水费合并todo
+        for (PayReceivedInvoiceDto item:payReceivedInvoiceDtos) {
+            PayInvoiceOrderDetailDto orderDetailDto = new PayInvoiceOrderDetailDto();
+            PayInvoiceParam payInvoiceParam = invoiceMap.get(item.getFeetype());
+            orderDetailDto.setGoodsname(item.getFeetypename());
+            orderDetailDto.setTaxamt(String.valueOf(saveTwoDecimal(item.getReceivedamount())));//含税金额
+            //含税标志为1 含税,税额=round((数量*含税单价)*税率/(1+税率)),2),不含税金额=含税金额-税额
+            //含税标志为0 不含税,税额=round((数量*不含税单价)*税率),2),含税金额=不含税金额+税额
+            BigDecimal taxAmount = new BigDecimal(0);//税额
+            BigDecimal receAmount = item.getReceivedamount();//实收金额
+            BigDecimal rate =new BigDecimal(payInvoiceParam.getTaxrate());//税率
+            if(payInvoiceParam.getPricetax().equals("1"))
+            {
+                taxAmount = saveTwoDecimal(receAmount.multiply(rate).divide(rate.add(BigDecimal.valueOf(1))));
+
+            }else
+            {
+                taxAmount = saveTwoDecimal(receAmount.multiply(rate));
+            }
+            orderDetailDto.setTax(String.valueOf(saveTwoDecimal(taxAmount)));//税额
+            orderDetailDto.setTaxfreeamt(String.valueOf(saveTwoDecimal(receAmount.subtract(taxAmount))));//不含税金额
+            if(item.getPrice()!=null) {
+                orderDetailDto.setPrice(String.valueOf(saveTwoDecimal(item.getPrice())));
+                orderDetailDto.setNum(String.valueOf(saveEightDecimal(receAmount.subtract(taxAmount).divide(saveTwoDecimal(item.getPrice())))));
+            }
+            if(!payInvoiceParam.getZerotax().equals("0")) {
+                orderDetailDto.setLslbs(payInvoiceParam.getZerotax());//零税率标志
+            }
+            orderDetailDto.setZzstsgl(payInvoiceParam.getOthermanger());//增值税特殊管理
+            orderDetailDto.setKce(payInvoiceParam.getKec());//扣除额
+            orderDetailDto.setZsbm(payInvoiceParam.getZsbm());//自行编码
+            orderDetailDto.setUnit(payInvoiceParam.getUnit());//单位
+            orderDetailDto.setSpec(payInvoiceParam.getSpec());//规格型号
+            orderDetailDto.setYhzcbs(payInvoiceParam.getPrepolicy());//优惠政策标识
+            orderDetailDto.setFphxz(payInvoiceParam.getNature());//发票行性质
+            orderDetailDto.setHsbz(payInvoiceParam.getPricetax());//单价含税标志
+            orderDetailDto.setSpbm(payInvoiceParam.getGoodstaxno());//税收分类编码
+            orderDetailDto.setTaxrate(payInvoiceParam.getTaxrate());//税率
+
+            orderDetailDtos.add(orderDetailDto);
+        }
+        payInvoiceOrderDto.setDetail(orderDetailDtos);
+        payEleInvoiceDto.setOrder(payInvoiceOrderDto);
+    }
+}

+ 54 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceParamServiceImpl.java

@@ -3,14 +3,19 @@ package com.bz.smart_city.service.impl.pay;
 import com.bz.smart_city.commom.exception.ServiceException;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.pay.PayBaseConfigMapper;
 import com.bz.smart_city.dao.pay.PayInvoiceParamMapper;
 import com.bz.smart_city.dao.pay.PaySysDictMapper;
 import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.pay.PayBaseConfigDto;
 import com.bz.smart_city.dto.pay.PaySysDictSelectDto;
+import com.bz.smart_city.entity.pay.PayBaseConfig;
 import com.bz.smart_city.entity.pay.PayInvoiceParam;
 import com.bz.smart_city.entity.pay.PaySysDict;
+import com.bz.smart_city.service.pay.PayBaseConfigService;
 import com.bz.smart_city.service.pay.PayInvoiceParamService;
 import com.bz.smart_city.service.pay.PaySysDictService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -32,6 +37,8 @@ public class PayInvoiceParamServiceImpl implements PayInvoiceParamService {
     PayInvoiceParamMapper payInvoiceParamMapper;
     @Resource
     PaySysDictMapper paySysDictMapper;
+    @Autowired
+    PayBaseConfigService payBaseConfigService;
     @Override
     public int batchInsert() {
         //1、从登陆信息中获取站点Id 水司ID
@@ -64,7 +71,54 @@ public class PayInvoiceParamServiceImpl implements PayInvoiceParamService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
         BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        //发票销售方设置参数
+        try {
+            PayBaseConfigDto payBaseConfig = new PayBaseConfigDto();
+            payBaseConfig.setCnname("销售方电话");
+            payBaseConfig.setName("PRINT_INVOICE_PHONE");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
 
+            payBaseConfig.setCnname("身份认证");
+            payBaseConfig.setName("PRINT_INVOICE_IDENTITY ");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("复核人");
+            payBaseConfig.setName("PRINT_INVOICE_CHECKER ");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方纳税人识别号");
+            payBaseConfig.setName("PRINT_INVOICE_ADMINISTERNUM");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方名称");
+            payBaseConfig.setName("PRINT_INVOICE_ADMINISTERNAME");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方地址");
+            payBaseConfig.setName("PRINT_INVOICE_ADDRESS");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方银行账号");
+            payBaseConfig.setName("PRINT_INVOICE_ACCEPTERBANKNUM");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方公共推送邮箱");
+            payBaseConfig.setName("PRINT_EMAIL");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+        }catch (Exception ex)
+        {
+            //异常不处理,可手动添加
+        }
+
+        //发票参数
         List<PayInvoiceParam> payInvoiceParams = payInvoiceParamMapper.findList(queryparam,siteId,customerId);
         if(payInvoiceParams.size()==0)
         {

+ 6 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayPayReceivedServiceImpl.java

@@ -7,10 +7,7 @@ import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.commom.util.Util;
 import com.bz.smart_city.dao.pay.*;
 import com.bz.smart_city.dto.LoginUser;
-import com.bz.smart_city.dto.pay.PayPayReceivedDto;
-import com.bz.smart_city.dto.pay.PayPayReceivedListDto;
-import com.bz.smart_city.dto.pay.PayRechargeaccountDto;
-import com.bz.smart_city.dto.pay.PayTransactiondetails;
+import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.BaseClosingAccountInfo;
 import com.bz.smart_city.entity.pay.PayPayReceived;
 import com.bz.smart_city.service.pay.PayPayReceivedService;
@@ -191,6 +188,11 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
         }
     }
 
+    @Override
+    public List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno, Integer siteId, Integer customerId) {
+        return payPayReceivedMapper.findInvoiceReceivedByPayseriesno(payseriesno,siteId,customerId);
+    }
+
     @Transactional(rollbackFor = Exception.class)
     public PayTransactiondetails cancelPayTransactiondetails(PayTransactiondetails payTransactiondetails, String payseriesno ) {
         LoginUser loginUser = UserUtil.getCurrentUser();

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayPayReceivedService.java

@@ -2,6 +2,8 @@ package com.bz.smart_city.service.pay;
 
 import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.dto.pay.PayPayReceivedListDto;
+import com.bz.smart_city.dto.pay.PayReceivedInvoiceDto;
+import org.apache.ibatis.annotations.Param;
 
 import java.math.BigInteger;
 import java.time.LocalDateTime;
@@ -22,4 +24,7 @@ public interface PayPayReceivedService {
     public int cancelReceived(BigInteger id);
 
     void cancelReceivedByPayseriesno(  String payseriesno);
+
+    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno,Integer siteId,Integer customerId);
+
 }

+ 21 - 0
smart-city-platform/src/main/resources/mapper/pay/PayPayReceivedMapper.xml

@@ -323,4 +323,25 @@
             </if>
         </where>
     </update>
+    <select id="findInvoiceReceivedByPayseriesno" resultType="com.bz.smart_city.dto.pay.PayReceivedInvoiceDto">
+          select
+            rece.payseriesno as "payseriesno",
+            rece.create_date as "createDate",
+            rece.ladderlevel as "ladderlevel",
+            rece.payway as "payway",
+            dict2.label as "paywayname",
+            sum(rece.receivedamount) as "receivedamount",
+            rece.price as "price",
+            rece.feetype as "feetype" ,
+            dict.label as "feetypename"
+        from pay_pay_received rece
+        inner join pay_sys_dict dict on dict.type="收费类型" and dict.`value`= rece.feetype
+        inner join pay_sys_dict dict2 on dict2.type="支付方式" and dict2.`value`= rece.payway
+        where rece.canceledrecord_id is null and rece.iscanceled =0 and rece.receivedamount>0
+              #and rece.payseriesno= #{payseriesno}
+              and rece.site_id = #{siteId}
+              and rece.customer_id = #{customerId}
+        group by rece.payseriesno,rece.create_date,rece.ladderlevel,rece.payway,dict2.label,rece.price,rece.feetype,dict.label
+
+    </select>
 </mapper>