From ad2456479e634687f4129a65501d68addfa7ae11 Mon Sep 17 00:00:00 2001 From: siontion Date: Wed, 10 Jan 2024 09:44:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 客户信息编码规范对接 --- .../admin/customer/vo/CustomerSaveReqVO.java | 214 +++++++++--------- .../service/customer/CustomerServiceImpl.java | 154 +++++++------ .../src/views/heli/customer/CustomerForm.vue | 4 +- 3 files changed, 188 insertions(+), 184 deletions(-) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerSaveReqVO.java index 17353bde..5fde0b8f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerSaveReqVO.java @@ -1,108 +1,106 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; - -@Schema(description = "管理后台 - 客户新表新增/修改 Request VO") -@Data -public class CustomerSaveReqVO { - - @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12756") - private Long id; - - @Schema(description = "客户编码", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "客户编码不能为空") - private String code; - - @Schema(description = "客户简称", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "客户简称不能为空") - private String brief; - - @Schema(description = "客户全称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") - @NotEmpty(message = "客户全称不能为空") - private String name; - - @Schema(description = "所属行业") - private String industry; - - @Schema(description = "客户级别.字典", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "客户级别.字典不能为空") - private Integer level; - - @Schema(description = "业务员,对应用户ID", example = "5426") - private Long userId; - - @Schema(description = "备注", example = "你猜") - private String description; - - @Schema(description = "联系人姓名1姓名", example = "赵六") - private String contact1Name; - - @Schema(description = "联系人姓名1岗位") - private String contact1Post; - - @Schema(description = "联系人姓名1方法") - private String contact1Method; - - @Schema(description = "联系人姓名1邮箱") - private String contact1Email; - - @Schema(description = "联系人姓名1地址") - private String contact1Addr; - - @Schema(description = "联系人姓名2姓名", example = "赵六") - private String contact2Name; - - @Schema(description = "联系人姓名2岗位") - private String contact2Post; - - @Schema(description = "联系人姓名2方法") - private String contact2Method; - - @Schema(description = "联系人姓名2邮箱") - private String contact2Email; - - @Schema(description = "联系人姓名2地址") - private String contact2Addr; - - @Schema(description = "联系人姓名3姓名", example = "赵六") - private String contact3Name; - - @Schema(description = "联系人姓名3岗位") - private String contact3Post; - - @Schema(description = "联系人姓名3方法") - private String contact3Method; - - @Schema(description = "联系人姓名3邮箱") - private String contact3Email; - - @Schema(description = "联系人姓名3地址") - private String contact3Addr; - - @Schema(description = "状态,1 表示正常,2 表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "状态,1 表示正常,2 表示禁用不能为空") - private Integer status; - - @Schema(description = "客户logo") - private String logo; - - @Schema(description = "付款方式", example = "1") - private String payType; - - @Schema(description = "账户名称", example = "芋艿") - private String accountName; - - @Schema(description = "银行账号") - private String bankNo; - - @Schema(description = "开户行") - private String bankAddress; - - @Schema(description = "公司税号") - private String taxNo; - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 客户新表新增/修改 Request VO") +@Data +public class CustomerSaveReqVO { + + @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12756") + private Long id; + + @Schema(description = "客户编码", requiredMode = Schema.RequiredMode.REQUIRED) + private String code; + + @Schema(description = "客户简称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "客户简称不能为空") + private String brief; + + @Schema(description = "客户全称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "客户全称不能为空") + private String name; + + @Schema(description = "所属行业") + private String industry; + + @Schema(description = "客户级别.字典", requiredMode = Schema.RequiredMode.REQUIRED) + private Integer level; + + @Schema(description = "业务员,对应用户ID", example = "5426") + private Long userId; + + @Schema(description = "备注", example = "你猜") + private String description; + + @Schema(description = "联系人姓名1姓名", example = "赵六") + private String contact1Name; + + @Schema(description = "联系人姓名1岗位") + private String contact1Post; + + @Schema(description = "联系人姓名1方法") + private String contact1Method; + + @Schema(description = "联系人姓名1邮箱") + private String contact1Email; + + @Schema(description = "联系人姓名1地址") + private String contact1Addr; + + @Schema(description = "联系人姓名2姓名", example = "赵六") + private String contact2Name; + + @Schema(description = "联系人姓名2岗位") + private String contact2Post; + + @Schema(description = "联系人姓名2方法") + private String contact2Method; + + @Schema(description = "联系人姓名2邮箱") + private String contact2Email; + + @Schema(description = "联系人姓名2地址") + private String contact2Addr; + + @Schema(description = "联系人姓名3姓名", example = "赵六") + private String contact3Name; + + @Schema(description = "联系人姓名3岗位") + private String contact3Post; + + @Schema(description = "联系人姓名3方法") + private String contact3Method; + + @Schema(description = "联系人姓名3邮箱") + private String contact3Email; + + @Schema(description = "联系人姓名3地址") + private String contact3Addr; + + @Schema(description = "状态,1 表示正常,2 表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态,1 表示正常,2 表示禁用不能为空") + private Integer status; + + @Schema(description = "客户logo") + private String logo; + + @Schema(description = "付款方式", example = "1") + private String payType; + + @Schema(description = "账户名称", example = "芋艿") + private String accountName; + + @Schema(description = "银行账号") + private String bankNo; + + @Schema(description = "开户行") + private String bankAddress; + + @Schema(description = "公司税号") + private String taxNo; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java index 59f46954..db445567 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java @@ -1,74 +1,80 @@ -package com.chanko.yunxi.mes.module.heli.service.customer; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; - -import com.chanko.yunxi.mes.module.heli.dal.mysql.customer.CustomerMapper; - -import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; - -/** - * 客户新表 Service 实现类 - * - * @author 管理员 - */ -@Service -@Validated -public class CustomerServiceImpl implements CustomerService { - - @Resource - private CustomerMapper customerMapper; - - @Override - public Long createCustomer(CustomerSaveReqVO createReqVO) { - // 插入 - CustomerDO customer = BeanUtils.toBean(createReqVO, CustomerDO.class); - customerMapper.insert(customer); - // 返回 - return customer.getId(); - } - - @Override - public void updateCustomer(CustomerSaveReqVO updateReqVO) { - // 校验存在 - validateCustomerExists(updateReqVO.getId()); - // 更新 - CustomerDO updateObj = BeanUtils.toBean(updateReqVO, CustomerDO.class); - customerMapper.updateById(updateObj); - } - - @Override - public void deleteCustomer(Long id) { - // 校验存在 - validateCustomerExists(id); - // 删除 - customerMapper.deleteById(id); - } - - private void validateCustomerExists(Long id) { - if (customerMapper.selectById(id) == null) { - throw exception(CUSTOMER_NOT_EXISTS); - } - } - - @Override - public CustomerDO getCustomer(Long id) { - return customerMapper.selectById(id); - } - - @Override - public PageResult getCustomerPage(CustomerPageReqVO pageReqVO) { - return customerMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.customer; + +import cn.hutool.core.lang.UUID; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.customer.CustomerMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.CUSTOMER; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WORKSHOP; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 客户新表 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class CustomerServiceImpl implements CustomerService { + + @Resource + private CustomerMapper customerMapper; + + @Override + public Long createCustomer(CustomerSaveReqVO createReqVO) { + // 插入 + CustomerDO customer = BeanUtils.toBean(createReqVO, CustomerDO.class); + customer.setCode(UUID.fastUUID().toString(true)); + customerMapper.insert(customer); + customer.setCode(CUSTOMER.getCode(customer.getId().toString())); + customerMapper.updateById(customer); + // 返回 + return customer.getId(); + } + + @Override + public void updateCustomer(CustomerSaveReqVO updateReqVO) { + // 校验存在 + validateCustomerExists(updateReqVO.getId()); + // 更新 + CustomerDO updateObj = BeanUtils.toBean(updateReqVO, CustomerDO.class); + customerMapper.updateById(updateObj); + } + + @Override + public void deleteCustomer(Long id) { + // 校验存在 + validateCustomerExists(id); + // 删除 + customerMapper.deleteById(id); + } + + private void validateCustomerExists(Long id) { + if (customerMapper.selectById(id) == null) { + throw exception(CUSTOMER_NOT_EXISTS); + } + } + + @Override + public CustomerDO getCustomer(Long id) { + return customerMapper.selectById(id); + } + + @Override + public PageResult getCustomerPage(CustomerPageReqVO pageReqVO) { + return customerMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/CustomerForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/CustomerForm.vue index 2d20ad01..783ef15e 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/CustomerForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/customer/CustomerForm.vue @@ -19,7 +19,7 @@ - + @@ -326,7 +326,7 @@ const formData = ref({ taxNo: undefined, }) const formRules = reactive({ - code: [{ required: true, message: '客户编码不能为空', trigger: 'blur' }], + // code: [{ required: true, message: '客户编码不能为空', trigger: 'blur' }], brief: [{ required: true, message: '客户简称不能为空', trigger: 'blur' }], name: [{ required: true, message: '客户全称不能为空', trigger: 'blur' }], // status: [{ required: true, message: '状态,1 表示正常,2 表示禁用不能为空', trigger: 'blur' }],