Explorar o código

Merge branch 'master' of https://git.steerinfo.com/XTEMS/xt-ems-api

# Conflicts:
#	src/main/java/com/steerinfo/task/SpringCronTask.java
QuietShadow %!s(int64=3) %!d(string=hai) anos
pai
achega
2c223c9f23

+ 3 - 1
src/main/java/com/steerinfo/ems/foldthevalues/controller/FoldTheValuesController.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.script.ScriptException;
+import java.text.ParseException;
 import java.util.*;
 import java.math.BigDecimal;
 
@@ -112,8 +113,9 @@ public class FoldTheValuesController extends BaseRESTfulController {
     }
 
     @GetMapping("/aaa")
-    public RESTfulResult getdate() throws ScriptException {
+    public RESTfulResult getdate() throws ScriptException, ParseException {
         foldTheValuesService.getDate();
+        foldTheValuesService.getMonthDate();
         return  success();
     }
     @ApiOperation(value="获取列表", notes="分页模糊查询")

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

@@ -8,6 +8,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 @Mapper
 public interface FoldTheValuesMapper extends IBaseMapper<FoldTheValues, String> {
@@ -17,4 +18,36 @@ public interface FoldTheValuesMapper extends IBaseMapper<FoldTheValues, String>
      * @return
      */
     List<Map<String, Object>> getDateForPage(HashMap<String,Object> parmas);
+
+    /**
+     * 丛质量数据中获取新的数据
+     * @return
+     */
+    List<FoldTheValues> getNewDate();
+
+    /**
+     *  获取最近最新的数据
+     */
+    FoldTheValues getNewOne(@Param("materialno") String materialno);
+
+    /**
+     *  查询今天没有指标值的数据
+     */
+    List<FoldTheValues> getNozbzData(@Param("clock") String clock);
+
+    /**
+     * 更新数据
+     */
+    int updateByClockAndMaterialno(FoldTheValues foldTheValues);
+
+    /**
+     * 查询已存在的数据
+     */
+    FoldTheValues getByClockAndMaterialno(FoldTheValues foldTheValues);
+
+    /**
+     * 查询月折标值数据
+     */
+    List<FoldTheValues> getDateForMoth(HashMap<String,Object> hashMap);
+
 }

+ 100 - 11
src/main/java/com/steerinfo/ems/foldthevalues/mapper/FoldTheValuesMapper.xml

@@ -13,10 +13,12 @@
     <result column="UNITID" jdbcType="VARCHAR" property="unitid" />
     <result column="BZ" jdbcType="VARCHAR" property="bz" />
     <result column="MATERIALNO" jdbcType="VARCHAR" property="materialno"/>
+    <result column="TIMEGRANID" jdbcType="VARCHAR" property="timegranid"/>
+    <result column="ESTIMATEDVALUE" jdbcType="VARCHAR" property="estimatedvalue"/>
   </resultMap>
   <sql id="columns">
     ID, MATERIALSOURCE, CLOCK, CODE, DESCRIPTION, ISAVAILABLE, REVISOR, REVISETIME,
-    UNITID, BZ,MATERIALNO
+    UNITID, BZ,MATERIALNO,TIMEGRANID,ESTIMATEDVALUE
   </sql>
   <sql id="columns_alias">
     t.ID, t.MATERIALSOURCE, t.CLOCK, t.CODE, t.DESCRIPTION, t.ISAVAILABLE, t.REVISOR,
@@ -135,11 +137,11 @@
     insert into FOLD_THE_VALUES (ID, MATERIALSOURCE, CLOCK,
       CODE, DESCRIPTION, ISAVAILABLE, 
       REVISOR, REVISETIME,MATERIALNO,
-      UNITID, BZ)
+      UNITID, BZ,TIMEGRANID,ESTIMATEDVALUE)
     values (#{id,jdbcType=VARCHAR}, #{materialsource,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR}, 
       #{code,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{isavailable,jdbcType=VARCHAR}, 
       #{revisor,jdbcType=VARCHAR}, #{revisetime,jdbcType=VARCHAR},#{materialno,jdbcType=VARCHAR},
-      #{unitid,jdbcType=VARCHAR}, #{bz,jdbcType=VARCHAR})
+      #{unitid,jdbcType=VARCHAR}, #{bz,jdbcType=VARCHAR},#{timegranid,jdbcType=VARCHAR},#{estimatedvalue,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
     insert into FOLD_THE_VALUES
@@ -218,7 +220,9 @@
       REVISOR = #{revisor,jdbcType=VARCHAR},
       REVISETIME = #{revisetime,jdbcType=VARCHAR},
       UNITID = #{unitid,jdbcType=VARCHAR},
-      BZ = #{bz,jdbcType=VARCHAR}
+      BZ = #{bz,jdbcType=VARCHAR},
+      TIMEGRANID = #{timegranid,jdbcType=VARCHAR},
+      ESTIMATEDVALUE = #{estimatedvalue,jdbcType=VARCHAR}
     where ID = #{id,jdbcType=VARCHAR}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
@@ -341,16 +345,101 @@
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
   <select id="getDateForPage" parameterType="java.util.HashMap" resultType="Map">
     select t.*, t1.id as energyid, t1.name as energyname
-      from Fold_the_values t
-      left join t_rm_energy t1
-      on t.materialno = t1.bdesc1
+    from Fold_the_values t
+    left join t_rm_energy t1
+    on t.materialno = t1.id
+    <where>
+     <if test = "startTime != null and startTime != '' and endTime != null and endTime != '' " >
+      and t.clock between #{startTime} and #{endTime}
+      </if >
+      <if test = "energyname != null and energyname != '' " >
+      and t1.name = #{energyname}
+      </if >
+      <if test="timegranid != null and timegranid != ''">
+      and t.timegranid = #{timegranid}
+      </if>
+    </where>
+    order by t.clock desc
+  </select>
+  <!---->
+  <select id="getNewDate" resultMap="BaseResultMap">
+  select t.batchno as id,
+          '三电厂' as materialsource,
+          to_char(to_date(t.monitordate, 'yyyymmdd hh24miss'),'yyyy-mm-dd') as clock,
+          t.monitoringvalue as estimatedvalue,
+          (t.MONITORINGVALUE * 0.03412 / 100) as code,
+          t.powersystemname as materialno
+     from t_cm_0348 t
+    where t.SITEM = 'BFHYD_05'
+      and t.powersystemname in ('P00006', 'P00007', 'P00008')
+      and t.powermonitorname in ('007', '008', '009')
+      and t.batchno not in (select distinct ID from FOLD_THE_VALUES)
+  </select>
+  <!--获取最近最新的数据-->
+  <select id="getNewOne" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select *
+      from (select *
+              from FOLD_THE_VALUES
+              <where>
+                <if test="materialno != null and materialno !=''">
+                  materialno = #{materialno}
+                </if>
+              </where>
+             order by CLOCK desc)
+     where rownum = 1
+  </select>
+  <!--查询出昨天没有折标值的数据-->
+  <select id="getNozbzData" parameterType="java.lang.String"  resultMap="BaseResultMap">
+    select distinct t.materialno
+      from FOLD_THE_VALUES t
+     where t.materialno not in
+           (select materialno from FOLD_THE_VALUES
+            <where>
+              <if test="clock != null and clock != ''">
+                clock = #{clock}
+              </if>
+            </where>
+            )
+  </select>
+  <update id="updateByClockAndMaterialno" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
+    update FOLD_THE_VALUES
+    set
+      CLOCK = #{clock,jdbcType=VARCHAR},
+      CODE = #{code,jdbcType=VARCHAR},
+      ISAVAILABLE = #{isavailable,jdbcType=VARCHAR},
+      UNITID = #{unitid,jdbcType=VARCHAR},
+      TIMEGRANID = #{timegranid,jdbcType=VARCHAR},
+      MATERIALNO = #{materialno,jdbcType=VARCHAR}
       <where>
-        <if test="clock != null and clock != '' ">
-          and t.clock = #{clock}
+        <if test="clock != null and clock != ''">
+         and CLOCK = #{clock,jdbcType=VARCHAR}
         </if>
-        <if test="energyid != null and energyid != '' ">
-          and t1.energyid = #{energyid}
+        <if test="materialno != null and materialno != ''">
+          and MATERIALNO = #{materialno,jdbcType=VARCHAR}
         </if>
       </where>
+  </update>
+  <select id="getByClockAndMaterialno" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues" resultMap="BaseResultMap">
+    select * from FOLD_THE_VALUES
+    <where>
+      <if test="clock != null and clock != ''">
+        and CLOCK = #{clock,jdbcType=VARCHAR}
+      </if>
+      <if test="materialno != null and materialno != ''">
+        and MATERIALNO = #{materialno,jdbcType=VARCHAR}
+      </if>
+    </where>
+  </select>
+  <!--获取月指标数据-->
+  <select id="getDateForMoth" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+       select sum(t.ESTIMATEDVALUE) as estimatedvalue, t.MATERIALSOURCE,t.MATERIALNO
+         from FOLD_THE_VALUES t
+        <where>
+          <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
+            T.clock between #{startTime} AND
+            #{endTime}
+          </if>
+        </where>
+        group by t.MATERIALNO,MATERIALSOURCE
   </select>
 </mapper>

+ 37 - 0
src/main/java/com/steerinfo/ems/foldthevalues/model/FoldTheValues.java

@@ -76,6 +76,43 @@ public class FoldTheValues implements IBasePO<String> {
     @ApiModelProperty(value="备注",required=false)
     private String bz;
 
+    private  String  estimatedvalue;
+    private   String  timegranid;
+    private String startTime;
+    private String endTime;
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getEstimatedvalue() {
+        return estimatedvalue;
+    }
+
+    public void setEstimatedvalue(String estimatedvalue) {
+        this.estimatedvalue = estimatedvalue;
+    }
+
+    public String getTimegranid() {
+        return timegranid;
+    }
+
+    public void setTimegranid(String timegranid) {
+        this.timegranid = timegranid;
+    }
+
     private static final long serialVersionUID = 1L;
 
     public String getId() {

+ 2 - 0
src/main/java/com/steerinfo/ems/foldthevalues/service/IFoldTheValuesService.java

@@ -5,6 +5,7 @@ import com.steerinfo.ems.foldthevalues.model.FoldTheValues;
 import com.steerinfo.framework.service.pagehelper.PageList;
 
 import javax.script.ScriptException;
+import java.text.ParseException;
 import java.util.Date;
 import java.math.BigDecimal;
 import java.util.HashMap;
@@ -28,5 +29,6 @@ public interface IFoldTheValuesService extends IBaseService<FoldTheValues, Strin
 
     public PageList<Map<String, Object>> getDateForPage(HashMap<String, Object> parmas, Integer pageNum,
                                                    Integer pageSize);
+    public void getMonthDate() throws ScriptException, ParseException;
 
 }

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

@@ -19,11 +19,10 @@ import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
 import java.text.DecimalFormat;
-import java.util.Date;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 /**
  * FoldTheValues服务实现:
@@ -54,20 +53,43 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
     }
 
     public void getDate() throws ScriptException {
-        List<EmsCalorificValue> newDate = emsCalorificValueMapper.getNewDate();
-        FoldTheValues foldTheValues = new FoldTheValues();
-        for (EmsCalorificValue emsCalorificValue : newDate) {
-            foldTheValues.setMaterialsource(emsCalorificValue.getMaterialsource());
-            foldTheValues.setClock(emsCalorificValue.getSampleno());
-            foldTheValues.setCode(this.getzbz(emsCalorificValue) == null ? "0.00" : this.getzbz(emsCalorificValue));
-            foldTheValues.setMaterialno(emsCalorificValue.getMaterialno());
-            foldTheValues.setIsavailable("0");
-            foldTheValues.setUnitid("033");
-            foldTheValues.setId(emsCalorificValue.getWtbh());
-            foldTheValuesMapper.insert(foldTheValues);
+        List<FoldTheValues> newDate = foldTheValuesMapper.getNewDate();
+        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);
+            } else {
+                foldTheValuesMapper.insert(foldTheValue);
+
+            }
+        }
+        this.insertNewDate();
+    }
+    public void insertNewDate(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.DATE, -1);
+        String clock  = DateUtils.dateStr(calendar.getTime(),"yyyy-MM-dd");
+        String id  = DateUtils.dateStr(calendar.getTime(),"yyyyMMdd");
+        List<FoldTheValues> foldTheValues = foldTheValuesMapper.getNozbzData(clock);
+        for (FoldTheValues foldTheValue : foldTheValues) {
+            FoldTheValues newOne = foldTheValuesMapper.getNewOne(foldTheValue.getMaterialno());
+            newOne.setId(id+foldTheValue.getMaterialno());
+            newOne.setClock(clock);
+            foldTheValuesMapper.insert(newOne);
         }
     }
-
     @Override
     public PageList<Map<String, Object>> getDateForPage(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum,pageSize);
@@ -76,6 +98,57 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
         return pageInfo;
     }
 
+    //高炉煤气P005 转炉煤气P007 焦炉煤气P006
+    public String getTrmenergyid(String materialno){
+        if(materialno.equals("P00006")){
+           return "P007";
+        }
+        if(materialno.equals("P00007")){
+            return  "P005";
+        }
+        if(materialno.equals("P00008")){
+           return "P006";
+        }
+        return null;
+    }
+
+    //获取每月的日数据
+    public void getMonthDate() throws ParseException, ScriptException {
+        HashMap<String,Object> hashMap =  new HashMap<>();
+        //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar  cal_1=Calendar.getInstance();//获取当前日期
+        cal_1.add(Calendar.MONTH, -1);
+        cal_1.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
+        String startTime = DateUtils.dateStr(cal_1.getTime(),"yyyy-MM-dd");//format.format(cal_1.getTime());
+        String month  = DateUtils.dateStr(cal_1.getTime(),"yyyyMM");
+        String clock  = DateUtils.dateStr(cal_1.getTime(),"yyyy-MM");
+        //获取前月的最后一天
+        Calendar cale = Calendar.getInstance();
+        cale.set(Calendar.DAY_OF_MONTH,0);//设置为1号,当前日期既为本月第一天
+        String endTime = DateUtils.dateStr(cale.getTime(),"yyyy-MM-dd");//format.format(cale.getTime());
+        int days = DateUtils.getDaysOfMonth(cal_1.getTime());
+        hashMap.put("startTime",startTime);
+        hashMap.put("endTime",endTime);
+        List<FoldTheValues> dateForMoth = foldTheValuesMapper.getDateForMoth(hashMap);
+        ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
+        DecimalFormat df   = new DecimalFormat("0.000");
+        FoldTheValues foldTheValue =  new FoldTheValues();
+        for (FoldTheValues foldTheValues : dateForMoth) {
+            foldTheValue.setId(month+foldTheValues.getMaterialno());
+            foldTheValue.setClock(clock);
+            foldTheValue.setCode(df.format(jse.eval(foldTheValues.getEstimatedvalue()+"/"+days+"*0.03412/100")).toString());
+            foldTheValue.setIsavailable("0");
+            foldTheValue.setUnitid("032");
+            foldTheValue.setDescription("低热值");
+            foldTheValue.setBz("取本月热值检测结果平均值进行热值换算");
+            foldTheValue.setMaterialno(foldTheValues.getMaterialno());
+            foldTheValue.setMaterialsource(foldTheValues.getMaterialsource());
+            foldTheValue.setTimegranid("MONTH");
+            foldTheValue.setEstimatedvalue(df.format(jse.eval(foldTheValues.getEstimatedvalue()+"/"+days)));
+            foldTheValuesMapper.insert(foldTheValue);
+        }
+
+    }
     //获取折标值
     public String getzbz(EmsCalorificValue emsCalorificValue) throws ScriptException {
         ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
@@ -110,5 +183,4 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
         DecimalFormat df   = new DecimalFormat("0.00");
         return  df.format(jse.eval(formula)).toString();
     }
-
 }

+ 21 - 0
src/main/java/com/steerinfo/ems/tcm0348/controller/TCm0348Controller.java

@@ -51,6 +51,27 @@ public class TCm0348Controller extends BaseRESTfulController {
     //@RequiresPermissions("tcm0348:view")
     @GetMapping(value = "/")
     public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        if(parmas.get("powermonitorname") != null && !parmas.get("powermonitorname").toString().isEmpty()){
+            String powermonitorname = parmas.get("powermonitorname").toString();
+            if(!powermonitorname.startsWith("'")){
+                powermonitorname = "'" + powermonitorname.replaceAll(",", "','").replaceAll(",", "','") + "'";
+            }
+            parmas.put("powermonitorname", powermonitorname);
+        }
+        if(parmas.get("sitem") != null && !parmas.get("sitem").toString().isEmpty()){
+            String sitem = parmas.get("sitem").toString();
+            if(!sitem.startsWith("'")){
+                sitem = "'" + sitem.replaceAll(",", "','").replaceAll(",", "','") + "'";
+            }
+            parmas.put("sitem", sitem);
+        }
+        if(parmas.get("powersystemname") != null && !parmas.get("powersystemname").toString().isEmpty()){
+            String powersystemname = parmas.get("powersystemname").toString();
+            if(!powersystemname.startsWith("'")){
+                powersystemname = "'" + powersystemname.replaceAll(",", "','").replaceAll(",", "','") + "'";
+            }
+            parmas.put("powersystemname", powersystemname);
+        }
         PageList<TCm0348> list = tCm0348Service.queryForPage(parmas, pageNum, pageSize);
         return success(list);
     }

+ 4 - 3
src/main/java/com/steerinfo/ems/tcm0348/mapper/TCm0348Mapper.xml

@@ -102,10 +102,10 @@
         and PLANID = #{planid, jdbcType=VARCHAR}
       </if>
       <if test="powermonitorname != null and powermonitorname != ''">
-        and POWERMONITORNAME = #{powermonitorname, jdbcType=VARCHAR}
+        and POWERMONITORNAME in (${powermonitorname})
       </if>
       <if test="powersystemname != null and powersystemname != ''">
-        and POWERSYSTEMNAME = #{powersystemname, jdbcType=VARCHAR}
+        and POWERSYSTEMNAME  in (${powersystemname})
       </if>
       <if test="batchno != null and batchno != ''">
         and BATCHNO like '%${batchno}%'
@@ -114,7 +114,7 @@
         and TIMEGRANID = #{timegranid, jdbcType=VARCHAR}
       </if>
       <if test="sitem != null and sitem != ''">
-        and SITEM = #{sitem, jdbcType=VARCHAR}
+        and SITEM  in (${sitem})
       </if>
       <if test="startTime != null and startTime != '' and endTime != null and endTime !='' ">
         and
@@ -122,6 +122,7 @@
         between to_date(#{startTime}, 'yyyy-mm-dd') and to_date(#{endTime}, 'yyyy-mm-dd')
       </if>
     </where>
+    order by  MONITORDATE desc
   </select>
 
   <insert id="batchInsert" parameterType="java.util.List">

+ 7 - 1
src/main/java/com/steerinfo/ems/trmcalpoint/controller/TRmCalpointController.java

@@ -507,7 +507,13 @@ public class TRmCalpointController extends BaseRESTfulController {
             }
             parmas.put("itemid", itemid); 
         }
-    	
+        if(parmas.get("costid") != null && !parmas.get("costid").toString().isEmpty()){
+            String costid = parmas.get("costid").toString();
+            if(!costid.startsWith("'")){
+                costid = "'" + costid.replaceAll(",", "','").replaceAll(",", "','") + "'";
+            }
+            parmas.put("costid", costid);
+        }
         PageList<Map<String, Object>> list = tRmCalpointService.getDate312ForPage(parmas, pageNum, pageSize);
         return success(list);
     }

+ 4 - 1
src/main/java/com/steerinfo/ems/trmcalpoint/mapper/TRmCalpointMapper.xml

@@ -1327,7 +1327,7 @@
   
   <!-- 能源调度管理-计量点数据管理-计量点数据录入列表 -->
   <select id="getDate312" parameterType="java.util.HashMap" resultType = "Map">
-    select timegranid,itemtype,clock,t.itemid,t.itemname,t.tag_alias,t.tag_modulus,t.unitid,t.propertyid,v.mintvalue,v.mendvalue,
+    select timegranid,itemtype,clock,t.itemid,t.itemname,t.tag_alias,t.tag_modulus,t.unitid,t.propertyid,t.costid,v.mintvalue,v.mendvalue,
     v.actualvalue,v.correctvalue,v.apportvalue,v.sumvalue,v.bz,v.crman,v.rec_time,v.upman,v.uptime,
     v.update_reason,e.name ename,nvl(l.name, '') lname
     from T_RM_CALPOINT t 
@@ -1338,6 +1338,9 @@
     <if test="itemid != null and itemid != ''">
       and t.ITEMID in (${itemid})
     </if>
+    <if test="costid != null and costid != ''">
+       and t.COSTID in  (${costid})
+    </if>
     <if test="timegranid != null and timegranid != ''">
        and TIMEGRANID = #{timegranid}
     </if>

+ 20 - 16
src/main/java/com/steerinfo/task/SpringCronTask.java

@@ -8,6 +8,7 @@ import com.steerinfo.ems.emsgmpcjh.service.IEmsGmPcJhService;
 import com.steerinfo.ems.emsscqklg.service.IEmsScqkLgService;
 import com.steerinfo.ems.emsscqklg.service.ILgRealService;
 import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
+import com.steerinfo.ems.foldthevalues.service.IFoldTheValuesService;
 import com.steerinfo.ems.ifemsmesactitem.service.IIfEmsMesActitemService;
 import com.steerinfo.ems.ifmesemsproductorder.service.IIfMesEmsProductorderService;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
@@ -44,7 +45,9 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
 import org.springframework.scheduling.support.CronTrigger;
 import org.springframework.stereotype.Service;
 
+import javax.script.ScriptException;
 import java.text.ParseException;
+import java.util.Properties;import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ScheduledFuture;
@@ -119,6 +122,8 @@ public class SpringCronTask implements SchedulingConfigurer{
 	IEmsScqkLgService emsScqkLgService;
 	@Autowired
 	ILgRealService lgRealService;
+	@Autowired
+	IFoldTheValuesService foldTheValuesService;
 	/**
 	 * SchedulingConfigurer接口的方法实现,加载后自动运行
 	 */
@@ -300,22 +305,21 @@ public class SpringCronTask implements SchedulingConfigurer{
 					 long start = System.currentTimeMillis();
 					 dzMaterialSfService.dataGeneration();
 					 emsScqkLgService.dateGenerate();
-					 logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
-				}
-				 //else if (taskId.equalsIgnoreCase("124")) {
-					// // 测试专用,2分钟一次
-					// //Date now = new Date();
-					// //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
-					// //Calendar c = Calendar.getInstance();
-					// //if (c.get(Calendar.DATE) == 1) {
-					//	 long start = System.currentTimeMillis();
-					//	 //emsGmPcJhService.addNbjh();
-					//	 emsScqkLgService.dateGenerate();
-					//	 logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
-					// //}
-				 //
-				 //}
-//				 else if (taskId.equalsIgnoreCase("106")) {
+					logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
+				} 
+				else if(taskId.equalsIgnoreCase("124")){
+					 long start = new Date().getTime();
+					 try {
+					 	 foldTheValuesService.getDate();
+						 Calendar c = Calendar.getInstance();
+						 if(c.get(Calendar.DATE) == 1){
+						 foldTheValuesService.getMonthDate();
+						 }
+					 } catch (Exception e) {
+						 e.printStackTrace();
+					 }
+					 logger.info("定时任务"+taskId+"执行时长:" + (new Date().getTime() - start)/1000 + "秒");
+				 }//				 else if (taskId.equalsIgnoreCase("106")) {
 //					// 获取MES水质监测数据
 //					long start = new Date().getTime();
 //					ifMesEmsWatermonitorService.synchronousMesAnEmsData();