12 changed files with 477 additions and 10 deletions
@ -0,0 +1,68 @@ |
|||||
|
package com.qs.serve.modules.vtb.controller; |
||||
|
|
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO; |
||||
|
import com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO; |
||||
|
import com.qs.serve.modules.vtb.entity.so.VtbActivityCheckSo; |
||||
|
import com.qs.serve.modules.vtb.entity.so.VtbVerificationCheckSo; |
||||
|
import com.qs.serve.modules.vtb.mapper.VtbVerReportMapper; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 核销数据 |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("vtb/data") |
||||
|
public class VtbVerificationDataController { |
||||
|
|
||||
|
private final VtbVerReportMapper verReportMapper; |
||||
|
|
||||
|
/** |
||||
|
* 获取活动的核销情况 |
||||
|
* @param query |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("pageActivityCheck") |
||||
|
public R<PageVo<VtbActivityCheckDTO>> getActivityData(VtbActivityCheckSo query){ |
||||
|
Long count = verReportMapper.countActivityCheck(query); |
||||
|
if(count>0){ |
||||
|
List<VtbActivityCheckDTO> list = verReportMapper.pageActivityCheck(query); |
||||
|
PageVo<VtbActivityCheckDTO> page = new PageVo<>(); |
||||
|
page.initPageByTotal(count); |
||||
|
page.setList(list); |
||||
|
return R.ok(page); |
||||
|
} |
||||
|
return R.byEmptyList(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取核销的支付信息 |
||||
|
* @param query |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("pageVerificationCheck") |
||||
|
public R<?> getVerificationData(VtbVerificationCheckSo query){ |
||||
|
Long count = verReportMapper.countVerificationCheck(query); |
||||
|
if(count>0){ |
||||
|
List<VtbVerificationDTO> list = verReportMapper.pageVerificationCheck(query); |
||||
|
PageVo<VtbVerificationDTO> page = new PageVo<>(); |
||||
|
page.initPageByTotal(count); |
||||
|
page.setList(list); |
||||
|
return R.ok(page); |
||||
|
} |
||||
|
return R.byEmptyList(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.qs.serve.modules.vtb.entity.dto; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* 活动的核销情况 |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VtbActivityCheckDTO { |
||||
|
|
||||
|
private String costApplyId; |
||||
|
|
||||
|
/** 费用编码 */ |
||||
|
private String costApplyCode; |
||||
|
|
||||
|
private String costTitle; |
||||
|
|
||||
|
/** 客户id */ |
||||
|
private String supplierId; |
||||
|
|
||||
|
private String supplierCode; |
||||
|
|
||||
|
private String supplierName; |
||||
|
|
||||
|
/** 提交实际 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime submitTime; |
||||
|
|
||||
|
/** 活动编码 */ |
||||
|
private String activityCode; |
||||
|
|
||||
|
private String activityTitle; |
||||
|
|
||||
|
private String activityAmount; |
||||
|
|
||||
|
/** 核销金额 */ |
||||
|
private String checkAmount; |
||||
|
|
||||
|
/** 核销完成 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime checkFinishedDate; |
||||
|
|
||||
|
/** 释放标识 */ |
||||
|
private Integer releaseFlag; |
||||
|
|
||||
|
/** 释放金额 */ |
||||
|
private BigDecimal releaseAmount; |
||||
|
|
||||
|
/** 释放时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime releaseTime; |
||||
|
|
||||
|
/** 释放人员id */ |
||||
|
private String releaseUserId; |
||||
|
|
||||
|
/** 释放人员 */ |
||||
|
private String releaseUserName; |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.qs.serve.modules.vtb.entity.dto; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* 活动的核销情况 |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VtbVerificationDTO { |
||||
|
|
||||
|
/** 核销编码 */ |
||||
|
private String verificationCode; |
||||
|
/** 供应商编码 */ |
||||
|
private String supplierCode; |
||||
|
/** 供应商 */ |
||||
|
private String supplierName; |
||||
|
/** 支付方式 */ |
||||
|
private String wayTitle; |
||||
|
/** 核销金额 */ |
||||
|
private String amount; |
||||
|
/** 支付金额 */ |
||||
|
private String payAmt; |
||||
|
/** 不再支付金额 */ |
||||
|
private String notPayAmt; |
||||
|
/** 费用编码 */ |
||||
|
private String costApplyCode; |
||||
|
/** 费用主题 */ |
||||
|
private String chargeTheme; |
||||
|
/** 费用申请时间 */ |
||||
|
private String submitTime; |
||||
|
/** 活动编码 */ |
||||
|
private String activityCode; |
||||
|
/** 活动内容 */ |
||||
|
private String actTitle; |
||||
|
|
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.qs.serve.modules.vtb.entity.so; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* 活动的核销情况 |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VtbActivityCheckSo { |
||||
|
|
||||
|
/** 费用编码 */ |
||||
|
private String costApplyCode; |
||||
|
|
||||
|
private String costTitle; |
||||
|
|
||||
|
/** 客户 */ |
||||
|
private String supplierCode; |
||||
|
|
||||
|
private String supplierName; |
||||
|
|
||||
|
/** 活动编码 */ |
||||
|
private String activityCode; |
||||
|
|
||||
|
private String activityTitle; |
||||
|
|
||||
|
|
||||
|
/** 提交开始时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime queryStartSubmitTime; |
||||
|
|
||||
|
/** 提交结束时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime queryEndSubmitTime; |
||||
|
|
||||
|
/** 核销开始时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime queryStartCheckTime; |
||||
|
|
||||
|
/** 核销开始时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime queryEndCheckTime; |
||||
|
|
||||
|
private Integer pageSize; |
||||
|
|
||||
|
private Integer startRow; |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.qs.serve.modules.vtb.entity.so; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VtbVerificationCheckSo { |
||||
|
/** 核销编码 */ |
||||
|
private String verificationCode; |
||||
|
/** 供应商编码 */ |
||||
|
private String supplierCode; |
||||
|
/** 供应商 */ |
||||
|
private String supplierName; |
||||
|
/** 费用编码 */ |
||||
|
private String costApplyCode; |
||||
|
/** 费用主题 */ |
||||
|
private String chargeTheme; |
||||
|
/** 活动编码 */ |
||||
|
private String activityCode; |
||||
|
/** 活动内容 */ |
||||
|
private String actTitle; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime startCheckTime; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime endCheckTime; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime startPayTime; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private LocalDateTime endPayTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.qs.serve.modules.vtb.mapper; |
||||
|
|
||||
|
import com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO; |
||||
|
import com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO; |
||||
|
import com.qs.serve.modules.vtb.entity.so.VtbActivityCheckSo; |
||||
|
import com.qs.serve.modules.vtb.entity.so.VtbVerificationCheckSo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/9/4 |
||||
|
*/ |
||||
|
public interface VtbVerReportMapper { |
||||
|
|
||||
|
List<VtbActivityCheckDTO> pageActivityCheck(@Param("query") VtbActivityCheckSo query); |
||||
|
|
||||
|
Long countActivityCheck(@Param("query") VtbActivityCheckSo query); |
||||
|
|
||||
|
List<VtbVerificationDTO> pageVerificationCheck(@Param("query") VtbVerificationCheckSo query); |
||||
|
|
||||
|
Long countVerificationCheck(@Param("query") VtbVerificationCheckSo query); |
||||
|
|
||||
|
} |
@ -0,0 +1,145 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.qs.serve.modules.vtb.mapper.VtbVerReportMapper"> |
||||
|
|
||||
|
|
||||
|
<sql id="baseSelectCheckWhere"> |
||||
|
where 1=1 |
||||
|
and tbs_activity.del_flag = 0 |
||||
|
and tbs_activity.cancel_flag = 0 |
||||
|
and tbs_cost_apply.del_flag = 0 |
||||
|
and tbs_cost_apply.charge_state in(2,3) |
||||
|
and tbs_cost_apply.cancel_flag = 0 |
||||
|
<if test="query.activityCode != null and query.activityCode != ''"> and `tbs_activity`.`activity_code` like concat('%',#{query.activityCode},'%')</if> |
||||
|
<if test="query.activityTitle != null and query.activityTitle != ''"> and `tbs_activity`.`act_title` like concat('%',#{query.activityTitle},'%')</if> |
||||
|
<if test="query.queryStartSubmitTime != null and query.queryStartSubmitTime != ''"> and `tbs_cost_apply`.`submit_time` >= #{query.queryStartSubmitTime} </if> |
||||
|
<if test="query.queryEndSubmitTime != null and query.queryEndSubmitTime != ''"> and `tbs_cost_apply`.`submit_time` <= #{query.queryEndSubmitTime} </if> |
||||
|
<if test="query.supplierCode != null and query.supplierCode != ''"> and `tbs_cost_apply`.`supplier_code` like concat('%',#{query.supplierCode},'%') </if> |
||||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `tbs_cost_apply`.`supplier_name` like concat('%',#{query.supplierName},'%') </if> |
||||
|
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `tbs_cost_apply`.`code` like concat('%',#{query.costApplyCode},'%') </if> |
||||
|
<if test="query.costTitle != null and query.costTitle != ''"> and `tbs_cost_apply`.`charge_theme` like concat('%',#{query.costTitle},'%') </if> |
||||
|
</sql> |
||||
|
|
||||
|
<select id="pageActivityCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO"> |
||||
|
select |
||||
|
tbs_cost_apply.`id` as costApplyId, |
||||
|
tbs_cost_apply.`code` as costApplyCode, |
||||
|
tbs_cost_apply.charge_theme as costTitle, |
||||
|
tbs_cost_apply.supplier_id , |
||||
|
tbs_cost_apply.supplier_code , |
||||
|
tbs_cost_apply.supplier_name , |
||||
|
tbs_cost_apply.submit_time , |
||||
|
tbs_activity.activity_code, |
||||
|
tbs_activity.act_title as activity_title, |
||||
|
tbs_activity.total_amount as activity_amount, |
||||
|
vvtb.act_check_amt as check_amount, |
||||
|
vvtb.vtb_finished_date as check_finished_date, |
||||
|
tbs_activity.`release_flag`, |
||||
|
tbs_activity.`release_amount`, |
||||
|
tbs_activity.`release_time`, |
||||
|
tbs_activity.`release_user_id`, |
||||
|
tbs_activity.`release_user_name` |
||||
|
from tbs_activity |
||||
|
left join tbs_cost_apply on tbs_activity.cost_apply_id = tbs_cost_apply.id |
||||
|
left join ( |
||||
|
select |
||||
|
vtb.activity_id, |
||||
|
sum(vtb.amount) as act_check_amt, |
||||
|
max(vtb.finished_time) as vtb_finished_date |
||||
|
from vtb_verification vtb |
||||
|
where |
||||
|
vtb.del_flag = 0 |
||||
|
<if test="query.queryStartCheckTime != null and query.queryStartCheckTime != ''"> |
||||
|
and vtb.finished_time >= #{query.queryStartCheckTime} </if> |
||||
|
<if test="query.queryEndSubmitTime != null and query.queryEndSubmitTime != ''"> |
||||
|
and vtb.finished_time <= #{query.queryEndSubmitTime} </if> |
||||
|
group by vtb.activity_id |
||||
|
) vvtb on vvtb.activity_id = tbs_activity.id |
||||
|
<include refid="baseSelectCheckWhere"></include> |
||||
|
limit #{query.startRow},#{query.pageSize} |
||||
|
</select> |
||||
|
|
||||
|
<select id="countActivityCheck" resultType="java.lang.Long"> |
||||
|
select |
||||
|
count(1) |
||||
|
from tbs_activity |
||||
|
left join tbs_cost_apply on tbs_activity.cost_apply_id = tbs_cost_apply.id |
||||
|
left join ( |
||||
|
select |
||||
|
vtb.activity_id |
||||
|
from vtb_verification vtb |
||||
|
where |
||||
|
vtb.del_flag = 0 |
||||
|
<if test="query.queryStartCheckTime != null and query.queryStartCheckTime != ''"> |
||||
|
and vtb.finished_time >= #{query.queryStartCheckTime} </if> |
||||
|
<if test="query.queryEndSubmitTime != null and query.queryEndSubmitTime != ''"> |
||||
|
and vtb.finished_time <= #{query.queryEndSubmitTime} </if> |
||||
|
group by vtb.activity_id |
||||
|
) vvtb on vvtb.activity_id = tbs_activity.id |
||||
|
<include refid="baseSelectCheckWhere"></include> |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="pageVerificationCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO"> |
||||
|
select |
||||
|
vtb.verification_code , |
||||
|
vtb.supplier_code , |
||||
|
vtb.supplier_name , |
||||
|
vtb.way_title , |
||||
|
vtb.amount , |
||||
|
pay_item1.pay_amt , |
||||
|
pay_item2.pay_amt as `not_pay_amt`, |
||||
|
cost.`code` , |
||||
|
cost.charge_theme , |
||||
|
cost.submit_time , |
||||
|
act.activity_code , |
||||
|
act.act_title |
||||
|
from vtb_verification vtb |
||||
|
left join |
||||
|
( |
||||
|
select pay1.verification_id,sum(pay1.item_pay_amount) as pay_amt |
||||
|
from pay_payment_item pay1 |
||||
|
left join pay_payment pm |
||||
|
on pm.id = pay1.payment_id |
||||
|
where pm.cancel_flag= 0 and pay1.del_flag = 0 and pay1.pay_type = 'pay' |
||||
|
<if test="query.startPayTime != null and query.startPayTime != ''"> and pm.create_time <= #{query.startPayTime}</if> |
||||
|
<if test="query.endPayTime != null and query.endPayTime != ''"> and pm.create_time <= #{query.endPayTime}</if> |
||||
|
group by pay1.verification_id |
||||
|
) pay_item1 |
||||
|
on pay_item1.verification_id = vtb.id |
||||
|
left join |
||||
|
( |
||||
|
select pay2.verification_id,sum(pay2.item_pay_amount) as pay_amt |
||||
|
from pay_payment_item pay2 |
||||
|
left join pay_payment pm |
||||
|
on pm.id = pay2.payment_id |
||||
|
where pm.cancel_flag= 0 and pay2.del_flag = 0 and pay2.pay_type = 'unPay' |
||||
|
<if test="query.startPayTime != null and query.startPayTime != ''"> and pm.create_time <= #{query.startPayTime}</if> |
||||
|
<if test="query.endPayTime != null and query.endPayTime != ''"> and pm.create_time <= #{query.endPayTime}</if> |
||||
|
group by pay2.verification_id |
||||
|
) pay_item2 |
||||
|
on pay_item2.verification_id = vtb.id |
||||
|
left join tbs_cost_apply cost on cost.id = vtb.cost_apply_id |
||||
|
left join tbs_activity act on act.id = vtb.activity_id |
||||
|
where |
||||
|
vtb.del_flag = 0 |
||||
|
and act.del_flag = 0 |
||||
|
and act.cancel_flag = 0 |
||||
|
and cost.del_flag = 0 |
||||
|
and cost.cancel_flag = 0 |
||||
|
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if> |
||||
|
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if> |
||||
|
<if test="query.supplierCode != null and query.supplierCode != ''"> and `act`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if> |
||||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `act`.`supplier_name` like concat('%',#{query.supplierName},'%')</if> |
||||
|
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if> |
||||
|
<if test="query.verificationCode != null and query.verificationCode != ''"> and `cost`.`code` like concat('%',#{query.verificationCode},'%')</if> |
||||
|
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if> |
||||
|
<if test="query.startCheckTime != null and query.startCheckTime != ''"> and `vtb`.`finished_time` >= #{query.startCheckTime}</if> |
||||
|
<if test="query.startCheckTime != null and query.startCheckTime != ''"> and `vtb`.`finished_time` <= #{query.endCheckTime}</if> |
||||
|
</select> |
||||
|
|
||||
|
<select id="countVerificationCheck" resultType="java.lang.Long"> |
||||
|
select count(1) from vtb_verification |
||||
|
</select> |
||||
|
</mapper> |
||||
|
|
Loading…
Reference in new issue