Skip to content

Commit

Permalink
Merge pull request #220 from Jzow/master
Browse files Browse the repository at this point in the history
Add expense receipt api and data object, views
  • Loading branch information
Jzow authored Nov 22, 2023
2 parents 157c766 + 96d58d6 commit 7e27781
Show file tree
Hide file tree
Showing 19 changed files with 1,919 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,56 @@
*/
package com.wansenai.api.financial;

import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.dto.financial.AddOrUpdateExpenseDTO;
import com.wansenai.dto.financial.QueryExpenseDTO;
import com.wansenai.service.financial.ExpenseReceiptService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.financial.ExpenseDetailVO;
import com.wansenai.vo.financial.ExpenseVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@RestController
@RequestMapping("/financial/expense")
public class ExpenseReceiptController {

private final ExpenseReceiptService expenseReceiptService;

public ExpenseReceiptController(ExpenseReceiptService expenseReceiptService) {
this.expenseReceiptService = expenseReceiptService;
}

@PostMapping("addOrUpdate")
public Response<String> addOrUpdateExpenseReceipt(@RequestBody AddOrUpdateExpenseDTO addOrUpdateExpenseDTO) {
return expenseReceiptService.addOrUpdateExpenseReceipt(addOrUpdateExpenseDTO);
}

@PostMapping("pageList")
public Response<Page<ExpenseVO>> getExpenseReceiptPageList(@RequestBody QueryExpenseDTO queryExpenseDTO) {
return expenseReceiptService.getExpenseReceiptPageList(queryExpenseDTO);
}

@GetMapping("getDetailById/{id}")
public Response<ExpenseDetailVO> getExpenseReceiptDetailById(@PathVariable("id") Long id) {
return expenseReceiptService.getExpenseReceiptDetail(id);
}

@PutMapping("deleteByIds")
public Response<String> deleteExpenseReceiptByIds(@RequestParam("ids") List<Long> ids) {
return expenseReceiptService.deleteBatchExpenseReceipt(ids);
}

@PutMapping("updateStatusByIds")
public Response<String> updateExpenseReceiptStatusByIds(@RequestParam("ids") List<Long> ids, @RequestParam("status") Integer status) {
return expenseReceiptService.updateExpenseReceiptStatus(ids, status);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.dto.financial;

import com.wansenai.bo.FileDataBO;
import com.wansenai.bo.IncomeExpenseBO;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Data
public class AddOrUpdateExpenseDTO {

private Long id;

private Long relatedPersonId;

private String receiptDate;

private String receiptNumber;

private Long financialPersonId;

private Long expenseAccountId;

private BigDecimal expenseAmount;

private String remark;

private List<IncomeExpenseBO> tableData;

private List<FileDataBO> files;

private Integer status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.dto.financial;

import lombok.Data;

@Data
public class QueryExpenseDTO {

private String receiptNumber;

private Long relatedPersonId;

private Long financialPersonId;

private Long accountId;

private Integer status;

private String remark;

private String startDate;

private String endDate;

private Integer page;

private Integer pageSize;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.vo.financial;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.wansenai.bo.BigDecimalSerializerBO;
import com.wansenai.bo.FileDataBO;
import com.wansenai.bo.IncomeExpenseBO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExpenseDetailVO {

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long relatedPersonId;

private String relatedPersonName;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;

private String receiptNumber;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long financialPersonId;

private String financialPersonName;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long expenseAccountId;

private String expenseAccountName;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal expenseAmount;

private String remark;

private List<IncomeExpenseBO> tableData;

private List<FileDataBO> files;

private Integer status;
}
53 changes: 53 additions & 0 deletions core/domain/src/main/java/com/wansenai/vo/financial/ExpenseVO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.vo.financial;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.wansenai.bo.BigDecimalSerializerBO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExpenseVO {

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;

// supplier or customer or member
private String name;

private String receiptNumber;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;

private String financialPerson;

private String expenseAccountName;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal expenseAmount;

private String remark;

private Integer status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ public Response<String> generateSnowflakeId(String type) {
case "商品" -> "P";
case "订单" -> "O";
case "收入单" -> "SRD";
case "支出单" -> "ZCD";
case "采购单" -> "CGD";
case "销售单" -> "XSD";
case "退货单" -> "THD";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,26 @@
*/
package com.wansenai.service.financial;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wansenai.dto.financial.AddOrUpdateExpenseDTO;
import com.wansenai.dto.financial.QueryExpenseDTO;
import com.wansenai.entities.financial.FinancialMain;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.financial.ExpenseDetailVO;
import com.wansenai.vo.financial.ExpenseVO;

import java.util.List;

public interface ExpenseReceiptService extends IService<FinancialMain> {

Response<Page<ExpenseVO>> getExpenseReceiptPageList(QueryExpenseDTO queryExpenseDTO);

Response<ExpenseDetailVO> getExpenseReceiptDetail(Long id);

Response<String> addOrUpdateExpenseReceipt(AddOrUpdateExpenseDTO addOrUpdateExpenseDTO);

Response<String> deleteBatchExpenseReceipt(List<Long> ids);

Response<String> updateExpenseReceiptStatus(List<Long> ids, Integer status);
}
Loading

0 comments on commit 7e27781

Please sign in to comment.