Skip to main content

CRM Khách hàng

Module này dùng chung 1 CustomerDTO cho 5 loại khách hàng, phân biệt qua sub-type, mỗi loại có base route riêng:

  • CustomerCompany — rpc/crm/customer-company (Khách hàng đối tác CTDA)
  • CustomerRetail — rpc/crm/customer-retail (Khách hàng lẻ)
  • CustomerStore — rpc/crm/customer-store (Khách hàng đại lý)
  • CustomerWorker — rpc/crm/customer-worker (Khách hàng thầu thợ)
  • CustomerModel — rpc/crm/customer-model (Khách hàng mô hình)

POST /{type}/count - Đếm số lượng Customer

Request Parameters (body - Customer_CustomerFilterDTO)

ParamTypeOperatorDescription
idIdFilterequal/inID
codeStringFiltercontainsMã khách hàng
codeDraftStringFiltercontainsMã nháp
nameStringFiltercontainsTên khách hàng
phoneStringFiltercontainsSố điện thoại
addressStringFiltercontainsĐịa chỉ
emailStringFiltercontainsEmail
taxCodeStringFiltercontainsMã số thuế
customerTypeIdIdFilterequalID loại khách hàng
customerSourceIdIdFilterequalID nguồn khách hàng
customerGroupingIdIdFilterequalID nhóm khách hàng
customerStatusIdIdFilterequalID trạng thái khách hàng
customerLevelIdIdFilterequalID cấp độ khách hàng
customerSizeIdIdFilterequalID quy mô khách hàng
customerSaleChannelIdIdFilterequalID kênh bán hàng
appUserIdIdFilterequalID nhân viên phụ trách
creatorIdIdFilterequalID người tạo
organizationIdIdFilterequalID đơn vị
provinceIdIdFilterequalID tỉnh/thành
districtIdIdFilterequalID quận/huyện
wardIdIdFilterequalID phường/xã
nationIdIdFilterequalID quốc gia
professionIdIdFilterequalID nghề nghiệp
sexIdIdFilterequalID giới tính
businessTypeIdIdFilterequalID loại hình kinh doanh
productGroupingIdIdFilterequalID nhóm sản phẩm
storeIdIdFilterequalID cửa hàng
storeTypeIdIdFilterequalID loại cửa hàng
storeGroupingIdIdFilterequalID nhóm cửa hàng
storeStatusIdIdFilterequalID trạng thái cửa hàng
statusIdIdFilterequalID trạng thái
birthdayDateFilterrangeNgày sinh
foundedAtDateFilterrangeNgày thành lập
createdAtDateFilterrangeNgày tạo
updatedAtDateFilterrangeNgày cập nhật
numberOfEmployeeLongFilterequalSố nhân viên
investmentDecimalFilterrangeVốn đầu tư
revenueAnnualDecimalFilterrangeDoanh thu hàng năm
totalPointsDecimalFilterrangeTổng điểm
searchstring-Tìm kiếm toàn văn (mã, tên, SĐT, email)

POST /{type}/list - Danh sách Customer (Master Table)

Response Fields - Customer_CustomerDTO

