3 Commits

Author SHA1 Message Date
Lemon
cc532bfcec 新增 发票导出接口 2026-07-16 15:21:42 +08:00
Lemon
a7d838cdb1 add 开票接口新增 email字段 2026-07-15 14:36:32 +08:00
jsowell
4986239cd4 update 停车优惠配置接口 2026-07-08 16:41:15 +08:00
9 changed files with 284 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ import com.jsowell.pile.domain.OrderInvoiceRecord;
import com.jsowell.pile.dto.GetInvoiceInfoDTO;
import com.jsowell.pile.service.OrderInvoiceRecordService;
import com.jsowell.pile.service.PileMerchantInfoService;
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -64,6 +66,18 @@ public class OrderInvoiceRecordController extends BaseController {
util.exportExcel(response, list, "申请开票数据");
}
/**
* 导出所选申请开票详情
*/
@PreAuthorize("@ss.hasPermi('order:invoice:export')")
@Log(title = "申请开票", businessType = BusinessType.EXPORT)
@PostMapping("/export/selected")
public void exportSelected(HttpServletResponse response, @RequestParam("ids") Integer[] ids) {
List<OrderInvoiceExportVO> list = orderInvoiceRecordService.selectInvoiceExportList(ids);
ExcelUtil<OrderInvoiceExportVO> util = new ExcelUtil<OrderInvoiceExportVO>(OrderInvoiceExportVO.class);
util.exportExcel(response, list, "所选申请开票详情数据");
}
/**
* 获取申请开票详细信息
*/

View File

@@ -64,4 +64,9 @@ public class InvoiceTitleDTO {
* 接收方式
*/
private String reception;
/**
* 邮箱地址
*/
private String email;
}

View File

@@ -24,4 +24,9 @@ public interface ChargeParkingDiscountMapper {
int insertOrUpdateSelective(ChargeParkingDiscount record);
ChargeParkingDiscount selectByStationId(String stationId);
}
int logicDeleteByStationIdExcludeId(@Param("stationId") String stationId,
@Param("keepId") Integer keepId,
@Param("updateBy") String updateBy,
@Param("updateTime") java.util.Date updateTime);
}

View File

