Parcourir la source

处理swagger api问题

1811872455@163.com il y a 3 semaines
Parent
commit
e4520155e6

+ 33 - 19
java/storlead-api/src/main/java/com/springfox/documentation/schema/Example.java → java/storlead-api/src/main/java/springfox/documentation/schema/Example.java

@@ -1,23 +1,28 @@
-package com.springfox.documentation.schema;
+package springfox.documentation.schema;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import springfox.documentation.service.VendorExtension;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
-import springfox.documentation.service.VendorExtension;
 
+/**
+ * 覆盖 springfox-core 3.0.0 同名类,修复 id 为 null 时 {@link #equals(Object)} NPE(Issue #3989/#4003)。
+ */
 @JsonInclude(Include.NON_EMPTY)
 public class Example {
+
     private final String id;
     private final String summary;
     private final String description;
     private final Object value;
     private final String externalValue;
     private final String mediaType;
-    private final List<VendorExtension> extensions = new ArrayList();
+    private final List<VendorExtension> extensions = new ArrayList<>();
 
-    /** @deprecated */
     @Deprecated
     public Example(Object value) {
         this.value = value;
@@ -28,7 +33,6 @@ public class Example {
         this.description = null;
     }
 
-    /** @deprecated */
     @Deprecated
     public Example(String mediaType, Object value) {
         this.mediaType = mediaType;
@@ -39,7 +43,8 @@ public class Example {
         this.description = null;
     }
 
-    public Example(String id, String summary, String description, Object value, String externalValue, String mediaType) {
+    public Example(String id, String summary, String description, Object value, String externalValue,
+            String mediaType) {
         this.id = id;
         this.summary = summary;
         this.description = description;
@@ -49,49 +54,58 @@ public class Example {
     }
 
     public String getId() {
-        return this.id;
+        return id;
     }
 
     public String getSummary() {
-        return this.summary;
+        return summary;
     }
 
     public String getDescription() {
-        return this.description;
+        return description;
     }
 
     public String getExternalValue() {
-        return this.externalValue;
+        return externalValue;
     }
 
     public List<VendorExtension> getExtensions() {
-        return this.extensions;
+        return extensions;
     }
 
     public Object getValue() {
-        return this.value;
+        return value;
     }
 
     public Optional<String> getMediaType() {
-        return Optional.ofNullable(this.mediaType);
+        return Optional.ofNullable(mediaType);
     }
 
+    @Override
     public String toString() {
-        return String.valueOf(this.value);
+        return String.valueOf(value);
     }
 
+    @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
-        } else if (o != null && !o.toString().equals("")) {
-            Example example = (Example)o;
-            return this.id.equals(example.id) && Objects.equals(this.summary, example.summary) && Objects.equals(this.description, example.description) && this.value.equals(example.value) && this.externalValue.equals(example.externalValue) && this.mediaType.equals(example.mediaType) && this.extensions.equals(example.extensions);
-        } else {
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
         }
+        Example example = (Example) o;
+        return Objects.equals(id, example.id)
+                && Objects.equals(summary, example.summary)
+                && Objects.equals(description, example.description)
+                && Objects.equals(value, example.value)
+                && Objects.equals(externalValue, example.externalValue)
+                && Objects.equals(mediaType, example.mediaType)
+                && Objects.equals(extensions, example.extensions);
     }
 
+    @Override
     public int hashCode() {
-        return Objects.hash(new Object[]{this.id, this.summary, this.description, this.value, this.externalValue, this.mediaType, this.extensions});
+        return Objects.hash(id, summary, description, value, externalValue, mediaType, extensions);
     }
 }

+ 0 - 91
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/OrderCostApiController.java

@@ -1,91 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CodeGenerateInterface;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.util.generate.CodeGenerate;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.enums.ReimburseStatusEnum;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.OrderCostRecordEntity;
-import com.storlead.sales.service.finance.OrderCostRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * @program: sp-sales-platform
- * @description: 费用
- * @author: chenkq
- * @create: 2024-07-31 15:18
- */
-@Api(tags = "财务: 费用")
-@RestController
-@RequestMapping("/finance/rost")
-public class OrderCostApiController {
-
-
-    @Resource
-    private OrderCostRecordService costRecordService;
-
-    @ApiOperation(value = "获取费用记录")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-        IPage<OrderCostRecordEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<OrderCostRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderCostRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<OrderCostRecordEntity> pageList = costRecordService.page(page,queryWrapper);
-        return Result.result(pageList);
-    }
-
-    @ApiOperation(value = "保存费用记录")
-    @PostMapping( "/save")
-    public Result<?> save(@RequestBody OrderCostRecordEntity record) {
-        if (Objects.isNull(record.getId())) {
-            record.setDataCode(CodeGenerate.generate12Code(CodeGenerateInterface.ORDER_COST_CODE));
-        }
-        costRecordService.saveOrUpdate(record);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "获取详情")
-    @PostMapping( "/get_detial")
-    public Result<?> getDetail(Long id) {
-        OrderCostRecordEntity record = costRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("费用记录不存在");
-        }
-        return Result.ok(record);
-    }
-
-    @ApiOperation(value = "删除费用记录")
-    @PostMapping( "/delete")
-    public Result<?> delete(Long id) {
-        OrderCostRecordEntity record = costRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("费用记录不存在");
-        }
-        if (ReimburseStatusEnum.NOT_REIMBURSEED.getCode().equals(record.getReimburseStatus())) {
-            costRecordService.lgDelete(id);
-        } else {
-            return Result.error("费用记录已报销,不能删除");
-        }
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "批量删除费用记录")
-    @PostMapping( "/deleteIds")
-    public Result<?> deleteIds(Long [] ids) {
-        costRecordService.lgDelete(Arrays.asList(ids));
-        return Result.ok();
-    }
-}

