| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | |
| | | }}; |
| | | |
| | | private static final HashMap<String, Object> historyPointMap = new HashMap<String, Object>() {{ |
| | | put("HCSY001", "蒸汽消耗"); |
| | | put("HCSY020", "初冷器出口煤气温度"); |
| | | put("HCSY021", "洗苯塔后煤气含苯"); |
| | | put("HCSY022", "脱硫后H2S含量"); |
| | | put("F0000101006", "蒸汽消耗"); |
| | | put("F0000101006", "初冷器出口煤气温度"); |
| | | put("F0000101006", "洗苯塔后煤气含苯"); |
| | | put("F0000101006", "脱硫后H2S含量"); |
| | | }}; |
| | | |
| | | private static final String jsonStr="{\n" + |
| | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String yesterday = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | Date startDate = calendar.getTime(); |
| | | calendar.add(Calendar.HOUR, 8); |
| | | Date endDate = calendar.getTime(); |
| | | String clock = ""; |
| | | String analyClass = ""; |
| | | if (hour == 0) { |
| | | clock = yesterday.concat("-").concat("A"); |
| | | if (hour >= 8 && hour < 16) { |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | startDate = calendar.getTime(); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 8); |
| | | endDate = calendar.getTime(); |
| | | clock = DateUtils.format(startDate).concat("-").concat("A"); |
| | | analyClass = "甲班"; |
| | | } else if (hour == 8) { |
| | | clock = yesterday.concat("-").concat("B"); |
| | | } else if (hour >= 16 && hour < 24) { |
| | | calendar.set(Calendar.HOUR_OF_DAY, 8); |
| | | startDate = calendar.getTime(); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 8); |
| | | endDate = calendar.getTime(); |
| | | clock = DateUtils.format(startDate).concat("-").concat("B"); |
| | | analyClass = "乙班"; |
| | | } else if (hour == 16) { |
| | | clock = yesterday.concat("-").concat("C"); |
| | | } else if (hour >= 0 && hour < 8) { |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 16); |
| | | startDate = calendar.getTime(); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 8); |
| | | endDate = calendar.getTime(); |
| | | clock = DateUtils.format(startDate).concat("-").concat("B"); |
| | | analyClass = "丙班"; |
| | | } |
| | | Map<String, Object> tMap = new HashMap<>(); |
| | | tMap.put("relId", UUID.randomUUID().toString()); |
| | | tMap.put("process", "化产工序"); |
| | | tMap.put("reportName", "化产工序"); |
| | | tMap.put("analyDate", yesterday); |
| | | tMap.put("analyDate", DateUtils.format(startDate)); |
| | | tMap.put("analyClass", analyClass); |
| | | tMap.put("clock", clock); |
| | | tMap.put("analyContent", "化产蒸汽消耗量异常"); |