Commit 65237395 by huluobin

# 费用系统 删除过期方法

parent 919cceaf
package com.blt.other.module.cost.dao;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -11,21 +10,21 @@ import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CostExportVo;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
public interface CostDao extends BaseMapper<CostDomain> {
//获取费用单列表
List<CostDomain> selectAll(@Param("userId") Integer userId, @Param("projectTypeList") List<String> projectTypeList);
List<CostDomain> selectAll(@Param("userId") Integer userId,
@Param("projectTypeList") List<String> projectTypeList);
//根据 costNo 获取费用单详情
CostDomain selectByCostNo(String costNo);
List<CostDomain> selectByKeys(CostDomain costDomain);
//根据 费用计划获取费用单详情
List<CostDomain> selectByCostPlanNo(String costPlanNo);
//查询最近一次费用单
......@@ -33,28 +32,6 @@ public interface CostDao extends BaseMapper<CostDomain> {
List<CostDomain> selectLinkLendCost(@Param("createuserid") Integer createuserid);
//查询管理成本费用列表,付款单+借还单
List<ManageCostDto> selectManageCost(@Param("startDate") LocalDateTime startDate,
@Param("endDate") LocalDateTime endDate,
@Param("feeSuperType") String feeSuperType,
@Param("feeSubType") String feeSubType,
@Param("companyValueList") List<Integer> companyValueList,
@Param("companyName") String companyName,
@Param("departmentName") String departmentName,
@Param("createUserId") Integer createUserId,
@Param("payUserId") Integer payUserId);
//查询所有的物流费用单和采购单
List<ManageCostDto> getLogisticsCostList(@Param("startDate") LocalDateTime startDate,
@Param("endDate") LocalDateTime endDate,
@Param("feeSuperType") String feeSuperType,
@Param("feeSubType") String feeSubType,
@Param("companyValueList") List<Integer> companyValueList,
@Param("companyName") String companyName,
@Param("departmentName") String departmentName,
@Param("createUserId") Integer createUserId,
@Param("payUserId") Integer payUserId);
//
List<String> listCostNoAll(CostExportVo costExportVo);
......@@ -91,5 +68,6 @@ public interface CostDao extends BaseMapper<CostDomain> {
Page<CostDomain> appCostList(@Param("page") IPage<CostDomain> costDomainIPage,
@Param("req") AppCostListReq req);
//根据费用单状态获取费用单
List<CostDomain> selectByStatus(Integer costStatus);
}
......@@ -87,288 +87,6 @@
ORDER BY id DESC
</select>
<select id="getLogisticsCostList" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name
feeSubType,d.amount amount,c.dic currency,
d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId
FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND
c.cost_status = 4
AND d.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form
manageCostType,u.departmentname1 departmentName,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.kind_name = '物流费'
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name
feeSubType,c.amount amount,c.dic currency,
c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId
FROM user u, cost c, type_relation t
WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND
c.cost_status = 4
AND c.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as
manageCostType,b.departmentname departmentName,
b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType,
b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, 0 as costId
FROM buy b
WHERE b.sku_type_name = '物流费'
and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3
<if test="startDate != null">AND b.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select>
<!--管理成本:查询付款单+收款单+借还单+采购单-->
<select id="selectManageCost" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT
c.cost_no no,
c.bank_company receiveUnit,
d.cost_reason reason,
c.pay_time payTime,
c.cost_form manageCostType,
u.departmentname1 departmentName,
c.company_value companyValue,
c.company_name companyName,
t.manage_cost_type feeSuperType,
d.kind_name feeSubType,
d.amount amount,
c.dic currency,
d.amount * c.to_rmb_rate amountRmb,
d.id as costId1,
c.id as costId
FROM cost c
left join user u on c.create_userid = u.userid
left join cost_detail d on c.cost_no = d.cost_no
left join type_relation t on t.fee_type = c.type_name
WHERE c.cost_form = 1
AND c.cost_status = 4
AND c.logistics_supplier_id is null
AND c.company_value =2
AND d.kind_name not in ('百伦咨询服务费','物流费')
<if test="feeSuperType != null and feeSuperType != ''">
AND t.manage_cost_type = #{feeSuperType}
</if>
<if test="feeSubType != null and feeSubType != ''">
AND d.kind_name = #{feeSubType}
</if>
<if test="departmentName != null and departmentName != ''">
AND u.departmentname1 = #{departmentName}
</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">
AND c.company_name = #{companyName}
</if>
<if test="createUserId != null and createUserId != ''">
AND c.create_userid = #{createUserId}
</if>
<if test="payUserId != null and payUserId != ''">
AND c.pay_user_id = #{payUserId}
</if>
<if test="startDate != null">
AND c.pay_time <![CDATA[>=]]> #{startDate}
</if>
<if test="endDate != null">
AND c.pay_time <![CDATA[<]]>#{endDate}
</if>
UNION
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name
feeSubType,d.amount amount,c.dic currency,
d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId
FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND
c.cost_status = 4
AND c.logistics_supplier_id is null AND c.company_value in
(1,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND d.kind_name not in ('百伦咨询服务费')
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND d.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND c.create_userid = #{createUserId}</if>
<if test="payUserId != null and payUserId != ''">AND c.pay_user_id = #{payUserId}</if>
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form
manageCostType,u.departmentname1 departmentName,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.company_value =2 AND c1.kind_name not in ('百伦咨询服务费','物流费')
AND exists (SELECT 1 FROM cost c2 WHERE c1.company_value = c2.company_value AND c1.type_name = c2.type_name
AND c2.create_userid = u.userid AND t.fee_type = c2.type_name AND c2.cost_form = 1 AND c2.cost_status = 4
AND c2.logistics_supplier_id is null)
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND c1.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND c1.create_userid = #{createUserId}</if>
<if test="payUserId != null and payUserId != ''">AND c1.pay_user_id = #{payUserId}</if>
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form
manageCostType,u.departmentname1 departmentName,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.company_value in (1,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND c1.kind_name not in
('百伦咨询服务费')
AND exists (SELECT 1 FROM cost c2 WHERE c1.company_value = c2.company_value AND c1.type_name = c2.type_name
AND c2.create_userid = u.userid AND t.fee_type = c2.type_name AND c2.cost_form = 1 AND c2.cost_status = 4
AND c2.logistics_supplier_id is null)
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND c1.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND c1.create_userid = #{createUserId}</if>
<if test="payUserId != null and payUserId != ''">AND c1.pay_user_id = #{payUserId}</if>
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name
feeSubType,c.amount amount,c.dic currency,
c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId
FROM user u, cost c, type_relation t
WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND
c.cost_status = 4
AND c.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND c.kind_name not in
('百伦咨询服务费')
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND c.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND c.create_userid = #{createUserId}</if>
<if test="payUserId != null and payUserId != ''">AND c.pay_user_id = #{payUserId}</if>
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as
manageCostType,b.departmentname departmentName,
b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType,
b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, b.id as costId
FROM buy b
WHERE b.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND b.sku_type_name in
('固定资产','低值易耗品')
and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3
<if test="feeSuperType != null and feeSuperType != ''">AND b.sku_type_name = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND b.sku_type_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND b.departmentname = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND b.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if>
</foreach>
</if>
<if test="companyName != null and companyName != ''">AND b.company = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND b.createuserid = #{createUserId}</if>
<if test="startDate != null">AND b.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select>
<!--
资产负债表相关费用单
1、已完成状态的所有费用类型借支单
2、已完成状态的所有费用类型借还单
3、已完成状态的所有费用类型付款单
4、待出纳付款状态的所有费用类型付款单
5、已完成状态的费用类型为"借款-其他应付款"、"收款-其他应付款"的还款单
-->
<select id="selectBalanceSheetCost" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT *
FROM cost
WHERE cost_form = 3
AND is_lend = 1
AND cost_status = 4
AND last_modify_date <![CDATA[>=]]> #{startDate}
AND last_modify_date <![CDATA[<]]> #{endDate}
UNION
SELECT *
FROM cost
WHERE cost_form = 3
AND is_lend = 2
AND cost_status = 4
AND last_modify_date <![CDATA[>=]]> #{startDate}
AND last_modify_date <![CDATA[<]]> #{endDate}
UNION
SELECT *
FROM cost
WHERE cost_form = 1
AND cost_status = 4
AND last_modify_date <![CDATA[>=]]> #{startDate}
AND last_modify_date <![CDATA[<]]> #{endDate}
AND kind_name IN ('还款--其他应付款', '借出--其他应付款')
UNION
SELECT *
FROM cost
WHERE cost_form = 1
AND cost_status = 2
AND audit_time <![CDATA[>=]]> #{startDate}
AND last_modify_date <![CDATA[<]]> #{endDate}
UNION
SELECT *
FROM cost
WHERE cost_form = 2
AND cost_status = 4
AND last_modify_date <![CDATA[>=]]> #{startDate}
AND last_modify_date <![CDATA[<]]> #{endDate}
AND kind_name IN ('借款--其他应付款', '收款--其他应付款')
</select>
<select id="listCostNoAll" resultType="java.lang.String">
select cost_no from cost
WHERE
......@@ -471,7 +189,6 @@
</if>
</sql>
<!--待部门审核-->
<select id="departmentCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment