pamapi/src/doc/sql/20220112_j.sql
@@ -40,3 +40,27 @@ CONSTRAINT interview_record_pkey PRIMARY KEY (id) ); -- æ°å¢é ç´å®çµæ¡è³ætable -- Drop table -- DROP TABLE public.appointment_closed_info; -- Drop table -- DROP TABLE public.appointment_closed_info; CREATE TABLE public.appointment_closed_info ( id bigserial NOT NULL, policyholder_identity_id varchar NULL, plan_code varchar NULL, policy_entry_date date NULL, remark varchar NULL, closed_reason varchar NULL, closed_other_reason varchar NULL, appointment_id bigserial NOT NULL, CONSTRAINT appointment_closed_info_pkey PRIMARY KEY (id) ); pamapi/src/doc/¹w¬ù³æ/µ²®×API.txt
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,30 @@ http post : http://localhost:8080/api/appointment/close request body : æäº¤ contactStatus: done { "policyholderIdentityId":"A123456789", "planCode":"ATM", "policyEntryDate":"2022-01-12", "contactStatus":"done", "appointmentId": 385 } æªæäº¤ contactStatus: closed { "contactStatus":"closed", "closedReason":"other", "closedOtherReason":"å¿æ ä¸å¥½ä¸æ³è²·", "appointmentId": 385, "remark":"test remark" } pamapi/src/main/java/com/pollex/pam/appointment/process/AppointmentProcess.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,25 @@ package com.pollex.pam.appointment.process; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.pollex.pam.service.dto.AbstractAppointmentProcessDTO; @Service public class AppointmentProcess{ @Autowired List<AppointmentProcessInterface> processList; public void process(AbstractAppointmentProcessDTO dto) { AbstractAppointmentProcessDTO appointmentProcessDTO = (AbstractAppointmentProcessDTO)dto; processList.stream().forEach(process ->{ if(process.getProcessType() == appointmentProcessDTO.getContactStatus()) { process.doProcess(appointmentProcessDTO); } }); } } pamapi/src/main/java/com/pollex/pam/appointment/process/AppointmentProcessInterface.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,11 @@ package com.pollex.pam.appointment.process; import com.pollex.pam.enums.ContactStatusEnum; import com.pollex.pam.service.dto.AbstractAppointmentProcessDTO; public interface AppointmentProcessInterface { void doProcess(AbstractAppointmentProcessDTO dto); ContactStatusEnum getProcessType(); } pamapi/src/main/java/com/pollex/pam/appointment/process/ClosedProcess.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,35 @@ package com.pollex.pam.appointment.process; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.pollex.pam.domain.AppointmentClosedInfo; import com.pollex.pam.enums.ContactStatusEnum; import com.pollex.pam.repository.AppointmentClosedInfoRepository; import com.pollex.pam.service.dto.AbstractAppointmentProcessDTO; import com.pollex.pam.service.dto.ClosedProcessDTO; import com.pollex.pam.service.dto.DoneProcessDTO; @Service public class ClosedProcess implements AppointmentProcessInterface{ @Autowired AppointmentClosedInfoRepository appointmentClosedInfoRepository; @Override public void doProcess(AbstractAppointmentProcessDTO processDTO) { ClosedProcessDTO doneProcess = (ClosedProcessDTO)processDTO; BeanUtils.copyProperties(processDTO, doneProcess); AppointmentClosedInfo closedInfo = new AppointmentClosedInfo(); BeanUtils.copyProperties(doneProcess, closedInfo); appointmentClosedInfoRepository.save(closedInfo); } @Override public ContactStatusEnum getProcessType() { return ContactStatusEnum.CLOSED; } } pamapi/src/main/java/com/pollex/pam/appointment/process/DoneProcess.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,34 @@ package com.pollex.pam.appointment.process; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.pollex.pam.domain.AppointmentClosedInfo; import com.pollex.pam.enums.ContactStatusEnum; import com.pollex.pam.repository.AppointmentClosedInfoRepository; import com.pollex.pam.service.dto.AbstractAppointmentProcessDTO; import com.pollex.pam.service.dto.DoneProcessDTO; @Service public class DoneProcess implements AppointmentProcessInterface{ @Autowired AppointmentClosedInfoRepository appointmentClosedInfoRepository; @Override public void doProcess(AbstractAppointmentProcessDTO processDTO) { DoneProcessDTO doneProcess = (DoneProcessDTO)processDTO; BeanUtils.copyProperties(processDTO, doneProcess); AppointmentClosedInfo closedInfo = new AppointmentClosedInfo(); BeanUtils.copyProperties(doneProcess, closedInfo); appointmentClosedInfoRepository.save(closedInfo); } @Override public ContactStatusEnum getProcessType() { return ContactStatusEnum.DONE; } } pamapi/src/main/java/com/pollex/pam/domain/Appointment.java
@@ -4,13 +4,26 @@ import java.time.Instant; import java.util.List; import javax.persistence.*; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.pollex.pam.enums.AppointmentStatusEnum; import com.pollex.pam.enums.ContactStatusEnum; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @EntityListeners(AuditingEntityListener.class) @Entity @@ -86,6 +99,15 @@ @JoinColumn(name = "appointment_id") @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) private List<AppointmentMemo> appointmentMemoList; // @OneToOne(cascade = CascadeType.REMOVE,fetch=FetchType.EAGER) //// @JoinColumn(name = "form_authority_id", referencedColumnName = "id") // @JoinColumn(name = "appointment_id", referencedColumnName = "id") // private AppointmentClosedInfo closedInfo; // @OneToOne(cascade = CascadeType.REMOVE // , mappedBy = "appointment", fetch=FetchType.LAZY) // private AppointmentClosedInfo closedInfo; public Long getId() { return id; @@ -246,6 +268,14 @@ public void setAppointmentMemoList(List<AppointmentMemo> appointmentMemoList) { this.appointmentMemoList = appointmentMemoList; } // public AppointmentClosedInfo getClosedInfo() { // return closedInfo; // } // // public void setClosedInfo(AppointmentClosedInfo closedInfo) { // this.closedInfo = closedInfo; // } pamapi/src/main/java/com/pollex/pam/domain/AppointmentClosedInfo.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,112 @@ package com.pollex.pam.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "appointment_closed_info") public class AppointmentClosedInfo implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "policyholder_identity_id") private String policyholderIdentityId; @Column(name = "plan_code") private String planCode; @Column(name = "policy_entry_date") private Date policyEntryDate; @Column(name = "remark") private String remark; @Column(name = "closed_reason") private String closedReason; @Column(name = "closed_other_reason") private String closedOtherReason; @Column(name = "appointment_id") private Long appointmentId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getPolicyholderIdentityId() { return policyholderIdentityId; } public void setPolicyholderIdentityId(String policyholderIdentityId) { this.policyholderIdentityId = policyholderIdentityId; } public String getPlanCode() { return planCode; } public void setPlanCode(String planCode) { this.planCode = planCode; } public Date getPolicyEntryDate() { return policyEntryDate; } public void setPolicyEntryDate(Date policyEntryDate) { this.policyEntryDate = policyEntryDate; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getClosedReason() { return closedReason; } public void setClosedReason(String closedReason) { this.closedReason = closedReason; } public String getClosedOtherReason() { return closedOtherReason; } public void setClosedOtherReason(String closedOtherReason) { this.closedOtherReason = closedOtherReason; } public Long getAppointmentId() { return appointmentId; } public void setAppointmentId(Long appointmentId) { this.appointmentId = appointmentId; } } pamapi/src/main/java/com/pollex/pam/repository/AppointmentClosedInfoRepository.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.AppointmentClosedInfo; @Repository public interface AppointmentClosedInfoRepository extends JpaRepository<AppointmentClosedInfo, Long>{ } pamapi/src/main/java/com/pollex/pam/service/AppointmentClosedInfoService.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,10 @@ package com.pollex.pam.service; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class AppointmentClosedInfoService { } pamapi/src/main/java/com/pollex/pam/service/dto/AbstractAppointmentProcessDTO.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,28 @@ package com.pollex.pam.service.dto; import com.pollex.pam.enums.ContactStatusEnum; public abstract class AbstractAppointmentProcessDTO{ private ContactStatusEnum contactStatus; private Long appointmentId; public ContactStatusEnum getContactStatus() { return contactStatus; } public void setContactStatus(ContactStatusEnum contactStatus) { this.contactStatus = contactStatus; } public Long getAppointmentId() { return appointmentId; } public void setAppointmentId(Long appointmentId) { this.appointmentId = appointmentId; } } pamapi/src/main/java/com/pollex/pam/service/dto/AppointmentCloseDTO.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,68 @@ package com.pollex.pam.service.dto; import java.util.Date; import com.pollex.pam.enums.ContactStatusEnum; public class AppointmentCloseDTO{ private String policyholderIdentityId; private String planCode; private Date policyEntryDate; private String remark; private String closedReason; private String closedOtherReason; private ContactStatusEnum contactStatus; private Long appointmentId; public String getPolicyholderIdentityId() { return policyholderIdentityId; } public void setPolicyholderIdentityId(String policyholderIdentityId) { this.policyholderIdentityId = policyholderIdentityId; } public String getPlanCode() { return planCode; } public void setPlanCode(String planCode) { this.planCode = planCode; } public Date getPolicyEntryDate() { return policyEntryDate; } public void setPolicyEntryDate(Date policyEntryDate) { this.policyEntryDate = policyEntryDate; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getClosedReason() { return closedReason; } public void setClosedReason(String closedReason) { this.closedReason = closedReason; } public String getClosedOtherReason() { return closedOtherReason; } public void setClosedOtherReason(String closedOtherReason) { this.closedOtherReason = closedOtherReason; } public ContactStatusEnum getContactStatus() { return contactStatus; } public void setContactStatus(ContactStatusEnum contactStatus) { this.contactStatus = contactStatus; } public Long getAppointmentId() { return appointmentId; } public void setAppointmentId(Long appointmentId) { this.appointmentId = appointmentId; } } pamapi/src/main/java/com/pollex/pam/service/dto/ClosedProcessDTO.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,29 @@ package com.pollex.pam.service.dto; public class ClosedProcessDTO extends AbstractAppointmentProcessDTO{ private String remark; private String closedReason; private String closedOtherReason; public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getClosedReason() { return closedReason; } public void setClosedReason(String closedReason) { this.closedReason = closedReason; } public String getClosedOtherReason() { return closedOtherReason; } public void setClosedOtherReason(String closedOtherReason) { this.closedOtherReason = closedOtherReason; } } pamapi/src/main/java/com/pollex/pam/service/dto/DoneProcessDTO.java
¤ñ¹ï·sÀÉ®× @@ -0,0 +1,39 @@ package com.pollex.pam.service.dto; import java.util.Date; public class DoneProcessDTO extends AbstractAppointmentProcessDTO{ private String policyholderIdentityId; private String planCode; private Date policyEntryDate; private String remark; public String getPolicyholderIdentityId() { return policyholderIdentityId; } public void setPolicyholderIdentityId(String policyholderIdentityId) { this.policyholderIdentityId = policyholderIdentityId; } public String getPlanCode() { return planCode; } public void setPlanCode(String planCode) { this.planCode = planCode; } public Date getPolicyEntryDate() { return policyEntryDate; } public void setPolicyEntryDate(Date policyEntryDate) { this.policyEntryDate = policyEntryDate; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } } pamapi/src/main/java/com/pollex/pam/web/rest/AppointmentResource.java
@@ -1,14 +1,22 @@ package com.pollex.pam.web.rest; import com.pollex.pam.appointment.process.AppointmentProcess; import com.pollex.pam.domain.Appointment; import com.pollex.pam.enums.ContactStatusEnum; import com.pollex.pam.service.SendMsgService; import com.pollex.pam.service.dto.AppointmentUpdateDTO; import com.pollex.pam.service.dto.ClosedProcessDTO; import com.pollex.pam.service.dto.DoneProcessDTO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import com.pollex.pam.service.AppointmentService; import com.pollex.pam.service.SatisfactionService; import com.pollex.pam.service.dto.AppointmentCloseDTO; import com.pollex.pam.service.dto.AppointmentCreateDTO; import com.pollex.pam.service.dto.AppointmentCustomerViewDTO; @@ -24,6 +32,9 @@ @Autowired SendMsgService sendMsgService; @Autowired AppointmentProcess abstractAppointmentProcess; @PutMapping("") public ResponseEntity<Void> updateAppointment(@RequestBody AppointmentUpdateDTO appointment) { @@ -59,4 +70,24 @@ appointmentService.recordConsultantReadTime(appointmentId); return ResponseEntity.noContent().build(); } @PostMapping("/close") public ResponseEntity<Void> closeAppointment(@RequestBody AppointmentCloseDTO closeDTO) { if(closeDTO.getContactStatus() == ContactStatusEnum.DONE) { DoneProcessDTO dto = new DoneProcessDTO(); BeanUtils.copyProperties(closeDTO, dto); abstractAppointmentProcess.process(dto); }else if(closeDTO.getContactStatus() == ContactStatusEnum.CLOSED){ ClosedProcessDTO dto = new ClosedProcessDTO(); BeanUtils.copyProperties(closeDTO, dto); abstractAppointmentProcess.process(dto); } // Appointment ap = appointmentService.findById(closeDTO.getAppointmentId()); // System.out.println("getClosedInfo().getClosedOtherReason()::"+ap.getClosedInfo().getClosedOtherReason()); return ResponseEntity.noContent().build(); } }