|
@@ -1,6 +1,8 @@
|
|
|
package com.bz.smart_city.service.impl.pay;
|
|
|
|
|
|
+import com.bz.smart_city.commom.exception.ServiceException;
|
|
|
import com.bz.smart_city.commom.model.Pagination;
|
|
|
+import com.bz.smart_city.commom.util.ExcelUtil;
|
|
|
import com.bz.smart_city.commom.util.UserUtil;
|
|
|
import com.bz.smart_city.dao.pay.PayReportMapper;
|
|
|
import com.bz.smart_city.dto.LoginUser;
|
|
@@ -8,14 +10,19 @@ import com.bz.smart_city.dto.pay.*;
|
|
|
import com.bz.smart_city.service.pay.PayAgenttransactionService;
|
|
|
import com.bz.smart_city.service.pay.PayReportService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static com.google.common.collect.Lists.newArrayList;
|
|
|
+
|
|
|
|
|
|
* @Author: ZJY
|
|
|
* @DATE: 2020-07-28 11:18
|
|
@@ -175,4 +182,198 @@ public class PayReportServiceImpl implements PayReportService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 导出用户欠费明细表
|
|
|
+ * @param payArrearagedetailsReportDto
|
|
|
+ * @param httpServletResponse
|
|
|
+ */
|
|
|
+ public void getDebtListExcel(PayArrearagedetailsReportDto payArrearagedetailsReportDto, HttpServletResponse httpServletResponse){
|
|
|
+
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
|
+ payArrearagedetailsReportDto.setCustomerId(customerId);
|
|
|
+ BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
|
|
|
+ payArrearagedetailsReportDto.setSiteId(siteId);
|
|
|
+
|
|
|
+ String title = "欠费用户明细表";
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ String[] rowsName = new String[]{"序号","客户编码","客户名称","地址","水量","水费","污水费","不征税自来水","违约金","超计划水费","合计金额","联系方式"};
|
|
|
+ List<PayArrearagedetailsReportDto> reSubList = new ArrayList<>();
|
|
|
+ List<PayArrearagedetailsReportDto> reList = payReportMapper.getPayArrearagedetailsReportList(payArrearagedetailsReportDto);
|
|
|
+ if(reList != null && reList.size() > 0){
|
|
|
+ PayArrearagedetailsReportDto totalDto = new PayArrearagedetailsReportDto();
|
|
|
+ Integer payamount = 0;
|
|
|
+ BigDecimal payamountFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal polluteFee= BigDecimal.ZERO;
|
|
|
+ BigDecimal taxExemptFee= BigDecimal.ZERO;
|
|
|
+ BigDecimal penltyFee= BigDecimal.ZERO;
|
|
|
+ BigDecimal outLevelFee= BigDecimal.ZERO;
|
|
|
+ BigDecimal subtotal= BigDecimal.ZERO;
|
|
|
+ for(int i=0;i<reList.size();i++){
|
|
|
+ payamount = payamount + reList.get(i).getPayamount();
|
|
|
+ payamountFee = payamountFee.add(reList.get(i).getPayamountFee());
|
|
|
+ polluteFee = polluteFee.add(reList.get(i).getPolluteFee());
|
|
|
+ taxExemptFee = taxExemptFee.add(reList.get(i).getTaxExemptFee());
|
|
|
+ penltyFee = penltyFee.add(reList.get(i).getPenltyFee());
|
|
|
+ outLevelFee = outLevelFee.add(reList.get(i).getOutLevelFee());
|
|
|
+ subtotal = subtotal.add(reList.get(i).getSubtotal());
|
|
|
+ }
|
|
|
+ totalDto.setPayamount(payamount);
|
|
|
+ totalDto.setPayamountFee(payamountFee);;
|
|
|
+ totalDto.setPolluteFee(polluteFee);
|
|
|
+ totalDto.setTaxExemptFee(taxExemptFee);
|
|
|
+ totalDto.setPenltyFee(penltyFee);
|
|
|
+ totalDto.setOutLevelFee(outLevelFee);
|
|
|
+ totalDto.setSubtotal(subtotal);
|
|
|
+ totalDto.setAccountNumber("合计");
|
|
|
+ reSubList.add(totalDto);
|
|
|
+ reSubList.addAll(reList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Object[]> dataList = newArrayList();
|
|
|
+ Object[] objs = null;
|
|
|
+ BigDecimal db = new BigDecimal("0.0");
|
|
|
+ for(int i=0; i<reSubList.size() ; i++){
|
|
|
+ PayArrearagedetailsReportDto dto = reSubList.get(i);
|
|
|
+ objs = new Object[rowsName.length];
|
|
|
+ objs[0] = i;
|
|
|
+ objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
|
|
|
+ objs[2] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
|
|
|
+ objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "" ;
|
|
|
+ objs[4] = dto != null && dto.getPayamount() != null ? dto.getPayamount() : db;
|
|
|
+ objs[5] = dto != null && dto.getPayamountFee() != null ? dto.getPayamountFee() : db;
|
|
|
+ objs[6] = dto != null && dto.getPolluteFee() != null ? dto.getPolluteFee() : db;
|
|
|
+ objs[7] = dto != null && dto.getTaxExemptFee() != null ? dto.getTaxExemptFee() : db;
|
|
|
+ objs[8] = dto != null && dto.getPenltyFee() != null ? dto.getPenltyFee() : db;
|
|
|
+ objs[9] = dto != null && dto.getOutLevelFee() != null ? dto.getOutLevelFee() : db;
|
|
|
+ objs[10] = dto != null && dto.getSubtotal() != null ? dto.getSubtotal() : db;
|
|
|
+ objs[11] = dto != null && StringUtils.isNotBlank(dto.getMobilePhone()) ? dto.getMobilePhone() : "";
|
|
|
+ dataList.add(objs);
|
|
|
+ }
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
+ try {
|
|
|
+ excelUtil.export(httpServletResponse);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(-900, "导出异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 导出操作员明细表
|
|
|
+ * @param payOperatordetailsReportDto
|
|
|
+ * @param httpServletResponse
|
|
|
+ */
|
|
|
+ public void getOperatordetListExcel(PayOperatordetailsReportDto payOperatordetailsReportDto, HttpServletResponse httpServletResponse){
|
|
|
+
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
|
+ payOperatordetailsReportDto.setCustomerId(customerId);
|
|
|
+ BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
|
|
|
+ payOperatordetailsReportDto.setSiteId(siteId);
|
|
|
+
|
|
|
+ String title = "收费员明细表";
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ String[] rowsName = new String[]{"序号","客户名称","小区","客户编码","地址","预存款","实收款","小计","收费时间","收费员"};
|
|
|
+ List<PayOperatordetailsReportDto> reSubList = new ArrayList<>();
|
|
|
+ List<PayOperatordetailsReportDto> reList = payReportMapper.getPayOperatordetailsReportList(payOperatordetailsReportDto);
|
|
|
+ if(reList != null && reList.size() > 0){
|
|
|
+ PayOperatordetailsReportDto totalDto = new PayOperatordetailsReportDto();
|
|
|
+ BigDecimal receivedCount = BigDecimal.ZERO;
|
|
|
+ BigDecimal transamount = BigDecimal.ZERO;
|
|
|
+ BigDecimal subtotal = BigDecimal.ZERO;
|
|
|
+ for(int i=0;i<reList.size();i++){
|
|
|
+ receivedCount = receivedCount.add(reList.get(i).getReceivedCount());
|
|
|
+ transamount = transamount.add(reList.get(i).getTransamount());
|
|
|
+ subtotal = subtotal.add(reList.get(i).getSubtotal());
|
|
|
+ }
|
|
|
+ totalDto.setSubtotal(subtotal);
|
|
|
+ totalDto.setTransamount(transamount);
|
|
|
+ totalDto.setReceivedCount(receivedCount);
|
|
|
+ totalDto.setAccountName("合计");
|
|
|
+ reSubList.add(totalDto);
|
|
|
+ reSubList.addAll(reList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Object[]> dataList = newArrayList();
|
|
|
+ Object[] objs = null;
|
|
|
+ BigDecimal db = new BigDecimal("0.0");
|
|
|
+ for(int i=0; i<reSubList.size() ; i++){
|
|
|
+ PayOperatordetailsReportDto dto = reSubList.get(i);
|
|
|
+ objs = new Object[rowsName.length];
|
|
|
+ objs[0] = i;
|
|
|
+ objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
|
|
|
+ objs[2] = dto != null && StringUtils.isNotBlank(dto.getCommunityName()) ? dto.getCommunityName() : "";
|
|
|
+ objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
|
|
|
+ objs[4] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "";
|
|
|
+ objs[5] = dto != null && dto.getTransamount() != null ? dto.getTransamount() : db;
|
|
|
+ objs[6] = dto != null && dto.getReceivedCount() != null ? dto.getReceivedCount() : db;
|
|
|
+ objs[7] = dto != null && dto.getSubtotal() != null ? dto.getSubtotal() : db;
|
|
|
+ objs[8] = dto != null && dto.getTransTime() != null ? dto.getTransTime() : null;
|
|
|
+ objs[9] = dto != null && dto.getCreateByName() != null ? dto.getCreateByName() : "";
|
|
|
+ dataList.add(objs);
|
|
|
+ }
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
+ try {
|
|
|
+ excelUtil.export(httpServletResponse);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(-900, "导出异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 导出收费明细表
|
|
|
+ * @param payTransactiondetailsReportDto
|
|
|
+ * @param httpServletResponse
|
|
|
+ */
|
|
|
+ public void getTranExcel(PayTransactiondetailsReportDto payTransactiondetailsReportDto,HttpServletResponse httpServletResponse){
|
|
|
+
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
|
|
|
+ payTransactiondetailsReportDto.setCustomerId(customerId);
|
|
|
+ BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
|
|
|
+ payTransactiondetailsReportDto.setSiteId(siteId);
|
|
|
+
|
|
|
+ String title = "收费明细表";
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ String[] rowsName = new String[]{"序号","客户编码","客户名称","地址","收费金额","支付方式","收费时间","收费员"};
|
|
|
+ List<PayTransactiondetailsReportDto> reSubList = new ArrayList<>();
|
|
|
+ List<PayTransactiondetailsReportDto> reList = payReportMapper.getPayTransactiondetailsReportList(payTransactiondetailsReportDto);
|
|
|
+ if(reList != null && reList.size() > 0){
|
|
|
+ PayTransactiondetailsReportDto totalDto = new PayTransactiondetailsReportDto();
|
|
|
+ BigDecimal transAmount = BigDecimal.ZERO;
|
|
|
+ for(int i=0;i<reList.size();i++){
|
|
|
+ transAmount = transAmount.add(reList.get(i).getTransAmount());
|
|
|
+ }
|
|
|
+ totalDto.setTransAmount(transAmount);
|
|
|
+ totalDto.setAccountNumber("合计");
|
|
|
+ reSubList.add(totalDto);
|
|
|
+ reSubList.addAll(reList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Object[]> dataList = newArrayList();
|
|
|
+ Object[] objs = null;
|
|
|
+ BigDecimal db = new BigDecimal("0.0");
|
|
|
+ for(int i=0; i<reSubList.size() ; i++){
|
|
|
+ PayTransactiondetailsReportDto dto = reSubList.get(i);
|
|
|
+ objs = new Object[rowsName.length];
|
|
|
+ objs[0] = i;
|
|
|
+ objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
|
|
|
+ objs[2] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
|
|
|
+ objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "";
|
|
|
+ objs[4] = dto != null && dto.getTransAmount() != null ? dto.getTransAmount() : db;
|
|
|
+ objs[5] = dto != null && StringUtils.isNotBlank(dto.getPaywayLabel()) ? dto.getPaywayLabel() : "";
|
|
|
+ objs[6] = dto != null && dto.getTransTime() != null ? dto.getTransTime() : null;
|
|
|
+ objs[7] = dto != null && dto.getCreateByName() != null ? dto.getCreateByName() : "";
|
|
|
+ dataList.add(objs);
|
|
|
+ }
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
+ try {
|
|
|
+ excelUtil.export(httpServletResponse);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(-900, "导出异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|