|
|
@@ -0,0 +1,96 @@
|
|
|
+package org.springblade.finance.fince;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.entity.CorpsDesc;
|
|
|
+import org.springblade.client.feign.ICorpsDescClient;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.core.excel.util.ExcelUtil;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
+import org.springblade.finance.excel.DealWithExcel;
|
|
|
+import org.springblade.finance.excel.ReceivableExcle;
|
|
|
+import org.springblade.finance.service.IAccService;
|
|
|
+import org.springblade.finance.vo.AccVO;
|
|
|
+import org.springblade.finance.vo.CostMessage;
|
|
|
+import org.springblade.finance.vojo.Settlement;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 应收总账
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/receivable")
|
|
|
+@Api(value = "应收总账", tags = "应收总账")
|
|
|
+public class Receivable extends BladeController {
|
|
|
+ private final IAccService accService;
|
|
|
+ private final ICorpsDescClient corpsDescClient;
|
|
|
+ /**
|
|
|
+ * 分页 应收总账
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "应收总账分页", notes = "传入settlement")
|
|
|
+ public R<IPage<CostMessage>> list(AccVO accVO, Query query) {
|
|
|
+ if (StringUtils.isBlank(accVO.getTradeType())){
|
|
|
+ throw new SecurityException("请选择查询的贸易类型");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(accVO.getDc())){
|
|
|
+ throw new SecurityException("请选择查询的收费类型");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(accVO.getTenantId())){
|
|
|
+ accVO.setTenantId(SecureUtil.getTenantId());
|
|
|
+ }
|
|
|
+ IPage<CostMessage> costMessageIPage = accService.salaryMessage(accVO, Condition.getPage(query));
|
|
|
+ if (CollectionUtils.isNotEmpty(costMessageIPage.getRecords())){
|
|
|
+ costMessageIPage.getRecords().stream().forEach(item ->{
|
|
|
+ if (item.getCorpId() != null){
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
+ item.setCorpName(corpMessage.getData().getCname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(costMessageIPage);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 导出-应收总账
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ @GetMapping("/export")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "应收总账")
|
|
|
+ public void export(AccVO accVO, HttpServletResponse response) {
|
|
|
+ if (StringUtils.isBlank(accVO.getTradeType())){
|
|
|
+ throw new SecurityException("请选择查询的贸易类型");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(accVO.getDc())){
|
|
|
+ throw new SecurityException("请选择查询的收费类型");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(accVO.getTenantId())){
|
|
|
+ accVO.setTenantId(SecureUtil.getTenantId());
|
|
|
+ }
|
|
|
+ List<ReceivableExcle> list = new ArrayList<>();
|
|
|
+ List<CostMessage> costMessageList = accService.salaryMessage(accVO);
|
|
|
+ if (CollectionUtils.isNotEmpty(costMessageList)){
|
|
|
+ list = BeanUtil.copy(costMessageList, ReceivableExcle.class);
|
|
|
+ }
|
|
|
+ ExcelUtil.export(response, "应收总账", "应收总账", list, ReceivableExcle.class);
|
|
|
+ }
|
|
|
+}
|