+ 0 - 82
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/OrderInvoiceRecordApiController.java

@@ -1,82 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CodeGenerateInterface;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.util.generate.CodeGenerate;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.OrderInvoiceRecordEntity;
-import com.storlead.sales.service.finance.OrderInvoiceRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * @program: sp-sales-platform
- * @description:
- * @author: chenkq
- * @create: 2024-07-31 11:08
- */
-@Api(tags = "财务: 发票")
-@RestController
-@RequestMapping("/finance/invoice")
-public class OrderInvoiceRecordApiController {
-
-    @Resource
-    private OrderInvoiceRecordService invoiceRecordService;
-
-    @ApiOperation(value = "获取发票记录")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-        IPage<OrderInvoiceRecordEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<OrderInvoiceRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderInvoiceRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<OrderInvoiceRecordEntity> pageList = invoiceRecordService.page(page,queryWrapper);
-        return Result.result(pageList);
-    }
-
-    @ApiOperation(value = "保存发票")
-    @PostMapping( "/save")
-    public Result<?> save(@RequestBody OrderInvoiceRecordEntity record) {
-        if (Objects.isNull(record.getId())) {
-            record.setDataCode(CodeGenerate.generate12Code(CodeGenerateInterface.ORDER_RECEIVE_CODE));
-        }
-        invoiceRecordService.saveOrUpdate(record);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "获取详情")
-    @PostMapping( "/get_detial")
-    public Result<?> getDetail(Long id) {
-        OrderInvoiceRecordEntity record = invoiceRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("发票记录不存在");
-        }
-        return Result.ok(record);
-    }
-
-    @ApiOperation(value = "删除发票")
-    @PostMapping( "/delete")
-    public Result<?> delete(Long id) {
-        invoiceRecordService.lgDelete(id);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "批量除发票")
-    @PostMapping( "/deleteIds")
-    public Result<?> deleteIds(Long [] ids) {
-        invoiceRecordService.lgDelete(Arrays.asList(ids));
-        return Result.ok();
-    }
-
-}

+ 0 - 393
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/OrderReceivePlanApiController.java

