diff --git a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java index 66bbb9d..aa28bf5 100644 --- a/src/main/java/com/gszc/service/impl/CustomServiceImpl.java +++ b/src/main/java/com/gszc/service/impl/CustomServiceImpl.java @@ -111,6 +111,32 @@ public class CustomServiceImpl extends ServiceImpl impleme List customSupports = customSupportMapper.selectList(new EntityWrapper().eq("custom_id", customId)); jsonObject.put("custom",custom); jsonObject.put("customSupports",customSupports); + + //年度 + Calendar c = Calendar.getInstance(); + c.setTime(new Date()); + c.add(Calendar.YEAR, -1); + Date y = c.getTime(); + List yearInvoiceList = invoiceMapper.selectList(new EntityWrapper().eq("custom_id", customId).ge("create_date", y)); + //月度 + c.setTime(new Date()); + c.add(Calendar.MONTH, -1); + Date m = c.getTime(); + List monthInvoiceList = invoiceMapper.selectList(new EntityWrapper().eq("custom_id", customId).ge("create_date", m)); + + BigDecimal yearMoney = new BigDecimal("0"); + BigDecimal monthMoney = new BigDecimal("0"); + for(Invoice invoice:yearInvoiceList){ + BigDecimal money = invoice.getMoney(); + yearMoney = yearMoney.add(money); + } + for(Invoice invoice:monthInvoiceList){ + BigDecimal money = invoice.getMoney(); + monthMoney = monthMoney.add(money); + } + jsonObject.put("yearMoney",yearMoney); + jsonObject.put("monthMoney",monthMoney); + return jsonObject; }