|
@@ -170,27 +170,37 @@ public class IndexServiceImpl extends ServiceImpl<IndexMapper, Object> implement
|
|
|
DateTime beginOfMonth = DateUtil.beginOfMonth(date);
|
|
|
DateTime endOfMonth = DateUtil.endOfMonth(date);
|
|
|
|
|
|
+ // 上半月结束时间
|
|
|
+ String halfEndTime = DateUtil.format(endOfMonth, "yyyy-MM-15 HH:mm:ss");
|
|
|
if (DateUtil.betweenDay(date, beginOfMonth, true) > 14) {
|
|
|
- // 上半月结束时间
|
|
|
- String halfEndTime = DateUtil.format(endOfMonth, "yyyy-MM-15 HH:mm:ss");
|
|
|
// 上个账期已付
|
|
|
- List<Map<String, Object>> paidInLastAccountingPeriod =
|
|
|
- baseMapper.getPaidInLastAccountingPeriod(beginOfMonth, halfEndTime);
|
|
|
+ List<Map<String, Object>> paidInLastAccountingPeriod = baseMapper.getPaidInLastAccountingPeriod(beginOfMonth, halfEndTime);
|
|
|
result.put("paidInLastAccountingPeriod", paidInLastAccountingPeriod);
|
|
|
- }
|
|
|
-
|
|
|
- // 下半月开始时间
|
|
|
- String lowerHalfBeginTime = DateUtil.format(beginOfMonth, "yyyy-MM-16 HH:mm:ss");
|
|
|
|
|
|
- // 本账期
|
|
|
- BigDecimal currentAccountingPeriod = baseMapper.getCurrentAccountingPeriod(lowerHalfBeginTime, endOfMonth)
|
|
|
- .setScale(2, RoundingMode.HALF_DOWN);
|
|
|
- result.put("currentAccountingPeriod", currentAccountingPeriod);
|
|
|
+ // 下半月开始时间
|
|
|
+ String lowerHalfBeginTime = DateUtil.format(beginOfMonth, "yyyy-MM-16 HH:mm:ss");
|
|
|
+
|
|
|
+ // 本账期
|
|
|
+ BigDecimal currentAccountingPeriod = baseMapper.getCurrentAccountingPeriod(lowerHalfBeginTime, endOfMonth)
|
|
|
+ .setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ result.put("currentAccountingPeriod", currentAccountingPeriod);
|
|
|
+
|
|
|
+ // 已付
|
|
|
+ List<Map<String, Object>> paid = baseMapper.gerPaid(lowerHalfBeginTime, endOfMonth);
|
|
|
+ paid.forEach(item -> item.put("PayAmount", ((BigDecimal) item.get("PayAmount")).setScale(2, RoundingMode.HALF_DOWN)));
|
|
|
+ result.put("paid", paid);
|
|
|
+ } else {
|
|
|
+ // 本账期
|
|
|
+ BigDecimal currentAccountingPeriod = baseMapper.getCurrentAccountingPeriod(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss"), DateUtil.parse(halfEndTime))
|
|
|
+ .setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ result.put("currentAccountingPeriod", currentAccountingPeriod);
|
|
|
+
|
|
|
+ // 已付
|
|
|
+ List<Map<String, Object>> paid = baseMapper.gerPaid(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss"), DateUtil.parse(halfEndTime));
|
|
|
+ paid.forEach(item -> item.put("PayAmount", ((BigDecimal) item.get("PayAmount")).setScale(2, RoundingMode.HALF_DOWN)));
|
|
|
+ result.put("paid", paid);
|
|
|
+ }
|
|
|
|
|
|
- // 已付
|
|
|
- List<Map<String, Object>> paid = baseMapper.gerPaid(lowerHalfBeginTime, endOfMonth);
|
|
|
- paid.forEach(item -> item.put("PayAmount", ((BigDecimal) item.get("PayAmount")).setScale(2, RoundingMode.HALF_DOWN)));
|
|
|
- result.put("paid", paid);
|
|
|
|
|
|
return result;
|
|
|
}
|