Merge pull request 'develop' (#317) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/317
This commit is contained in:
commit
5e129d8e51
@ -124,6 +124,23 @@ public class EmisWriteoffApplyController extends EmisBaseController {
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
apply.setApplyRecMoney(totalAmount);
|
||||
|
||||
// 提取发票号列表(去重)
|
||||
List<String> invoiceNos = apply.getDetailList().stream()
|
||||
.filter(detail -> detail != null && detail.getInvoiceNo() != null)
|
||||
.flatMap(detail -> {
|
||||
// 如果invoiceNo包含逗号,先拆分
|
||||
String invoiceNo = detail.getInvoiceNo().trim();
|
||||
if (invoiceNo.isEmpty()) {
|
||||
return java.util.stream.Stream.empty();
|
||||
}
|
||||
return Arrays.stream(invoiceNo.split(","))
|
||||
.map(String::trim)
|
||||
.filter(no -> !no.isEmpty());
|
||||
})
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
apply.setInvoiceNo(invoiceNos.isEmpty() ? "" : String.join(",", invoiceNos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,9 @@ public class EmisWriteoffApply extends BaseEntity {
|
||||
/* 收款来源 1-微信支付2支付宝 3-对公 */
|
||||
private String payType;
|
||||
|
||||
/* 发票号 */
|
||||
private String invoiceNo;
|
||||
|
||||
/* 交易时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date tradeDate;
|
||||
|
||||
@ -72,4 +72,6 @@ public class EmisWriteoffApplyDetail extends BaseEntity {
|
||||
@Excel(name = "快件类型")
|
||||
private String expressType;
|
||||
|
||||
/* 发票号(只作查询) */
|
||||
private String invoiceNo;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="applyMoney" column="apply_money" />
|
||||
<result property="settleBillNo" column="settle_bill_no" />
|
||||
<result property="expressType" column="express_type" />
|
||||
<result property="invoiceNo" column="invoice_no" />
|
||||
<!-- 关联运单信息 -->
|
||||
<association property="emisWaybill" javaType="EmisWaybill">
|
||||
<result property="id" column="w_id"/>
|
||||
@ -242,7 +243,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ssb.bl_sensitive as ssb_bl_sensitive, ssb.bl_confirm_center as ssb_bl_confirm_center, ssb.confirm_center_date as ssb_confirm_center_date,
|
||||
ssb.confirm_center_note as ssb_confirm_center_note, ssb.confirm_center_man_code as ssb_confirm_center_man_code,
|
||||
ssb.confirm_center_code as ssb_confirm_center_code, ssb.bl_confirm_site as ssb_bl_confirm_site, ssb.confirm_site_date as ssb_confirm_site_date,
|
||||
ssb.confirm_site_man_code as ssb_confirm_site_man_code, ssb.confirm_site_note as ssb_confirm_site_note, ssb.confirm_site_code as ssb_confirm_site_code
|
||||
ssb.confirm_site_man_code as ssb_confirm_site_man_code, ssb.confirm_site_note as ssb_confirm_site_note, ssb.confirm_site_code as ssb_confirm_site_code,
|
||||
GROUP_CONCAT(DISTINCT ch.invoice_no ORDER BY ch.invoice_no SEPARATOR ',') as invoice_no
|
||||
from emis_writeoff_apply_detail wad
|
||||
left join emis_waybill w on wad.bill_code = w.bill_code and w.del_flag = '0'
|
||||
left join emis_trans_product tp on w.product_type = tp.prod_code and tp.del_flag = '0'
|
||||
@ -250,6 +252,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join emis_settle_sub_bill ssb on wad.bill_code = ssb.bill_code and ssb.del_flag = '0'
|
||||
left join emis_site send_site on w.send_site_code = send_site.site_code and send_site.del_flag = '0'
|
||||
left join emis_site dest_site on w.dispatch_underling_site_code = dest_site.site_code and dest_site.del_flag = '0'
|
||||
left join emis_settle_invoice_bill_rel sibr on ssb.settle_bill_no = sibr.settle_bill_no and sibr.del_flag = '0'
|
||||
left join emis_settle_invoice_record sir on sibr.apply_seq_no = sir.apply_seq_no and sir.del_flag = '0'
|
||||
left join (
|
||||
select ch1.*
|
||||
from emis_settle_invoice_ch_record ch1
|
||||
inner join (
|
||||
select apply_seq_no, max(id) as max_id
|
||||
from emis_settle_invoice_ch_record
|
||||
where del_flag = '0'
|
||||
group by apply_seq_no
|
||||
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
|
||||
where ch1.del_flag = '0'
|
||||
) ch on sir.apply_seq_no = ch.apply_seq_no
|
||||
</sql>
|
||||
|
||||
<!-- 根据运单号汇总历史申请金额(仅统计财务中心未通过的数据:bl_center_confirmed != 1) -->
|
||||
@ -275,17 +290,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="settleBillNo != null and settleBillNo != ''"> and wad.settle_bill_no = #{settleBillNo}</if>
|
||||
<if test="applyMoney != null "> and wad.apply_money = #{applyMoney}</if>
|
||||
</where>
|
||||
group by wad.id, wad.apply_id, wad.apply_no, wad.bill_code
|
||||
order by wad.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWriteoffApplyDetailById" parameterType="Long" resultMap="EmisWriteoffApplyDetailResult">
|
||||
<include refid="selectEmisWriteoffApplyDetailVo"/>
|
||||
where wad.id = #{id} and wad.del_flag = '0'
|
||||
group by wad.id, wad.apply_id, wad.apply_no, wad.bill_code
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWriteoffApplyDetailListByApplyId" parameterType="Long" resultMap="EmisWriteoffApplyDetailResult">
|
||||
<include refid="selectEmisWriteoffApplyDetailVo"/>
|
||||
where wad.apply_id = #{applyId} and wad.del_flag = '0'
|
||||
group by wad.id, wad.apply_id, wad.apply_no, wad.bill_code
|
||||
order by wad.create_time desc
|
||||
</select>
|
||||
|
||||
@ -348,6 +366,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectEmisWriteoffApplyDetailListByApplyIdWithDetails" parameterType="Long" resultMap="EmisWriteoffApplyDetailResult">
|
||||
<include refid="selectEmisWriteoffApplyDetailVo"/>
|
||||
where wad.apply_id = #{applyId} and wad.del_flag = '0'
|
||||
group by wad.id, wad.apply_id, wad.apply_no, wad.bill_code
|
||||
order by wad.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
@ -59,7 +59,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from emis_writeoff_apply wa
|
||||
<if test="(params != null and params.queryParams != null and params.queryParams != '') or (settleBillName != null and settleBillName != '')">
|
||||
left join emis_writeoff_apply_detail wad on wa.id = wad.apply_id and wad.del_flag = '0'
|
||||
</if>
|
||||
left join emis_settle_sub_bill ssb on wad.bill_code = ssb.bill_code and ssb.del_flag = '0'
|
||||
left join emis_settle_invoice_bill_rel sibr on ssb.settle_bill_no = sibr.settle_bill_no and sibr.del_flag = '0'
|
||||
left join emis_settle_invoice_record sir on sibr.apply_seq_no = sir.apply_seq_no and sir.del_flag = '0'
|
||||
left join (
|
||||
select ch1.*
|
||||
from emis_settle_invoice_ch_record ch1
|
||||
inner join (
|
||||
select apply_seq_no, max(id) as max_id
|
||||
from emis_settle_invoice_ch_record
|
||||
where del_flag = '0'
|
||||
group by apply_seq_no
|
||||
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
|
||||
where ch1.del_flag = '0'
|
||||
) ch on sir.apply_seq_no = ch.apply_seq_no </if>
|
||||
<if test="settleBillName != null and settleBillName != ''">
|
||||
left join emis_settle_bill sb on wad.settle_bill_no = sb.settle_bill_no and sb.del_flag = '0'
|
||||
</if>
|
||||
@ -92,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="revokeManName != null and revokeManName != ''"> and wa.revoke_man_name like concat('%', #{revokeManName}, '%')</if>
|
||||
<if test="revokeReason != null and revokeReason != ''"> and wa.revoke_reason like concat('%', #{revokeReason}, '%')</if>
|
||||
<if test="settleBillName != null and settleBillName != ''"> and sb.settle_bill_name like concat('%', #{settleBillName}, '%')</if>
|
||||
<if test="payType != null and payType != ''"> and wa.pay_type = #{payType}</if>
|
||||
<if test="params != null and params.queryParams != null and params.queryParams != ''">
|
||||
and (
|
||||
wad.bill_code in
|
||||
@ -102,6 +116,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach collection="params.queryParams.split('\n')" item="param" open="(" separator="," close=")">
|
||||
#{param}
|
||||
</foreach>
|
||||
or ch.invoice_no in
|
||||
<foreach collection="params.queryParams.split('\n')" item="param" open="(" separator="," close=")">
|
||||
#{param}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
@ -381,6 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="applyMoney" column="apply_money"/>
|
||||
<result property="settleBillNo" column="settle_bill_no"/>
|
||||
<result property="expressType" column="express_type"/>
|
||||
<result property="invoiceNo" column="invoice_no"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -523,11 +542,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<!-- 根据运单号查询运单、结算账单、结算子账单信息 -->
|
||||
<select id="selectEmisWriteoffApplyDetailListByBillCodes" parameterType="java.util.List" resultMap="EmisWriteoffApplyDetailWithDetailsResult">
|
||||
select distinct
|
||||
select
|
||||
-- EmisWriteoffApplyDetail 基本信息
|
||||
w.bill_code as bill_code,
|
||||
0.00 as apply_money,
|
||||
ssb.settle_bill_no as settle_bill_no,
|
||||
GROUP_CONCAT(DISTINCT ch.invoice_no ORDER BY ch.invoice_no SEPARATOR ',') as invoice_no,
|
||||
|
||||
-- 运单信息
|
||||
w.id as w_id, w.order_sn as w_order_sn, w.cust_order_id as w_cust_order_id, w.bill_code as w_bill_code,
|
||||
@ -583,6 +603,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join emis_site send_site on w.send_site_code = send_site.site_code and send_site.del_flag = '0'
|
||||
left join emis_site dest_site on w.dispatch_underling_site_code = dest_site.site_code and dest_site.del_flag = '0'
|
||||
left join emis_trans_product tp on w.product_type = tp.prod_code and tp.del_flag = '0'
|
||||
left join emis_settle_invoice_bill_rel sibr on ssb.settle_bill_no = sibr.settle_bill_no and sibr.del_flag = '0'
|
||||
left join emis_settle_invoice_record sir on sibr.apply_seq_no = sir.apply_seq_no and sir.del_flag = '0'
|
||||
left join (
|
||||
select ch1.*
|
||||
from emis_settle_invoice_ch_record ch1
|
||||
inner join (
|
||||
select apply_seq_no, max(id) as max_id
|
||||
from emis_settle_invoice_ch_record
|
||||
where del_flag = '0'
|
||||
group by apply_seq_no
|
||||
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
|
||||
where ch1.del_flag = '0'
|
||||
) ch on sir.apply_seq_no = ch.apply_seq_no
|
||||
where
|
||||
w.del_flag = '0'
|
||||
and w.bill_code in
|
||||
@ -591,6 +624,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
and w.order_status != '0'
|
||||
and w.order_status != '2'
|
||||
group by w.id, w.bill_code, ssb.id, ssb.settle_bill_no, sb.id
|
||||
order by w.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user