41 lines
1.5 KiB
Java
41 lines
1.5 KiB
Java
|
|
package com.dbnt.faisp.kwms.service;
|
||
|
|
|
||
|
|
import com.dbnt.faisp.kwms.model.VEmployee;
|
||
|
|
import com.dbnt.faisp.kwms.repository.VEmployeeRepository;
|
||
|
|
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
|
||
|
|
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
|
||
|
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
@Service
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
public class KwmsService {
|
||
|
|
private final VEmployeeRepository vEmployeeRepository;
|
||
|
|
private final CodeMgtService codeMgtService;
|
||
|
|
|
||
|
|
public UserInfo selectEmpInfo(String dicCode) {
|
||
|
|
VEmployee empInfo = vEmployeeRepository.findByDicCode(dicCode).orElse(null);
|
||
|
|
return convertVEmployeeToUserInfo(empInfo);
|
||
|
|
}
|
||
|
|
|
||
|
|
private UserInfo convertVEmployeeToUserInfo(VEmployee empInfo){
|
||
|
|
UserInfo userInfo = new UserInfo();
|
||
|
|
userInfo.setDicCode(empInfo.getDicCode());
|
||
|
|
userInfo.setUserNm(empInfo.getEmpNm());
|
||
|
|
userInfo.setSex(empInfo.getSex());
|
||
|
|
String[] positionAry = empInfo.getCallBuseoNm().split(" ");
|
||
|
|
userInfo.setOgCd(codeMgtService.searchCode("OG", positionAry[0]));
|
||
|
|
if (positionAry.length>1){
|
||
|
|
userInfo.setOfcCd(codeMgtService.searchCode("OFC", positionAry[1]));
|
||
|
|
}
|
||
|
|
userInfo.setTitleCd(codeMgtService.searchCode("JT", empInfo.getJikgeup()));
|
||
|
|
userInfo.setOutturnCd(codeMgtService.searchCode("OTC", empInfo.getGyunggwa()));
|
||
|
|
userInfo.setSeriesCd(codeMgtService.searchCode("SRC", empInfo.getJikbyul()));
|
||
|
|
|
||
|
|
return userInfo;
|
||
|
|
}
|
||
|
|
}
|