@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.OrderInvoiceRecord;
import com.jsowell.pile.dto.GetInvoiceInfoDTO;
import com.jsowell.pile.dto.QueryInvoiceRecordDTO;
import com.jsowell.pile.vo.web.InvoiceRecordVO;
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
import java.time.LocalDateTime;
@@ -26,6 +27,8 @@ public interface OrderInvoiceRecordService {
InvoiceRecordVO selectInvoiceTitleVO(Integer id);
List<OrderInvoiceExportVO> selectInvoiceExportList(Integer[] ids);
/**
* 查询申请开票列表
*

View File

@@ -9,6 +9,7 @@ import com.jsowell.pile.vo.web.ChargeParkingDiscountVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountService{
@@ -81,12 +82,26 @@ public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountSe
@Override
public int insertOrUpdateSelective(ChargeParkingDiscount record) {
if (record.getId() == null) {
record.setCreateBy(SecurityUtils.getUsername());
} else {
record.setUpdateBy(SecurityUtils.getUsername());
if (record == null || StringUtils.isBlank(record.getStationId())) {
return 0;
}
return chargeParkingDiscountMapper.insertOrUpdateSelective(record);
String username = SecurityUtils.getUsername();
Date now = new Date();
record.setDelFlag("0");
ChargeParkingDiscount latestRecord = this.selectByStationId(record.getStationId());
if (latestRecord == null) {
record.setCreateBy(username);
record.setCreateTime(now);
return chargeParkingDiscountMapper.insertSelective(record);
}
record.setId(latestRecord.getId());
record.setUpdateBy(username);
record.setUpdateTime(now);
int result = chargeParkingDiscountMapper.updateByPrimaryKeySelective(record);
chargeParkingDiscountMapper.logicDeleteByStationIdExcludeId(record.getStationId(), latestRecord.getId(), username, now);
return result;
}
}

View File

@@ -13,6 +13,8 @@ import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
import com.jsowell.pile.vo.uniapp.customer.InvoiceTitleVO;
import com.jsowell.pile.vo.web.InvoiceRecordVO;
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
import com.jsowell.pile.vo.web.OrderInvoiceOrderExportVO;
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,7 +22,11 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 申请开票Service业务层处理
@@ -76,6 +82,82 @@ public class OrderInvoiceRecordServiceImpl implements OrderInvoiceRecordService
.build();
}
@Override
public List<OrderInvoiceExportVO> selectInvoiceExportList(Integer[] ids) {
if (ids == null || ids.length == 0) {
return Collections.emptyList();
}
return Arrays.stream(ids)
.filter(Objects::nonNull)
.distinct()
.map(this::selectInvoiceTitleVO)
.filter(Objects::nonNull)
.map(this::buildOrderInvoiceExportVO)
.collect(Collectors.toList());
}
private OrderInvoiceExportVO buildOrderInvoiceExportVO(InvoiceRecordVO invoiceRecordVO) {
InvoiceTitleVO invoiceTitle = invoiceRecordVO.getInvoiceTitle();
return OrderInvoiceExportVO.builder()
.id(invoiceRecordVO.getId())
.memberId(invoiceRecordVO.getMemberId())
.phoneNumber(invoiceRecordVO.getPhoneNumber())
.status(invoiceRecordVO.getStatus())
.createTime(invoiceRecordVO.getCreateTime())
.updateTime(invoiceRecordVO.getUpdateTime())
.titleId(invoiceTitle == null ? null : invoiceTitle.getTitleId())
.titleName(invoiceTitle == null ? null : invoiceTitle.getTitleName())
.titleType(invoiceTitle == null ? null : invoiceTitle.getTitleType())
.taxId(invoiceTitle == null ? null : invoiceTitle.getTaxId())
.unitAddress(invoiceTitle == null ? null : invoiceTitle.getUnitAddress())
.email(invoiceTitle == null ? null : invoiceTitle.getEmail())
.reception(invoiceTitle == null ? null : invoiceTitle.getReception())
.titlePhoneNumber(invoiceTitle == null ? null : invoiceTitle.getPhoneNumber())
.bankName(invoiceTitle == null ? null : invoiceTitle.getBankName())
.bankAccountNumber(invoiceTitle == null ? null : invoiceTitle.getBankAccountNumber())
.defaultFlag(invoiceTitle == null ? null : invoiceTitle.getDefaultFlag())
.orderList(buildOrderExportList(invoiceRecordVO.getOrderList()))
.build();
}
private List<OrderInvoiceOrderExportVO> buildOrderExportList(List<OrderAmountDetailVO> orderList) {
if (CollectionUtils.isEmpty(orderList)) {
List<OrderInvoiceOrderExportVO> emptyOrderList = new ArrayList<>();
emptyOrderList.add(new OrderInvoiceOrderExportVO());
return emptyOrderList;
}
List<OrderInvoiceOrderExportVO> exportList = orderList.stream()
.filter(Objects::nonNull)
.map(this::buildOrderInvoiceOrderExportVO)
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(exportList)) {
exportList.add(new OrderInvoiceOrderExportVO());
}
return exportList;
}
private OrderInvoiceOrderExportVO buildOrderInvoiceOrderExportVO(OrderAmountDetailVO orderAmountDetailVO) {
return OrderInvoiceOrderExportVO.builder()
.orderCode(orderAmountDetailVO.getOrderCode())
.totalUsedElectricity(orderAmountDetailVO.getTotalUsedElectricity())
.totalOrderAmount(orderAmountDetailVO.getTotalOrderAmount())
.totalElectricityAmount(orderAmountDetailVO.getTotalElectricityAmount())
.totalServiceAmount(orderAmountDetailVO.getTotalServiceAmount())
.sharpUsedElectricity(orderAmountDetailVO.getSharpUsedElectricity())
.sharpElectricityPrice(orderAmountDetailVO.getSharpElectricityPrice())
.sharpServicePrice(orderAmountDetailVO.getSharpServicePrice())
.peakUsedElectricity(orderAmountDetailVO.getPeakUsedElectricity())
.peakElectricityPrice(orderAmountDetailVO.getPeakElectricityPrice())
.peakServicePrice(orderAmountDetailVO.getPeakServicePrice())
.flatUsedElectricity(orderAmountDetailVO.getFlatUsedElectricity())
.flatElectricityPrice(orderAmountDetailVO.getFlatElectricityPrice())
.flatServicePrice(orderAmountDetailVO.getFlatServicePrice())
.valleyUsedElectricity(orderAmountDetailVO.getValleyUsedElectricity())
.valleyElectricityPrice(orderAmountDetailVO.getValleyElectricityPrice())
.valleyServicePrice(orderAmountDetailVO.getValleyServicePrice())
.build();
}
/**
* 查询申请开票列表
*

View File

@@ -0,0 +1,72 @@
package com.jsowell.pile.vo.web;
import com.jsowell.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 发票详情导出数据
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OrderInvoiceExportVO {
@Excel(name = "申请记录ID", sort = 1, needMerge = true)
private String id;
@Excel(name = "会员ID", sort = 2, needMerge = true, width = 20)
private String memberId;
@Excel(name = "申请人电话", sort = 3, needMerge = true, width = 18)
private String phoneNumber;
@Excel(name = "状态", sort = 4, needMerge = true, readConverterExp = "0=未开票,1=已开票")
private String status;
@Excel(name = "申请时间", sort = 5, needMerge = true, width = 20)
private String createTime;
@Excel(name = "开票时间", sort = 6, needMerge = true, width = 20)
private String updateTime;
@Excel(name = "抬头ID", sort = 7, needMerge = true)
private String titleId;
@Excel(name = "抬头名称", sort = 8, needMerge = true, width = 30)
private String titleName;
@Excel(name = "抬头类型", sort = 9, needMerge = true)
private String titleType;
@Excel(name = "税号", sort = 10, needMerge = true, width = 24)
private String taxId;
@Excel(name = "单位地址", sort = 11, needMerge = true, width = 30)
private String unitAddress;
@Excel(name = "抬头邮箱", sort = 12, needMerge = true, width = 24)
private String email;
@Excel(name = "接收方式", sort = 13, needMerge = true)
private String reception;
@Excel(name = "抬头电话", sort = 14, needMerge = true, width = 18)
private String titlePhoneNumber;
@Excel(name = "开户银行", sort = 15, needMerge = true, width = 24)
private String bankName;
@Excel(name = "银行账户", sort = 16, needMerge = true, width = 24)
private String bankAccountNumber;
@Excel(name = "默认抬头", sort = 17, needMerge = true, readConverterExp = "0=否,1=是")
private String defaultFlag;
@Excel(name = "订单明细", sort = 18)
private List<OrderInvoiceOrderExportVO> orderList;
}

View File

@@ -0,0 +1,69 @@
package com.jsowell.pile.vo.web;
import com.jsowell.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* 发票关联订单导出明细
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OrderInvoiceOrderExportVO {
@Excel(name = "订单号", sort = 1, width = 24)
private String orderCode;
@Excel(name = "总用电量", sort = 2)
private BigDecimal totalUsedElectricity;
@Excel(name = "订单总金额", sort = 3)
private BigDecimal totalOrderAmount;
@Excel(name = "电费总金额", sort = 4)
private BigDecimal totalElectricityAmount;
@Excel(name = "服务费总金额", sort = 5)
private BigDecimal totalServiceAmount;
@Excel(name = "尖时段用电量", sort = 6)
private BigDecimal sharpUsedElectricity;
@Excel(name = "尖时段电费单价", sort = 7)
private BigDecimal sharpElectricityPrice;
@Excel(name = "尖时段服务费单价", sort = 8)
private BigDecimal sharpServicePrice;
@Excel(name = "峰时段用电量", sort = 9)
private BigDecimal peakUsedElectricity;
@Excel(name = "峰时段电费单价", sort = 10)
private BigDecimal peakElectricityPrice;
@Excel(name = "峰时段服务费单价", sort = 11)
private BigDecimal peakServicePrice;
@Excel(name = "平时段用电量", sort = 12)
private BigDecimal flatUsedElectricity;
@Excel(name = "平时段电费单价", sort = 13)
private BigDecimal flatElectricityPrice;
@Excel(name = "平时段服务费单价", sort = 14)
private BigDecimal flatServicePrice;
@Excel(name = "谷时段用电量", sort = 15)
private BigDecimal valleyUsedElectricity;
@Excel(name = "谷时段电费单价", sort = 16)
private BigDecimal valleyElectricityPrice;
@Excel(name = "谷时段服务费单价", sort = 17)
private BigDecimal valleyServicePrice;
}

View File

@@ -485,11 +485,23 @@
</trim>
</insert>
<update id="logicDeleteByStationIdExcludeId">
update charge_parking_discount
set del_flag = '1',
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where station_id = #{stationId,jdbcType=VARCHAR}
and del_flag = '0'
and id != #{keepId,jdbcType=INTEGER}
</update>
<select id="selectByStationId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from charge_parking_discount
where del_flag = '0'
and station_id = #{stationId,jdbcType=VARCHAR}
order by ifnull(update_time, create_time) desc, id desc
limit 1
</select>
</mapper>
</mapper>