文件名从 ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunCokingTraceModelTask.java 修改 |
| | |
| | | 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.*; |
| | |
| | | * @Description |
| | | * @createTime 2025年04月17日 |
| | | */ |
| | | @Component("runCokingTraceModelTask") |
| | | public class RunCokingTraceModelTask implements ITask { |
| | | @Component("runCokingTraceModelGXJTask") |
| | | public class RunCokingTraceModelGXJTask implements ITask { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | | logger.info("RunCokingTraceModelTask,参数为:{}", params); |
| | | logger.info("RunCokingTraceModelGXJTask,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | String yesterday = DateUtils.format(DateUtils.addDateDays(new Date(), -1), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | String clock = ""; |
| | | String analyClass = ""; |
| | | int hour = 8; |
| | | if (hour == 0) { |
| | | clock = yesterday.concat("-").concat("A"); |
| | | analyClass = "甲班"; |
| | |
| | | saveTraceInd(tMap,result); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingTraceModelTask运行异常"); |
| | | logger.error("RunCokingTraceModelGXJTask运行异常"); |
| | | ex.printStackTrace(); |
| | | } |
| | | logger.info("RunCokingTraceModelTask运行完成"); |
| | | logger.info("RunCokingTraceModelGXJTask运行完成"); |
| | | |
| | | } |
| | | |
| | | private void saveTraceReport(Map<String, Object> tMap,JSONObject result) { |
| | | public void saveTraceReport(Map<String, Object> tMap,JSONObject result) { |
| | | CokingTraceReportEntity reportEntity = new CokingTraceReportEntity(); |
| | | reportEntity.setId(tMap.get("relId").toString()); |
| | | reportEntity.setProcess(tMap.get("process").toString()); |
| | |
| | | cokingTraceReportService.save(reportEntity); |
| | | } |
| | | |
| | | private void saveTraceSuggest(Map<String, Object> tMap,JSONObject result) { |
| | | public void saveTraceSuggest(Map<String, Object> tMap,JSONObject result) { |
| | | for(int i=1;i<=2;i++){ |
| | | String steamTotal = result.get("steamTotal"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamTotal)){ |
| | | CokingTraceSuggestEntity suggestEntity = new CokingTraceSuggestEntity(); |
| | | suggestEntity.setRelId(tMap.get("relId").toString()); |
| | | suggestEntity.setProcess(tMap.get("process").toString()); |
| | | suggestEntity.setSugObj(i+"#"); |
| | | suggestEntity.setSugObj("GXJ"); |
| | | suggestEntity.setClock(tMap.get("clock").toString()); |
| | | suggestEntity.setContent(steamTotal); |
| | | suggestEntity.setCreateDate(new Date()); |
| | |
| | | } |
| | | } |
| | | |
| | | private void saveTraceDeviation(Map<String, Object> tMap,JSONObject result) { |
| | | public void saveTraceDeviation(Map<String, Object> tMap,JSONObject result) { |
| | | List<ChartParamDTO> list = mcsApi.getChartParamList(CommonConstant.STEAM_INDEX_CHARTCODE); |
| | | Map<String, String> steamIndexMaps = list.stream().collect(Collectors.toMap(ChartParamDTO::getParamCode, e -> e.getParamValue())); |
| | | Map<String, String> steamIndexMaps = list.stream().collect(Collectors.toMap(ChartParamDTO::getParamCode, e -> e.getParamName())); |
| | | for(int i=0;i<=5;i++){ |
| | | String steamFirstColoum = result.get("steamFirstColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamFirstColoum)){ |
| | |
| | | deviationEntity.setRelId(tMap.get("relId").toString()); |
| | | deviationEntity.setProcess(tMap.get("process").toString()); |
| | | deviationEntity.setClock(tMap.get("clock").toString()); |
| | | deviationEntity.setSugObj("1#"); |
| | | deviationEntity.setSugObj("GXJ"); |
| | | deviationEntity.setGroupName(steamFirstColoumMap.get("steamFirstColoum"+i).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | |
| | | deviationEntity.setRelId(tMap.get("relId").toString()); |
| | | deviationEntity.setProcess(tMap.get("process").toString()); |
| | | deviationEntity.setClock(tMap.get("clock").toString()); |
| | | deviationEntity.setSugObj("2#"); |
| | | deviationEntity.setSugObj("GXJ"); |
| | | deviationEntity.setGroupName(steamSecondColoumMap.get("steamSecondColoum" + i).toString()); |
| | | deviationEntity.setIndName(element.get(0).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | |
| | | |
| | | } |
| | | |
| | | private void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | public void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | |
| | | } |
| | | } |
| | | |
| | | private void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | | public void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("indType","干熄焦工序异常溯源"); |
| | | List<CokingTraceConfEntity> list = cokingTraceConfService.list(map); |
| | |
| | | cokingTraceIndEntity.setRelId(tMap.get("relId").toString()); |
| | | cokingTraceIndEntity.setTitle(conf.getIndType()); |
| | | cokingTraceIndEntity.setClock(tMap.get("clock").toString()); |
| | | cokingTraceIndEntity.setIndCode(conf.getIndCode()); |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |