demand: 已使用额度细分两个字段,一个是超期额度,一个账期内额度。双击需要显示具体明细。
committer: heyu
This commit is contained in:
parent
519cfbaf96
commit
92438e9d16
@ -537,6 +537,14 @@ public class EmisWaybillController extends EmisBaseController
|
||||
list = emisWaybillService.selectEmisWaybillList(emisWaybill);
|
||||
}
|
||||
|
||||
if("1".equals(emisWaybill.getQueryQuotaType())){
|
||||
// 查询超期的运单列表
|
||||
list = emisBaseService.filterOverTermEmisWaybillList(list);
|
||||
}
|
||||
if("2".equals(emisWaybill.getQueryQuotaType())){
|
||||
// 查询未超期的账单列表
|
||||
list = emisBaseService.filterInTermEmisWaybillList(list);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@ public class EmisCreditSalesmen extends BaseEntity
|
||||
private BigDecimal creditMoney;
|
||||
/* 使用额度 */
|
||||
private BigDecimal useMoney;
|
||||
/* 超期额度 */
|
||||
private BigDecimal overTermMoney;
|
||||
/* 账期内额度 */
|
||||
private BigDecimal inTermMoney;
|
||||
/* 币种 */
|
||||
private String currency;
|
||||
/* 运输方式 */
|
||||
|
||||
@ -675,6 +675,9 @@ public class EmisWaybill extends BaseEntity
|
||||
private String customerNickName;
|
||||
@TableField(exist = false)
|
||||
private String customerAvatar;
|
||||
// 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度
|
||||
@TableField(exist = false)
|
||||
private String queryQuotaType;
|
||||
|
||||
// transType - 运输类型
|
||||
@TableField(exist = false)
|
||||
|
||||
@ -156,4 +156,5 @@ public interface EmisSettleSubBillMapper extends BaseMapper<EmisSettleSubBill>
|
||||
|
||||
public int deleteEmisSettleSubBillByBillCode(String billCode);
|
||||
|
||||
List<EmisSettleSubBill> querysSettleSubBillByBillCodeList(@Param("billCodeList") List<String> billCodeList);
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 运单列表Service业务层处理
|
||||
@ -1503,7 +1504,18 @@ public class EmisBaseService {
|
||||
try {
|
||||
Map useMoneyMap=emisCreditSalesmenMapper.getUseMoneyMap(item);
|
||||
BigDecimal useMoney = (BigDecimal)useMoneyMap.get("useMoney");
|
||||
emisCreditSalesmenMapper.updateUseMoney(item.getId(),useMoney);
|
||||
List<EmisWaybill> emisWaybillList = getEmisWaybills(item);
|
||||
// 账期内金额
|
||||
BigDecimal inTermMoney = getInTermMoney(emisWaybillList);
|
||||
// 超期金额
|
||||
BigDecimal overTermMoney = BigDecimal.valueOf(useMoney.subtract(inTermMoney).stripTrailingZeros().longValue());
|
||||
EmisCreditSalesmen emisCreditSalesmen = new EmisCreditSalesmen();
|
||||
emisCreditSalesmen.setId(item.getId());
|
||||
emisCreditSalesmen.setUseMoney(useMoney);
|
||||
emisCreditSalesmen.setOverTermMoney(overTermMoney);
|
||||
emisCreditSalesmen.setInTermMoney(inTermMoney);
|
||||
emisCreditSalesmenMapper.updateEmisCreditSalesmen(emisCreditSalesmen);
|
||||
log.info("success.autoDoCredit , emisCreditSalesmen,{}", JSON.toJSONString(emisCreditSalesmen));
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -1526,6 +1538,74 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal getInTermMoney(List<EmisWaybill> emisWaybillList) {
|
||||
List<EmisWaybill> inTermList = filterInTermEmisWaybillList(emisWaybillList);
|
||||
List<String> billCodeList = inTermList.stream().map(EmisWaybill::getBillCode).collect(Collectors.toList());
|
||||
log.info("cd getInTermMoney , billCodeList,{}", billCodeList);
|
||||
if (CollectionUtil.isEmpty(billCodeList)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
List<EmisSettleSubBill> emisSettleSubBillList = emisSettleSubBillMapper.querysSettleSubBillByBillCodeList(billCodeList);
|
||||
if (CollectionUtil.isEmpty(emisSettleSubBillList)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
log.info("query emisSettleSubBillList , emisSettleSubBillList,{}", emisSettleSubBillList);
|
||||
BigDecimal inTermMoney = BigDecimal.valueOf(emisSettleSubBillList.stream()
|
||||
.map(EmisSettleSubBill::getBillFee)
|
||||
.filter(i -> i != null)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.stripTrailingZeros().longValue());
|
||||
log.info("success.getInTermMoney , inTermMoney,{}", inTermMoney);
|
||||
return inTermMoney;
|
||||
}
|
||||
|
||||
public List<EmisWaybill> filterOverTermEmisWaybillList(List<EmisWaybill> list) {
|
||||
log.info("cd filterOverTermEmisWaybillList , emisWaybillList,{}", list);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<EmisWaybill> overTermList = list.stream()
|
||||
.filter(item -> item.getOrderDate() != null)
|
||||
.filter(item -> (System.currentTimeMillis() - item.getOrderDate().getTime()) > (10 * 1000 * 60 * 60 * 24))
|
||||
.collect(Collectors.toList());
|
||||
log.info("success.filterOverTermEmisWaybillList , overTermList,{}", overTermList);
|
||||
return overTermList;
|
||||
}
|
||||
|
||||
public List<EmisWaybill> filterInTermEmisWaybillList(List<EmisWaybill> list) {
|
||||
log.info("cd filterInTermEmisWaybillList , emisWaybillList,{}", list);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<EmisWaybill> overTermList = filterOverTermEmisWaybillList(list);
|
||||
if (CollectionUtil.isEmpty(overTermList)) {
|
||||
return list;
|
||||
}
|
||||
List<EmisWaybill> inTermList = list.stream()
|
||||
.filter(item -> !overTermList.contains(item))
|
||||
.collect(Collectors.toList());
|
||||
log.info("success.filterInTermEmisWaybillList , inTermList,{}", inTermList);
|
||||
return inTermList;
|
||||
}
|
||||
|
||||
private List<EmisWaybill> getEmisWaybills(EmisCreditSalesmen item) {
|
||||
EmisWaybill emisWaybill = new EmisWaybill();
|
||||
emisWaybill.setPaymentType("1,3");
|
||||
emisWaybill.setPayee(item.getSalesmen());
|
||||
emisWaybill.setPaymentStatus("0,2");
|
||||
emisWaybill.getParams().put("problemQueryType", "2");
|
||||
emisWaybill.getParams().put("problemQueryIds", "173,170,151");
|
||||
emisWaybill.getParams().put("queryTabType", "1");
|
||||
emisWaybill.getParams().put("querySendType", "1");
|
||||
emisWaybill.getParams().put("beginSendDate",
|
||||
DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", item.getStartDate()));
|
||||
emisWaybill.getParams().put("endSendDate",
|
||||
DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", item.getEndDate()));
|
||||
emisWaybill.setCarryType(item.getTransType());
|
||||
List<EmisWaybill> emisWaybillList = emisWaybillMapper.selectEmisWaybillList(emisWaybill);
|
||||
return emisWaybillList;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void redoGenerateBill(String billCode) throws EmisBizError{
|
||||
|
||||
@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="salesmen" column="salesmen" />
|
||||
<result property="creditMoney" column="credit_money" />
|
||||
<result property="useMoney" column="use_money" />
|
||||
<result property="overTermMoney" column="over_term_money" />
|
||||
<result property="inTermMoney" column="in_term_money" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="transType" column="trans_type" />
|
||||
<result property="startDate" column="start_date" />
|
||||
@ -22,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisCreditSalesmenList" parameterType="EmisCreditSalesmen" resultMap="EmisCreditSalesmenResult">
|
||||
select id, acc_code, salesmen, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, acc_code, salesmen, credit_money, use_money, over_term_money, in_term_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_credit_salesmen a
|
||||
<where>
|
||||
del_flag='0'
|
||||
@ -82,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectEmisCreditSalesmenById" parameterType="Long" resultMap="EmisCreditSalesmenResult">
|
||||
select id, acc_code, salesmen, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, acc_code, salesmen, credit_money, use_money, over_term_money, in_term_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_credit_salesmen a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -120,6 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="salesmen != null and salesmen != ''">salesmen,</if>
|
||||
<if test="creditMoney != null">credit_money,</if>
|
||||
<if test="useMoney != null">use_money,</if>
|
||||
<if test="overTermMoney != null">over_term_money,</if>
|
||||
<if test="inTermMoney != null">in_term_Money,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="transType != null and transType != ''">trans_type,</if>
|
||||
<if test="startDate != null">start_date,</if>
|
||||
@ -140,6 +144,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="salesmen != null and salesmen != ''">#{salesmen},</if>
|
||||
<if test="creditMoney != null">#{creditMoney},</if>
|
||||
<if test="useMoney != null">#{useMoney},</if>
|
||||
<if test="overTermMoney != null">#{overTermMoney},</if>
|
||||
<if test="inTermMoney != null">#{inTermMoney},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="transType != null and transType != ''">#{transType},</if>
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
@ -162,6 +168,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="creditMoney != null">credit_money = #{creditMoney},</if>
|
||||
<if test="useMoney != null">use_money = #{useMoney},</if>
|
||||
<if test="overTermMoney != null">over_term_money = #{overTermMoney},</if>
|
||||
<if test="inTermMoney != null">in_term_Money = #{inTermMoney},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
|
||||
@ -627,8 +627,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where a.del_flag='0' and a.bill_code = #{billCode}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="querysSettleSubBillByBillCodeList" parameterType="String" resultMap="EmisSettleSubBillResult">
|
||||
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_sub_bill a
|
||||
where a.del_flag='0' and a.bill_code in
|
||||
<foreach item="billCode" collection="billCodeList" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectSubBillListBySettleBillNo" parameterType="String" resultMap="EmisSettleSubBillResult">
|
||||
select id, bill_no, parent_bill_no, settle_bill_no, bill_code, bill_date, bill_fee, currency, settle_type, bl_split, bl_merge, bill_month, cust_no, cust_name, customer_code, customer_name, invoiced_money, reced_money, satisfy_money, allowance_money, deduction_money, other_money, satisfy_reason, allowance_reason, deduction_reason, other_reason, open_bill_status, payment_status, charge_status, payee, salesmen, bl_special_quote, bl_sensitive, bl_confirm_center, confirm_center_date, confirm_center_note, confirm_center_man_code, confirm_center_code, bl_confirm_site, confirm_site_date, confirm_site_man_code, confirm_site_note, confirm_site_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
|
||||
Loading…
Reference in New Issue
Block a user