@@ -1,393 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.pojo.entity.customer.CustomerEntity;
-import com.storlead.sales.pojo.entity.customer.OrderFormEntity;
-import com.storlead.sales.enums.ApproveStatusEnum;
-import com.storlead.sales.enums.ReceivePlanStatusEnum;
-import com.storlead.sales.enums.TaskStatusEnum;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanDTO;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.OrderReceivePlanDetailEntity;
-import com.storlead.sales.pojo.entity.finance.OrderReceivePlanRecordEntity;
-import com.storlead.sales.pojo.entity.finance.OrderReceiveRecordEntity;
-import com.storlead.sales.pojo.vo.finance.OrderReceivePlanDetailVO;
-import com.storlead.sales.pojo.vo.finance.OrderReceivePlanVO;
-import com.storlead.sales.pojo.vo.finance.OrderReceiveRecordVO;
-import com.storlead.sales.pojo.vo.finance.ReceivePlanDetailVO;
-import com.storlead.sales.service.customer.CustomerService;
-import com.storlead.sales.service.customer.OrderFormService;
-import com.storlead.sales.service.finance.OrderReceivePlanDetailService;
-import com.storlead.sales.service.finance.OrderReceivePlanRecordService;
-import com.storlead.sales.service.finance.OrderReceiveRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.BeanUtils;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * @program: sp-sales-platform
- * @description:
- * @author: chenkq
- * @create: 2024-07-26 14:39
- */
-@Api(tags = "财务: 回款计划")
-@RestController
-@RequestMapping("/finance/receive/plan")
-public class OrderReceivePlanApiController {
-
-    @Resource
-    private OrderReceivePlanRecordService orderReceivePlanService;
-
-    @Resource
-    private OrderReceivePlanDetailService orderReceivePlanDetailService;
-
-    @Resource
-    private OrderReceiveRecordService orderReceiveRecordService;
-
-    @Resource
-    private OrderFormService orderFormService;
-
-    @Resource
-    private CustomerService customerService;
-
-    @ApiOperation(value = "获取回款计划")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-
-        IPage<OrderReceivePlanDetailEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<OrderReceivePlanDetailEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceivePlanDetailEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<OrderReceivePlanDetailEntity> pageList = orderReceivePlanDetailService.page(page,queryWrapper);
-        return Result.result(pageList);
-
-    }
-
-    @ApiOperation(value = "获取回款计划详情")
-    @PostMapping( "/get_plan_detail")
-    public Result<?> getPlanDetail(Long detailId) {
-
-        if (Objects.isNull(detailId)) {
-            return Result.error("参数错误");
-        }
-        OrderReceivePlanDetailEntity receiveDetail = orderReceivePlanDetailService.getById(detailId);
-        if (Objects.isNull(receiveDetail)) {
-            return Result.error("参数错误");
-        }
-        OrderReceivePlanVO planVO = new OrderReceivePlanVO();
-        OrderReceivePlanDetailVO detailVo = new OrderReceivePlanDetailVO();
-        BeanUtils.copyProperties(receiveDetail,detailVo);
-        planVO.setDetail(detailVo);
-
-        Long orderId =  receiveDetail.getOrderId();
-        OrderFormEntity orderForm = orderFormService.getById(receiveDetail.getOrderId());
-        if (Objects.isNull(orderForm)) {
-            return Result.error("参数错误");
-        }
-
-        LambdaQueryWrapper<OrderReceivePlanRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getOrderId,orderId);
-        queryWrapper.last("limit 1");
-        OrderReceivePlanRecordEntity plan = orderReceivePlanService.getOne(queryWrapper);
-        if (Objects.isNull(plan)) {
-            return Result.error("参数错误!");
-        }
-        BeanUtils.copyProperties(plan,planVO);
-        planVO.setOrderName(orderForm.getTitle());
-        CustomerEntity customer = customerService.getById(orderForm.getCustomerId());
-         if (Objects.isNull(customer)) {
-             planVO.setCustomerName("");
-        } else {
-             planVO.setCustomerName(customer.getCustomerName());
-        }
-
-        LambdaQueryWrapper<OrderReceivePlanDetailEntity> detailWrapper = new LambdaQueryWrapper();
-        detailWrapper.eq(OrderReceivePlanDetailEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        detailWrapper.eq(OrderReceivePlanDetailEntity::getOrderId,orderId);
-        detailWrapper.last("limit 1");
-        List<OrderReceivePlanDetailEntity> planDetails = orderReceivePlanDetailService.list(detailWrapper);
-
-        List<OrderReceivePlanDetailVO> receivePlanDetaills =new ArrayList<>();
-        for (OrderReceivePlanDetailEntity detail : planDetails) {
-            OrderReceivePlanDetailVO record = new OrderReceivePlanDetailVO();
-            BeanUtils.copyProperties(detail,record);
-            receivePlanDetaills.add(record);
-        }
-
-        planVO.setPlanDetails(receivePlanDetaills);
-
-        LambdaQueryWrapper<OrderReceiveRecordEntity> reWrapper = new LambdaQueryWrapper();
-        reWrapper.eq(OrderReceiveRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        reWrapper.eq(OrderReceiveRecordEntity::getPlanId,orderId);
-        reWrapper.last("limit 1");
-        List<OrderReceiveRecordEntity> details = orderReceiveRecordService.list(reWrapper);
-
-        List<OrderReceiveRecordVO> receiveDetaills =new ArrayList<>();
-        for (OrderReceiveRecordEntity detail : details) {
-            OrderReceiveRecordVO record = new OrderReceiveRecordVO();
-            BeanUtils.copyProperties(detail,record);
-            receiveDetaills.add(record);
-        }
-        planVO.setReceiveDetails(receiveDetaills);
-
-        return Result.result(planVO);
-    }
-
-    @ApiOperation(value = "创建回款计划")
-    @PostMapping( "/generate_plan")
-    public Result<?> generate_plan(@RequestBody OrderReceivePlanDTO dto) {
-        if (Objects.isNull(dto)) {
-            return Result.error("参数错误");
-        }
-
-        LocalDate firstReceiveDate = dto.getFirstReceiveDate();
-        Integer receivePeriodTotal =dto.getReceivePeriodTotal();
-        LocalDate receiveDate = firstReceiveDate;
-        BigDecimal receiveAmount = dto.getPlanReceiveAmount();
-        BigDecimal leaveOrderAmount = receiveAmount;
-        BigDecimal periodAmount =  receiveAmount.divide(BigDecimal.valueOf(receivePeriodTotal),2, RoundingMode.HALF_UP);
-        BigDecimal percentage = periodAmount.divide(receiveAmount, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
-        BigDecimal receiveRatio =  percentage ;
-        BigDecimal lastReceiveRatio = BigDecimal.valueOf(100) ;
-
-        List<ReceivePlanDetailVO> planDetails = new ArrayList<>();
-        for(int periodNum =1; periodNum <= receivePeriodTotal ;periodNum++) {
-            ReceivePlanDetailVO record = new ReceivePlanDetailVO();
-            if (Integer.valueOf(0).equals(dto.getIsCreate())) {
-                // 创建
-                if (periodNum > 1) {
-                    if(Integer.valueOf(1).equals(dto.getReceiveIntervalUnit())) {
-                        receiveDate = receiveDate.plusDays(dto.getReceiveInterval());
-                    } else {
-                        receiveDate = receiveDate.plusMonths(dto.getReceiveInterval());
-                    }
-                }
-            }else  {
-                // 修改
-                if(Integer.valueOf(1).equals(dto.getReceiveIntervalUnit())) {
-                    receiveDate = receiveDate.plusDays(dto.getReceiveInterval());
-                } else {
-                    receiveDate = receiveDate.plusMonths(dto.getReceiveInterval());
-                }
-            }
-
-            if (Integer.valueOf(periodNum).equals(receivePeriodTotal)) {
-                record.setPlanReceiveAmount(leaveOrderAmount);
-                record.setReceiveRatio(lastReceiveRatio);
-            } else {
-                record.setPlanReceiveAmount(periodAmount);
-                record.setReceiveRatio(receiveRatio);
-            }
-            record.setPeriodNum(periodNum);
-            record.setPlanReceiveDate(receiveDate);
-            planDetails.add(record);
-
-            leaveOrderAmount = leaveOrderAmount.subtract(periodAmount);
-            lastReceiveRatio = lastReceiveRatio.subtract(receiveRatio);
-        }
-        return Result.ok(planDetails);
-    }
-
-    @ApiOperation(value = "创建回款计划")
-    @PostMapping( "/create_plan")
-    public Result<?> createPlan(@RequestBody OrderReceivePlanDTO dto) {
-        if (Objects.isNull(dto)) {
-            return Result.error("参数错误");
-        }
-        OrderFormEntity  order = orderFormService.getById(dto.getOrderId());
-
-        LambdaQueryWrapper<OrderReceivePlanRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getOrderId,dto.getOrderId());
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        OrderReceivePlanRecordEntity planRecord = orderReceivePlanService.getOne(queryWrapper);
-
-        if (Objects.nonNull(planRecord)) {
-            return Result.error("该订单已有回款计划,请先删除");
-        }
-
-        List<OrderReceivePlanDetailEntity> planDetails = dto.getUpdateData();
-        if (CollectionUtils.isEmpty(planDetails)) {
-            return Result.error("请创建计划详情");
-        }
-        OrderReceivePlanRecordEntity plan = new OrderReceivePlanRecordEntity();
-        plan.setOrderId(dto.getOrderId());
-        plan.setOrderAmount(order.getTotalOrderAmt());
-        plan.setReceiveAmount(order.getTotalOrderAmt());
-        plan.setReceiveIntervalUnit(dto.getReceiveIntervalUnit());
-        plan.setReceiveInterval(dto.getReceiveInterval());
-        plan.setPeriodTotal(planDetails.size());
-
-        double plReceiveAmount =  planDetails.stream().mapToDouble(e -> e.getPlanReceiveAmount().doubleValue()).sum();
-        BigDecimal receiveAmount = new BigDecimal(String.valueOf(plReceiveAmount));
-        if (receiveAmount.compareTo(order.getTotalOrderAmt()) < 0) {
-            return Result.error("订单金额与计划回款金额不一致");
-        }
-
-        LocalDate firstReceiveDate = dto.getFirstReceiveDate();
-        Integer receivePeriodTotal =dto.getReceivePeriodTotal();
-        LocalDate lastReceiveDate = firstReceiveDate;
-        BigDecimal periodAmount = order.getTotalOrderAmt().divide(BigDecimal.valueOf(receivePeriodTotal));
-        BigDecimal leaveOrderAmount = BigDecimal.valueOf(0);
-
-        for(int periodNum =1; periodNum <= planDetails.size() ;periodNum++) {
-            OrderReceivePlanDetailEntity record = planDetails.get(periodNum-1);
-            leaveOrderAmount = order.getTotalOrderAmt().multiply(periodAmount);
-            if (periodNum > 1) {
-                if(Integer.valueOf(1).equals(dto.getReceiveIntervalUnit())) {
-                    lastReceiveDate = firstReceiveDate.plusDays(dto.getReceiveInterval() * periodNum);
-                } else {
-                    lastReceiveDate = firstReceiveDate.plusMonths(dto.getReceiveInterval() * periodNum);
-                }
-            }
-            if (Integer.valueOf(periodNum).equals(dto.getReceivePeriodTotal())) {
-                record.setPlanReceiveAmount(leaveOrderAmount);
-            } else {
-                record.setPlanReceiveAmount(periodAmount);
-            }
-            record.setPeriodNum(periodNum);
-            record.setPeriodTotal(receivePeriodTotal);
-            record.setPlanReceiveDate(lastReceiveDate);
-            record.setOrderId(dto.getOrderId());
-        }
-        orderReceivePlanService.save(plan);
-        orderReceivePlanDetailService.saveOrUpdateBatch(planDetails);
-
-
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "配置回款计划")
-    @PostMapping( "/update_plan")
-    public Result<?> updatPlan(@RequestBody OrderReceivePlanDTO dto) {
-        if (Objects.isNull(dto)) {
-            return Result.error("参数错误");
-        }
-
-        LambdaQueryWrapper<OrderReceivePlanRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getOrderId,dto.getOrderId());
-        queryWrapper.eq(OrderReceivePlanRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        OrderReceivePlanRecordEntity plan = orderReceivePlanService.getOne(queryWrapper);
-
-        List<OrderReceivePlanDetailEntity> planDetails = dto.getUpdateData();
-
-        BigDecimal planReceiveAmount = BigDecimal.ZERO;
-        List<OrderReceivePlanDetailEntity> updatels = new ArrayList<>();
-        for (OrderReceivePlanDetailEntity planDetail : planDetails) {
-            if (ReceivePlanStatusEnum.UNSTART.getCode().equals(planDetail.getReceiveStatus())
-                    && (ApproveStatusEnum.NOT_SUBMIT_APPROVE.equals(planDetail.getApproveStatus())
-                    || ApproveStatusEnum.APPROVE_NO_PASS.equals(planDetail.getApproveStatus()))) {
-                updatels.add(planDetail);
-            }
-            if (CommonConstant.DEL_FLAG_0.equals(planDetail.getIsDelete())) {
-                planReceiveAmount = planReceiveAmount.add(planDetail.getPlanReceiveAmount());
-            }
-        }
-
-        if (CollectionUtils.isEmpty(updatels)) {
-            orderReceivePlanDetailService.saveOrUpdateBatch(updatels);
-        }
-
-        if (planReceiveAmount.compareTo(plan.getReceiveAmount()) < 0) {
-            return Result.error("回款金额需要与订单金额一致");
-        }
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "删除回款计划")
-    @PostMapping( "/delete_plan_detail")
-    public Result<?> deletePlanDetail(@RequestBody OrderReceivePlanDTO dto) {
-        if (Objects.isNull(dto)) {
-            return Result.error("参数错误");
-        }
-        LambdaQueryWrapper<OrderReceivePlanRecordEntity> planWrapper = new LambdaQueryWrapper();
-        planWrapper.eq(OrderReceivePlanRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        planWrapper.eq(OrderReceivePlanRecordEntity::getOrderId, dto.getOrderId());
-        planWrapper.last("limit 1");
-        OrderReceivePlanRecordEntity  receivePlan = orderReceivePlanService.getOne(planWrapper);
-        if (Objects.isNull(receivePlan)) {
-            return Result.error("receivePlan");
-        }
-        LambdaQueryWrapper<OrderReceivePlanDetailEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceivePlanDetailEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        List<OrderReceivePlanDetailEntity> planDetails = orderReceivePlanDetailService.list(queryWrapper);
-
-        if (CollectionUtils.isEmpty(planDetails)) {
-            return Result.error("参数错误");
-        }
-
-        Boolean isCanCreate = true;
-        for (OrderReceivePlanDetailEntity p : planDetails) {
-            if (!TaskStatusEnum.UNSTART.getCode().equals(p.getReceiveStatus())); {
-                isCanCreate = false;
-            }
-        }
-        if (!isCanCreate) {
-            return Result.error("该订单已有回款计划在进行中,无法删除!");
-        }
-        List<Long> ids = planDetails.stream().map(OrderReceivePlanDetailEntity::getId).collect(Collectors.toList());
-        orderReceivePlanService.lgDelete(ids);
-        if (Objects.nonNull(receivePlan)) {
-            orderReceivePlanService.lgDelete(receivePlan.getId());
-        }
-        return Result.ok();
-    }
-
-
-
-//    @ApiOperation(value = "创建回款计划")
-//    @PostMapping( "/create_plan")
-//    public Result<?> list(@RequestBody OrderReceivePlanDTO dto) {
-//        if (Objects.isNull(dto.getcustomerId())) {
-//            return Result.error("参数错误");
-//        }
-//        if (Objects.isNull(dto.getOrderId())) {
-//            return Result.error("参数错误");
-//        }
-//        OrderFormEntity order = orderFormService.getById(dto.getOrderId());
-//        LocalDate firstReceiveDate = dto.getFirstReceiveDate();
-//        Integer receivePeriodTotal =dto.getReceivePeriodTotal();
-//        LocalDate lastReceiveDate = firstReceiveDate;
-//        BigDecimal periodAmount =  order.getOrderAmount().divide(BigDecimal.valueOf(receivePeriodTotal));
-//        BigDecimal leaveOrderAmount = BigDecimal.valueOf(0);
-//        for(int periodNum =1; periodNum <= dto.getReceivePeriodTotal() ;periodNum++) {
-//            OrderReceivePlanRecordEntity record = new OrderReceivePlanRecordEntity();
-//            if (periodNum > 1) {
-//                if(Integer.valueOf(1).equals(dto.getReceiveIntervalUnit())) {
-//                    lastReceiveDate = firstReceiveDate.plusDays(dto.getReceiveInterval() * periodNum);
-//                } else {
-//                    lastReceiveDate = firstReceiveDate.plusMonths(dto.getReceiveInterval() * periodNum);
-//                }
-//            }
-//            leaveOrderAmount = order.getOrderAmount().multiply(periodAmount);
-//            if (Integer.valueOf(periodNum).equals(dto.getReceivePeriodTotal())) {
-//                record.setPlanReceiveAmount(leaveOrderAmount);
-//            } else {
-//                record.setPlanReceiveAmount(periodAmount);
-//            }
-//            record.setPeriodNum(periodNum);
-//            record.setPeriodTotal(receivePeriodTotal);
-//            record.setPlanReceiveDate(lastReceiveDate);
-//            record.setOrderId(dto.getOrderId());
-//        }
-//
-//        return Result.ok();
-//    }
-}

+ 0 - 94
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/OrderReceiveRecordApiController.java

@@ -1,94 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CodeGenerateInterface;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.util.generate.CodeGenerate;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.enums.ApproveStatusEnum;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.OrderReceiveRecordEntity;
-import com.storlead.sales.service.finance.OrderReceiveRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * @program: sp-sales-platform
- * @description:
- * @author: chenkq
- * @create: 2024-07-31 14:31
- */
-@Api(tags = "财务: 回款记录")
-@RestController
-@RequestMapping("/finance/receive")
-public class OrderReceiveRecordApiController {
-    @Resource
-    private OrderReceiveRecordService receiveRecordService;
-
-    @ApiOperation(value = "获取回款记录")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-        IPage<OrderReceiveRecordEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<OrderReceiveRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderReceiveRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<OrderReceiveRecordEntity> pageList = receiveRecordService.page(page,queryWrapper);
-        return Result.result(pageList);
-    }
-
-    @ApiOperation(value = "保存汇款记录")
-    @PostMapping( "/save")
-    public Result<?> save(@RequestBody OrderReceiveRecordEntity record) {
-        if (Objects.isNull(record.getId())) {
-            record.setDataCode(CodeGenerate.generate12Code(CodeGenerateInterface.ORDER_RECEIVE_CODE));
-        }
-        receiveRecordService.saveOrUpdate(record);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "获取详情")
-    @PostMapping( "/get_detial")
-    public Result<?> getDetail(Long id) {
-        OrderReceiveRecordEntity record = receiveRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("回款记录不存在");
-        }
-        return Result.ok(record);
-    }
-
-
-    @ApiOperation(value = "删除回款记录")
-    @PostMapping( "/delete")
-    public Result<?> delete(Long id) {
-        OrderReceiveRecordEntity record = receiveRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("回款记录不存在");
-        }
-        if (ApproveStatusEnum.APPROVE_NO_PASS.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.APPROVE_ING.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.NOT_SUBMIT_APPROVE.getCode().equals(record.getApproveStatus())
-        ) {
-            receiveRecordService.lgDelete(id);
-        } else {
-            return Result.error("回款记录已审批通过,不能删除");
-        }
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "批量除发票")
-    @PostMapping( "/deleteIds")
-    public Result<?> deleteIds(Long [] ids) {
-        receiveRecordService.lgDelete(Arrays.asList(ids));
-        return Result.ok();
-    }
-
-}

