From 0212e22984c0c5f5cc15ac36bedf769cdb5b22f8 Mon Sep 17 00:00:00 2001 From: "kuang.yifei@iwhalecloud.com" Date: Wed, 1 Jun 2022 18:11:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E5=85=A5=E5=92=8C=E6=94=AF=E5=87=BA?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/FinancialDetailController.java | 13 +++++++++++ .../web/pojo/vo/FinancialCountRequest.java | 10 ++++++++ .../web/pojo/vo/FinancialCountResponse.java | 14 +++++++++++ .../payment/mapper/FinancialDetailMapper.java | 6 +++++ .../response/FinancialCountResponse.java | 15 ++++++++++++ .../service/FinancialDetailService.java | 9 ++++++++ .../impl/FinancialDetailServiceImpl.java | 19 +++++++++++++++ .../financial/FinancialDetailMapper.xml | 23 +++++++++++++++++++ 8 files changed, 109 insertions(+) create mode 100644 ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountRequest.java create mode 100644 ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountResponse.java create mode 100644 ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java b/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java index 91de81ab..b8610cd9 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/payment/FinancialDetailController.java @@ -6,9 +6,11 @@ import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.enums.BusinessType; +import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.service.FinancialDetailService; +import com.ghy.web.pojo.vo.FinancialCountRequest; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -38,6 +40,17 @@ public class FinancialDetailController extends BaseController { return prefix; } + @PostMapping("/count") + @ResponseBody + public AjaxResult count(@RequestBody FinancialCountRequest request){ + try { + return AjaxResult.success(financialDetailService.count(request.getCountTime())); + }catch (Exception e){ + e.printStackTrace(); + return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); + } + } + @RequiresPermissions("financial:detail:list") @PostMapping("/list") @ResponseBody diff --git a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountRequest.java b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountRequest.java new file mode 100644 index 00000000..d8a96267 --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountRequest.java @@ -0,0 +1,10 @@ +package com.ghy.web.pojo.vo; + +import lombok.Data; + +@Data +public class FinancialCountRequest { + + private String countTime; + +} diff --git a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountResponse.java b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountResponse.java new file mode 100644 index 00000000..28fb5565 --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/FinancialCountResponse.java @@ -0,0 +1,14 @@ +package com.ghy.web.pojo.vo; + +import lombok.Data; + +@Data +public class FinancialCountResponse { + + private String createTime; + + private String payCount; + + private String incomeCount; + +} diff --git a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java index dc2c7715..360aadeb 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java +++ b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java @@ -1,6 +1,7 @@ package com.ghy.payment.mapper; import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.response.FinancialCountResponse; import java.util.List; @@ -11,6 +12,11 @@ import java.util.List; */ public interface FinancialDetailMapper { + /** + * @return 月份集合 + */ + List count(FinancialCountResponse response); + /** * @param financialDetail 财务细单属性 * @return 成功条数 diff --git a/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java new file mode 100644 index 00000000..49489ce5 --- /dev/null +++ b/ghy-payment/src/main/java/com/ghy/payment/response/FinancialCountResponse.java @@ -0,0 +1,15 @@ +package com.ghy.payment.response; + +import lombok.Data; + +@Data +public class FinancialCountResponse { + + private String createTime; + + private String payCount; + + private String incomeCount; + + private String flag; +} diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java index 93f796d6..85d064fa 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java @@ -1,8 +1,10 @@ package com.ghy.payment.service; import com.ghy.payment.domain.FinancialDetail; +import com.ghy.payment.response.FinancialCountResponse; import java.util.List; +import java.util.Map; /** * 财务细单接口 @@ -11,6 +13,13 @@ import java.util.List; */ public interface FinancialDetailService { + /** + * @param countTime 是否查询准确时间 + * @param flag 0收入 1支出 + * @return 月份集合 + */ + List count(String countTime); + /** * @param financialDetail 财务细单属性 * @return 成功条数 diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java index 6185db68..b0c98725 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java @@ -4,6 +4,7 @@ import com.ghy.common.constant.UserConstants; import com.ghy.common.core.text.Convert; import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.mapper.FinancialDetailMapper; +import com.ghy.payment.response.FinancialCountResponse; import com.ghy.payment.service.FinancialDetailService; import org.springframework.stereotype.Service; @@ -30,6 +31,24 @@ public class FinancialDetailServiceImpl implements FinancialDetailService { @Resource private FinancialDetailMapper financialDetailMapper; + + @Override + public List count(String countTime) { + FinancialCountResponse request = new FinancialCountResponse(); + request.setCreateTime(countTime); + request.setFlag("true"); + // 查询各月含有收入的费用 + List list = financialDetailMapper.count(request); + list.forEach(financialCountResponse->{ + // 查询指定月支出的 + request.setFlag("false"); + request.setCreateTime(financialCountResponse.getCreateTime()); + financialCountResponse.setPayCount(financialDetailMapper.count(request).get(0).getPayCount()); + }); + return list; + } + + @Override public int insertFinancialDetail(FinancialDetail financialDetail) { return financialDetailMapper.insertFinancialDetail(financialDetail); diff --git a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml index ab204ca9..9942a683 100644 --- a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml +++ b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml @@ -27,6 +27,12 @@ + + + + + + SELECT id, dept_id, code, financial_master_id, financial_master_code, order_detail_id, order_detail_code, @@ -96,6 +102,23 @@ WHERE reverse_id = #{reverseId} + + INSERT INTO financial_detail(