开店管理导出加字段

This commit is contained in:
shuo.wang
2025-02-07 14:40:11 +08:00
parent c87a934bde
commit 279ab0e0d4
4 changed files with 35 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.store.mapper; package com.cool.store.mapper;
import com.cool.store.dto.FranchiseFeeDTO;
import com.cool.store.entity.FranchiseFeeDO; import com.cool.store.entity.FranchiseFeeDO;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -11,6 +12,6 @@ import java.util.Map;
public interface FranchiseFeeMapper extends Mapper<FranchiseFeeDO> { public interface FranchiseFeeMapper extends Mapper<FranchiseFeeDO> {
FranchiseFeeDO selectByShopId(@Param("shopId") Long shopId); FranchiseFeeDO selectByShopId(@Param("shopId") Long shopId);
@MapKey("shopId")
Map<Long, Date> getPayTimeByShopIds(@Param("shopIds") List<Long> shopIds); List<FranchiseFeeDTO> getPayTimeByShopIds(@Param("shopIds") List<Long> shopIds);
} }

View File

@@ -9,14 +9,15 @@
order by create_time desc order by create_time desc
limit 1 limit 1
</select> </select>
<select id="getPayTimeByShopIds" resultType="java.util.HashMap"> <select id="getPayTimeByShopIds" resultType="com.cool.store.dto.FranchiseFeeDTO">
select a.shop_id AS shopId , select a.shop_id AS shopId ,
b.pay_time as payTime b.pay_time as payTime
from xfsg_franchise_fee a from xfsg_franchise_fee a
LEFT JOIN xfsg_line_pay b ON b.id = a.pay_id; LEFT JOIN xfsg_line_pay b ON b.id = a.pay_id
where a.shop_id in where a.shop_id in
<foreach collection="shopIds" item="shopId" open="(" separator="," close=")"> <foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
#{shopId} #{shopId}
</foreach> </foreach>
</select> </select>
</mapper> </mapper>

View File

@@ -0,0 +1,19 @@
package com.cool.store.dto;
import lombok.Data;
import java.util.Date;
/**
* @Author: WangShuo
* @Date: 2025/02/07/14:34
* @Version 1.0
* @注释:
*
*/
@Data
public class FranchiseFeeDTO {
private Long shopId;
private Date payTime;
}

View File

@@ -6,6 +6,7 @@ import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.dto.ExportBranchShopDTO; import com.cool.store.dto.ExportBranchShopDTO;
import com.cool.store.dto.FranchiseFeeDTO;
import com.cool.store.dto.Preparation.PreparationDTO; import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.dto.Preparation.ScheduleDTO; import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.PreparationScheduleDTO; import com.cool.store.dto.PreparationScheduleDTO;
@@ -101,7 +102,10 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
List<ExportBranchShopDTO> exportList = new ArrayList<>(); List<ExportBranchShopDTO> exportList = new ArrayList<>();
List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList()); List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList());
List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds); List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds);
Map<Long, Date> payTimeByShopIds = franchiseFeeMapper.getPayTimeByShopIds(shopIds); List<FranchiseFeeDTO> payTimeByShopIds = franchiseFeeMapper.getPayTimeByShopIds(shopIds);
Map<Long, Date> payTimeMap = payTimeByShopIds.stream().filter(o -> o.getPayTime() != null)
.filter(o -> o.getShopId() != null)
.collect(Collectors.toMap(FranchiseFeeDTO::getShopId, FranchiseFeeDTO::getPayTime));
Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>(); Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>();
if (signFranchises != null) { if (signFranchises != null) {
signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity())); signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
@@ -127,8 +131,11 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
dto.setContractStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractStartTime())); dto.setContractStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractStartTime()));
dto.setContractEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractEndTime())); dto.setContractEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractEndTime()));
} }
dto.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, payTimeByShopIds.get(response.getShopId()))); Date payTime = payTimeMap.get(response.getShopId());
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId()); if (Objects.nonNull(payTime)){
dto.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1,payTime));
}
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId());
if (invoicingDO != null) { if (invoicingDO != null) {
dto.setInvoicingTime(invoicingDO.getInvoiceDate()); dto.setInvoicingTime(invoicingDO.getInvoiceDate());
dto.setManagementFeeTax(invoicingDO.getManagementFeeTax().toString()); dto.setManagementFeeTax(invoicingDO.getManagementFeeTax().toString());