Commit 2aab128730e04c61cbd5d32c8a347c060d3c1ee0

Authored by yeqianyong
1 parent c6ffecf2

楚江erp:账期-台账明细、台账报表增加特定排序

... ... @@ -494,6 +494,19 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge
494 494 vo.setEndTime(endTime);
495 495 }
496 496 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  497 + // 总欠款筛选
  498 + String debtAmountScope = vo.getDebtAmountScope();
  499 + if ("SCOPE_1".equals(debtAmountScope)) {
  500 + vo.setDebtStartValue(new BigDecimal(5000000));
  501 + } else if ("SCOPE_2".equals(debtAmountScope)) {
  502 + vo.setDebtStartValue(new BigDecimal(3000000));
  503 + vo.setDebtEndValue(new BigDecimal(5000000));
  504 + } else if ("SCOPE_3".equals(debtAmountScope)) {
  505 + vo.setDebtStartValue(new BigDecimal(1000000));
  506 + vo.setDebtEndValue(new BigDecimal(3000000));
  507 + } else if ("SCOPE_4".equals(debtAmountScope)) {
  508 + vo.setDebtEndValue(new BigDecimal(1000000));
  509 + }
497 510 // 开启分页
498 511 PageHelperUtil.startPage(pageIndex, pageSize);
499 512 List<ReceiptLedgerReportBo> dataList = getBaseMapper().report(vo);
... ...
... ... @@ -132,6 +132,24 @@
132 132 AND tb.debt_status = #{vo.debtStatus}
133 133 </if>
134 134 </where>
  135 + ORDER BY
  136 + CASE
  137 + WHEN d.name like '宁波办%' THEN 1
  138 + WHEN d.name like '温州办%' THEN 2
  139 + WHEN d.name like '东莞办%' THEN 3
  140 + WHEN d.name like '佛山办%' THEN 4
  141 + WHEN d.name like '苏州办%' THEN 5
  142 + WHEN d.name like '常州办%' THEN 6
  143 + WHEN d.name like '北方办%' THEN 7
  144 + WHEN d.name like '紫铜办%' THEN 8
  145 + WHEN d.name like '外贸办%' THEN 9
  146 + ELSE 10 -- 其他办事处按字母顺序排在后面
  147 + END,
  148 + d.name ASC,
  149 + r.name ASC,
  150 + cs.short_name ASC,
  151 + oc.name ASC,
  152 + tb.shipment_date DESC
135 153 </select>
136 154
137 155 <select id="queryByCustomerShortName" resultMap="ReceiptLedgerInfo">
... ... @@ -231,7 +249,8 @@
231 249 tb.region,
232 250 r.name as region_name,
233 251 max(cc.company_credit_limit) as quota,
234   - max(cc.company_settlement_period) as settle_term
  252 + max(cc.company_settlement_period) as settle_term,
  253 + sum(distinct rl.end_account_receivable) as end_account_total
235 254 from base_data_customer_short tb
236 255 left join sys_dept d on tb.dept_id = d.id
237 256 left join sys_dept r on tb.region = r.id
... ... @@ -254,11 +273,27 @@
254 273 group by tb.short_name,tb.type,tb.dept_id,tb.region
255 274 having 1=1
256 275 <if test="vo.debtStartValue != null">
257   - and sum(rl.end_account_receivable) >= #{debtStartValue}
  276 + and sum(distinct rl.end_account_receivable) >= #{vo.debtStartValue}
258 277 </if>
259 278 <if test="vo.debtEndValue != null">
260   - and sum(rl.end_account_receivable) &lt;= #{debtEndValue}
  279 + and sum(distinct rl.end_account_receivable) &lt;= #{vo.debtEndValue}
261 280 </if>
  281 + order by
  282 + case
  283 + when d.name like '宁波办%' then 1
  284 + when d.name like '温州办%' then 2
  285 + when d.name like '东莞办%' then 3
  286 + when d.name like '佛山办%' then 4
  287 + when d.name like '苏州办%' then 5
  288 + when d.name like '常州办%' then 6
  289 + when d.name like '北方办%' then 7
  290 + when d.name like '紫铜办%' then 8
  291 + when d.name like '外贸办%' then 9
  292 + else 10 -- 其他办事处按字母顺序排在后面
  293 + end,
  294 + d.name asc,
  295 + r.name asc,
  296 + sum(distinct rl.end_account_receivable) desc
262 297 </select>
263 298
264 299 <select id="statisticsDebtByShortName" resultType="java.util.Map">
... ...