优化:开店管理导出
This commit is contained in:
@@ -11,7 +11,13 @@
|
||||
</select>
|
||||
<select id="getPayTimeByShopIds" resultType="com.cool.store.dto.FranchiseFeeDTO">
|
||||
select a.shop_id AS shopId ,
|
||||
b.pay_time as payTime
|
||||
b.pay_time as payTime,
|
||||
a.year_franchise_fee as yearFranchiseFee,
|
||||
a.loan_margin as loanMargin,
|
||||
a.first_year_start_time as firstYearStartTime,
|
||||
a.first_year_end_time as firstYearEndTime,
|
||||
a.first_year_fee as firstYearFee,
|
||||
a.performance_bond as performanceBond
|
||||
from xfsg_franchise_fee a
|
||||
LEFT JOIN xfsg_line_pay b ON b.id = a.pay_id
|
||||
where a.shop_id in
|
||||
|
||||
@@ -50,68 +50,117 @@ public class ExportBranchShopDTO {
|
||||
@ColumnWidth(30)
|
||||
private String contractCode;
|
||||
|
||||
@ExcelProperty(value = "合同开始时间",order = 9)
|
||||
@ExcelProperty(value = "第一年加盟开始时间",order = 9)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearStartTime;
|
||||
|
||||
@ExcelProperty(value = "第一年加盟开始时间",order = 9)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearEndTime;
|
||||
|
||||
@ExcelProperty(value = "合同开始时间",order = 11)
|
||||
@ColumnWidth(30)
|
||||
private String contractStartTime;
|
||||
|
||||
@ExcelProperty(value = "合同结束时间",order = 10)
|
||||
@ExcelProperty(value = "合同结束时间",order = 12)
|
||||
@ColumnWidth(30)
|
||||
private String contractEndTime;
|
||||
|
||||
@ExcelProperty(value = "开票时间",order = 11)
|
||||
@ExcelProperty(value = "开票时间",order = 13)
|
||||
@ColumnWidth(30)
|
||||
private String invoicingTime;
|
||||
|
||||
@ExcelProperty(value = "管理费(含税金额)",order = 12)
|
||||
@ExcelProperty(value = "币种",order = 14)
|
||||
@ColumnWidth(30)
|
||||
private String managementFeeTax;
|
||||
private String currency;
|
||||
|
||||
@ExcelProperty(value = "管理费(不含税金额)",order = 13)
|
||||
@ExcelProperty(value = "合计缴费金额(取自账单)",order = 15)
|
||||
@ColumnWidth(30)
|
||||
private String managementFee;
|
||||
private String totalAmountContributions;
|
||||
|
||||
@ExcelProperty(value = "品牌费(含税金额)",order = 14)
|
||||
@ExcelProperty(value = "加盟费(取自账单)",order = 16)
|
||||
@ColumnWidth(30)
|
||||
private String brandingFeeTax;
|
||||
private String franchiseFeeBill;
|
||||
|
||||
@ExcelProperty(value = "品牌费(不含税金额)",order = 15)
|
||||
@ColumnWidth(30)
|
||||
private String brandingFee;
|
||||
|
||||
@ExcelProperty(value = "加盟费(含税金额)",order = 16)
|
||||
@ExcelProperty(value = "加盟费(含税金额)",order = 18)
|
||||
@ColumnWidth(30)
|
||||
private String franchiseFeeTax;
|
||||
|
||||
@ExcelProperty(value = "加盟费(不含税金额)",order = 17)
|
||||
@ExcelProperty(value = "加盟费(不含税金额)",order = 19)
|
||||
@ColumnWidth(30)
|
||||
private String franchiseFee;
|
||||
|
||||
@ExcelProperty(value = "设计费(含税金额)",order = 18)
|
||||
@ExcelProperty(value = "保证金(取自账单)",order = 20)
|
||||
@ColumnWidth(30)
|
||||
private String loanMargin;
|
||||
|
||||
@ExcelProperty(value = "第一年度管理费(取自账单)",order = 21)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearManagementFeeBill;
|
||||
|
||||
@ExcelProperty(value = "第一年度管理费(含税金额)",order = 22)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearManagementFeeTax;
|
||||
|
||||
@ExcelProperty(value = "第一年度管理费(不含税金额)",order = 23)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearManagementFee;
|
||||
|
||||
@ExcelProperty(value = "第一年度品牌费(取自账单)",order = 24)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearBrandingFeeBill;
|
||||
|
||||
@ExcelProperty(value = "第一年度品牌费(含税金额)",order = 25)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearBrandingFeeTax;
|
||||
|
||||
@ExcelProperty(value = "第一年度品牌费(不含税金额)",order = 26)
|
||||
@ColumnWidth(30)
|
||||
private String firstYearBrandingFee;
|
||||
|
||||
@ExcelProperty(value = "设计费(取自账单)",order = 27)
|
||||
@ColumnWidth(30)
|
||||
private String performanceBondBill;
|
||||
|
||||
@ExcelProperty(value = "设计费(含税金额)",order = 28)
|
||||
@ColumnWidth(30)
|
||||
private String designFeeTax;
|
||||
|
||||
@ExcelProperty(value = "设计费(不含税金额)",order = 19)
|
||||
@ExcelProperty(value = "设计费(不含税金额)",order = 29)
|
||||
@ColumnWidth(30)
|
||||
private String designFee;
|
||||
|
||||
@ExcelProperty(value = "当前进度",order = 20)
|
||||
@ExcelProperty(value = "第1次缴纳时间",order = 30)
|
||||
@ColumnWidth(30)
|
||||
private String firstPayTime;
|
||||
|
||||
@ExcelProperty(value = "第2次缴纳时间",order = 31)
|
||||
@ColumnWidth(30)
|
||||
private String secondPayTime;
|
||||
|
||||
@ExcelProperty(value = "第3次缴纳时间",order = 32)
|
||||
@ColumnWidth(30)
|
||||
private String thirdPayTime;
|
||||
|
||||
@ExcelProperty(value = "第4次缴纳时间",order = 33)
|
||||
@ColumnWidth(30)
|
||||
private String fourthPayTime;
|
||||
|
||||
@ExcelProperty(value = "当前进度",order = 34)
|
||||
@ColumnWidth(30)
|
||||
private String currentProgress;
|
||||
|
||||
@ExcelProperty(value = "状态",order = 21)
|
||||
@ExcelProperty(value = "状态",order = 35)
|
||||
@ColumnWidth(30)
|
||||
private String shopStatus;
|
||||
|
||||
@ExcelProperty(value = "计划开店时间",order = 22)
|
||||
@ExcelProperty(value = "计划开店时间",order = 36)
|
||||
@ColumnWidth(30)
|
||||
private String planOpenTime;
|
||||
|
||||
@ExcelProperty(value = "开店时长(天)",order = 23)
|
||||
@ExcelProperty(value = "开店时长(天)",order =37)
|
||||
@ColumnWidth(30)
|
||||
private String openDuration;
|
||||
|
||||
@ExcelProperty(value = "缴费时间",order = 24)
|
||||
@ColumnWidth(30)
|
||||
private String payTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -16,4 +17,16 @@ public class FranchiseFeeDTO {
|
||||
private Long shopId;
|
||||
|
||||
private Date payTime;
|
||||
|
||||
private String yearFranchiseFee;
|
||||
|
||||
private String loanMargin;
|
||||
|
||||
private Date firstYearStartTime;
|
||||
|
||||
private Date firstYearEndTime;
|
||||
|
||||
private String firstYearFee;
|
||||
|
||||
private String performanceBond;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigInteger;
|
||||
import java.text.MessageFormat;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
@@ -102,10 +103,12 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
List<ExportBranchShopDTO> exportList = new ArrayList<>();
|
||||
List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList());
|
||||
List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds);
|
||||
List<FranchiseFeeDTO> payTimeByShopIds = franchiseFeeMapper.getPayTimeByShopIds(shopIds);
|
||||
Map<Long, Date> payTimeMap = payTimeByShopIds.stream().filter(o -> o.getPayTime() != null)
|
||||
List<FranchiseFeeDTO> franchiseFees = franchiseFeeMapper.getPayTimeByShopIds(shopIds);
|
||||
Map<Long, Date> payTimeMap = franchiseFees.stream().filter(o -> o.getPayTime() != null)
|
||||
.filter(o -> o.getShopId() != null)
|
||||
.collect(Collectors.toMap(FranchiseFeeDTO::getShopId, FranchiseFeeDTO::getPayTime));
|
||||
Map<Long, FranchiseFeeDTO> franchiseFeeDTOMap = franchiseFees.stream().filter(o -> o.getShopId() != null)
|
||||
.collect(Collectors.toMap(FranchiseFeeDTO::getShopId, Function.identity()));
|
||||
Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>();
|
||||
if (signFranchises != null) {
|
||||
signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
|
||||
@@ -117,6 +120,15 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
}
|
||||
for (BranchShopResponse response : list) {
|
||||
ExportBranchShopDTO dto = new ExportBranchShopDTO();
|
||||
FranchiseFeeDTO franchiseFeeDTO = franchiseFeeDTOMap.getOrDefault(response.getShopId(), new FranchiseFeeDTO());
|
||||
dto.setFirstYearStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, franchiseFeeDTO.getFirstYearStartTime()));
|
||||
dto.setFirstYearEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, franchiseFeeDTO.getFirstYearEndTime()));
|
||||
String total =(new BigInteger(franchiseFeeDTO.getPerformanceBond()).add(new BigInteger(franchiseFeeDTO.getFirstYearFee()))
|
||||
.add(new BigInteger(franchiseFeeDTO.getYearFranchiseFee())).add(new BigInteger(franchiseFeeDTO.getLoanMargin())).toString());
|
||||
dto.setTotalAmountContributions(total);
|
||||
dto.setFranchiseFeeBill(franchiseFeeDTO.getYearFranchiseFee());
|
||||
dto.setLoanMargin(franchiseFeeDTO.getLoanMargin());
|
||||
dto.setPerformanceBondBill(franchiseFeeDTO.getPerformanceBond());
|
||||
dto.setUserName(response.getUsername());
|
||||
dto.setMobile(response.getMobile());
|
||||
dto.setShopName(response.getShopName());
|
||||
@@ -133,15 +145,15 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
}
|
||||
Date payTime = payTimeMap.get(response.getShopId());
|
||||
if (Objects.nonNull(payTime)){
|
||||
dto.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1,payTime));
|
||||
dto.setFirstPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1,payTime));
|
||||
}
|
||||
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId());
|
||||
if (invoicingDO != null) {
|
||||
dto.setInvoicingTime(invoicingDO.getInvoiceDate());
|
||||
dto.setManagementFeeTax(invoicingDO.getManagementFeeTax().toString());
|
||||
dto.setManagementFee(invoicingDO.getManagementFee().toString());
|
||||
dto.setBrandingFeeTax(invoicingDO.getBrandUsageFeeTax().toString());
|
||||
dto.setBrandingFee(invoicingDO.getBrandUsageFee().toString());
|
||||
dto.setFirstYearManagementFeeTax(invoicingDO.getManagementFeeTax().toString());
|
||||
dto.setFirstYearManagementFee(invoicingDO.getManagementFee().toString());
|
||||
dto.setFirstYearBrandingFeeTax(invoicingDO.getBrandUsageFeeTax().toString());
|
||||
dto.setFirstYearBrandingFee(invoicingDO.getBrandUsageFee().toString());
|
||||
dto.setFranchiseFeeTax(invoicingDO.getFranchiseFeeTax().toString());
|
||||
dto.setFranchiseFee(invoicingDO.getFranchiseFee().toString());
|
||||
dto.setDesignFeeTax(invoicingDO.getDesignServiceFeeTax().toString());
|
||||
@@ -151,6 +163,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
dto.setShopStatus(response.getShopStatus());
|
||||
dto.setPlanOpenTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, response.getPlanOpenTime()));
|
||||
dto.setOpenDuration(response.getDays());
|
||||
dto.setCurrency("元");
|
||||
exportList.add(dto);
|
||||
}
|
||||
url = easyExcelUtil.exportExcel(ExportBranchShopDTO.class, exportList, null, FileTypeEnum.BRANCH_SHOP_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()), FileTypeEnum.BRANCH_SHOP_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
|
||||
|
||||
Reference in New Issue
Block a user