保誠-保戶業務員媒合平台
wayne
2021-11-29 7c94cd336bb31986d9744657f7a91cddfb34c21e
[update]【todo 131166】修正customer detail命名,ID -> DB_ID
修改6個檔案
21 ■■■■ 已變更過的檔案
pamapi/src/main/java/com/pollex/pam/enums/CustomerDetailEnum.java 2 ●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/security/SecurityUtils.java 4 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java 3 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java 6 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/CustomerAuthService.java 2 ●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/CustomerService.java 4 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/enums/CustomerDetailEnum.java
@@ -1,7 +1,7 @@
package com.pollex.pam.enums;
public enum CustomerDetailEnum {
    ID("CustomerId"),
    DB_ID("CustomerDBId"),
    NAME("CustomerName");
    private final String value;
pamapi/src/main/java/com/pollex/pam/security/SecurityUtils.java
@@ -107,9 +107,9 @@
        return userDetails.get(ConsultantDetailEnum.AGENT_NO.getValue());
    }
    public static Long getCustomerId() {
    public static Long getCustomerDBId() {
        Map<String, String> userDetails = getCurrentUserDetails();
        return Long.parseLong(userDetails.get(CustomerDetailEnum.ID.getValue()));
        return Long.parseLong(userDetails.get(CustomerDetailEnum.DB_ID.getValue()));
    }
    public static Map<String, String> getCurrentUserDetails() {
pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java
@@ -16,7 +16,6 @@
import com.pollex.pam.service.dto.AppointmentCustomerViewDTO;
import com.pollex.pam.service.mapper.AppointmentCustomerViewMapper;
import com.pollex.pam.service.mapper.AppointmentDTOMapper;
import com.pollex.pam.service.mapper.AppointmentMapper;
import com.pollex.pam.web.rest.errors.AppointmentNotFoundException;
@Service
@@ -40,7 +39,7 @@
    public void customerCreateAppointment(AppointmentCreateDTO appointmentCreateDTO) {
        Appointment appointment = appointmentDTOMapper.toAppointment(appointmentCreateDTO);
        appointment.setCustomerId(SecurityUtils.getCustomerId());
        appointment.setCustomerId(SecurityUtils.getCustomerDBId());
        appointment.setCommunicateStatus(ContactStatusEnum.RESERVED);
        appointmentRepository.save(appointment);
    }
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -44,7 +44,7 @@
    AppointmentCustomerViewMapper appointmentCustomerViewMapper;
    public List<ConsultantDTO> getMyConsultantList() {
        Long userId = SecurityUtils.getCustomerId();
        Long userId = SecurityUtils.getCustomerDBId();
        return customerFavoriteConsultantRepository.findAllByCustomerId(userId)
            .stream()
            .map(consultantMapper::toDto)
@@ -81,7 +81,7 @@
    public void addConsultantToCustomList(AddConsultantParam param) {
        List<String> agentNoList = param.getAgentNoList();
        List<Consultant> consultants = consultantRepository.findAllByAgentNoIn(agentNoList);
        Long userId = SecurityUtils.getCustomerId();
        Long userId = SecurityUtils.getCustomerDBId();
        consultants.forEach(consultant -> {
            boolean isConsultantInList = customerFavoriteConsultantRepository.findOneByCustomerIdAndConsultant(userId, consultant).isPresent();
@@ -107,7 +107,7 @@
    }
    public void removeConsultantFromCustomList(String agentNo) {
        Long customId = SecurityUtils.getCustomerId();
        Long customId = SecurityUtils.getCustomerDBId();
        Consultant consultant = consultantRepository.findOneByAgentNo(agentNo).orElseThrow(ConsultantNotFoundException::new);
        CustomerFavoriteConsultant target = customerFavoriteConsultantRepository.findOneByCustomerIdAndConsultant(customId, consultant).orElse(null);
pamapi/src/main/java/com/pollex/pam/service/CustomerAuthService.java
@@ -59,7 +59,7 @@
                new UsernamePasswordAuthenticationToken(account, otpCode, grantedAuths);
        Map<String, String> details = new HashMap<>();
        details.put(CustomerDetailEnum.ID.getValue(), customer.getId().toString());
        details.put(CustomerDetailEnum.DB_ID.getValue(), customer.getId().toString());
        details.put(CustomerDetailEnum.NAME.getValue(), customer.getName());
        authenticationToken.setDetails(details);
pamapi/src/main/java/com/pollex/pam/service/CustomerService.java
@@ -64,7 +64,7 @@
    }
    public void updateLoggedCustomer(CustomerDTO customerDTO) {
        Long customerId = SecurityUtils.getCustomerId();
        Long customerId = SecurityUtils.getCustomerDBId();
        Customer customer = customerRepository.findById(customerId)
            .orElseThrow(() -> new UsernameNotFoundException("customerId which is from token is not found in customer db table, customer id = " + customerId));
@@ -75,7 +75,7 @@
    }
    public CustomerDTO getLoggedCustomerDTO() {
        Long customerId = SecurityUtils.getCustomerId();
        Long customerId = SecurityUtils.getCustomerDBId();
        Customer customer = customerRepository.findById(customerId)
            .orElseThrow(() -> new UsernameNotFoundException("customerId which is from token is not found in customer db table, customer id = " + customerId));