Merge branch 'Phase3' of https://dev.pollex.com.tw:8443/r/pcalife/PAM into Phase3
¤ñ¹ï·sÀÉ®× |
| | |
| | | ALTER TABLE public.satisfaction ALTER COLUMN customer_id DROP NOT NULL; |
| | | ALTER TABLE public.satisfaction ADD "type" varchar NULL; |
| | | |
| | | -- Auto-generated SQL script #202201261717 |
| | | UPDATE public.satisfaction SET "type"='APPOINTMENT'; |
| | | |
¤ñ¹ï·sÀÉ®× |
| | |
| | | http post : |
| | | http://localhost:8080/api/satisfaction/system/score |
| | | |
| | | |
| | | 填寫ä¸ç: |
| | | request body: |
| | | { |
| | | "appointmentId": 67, |
| | | "score":4 |
| | | } |
| | | |
| | | |
| | | response body: |
| | | { |
| | | "id": 93, |
| | | "customerId": 165, |
| | | "agentNo": null, |
| | | "status": "FILLED", |
| | | "score": 4.0, |
| | | "appointmentId": 482, |
| | | "type": "SYSTEM" |
| | | } |
| | |
| | | http://localhost:8080/api/consultant/all |
| | | |
| | | response body: |
| | | [ |
| | | { |
| | | "name": "", |
| | | "agentNo": "", |
| | | "role": "", |
| | | "avgScore": 0, |
| | | "serveArea": ["æ°åå¸","å®è縣","å°ä¸å¸"], |
| | | "seniority_year": 22, |
| | | "seniority_month": 10, |
| | | "expertise": [], |
| | | "gender": "female", // "male": ç·æ§ã "female": å¥³æ§ |
| | | "name": "å´å¯¨", |
| | | "agentNo": "R221444250", |
| | | "role": "å°åä¿éªç¶ç´äºº", |
| | | "avgScore": 3.3, |
| | | "serveArea": [ |
| | | "å
¨å°" |
| | | ], |
| | | "seniority_year": 38, |
| | | "seniority_month": 0, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "female", |
| | | "communicationStyle" : "謹æ
å實ãæå¿«ä¸»åãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | } |
| | | }, |
| | | { |
| | | "name": "å¬å¦¹", |
| | | "agentNo": "B282677963", |
| | | "role": "é åµä¿éªç¶ç´äºº", |
| | | "avgScore": 3.4, |
| | | "serveArea": [ |
| | | "åæç¸£", |
| | | "é«éå¸", |
| | | "屿±ç¸£" |
| | | ], |
| | | "seniority_year": 30, |
| | | "seniority_month": 8, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "female", |
| | | "communicationStyle": "謹æ
å實ãæå¿«ä¸»åãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | }, |
| | | ... |
| | | ] |
| | |
| | | (å·²æ£ç¨ï¼å å¹é
度éä¿èæ¹å°ææé¡§åè³æçµ¦å端) |
| | | http post: http://localhost:8080/api/consultant/strictQuery |
| | | |
| | | request body: |
| | |
| | | (å·²æ£ç¨ï¼å å¹é
度éä¿èæ¹å°ææé¡§åè³æçµ¦å端) |
| | | http post: http://localhost:8080/api/consultant/fastQuery |
| | | |
| | | request body: |
| | |
| | | "avgScore" : 3.1, |
| | | "title" : "èç¶ç(DM)", |
| | | "phoneNumber" : "0987168787", |
| | | "serveArea" : "å
¨å°", |
| | | "serveArea" : ["æ°åå¸","å°åå¸"], |
| | | "companyAddress" : "è±è®ç¸£çéé®ä¸æ£è·¯30è9æ¨", |
| | | "latestLoginTime" : "2021-12-24T08:48:21.497Z", |
| | | "seniority" : "38 å¹´ ", |
| | |
| | | response body: |
| | | [ |
| | | { |
| | | "agentNo": "12345", |
| | | "name": "測試æ¨è¦æ¥åå¡", |
| | | "img": "", |
| | | "expertise": [ |
| | | "財åè¦å", |
| | | "è³ç¢è½ç§»" |
| | | ], |
| | | "avgScore": 4.7, |
| | | "contactStatus": null, |
| | | "updateTime": null, |
| | | "seniority": "4å¹´2åæ", |
| | | "name": "å´å¯¨", |
| | | "agentNo": "R221444250", |
| | | "role": "å°åä¿éªç¶ç´äºº", |
| | | "new": false, |
| | | "latestAppointmentId": null |
| | | "avgScore": 3.3, |
| | | "serveArea": [ |
| | | "å
¨å°" |
| | | ], |
| | | "seniority_year": 38, |
| | | "seniority_month": 0, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "female", |
| | | "communicationStyle": "謹æ
å實ãæå¿«ä¸»åãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | }, |
| | | { |
| | | "name": "å¬å¦¹", |
| | | "agentNo": "B282677963", |
| | | "role": "é åµä¿éªç¶ç´äºº", |
| | | "avgScore": 3.4, |
| | | "serveArea": [ |
| | | "åæç¸£", |
| | | "é«éå¸", |
| | | "屿±ç¸£" |
| | | ], |
| | | "seniority_year": 30, |
| | | "seniority_month": 8, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "female", |
| | | "communicationStyle": "謹æ
å實ãæå¿«ä¸»åãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | }, |
| | | { |
| | | "name": "ä¼å¤ å", |
| | | "agentNo": "Z152717443", |
| | | "role": "åæ³°ä¿éªç¶ç´äºº", |
| | | "avgScore": 3.7, |
| | | "serveArea": [ |
| | | "æ°åå¸", |
| | | "å®è縣", |
| | | "å°ä¸å¸" |
| | | ], |
| | | "seniority_year": 17, |
| | | "seniority_month": 1, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "male", |
| | | "communicationStyle": "謹æ
å實ãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | }, |
| | | { |
| | | "name": "å®éæ©", |
| | | "agentNo": "J149388015", |
| | | "role": "å¨çä¿éªç¶ç´äºº", |
| | | "avgScore": 4.6, |
| | | "serveArea": [ |
| | | "å°åå¸", |
| | | "屿±ç¸£" |
| | | ], |
| | | "seniority_year": 22, |
| | | "seniority_month": 8, |
| | | "expertise": [ |
| | | "å¥åº·èä¿é", |
| | | "å女æè²", |
| | | "è³ç¢è¦å", |
| | | "æ¨æ´»éä¼", |
| | | "ä¿å®å¥æª¢/è¦å", |
| | | "åç´
ä¿å®" |
| | | ], |
| | | "gender": "male", |
| | | "communicationStyle": "謹æ
å實ãæå¿«ä¸»åãèå¿å¾è½ãå¥è«é¢¨è¶£" |
| | | } |
| | | ] |
| | |
| | | "expertise":["å¥åº·èä¿é","å女æè²"], |
| | | "title":"æ¥åå°å¡ (SC)", |
| | | "role":"å°åä¿éªç¶ç´äºº", |
| | | "serveArea":"å°åå¸ã屿±ç¸£", |
| | | "serveArea":["å°åå¸","屿±ç¸£"], |
| | | "gender":"male", |
| | | "phoneNumber":"09123456789", |
| | | "companyAddress":"å®è縣äºçµéä¸èè·¯3è3æ¨", |
| | |
| | | AppointmentClosedInfo closedInfo = new AppointmentClosedInfo(); |
| | | BeanUtils.copyProperties(closeProcess, closedInfo); |
| | | Appointment appointment = appointmentService.findById(processDTO.getAppointmentId()); |
| | | satisfactionService.createSatisfaction(appointment); |
| | | satisfactionService.createAppointmentSatisfaction(appointment); |
| | | return appointmentClosedInfoRepository.save(closedInfo); |
| | | } |
| | | |
| | |
| | | AppointmentClosedInfo closedInfo = new AppointmentClosedInfo(); |
| | | BeanUtils.copyProperties(doneProcess, closedInfo); |
| | | Appointment appointment = appointmentService.findById(processDTO.getAppointmentId()); |
| | | satisfactionService.createSatisfaction(appointment); |
| | | satisfactionService.createAppointmentSatisfaction(appointment); |
| | | return appointmentClosedInfoRepository.save(closedInfo); |
| | | } |
| | | |
| | |
| | | .antMatchers("/api/eService/authenticate").permitAll() |
| | | .antMatchers("/api/account/reset-password/init").permitAll() |
| | | .antMatchers("/api/account/reset-password/finish").permitAll() |
| | | .antMatchers("/api/consultant/all").permitAll() |
| | | .antMatchers("/api/consultant/recommend").permitAll() |
| | | .antMatchers("/api/consultant/detail").permitAll() |
| | | .antMatchers("/api/consultant/fastQuery").permitAll() |
| | |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Table; |
| | | |
| | | import com.pollex.pam.enums.PersonalNotificationRoleEnum; |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import org.springframework.data.annotation.CreatedDate; |
| | | import org.springframework.data.annotation.LastModifiedDate; |
| | | |
| | |
| | | |
| | | @Column(name = "appointment_id") |
| | | private Long appointmentId; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | @Column(name = "type") |
| | | private SatisfactionTypeEnum type; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | |
| | | public void setAppointmentId(Long appointmentId) { |
| | | this.appointmentId = appointmentId; |
| | | } |
| | | |
| | | public SatisfactionTypeEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(SatisfactionTypeEnum type) { |
| | | this.type = type; |
| | | } |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | package com.pollex.pam.enums; |
| | | |
| | | public enum SatisfactionTypeEnum { |
| | | APPOINTMENT, |
| | | SYSTEM |
| | | } |
| | |
| | | import java.util.Optional; |
| | | |
| | | import com.pollex.pam.enums.SatisfactionStatusEnum; |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | |
| | | @Repository |
| | | public interface SatisfactionRepository extends JpaRepository<Satisfaction, Long>{ |
| | | |
| | | List<Satisfaction> findByAgentNo(String agentNo); |
| | | List<Satisfaction> findByAgentNoAndType(String agentNo, SatisfactionTypeEnum type); |
| | | |
| | | List<Satisfaction> findByCustomerId(Long customerId); |
| | | List<Satisfaction> findByCustomerIdAndType(Long customerId, SatisfactionTypeEnum type); |
| | | |
| | | Optional<Satisfaction> findOneByAppointmentId(Long appointmentId); |
| | | |
| | | List<Satisfaction> findAllByStatus(SatisfactionStatusEnum status); |
| | | List<Satisfaction> findAllByStatusAndType(SatisfactionStatusEnum status, SatisfactionTypeEnum type); |
| | | |
| | | @Query(value = "SELECT avg(score) FROM satisfaction where agent_no=:agent_no" |
| | | @Query(value = "SELECT avg(score) FROM satisfaction where type='APPOINTMENT'" |
| | | + " and agent_no=:agent_no" |
| | | + " and score is not null" |
| | | , nativeQuery = true) |
| | | Float getAgentScoreAvg(@Param("agent_no") String agentNo); |
| | |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | public List<ConsultantDTO> getAllConsultantList() { |
| | | return consultantRepository.findAll() |
| | | .stream() |
| | | .map(consultantMapper::toDto) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Deprecated |
| | | public List<ConsultantDTO> strictQueryConsultant(StrictQueryConsultantParam param) { |
| | | return consultantRepository.findAll(ConsultantQuerySpec.getStrictQuerySpec(param)) |
| | | .stream() |
| | |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Deprecated |
| | | public List<ConsultantDTO> fastQueryConsultant(FastQueryConsultantParam param) { |
| | | return consultantRepository.findAll(ConsultantQuerySpec.getFastQuerySpec(param)) |
| | | .stream() |
| | |
| | | personalNotificationRepository.save(entity); |
| | | } |
| | | |
| | | public void createNotFillSatisfactionSumToCustomer(Long customerId, int notFillSatisfactionSum) { |
| | | public void createNotFillAppointmentSatisfactionNumberToCustomer(Long customerId, int notFillSatisfactionSum) { |
| | | PersonalNotification entity = new PersonalNotification(); |
| | | |
| | | String content = "æ¨æ "+notFillSatisfactionSum+" çé¡§åçæ»¿æåº¦éè¦å¡«å¯«"; |
| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import com.pollex.pam.security.SecurityUtils; |
| | | import com.pollex.pam.service.dto.SatisfactionSystemScoreDTO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | Satisfaction satisfaction = satisfactionOP.orElseThrow(SatisfactionNotFoundException::new); |
| | | satisfaction.setScore(scoreDTO.getScore()); |
| | | satisfaction.setStatus(SatisfactionStatusEnum.FILLED); |
| | | satisfaction.setType(SatisfactionTypeEnum.APPOINTMENT); |
| | | save(satisfaction); |
| | | personalNotificationService.createScorefactionToConsultant(satisfaction); |
| | | return satisfaction; |
| | | } |
| | | |
| | | public Satisfaction createSatisfaction(Appointment appointment) { |
| | | public Satisfaction createAppointmentSatisfaction(Appointment appointment) { |
| | | boolean isexist = getByAppointmentId(appointment.getId()).isPresent(); |
| | | if(isexist) { |
| | | throw new SatisfactionAlreadyExistException(); |
| | | } |
| | | Satisfaction satisfaction = appointmentMapper.toSatisfaction(appointment); |
| | | Satisfaction satisfaction = appointmentMapper.toAppointmentSatisfaction(appointment); |
| | | return save(satisfaction); |
| | | } |
| | | // |
| | |
| | | // return save(satisfaction); |
| | | // } |
| | | |
| | | public List<SatisfactionDTO> getByAgentNo(String agentNo) { |
| | | List<Satisfaction> satisfactionList = satisfactionRepository.findByAgentNo(agentNo); |
| | | public List<SatisfactionDTO> getByAgentNoAndType(String agentNo, SatisfactionTypeEnum type) { |
| | | List<Satisfaction> satisfactionList = satisfactionRepository.findByAgentNoAndType(agentNo, type); |
| | | return satisfactionMapper.toDTO(satisfactionList); |
| | | } |
| | | |
| | | public List<SatisfactionDTO> getByCustomerId(Long customerDBId) { |
| | | List<Satisfaction> satisfactionList = satisfactionRepository.findByCustomerId(customerDBId); |
| | | public List<SatisfactionDTO> getByCustomerIdAndType(Long customerDBId, SatisfactionTypeEnum type) { |
| | | List<Satisfaction> satisfactionList = satisfactionRepository.findByCustomerIdAndType(customerDBId, type); |
| | | return satisfactionMapper.toDTO(satisfactionList); |
| | | } |
| | | |
| | |
| | | return satisfactionRepository.findOneByAppointmentId(appointmentId); |
| | | } |
| | | |
| | | public List<Satisfaction> getByStatus(SatisfactionStatusEnum status) { |
| | | return satisfactionRepository.findAllByStatus(status); |
| | | public List<Satisfaction> getByStatusAndType(SatisfactionStatusEnum status, SatisfactionTypeEnum type) { |
| | | return satisfactionRepository.findAllByStatusAndType(status, type); |
| | | } |
| | | |
| | | public List<Satisfaction> scoreAllfaction(List<SatisfactionCustomerScoreDTO> scoreDTO) { |
| | |
| | | }); |
| | | return satisfactionList; |
| | | } |
| | | |
| | | public Satisfaction createSystemSatisfaction(SatisfactionSystemScoreDTO scoreDTO) { |
| | | Satisfaction satisfaction = new Satisfaction(); |
| | | satisfaction.setCustomerId(SecurityUtils.getCustomerDBId()); |
| | | satisfaction.setAppointmentId(scoreDTO.getAppointmentId()); |
| | | satisfaction.setStatus(SatisfactionStatusEnum.FILLED); |
| | | satisfaction.setScore(scoreDTO.getScore()); |
| | | satisfaction.setType(SatisfactionTypeEnum.SYSTEM); |
| | | return satisfactionRepository.save(satisfaction); |
| | | } |
| | | } |
| | |
| | | import com.pollex.pam.enums.AppointmentStatusEnum; |
| | | import com.pollex.pam.enums.ContactStatusEnum; |
| | | import com.pollex.pam.enums.SatisfactionStatusEnum; |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import com.pollex.pam.repository.AppointmentCustomerViewRepository; |
| | | import com.pollex.pam.repository.AppointmentExpiringNotifyRecordRepository; |
| | | import org.slf4j.Logger; |
| | |
| | | |
| | | // todo é確èªè©²æé, otis todo=134497 |
| | | @Scheduled(cron = "0 30 8 * * *") |
| | | public void sendNotFillSatisfactionToPersonalNotification() { |
| | | Map<Long, List<Satisfaction>> customerNotFillSatisfactions = satisfactionService.getByStatus(SatisfactionStatusEnum.UNFILLED) |
| | | public void sendNotFillAppointmentSatisfactionToPersonalNotification() { |
| | | Map<Long, List<Satisfaction>> customerNotFillSatisfactions = |
| | | satisfactionService.getByStatusAndType(SatisfactionStatusEnum.UNFILLED, SatisfactionTypeEnum.APPOINTMENT) |
| | | .stream() |
| | | .collect(Collectors.groupingBy(Satisfaction::getCustomerId)); |
| | | |
| | | customerNotFillSatisfactions.forEach((customerId, notFillSatisfactions) -> |
| | | personalNotificationService.createNotFillSatisfactionSumToCustomer(customerId, notFillSatisfactions.size()) |
| | | personalNotificationService.createNotFillAppointmentSatisfactionNumberToCustomer(customerId, notFillSatisfactions.size()) |
| | | ); |
| | | } |
| | | |
| | |
| | | package com.pollex.pam.service.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import com.pollex.pam.enums.ContactStatusEnum; |
| | | import com.pollex.pam.enums.GenderEnum; |
| | | |
| | | import java.time.Instant; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.List; |
| | | |
| | | public class ConsultantDTO { |
| | | |
| | | @JsonProperty("new") |
| | | private boolean newConsultant; |
| | | private String agentNo; |
| | | private String name; |
| | | private String img; |
| | | private List<String> expertise; |
| | | private Float avgScore; |
| | | private ContactStatusEnum contactStatus; |
| | | private Instant updateTime; |
| | | private String agentNo; |
| | | private String role; |
| | | private String seniority; |
| | | private Float avgScore; |
| | | private List<String> serveArea; |
| | | private Long seniority_year; |
| | | private Long seniority_month; |
| | | private List<String> expertise; |
| | | private GenderEnum gender; |
| | | private String communicationStyle; |
| | | |
| | | public boolean isNewConsultant() { |
| | | if(updateTime != null){ |
| | | Instant nowTimestamp = Instant.now(); |
| | | return ChronoUnit.DAYS.between(updateTime, nowTimestamp) < 3; |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | return false; |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getAgentNo() { |
| | |
| | | this.agentNo = agentNo; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getRole() { |
| | | return role; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getImg() { |
| | | return img; |
| | | } |
| | | |
| | | public void setImg(String img) { |
| | | this.img = img; |
| | | } |
| | | |
| | | public List<String> getExpertise() { |
| | | return expertise; |
| | | } |
| | | |
| | | public void setExpertise(List<String> expertise) { |
| | | this.expertise = expertise; |
| | | public void setRole(String role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | public Float getAvgScore() { |
| | |
| | | this.avgScore = avgScore; |
| | | } |
| | | |
| | | public ContactStatusEnum getContactStatus() { |
| | | return contactStatus; |
| | | public List<String> getServeArea() { |
| | | return serveArea; |
| | | } |
| | | |
| | | public void setContactStatus(ContactStatusEnum contactStatus) { |
| | | this.contactStatus = contactStatus; |
| | | public void setServeArea(List<String> serveArea) { |
| | | this.serveArea = serveArea; |
| | | } |
| | | |
| | | public Instant getUpdateTime() { |
| | | return updateTime; |
| | | public Long getSeniority_year() { |
| | | return seniority_year; |
| | | } |
| | | |
| | | public void setUpdateTime(Instant updateTime) { |
| | | this.updateTime = updateTime; |
| | | public void setSeniority_year(Long seniority_year) { |
| | | this.seniority_year = seniority_year; |
| | | } |
| | | |
| | | public String getRole() { |
| | | return role; |
| | | public Long getSeniority_month() { |
| | | return seniority_month; |
| | | } |
| | | |
| | | public void setRole(String role) { |
| | | this.role = role; |
| | | public void setSeniority_month(Long seniority_month) { |
| | | this.seniority_month = seniority_month; |
| | | } |
| | | |
| | | public String getSeniority() { |
| | | return seniority; |
| | | public List<String> getExpertise() { |
| | | return expertise; |
| | | } |
| | | |
| | | public void setSeniority(String seniority) { |
| | | this.seniority = seniority; |
| | | public void setExpertise(List<String> expertise) { |
| | | this.expertise = expertise; |
| | | } |
| | | |
| | | public void setNewConsultant(boolean newConsultant) { |
| | | this.newConsultant = newConsultant; |
| | | public GenderEnum getGender() { |
| | | return gender; |
| | | } |
| | | |
| | | public void setGender(GenderEnum gender) { |
| | | this.gender = gender; |
| | | } |
| | | |
| | | public String getCommunicationStyle() { |
| | | return communicationStyle; |
| | | } |
| | | |
| | | public void setCommunicationStyle(String communicationStyle) { |
| | | this.communicationStyle = communicationStyle; |
| | | } |
| | | } |
| | |
| | | private String name; |
| | | private String agentNo; |
| | | private String role; |
| | | private String img; |
| | | private Float avgScore; |
| | | private String title; |
| | | private String phoneNumber; |
| | | private String serveArea; |
| | | private List<String> serveArea; |
| | | private String companyAddress; |
| | | private Instant latestLoginTime; |
| | | private String seniority; |
| | | private Number suitability; |
| | | private Number evaluation; |
| | | private List<String> expertise; |
| | | private String concept; |
| | |
| | | this.role = role; |
| | | } |
| | | |
| | | public String getImg() { |
| | | return img; |
| | | } |
| | | |
| | | public void setImg(String img) { |
| | | this.img = img; |
| | | } |
| | | |
| | | public Float getAvgScore() { |
| | | return avgScore; |
| | | } |
| | |
| | | this.phoneNumber = phoneNumber; |
| | | } |
| | | |
| | | public String getServeArea() { |
| | | public List<String> getServeArea() { |
| | | return serveArea; |
| | | } |
| | | |
| | | public void setServeArea(String serveArea) { |
| | | public void setServeArea(List<String> serveArea) { |
| | | this.serveArea = serveArea; |
| | | } |
| | | |
| | |
| | | |
| | | public void setSeniority(String seniority) { |
| | | this.seniority = seniority; |
| | | } |
| | | |
| | | public Number getSuitability() { |
| | | return suitability; |
| | | } |
| | | |
| | | public void setSuitability(Number suitability) { |
| | | this.suitability = suitability; |
| | | } |
| | | |
| | | public Number getEvaluation() { |
| | |
| | | private List<String> expertise; |
| | | private String title; |
| | | private String role; |
| | | private String serveArea; |
| | | private List<String> serveArea; |
| | | private GenderEnum gender; |
| | | private String phoneNumber; |
| | | private String companyAddress; |
| | |
| | | public void setRole(String role) { |
| | | this.role = role; |
| | | } |
| | | public String getServeArea() { |
| | | public List<String> getServeArea() { |
| | | return serveArea; |
| | | } |
| | | public void setServeArea(String serveArea) { |
| | | public void setServeArea(List<String> serveArea) { |
| | | this.serveArea = serveArea; |
| | | } |
| | | public GenderEnum getGender() { |
| | |
| | | public void setAgentNo(String agentNo) { |
| | | this.agentNo = agentNo; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
¤ñ¹ï·sÀÉ®× |
| | |
| | | package com.pollex.pam.service.dto; |
| | | |
| | | public class SatisfactionSystemScoreDTO { |
| | | |
| | | private Long appointmentId; |
| | | private Float score; |
| | | |
| | | public Long getAppointmentId() { |
| | | return appointmentId; |
| | | } |
| | | |
| | | public void setAppointmentId(Long appointmentId) { |
| | | this.appointmentId = appointmentId; |
| | | } |
| | | |
| | | public Float getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Float score) { |
| | | this.score = score; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import com.pollex.pam.enums.SatisfactionStatusEnum; |
| | | import com.pollex.pam.repository.AppointmentRepository; |
| | | import com.pollex.pam.service.dto.AppointmentDTO; |
| | | import com.pollex.pam.service.dto.SatisfactionCustomerScoreDTO; |
| | | |
| | | @Service |
| | | public class AppointmentMapper { |
| | |
| | | .map(s -> toAppointmentDTO(s)).collect(toList()); |
| | | } |
| | | |
| | | public Satisfaction toSatisfaction(Appointment appointment) { |
| | | public Satisfaction toAppointmentSatisfaction(Appointment appointment) { |
| | | Satisfaction target = new Satisfaction(); |
| | | target.setAppointmentId(appointment.getId()); |
| | | target.setAgentNo(appointment.getAgentNo()); |
| | | target.setCustomerId(appointment.getCustomerId()); |
| | | target.setType(SatisfactionTypeEnum.APPOINTMENT); |
| | | target.setStatus(SatisfactionStatusEnum.UNFILLED); |
| | | return target; |
| | | } |
| | | |
| | | public Satisfaction toSatisfaction(Long appointmentId) { |
| | | public Satisfaction toAppointmentSatisfaction(Long appointmentId) { |
| | | Appointment appointment = appointmentRepository.findById(appointmentId).get(); |
| | | return toSatisfaction(appointment); |
| | | return toAppointmentSatisfaction(appointment); |
| | | } |
| | | |
| | | |
| | |
| | | target.setPhotoPath(FileUtil.toPath(source.getPhotoFileName(), applicationProperty.getFileFolderPath())); |
| | | String expertise = StringUtils.convertToString(source.getExpertise(), ","); |
| | | target.setExpertise(expertise); |
| | | |
| | | String serveArea = StringUtils.convertToString(source.getServeArea(), ","); |
| | | target.setServeArea(serveArea); |
| | | |
| | | target.setAward(source.getAwards()); |
| | | target.setExperience(source.getExperiences()); |
| | | } |
| | |
| | | ConsultantDTO consultantDTO = new ConsultantDTO(); |
| | | consultantDTO.setAgentNo(source.getAgentNo()); |
| | | consultantDTO.setName(source.getName()); |
| | | consultantDTO.setAvgScore(source.getAvgScore()); |
| | | consultantDTO.setSeniority(source.getSeniorityDTOString()); |
| | | consultantDTO.setExpertise(splitStringWithChar(source.getExpertise())); |
| | | consultantDTO.setImg(source.getPhotoPath()); |
| | | consultantDTO.setRole(source.getRole()); |
| | | |
| | | consultantDTO.setContactStatus(null); |
| | | consultantDTO.setUpdateTime(null); |
| | | // consultantDTO.setLatestAppointmentId(null); |
| | | consultantDTO.setAvgScore(source.getAvgScore()); |
| | | consultantDTO.setServeArea(splitStringWithChar(source.getServeArea())); |
| | | consultantDTO.setSeniority_year(source.getSeniorityYear()); |
| | | consultantDTO.setSeniority_month(source.getSeniorityMonth()); |
| | | consultantDTO.setExpertise(splitStringWithChar(source.getExpertise())); |
| | | consultantDTO.setGender(source.getGender()); |
| | | consultantDTO.setCommunicationStyle(source.getCommunicationStyle()); |
| | | |
| | | return consultantDTO; |
| | | } |
| | |
| | | consultantDetailDTO.setAvgScore(source.getAvgScore()); |
| | | consultantDetailDTO.setTitle(source.getTitle()); |
| | | consultantDetailDTO.setPhoneNumber(source.getPhoneNumber()); |
| | | consultantDetailDTO.setServeArea(source.getServeArea()); |
| | | consultantDetailDTO.setServeArea(splitStringWithChar(source.getServeArea())); |
| | | consultantDetailDTO.setCompanyAddress(source.getCompanyAddress()); |
| | | consultantDetailDTO.setSeniority(source.getSeniorityDTOString()); |
| | | consultantDetailDTO.setConcept(source.getConcept()); |
| | | consultantDetailDTO.setAwards(source.getAward()); |
| | | consultantDetailDTO.setImg(source.getPhotoPath()); |
| | | consultantDetailDTO.setExpertise(splitStringWithChar(source.getExpertise())); |
| | | consultantDetailDTO.setExperiences(source.getExperience()); |
| | | |
| | | // todo 決å®å¹é
ç¨åº¦ |
| | | consultantDetailDTO.setSuitability(50); |
| | | // todo é確èªè«®è©¢åº¦è¡¨ç¾ |
| | | consultantDetailDTO.setEvaluation(50); |
| | | |
| | | return consultantDetailDTO; |
| | |
| | | AppointmentMapper appointmentMapper; |
| | | |
| | | public Satisfaction toSatisfaction(SatisfactionCustomerScoreDTO source) { |
| | | Satisfaction satisfaction = appointmentMapper.toSatisfaction(source.getAppointmentId()); |
| | | Satisfaction satisfaction = appointmentMapper.toAppointmentSatisfaction(source.getAppointmentId()); |
| | | satisfaction.setScore(source.getScore()); |
| | | if(satisfaction.getScore()!=null) { |
| | | satisfaction.setStatus(SatisfactionStatusEnum.FILLED); |
| | |
| | | return new ResponseEntity<>(myConsultants, HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping("/all") |
| | | public ResponseEntity<List<ConsultantDTO>> getAllConsultantList() { |
| | | List<ConsultantDTO> myConsultants = consultantService.getAllConsultantList(); |
| | | return new ResponseEntity<>(myConsultants, HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping("/favorite/view") |
| | | public ResponseEntity<Void> recordMyConsultantListView() { |
| | | consultantService.recordMyConsultantListView(); |
| | |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | |
| | | @Deprecated |
| | | @PostMapping("/strictQuery") |
| | | public ResponseEntity<List<ConsultantDTO>> strictQueryConsultant(@RequestBody StrictQueryConsultantParam param) { |
| | | List<ConsultantDTO> queryResult = consultantService.strictQueryConsultant(param); |
| | | return new ResponseEntity<>(queryResult, HttpStatus.OK); |
| | | } |
| | | |
| | | @Deprecated |
| | | @PostMapping("/fastQuery") |
| | | public ResponseEntity<List<ConsultantDTO>> fastQueryConsultant(@RequestBody FastQueryConsultantParam param) { |
| | | List<ConsultantDTO> queryResult = consultantService.fastQueryConsultant(param); |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.pollex.pam.enums.SatisfactionTypeEnum; |
| | | import com.pollex.pam.service.dto.SatisfactionSystemScoreDTO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | 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.domain.Appointment; |
| | | import com.pollex.pam.domain.Satisfaction; |
| | | import com.pollex.pam.security.SecurityUtils; |
| | | import com.pollex.pam.service.SatisfactionService; |
| | | import com.pollex.pam.service.dto.SatisfactionCustomerScoreDTO; |
| | | import com.pollex.pam.service.dto.SatisfactionDTO; |
| | | import com.pollex.pam.service.dto.SatisfactionUpdateDTO; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/satisfaction") |
| | |
| | | @GetMapping("/getMySatisfaction") |
| | | public List<SatisfactionDTO> getMySatisfaction(){ |
| | | if(StringUtils.hasText(SecurityUtils.getAgentNo())) { |
| | | return satisfactionService.getByAgentNo(SecurityUtils.getAgentNo()); |
| | | return satisfactionService.getByAgentNoAndType(SecurityUtils.getAgentNo(), SatisfactionTypeEnum.APPOINTMENT); |
| | | }else if(SecurityUtils.getCustomerDBId()!=null){ |
| | | return satisfactionService.getByCustomerId(SecurityUtils.getCustomerDBId()); |
| | | return satisfactionService.getByCustomerIdAndType(SecurityUtils.getCustomerDBId(), SatisfactionTypeEnum.APPOINTMENT); |
| | | } |
| | | log.error("Not has agent code and customer id"); |
| | | throw new IllegalArgumentException("Not has agent code and customer id"); |
| | | } |
| | | |
| | | @PostMapping("/system/score") |
| | | public Satisfaction createSystemSatisfaction(@RequestBody SatisfactionSystemScoreDTO scoreDTO) { |
| | | return satisfactionService.createSystemSatisfaction(scoreDTO); |
| | | } |
| | | } |