Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Business logic code for newly added customer information module #96

Merged
merged 8 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions api/src/main/kotlin/com/wansensoft/api/basic/CustomerController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.wansensoft.api.basic

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.wansensoft.dto.basic.*
import com.wansensoft.service.basic.CustomerService
import com.wansensoft.utils.response.Response
import com.wansensoft.vo.basic.CustomerVO
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/basic/customer")
class CustomerController (private val customerService: CustomerService){

@PostMapping("/list")
fun customerList(@RequestBody queryCustomerDTO: QueryCustomerDTO?) : Response<Page<CustomerVO>> {
return customerService.getCustomerList(queryCustomerDTO)
}

@PostMapping("/addOrUpdate")
fun addOrUpdateCustomer(@RequestBody addOrUpdateCustomerDTO: AddOrUpdateCustomerDTO) : Response<String> {
return customerService.addOrUpdateCustomer(addOrUpdateCustomerDTO)
}

@DeleteMapping("/deleteBatch")
fun deleteBatchCustomer(@RequestParam ids: List<Long>?) : Response<String> {
return customerService.deleteCustomer(ids)
}

@PostMapping("/updateStatus")
fun updateCustomerStatus(@RequestParam("ids") ids: List<Long>?, @RequestParam("status") status: Int?) : Response<String> {
return customerService.updateCustomerStatus(ids, status)
}
}
12 changes: 12 additions & 0 deletions api/src/main/kotlin/com/wansensoft/api/basic/SupplierController.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* 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.wansensoft.api.basic

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
Expand Down
8 changes: 8 additions & 0 deletions dao/src/main/java/com/wansensoft/mappers/CustomerMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wansensoft.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wansensoft.entities.basic.Customer;

public interface CustomerMapper extends BaseMapper<Customer> {

}
5 changes: 5 additions & 0 deletions dao/src/main/resources/mapper_xml/CustomerMapper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wansensoft.mappers.CustomerMapper">

</mapper>
145 changes: 145 additions & 0 deletions domain/src/main/java/com/wansensoft/entities/basic/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
package com.wansensoft.entities.basic;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("customer")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Customer implements Serializable {

@Serial
private static final long serialVersionUID = 15791051662L;

/**
* 主键
*/
@TableId(value = "id")
private Long id;

/**
* 租户id
*/
private Long tenantId;

/**
* 客户名称
*/
private String customerName;

/**
* 联系人
*/
private String contact;

/**
* 手机
*/
private String phoneNumber;

/**
* 电子邮箱
*/
private String email;

/**
* 一季度应收账款
*/
private BigDecimal firstQuarterAccountReceivable;

/**
* 二季度应收账款
*/
private BigDecimal secondQuarterAccountReceivable;

/**
* 三季度应收账款
*/
private BigDecimal thirdQuarterAccountReceivable;

/**
* 四季度应收账款
*/
private BigDecimal fourthQuarterAccountReceivable;

/**
* 累计应收账款
*/
private BigDecimal totalAccountReceivable;

/**
* 地址
*/
private String address;

/**
* 纳税人识别号
*/
private String taxNumber;

/**
* 开户行
*/
private String bankName;

/**
* 账号
*/
private String accountNumber;

/**
* 税率
*/
private BigDecimal taxRate;

/**
* 状态(0-启用,1-停用)默认启用
*/
private Integer status;

/**
* 备注
*/
private String remark;

/**
* 排序
*/
private Integer sort;

/**
* 创建时间
*/
private LocalDateTime createTime;

/**
* 修改时间
*/
private LocalDateTime updateTime;

/**
* 创建人
*/
private Long createBy;

/**
* 修改人
*/
private Long updateBy;

/**
* 删除标记,0未删除,1删除
*/
private Integer deleteFlag;
}
29 changes: 2 additions & 27 deletions domain/src/main/java/com/wansensoft/entities/basic/Supplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class Supplier implements Serializable {
private Integer isSystem;

/**
* 类型
* 类型 (预留字段)
*/
private String type;

Expand All @@ -86,26 +86,6 @@ public class Supplier implements Serializable {
*/
private Integer status;

/**
* 一季度应收账款
*/
private BigDecimal firstQuarterAccountReceivable;

/**
* 二季度应收账款
*/
private BigDecimal secondQuarterAccountReceivable;

/**
* 三季度应收账款
*/
private BigDecimal thirdQuarterAccountReceivable;

/**
* 四季度应收账款
*/
private BigDecimal fourthQuarterAccountReceivable;

/**
* 一季度应付账款
*/
Expand All @@ -126,11 +106,6 @@ public class Supplier implements Serializable {
*/
private BigDecimal fourthQuarterAccountPayment;

/**
* 累计应收账款
*/
private BigDecimal totalAccountReceivable;

/**
* 累计应付账款
*/
Expand Down Expand Up @@ -164,7 +139,7 @@ public class Supplier implements Serializable {
/**
* 账号
*/
private Long accountNumber;
private String accountNumber;

/**
* 税率
Expand Down
13 changes: 12 additions & 1 deletion domain/src/main/kotlin/com/wansensoft/NoArg.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* 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.wansensoft

annotation class NoArg
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.wansensoft.dto.basic

import com.wansensoft.NoArg
import java.math.BigDecimal

@NoArg
data class AddOrUpdateCustomerDTO(

val id: Long?,

var customerName: String,

var contact: String?,

var phoneNumber: String?,

var email: String?,

var firstQuarterAccountReceivable: BigDecimal?,

var secondQuarterAccountReceivable: BigDecimal?,

var thirdQuarterAccountReceivable: BigDecimal?,

var fourthQuarterAccountReceivable: BigDecimal?,

var totalAccountReceivable: BigDecimal?,

var address: String?,

var taxNumber: String?,

var bankName: String?,

var accountNumber: String?,

var taxRate: BigDecimal?,

var status: Int?,

var remark: String?,

var sort: Int?,
)
16 changes: 0 additions & 16 deletions domain/src/main/kotlin/com/wansensoft/dto/basic/AddSupplierDTO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ data class AddSupplierDTO (
* 状态
*/
val status: Int? = null,
/**
* 第一季度应收账款
*/
val firstQuarterAccountReceivable: Double? = null,
/**
* 第二季度应收账款
*/
val secondQuarterAccountReceivable: Double? = null,
/**
* 第三季度应收账款
*/
val thirdQuarterAccountReceivable: Double? = null,
/**
* 第四季度应收账款
*/
val fourthQuarterAccountReceivable: Double? = null,
/**
* 第一季度应付账款
*/
Expand Down
Loading