保誠-保戶業務員媒合平台
wayne
2022-02-14 a2edb2c55c3ef6129db84ac92c78970bc8bd27e5
[update] [todo 135313] 客戶填寫滿意度問卷api調整,並增加填寫時的檢核

刪除2個檔案
修改4個檔案
98 ■■■■ 已變更過的檔案
pamapi/src/doc/滿意度/客戶填寫平台滿意度.txt 22 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/doc/滿意度/客戶填寫滿意度問卷.txt 10 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/SatisfactionService.java 18 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionCustomerScoreDTO.java 19 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionSystemScoreDTO.java 23 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/web/rest/SatisfactionResource.java 6 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/doc/º¡·N«×/«È¤á¶ñ¼g¥­¥xº¡·N«×.txt
Àɮפw§R°£
pamapi/src/doc/º¡·N«×/«È¤á¶ñ¼gº¡·N«×°Ý¨÷.txt
@@ -8,8 +8,9 @@
request body:
{
    "satisfactionId": 84,
    "score":4
    "appointmentId": 482,
    "score":4,
    "type": "APPOINTMENT"   // "APPOINTMENT" è¡¨é‡å°æ­¤æ¬¡é ç´„的顧問滿意度、 "SYSTEM" å‰‡æ˜¯é‡å°å¹³å°çš„æ»¿æ„åº¦
}
response body:
@@ -33,8 +34,9 @@
request body:
[{
    "satisfactionId": 84,
    "score":4
    "appointmentId": 482,
    "score":4,
    "type": "APPOINTMENT"   // "APPOINTMENT" è¡¨é‡å°æ­¤æ¬¡é ç´„的顧問滿意度、 "SYSTEM" å‰‡æ˜¯é‡å°å¹³å°çš„æ»¿æ„åº¦
}]
pamapi/src/main/java/com/pollex/pam/service/SatisfactionService.java
@@ -6,7 +6,6 @@
import com.pollex.pam.enums.SatisfactionTypeEnum;
import com.pollex.pam.security.SecurityUtils;
import com.pollex.pam.service.dto.SatisfactionSystemScoreDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +25,7 @@
import com.pollex.pam.service.mapper.SatisfactionMapper;
import com.pollex.pam.web.rest.errors.SatisfactionAlreadyExistException;
import com.pollex.pam.web.rest.errors.SatisfactionNotFoundException;
import org.springframework.util.Assert;
@Service
@Transactional
@@ -66,8 +66,12 @@
    }
    public Satisfaction scorefaction(SatisfactionCustomerScoreDTO scoreDTO) {
        Optional<Satisfaction> satisfactionOP = satisfactionRepository.findById(scoreDTO.getSatisfactionId());
        Optional<Satisfaction> satisfactionOP = satisfactionRepository.findOneByAppointmentIdAndType(scoreDTO.getAppointmentId(), scoreDTO.getType());
        Satisfaction satisfaction = satisfactionOP.orElseThrow(SatisfactionNotFoundException::new);
        boolean isSameCustomer = satisfaction.getCustomerId().equals(SecurityUtils.getCustomerDBId());
        Assert.isTrue(isSameCustomer, "The currently logged in customer has a different ID than the customer on Satisfaction");
        satisfaction.setScore(scoreDTO.getScore());
        satisfaction.setStatus(SatisfactionStatusEnum.FILLED);
        save(satisfaction);
@@ -126,15 +130,5 @@
        satisfaction.setType(SatisfactionTypeEnum.SYSTEM);
        satisfactionRepository.save(satisfaction);
    }
    public Satisfaction fillSystemSatisfaction(SatisfactionSystemScoreDTO scoreDTO) {
        Optional<Satisfaction> systemSatisfactionOptional =
            satisfactionRepository.findOneByAppointmentIdAndType(scoreDTO.getAppointmentId(), SatisfactionTypeEnum.SYSTEM);
        Satisfaction satisfaction = systemSatisfactionOptional.orElseThrow(SatisfactionNotFoundException::new);
        satisfaction.setStatus(SatisfactionStatusEnum.FILLED);
        satisfaction.setScore(scoreDTO.getScore());
        return satisfactionRepository.save(satisfaction);
    }
}
pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionCustomerScoreDTO.java
@@ -1,15 +1,18 @@
package com.pollex.pam.service.dto;
import com.pollex.pam.enums.SatisfactionTypeEnum;
public class SatisfactionCustomerScoreDTO {
    private Long satisfactionId;
    private Long appointmentId;
    private Float score;
    private SatisfactionTypeEnum type;
    public Long getSatisfactionId() {
        return satisfactionId;
    public Long getAppointmentId() {
        return appointmentId;
    }
    public void setSatisfactionId(Long satisfactionId) {
        this.satisfactionId = satisfactionId;
    public void setAppointmentId(Long appointmentId) {
        this.appointmentId = appointmentId;
    }
    public Float getScore() {
        return score;
@@ -17,4 +20,10 @@
    public void setScore(Float score) {
        this.score = score;
    }
    public SatisfactionTypeEnum getType() {
        return type;
    }
    public void setType(SatisfactionTypeEnum type) {
        this.type = type;
    }
}
pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionSystemScoreDTO.java
Àɮפw§R°£
pamapi/src/main/java/com/pollex/pam/web/rest/SatisfactionResource.java
@@ -3,7 +3,6 @@
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;
@@ -49,10 +48,5 @@
        }
        log.error("Not has agent code and customer id");
        throw new IllegalArgumentException("Not has agent code and customer id");
    }
    @PostMapping("/system/score")
    public Satisfaction fillSystemSatisfaction(@RequestBody SatisfactionSystemScoreDTO scoreDTO) {
        return satisfactionService.fillSystemSatisfaction(scoreDTO);
    }
}