|
@@ -1,5 +1,6 @@
|
|
|
package com.steerinfo.ems.foldthevalues.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.steerinfo.ems.Utils.DateUtils;
|
|
|
import com.steerinfo.ems.emscalorificvalue.mapper.EmsCalorificValueMapper;
|
|
|
import com.steerinfo.ems.emscalorificvalue.model.EmsCalorificValue;
|
|
@@ -12,6 +13,8 @@ import com.steerinfo.ems.foldthevalues.mapper.FoldTheValuesMapper;
|
|
|
import com.steerinfo.ems.foldthevalues.service.IFoldTheValuesService;
|
|
|
import com.steerinfo.framework.service.pagehelper.PageHelper;
|
|
|
import com.steerinfo.framework.service.pagehelper.PageList;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -45,6 +48,7 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
|
|
|
private EmsCalorificValueMapper emsCalorificValueMapper;
|
|
|
@Autowired
|
|
|
private NjFormulaMapper njFormulaMapper;
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(FoldTheValuesServiceImpl.class);
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -58,23 +62,29 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
|
|
|
DecimalFormat df = new DecimalFormat("0.000");
|
|
|
FoldTheValues foldTheValue = new FoldTheValues();
|
|
|
for (FoldTheValues foldTheValues : newDate) {
|
|
|
- foldTheValue.setId(foldTheValues.getId());
|
|
|
- foldTheValue.setMaterialsource(foldTheValues.getMaterialsource());
|
|
|
- foldTheValue.setMaterialno(this.getTrmenergyid(foldTheValues.getMaterialno()));
|
|
|
- foldTheValue.setClock(foldTheValues.getClock());
|
|
|
- foldTheValue.setCode(df.format(Double.valueOf(String.valueOf(foldTheValues.getCode()))));
|
|
|
- foldTheValue.setTimegranid("DAY");
|
|
|
- foldTheValue.setUnitid("032");
|
|
|
- foldTheValue.setDescription("低热值");
|
|
|
- foldTheValue.setBz("采用当天热值进行换算,当天无检测结果,则取最近热值进行换算");
|
|
|
- foldTheValue.setEstimatedvalue(foldTheValues.getEstimatedvalue());
|
|
|
- FoldTheValues byClockAndMaterialno = foldTheValuesMapper.getByClockAndMaterialno(foldTheValue);
|
|
|
- if(byClockAndMaterialno != null){
|
|
|
- foldTheValuesMapper.updateByClockAndMaterialno(foldTheValue);
|
|
|
- foldTheValuesMapper.updateByClock(foldTheValues);
|
|
|
- } else {
|
|
|
- foldTheValuesMapper.insert(foldTheValue);
|
|
|
+ try{
|
|
|
+ foldTheValue.setId(foldTheValues.getId());
|
|
|
+ foldTheValue.setMaterialsource(foldTheValues.getMaterialsource());
|
|
|
+ foldTheValue.setMaterialno(this.getTrmenergyid(foldTheValues.getMaterialno()));
|
|
|
+ foldTheValue.setClock(foldTheValues.getClock());
|
|
|
+ foldTheValue.setCode(df.format(Double.valueOf(String.valueOf(foldTheValues.getCode()))));
|
|
|
+ foldTheValue.setTimegranid("DAY");
|
|
|
+ foldTheValue.setUnitid("032");
|
|
|
+ foldTheValue.setDescription("低热值");
|
|
|
+ foldTheValue.setBz("采用当天热值进行换算,当天无检测结果,则取最近热值进行换算");
|
|
|
+ foldTheValue.setEstimatedvalue(foldTheValues.getEstimatedvalue());
|
|
|
+ FoldTheValues byClockAndMaterialno = foldTheValuesMapper.getByClockAndMaterialno(foldTheValue);
|
|
|
+ if(byClockAndMaterialno != null){
|
|
|
+ foldTheValuesMapper.updateByClockAndMaterialno(foldTheValue);
|
|
|
+ foldTheValuesMapper.updateByClock(foldTheValues);
|
|
|
+ } else {
|
|
|
+ foldTheValuesMapper.insert(foldTheValue);
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ logger.info("本次大宗低热值收发数据出错" + JSONObject.toJSONString(foldTheValue));
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
//读取昨天数据
|
|
@@ -110,7 +120,7 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
|
|
|
if(materialno.equals("P00008")){
|
|
|
return "P006";
|
|
|
}
|
|
|
- return null;
|
|
|
+ return materialno;
|
|
|
}
|
|
|
|
|
|
//获取动力每月的得折标值
|