+ 0 - 93
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/OrderRefundRecordApiController.java

@@ -1,93 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CodeGenerateInterface;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.util.generate.CodeGenerate;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.enums.ApproveStatusEnum;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.OrderRefundRecordEntity;
-import com.storlead.sales.service.finance.OrderRefundRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * @program: sp-sales-platform
- * @description: 退款管理
- * @author: chenkq
- * @create: 2024-07-31 14:53
- */
-@Api(tags = "财务: 退款")
-@RestController
-@RequestMapping("/finance/refund")
-public class OrderRefundRecordApiController {
-    @Resource
-    private OrderRefundRecordService refundRecordService;
-
-    @ApiOperation(value = "获取退费记录")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-        IPage<OrderRefundRecordEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<OrderRefundRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(OrderRefundRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<OrderRefundRecordEntity> pageList = refundRecordService.page(page,queryWrapper);
-        return Result.result(pageList);
-    }
-
-    @ApiOperation(value = "保存退费记录")
-    @PostMapping( "/save")
-    public Result<?> save(@RequestBody OrderRefundRecordEntity record) {
-        if (Objects.isNull(record.getId())) {
-            record.setDataCode(CodeGenerate.generate12Code(CodeGenerateInterface.ORDER_REFUND_CODE));
-        }
-        refundRecordService.saveOrUpdate(record);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "获取详情")
-    @PostMapping( "/get_detial")
-    public Result<?> getDetail(Long id) {
-        OrderRefundRecordEntity record = refundRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("回款记录不存在");
-        }
-        return Result.ok(record);
-    }
-
-
-    @ApiOperation(value = "删除退费记录")
-    @PostMapping( "/delete")
-    public Result<?> delete(Long id) {
-        OrderRefundRecordEntity record = refundRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("退费记录不存在");
-        }
-        if (ApproveStatusEnum.APPROVE_NO_PASS.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.APPROVE_ING.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.NOT_SUBMIT_APPROVE.getCode().equals(record.getApproveStatus())
-        ) {
-            refundRecordService.lgDelete(id);
-        } else {
-            return Result.error("回款记录已审批通过,不能删除");
-        }
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "批量除退费记录")
-    @PostMapping( "/deleteIds")
-    public Result<?> deleteIds(Long [] ids) {
-        refundRecordService.lgDelete(Arrays.asList(ids));
-        return Result.ok();
-    }
-}