FieldTypeDescription
idlongID khách hàng
sttlongSố thứ tự
codestringMã khách hàng
codeDraftstringMã nháp
namestringTên khách hàng
phonestringSố điện thoại
addressstringĐịa chỉ
emailstringEmail
taxCodestringMã số thuế
faxstringFax
websitestringWebsite
zipCodestringMã bưu điện
descriptionstringMô tả
customerTypeIdlongID loại khách hàng
customerSourceIdlong?ID nguồn khách hàng
customerLeadIdlong?ID lead
customerStatusIdlong?ID trạng thái KH
customerLevelIdlong?ID cấp độ KH
customerSizeIdlong?ID quy mô KH
customerSaleChannelIdlong?ID kênh bán hàng
productGroupingIdlong?ID nhóm sản phẩm
statusIdlongID trạng thái
sexIdlong?ID giới tính
birthdaydatetime?Ngày sinh
professionIdlong?ID nghề nghiệp
businessTypeIdlong?ID loại hình kinh doanh
numberOfEmployeelong?Số nhân viên
investmentdecimal?Vốn đầu tư
revenueAnnualdecimal?Doanh thu hàng năm
nationIdlong?ID quốc gia
provinceIdlong?ID tỉnh/thành
districtIdlong?ID quận/huyện
wardIdlong?ID phường/xã
appUserIdlong?ID nhân viên phụ trách
creatorIdlongID người tạo
organizationIdlongID đơn vị
storeIdlong?ID cửa hàng
modelTypestringLoại mô hình
modelScalestringQuy mô mô hình
modelAreastringKhu vực mô hình
modelSubjectTypestringLoại đối tượng mô hình
longitudedecimal?Kinh độ
latitudedecimal?Vĩ độ
totalPointlongTổng điểm tích luỹ
currentPointlongĐiểm hiện tại
bankAccountstringTài khoản ngân hàng
bankNamestring?Tên ngân hàng
bankNumberstring?Số tài khoản NH
identificationNumberstringSố CMND/CCCD
citizenIdentificationNumberstring?Số CCCD
facebookAccountstringFacebook
googleAccountstringGoogle
consumptionQuantityPerMonthstringSố lượng tiêu thụ/tháng
representativeNamestring?Tên người đại diện
representativePhoneNumberstring?SĐT người đại diện
representativeSexIdlong?ID giới tính người đại diện
otherImportantDatesstring?Ngày quan trọng khác
foundedAtdatetime?Ngày thành lập
customerGroupingNamesstringTên nhóm KH (ghép chuỗi)
hobbyNamesstringSở thích (ghép chuỗi)
rankNamestring?Tên cấp bậc
userNamestring?Tên đăng nhập
majorNamestring?Tên chuyên ngành
workerGroupingNamestring?Tên nhóm thầu thợ
customerSituationstringTình hình khách hàng
customerTimestringThời gian làm khách hàng
usedboolĐang sử dụng
rowIdguidRow ID
createdAtdatetimeNgày tạo
updatedAtdatetimeNgày cập nhật
appUserCustomer_AppUserDTONhân viên phụ trách
creatorCustomer_AppUserDTONgười tạo
customerTypeCustomer_CustomerTypeDTOLoại khách hàng
customerSourceCustomer_CustomerSourceDTONguồn khách hàng
customerLeadCustomer_CustomerLeadDTOLead
customerStatusCustomer_CustomerStatusDTOTrạng thái KH
customerLevelCustomer_CustomerLevelDTOCấp độ KH
customerSizeCustomer_CustomerSizeDTOQuy mô KH
customerSaleChannelCustomer_CustomerSaleChannelDTOKênh bán hàng
businessTypeCustomer_BusinessTypeDTOLoại hình kinh doanh
professionCustomer_ProfessionDTONghề nghiệp
sexCustomer_SexDTOGiới tính
representativeSexCustomer_SexDTOGiới tính người đại diện
statusCustomer_StatusDTOTrạng thái
nationCustomer_NationDTOQuốc gia
provinceCustomer_ProvinceDTOTỉnh/thành
districtCustomer_DistrictDTOQuận/huyện
wardCustomer_WardDTOPhường/xã
organizationCustomer_OrganizationDTOĐơn vị
storeCustomer_StoreDTOCửa hàng
productGroupingCustomer_ProductGroupingDTONhóm sản phẩm
customerFileGroupingsList<Customer_CustomerFileGroupingDTO>File đính kèm (theo nhóm)
customerCustomerGroupingMappingsList<Customer_CustomerCustomerGroupingMappingDTO>Nhóm KH
customerEmailsList<Customer_CustomerEmailDTO>Danh sách email
customerPhonesList<Customer_CustomerPhoneDTO>Danh sách SĐT
customerHistoriesList<Customer_CustomerHistoryDTO>Lịch sử thay đổi
customerHobbyMappingsList<Customer_CustomerHobbyMappingDTO>Sở thích
customerDistrictWorkingMappingsList<Customer_CustomerDistrictWorkingMapping>Quận/huyện làm việc

Nested Objects

appUser / creator - Customer_AppUserDTO

FieldTypeDescription
idlongID nhân viên
usernamestringTên đăng nhập
displayNamestringTên hiển thị
emailstringEmail
phonestringSố điện thoại
organizationIdlongID đơn vị
organizationCustomer_OrganizationDTOĐơn vị (Name)
statusIdlongTrạng thái
usedboolĐang sử dụng

customerType - Customer_CustomerTypeDTO

FieldTypeDescription
idlongID loại KH
codestringMã loại
namestringTên loại

customerStatus - Customer_CustomerStatusDTO

FieldTypeDescription
idlongID trạng thái
codestringMã trạng thái
namestringTên trạng thái
colorstringMã màu

sex - Customer_SexDTO

FieldTypeDescription
idlongID giới tính
codestringMã
namestringTên (Nam/Nữ)

status - Customer_StatusDTO

FieldTypeDescription
idlongID trạng thái
codestringMã
namestringTên

organization - Customer_OrganizationDTO

FieldTypeDescription
idlongID đơn vị
codestringMã đơn vị
namestringTên đơn vị
pathstringĐường dẫn

province / district / ward / nation - Customer_*DTO

Mỗi đối tượng có id, code, name. Riêng nation có thêm longitude, latitude, priority.


POST /{type}/get - Chi tiết Customer

Trả về đầy đủ Customer_CustomerDTO + tất cả nested objects.


