保誠-保戶業務員媒合平台
Jack
2021-11-10 61a592ba01d2ddb29b5c75df83ed0ffae288bf46
[ADD] 預約前詢問API
[ADD] 顧問登入取得所屬全部的預約單API
修改3個檔案
新增16個檔案
1081 ■■■■■ 已變更過的檔案
pamapi/src/doc/預約單/預約前詢問.txt 22 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/doc/預約單/顧問取得所有自己的預約單API 40 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/domain/Appointment.java 186 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/domain/AppointmentCustomerView.java 193 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/domain/Customer.java 101 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/repository/AppointmentCustomerViewRepository.java 15 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/repository/AppointmentRepository.java 15 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/repository/CustomerRepository.java 11 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/security/SecurityUtils.java 22 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java 37 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java 22 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentCreateDTO.java 80 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentCustomerViewDTO.java 120 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentDTO.java 114 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java 28 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentDTOMapper.java 18 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java 27 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/web/rest/AppointmentResource.java 24 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java 6 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/doc/¹w¬ù³æ/¹w¬ù«e¸ß°Ý.txt
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,22 @@
http post :
http://localhost:8080/api/appointment/customer/create
contactType: email,phone
gender: male, female
request body:
{
    "phone":"09123456789",
    "email":"pollex@pollex.comm.tw",
    "contactType":"phone",
    "gender":"male",
    "age":20,
    "job":"專案經理",
    "requirement":"財務規劃,資產移轉",
    "hopeContactTime":"'星期一~星期五, 12:00~14:00, 18:00~21:00'",
    "otherRequirement":"外幣投資",
    "agentNo":"admin"
}
pamapi/src/doc/¹w¬ù³æ/ÅU°Ý¨ú±o©Ò¦³¦Û¤vªº¹w¬ù³æAPI
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,40 @@
http get :
http://localhost:8080/api/consultant/getMyAppointment
response body :
[
    {
        "id": 11,
        "phone": "09123456789",
        "email": "pollex@pollex.comm.tw",
        "contactType": "phone",
        "gender": "male",
        "age": 20,
        "job": "專案經理",
        "requirement": "財務規劃,資產移轉",
        "communicateStatus": "picked",
        "hopeContactTime": "'星期一~星期五, 12:00~14:00, 18:00~21:00'",
        "otherRequirement": "外幣投資",
        "appointmentDate": "2021-11-10T03:17:30.586Z",
        "agentNo": "admin"
    },
    {
        "id": 12,
        "phone": "09123456789",
        "email": "pollex@pollex.comm.tw",
        "contactType": "phone",
        "gender": "male",
        "age": 20,
        "job": "專案經理",
        "requirement": "財務規劃,資產移轉",
        "communicateStatus": "reserved",
        "hopeContactTime": "'星期一~星期五, 12:00~14:00, 18:00~21:00'",
        "otherRequirement": "外幣投資",
        "appointmentDate": "2021-11-10T03:20:00.563Z",
        "agentNo": "admin"
    }
]
pamapi/src/main/java/com/pollex/pam/domain/Appointment.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,186 @@
package com.pollex.pam.domain;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.pollex.pam.enums.ContactStatusEnum;
@Entity
@Table(name = "appointment")
public class Appointment implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(name = "phone")
    private String phone;
    @Column(name = "email")
    private String email;
    @Column(name = "contact_type")
    private String contactType;
    @Column(name = "gender")
    private String gender;
    @Column(name = "age")
    private int age;
    @Column(name = "job")
    private String job;
    @Column(name = "requirement")
    private String requirement;
    @Enumerated(EnumType.STRING)
    @Column(name = "communicate_status")
    private ContactStatusEnum communicateStatus;
    @Column(name = "hope_contact_time")
    private String hopeContactTime;
    @Column(name = "other_requirement")
    private String otherRequirement;
    @Column(name = "appointment_date")
    private Instant appointmentDate = Instant.now();
    @Column(name = "agent_no")
    private String agentNo;
    @Column(name = "customer_id")
    private Long customerId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getContactType() {
        return contactType;
    }
    public void setContactType(String contactType) {
        this.contactType = contactType;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getRequirement() {
        return requirement;
    }
    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }
    public String getHopeContactTime() {
        return hopeContactTime;
    }
    public void setHopeContactTime(String hopeContactTime) {
        this.hopeContactTime = hopeContactTime;
    }
    public String getOtherRequirement() {
        return otherRequirement;
    }
    public void setOtherRequirement(String otherRequirement) {
        this.otherRequirement = otherRequirement;
    }
    public Instant getAppointmentDate() {
        return appointmentDate;
    }
    public void setAppointmentDate(Instant appointmentDate) {
        this.appointmentDate = appointmentDate;
    }
    public String getAgentNo() {
        return agentNo;
    }
    public void setAgentNo(String agentNo) {
        this.agentNo = agentNo;
    }
    public ContactStatusEnum getCommunicateStatus() {
        return communicateStatus;
    }
    public void setCommunicateStatus(ContactStatusEnum communicateStatus) {
        this.communicateStatus = communicateStatus;
    }
    public Long getCustomerId() {
        return customerId;
    }
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
}
pamapi/src/main/java/com/pollex/pam/domain/AppointmentCustomerView.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,193 @@
package com.pollex.pam.domain;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import com.pollex.pam.enums.ContactStatusEnum;
@Entity
@Table(name = "appointment_customer_view")
public class AppointmentCustomerView implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Column(name = "appointment_id")
    @Id
    private Long id;
    @Column(name = "phone")
    private String phone;
    @Column(name = "email")
    private String email;
    @Column(name = "contact_type")
    private String contactType;
    @Column(name = "gender")
    private String gender;
    @Column(name = "age")
    private int age;
    @Column(name = "job")
    private String job;
    @Column(name = "requirement")
    private String requirement;
    @Enumerated(EnumType.STRING)
    @Column(name = "communicate_status")
    private ContactStatusEnum communicateStatus;
    @Column(name = "hope_contact_time")
    private String hopeContactTime;
    @Column(name = "other_requirement")
    private String otherRequirement;
    @Column(name = "appointment_date")
    private Instant appointmentDate;
    @Column(name = "agent_no")
    private String agentNo;
    @Column(name = "customer_id")
    private Long customerId;
    @Column(name = "name")
    private String name;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getContactType() {
        return contactType;
    }
    public void setContactType(String contactType) {
        this.contactType = contactType;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getRequirement() {
        return requirement;
    }
    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }
    public ContactStatusEnum getCommunicateStatus() {
        return communicateStatus;
    }
    public void setCommunicateStatus(ContactStatusEnum communicateStatus) {
        this.communicateStatus = communicateStatus;
    }
    public String getHopeContactTime() {
        return hopeContactTime;
    }
    public void setHopeContactTime(String hopeContactTime) {
        this.hopeContactTime = hopeContactTime;
    }
    public String getOtherRequirement() {
        return otherRequirement;
    }
    public void setOtherRequirement(String otherRequirement) {
        this.otherRequirement = otherRequirement;
    }
    public Instant getAppointmentDate() {
        return appointmentDate;
    }
    public void setAppointmentDate(Instant appointmentDate) {
        this.appointmentDate = appointmentDate;
    }
    public String getAgentNo() {
        return agentNo;
    }
    public void setAgentNo(String agentNo) {
        this.agentNo = agentNo;
    }
    public Long getCustomerId() {
        return customerId;
    }
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
pamapi/src/main/java/com/pollex/pam/domain/Customer.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,101 @@
package com.pollex.pam.domain;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "customer")
public class Customer implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(name = "name")
    private String name;
    @Column(name = "phone")
    private String phone;
    @Column(name = "email")
    private String email;
    @CreatedDate
    @Column(name = "created_date", updatable = false)
    @JsonIgnore
    private Instant createdDate = Instant.now();
    @LastModifiedDate
    @Column(name = "last_modified_date")
    @JsonIgnore
    private Instant lastModifiedDate = Instant.now();
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public Instant getCreatedDate() {
        return createdDate;
    }
    public void setCreatedDate(Instant createdDate) {
        this.createdDate = createdDate;
    }
    public Instant getLastModifiedDate() {
        return lastModifiedDate;
    }
    public void setLastModifiedDate(Instant lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }
}
pamapi/src/main/java/com/pollex/pam/repository/AppointmentCustomerViewRepository.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,15 @@
package com.pollex.pam.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.pollex.pam.domain.AppointmentCustomerView;
@Repository
public interface AppointmentCustomerViewRepository extends JpaRepository<AppointmentCustomerView, Long>{
    List<AppointmentCustomerView> findByAgentNo(String agentNo);
}
pamapi/src/main/java/com/pollex/pam/repository/AppointmentRepository.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,15 @@
package com.pollex.pam.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.pollex.pam.domain.Appointment;
@Repository
public interface AppointmentRepository extends JpaRepository<Appointment, Long>{
    List<Appointment> findByAgentNo(String agentNo);
}
pamapi/src/main/java/com/pollex/pam/repository/CustomerRepository.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,11 @@
package com.pollex.pam.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.pollex.pam.domain.Customer;
@Repository
public interface CustomerRepository extends JpaRepository<Customer, Long>{
}
pamapi/src/main/java/com/pollex/pam/security/SecurityUtils.java
@@ -1,8 +1,10 @@
package com.pollex.pam.security;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
@@ -97,4 +99,24 @@
    private static Stream<String> getAuthorities(Authentication authentication) {
        return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority);
    }
    public static String getAgentNo() {
        return getCurrentUserLogin().orElseGet(null);
    }
    // todo , should get id from user details
    public static Long getCustomerId() {
//        Map<String, String> userDetails = getCurrentUserDetails();
//        return Long.parseLong(userDetails.get("id"));
        return Long.parseLong("2");
    }
    public static Map<String, String> getCurrentUserDetails() {
        SecurityContext securityContext = SecurityContextHolder.getContext();
        if(securityContext.getAuthentication()==null ||
                securityContext.getAuthentication().getDetails() ==null) {
            return null;
        }
        return (Map<String, String>) securityContext.getAuthentication().getDetails();
   }
}
pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,37 @@
package com.pollex.pam.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.enums.ContactStatusEnum;
import com.pollex.pam.repository.AppointmentRepository;
import com.pollex.pam.security.SecurityUtils;
import com.pollex.pam.service.dto.AppointmentCreateDTO;
import com.pollex.pam.service.mapper.AppointmentDTOMapper;
import com.pollex.pam.service.mapper.AppointmentMapper;
@Service
public class AppointmentService {
    @Autowired
    AppointmentRepository appointmentRepository;
    @Autowired
    AppointmentDTOMapper appointmentDTOMapper;
    public void customerCreateAppointment(AppointmentCreateDTO appointmentCreateDTO) {
        Appointment appointment = appointmentDTOMapper.toAppointment(appointmentCreateDTO);
        appointment.setCustomerId(SecurityUtils.getCustomerId());
        appointment.setCommunicateStatus(ContactStatusEnum.RESERVED);
        appointmentRepository.save(appointment);
    }
    public List<Appointment> findByAgentNo(String agentNo) {
        return appointmentRepository.findByAgentNo(agentNo);
    }
}
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -1,17 +1,24 @@
package com.pollex.pam.service;
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.domain.AppointmentCustomerView;
import com.pollex.pam.domain.Consultant;
import com.pollex.pam.domain.CustomFavoriteConsultant;
import com.pollex.pam.domain.User;
import com.pollex.pam.enums.ContactStatusEnum;
import com.pollex.pam.repository.AppointmentCustomerViewRepository;
import com.pollex.pam.repository.ConsultantRepository;
import com.pollex.pam.repository.CustomFavoriteConsultantRepository;
import com.pollex.pam.security.SecurityUtils;
import com.pollex.pam.service.dto.*;
import com.pollex.pam.service.mapper.AppointmentCustomerViewMapper;
import com.pollex.pam.service.mapper.AppointmentMapper;
import com.pollex.pam.service.mapper.ConsultantMapper;
import com.pollex.pam.web.rest.errors.ConsultantNotFoundException;
import com.pollex.pam.web.rest.errors.NotLoginException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -28,6 +35,15 @@
    private final CustomFavoriteConsultantRepository customFavoriteConsultantRepository;
    private final ConsultantMapper consultantMapper;
    private final UserService userService;
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    AppointmentCustomerViewRepository appointmentCustomerViewRepository;
    @Autowired
    AppointmentCustomerViewMapper appointmentCustomerViewMapper;
    public ConsultantService(
        ConsultantRepository consultantRepository,
@@ -97,4 +113,10 @@
        });
    }
    public List<AppointmentCustomerViewDTO> getMyAppointment() {
        String agentNo = SecurityUtils.getAgentNo();
        List<AppointmentCustomerView> appointmentList = appointmentCustomerViewRepository.findByAgentNo(agentNo);
        return appointmentCustomerViewMapper.toAppointmentCustomerViewDTO(appointmentList);
    }
}
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentCreateDTO.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,80 @@
package com.pollex.pam.service.dto;
public class AppointmentCreateDTO {
    private String phone;
    private String email;
    private String contactType; //聯絡方式
    private String gender;
    private int age;
    private String job;
    private String requirement;
    private String hopeContactTime; //希望聯絡的時間
    private String otherRequirement;
    private String agentNo;
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getContactType() {
        return contactType;
    }
    public void setContactType(String contactType) {
        this.contactType = contactType;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getRequirement() {
        return requirement;
    }
    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }
    public String getHopeContactTime() {
        return hopeContactTime;
    }
    public void setHopeContactTime(String hopeContactTime) {
        this.hopeContactTime = hopeContactTime;
    }
    public String getOtherRequirement() {
        return otherRequirement;
    }
    public void setOtherRequirement(String otherRequirement) {
        this.otherRequirement = otherRequirement;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getAgentNo() {
        return agentNo;
    }
    public void setAgentNo(String agentNo) {
        this.agentNo = agentNo;
    }
}
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentCustomerViewDTO.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,120 @@
package com.pollex.pam.service.dto;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import com.pollex.pam.enums.ContactStatusEnum;
public class AppointmentCustomerViewDTO {
    private Long id;
    private String phone;
    private String email;
    private String contactType;
    private String gender;
    private int age;
    private String job;
    private String requirement;
    private ContactStatusEnum communicateStatus;
    private String hopeContactTime;
    private String otherRequirement;
    private Instant appointmentDate;
    private String agentNo;
    private Long customerId;
    private String name;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getContactType() {
        return contactType;
    }
    public void setContactType(String contactType) {
        this.contactType = contactType;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getRequirement() {
        return requirement;
    }
    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }
    public ContactStatusEnum getCommunicateStatus() {
        return communicateStatus;
    }
    public void setCommunicateStatus(ContactStatusEnum communicateStatus) {
        this.communicateStatus = communicateStatus;
    }
    public String getHopeContactTime() {
        return hopeContactTime;
    }
    public void setHopeContactTime(String hopeContactTime) {
        this.hopeContactTime = hopeContactTime;
    }
    public String getOtherRequirement() {
        return otherRequirement;
    }
    public void setOtherRequirement(String otherRequirement) {
        this.otherRequirement = otherRequirement;
    }
    public Instant getAppointmentDate() {
        return appointmentDate;
    }
    public void setAppointmentDate(Instant appointmentDate) {
        this.appointmentDate = appointmentDate;
    }
    public String getAgentNo() {
        return agentNo;
    }
    public void setAgentNo(String agentNo) {
        this.agentNo = agentNo;
    }
    public Long getCustomerId() {
        return customerId;
    }
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentDTO.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,114 @@
package com.pollex.pam.service.dto;
import java.time.Instant;
import org.springframework.stereotype.Service;
import com.pollex.pam.enums.ContactStatusEnum;
@Service
public class AppointmentDTO {
    private Long id;
    private String phone;
    private String email;
    private String contactType;
    private String gender;
    private int age;
    private String job;
    private String requirement;
    private ContactStatusEnum communicateStatus;
    private String hopeContactTime;
    private String otherRequirement;
    private Instant appointmentDate;
    private String agentNo;
    private Long customerId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getContactType() {
        return contactType;
    }
    public void setContactType(String contactType) {
        this.contactType = contactType;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getRequirement() {
        return requirement;
    }
    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }
    public ContactStatusEnum getCommunicateStatus() {
        return communicateStatus;
    }
    public void setCommunicateStatus(ContactStatusEnum communicateStatus) {
        this.communicateStatus = communicateStatus;
    }
    public String getHopeContactTime() {
        return hopeContactTime;
    }
    public void setHopeContactTime(String hopeContactTime) {
        this.hopeContactTime = hopeContactTime;
    }
    public String getOtherRequirement() {
        return otherRequirement;
    }
    public void setOtherRequirement(String otherRequirement) {
        this.otherRequirement = otherRequirement;
    }
    public Instant getAppointmentDate() {
        return appointmentDate;
    }
    public void setAppointmentDate(Instant appointmentDate) {
        this.appointmentDate = appointmentDate;
    }
    public String getAgentNo() {
        return agentNo;
    }
    public void setAgentNo(String agentNo) {
        this.agentNo = agentNo;
    }
    public Long getCustomerId() {
        return customerId;
    }
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
}
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,28 @@
package com.pollex.pam.service.mapper;
import static java.util.stream.Collectors.toList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.pollex.pam.domain.AppointmentCustomerView;
import com.pollex.pam.service.dto.AppointmentCustomerViewDTO;
import com.pollex.pam.service.dto.AppointmentDTO;
@Service
public class AppointmentCustomerViewMapper {
    public AppointmentCustomerViewDTO toAppointmentCustomerViewDTO(AppointmentCustomerView source) {
        AppointmentCustomerViewDTO target = new AppointmentCustomerViewDTO();
        BeanUtils.copyProperties(source, target);
        return target;
    }
    public List<AppointmentCustomerViewDTO> toAppointmentCustomerViewDTO(
            List<AppointmentCustomerView> source) {
        return source.stream().map(s -> toAppointmentCustomerViewDTO(s))
                .collect(toList());
    }
}
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentDTOMapper.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,18 @@
package com.pollex.pam.service.mapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.enums.ContactStatusEnum;
import com.pollex.pam.service.dto.AppointmentCreateDTO;
@Service
public class AppointmentDTOMapper {
    public Appointment toAppointment(AppointmentCreateDTO source) {
        Appointment target = new Appointment();
        BeanUtils.copyProperties(source, target);
        return target;
    }
}
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,27 @@
package com.pollex.pam.service.mapper;
import static java.util.stream.Collectors.toList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.service.dto.AppointmentDTO;
@Service
public class AppointmentMapper {
    public AppointmentDTO toAppointmentDTO(Appointment source) {
        AppointmentDTO target = new AppointmentDTO();
        BeanUtils.copyProperties(source, target);
        return target;
    }
    public List<AppointmentDTO> toAppointmentDTO(List<Appointment> source) {
        return source.stream()
                .map(s -> toAppointmentDTO(s)).collect(toList());
    }
}
pamapi/src/main/java/com/pollex/pam/web/rest/AppointmentResource.java
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,24 @@
package com.pollex.pam.web.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pollex.pam.service.AppointmentService;
import com.pollex.pam.service.dto.AppointmentCreateDTO;
@RestController
@RequestMapping("/api/appointment")
public class AppointmentResource {
    @Autowired
    AppointmentService appointmentService;
    @PostMapping("/customer/create")
    public void clientCreateAppointment(@RequestBody AppointmentCreateDTO appointmentCreateDTO) {
        appointmentService.customerCreateAppointment(appointmentCreateDTO);
    }
}
pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java
@@ -53,4 +53,10 @@
        ConsultantDetailDTO result = consultantService.getConsultantDetail(agentNo);
        return new ResponseEntity<>(result, HttpStatus.OK);
    }
    @GetMapping("/getMyAppointment")
    public List<AppointmentCustomerViewDTO> getMyAppointment() {
        return consultantService.getMyAppointment();
    }
}