+ 0 - 94
java/storlead-sasa/storlead-sales/src/main/java/com/storlead/sales/controller/finance/ReimburseBillApiController.java

@@ -1,94 +0,0 @@
-package com.storlead.sales.controller.finance;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.storlead.framework.common.constant.CodeGenerateInterface;
-import com.storlead.framework.common.constant.CommonConstant;
-import com.storlead.framework.common.util.generate.CodeGenerate;
-import com.storlead.framework.common.result.Result;
-import com.storlead.sales.enums.ApproveStatusEnum;
-import com.storlead.sales.pojo.dto.finance.OrderReceivePlanQueryDTO;
-import com.storlead.sales.pojo.entity.finance.ReimburseBillRecordEntity;
-import com.storlead.sales.service.finance.ReimburseBillRecordService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * @program: sp-sales-platform
- * @description:
- * @author: chenkq
- * @create: 2024-07-31 15:14
- */
-@Api(tags = "财务: 报销")
-@RestController
-@RequestMapping("/finance/reimburse")
-public class ReimburseBillApiController {
-
-    @Resource
-    private ReimburseBillRecordService reimburseBillRecordService;
-
-    @ApiOperation(value = "获取报销记录")
-    @PostMapping( "/list_page")
-    public Result<?> list(@RequestBody OrderReceivePlanQueryDTO dto) {
-        IPage<ReimburseBillRecordEntity> page = new Page<>(dto.getPageIndex(),dto.getPageSize());
-        LambdaQueryWrapper<ReimburseBillRecordEntity> queryWrapper = new LambdaQueryWrapper();
-        queryWrapper.eq(ReimburseBillRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        IPage<ReimburseBillRecordEntity> pageList = reimburseBillRecordService.page(page,queryWrapper);
-        return Result.result(pageList);
-    }
-
-    @ApiOperation(value = "保存报销记录")
-    @PostMapping( "/save")
-    public Result<?> save(@RequestBody ReimburseBillRecordEntity record) {
-        if (Objects.isNull(record.getId())) {
-            record.setDataCode(CodeGenerate.generate12Code(CodeGenerateInterface.ORDER_REIMBURSE_BILL_CODE));
-        }
-        reimburseBillRecordService.saveOrUpdate(record);
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "获取详情")
-    @PostMapping( "/get_detial")
-    public Result<?> getDetail(Long id) {
-        ReimburseBillRecordEntity record = reimburseBillRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("费用记录不存在");
-        }
-        return Result.ok(record);
-    }
-
-
-    @ApiOperation(value = "删除报销记录")
-    @PostMapping( "/delete")
-    public Result<?> delete(Long id) {
-        ReimburseBillRecordEntity record = reimburseBillRecordService.getById(id);
-        if (Objects.isNull(record)) {
-            return Result.error("报销记录不存在");
-        }
-        if (ApproveStatusEnum.APPROVE_NO_PASS.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.APPROVE_ING.getCode().equals(record.getApproveStatus())
-                || ApproveStatusEnum.NOT_SUBMIT_APPROVE.getCode().equals(record.getApproveStatus())
-        ) {
-            reimburseBillRecordService.lgDelete(id);
-        } else {
-            return Result.error("报销记录已审批通过,不能删除");
-        }
-        return Result.ok();
-    }
-
-    @ApiOperation(value = "批量删除报销记录")
-    @PostMapping( "/deleteIds")
-    public Result<?> deleteIds(Long [] ids) {
-        reimburseBillRecordService.lgDelete(Arrays.asList(ids));
-        return Result.ok();
-    }
-}