|
|
@@ -16,17 +16,21 @@
|
|
|
*/
|
|
|
package org.springblade.finance.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.finance.excel.FeeStatisticsExcel;
|
|
|
import org.springblade.finance.vo.AccVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.excel.util.ExcelUtil;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
|
@@ -36,6 +40,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.finance.service.IAccService;
|
|
|
+import org.springblade.purchase.sales.entity.Order;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -43,6 +48,7 @@ import org.springblade.finance.vojo.Acc;
|
|
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -204,5 +210,68 @@ public class AccController extends BladeController {
|
|
|
return R.data(list);
|
|
|
|
|
|
}
|
|
|
+ @GetMapping("/getAccMessage")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "统计收付费明细", notes = "传入ids")
|
|
|
+ public R<List<Acc>> getAccMessage(@Valid @RequestBody Acc acc) {
|
|
|
+ if (StringUtils.isBlank(acc.getTradeType())){
|
|
|
+ throw new SecurityException("请选择查询的类型");
|
|
|
+ }
|
|
|
+ //默认为付费
|
|
|
+ if (StringUtils.isBlank(acc.getDc())){
|
|
|
+ acc.setDc("c");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<Acc> accLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ accLambdaQueryWrapper
|
|
|
+ .eq(Acc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Acc::getIsDeleted, 0)
|
|
|
+ .eq(Acc::getTradeType, acc.getTradeType())
|
|
|
+ .like(Func.isNotEmpty(acc.getAccSysNo()),Acc::getSysno,acc.getSysno())
|
|
|
+ .eq(Func.isNotEmpty(acc.getCorpId()),Acc::getCorpId,acc.getCorpId())
|
|
|
+ .eq(Acc::getDc,acc.getDc())
|
|
|
+ .ge(Func.isNotEmpty(acc.getAccDateStart()), Acc::getAccDate, acc.getAccDateStart())//订单日期开始
|
|
|
+ .le(Func.isNotEmpty(acc.getAccDateEnd()), Acc::getAccDate, acc.getAccDateEnd());//订单日期结束
|
|
|
+
|
|
|
+ List<Acc> list = accService.list(accLambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ list.forEach(e -> {
|
|
|
+ //客户名称
|
|
|
+ e.setCorpName(corpsDescClient.getCorpMessage(e.getCorpId()).getData().getCname());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+ @GetMapping("/exportAccMessage")
|
|
|
+ @ApiOperationSupport(order = 10)
|
|
|
+ @ApiOperation(value = "导出收付费明细", notes = "传入ids")
|
|
|
+ public void exportAccMessage(Acc acc, HttpServletResponse response) {
|
|
|
+ if (StringUtils.isBlank(acc.getTradeType())){
|
|
|
+ throw new SecurityException("请选择查询的类型");
|
|
|
+ }
|
|
|
+ //默认为付费
|
|
|
+ if (StringUtils.isBlank(acc.getDc())){
|
|
|
+ acc.setDc("c");
|
|
|
+ }
|
|
|
+ List<FeeStatisticsExcel> feeStatisticsExcelArrayList = new ArrayList<>();
|
|
|
+ LambdaQueryWrapper<Acc> accLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ accLambdaQueryWrapper
|
|
|
+ .eq(Acc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Acc::getIsDeleted, 0)
|
|
|
+ .eq(Acc::getTradeType, acc.getTradeType())
|
|
|
+ .like(Func.isNotEmpty(acc.getAccSysNo()),Acc::getSysno,acc.getSysno())
|
|
|
+ .eq(Func.isNotEmpty(acc.getCorpId()),Acc::getCorpId,acc.getCorpId())
|
|
|
+ .eq(Acc::getDc,acc.getDc())
|
|
|
+ .ge(Func.isNotEmpty(acc.getAccDateStart()), Acc::getAccDate, acc.getAccDateStart())//订单日期开始
|
|
|
+ .le(Func.isNotEmpty(acc.getAccDateEnd()), Acc::getAccDate, acc.getAccDateEnd());//订单日期结束
|
|
|
|
|
|
+ List<Acc> list = accService.list(accLambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ list.forEach(e -> {
|
|
|
+ //客户名称
|
|
|
+ e.setCorpName(corpsDescClient.getCorpMessage(e.getCorpId()).getData().getCname());
|
|
|
+ });
|
|
|
+ feeStatisticsExcelArrayList = JSON.parseArray(JSON.toJSONString(list), FeeStatisticsExcel.class);
|
|
|
+ }
|
|
|
+ ExcelUtil.export(response, "收付费明细", "收付费明细", feeStatisticsExcelArrayList, FeeStatisticsExcel.class);
|
|
|
+ }
|
|
|
}
|