|
@@ -147,6 +147,31 @@
|
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case
|
|
|
|
|
+ when kll.status = 2 then
|
|
|
|
|
+ true
|
|
|
|
|
+ when kll.status in (3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ (
|
|
|
|
|
+ kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>)
|
|
|
|
|
+ or
|
|
|
|
|
+ (
|
|
|
|
|
+ select kllt.id
|
|
|
|
|
+ from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
|
|
|
|
|
+ and kllt.l_ledger_id = kll.id
|
|
|
|
|
+ and kllt.status in (3, 5)
|
|
|
|
|
+ and kllt.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
</where>
|
|
</where>
|
|
|
order by kll.generate_time desc
|
|
order by kll.generate_time desc
|
|
|
</select>
|
|
</select>
|
|
@@ -359,10 +384,145 @@
|
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case when kll.status in (1, 6)
|
|
|
|
|
+ then
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ when kll.status in (2, 3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ or kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
</where>
|
|
</where>
|
|
|
order by kll.generate_time desc
|
|
order by kll.generate_time desc
|
|
|
</select>
|
|
</select>
|
|
|
-
|
|
|
|
|
|
|
+ <!--对账发起方-->
|
|
|
|
|
+ <select id="countSendOrder" resultType="java.util.Map">
|
|
|
|
|
+ SELECT count(1) "0",
|
|
|
|
|
+ count(IF(kll.status = 1, 1, NULL)) "1",
|
|
|
|
|
+ count(IF(kll.status = 2, 1, NULL)) "2",
|
|
|
|
|
+ count(IF(kll.status = 3, 1, NULL)) "3",
|
|
|
|
|
+ count(IF(kll.status = 4, 1, NULL)) "4",
|
|
|
|
|
+ count(IF(kll.status = 5, 1, NULL)) "5",
|
|
|
|
|
+ count(IF(kll.status = 6, 1, NULL)) "6"
|
|
|
|
|
+ FROM kwp_ledger_logistics kll
|
|
|
|
|
+ inner join kwp_ledger_logistics_unit kllu
|
|
|
|
|
+ on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
|
|
|
+ kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
|
|
|
|
|
+ inner join kwp_ledger_logistics_unit kllu2
|
|
|
|
|
+ on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
|
|
|
|
|
+ kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
|
|
|
|
|
+ <where>
|
|
|
|
|
+ kll.del_flag = 0
|
|
|
|
|
+ and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
|
|
|
|
|
+ <if test="logisticsReq.trading != null">
|
|
|
|
|
+ and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
|
|
|
|
|
+ and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
|
|
|
|
|
+ and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
|
|
|
|
|
+ and (
|
|
|
|
|
+ kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case when kll.status in (1, 6)
|
|
|
|
|
+ then
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ when kll.status in (2, 3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ or kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!--对账审核方-->
|
|
|
|
|
+ <select id="countAuditOrder" resultType="java.util.Map">
|
|
|
|
|
+ SELECT count(1) "0",
|
|
|
|
|
+ count(IF(kll.status = 1, 1, NULL)) "1",
|
|
|
|
|
+ count(IF(kll.status = 2, 1, NULL)) "2",
|
|
|
|
|
+ count(IF(kll.status = 3, 1, NULL)) "3",
|
|
|
|
|
+ count(IF(kll.status = 4, 1, NULL)) "4",
|
|
|
|
|
+ count(IF(kll.status = 5, 1, NULL)) "5",
|
|
|
|
|
+ count(IF(kll.status = 6, 1, NULL)) "6"
|
|
|
|
|
+ FROM kwp_ledger_logistics kll
|
|
|
|
|
+ inner join kwp_ledger_logistics_unit kllu
|
|
|
|
|
+ on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
|
|
|
+ kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
|
|
|
|
|
+ inner join kwp_ledger_logistics_unit kllu2
|
|
|
|
|
+ on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
|
|
|
|
|
+ kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
|
|
|
|
|
+ <where>
|
|
|
|
|
+ kll.del_flag = 0
|
|
|
|
|
+ and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
|
|
|
|
|
+ and kll.status not in (1, 6)
|
|
|
|
|
+ <if test="logisticsReq.trading != null">
|
|
|
|
|
+ and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
|
|
|
|
|
+ and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
|
|
|
|
|
+ and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
|
|
|
|
|
+ and (
|
|
|
|
|
+ kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case
|
|
|
|
|
+ when kll.status = 2 then
|
|
|
|
|
+ true
|
|
|
|
|
+ when kll.status in (3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ (
|
|
|
|
|
+ kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>)
|
|
|
|
|
+ or
|
|
|
|
|
+ (
|
|
|
|
|
+ select kllt.id
|
|
|
|
|
+ from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
|
|
|
|
|
+ and kllt.l_ledger_id = kll.id
|
|
|
|
|
+ and kllt.status in (3, 5)
|
|
|
|
|
+ and kllt.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
<select id="countOrder" resultType="java.util.Map">
|
|
<select id="countOrder" resultType="java.util.Map">
|
|
|
SELECT count(1) "0",
|
|
SELECT count(1) "0",
|
|
|
count(IF(kll.status = 1, 1, NULL)) "1",
|
|
count(IF(kll.status = 1, 1, NULL)) "1",
|
|
@@ -507,31 +667,31 @@
|
|
|
|
|
|
|
|
<select id="exportList" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
|
|
<select id="exportList" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
|
|
|
select kll.id,
|
|
select kll.id,
|
|
|
- kll.l_ledger_no lLedgerNo,
|
|
|
|
|
|
|
+ kll.l_ledger_no lLedgerNo,
|
|
|
kll.name,
|
|
kll.name,
|
|
|
- kll.start_time startTime,
|
|
|
|
|
- kll.end_time endTime,
|
|
|
|
|
- kll.tax_rate taxRate,
|
|
|
|
|
|
|
+ kll.start_time startTime,
|
|
|
|
|
+ kll.end_time endTime,
|
|
|
|
|
+ kll.tax_rate taxRate,
|
|
|
kll.trading,
|
|
kll.trading,
|
|
|
- kll.total_price totalPrice,
|
|
|
|
|
- kll.ex_tax_price exTaxPrice,
|
|
|
|
|
- kll.settle_price settlePrice,
|
|
|
|
|
- kll.actual_price actualPrice,
|
|
|
|
|
|
|
+ kll.total_price totalPrice,
|
|
|
|
|
+ kll.ex_tax_price exTaxPrice,
|
|
|
|
|
+ kll.settle_price settlePrice,
|
|
|
|
|
+ kll.actual_price actualPrice,
|
|
|
kll.url,
|
|
kll.url,
|
|
|
- kll.generate_time generateTime,
|
|
|
|
|
- kll.receipt_time receiptTime,
|
|
|
|
|
|
|
+ kll.generate_time generateTime,
|
|
|
|
|
+ kll.receipt_time receiptTime,
|
|
|
kll.remark,
|
|
kll.remark,
|
|
|
kll.status,
|
|
kll.status,
|
|
|
- kll.create_by createBy,
|
|
|
|
|
- kllu.top_ent_id checkEntId,
|
|
|
|
|
|
|
+ kll.create_by createBy,
|
|
|
|
|
+ kllu.top_ent_id checkEntId,
|
|
|
(case
|
|
(case
|
|
|
when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_user
|
|
when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_user
|
|
|
- else kll.success_user end) as contacts,
|
|
|
|
|
|
|
+ else kll.success_user end) as contacts,
|
|
|
(case
|
|
(case
|
|
|
when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_phone
|
|
when #{logisticsReq.unitType,jdbcType=INTEGER} = 1 then kll.audit_phone
|
|
|
else kll.success_phone end) as phone,
|
|
else kll.success_phone end) as phone,
|
|
|
- kllu.firm_name firmName,
|
|
|
|
|
- kll.order_count orderCount
|
|
|
|
|
|
|
+ kllu.firm_name firmName,
|
|
|
|
|
+ kll.order_count orderCount
|
|
|
from kwp_ledger_logistics kll
|
|
from kwp_ledger_logistics kll
|
|
|
inner join kwp_ledger_logistics_unit kllu
|
|
inner join kwp_ledger_logistics_unit kllu
|
|
|
on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
@@ -567,6 +727,55 @@
|
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="logisticsReq.unitType == 1">
|
|
|
|
|
+ and (
|
|
|
|
|
+ case when kll.status in (1, 6)
|
|
|
|
|
+ then
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ when kll.status in (2, 3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ or kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsReq.unitType == 2">
|
|
|
|
|
+ and (
|
|
|
|
|
+ case
|
|
|
|
|
+ when kll.status = 2 then
|
|
|
|
|
+ true
|
|
|
|
|
+ when kll.status in (3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ (
|
|
|
|
|
+ kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>)
|
|
|
|
|
+ or
|
|
|
|
|
+ (
|
|
|
|
|
+ select kllt.id
|
|
|
|
|
+ from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
|
|
|
|
|
+ and kllt.l_ledger_id = kll.id
|
|
|
|
|
+ and kllt.status in (3, 5)
|
|
|
|
|
+ and kllt.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
</where>
|
|
</where>
|