Bladeren bron

大宗煤气热值的名称修改。从三电厂,高焦转-》计量高焦转

zhangy 10 maanden geleden
bovenliggende
commit
cad83c5a9b

+ 17 - 4
src/main/java/com/steerinfo/ems/foldthevalues/controller/FoldTheValuesController.java

@@ -66,7 +66,7 @@ public class FoldTheValuesController extends BaseRESTfulController {
         PageList<FoldTheValues> list = foldTheValuesService.queryLikeForPage(parmas, pageNum, pageSize);
         return success(list);
     }
-    
+
     @ApiOperation(value="创建", notes="根据FoldTheValues对象创建")
     @ApiImplicitParam(name = "foldTheValues", value = "详细实体foldTheValues", required = true, dataType = "FoldTheValues")
     //@RequiresPermissions("foldthevalues:create")
@@ -112,12 +112,25 @@ public class FoldTheValuesController extends BaseRESTfulController {
       return success();
     }
 
+    //重新生成
     @GetMapping("/aaa")
     public RESTfulResult getdate() throws ScriptException, ParseException {
 //        foldTheValuesService.getDate();
-         //foldTheValuesService.getMonthData();
-           //foldTheValuesService.getDataForwl();
-        //foldTheValuesService.insertNewDate();
+        //         //foldTheValuesService.getMonthData();
+        //           //foldTheValuesService.getDataForwl();
+        //        //foldTheValuesService.insertNewDate();
+        long start = System.currentTimeMillis();
+        try {
+            foldTheValuesService.getData();
+            foldTheValuesService.getDataForwl();
+            Calendar c = Calendar.getInstance();
+            if(c.get(Calendar.DATE) == 1){
+                foldTheValuesService.getMonthData();
+            }
+            foldTheValuesService.insertNewDate();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return  success();
     }
     @ApiOperation(value="获取列表", notes="分页模糊查询")

+ 9 - 0
src/main/java/com/steerinfo/ems/foldthevalues/mapper/FoldTheValuesMapper.xml

@@ -419,6 +419,9 @@
         <if test="materialno != null and materialno != ''">
           and MATERIALNO = #{materialno,jdbcType=VARCHAR}
         </if>
+        <if test="materialsource != null and materialsource != ''">
+          and MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR}
+        </if>
       </where>
   </update>
   <select id="getByClockAndMaterialno" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues" resultMap="BaseResultMap">
@@ -430,6 +433,9 @@
       <if test="materialno != null and materialno != ''">
         and MATERIALNO = #{materialno,jdbcType=VARCHAR}
       </if>
+      <if test="materialsource != null and materialsource != ''">
+        and MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR}
+      </if>
     </where>
   </select>
   <!--获取月指标数据-->
@@ -511,6 +517,9 @@ select t2.*
       <if test="materialno != null and materialno != ''">
         and MATERIALNO = #{materialno,jdbcType=VARCHAR}
       </if>
+      <if test="materialsource != null and materialsource != ''">
+        and MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR}
+      </if>
     </where>
   </update>
 </mapper>

+ 27 - 17
src/main/java/com/steerinfo/ems/foldthevalues/service/impl/FoldTheValuesServiceImpl.java

@@ -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;
     }
 
     //获取动力每月的得折标值