
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package com.takensoft.pohangTp.hwaSin.service;
import com.takensoft.pohangTp.hwaSin.dao.HwaSinDAO;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Service
public class HwaSinService {
private final HwaSinDAO hwaSinDAO;
public HwaSinService(HwaSinDAO hwaSinDAO) {
this.hwaSinDAO = hwaSinDAO;
}
/**
* 시간대별 평균 길이 Z축 마모
*
* @author 김성훈
* @since 2024.01.18
*/
public List<HashMap<String, Object>> timeZWear(String tl_no) throws Exception {
return hwaSinDAO.timeZWear(tl_no);
}
/**
* 월별 평균 길이 Z축 마모
*
* @author 김성훈
* @since 2024.01.18
*/
public List<HashMap<String, Object>> monthZWear(String tl_no) throws Exception {
return hwaSinDAO.monthZWear(tl_no);
}
/**
* 가동시간에 따른 각 툴별(도구) 길이 Z축 마모
*
* @author 김성훈
* @since 2024.01.22
*/
public List<HashMap<String, Object>> toolZWear() {
List<HashMap<String, Object>> toolZWear = hwaSinDAO.toolZWear();
String oldDate = toolZWear.get(0).get("search_date").toString();
List<HashMap<String, Object>> toolZwearList = new ArrayList<>();
HashMap<String, Object> dateOne = new HashMap<>();
for (int i = 0; i < toolZWear.size(); i++) {
HashMap<String, Object> one = toolZWear.get(i);
String date = one.get("search_date").toString();
if(oldDate.equals(date)) {
dateOne.put("search_date", one.get("search_date"));
dateOne.put(one.get("tl_no").toString(), Math.abs(Double.parseDouble(one.get("ofs5").toString())));
if(i+1 == toolZWear.size()) {
HashMap<String, Object> inputDate = new HashMap<>(dateOne);
toolZwearList.add(inputDate);
}
} else {
HashMap<String, Object> inputDate = new HashMap<>(dateOne);
toolZwearList.add(inputDate);
oldDate = one.get("search_date").toString();
dateOne.put(one.get("tl_no").toString(), Math.abs(Double.parseDouble(one.get("ofs5").toString())));
}
}
return toolZwearList;
}
/**
* 가동시간에 따른 각 툴별(도구) 길이 X축 마모
*
* @author 김성훈
* @since 2024.01.22
*/
public Object toolXWear() {
List<HashMap<String, Object>> toolXwear = hwaSinDAO.toolXWear();
String oldDate = toolXwear.get(0).get("search_date").toString();
List<HashMap<String, Object>> toolXWearList = new ArrayList<>();
HashMap<String, Object> dateOne = new HashMap<>();
for (int i = 0; i < toolXwear.size(); i++) {
HashMap<String, Object> one = toolXwear.get(i);
String date = one.get("search_date").toString();
if(oldDate.equals(date)) {
dateOne.put("search_date", one.get("search_date"));
dateOne.put(one.get("tl_no").toString(), Math.abs(Double.parseDouble(one.get("ofs4").toString())));
if(i+1 == toolXwear.size()) {
HashMap<String, Object> inputDate = new HashMap<>(dateOne);
toolXWearList.add(inputDate);
}
} else {
HashMap<String, Object> inputDate = new HashMap<>(dateOne);
toolXWearList.add(inputDate);
oldDate = one.get("search_date").toString();
dateOne.put(one.get("tl_no").toString(), Math.abs(Double.parseDouble(one.get("ofs4").toString())));
}
}
return toolXWearList;
}
}