POST /{type}/create /update /delete - CRUD

Body là Customer_CustomerDTO. Tất cả đều dùng chung DTO.


POST /{type}/bulk-delete - Xoá nhiều

{ "ids": [1, 2, 3] }

POST /{type}/get-history - Lịch sử thay đổi

Trả về RequestHistory<Customer> bao gồm các thay đổi theo thời gian.


POST /{type}/import & /export & /export-template - Excel

  • /import — Import danh sách KH từ file Excel (worksheet "KH")
  • /export — Export danh sách KH ra file Excel template
  • /export-template — Download template Excel để import

POST /{type}/upload-file & /multi-upload & /save-image - Upload

  • /upload-file — Upload 1 file, trả về Customer_FileDTO
  • /multi-upload — Upload nhiều file, trả về List<Customer_FileDTO>
  • /save-image — Lưu ảnh, trả về Customer_ImageDTO

Màn Khách hàng 360

Mỗi customer có các tab 360 trên giao diện chi tiết. Các endpoint bên dưới dùng chung pattern POST /{type}/{action}.

Hợp đồng (Contract)

EndpointMô tả
/count-contractĐếm hợp đồng
/list-contractDanh sách hợp đồng
/get-contractChi tiết hợp đồng
/create-contractTạo hợp đồng
/update-contractCập nhật hợp đồng
/delete-contractXoá hợp đồng
/bulk-delete-contractXoá nhiều hợp đồng

Hợp đồng nguyên tắc (PrincipalContract)

EndpointMô tả
/count-principal-contractĐếm
/list-principal-contractDanh sách
/get-principal-contractChi tiết

Đơn hàng (CustomerSalesOrder)

EndpointMô tả
/count-customer-sales-orderĐếm đơn hàng
/list-customer-sales-orderDanh sách đơn hàng
/get-customer-sales-orderChi tiết đơn hàng

Ticket

EndpointMô tả
/count-ticketĐếm ticket
/list-ticketDanh sách ticket
/get-ticketChi tiết ticket
/create-ticketTạo ticket
/update-ticketCập nhật ticket
/delete-ticketXoá ticket

Call Log

EndpointMô tả
/count-call-logĐếm
/list-call-logDanh sách
/get-call-logChi tiết
/update-call-logCập nhật
/delete-call-logXoá

Hoạt động (Activity)

EndpointMô tả
/count-activityĐếm hoạt động
/count-ongoing-activityĐếm hoạt động đang diễn ra
/list-activityDanh sách
/list-ongoing-activityDanh sách đang diễn ra
/get-activityChi tiết
/create-activityTạo
/update-activityCập nhật
/delete-activityXoá
/bulk-delete-activityXoá nhiều

Liên hệ (Contact)

EndpointMô tả
/count-contactĐếm
/list-contactDanh sách
/get-contactChi tiết
/create-contactTạo
/update-contactCập nhật
/delete-contactXoá
/bulk-delete-contactXoá nhiều

Email

EndpointMô tả
/get-emailChi tiết email
/create-emailTạo email
/update-emailCập nhật
/send-emailGửi email
/send-multi-emailGửi nhiều email
/delete-emailXoá
/read-emailĐánh dấu đã đọc
/list-inboxDanh sách inbox
/count-inboxĐếm inbox
/list-draftDanh sách nháp
/count-draftĐếm nháp
/list-sentDanh sách đã gửi
/count-sentĐếm đã gửi
/get-customer-email-historyLịch sử email
/count-customer-email-historyĐếm lịch sử
/list-customer-email-historyDanh sách lịch sử

Lịch sử tích điểm (CustomerPointHistory)

EndpointMô tả
/count-customer-point-historyĐếm
/list-customer-point-historyDanh sách
/get-customer-point-historyChi tiết
/create-customer-point-historyTạo

Bảo hành - sửa chữa (WarrantyClaim / RepairTicket)

EndpointMô tả
/count-warranty-claimĐếm
/list-warranty-claimDanh sách
/create-repair-ticketTạo phiếu sửa chữa
/update-repair-ticketCập nhật
/delete-repair-ticketXoá
/bulk-delete-repair-ticketXoá nhiều
/count-repair-ticketĐếm
/list-repair-ticketDanh sách
/get-repair-ticketChi tiết

Đơn hàng cửa hàng (StoreSalesOrder — chỉ CustomerStore)

EndpointMô tả
/count-store-sales-orderĐếm
/list-store-sales-orderDanh sách

Đơn mua hàng (PurchaseOrder)

EndpointMô tả
/count-purchase-orderĐếm
/list-purchase-orderDanh sách
/get-purchase-orderChi tiết

File đính kèm (CustomerFileGrouping — chỉ CustomerModel)

EndpointMô tả
/count-customer-file-groupingĐếm
/list-customer-file-groupingDanh sách