From e6d321aff026202df0645e24552bd0e4910a8211 Mon Sep 17 00:00:00 2001 From: fNumb <326122450@qq.com> Date: Thu, 10 Aug 2023 00:00:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/bs/enums/ErrorCodeConstants.java | 1 + .../customer/CustomerCompanyController.java | 102 ++++++++++++++++++ .../customer/vo/CustomerCompanyBaseVO.java | 76 +++++++++++++ .../vo/CustomerCompanyCreateReqVO.java | 14 +++ .../customer/vo/CustomerCompanyExcelVO.java | 75 +++++++++++++ .../vo/CustomerCompanyExportReqVO.java | 70 ++++++++++++ .../customer/vo/CustomerCompanyPageReqVO.java | 72 +++++++++++++ .../customer/vo/CustomerCompanyRespVO.java | 19 ++++ .../vo/CustomerCompanyUpdateReqVO.java | 18 ++++ .../customer/CustomerCompanyConvert.java | 37 +++++++ .../customer/CustomerCompanyDO.java | 97 +++++++++++++++++ .../mysql/customer/CustomerCompanyMapper.java | 65 +++++++++++ .../customer/CustomerCompanyService.java | 74 +++++++++++++ .../customer/CustomerCompanyServiceImpl.java | 85 +++++++++++++++ 14 files changed, 805 insertions(+) create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/CustomerCompanyController.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyBaseVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyCreateReqVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExcelVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExportReqVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyPageReqVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyRespVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyUpdateReqVO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/customer/CustomerCompanyConvert.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/customer/CustomerCompanyDO.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/customer/CustomerCompanyMapper.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyService.java create mode 100644 yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyServiceImpl.java diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java index 1fb76588..6e2694be 100644 --- a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java @@ -13,4 +13,5 @@ public interface ErrorCodeConstants { ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在"); ErrorCode BUDGET_NOT_EXISTS = new ErrorCode(200400, "预算管理不存在"); ErrorCode FEE_MANAGE_NOT_EXISTS = new ErrorCode(200500, "费用控制不存在"); + ErrorCode CUSTOMER_COMPANY_NOT_EXISTS = new ErrorCode(200600, "客户公司不存在"); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/CustomerCompanyController.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/CustomerCompanyController.java new file mode 100644 index 00000000..f27acb10 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/CustomerCompanyController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer; + +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.*; +import cn.iocoder.yudao.module.bs.convert.customer.CustomerCompanyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO; +import cn.iocoder.yudao.module.bs.service.customer.CustomerCompanyService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 客户公司信息") +@RestController +@RequestMapping("/bs/customer-company") +@Validated +public class CustomerCompanyController { + + @Resource + private CustomerCompanyService customerCompanyService; + + @PostMapping("/create") + @Operation(summary = "创建客户公司信息") + @PreAuthorize("@ss.hasPermission('bs:customer-company:create')") + public CommonResult createCustomerCompany(@Valid @RequestBody CustomerCompanyCreateReqVO createReqVO) { + return success(customerCompanyService.createCustomerCompany(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新客户公司信息") + @PreAuthorize("@ss.hasPermission('bs:customer-company:update')") + public CommonResult updateCustomerCompany(@Valid @RequestBody CustomerCompanyUpdateReqVO updateReqVO) { + customerCompanyService.updateCustomerCompany(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除客户公司信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('bs:customer-company:delete')") + public CommonResult deleteCustomerCompany(@RequestParam("id") Long id) { + customerCompanyService.deleteCustomerCompany(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得客户公司信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bs:customer-company:query')") + public CommonResult getCustomerCompany(@RequestParam("id") Long id) { + CustomerCompanyDO customerCompany = customerCompanyService.getCustomerCompany(id); + return success(CustomerCompanyConvert.INSTANCE.convert(customerCompany)); + } + + @GetMapping("/list") + @Operation(summary = "获得客户公司信息列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('bs:customer-company:query')") + public CommonResult> getCustomerCompanyList(@RequestParam("ids") Collection ids) { + List list = customerCompanyService.getCustomerCompanyList(ids); + return success(CustomerCompanyConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得客户公司信息分页") + @PreAuthorize("@ss.hasPermission('bs:customer-company:query')") + public CommonResult> getCustomerCompanyPage(@Valid CustomerCompanyPageReqVO pageVO) { + PageResult pageResult = customerCompanyService.getCustomerCompanyPage(pageVO); + return success(CustomerCompanyConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出客户公司信息 Excel") + @PreAuthorize("@ss.hasPermission('bs:customer-company:export')") + @OperateLog(type = EXPORT) + public void exportCustomerCompanyExcel(@Valid CustomerCompanyExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = customerCompanyService.getCustomerCompanyList(exportReqVO); + // 导出 Excel + List datas = CustomerCompanyConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "客户公司信息.xls", "数据", CustomerCompanyExcelVO.class, datas); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyBaseVO.java new file mode 100644 index 00000000..af939955 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyBaseVO.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 客户公司信息 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class CustomerCompanyBaseVO { + + @Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @NotNull(message = "公司名称不能为空") + private String companyName; + + @Schema(description = "公司编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "公司编码不能为空") + private String companyNumber; + + @Schema(description = "企业性质", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "企业性质不能为空") + private String companyType; + + @Schema(description = "法人代表") + private String legalPerson; + + @Schema(description = "联系方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "联系方式不能为空") + private String phone; + + @Schema(description = "统一社会信用代码") + private String creditCode; + + @Schema(description = "区域编码") + private String areaCode; + + @Schema(description = "企业地址") + private String address; + + @Schema(description = "营业期限(起)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime businessStratDate; + + @Schema(description = "营业期限(止)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime businessEndDate; + + @Schema(description = "银行户名", example = "张三") + private String bankName; + + @Schema(description = "银行账号") + private String bankNumber; + + @Schema(description = "开户行名称") + private String bankOfDeposit; + + @Schema(description = "status", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private String files; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyCreateReqVO.java new file mode 100644 index 00000000..85204013 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 客户公司信息创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CustomerCompanyCreateReqVO extends CustomerCompanyBaseVO { + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExcelVO.java new file mode 100644 index 00000000..1f82bfc2 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExcelVO.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 客户公司信息 Excel VO + * + * @author 芋道源码 + */ +@Data +public class CustomerCompanyExcelVO { + + @ExcelProperty("id") + private Long id; + + @ExcelProperty("公司名称") + private String companyName; + + @ExcelProperty("公司编码") + private String companyNumber; + + @ExcelProperty("企业性质") + private String companyType; + + @ExcelProperty("法人代表") + private String legalPerson; + + @ExcelProperty("联系方式") + private String phone; + + @ExcelProperty("统一社会信用代码") + private String creditCode; + + @ExcelProperty("区域编码") + private String areaCode; + + @ExcelProperty("企业地址") + private String address; + + @ExcelProperty("营业期限(起)") + private LocalDateTime businessStratDate; + + @ExcelProperty("营业期限(止)") + private LocalDateTime businessEndDate; + + @ExcelProperty("银行户名") + private String bankName; + + @ExcelProperty("银行账号") + private String bankNumber; + + @ExcelProperty("开户行名称") + private String bankOfDeposit; + + @ExcelProperty("status") + private String status; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("附件") + private String files; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExportReqVO.java new file mode 100644 index 00000000..defe9e70 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyExportReqVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 客户公司信息 Excel 导出 Request VO,参数和 CustomerCompanyPageReqVO 是一致的") +@Data +public class CustomerCompanyExportReqVO { + + @Schema(description = "公司名称", example = "李四") + private String companyName; + + @Schema(description = "公司编码") + private String companyNumber; + + @Schema(description = "企业性质", example = "2") + private String companyType; + + @Schema(description = "法人代表") + private String legalPerson; + + @Schema(description = "联系方式") + private String phone; + + @Schema(description = "统一社会信用代码") + private String creditCode; + + @Schema(description = "区域编码") + private String areaCode; + + @Schema(description = "企业地址") + private String address; + + @Schema(description = "营业期限(起)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] businessStratDate; + + @Schema(description = "营业期限(止)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] businessEndDate; + + @Schema(description = "银行户名", example = "张三") + private String bankName; + + @Schema(description = "银行账号") + private String bankNumber; + + @Schema(description = "开户行名称") + private String bankOfDeposit; + + @Schema(description = "status", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private String files; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyPageReqVO.java new file mode 100644 index 00000000..1823b850 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyPageReqVO.java @@ -0,0 +1,72 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 客户公司信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CustomerCompanyPageReqVO extends PageParam { + + @Schema(description = "公司名称", example = "李四") + private String companyName; + + @Schema(description = "公司编码") + private String companyNumber; + + @Schema(description = "企业性质", example = "2") + private String companyType; + + @Schema(description = "法人代表") + private String legalPerson; + + @Schema(description = "联系方式") + private String phone; + + @Schema(description = "统一社会信用代码") + private String creditCode; + + @Schema(description = "区域编码") + private String areaCode; + + @Schema(description = "企业地址") + private String address; + + @Schema(description = "营业期限(起)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] businessStratDate; + + @Schema(description = "营业期限(止)") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] businessEndDate; + + @Schema(description = "银行户名", example = "张三") + private String bankName; + + @Schema(description = "银行账号") + private String bankNumber; + + @Schema(description = "开户行名称") + private String bankOfDeposit; + + @Schema(description = "status", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private String files; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyRespVO.java new file mode 100644 index 00000000..bada5688 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 客户公司信息 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CustomerCompanyRespVO extends CustomerCompanyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24144") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyUpdateReqVO.java new file mode 100644 index 00000000..dec66cf2 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/customer/vo/CustomerCompanyUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.bs.controller.admin.customer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 客户公司信息更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CustomerCompanyUpdateReqVO extends CustomerCompanyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24144") + @NotNull(message = "id不能为空") + private Long id; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/customer/CustomerCompanyConvert.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/customer/CustomerCompanyConvert.java new file mode 100644 index 00000000..742df6a9 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/customer/CustomerCompanyConvert.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.bs.convert.customer; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExcelVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyRespVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 客户公司信息 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface CustomerCompanyConvert { + + CustomerCompanyConvert INSTANCE = Mappers.getMapper(CustomerCompanyConvert.class); + + CustomerCompanyDO convert(CustomerCompanyCreateReqVO bean); + + CustomerCompanyDO convert(CustomerCompanyUpdateReqVO bean); + + CustomerCompanyRespVO convert(CustomerCompanyDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/customer/CustomerCompanyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/customer/CustomerCompanyDO.java new file mode 100644 index 00000000..2b3bec7c --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/customer/CustomerCompanyDO.java @@ -0,0 +1,97 @@ +package cn.iocoder.yudao.module.bs.dal.dataobject.customer; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 客户公司信息 DO + * + * @author 芋道源码 + */ +@TableName("bs_customer_company") +@KeySequence("bs_customer_company_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CustomerCompanyDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 公司名称 + */ + private String companyName; + /** + * 公司编码 + */ + private String companyNumber; + /** + * 企业性质 + */ + private String companyType; + /** + * 法人代表 + */ + private String legalPerson; + /** + * 联系方式 + */ + private String phone; + /** + * 统一社会信用代码 + */ + private String creditCode; + /** + * 区域编码 + */ + private String areaCode; + /** + * 企业地址 + */ + private String address; + /** + * 营业期限(起) + */ + private LocalDateTime businessStratDate; + /** + * 营业期限(止) + */ + private LocalDateTime businessEndDate; + /** + * 银行户名 + */ + private String bankName; + /** + * 银行账号 + */ + private String bankNumber; + /** + * 开户行名称 + */ + private String bankOfDeposit; + /** + * status + */ + private String status; + /** + * 备注 + */ + private String remark; + /** + * 附件 + */ + private String files; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/customer/CustomerCompanyMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/customer/CustomerCompanyMapper.java new file mode 100644 index 00000000..9840f50a --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/customer/CustomerCompanyMapper.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.bs.dal.mysql.customer; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户公司信息 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface CustomerCompanyMapper extends BaseMapperX { + + default PageResult selectPage(CustomerCompanyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(CustomerCompanyDO::getCompanyName, reqVO.getCompanyName()) + .eqIfPresent(CustomerCompanyDO::getCompanyNumber, reqVO.getCompanyNumber()) + .eqIfPresent(CustomerCompanyDO::getCompanyType, reqVO.getCompanyType()) + .eqIfPresent(CustomerCompanyDO::getLegalPerson, reqVO.getLegalPerson()) + .eqIfPresent(CustomerCompanyDO::getPhone, reqVO.getPhone()) + .eqIfPresent(CustomerCompanyDO::getCreditCode, reqVO.getCreditCode()) + .eqIfPresent(CustomerCompanyDO::getAreaCode, reqVO.getAreaCode()) + .eqIfPresent(CustomerCompanyDO::getAddress, reqVO.getAddress()) + .betweenIfPresent(CustomerCompanyDO::getBusinessStratDate, reqVO.getBusinessStratDate()) + .betweenIfPresent(CustomerCompanyDO::getBusinessEndDate, reqVO.getBusinessEndDate()) + .likeIfPresent(CustomerCompanyDO::getBankName, reqVO.getBankName()) + .eqIfPresent(CustomerCompanyDO::getBankNumber, reqVO.getBankNumber()) + .eqIfPresent(CustomerCompanyDO::getBankOfDeposit, reqVO.getBankOfDeposit()) + .eqIfPresent(CustomerCompanyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(CustomerCompanyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(CustomerCompanyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(CustomerCompanyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(CustomerCompanyDO::getId)); + } + + default List selectList(CustomerCompanyExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(CustomerCompanyDO::getCompanyName, reqVO.getCompanyName()) + .eqIfPresent(CustomerCompanyDO::getCompanyNumber, reqVO.getCompanyNumber()) + .eqIfPresent(CustomerCompanyDO::getCompanyType, reqVO.getCompanyType()) + .eqIfPresent(CustomerCompanyDO::getLegalPerson, reqVO.getLegalPerson()) + .eqIfPresent(CustomerCompanyDO::getPhone, reqVO.getPhone()) + .eqIfPresent(CustomerCompanyDO::getCreditCode, reqVO.getCreditCode()) + .eqIfPresent(CustomerCompanyDO::getAreaCode, reqVO.getAreaCode()) + .eqIfPresent(CustomerCompanyDO::getAddress, reqVO.getAddress()) + .betweenIfPresent(CustomerCompanyDO::getBusinessStratDate, reqVO.getBusinessStratDate()) + .betweenIfPresent(CustomerCompanyDO::getBusinessEndDate, reqVO.getBusinessEndDate()) + .likeIfPresent(CustomerCompanyDO::getBankName, reqVO.getBankName()) + .eqIfPresent(CustomerCompanyDO::getBankNumber, reqVO.getBankNumber()) + .eqIfPresent(CustomerCompanyDO::getBankOfDeposit, reqVO.getBankOfDeposit()) + .eqIfPresent(CustomerCompanyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(CustomerCompanyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(CustomerCompanyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(CustomerCompanyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(CustomerCompanyDO::getId)); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyService.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyService.java new file mode 100644 index 00000000..10b8b1c3 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyService.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.bs.service.customer; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO; + +import java.util.*; +import javax.validation.*; + +/** + * 客户公司信息 Service 接口 + * + * @author 芋道源码 + */ +public interface CustomerCompanyService { + + /** + * 创建客户公司信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createCustomerCompany(@Valid CustomerCompanyCreateReqVO createReqVO); + + /** + * 更新客户公司信息 + * + * @param updateReqVO 更新信息 + */ + void updateCustomerCompany(@Valid CustomerCompanyUpdateReqVO updateReqVO); + + /** + * 删除客户公司信息 + * + * @param id 编号 + */ + void deleteCustomerCompany(Long id); + + /** + * 获得客户公司信息 + * + * @param id 编号 + * @return 客户公司信息 + */ + CustomerCompanyDO getCustomerCompany(Long id); + + /** + * 获得客户公司信息列表 + * + * @param ids 编号 + * @return 客户公司信息列表 + */ + List getCustomerCompanyList(Collection ids); + + /** + * 获得客户公司信息分页 + * + * @param pageReqVO 分页查询 + * @return 客户公司信息分页 + */ + PageResult getCustomerCompanyPage(CustomerCompanyPageReqVO pageReqVO); + + /** + * 获得客户公司信息列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 客户公司信息列表 + */ + List getCustomerCompanyList(CustomerCompanyExportReqVO exportReqVO); + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyServiceImpl.java new file mode 100644 index 00000000..a8ac9a68 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/customer/CustomerCompanyServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.bs.service.customer; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.customer.vo.CustomerCompanyUpdateReqVO; +import cn.iocoder.yudao.module.bs.convert.customer.CustomerCompanyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.customer.CustomerCompanyDO; +import cn.iocoder.yudao.module.bs.dal.mysql.customer.CustomerCompanyMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; + +/** + * 客户公司信息 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class CustomerCompanyServiceImpl implements CustomerCompanyService { + + @Resource + private CustomerCompanyMapper customerCompanyMapper; + + @Override + public Long createCustomerCompany(CustomerCompanyCreateReqVO createReqVO) { + // 插入 + CustomerCompanyDO customerCompany = CustomerCompanyConvert.INSTANCE.convert(createReqVO); + customerCompanyMapper.insert(customerCompany); + // 返回 + return customerCompany.getId(); + } + + @Override + public void updateCustomerCompany(CustomerCompanyUpdateReqVO updateReqVO) { + // 校验存在 + validateCustomerCompanyExists(updateReqVO.getId()); + // 更新 + CustomerCompanyDO updateObj = CustomerCompanyConvert.INSTANCE.convert(updateReqVO); + customerCompanyMapper.updateById(updateObj); + } + + @Override + public void deleteCustomerCompany(Long id) { + // 校验存在 + validateCustomerCompanyExists(id); + // 删除 + customerCompanyMapper.deleteById(id); + } + + private void validateCustomerCompanyExists(Long id) { + if (customerCompanyMapper.selectById(id) == null) { + throw exception(CUSTOMER_COMPANY_NOT_EXISTS); + } + } + + @Override + public CustomerCompanyDO getCustomerCompany(Long id) { + return customerCompanyMapper.selectById(id); + } + + @Override + public List getCustomerCompanyList(Collection ids) { + return customerCompanyMapper.selectBatchIds(ids); + } + + @Override + public PageResult getCustomerCompanyPage(CustomerCompanyPageReqVO pageReqVO) { + return customerCompanyMapper.selectPage(pageReqVO); + } + + @Override + public List getCustomerCompanyList(CustomerCompanyExportReqVO exportReqVO) { + return customerCompanyMapper.selectList(exportReqVO); + } + +}