客户信息编码规范对接

客户信息编码规范对接
master
siontion 10 months ago
parent 10d76692fd
commit ad2456479e

@ -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;
}
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;
}

@ -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<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO) {
return customerMapper.selectPage(pageReqVO);
}
}
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<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO) {
return customerMapper.selectPage(pageReqVO);
}
}

@ -19,7 +19,7 @@
<el-col :span="8">
<el-row>
<el-col :span="24">
<el-form-item prop="code" label="客户编码" required>
<el-form-item prop="code" label="客户编码">
<el-input v-model="formData.code" />
</el-form-item>
</el-col>
@ -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' }],

Loading…
Cancel
Save