Browse Source

修改【费用申请活动支付金额管理 】 和 添加核销【余额不再支付】字段

v1.0
15989082884@163.com 2 years ago
parent
commit
6b48bb713f
  1. 2
      src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java
  2. 11
      src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java
  3. 34
      src/main/java/com/qs/serve/modules/vtb/controller/VtbVerificationDataController.java
  4. 2
      src/main/java/com/qs/serve/modules/vtb/entity/VtbVerification.java
  5. 2
      src/main/java/com/qs/serve/modules/vtb/entity/VtbVerificationSubject.java
  6. 29
      src/main/java/com/qs/serve/modules/vtb/entity/dto/VtbVerificationDTO.java
  7. 30
      src/main/java/com/qs/serve/modules/vtb/entity/so/VtbVerificationCheckSo.java
  8. 32
      src/main/java/com/qs/serve/modules/vtb/mapper/VtbVerForPayReportMapper.java
  9. 6
      src/main/java/com/qs/serve/modules/vtb/mapper/VtbVerReportMapper.java
  10. 199
      src/main/resources/mapper/vtb/VtbVerForPayReportMapper.xml
  11. 310
      src/main/resources/mapper/vtb/VtbVerReportMapper.xml

2
src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java

@ -36,7 +36,7 @@ public class PayPaymentBo implements Serializable {
private BigDecimal payAmount;
/** ERP编码 */
@NotNull(message = "ERP编码不能为空")
// @NotNull(message = "ERP编码不能为空")
private String erpId;
/** 发票编号 */

11
src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java

@ -243,7 +243,7 @@ public class PayPaymentServiceImpl extends ServiceImpl<PayPaymentMapper,PayPayme
payPayment.setBillNumber(paymentBo.getBillNumber());
payPayment.setRemark(paymentBo.getRemark());
payPayment.setTenantId("001");
payPayment.setErpId(paymentBo.getErpId());
// payPayment.setErpId(paymentBo.getErpId());
if(vtbSub!=null) {
payPayment.setSupplierId(vtbSub.getSupplierId());
@ -297,6 +297,15 @@ public class PayPaymentServiceImpl extends ServiceImpl<PayPaymentMapper,PayPayme
paymentItemService.save(payPaymentItem);
if(vtbSub!=null){
vtbSub.setPayReleaseFlag(1);
verificationSubjectService.updateById(vtbSub);
}else if(verificationList.size()!=0) {
verificationList.forEach(a->a.setPayReleaseFlag(1));
verificationService.updateBatchById(verificationList);
// verificationAmount = verificationList.stream().map(a -> a.getAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
}
return payPayment;
}

34
src/main/java/com/qs/serve/modules/vtb/controller/VtbVerificationDataController.java

@ -7,6 +7,7 @@ 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.VtbVerForPayReportMapper;
import com.qs.serve.modules.vtb.mapper.VtbVerReportMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -30,6 +31,9 @@ public class VtbVerificationDataController {
private final VtbVerReportMapper verReportMapper;
private final VtbVerForPayReportMapper verPayReportMapper;
/**
* 获取活动的核销情况
* @param query
@ -42,7 +46,12 @@ public class VtbVerificationDataController {
query.setOpenPage(1);
query.setStartRow(PageUtil.getStartRow());
List<Long> activityIds = verReportMapper.getActiveIdsForDataAmount(query);
if(activityIds.size()==0){
activityIds.add(0L);
}
query.setActivityIds(activityIds);
query.setOpenPage(0);
List<VtbActivityCheckDTO> list = verReportMapper.pageActiveAndVtbDataAmount(query);
PageVo<VtbActivityCheckDTO> page = new PageVo<>();
page.initPageByTotal(count);
@ -76,11 +85,19 @@ public class VtbVerificationDataController {
*/
@GetMapping("pageVerificationCheck")
public R<PageVo<VtbVerificationDTO>> getVerificationData(VtbVerificationCheckSo query){
Long count = verReportMapper.countVerificationCheck(query);
Long count = verPayReportMapper.countVerificationCheck(query);
if(count>0){
query.setOpenPage(1);
query.setStartRow(PageUtil.getStartRow());
List<VtbVerificationDTO> list = verReportMapper.pageVerificationCheck(query);
List<Long> ids = verPayReportMapper.getVerificationIdsForPay(query);
if(ids.size()==0){
ids.add(0L);
}
query.setVtbIds(ids);
query.setOpenPage(0);
List<VtbVerificationDTO> list = verPayReportMapper.pageVerificationCheck(query);
PageVo<VtbVerificationDTO> page = new PageVo<>();
page.initPageByTotal(count);
page.setList(list);
@ -96,7 +113,18 @@ public class VtbVerificationDataController {
*/
@GetMapping("exportVerificationCheck")
public R<List<VtbVerificationDTO>> exportVerificationCheck(VtbVerificationCheckSo query){
List<VtbVerificationDTO> list = verReportMapper.pageVerificationCheck(query);
List<VtbVerificationDTO> list = new ArrayList<>();
Long count = verPayReportMapper.countVerificationCheck(query);
if(count>0) {
List<Long> ids = verPayReportMapper.getVerificationIdsForPay(query);
if(ids.size()==0){
ids.add(0L);
}
query.setVtbIds(ids);
list = verPayReportMapper.pageVerificationCheck(query);
}
return R.ok(list);
}

2
src/main/java/com/qs/serve/modules/vtb/entity/VtbVerification.java

@ -76,6 +76,8 @@ public class VtbVerification implements Serializable {
/** 支付状态:0-未支付;1-已支付 */
private Integer paymentState;
private Integer payReleaseFlag;
/** 记录释放标识 */
private Integer regReleaseFlag;

2
src/main/java/com/qs/serve/modules/vtb/entity/VtbVerificationSubject.java

@ -88,6 +88,8 @@ public class VtbVerificationSubject implements Serializable {
/** 支付完成标识 */
private Integer payFinishedFlag;
private Integer payReleaseFlag;
/** 场次 */
@NotNull(message = "场次不能为空")
private Integer countSession;

29
src/main/java/com/qs/serve/modules/vtb/entity/dto/VtbVerificationDTO.java

@ -17,6 +17,22 @@ public class VtbVerificationDTO {
/** 核销编码 */
private String verificationCode;
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime createTime;
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime finishedTime;
/** 供应商编码 */
private String userCode;
/** 供应商 */
private String userName;
/** 供应商编码 */
private String supplierCode;
/** 供应商 */
@ -26,15 +42,24 @@ public class VtbVerificationDTO {
/** 核销金额 */
private String amount;
/** 支付金额 */
private String payAmt;
private String payAmount;
/** 不再支付金额 */
private String notPayAmt;
private String notPayAmount;
private String unpayAmount;
/** 费用编码 */
private String costApplyCode;
/** 费用主题 */
private String chargeTheme;
/** 费用申请时间 */
private String submitTime;
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime costPassTime;
/** 活动编码 */
private String activityCode;
/** 活动内容 */

30
src/main/java/com/qs/serve/modules/vtb/entity/so/VtbVerificationCheckSo.java

@ -5,6 +5,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author YenHex
@ -14,10 +15,17 @@ import java.time.LocalDateTime;
public class VtbVerificationCheckSo {
/** 核销编码 */
private String verificationCode;
/** 供应商编码 */
private String supplierCode;
/** 供应商 */
private String supplierName;
private Integer stopSupplierFlag;
private String userCode;
private String userName;
/** 费用编码 */
private String costApplyCode;
/** 费用主题 */
@ -27,14 +35,27 @@ public class VtbVerificationCheckSo {
/** 活动内容 */
private String actTitle;
/** 开始核销时间 */
private String wayTitle;
/** 核销开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime startCheckTime;
private LocalDateTime queryStartCheckTime;
/** 核销开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime endCheckTime;
private LocalDateTime queryEndCheckTime;
/** 核销完成时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime queryStartFinishCheckTime;
/** 核销完成时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime queryEndFinishCheckTime;
/** 开始支付时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -53,4 +74,7 @@ public class VtbVerificationCheckSo {
* 当openPage=1时,进行翻页(后台维护)
*/
private Integer openPage;
private List<Long> vtbIds;
}

32
src/main/java/com/qs/serve/modules/vtb/mapper/VtbVerForPayReportMapper.java

@ -0,0 +1,32 @@
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 VtbVerForPayReportMapper {
// 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);
List<Long> getVerificationIdsForPay(@Param("query") VtbVerificationCheckSo query);
// List<VtbActivityCheckDTO> pageActiveAndVtbDataAmount(@Param("query") VtbActivityCheckSo query);
//
// Long countActiveAndVtbDataAmount(@Param("query") VtbActivityCheckSo query);
//
}

6
src/main/java/com/qs/serve/modules/vtb/mapper/VtbVerReportMapper.java

@ -17,9 +17,9 @@ 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);
// List<VtbVerificationDTO> pageVerificationCheck(@Param("query") VtbVerificationCheckSo query);
//
// Long countVerificationCheck(@Param("query") VtbVerificationCheckSo query);
List<VtbActivityCheckDTO> pageActiveAndVtbDataAmount(@Param("query") VtbActivityCheckSo query);

199
src/main/resources/mapper/vtb/VtbVerForPayReportMapper.xml

@ -0,0 +1,199 @@
<?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.VtbVerForPayReportMapper">
<select id="pageVerificationCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO">
SELECT
vtb.verification_code,
vtb.create_time,
vtb.finished_time,
vtb.user_code,
vtb.user_name,
vtb.supplier_code,
vtb.supplier_name,
vtb.way_title,
IFNULL( vtb.amount, 0 ) AS amount,
IFNULL(pay_item1.pay_amt,0) as pay_amount,
IFNULL(pay_item1.not_pay_amt,0) as not_pay_amount,
IFNULL( vtb.amount, 0 ) - IFNULL(pay_item1.pay_amt,0) - IFNULL(pay_item1.not_pay_amt,0) as unpay_amount,
cost.`code` as costApplyCode,
cost.charge_theme,
cost.submit_time,
act.cost_pass_time,
act.activity_code,
act.act_title
FROM
vtb_verification vtb
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
left join bms_supplier sup on vtb.supplier_id = sup.id
LEFT JOIN (
SELECT
pay.verification_id,
sum( Case pay.pay_type when 'pay' Then pay.item_pay_amount else 0 end ) AS pay_amt ,
sum( Case pay.pay_type when 'unPay' Then pay.item_pay_amount else 0 end ) AS not_pay_amt
FROM
pay_payment_item pay
WHERE pay.del_flag = 0
<!-- <if test="query.startPayTime != null ">-->
<!-- and pay.pay_date &gt;= #{query.startPayTime} </if>-->
<!-- <if test="query.endPayTime != null ">-->
<!-- and pay.pay_date &lt;= #{query.endPayTime} </if>-->
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
and pay.verification_id in
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
GROUP BY
pay.verification_id
) pay_item1 ON pay_item1.verification_id = vtb.id
WHERE
vtb.del_flag = 0
AND vtb.verification_state = 1
AND act.del_flag = 0
AND act.cancel_flag = 0
AND cost.del_flag = 0
AND cost.cancel_flag = 0
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
and vtb.id in
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.queryStartCheckTime != null ">
and vtb.create_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndCheckTime != null ">
and vtb.create_time &lt;= #{query.queryEndCheckTime} </if>
<if test="query.queryStartFinishCheckTime != null ">
and vtb.finished_time &gt;= #{query.queryStartFinishCheckTime} </if>
<if test="query.queryEndFinishCheckTime != null ">
and vtb.finished_time &lt;= #{query.queryEndFinishCheckTime} </if>
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
<select id="countVerificationCheck" resultType="java.lang.Long">
SELECT
count(1)
FROM
vtb_verification vtb
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
left join bms_supplier sup on vtb.supplier_id = sup.id
WHERE
vtb.del_flag = 0
AND vtb.verification_state = 1
AND act.del_flag = 0
AND act.cancel_flag = 0
AND cost.del_flag = 0
AND cost.cancel_flag = 0
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
and vtb.id in
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.queryStartCheckTime != null ">
and vtb.create_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndCheckTime != null ">
and vtb.create_time &lt;= #{query.queryEndCheckTime} </if>
<if test="query.queryStartFinishCheckTime != null ">
and vtb.finished_time &gt;= #{query.queryStartFinishCheckTime} </if>
<if test="query.queryEndFinishCheckTime != null ">
and vtb.finished_time &lt;= #{query.queryEndFinishCheckTime} </if>
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
</select>
<select id="getVerificationIdsForPay" resultType="java.lang.Long">
SELECT
vtb.id
FROM
vtb_verification vtb
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
left join bms_supplier sup on vtb.supplier_id = sup.id
WHERE
vtb.del_flag = 0
AND vtb.verification_state = 1
AND act.del_flag = 0
AND act.cancel_flag = 0
AND cost.del_flag = 0
AND cost.cancel_flag = 0
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
and vtb.id in
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.queryStartCheckTime != null ">
and vtb.create_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndCheckTime != null ">
and vtb.create_time &lt;= #{query.queryEndCheckTime} </if>
<if test="query.queryStartFinishCheckTime != null ">
and vtb.finished_time &gt;= #{query.queryStartFinishCheckTime} </if>
<if test="query.queryEndFinishCheckTime != null ">
and vtb.finished_time &lt;= #{query.queryEndFinishCheckTime} </if>
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
</mapper>

310
src/main/resources/mapper/vtb/VtbVerReportMapper.xml

@ -3,171 +3,171 @@
<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 `tbs_cost_apply`.`submit_time` &gt;= #{query.queryStartSubmitTime} </if>
<if test="query.queryEndSubmitTime != null "> and `tbs_cost_apply`.`submit_time` &lt;= #{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>
<!-- <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 `tbs_cost_apply`.`submit_time` &gt;= #{query.queryStartSubmitTime} </if>-->
<!-- <if test="query.queryEndSubmitTime != null "> and `tbs_cost_apply`.`submit_time` &lt;= #{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 vtb.finished_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndSubmitTime != null ">
and vtb.finished_time &lt;= #{query.queryEndSubmitTime} </if>
group by vtb.activity_id
) vvtb on vvtb.activity_id = tbs_activity.id
<include refid="baseSelectCheckWhere"></include>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
<!-- <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 vtb.finished_time &gt;= #{query.queryStartCheckTime} </if>-->
<!-- <if test="query.queryEndSubmitTime != null ">-->
<!-- and vtb.finished_time &lt;= #{query.queryEndSubmitTime} </if>-->
<!-- group by vtb.activity_id-->
<!-- ) vvtb on vvtb.activity_id = tbs_activity.id-->
<!-- <include refid="baseSelectCheckWhere"></include>-->
<!-- <if test="query.openPage!=null and query.openPage==1">-->
<!-- limit #{query.startRow},#{query.pageSize}-->
<!-- </if>-->
<!-- </select>-->
<resultMap id="vtbActivityCheckDTOMap" type="com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO">
<!-- <resultMap id="vtbActivityCheckDTOMap" type="com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO">-->
</resultMap>
<!-- </resultMap>-->
<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 vtb.finished_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndSubmitTime != null ">
and vtb.finished_time &lt;= #{query.queryEndSubmitTime} </if>
group by vtb.activity_id
) vvtb on vvtb.activity_id = tbs_activity.id
<include refid="baseSelectCheckWhere"></include>
</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 vtb.finished_time &gt;= #{query.queryStartCheckTime} </if>-->
<!-- <if test="query.queryEndSubmitTime != null ">-->
<!-- and vtb.finished_time &lt;= #{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" resultMap="verificationCheckMap">
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 &lt;= #{query.startPayTime}</if>
<if test="query.endPayTime != null and query.endPayTime != ''"> and pm.create_time &lt;= #{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 pm.create_time &lt;= #{query.startPayTime}</if>
<if test="query.endPayTime != null "> and pm.create_time &lt;= #{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 vtb.verification_state = 1
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 `vtb`.`finished_time` &gt;= #{query.startCheckTime}</if>
<if test="query.startCheckTime != null "> and `vtb`.`finished_time` &lt;= #{query.endCheckTime}</if>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
<!-- <select id="pageVerificationCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO" resultMap="verificationCheckMap">-->
<!-- 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 &lt;= #{query.startPayTime}</if>-->
<!-- <if test="query.endPayTime != null and query.endPayTime != ''"> and pm.create_time &lt;= #{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 pm.create_time &lt;= #{query.startPayTime}</if>-->
<!-- <if test="query.endPayTime != null "> and pm.create_time &lt;= #{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 vtb.verification_state = 1-->
<!-- 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 `vtb`.`finished_time` &gt;= #{query.startCheckTime}</if>-->
<!-- <if test="query.startCheckTime != null "> and `vtb`.`finished_time` &lt;= #{query.endCheckTime}</if>-->
<!-- <if test="query.openPage!=null and query.openPage==1">-->
<!-- limit #{query.startRow},#{query.pageSize}-->
<!-- </if>-->
<!-- </select>-->
<select id="countVerificationCheck" resultType="java.lang.Long">
select count(1) from vtb_verification
</select>
<!-- <select id="countVerificationCheck" resultType="java.lang.Long">-->
<!-- select count(1) from vtb_verification-->
<!-- </select>-->
<resultMap id="verificationCheckMap" type="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO">
<result property="verificationCode" column="verification_code"/>
<result property="supplierCode" column="supplier_code"/>
<result property="supplierName" column="supplier_name"/>
<result property="wayTitle" column="way_title"/>
<result property="amount" column="amount"/>
<result property="payAmt" column="pay_amt"/>
<result property="notPayAmt" column="not_pay_amt"/>
<result property="costApplyCode" column="code"/>
<result property="chargeTheme" column="charge_theme"/>
<result property="submitTime" column="submit_time"/>
<result property="activityCode" column="activity_code"/>
<result property="actTitle" column="act_title"/>
</resultMap>
<!-- <resultMap id="verificationCheckMap" type="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO">-->
<!-- <result property="verificationCode" column="verification_code"/>-->
<!-- <result property="supplierCode" column="supplier_code"/>-->
<!-- <result property="supplierName" column="supplier_name"/>-->
<!-- <result property="wayTitle" column="way_title"/>-->
<!-- <result property="amount" column="amount"/>-->
<!-- <result property="payAmt" column="pay_amt"/>-->
<!-- <result property="notPayAmt" column="not_pay_amt"/>-->
<!-- <result property="costApplyCode" column="code"/>-->
<!-- <result property="chargeTheme" column="charge_theme"/>-->
<!-- <result property="submitTime" column="submit_time"/>-->
<!-- <result property="activityCode" column="activity_code"/>-->
<!-- <result property="actTitle" column="act_title"/>-->
<!-- </resultMap>-->
<select id="pageActiveAndVtbDataAmount" resultType="com.qs.serve.modules.vtb.entity.dto.VtbActivityCheckDTO">
SELECT

Loading…
Cancel
Save