mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-06 23:34:18 +09:00
state list 등록
This commit is contained in:
@@ -30,6 +30,7 @@ import java.net.MalformedURLException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -554,6 +555,7 @@ public class SysMgtService {
|
||||
public SetWorkStateResDto setWorkState(SetWorkStateReqDto setWorkParam) {
|
||||
|
||||
File file = new File("C:\\efs\\home\\workState\\workStatefile.txt");
|
||||
File fileList = new File("C:\\efs\\admin\\workState\\workStatefile.txt");
|
||||
|
||||
String[] workParamArr = setWorkParam.getStartDate().split("-");
|
||||
|
||||
@@ -578,6 +580,7 @@ public class SysMgtService {
|
||||
//1. workState 파일이 없다면? 만들어라
|
||||
if(!file.exists()) {
|
||||
file.createNewFile();
|
||||
fileList.createNewFile();
|
||||
}
|
||||
|
||||
//2. Buffer를 사용해서 File에 write할 수 있는 BufferedWriter 생성
|
||||
@@ -592,12 +595,42 @@ public class SysMgtService {
|
||||
//4. Buffer
|
||||
writer.close();
|
||||
|
||||
//5. admin파일에 저장
|
||||
|
||||
String workStateData = "";
|
||||
|
||||
Resource filethree = fileService.loadAsResource(dirWorkState);
|
||||
BufferedReader reader = new BufferedReader(new FileReader(filethree.getFile()));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
reader.close();
|
||||
|
||||
FileWriter fwList = new FileWriter(fileList);
|
||||
BufferedWriter writerList = new BufferedWriter(fwList);
|
||||
|
||||
workStateData = sb.toString();
|
||||
String[] Data = workStateData.split(",");
|
||||
|
||||
List<String> newList = new ArrayList<>(Arrays.asList(workStateData));
|
||||
newList.add(setWorkState);
|
||||
|
||||
for (String data : newList) {
|
||||
writerList.write(data);
|
||||
writerList.newLine();
|
||||
}
|
||||
writerList.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.debug("setWorkParam={}",setWorkParam);
|
||||
|
||||
|
||||
|
||||
return new SetWorkStateResDto(ApiResponseCode.SUCCESS);
|
||||
}
|
||||
|
||||
@@ -611,7 +644,7 @@ public class SysMgtService {
|
||||
SysMgtMapper sysmgtmapper = sqlSessionSlave.getMapper(SysMgtMapper.class);
|
||||
|
||||
String workStateData = "";
|
||||
log.debug("1번 ={}",workStateData);
|
||||
// log.debug("1번 ={}",workStateData);
|
||||
String [] workStateDataArr = new String[7];
|
||||
log.info("getWorkStateCheck START ==========================================");
|
||||
|
||||
@@ -658,19 +691,14 @@ public class SysMgtService {
|
||||
svcCheckList.setStrHd(StrHd);
|
||||
String EndHd = svcCheckList.getEndHour()+" : "+ svcCheckList.getEndMin();
|
||||
svcCheckList.setEndHd(EndHd);
|
||||
log.debug("2번 ={}",svcCheckList);
|
||||
// log.debug("2번 ={}",svcCheckList);
|
||||
// 리스트에 항목 추가
|
||||
CheckList.add(svcCheckList);
|
||||
log.debug("3번 ={}",CheckList.get(i));
|
||||
// log.debug("3번 ={}",CheckList.get(i));
|
||||
}
|
||||
|
||||
log.debug("CheckList0={}",CheckList.get(0));
|
||||
log.debug("CheckList1={}",CheckList.get(1));
|
||||
log.debug("CheckList2={}",CheckList.get(2));
|
||||
log.debug("CheckList3={}",CheckList.get(3));
|
||||
|
||||
svcCheckListRes.setList(CheckList);
|
||||
log.debug("4번 ={}",svcCheckListRes.getList());
|
||||
// log.debug("4번 ={}",svcCheckListRes.getList());
|
||||
totalCnt = CheckList.size();
|
||||
int page = svcCheckListReqDto.getPage();
|
||||
int pagePerRows = svcCheckListReqDto.getPagePerRows();
|
||||
@@ -681,7 +709,7 @@ public class SysMgtService {
|
||||
// 파일 읽기 실패 시 "USE"로 설정하고 결과 반환
|
||||
log.error("WORK STATE READ FAIL : {}",e.getMessage(), e);
|
||||
svcCheckList.setWorkState("USE");
|
||||
log.debug("5번 ={}",svcCheckList.getWorkState());
|
||||
// log.debug("5번 ={}",svcCheckList.getWorkState());
|
||||
|
||||
String[] Data = workStateData.split(",");
|
||||
totalCnt = CheckList.size();
|
||||
|
||||
Reference in New Issue
Block a user