Browse Source

活动核销金额查询界面和导出

v1.0
15989082884@163.com 2 years ago
parent
commit
15fc6e1b32
  1. 15
      src/main/java/com/qs/serve/modules/vtb/controller/VtbVerificationDataController.java
  2. 45
      src/main/java/com/qs/serve/modules/vtb/entity/dto/VtbActivityCheckDTO.java
  3. 38
      src/main/java/com/qs/serve/modules/vtb/entity/so/VtbActivityCheckSo.java
  4. 11
      src/main/java/com/qs/serve/modules/vtb/mapper/VtbVerReportMapper.java
  5. 221
      src/main/resources/mapper/vtb/VtbVerReportMapper.xml

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

@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
@ -36,11 +37,13 @@ public class VtbVerificationDataController {
*/
@GetMapping("pageActivityCheck")
public R<PageVo<VtbActivityCheckDTO>> getActivityData(VtbActivityCheckSo query){
Long count = verReportMapper.countActivityCheck(query);
Long count = verReportMapper.countActiveAndVtbDataAmount(query);
if(count>0){
query.setOpenPage(1);
query.setStartRow(PageUtil.getStartRow());
List<VtbActivityCheckDTO> list = verReportMapper.pageActivityCheck(query);
List<Long> activityIds = verReportMapper.getActiveIdsForDataAmount(query);
query.setActivityIds(activityIds);
List<VtbActivityCheckDTO> list = verReportMapper.pageActiveAndVtbDataAmount(query);
PageVo<VtbActivityCheckDTO> page = new PageVo<>();
page.initPageByTotal(count);
page.setList(list);
@ -56,7 +59,13 @@ public class VtbVerificationDataController {
*/
@GetMapping("exportActivityCheck")
public R<List<VtbActivityCheckDTO>> exportActivityData(VtbActivityCheckSo query){
List<VtbActivityCheckDTO> list = verReportMapper.pageActivityCheck(query);
List<VtbActivityCheckDTO> list = new ArrayList<>();
Long count = verReportMapper.countActiveAndVtbDataAmount(query);
if(count>0) {
List<Long> activityIds = verReportMapper.getActiveIdsForDataAmount(query);
query.setActivityIds(activityIds);
list = verReportMapper.pageActiveAndVtbDataAmount(query);
}
return R.ok(list);
}

45
src/main/java/com/qs/serve/modules/vtb/entity/dto/VtbActivityCheckDTO.java

@ -29,40 +29,49 @@ public class VtbActivityCheckDTO {
private String supplierName;
private String userCode;
private String userName;
private Integer chargeState;
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime submitTime;
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime passTime;
/** 活动编码 */
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 actStartDate;
/** 核销完成 */
/** 提交实际 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime checkFinishedDate;
private LocalDateTime actEndDate;
/** 释放标识 */
private Integer releaseFlag;
/** 释放金额 */
private BigDecimal releaseAmount;
private BigDecimal activityAmount;
/** 释放时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime releaseTime;
/** 核销金额 */
private BigDecimal checkedAmount;
/** 释放人员id */
private String releaseUserId;
/** 核销金额 */
private BigDecimal checkingAmount;
private BigDecimal notCheckAmount;
/** 释放金额 */
private BigDecimal releaseAmount;
/** 释放人员 */
private String releaseUserName;
}

38
src/main/java/com/qs/serve/modules/vtb/entity/so/VtbActivityCheckSo.java

@ -6,6 +6,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* 活动的核销情况
@ -30,6 +31,13 @@ public class VtbActivityCheckSo {
private String activityTitle;
private String userCode;
private String userName;
private Integer costApplyState;
/** 核销状态 */
private Integer verificationState;
/** 提交开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -41,6 +49,16 @@ public class VtbActivityCheckSo {
@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 queryStartFinishTime;
/** 过审结束时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime queryEndFinishTime;
/** 核销开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ -51,6 +69,24 @@ public class VtbActivityCheckSo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
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")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime queryStartActivityEndTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime queryEndActivityEndTime;
private Integer pageSize;
private Integer startRow;
@ -60,4 +96,6 @@ public class VtbActivityCheckSo {
*/
private Integer openPage;
private List<Long> activityIds;
}

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

@ -14,12 +14,17 @@ import java.util.List;
*/
public interface VtbVerReportMapper {
List<VtbActivityCheckDTO> pageActivityCheck(@Param("query") VtbActivityCheckSo query);
Long countActivityCheck(@Param("query") VtbActivityCheckSo query);
// 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<VtbActivityCheckDTO> pageActiveAndVtbDataAmount(@Param("query") VtbActivityCheckSo query);
Long countActiveAndVtbDataAmount(@Param("query") VtbActivityCheckSo query);
List<Long> getActiveIdsForDataAmount(@Param("query") VtbActivityCheckSo query);
}

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

@ -85,20 +85,7 @@
<include refid="baseSelectCheckWhere"></include>
</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>
<select id="pageVerificationCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO" resultMap="verificationCheckMap">
select
@ -165,5 +152,211 @@
<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>
<select id="pageActiveAndVtbDataAmount" 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.user_code,
tbs_cost_apply.user_name,
tbs_cost_apply.charge_state,
c.activity_code,
c.act_title as activityTitle,
c.act_start_date,
c.act_end_date,
tbs_cost_apply.submit_time AS submitTime,
c.cost_pass_time as passTime,
IFNULL( c.total_amount, 0 ) AS activity_amount,
IFNULL( verification_query.checked_amt, 0 ) AS checked_amount,
IFNULL( verification_query.checking_amt, 0 ) AS checking_amount,
IFNULL( c.release_amount, 0 ) AS release_amount,
(
CASE
WHEN tbs_cost_apply.charge_state = 1 THEN
0
ELSE
IFNULL( c.total_amount, 0 ) - IFNULL( verification_totals.checked_amt, 0 ) - IFNULL( verification_totals.checking_amt, 0 ) - IFNULL( c.release_amount, 0 ) END
) AS notCheckAmount
FROM
tbs_activity c
LEFT JOIN tbs_cost_apply ON c.cost_apply_id = tbs_cost_apply.id
LEFT JOIN (
SELECT
activity_id,
SUM( CASE WHEN verification_state = 1 THEN amount ELSE 0 END ) AS checked_amt,
SUM( CASE WHEN verification_state = 0 THEN amount ELSE 0 END ) AS checking_amt
FROM
vtb_verification
WHERE
del_flag = 0
<if test="query.activityIds !=null and query.activityIds.size > 0">
and activity_id in
<foreach collection="query.activityIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.verificationState != null ">
and verification_state = #{query.verificationState} </if>
<if test="query.queryStartCheckTime != null ">
and create_time &gt;= #{query.queryStartCheckTime} </if>
<if test="query.queryEndCheckTime != null ">
and create_time &lt;= #{query.queryEndCheckTime} </if>
<if test="query.queryStartFinishCheckTime != null ">
and finished_time &gt;= #{query.queryStartFinishCheckTime} </if>
<if test="query.queryEndFinishCheckTime != null ">
and finished_time &lt;= #{query.queryEndFinishCheckTime} </if>
GROUP BY
activity_id
) verification_query ON verification_query.activity_id = c.id
LEFT JOIN (
SELECT
activity_id,
SUM( CASE WHEN verification_state = 1 THEN amount ELSE 0 END ) AS checked_amt,
SUM( CASE WHEN verification_state = 0 THEN amount ELSE 0 END ) AS checking_amt
FROM
vtb_verification
WHERE
del_flag = 0
<if test="query.activityIds !=null and query.activityIds.size > 0">
and activity_id in
<foreach collection="query.activityIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
GROUP BY
activity_id
) verification_totals ON verification_totals.activity_id = c.id
WHERE
c.del_flag = 0
and c.cancel_flag = 0
AND tbs_cost_apply.del_flag = 0
and tbs_cost_apply.cancel_flag = 0
<if test="query.costApplyState != null ">
AND tbs_cost_apply.charge_state = #{query.costApplyState} </if>
<if test="query.costApplyState == null ">
AND tbs_cost_apply.charge_state in (1,2,3) </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.queryStartFinishTime != null ">
and c.cost_pass_time &gt;= #{query.queryStartFinishTime} </if>
<if test="query.queryEndFinishTime != null ">
and c.cost_pass_time &lt;= #{query.queryEndFinishTime} </if>
<if test="query.queryStartActivityEndTime != null ">
and c.act_end_date &gt;= #{query.queryStartActivityEndTime} </if>
<if test="query.queryEndActivityEndTime != null ">
and c.act_end_date &lt;= #{query.queryEndActivityEndTime} </if>
<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.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>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_cost_apply`.`user_code` like concat('%',#{query.userCode},'%') </if>
<if test="query.userName != null and query.userName != ''"> and `tbs_cost_apply`.`user_name` like concat('%',#{query.userName},'%') </if>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
<select id="countActiveAndVtbDataAmount" resultType="java.lang.Long">
SELECT
count(1)
FROM
tbs_activity c
LEFT JOIN tbs_cost_apply ON c.cost_apply_id = tbs_cost_apply.id
WHERE
c.del_flag = 0
and c.cancel_flag = 0
AND tbs_cost_apply.del_flag = 0
and tbs_cost_apply.cancel_flag = 0
<if test="query.costApplyState != null ">
AND tbs_cost_apply.charge_state = #{query.costApplyState} </if>
<if test="query.costApplyState == null ">
AND tbs_cost_apply.charge_state in (1,2,3) </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.queryStartFinishTime != null ">
and tbs_cost_apply.pass_time &gt;= #{query.queryStartFinishTime} </if>
<if test="query.queryEndFinishTime != null ">
and tbs_cost_apply.pass_time &lt;= #{query.queryEndFinishTime} </if>
<if test="query.queryStartActivityEndTime != null ">
and c.act_end_date &gt;= #{query.queryStartActivityEndTime} </if>
<if test="query.queryEndActivityEndTime != null ">
and c.act_end_date &lt;= #{query.queryEndActivityEndTime} </if>
<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.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>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_cost_apply`.`user_code` like concat('%',#{query.userCode},'%') </if>
<if test="query.userName != null and query.userName != ''"> and `tbs_cost_apply`.`user_name` like concat('%',#{query.userName},'%') </if>
</select>
<select id="getActiveIdsForDataAmount" resultType="java.lang.Long">
SELECT
c.id
FROM
tbs_activity c
LEFT JOIN tbs_cost_apply ON c.cost_apply_id = tbs_cost_apply.id
WHERE
c.del_flag = 0
and c.cancel_flag = 0
AND tbs_cost_apply.del_flag = 0
and tbs_cost_apply.cancel_flag = 0
<if test="query.costApplyState != null ">
AND tbs_cost_apply.charge_state = #{query.costApplyState} </if>
<if test="query.costApplyState == null ">
AND tbs_cost_apply.charge_state in (1,2,3) </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.queryStartFinishTime != null ">
and tbs_cost_apply.pass_time &gt;= #{query.queryStartFinishTime} </if>
<if test="query.queryEndFinishTime != null ">
and tbs_cost_apply.pass_time &lt;= #{query.queryEndFinishTime} </if>
<if test="query.queryStartActivityEndTime != null ">
and c.act_end_date &gt;= #{query.queryStartActivityEndTime} </if>
<if test="query.queryEndActivityEndTime != null ">
and c.act_end_date &lt;= #{query.queryEndActivityEndTime} </if>
<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.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>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_cost_apply`.`user_code` like concat('%',#{query.userCode},'%') </if>
<if test="query.userName != null and query.userName != ''"> and `tbs_cost_apply`.`user_name` like concat('%',#{query.userName},'%') </if>
<if test="query.openPage!=null and query.openPage==1">
limit #{query.startRow},#{query.pageSize}
</if>
</select>
</mapper>

Loading…
Cancel
Save