Skip to content

Commit

Permalink
Merge pull request #291 from Jzow/master
Browse files Browse the repository at this point in the history
Fix supplier customer and member module filtering and export data interface
  • Loading branch information
wansenai-bot authored Dec 14, 2023
2 parents 6a20640 + dabde21 commit c31471a
Show file tree
Hide file tree
Showing 22 changed files with 282 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@ public Response<String> uploadExclsData(@RequestParam("file") MultipartFile file
return commonService.uploadExclsData(file);
}

/**
* @deprecatedjavadoc
*
* At present, exporting requires filtering based on query conditions, and the exportExcel method exports all data.
* It is more of a universal export method, and the implementation class of the method needs to match the array
* index mapping of exported columns, which is very complex. Therefore, it will be removed in the next version
*
* @param type export type name
* @param response HttpServletResponse object file
*/
@GetMapping("/export/excel")
@Deprecated(since = "2.1.0", forRemoval = true)
public void exportExcel(@RequestParam("type") String type, HttpServletResponse response) {
try {
File file = commonService.exportExcel(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
package com.wansenai.api.basic

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.wansenai.dto.basic.*
import com.wansenai.dto.basic.QueryCustomerDTO
import com.wansenai.dto.basic.AddOrUpdateCustomerDTO
import com.wansenai.service.basic.CustomerService
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.CustomerVO
import jakarta.servlet.http.HttpServletResponse
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
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.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.ModelAttribute

@RestController
@RequestMapping("/basic/customer")
Expand All @@ -36,7 +39,7 @@ class CustomerController (private val customerService: CustomerService){

@GetMapping("list")
fun customerList() : Response<List<CustomerVO>> {
return customerService.getCustomerList()
return customerService.getCustomerList(null)
}

@PostMapping("/addOrUpdate")
Expand All @@ -53,4 +56,9 @@ class CustomerController (private val customerService: CustomerService){
fun updateCustomerStatus(@RequestParam("ids") ids: List<Long>?, @RequestParam("status") status: Int?) : Response<String> {
return customerService.updateCustomerStatus(ids, status)
}

@GetMapping("export")
fun export(@ModelAttribute queryCustomerDTO: QueryCustomerDTO, response: HttpServletResponse) {
customerService.exportCustomerData(queryCustomerDTO, response)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import com.wansenai.dto.basic.QueryMemberDTO
import com.wansenai.service.basic.MemberService
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.MemberVO
import jakarta.servlet.http.HttpServletResponse
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.ModelAttribute

@RestController
@RequestMapping("/basic/member")
Expand Down Expand Up @@ -52,6 +54,11 @@ class MemberController (private val memberService: MemberService){

@GetMapping("/list")
fun getMemberList() : Response<List<MemberVO>> {
return memberService.getMemberList()
return memberService.getMemberList(null)
}

@GetMapping("export")
fun export(@ModelAttribute queryMemberDTO: QueryMemberDTO, response: HttpServletResponse) {
memberService.exportMemberData(queryMemberDTO, response)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import com.wansenai.dto.basic.UpdateSupplierStatusDTO
import com.wansenai.service.basic.SupplierService
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.SupplierVO
import jakarta.servlet.http.HttpServletResponse
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
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.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.ModelAttribute

@RestController
@RequestMapping("/basic/supplier")
Expand All @@ -39,7 +41,7 @@ class SupplierController (private val supplierService: SupplierService){

@GetMapping("/list")
fun supplierList() : Response<List<SupplierVO>> {
return supplierService.getSupplierList()
return supplierService.getSupplierList(null)
}

@PostMapping("/add")
Expand All @@ -61,4 +63,9 @@ class SupplierController (private val supplierService: SupplierService){
fun updateSupplierStatus(@RequestBody updateSupplierStatusDTO: UpdateSupplierStatusDTO) : Response<String> {
return supplierService.updateSupplierStatus(updateSupplierStatusDTO)
}

@GetMapping("export")
fun export(@ModelAttribute querySupplierDTO: QuerySupplierDTO, response: HttpServletResponse) {
supplierService.exportSupplierData(querySupplierDTO, response)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public class Customer implements Serializable {
*/
private BigDecimal totalAccountReceivable;

/**
* 传真
*/
private String fax;

/**
* 地址
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ data class AddOrUpdateCustomerDTO(

var totalAccountReceivable: BigDecimal?,

var fax: String?,

var address: String?,

var taxNumber: String?,
Expand Down
20 changes: 20 additions & 0 deletions core/domain/src/main/kotlin/com/wansenai/vo/basic/CustomerVO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.wansenai.NoArg
import com.wansenai.bo.BigDecimalSerializerBO
import com.wansenai.utils.excel.ExcelExport
import java.math.BigDecimal
import java.time.LocalDateTime

Expand All @@ -25,42 +26,61 @@ data class CustomerVO (
@JsonFormat(shape = JsonFormat.Shape.STRING)
var id: Long?,

@ExcelExport(value = "客户", sort = 1)
var customerName: String?,

@ExcelExport(value = "联系人", sort = 2)
var contact: String?,

@ExcelExport(value = "手机号码", sort = 3)
var phoneNumber: String?,

@ExcelExport(value = "电子邮箱", sort = 4)
var email: String?,

@ExcelExport(value = "传真", sort = 5)
var fax: String?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "一季度收款", sort = 8)
var firstQuarterAccountReceivable: BigDecimal?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "二季度收款", sort = 9)
var secondQuarterAccountReceivable: BigDecimal?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "三季度收款", sort = 10)
var thirdQuarterAccountReceivable: BigDecimal?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "四季度收款", sort = 11)
var fourthQuarterAccountReceivable: BigDecimal?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "累计应收账款", sort = 12)
var totalAccountReceivable: BigDecimal?,

@ExcelExport(value = "地址", sort = 6)
var address: String?,

@ExcelExport(value = "纳税人识别号", sort = 13)
var taxNumber: String?,

@ExcelExport(value = "开户行", sort = 15)
var bankName: String?,

@ExcelExport(value = "银行账户", sort = 16)
var accountNumber: String?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "税率(%)", sort = 14)
var taxRate: BigDecimal?,

@ExcelExport(value = "状态", kv="0-启用;1-停用", sort = 7)
var status: Int?,

@ExcelExport(value = "备注", sort = 17)
var remark: String?,

var sort: Int?,
Expand Down
8 changes: 8 additions & 0 deletions core/domain/src/main/kotlin/com/wansenai/vo/basic/MemberVO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.wansenai.NoArg
import com.wansenai.bo.BigDecimalSerializerBO
import com.wansenai.utils.excel.ExcelExport
import java.math.BigDecimal
import java.time.LocalDateTime

Expand All @@ -25,19 +26,26 @@ data class MemberVO(
@JsonFormat(shape = JsonFormat.Shape.STRING)
var id: Long?,

@ExcelExport(value = "会原卡号", sort = 1)
var memberNumber: String?,

@ExcelExport(value = "会员名称", sort = 2)
var memberName: String?,

@ExcelExport(value = "手机号码", sort = 3)
var phoneNumber: String?,

@ExcelExport(value = "电子邮箱", sort = 4)
var email: String?,

@JsonSerialize(using = BigDecimalSerializerBO::class)
@ExcelExport(value = "预付款", sort = 5)
var advancePayment: BigDecimal?,

@ExcelExport(value = "状态", kv="0-启用;1-停用", sort = 6)
var status: Int?,

@ExcelExport(value = "备注", sort = 7)
var remark: String?,

var sort: Int?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ data class SupplierVO (
@ExcelExport(value = "电子邮箱", sort = 5)
var email: String?,

@ExcelExport(value = "状态", kv="0-启用;1-停用", sort = 7)
var status: Int,

@JsonSerialize(using = BigDecimalSerializerBO::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import com.wansenai.dto.basic.QueryCustomerDTO
import com.wansenai.entities.basic.Customer
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.CustomerVO
import jakarta.servlet.http.HttpServletResponse

interface CustomerService: IService<Customer> {

fun getCustomerPageList(queryCustomerDTO: QueryCustomerDTO?): Response<Page<CustomerVO>>

fun getCustomerList(): Response<List<CustomerVO>>
fun getCustomerList(queryCustomerDTO: QueryCustomerDTO?): Response<List<CustomerVO>>

fun addOrUpdateCustomer(addOrUpdateCustomerDTO: AddOrUpdateCustomerDTO): Response<String>

Expand All @@ -33,4 +34,6 @@ interface CustomerService: IService<Customer> {
fun updateCustomerStatus(ids: List<Long>?, status: Int?): Response<String>

fun batchAddCustomer(customers: List<Customer>?): Boolean

fun exportCustomerData(queryCustomerDTO: QueryCustomerDTO?, response: HttpServletResponse)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.wansenai.dto.basic.QueryMemberDTO
import com.wansenai.entities.basic.Member
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.MemberVO
import jakarta.servlet.http.HttpServletResponse
import java.math.BigDecimal

interface MemberService: IService<Member> {
Expand All @@ -33,9 +34,11 @@ interface MemberService: IService<Member> {

fun batchAddMember(members: List<Member>?): Boolean

fun getMemberList(): Response<List<MemberVO>>
fun getMemberList(memberDTO: QueryMemberDTO?): Response<List<MemberVO>>

fun updateAdvanceChargeAmount(memberId: Long?, amount: BigDecimal): Boolean

fun getMemberById(memberId: Long?): Member?

fun exportMemberData(memberDTO: QueryMemberDTO?, response: HttpServletResponse)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import com.wansenai.dto.basic.UpdateSupplierStatusDTO
import com.wansenai.entities.basic.Supplier
import com.wansenai.utils.response.Response
import com.wansenai.vo.basic.SupplierVO
import jakarta.servlet.http.HttpServletResponse

interface SupplierService : IService<Supplier> {

fun getSupplierPageList(supplier: QuerySupplierDTO?): Response<Page<SupplierVO>>

fun addSupplier(supplier: AddSupplierDTO?): Response<String>

fun getSupplierList(): Response<List<SupplierVO>>
fun getSupplierList(supplier: QuerySupplierDTO?): Response<List<SupplierVO>>

/**
* 内部使用方法
Expand All @@ -40,4 +41,6 @@ interface SupplierService : IService<Supplier> {
fun deleteSupplier(ids: List<Long>?): Response<String>

fun updateSupplierStatus(updateSupplierStatusDTO: UpdateSupplierStatusDTO?): Response<String>

fun exportSupplierData(querySupplierDTO: QuerySupplierDTO, response: HttpServletResponse)
}
Loading

0 comments on commit c31471a

Please sign in to comment.