Procházet zdrojové kódy

2021/8/31 zhangyan
1.水数据自动生成
2.投入产出更新

QuietShadow před 3 roky
rodič
revize
d84f25bbed
21 změnil soubory, kde provedl 2465 přidání a 411 odebrání
  1. 124 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/controller/EmsWaterRealtimeController.java
  2. 26 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.java
  3. 676 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.xml
  4. 348 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/model/EmsWaterRealtime.java
  5. 30 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/service/IEmsWaterRealtimeService.java
  6. 172 0
      src/main/java/com/steerinfo/ems/emswaterrealtime/service/impl/EmsWaterRealtimeServiceImpl.java
  7. 114 26
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/controller/IfMesEmsSwapfileController.java
  8. 14 6
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.java
  9. 81 4
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.xml
  10. 17 5
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/model/IfMesEmsSwapfile.java
  11. 44 6
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/IIfMesEmsSwapfileService.java
  12. 192 35
      src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/impl/IfMesEmsSwapfileServiceImpl.java
  13. 21 0
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/controller/TRmWorkprocMaterialValueController.java
  14. 6 2
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/mapper/TRmWorkprocMaterialValueMapper.xml
  15. 10 0
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/ITRmWorkprocMaterialValueService.java
  16. 124 97
      src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/impl/TRmWorkprocMaterialValueServiceImpl.java
  17. 59 29
      src/main/java/com/steerinfo/ems/trmworkprocproductvalue/controller/TRmWorkprocProductValueController.java
  18. 188 49
      src/main/java/com/steerinfo/ems/trmworkprocproductvalue/mapper/TRmWorkprocProductValueMapper.xml
  19. 87 32
      src/main/java/com/steerinfo/ems/trmworkprocproductvalue/model/TRmWorkprocProductValue.java
  20. 96 96
      src/main/java/com/steerinfo/ems/trmworkprocproductvalue/service/impl/TRmWorkprocProductValueServiceImpl.java
  21. 36 24
      src/main/java/com/steerinfo/task/SpringCronTask.java

+ 124 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/controller/EmsWaterRealtimeController.java

@@ -0,0 +1,124 @@
+package com.steerinfo.ems.emswaterrealtime.controller;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
+import com.steerinfo.ems.trmcalpoint.service.ITRmCalpointService;
+import com.steerinfo.framework.controller.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import com.steerinfo.framework.utils.collection.ListUtils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * EmsWaterRealtime RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+@RequestMapping("/${api.version}/emswaterrealtimes")
+public class EmsWaterRealtimeController extends BaseRESTfulController {
+
+    @Autowired
+    IEmsWaterRealtimeService emsWaterRealtimeService;
+
+    @ApiOperation(value="获取列表", notes="分页查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/")
+    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsWaterRealtime> list = emsWaterRealtimeService.queryForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/like/")
+    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<EmsWaterRealtime> list = emsWaterRealtimeService.queryLikeForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+    
+    @ApiOperation(value="创建", notes="根据EmsWaterRealtime对象创建")
+    @ApiImplicitParam(name = "emsWaterRealtime", value = "详细实体emsWaterRealtime", required = true, dataType = "EmsWaterRealtime")
+    //@RequiresPermissions("emswaterrealtime:create")
+    @PostMapping(value = "/")
+    public RESTfulResult add(@ModelAttribute EmsWaterRealtime model){
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.add(model);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
+    //@RequiresPermissions("emswaterrealtime:view")
+    @GetMapping(value = "/{id}")
+    public RESTfulResult get(@PathVariable String id){
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.getById(id);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsWaterRealtime信息来更新详细信息")
+    @ApiImplicitParams({
+        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
+        @ApiImplicitParam(name = "emsWaterRealtime", value = "详细实体emsWaterRealtime", required = true, dataType = "EmsWaterRealtime")
+    })
+    //@RequiresPermissions("emswaterrealtime:update")
+    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@PathVariable String id, @RequestBody EmsWaterRealtime model){
+        model.setId(id);
+        EmsWaterRealtime emsWaterRealtime = emsWaterRealtimeService.modify(model);
+        return success(emsWaterRealtime);
+    }
+
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("emswaterrealtime:delete")
+    @DeleteMapping(value = "/{id}")//Short
+    public RESTfulResult delete(@PathVariable String id){
+    	List<String> list = Arrays.asList(id.split(","));
+    	if(ListUtils.isNotEmpty(list)) {
+	    	List<String> ids = ListUtils.convertList(list);
+			  emsWaterRealtimeService.delete(ids);
+    	}
+      return success();
+    }
+
+    @Autowired
+    ITRmCalpointService tRmCalpointService;
+
+
+    @ApiOperation(value="生成", notes="生成水数据")
+    //@RequiresPermissions("emswaterrealtime:delete")
+    @GetMapping(value = "/water")//Short
+    public int water(){
+        emsWaterRealtimeService.getWaterListByArmMeter();
+         emsWaterRealtimeService.dataGeneration();
+        //emsWaterRealtimeService.getcalpoint();
+        emsWaterRealtimeService.getWaterTenMinutes();
+
+        tRmCalpointService.statHourData();
+        return 1;
+    }
+}

+ 26 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.java

@@ -0,0 +1,26 @@
+package com.steerinfo.ems.emswaterrealtime.mapper;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Mapper
+public interface EmsWaterRealtimeMapper extends IBaseMapper<EmsWaterRealtime, String> {
+
+    //@TargetDataSource(dataSourceKey = DataSourceKey.DB_OTHER)
+    List<EmsWaterRealtime> getWaterListByArmMeter();
+
+    List<TRmCalpoint> getcalpoint();
+
+    List<EmsWaterRealtime> getWaterTenMinutes();
+
+    int insertWaterTenMinutes(HashMap<String, Object> HashMap);
+
+    int updateWaterTenMinutes(HashMap<String, Object> HashMap);
+
+    int updateWaterMinutes(HashMap<String, Object> HashMap);
+}

+ 676 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/mapper/EmsWaterRealtimeMapper.xml

@@ -0,0 +1,676 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.steerinfo.ems.emswaterrealtime.mapper.EmsWaterRealtimeMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    <id column="MeterId" jdbcType="DECIMAL" property="meterid" />
+    <result column="PhoneNo" jdbcType="VARCHAR" property="phoneno" />
+    <result column="AddressCode" jdbcType="VARCHAR" property="addresscode" />
+    <result column="M_UserType" jdbcType="VARCHAR" property="mUsertype" />
+    <result column="M_Type" jdbcType="VARCHAR" property="mType" />
+    <result column="M_Name" jdbcType="VARCHAR" property="mName" />
+    <result column="M_DoorNo" jdbcType="VARCHAR" property="mDoorno" />
+    <result column="M_PipeDn" jdbcType="VARCHAR" property="mPipedn" />
+    <result column="M_Material" jdbcType="VARCHAR" property="mMaterial" />
+    <result column="M_Ratio" jdbcType="VARCHAR" property="mRatio" />
+    <result column="CreateTime" jdbcType="TIMESTAMP" property="createtime" />
+    <result column="ForValue" jdbcType="DECIMAL" property="forvalue" />
+    <result column="RevValue" jdbcType="DECIMAL" property="revvalue" />
+    <result column="PressValue" jdbcType="DECIMAL" property="pressvalue" />
+    <result column="RealValue" jdbcType="DECIMAL" property="realvalue" />
+    <result column="SumValue" jdbcType="DECIMAL" property="sumvalue" />
+    <result column="CelVal" jdbcType="DECIMAL" property="celval" />
+    <result column="NetVal" jdbcType="DECIMAL" property="netval" />
+    <result column="IsStat" jdbcType="CHAR" property="isstat" />
+    <result column="DeviceId" jdbcType="VARCHAR" property="deviceid" />
+    <result column="ReadTime" jdbcType="TIMESTAMP" property="readtime" />
+  </resultMap>
+  <sql id="columns">
+    MeterId, PhoneNo, AddressCode, M_UserType, M_Type, M_Name, M_DoorNo, M_PipeDn, M_Material, 
+    M_Ratio, CreateTime, ForValue, RevValue, PressValue, RealValue, SumValue, CelVal, 
+    NetVal, IsStat, DeviceId, ReadTime
+  </sql>
+  <sql id="columns_alias">
+    t.MeterId, t.PhoneNo, t.AddressCode, t.M_UserType, t.M_Type, t.M_Name, t.M_DoorNo, 
+    t.M_PipeDn, t.M_Material, t.M_Ratio, t.CreateTime, t.ForValue, t.RevValue, t.PressValue, 
+    t.RealValue, t.SumValue, t.CelVal, t.NetVal, t.IsStat, t.DeviceId, t.ReadTime
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM EMS_WATER_REALTIME
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM EMS_WATER_REALTIME t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="meterid != null">
+        and MeterId = #{meterid}
+      </if>
+      <if test="phoneno != null and phoneno != ''">
+        and PhoneNo = #{phoneno}
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        and AddressCode = #{addresscode}
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        and M_UserType = #{mUsertype}
+      </if>
+      <if test="mType != null and mType != ''">
+        and M_Type = #{mType}
+      </if>
+      <if test="mName != null and mName != ''">
+        and M_Name = #{mName}
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        and M_DoorNo = #{mDoorno}
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        and M_PipeDn = #{mPipedn}
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        and M_Material = #{mMaterial}
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        and M_Ratio = #{mRatio}
+      </if>
+      <if test="createtime != null">
+        and TO_CHAR(CreateTime,'yyyy-MM-dd') = #{createtime}
+      </if>
+      <if test="forvalue != null">
+        and ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        and RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        and PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        and RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        and SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        and CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        and NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        and IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        and DeviceId = #{deviceid}
+      </if>
+      <if test="readtime != null">
+        and TO_CHAR(ReadTime,'yyyy-MM-dd') = #{readtime}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="meterid != null">
+        and MeterId = #{meterid}
+      </if>
+      <if test="phoneno != null and phoneno != ''">
+        and PhoneNo LIKE '%${phoneno}%'
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        and AddressCode LIKE '%${addresscode}%'
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        and M_UserType LIKE '%${mUsertype}%'
+      </if>
+      <if test="mType != null and mType != ''">
+        and M_Type LIKE '%${mType}%'
+      </if>
+      <if test="mName != null and mName != ''">
+        and M_Name LIKE '%${mName}%'
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        and M_DoorNo LIKE '%${mDoorno}%'
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        and M_PipeDn LIKE '%${mPipedn}%'
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        and M_Material LIKE '%${mMaterial}%'
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        and M_Ratio LIKE '%${mRatio}%'
+      </if>
+      <if test="createtime != null">
+        and TO_CHAR(CreateTime,'yyyy-MM-dd') = #{createtime}
+      </if>
+      <if test="forvalue != null">
+        and ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        and RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        and PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        and RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        and SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        and CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        and NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        and IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        and DeviceId LIKE '%${deviceid}%'
+      </if>
+      <if test="readtime != null">
+        and TO_CHAR(ReadTime,'yyyy-MM-dd') = #{readtime}
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from EMS_WATER_REALTIME
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from EMS_WATER_REALTIME
+    where 1!=1 
+      <if test="phoneno != null and phoneno != ''">
+        or PhoneNo = #{phoneno}
+      </if>
+      <if test="addresscode != null and addresscode != ''">
+        or AddressCode = #{addresscode}
+      </if>
+      <if test="mUsertype != null and mUsertype != ''">
+        or M_UserType = #{mUsertype}
+      </if>
+      <if test="mType != null and mType != ''">
+        or M_Type = #{mType}
+      </if>
+      <if test="mName != null and mName != ''">
+        or M_Name = #{mName}
+      </if>
+      <if test="mDoorno != null and mDoorno != ''">
+        or M_DoorNo = #{mDoorno}
+      </if>
+      <if test="mPipedn != null and mPipedn != ''">
+        or M_PipeDn = #{mPipedn}
+      </if>
+      <if test="mMaterial != null and mMaterial != ''">
+        or M_Material = #{mMaterial}
+      </if>
+      <if test="mRatio != null and mRatio != ''">
+        or M_Ratio = #{mRatio}
+      </if>
+      <if test="createtime != null">
+        or TO_CHAR(CreateTime,'yyyy-MM-dd') = '#{createtime}'
+      </if>
+      <if test="forvalue != null">
+        or ForValue = #{forvalue}
+      </if>
+      <if test="revvalue != null">
+        or RevValue = #{revvalue}
+      </if>
+      <if test="pressvalue != null">
+        or PressValue = #{pressvalue}
+      </if>
+      <if test="realvalue != null">
+        or RealValue = #{realvalue}
+      </if>
+      <if test="sumvalue != null">
+        or SumValue = #{sumvalue}
+      </if>
+      <if test="celval != null">
+        or CelVal = #{celval}
+      </if>
+      <if test="netval != null">
+        or NetVal = #{netval}
+      </if>
+      <if test="isstat != null">
+        or IsStat = #{isstat}
+      </if>
+      <if test="deviceid != null and deviceid != ''">
+        or DeviceId = #{deviceid}
+      </if>
+      <if test="readtime != null">
+        or TO_CHAR(ReadTime,'yyyy-MM-dd') = '#{readtime}'
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    insert into EMS_WATER_REALTIME (MeterId, PhoneNo, AddressCode, 
+      M_UserType, M_Type, M_Name, 
+      M_DoorNo, M_PipeDn, M_Material, 
+      M_Ratio, CreateTime, ForValue,
+      RevValue, PressValue, RealValue, 
+      SumValue, CelVal, NetVal, 
+      IsStat, DeviceId, ReadTime
+      )
+    values (#{meterid,jdbcType=DECIMAL}, #{phoneno,jdbcType=VARCHAR}, #{addresscode,jdbcType=VARCHAR}, 
+      #{mUsertype,jdbcType=VARCHAR}, #{mType,jdbcType=VARCHAR}, #{mName,jdbcType=VARCHAR}, 
+      #{mDoorno,jdbcType=VARCHAR}, #{mPipedn,jdbcType=VARCHAR}, #{mMaterial,jdbcType=VARCHAR}, 
+      #{mRatio,jdbcType=VARCHAR},
+    to_date (substr( #{createtime,jdbcType=TIME}, 0, INSTR( #{createtime,jdbcType=TIME}, '.', 1, 1 )-1), 'YYYY-MM-DD HH24:MI:SS' ),
+    #{forvalue,jdbcType=DECIMAL},
+      #{revvalue,jdbcType=DECIMAL}, #{pressvalue,jdbcType=DECIMAL}, #{realvalue,jdbcType=DECIMAL}, 
+      #{sumvalue,jdbcType=DECIMAL}, #{celval,jdbcType=DECIMAL}, #{netval,jdbcType=DECIMAL}, 
+      #{isstat,jdbcType=CHAR}, #{deviceid,jdbcType=VARCHAR}, to_date ( #{readtime,jdbcType=TIME} , 'YYYY-MM-DD HH24:MI:SS' )
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    insert into EMS_WATER_REALTIME
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="meterid != null">
+        MeterId,
+      </if>
+      <if test="phoneno != null">
+        PhoneNo,
+      </if>
+      <if test="addresscode != null">
+        AddressCode,
+      </if>
+      <if test="mUsertype != null">
+        M_UserType,
+      </if>
+      <if test="mType != null">
+        M_Type,
+      </if>
+      <if test="mName != null">
+        M_Name,
+      </if>
+      <if test="mDoorno != null">
+        M_DoorNo,
+      </if>
+      <if test="mPipedn != null">
+        M_PipeDn,
+      </if>
+      <if test="mMaterial != null">
+        M_Material,
+      </if>
+      <if test="mRatio != null">
+        M_Ratio,
+      </if>
+      <if test="createtime != null">
+        CreateTime,
+      </if>
+      <if test="forvalue != null">
+        ForValue,
+      </if>
+      <if test="revvalue != null">
+        RevValue,
+      </if>
+      <if test="pressvalue != null">
+        PressValue,
+      </if>
+      <if test="realvalue != null">
+        RealValue,
+      </if>
+      <if test="sumvalue != null">
+        SumValue,
+      </if>
+      <if test="celval != null">
+        CelVal,
+      </if>
+      <if test="netval != null">
+        NetVal,
+      </if>
+      <if test="isstat != null">
+        IsStat,
+      </if>
+      <if test="deviceid != null">
+        DeviceId,
+      </if>
+      <if test="readtime != null">
+        ReadTime,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="meterid != null">
+        #{meterid,jdbcType=DECIMAL},
+      </if>
+      <if test="phoneno != null">
+        #{phoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="addresscode != null">
+        #{addresscode,jdbcType=VARCHAR},
+      </if>
+      <if test="mUsertype != null">
+        #{mUsertype,jdbcType=VARCHAR},
+      </if>
+      <if test="mType != null">
+        #{mType,jdbcType=VARCHAR},
+      </if>
+      <if test="mName != null">
+        #{mName,jdbcType=VARCHAR},
+      </if>
+      <if test="mDoorno != null">
+        #{mDoorno,jdbcType=VARCHAR},
+      </if>
+      <if test="mPipedn != null">
+        #{mPipedn,jdbcType=VARCHAR},
+      </if>
+      <if test="mMaterial != null">
+        #{mMaterial,jdbcType=VARCHAR},
+      </if>
+      <if test="mRatio != null">
+        #{mRatio,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="forvalue != null">
+        #{forvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="revvalue != null">
+        #{revvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="pressvalue != null">
+        #{pressvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="realvalue != null">
+        #{realvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="sumvalue != null">
+        #{sumvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="celval != null">
+        #{celval,jdbcType=DECIMAL},
+      </if>
+      <if test="netval != null">
+        #{netval,jdbcType=DECIMAL},
+      </if>
+      <if test="isstat != null">
+        #{isstat,jdbcType=CHAR},
+      </if>
+      <if test="deviceid != null">
+        #{deviceid,jdbcType=VARCHAR},
+      </if>
+      <if test="readtime != null">
+        #{readtime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    update EMS_WATER_REALTIME
+    set PhoneNo = #{phoneno,jdbcType=VARCHAR},
+      AddressCode = #{addresscode,jdbcType=VARCHAR},
+      M_UserType = #{mUsertype,jdbcType=VARCHAR},
+      M_Type = #{mType,jdbcType=VARCHAR},
+      M_Name = #{mName,jdbcType=VARCHAR},
+      M_DoorNo = #{mDoorno,jdbcType=VARCHAR},
+      M_PipeDn = #{mPipedn,jdbcType=VARCHAR},
+      M_Material = #{mMaterial,jdbcType=VARCHAR},
+      M_Ratio = #{mRatio,jdbcType=VARCHAR},
+      CreateTime = to_date (substr( #{createtime,jdbcType=TIME}, 0, INSTR( #{createtime,jdbcType=TIME}, '.', 1, 1 )-1), 'YYYY-MM-DD HH24:MI:SS' ),
+      ForValue = #{forvalue,jdbcType=DECIMAL},
+      RevValue = #{revvalue,jdbcType=DECIMAL},
+      PressValue = #{pressvalue,jdbcType=DECIMAL},
+      RealValue = #{realvalue,jdbcType=DECIMAL},
+      SumValue = #{sumvalue,jdbcType=DECIMAL},
+      CelVal = #{celval,jdbcType=DECIMAL},
+      NetVal = #{netval,jdbcType=DECIMAL},
+      IsStat = #{isstat,jdbcType=CHAR},
+      DeviceId = #{deviceid,jdbcType=VARCHAR},
+      ReadTime = to_date (#{readtime,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime">
+    update EMS_WATER_REALTIME
+    <set>
+      <if test="phoneno != null">
+        PhoneNo = #{phoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="addresscode != null">
+        AddressCode = #{addresscode,jdbcType=VARCHAR},
+      </if>
+      <if test="mUsertype != null">
+        M_UserType = #{mUsertype,jdbcType=VARCHAR},
+      </if>
+      <if test="mType != null">
+        M_Type = #{mType,jdbcType=VARCHAR},
+      </if>
+      <if test="mName != null">
+        M_Name = #{mName,jdbcType=VARCHAR},
+      </if>
+      <if test="mDoorno != null">
+        M_DoorNo = #{mDoorno,jdbcType=VARCHAR},
+      </if>
+      <if test="mPipedn != null">
+        M_PipeDn = #{mPipedn,jdbcType=VARCHAR},
+      </if>
+      <if test="mMaterial != null">
+        M_Material = #{mMaterial,jdbcType=VARCHAR},
+      </if>
+      <if test="mRatio != null">
+        M_Ratio = #{mRatio,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        CreateTime = #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="forvalue != null">
+        ForValue = #{forvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="revvalue != null">
+        RevValue = #{revvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="pressvalue != null">
+        PressValue = #{pressvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="realvalue != null">
+        RealValue = #{realvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="sumvalue != null">
+        SumValue = #{sumvalue,jdbcType=DECIMAL},
+      </if>
+      <if test="celval != null">
+        CelVal = #{celval,jdbcType=DECIMAL},
+      </if>
+      <if test="netval != null">
+        NetVal = #{netval,jdbcType=DECIMAL},
+      </if>
+      <if test="isstat != null">
+        IsStat = #{isstat,jdbcType=CHAR},
+      </if>
+      <if test="deviceid != null">
+        DeviceId = #{deviceid,jdbcType=VARCHAR},
+      </if>
+      <if test="readtime != null">
+        ReadTime = #{readtime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where MeterId = #{meterid,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="where"/>
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="whereLike"/>
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into EMS_WATER_REALTIME 
+      (MeterId, 
+      PhoneNo, AddressCode, M_UserType, 
+      M_Type, M_Name, M_DoorNo, 
+      M_PipeDn, M_Material, M_Ratio, 
+      CreateTime, ForValue, RevValue, 
+      PressValue, RealValue, SumValue, 
+      CelVal, NetVal, IsStat, 
+      DeviceId, ReadTime)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.meterid,jdbcType=DECIMAL}, 
+      #{item.phoneno,jdbcType=VARCHAR}, #{item.addresscode,jdbcType=VARCHAR}, #{item.mUsertype,jdbcType=VARCHAR}, 
+      #{item.mType,jdbcType=VARCHAR}, #{item.mName,jdbcType=VARCHAR}, #{item.mDoorno,jdbcType=VARCHAR}, 
+      #{item.mPipedn,jdbcType=VARCHAR}, #{item.mMaterial,jdbcType=VARCHAR}, #{item.mRatio,jdbcType=VARCHAR}, 
+      #{item.createtime,jdbcType=TIMESTAMP}, #{item.forvalue,jdbcType=DECIMAL}, #{item.revvalue,jdbcType=DECIMAL}, 
+      #{item.pressvalue,jdbcType=DECIMAL}, #{item.realvalue,jdbcType=DECIMAL}, #{item.sumvalue,jdbcType=DECIMAL}, 
+      #{item.celval,jdbcType=DECIMAL}, #{item.netval,jdbcType=DECIMAL}, #{item.isstat,jdbcType=CHAR}, 
+      #{item.deviceid,jdbcType=VARCHAR}, #{item.readtime,jdbcType=TIMESTAMP} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update EMS_WATER_REALTIME
+     set
+       MeterId=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.meterid,jdbcType=DECIMAL}
+       </foreach>
+       ,PhoneNo=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.phoneno,jdbcType=VARCHAR}
+       </foreach>
+       ,AddressCode=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.addresscode,jdbcType=VARCHAR}
+       </foreach>
+       ,M_UserType=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mUsertype,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Type=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mType,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Name=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mName,jdbcType=VARCHAR}
+       </foreach>
+       ,M_DoorNo=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mDoorno,jdbcType=VARCHAR}
+       </foreach>
+       ,M_PipeDn=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mPipedn,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Material=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mMaterial,jdbcType=VARCHAR}
+       </foreach>
+       ,M_Ratio=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.mRatio,jdbcType=VARCHAR}
+       </foreach>
+       ,CreateTime=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.createtime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,ForValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.forvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,RevValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.revvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,PressValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.pressvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,RealValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.realvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,SumValue=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.sumvalue,jdbcType=DECIMAL}
+       </foreach>
+       ,CelVal=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.celval,jdbcType=DECIMAL}
+       </foreach>
+       ,NetVal=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.netval,jdbcType=DECIMAL}
+       </foreach>
+       ,IsStat=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.isstat,jdbcType=CHAR}
+       </foreach>
+       ,DeviceId=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.deviceid,jdbcType=VARCHAR}
+       </foreach>
+       ,ReadTime=
+       <foreach collection="list" item="item" index="index" separator=" " open="case MeterId" close="end">
+          when #{item.meterid,jdbcType=DECIMAL} then #{item.readtime,jdbcType=TIMESTAMP}
+       </foreach>
+     where MeterId in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.meterid,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from EMS_WATER_REALTIME
+    where MeterId in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+      <select id="getWaterListByArmMeter" resultMap="BaseResultMap">
+        SELECT MeterId, PhoneNo, AddressCode, M_UserType, M_Type
+             , M_Name, M_DoorNo, M_PipeDn, M_Material, M_Ratio, CreateTime
+             , ForValue, RevValue, PressValue, RealValue, SumValue, CelVal
+             , NetVal, IsStat, DeviceId FROM ARM_Meter WITH (NOLOCK) where CreateTime >= '2021-08-01'
+<!--        FROM Meter_Base.dbo.ARM_Meter-->
+    </select>
+  <select id="getcalpoint"
+          resultType="com.steerinfo.ems.trmcalpoint.model.TRmCalpoint">
+    SELECT * FROM T_RM_CALPOINT WHERE ITEMID  not in
+    (SELECT t.ITEMID FROM T_RM_CALPOINT t JOIN FORMULA f ON t.ITEMID =f.CODE)
+  </select>
+  <select id="getWaterTenMinutes" resultMap="BaseResultMap">
+    SELECT w.FORVALUE AS SUMVALUE,
+<!--(w.FORVALUE - w.REVVALUE) -->
+    c.BTYPE2 AS M_TYPE,  c.SOURCE_TYPE AS M_MATERIAL
+    FROM T_RM_LOCATION l
+    JOIN T_RM_CALPOINT c ON l.ID = c.LOCATEID
+    AND c.ENERGYTYPEID = 'W'
+    LEFT JOIN EMS_WATER_REALTIME w ON l.BCODE = w.ADDRESSCODE
+    ORDER BY TO_NUMBER(regexp_substr(l.ID,'[0-9.]+'))
+  </select>
+  <insert id="insertWaterTenMinutes" parameterType="java.util.HashMap">
+    INSERT INTO EMS_WATER_TIMING(TMSTMP, TIM,
+    YZGXS_YSX, YLT_ZWATER_ACC2, BWFDZ_CYS_ZYLLJ, LG1_SCXINS_ACC2, SJ2_YRXINS_ACC,
+    SJ2_YRXINS_ACC2, JH1_GLXINS_ACC, YLT_HQXINS_ACC, YJ_SC_FOLW1, YSJ_CYS_TO_LG,
+    ESJ_CYS_TO_LG, YSJ_CYS_ACC, ESJ_CYS_ACC, BWFDZ_CYWATER_ACC, EJH_XS_HQ_JLS_ACC) VALUES
+    (to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' ),
+    to_date (#{clock2,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' ),
+    0.00, 0.00, 0.00, 0.00, 0.00,
+    0.00, 0.00, 0.00, 0.00, 0.00,
+    0.00, 0.00, 0.00, 0.00, 0.00
+    )
+  </insert>
+  <update id="updateWaterTenMinutes" parameterType="java.util.HashMap">
+    update EMS_WATER_TIMING
+    <set>
+      <if test="clock2 != null and clock2 != ''">
+        TIM = to_date (#{clock2,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+      </if>
+      ${sql}
+    </set>
+    where TMSTMP =to_date (#{clock1,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+  </update>
+  <update id="updateWaterMinutes" parameterType="java.util.HashMap">
+    update ${table}
+    <set>
+      <if test="clock != null and clock2 != ''">
+        TMSTMP = to_date (#{clock,jdbcType=TIME}, 'YYYY-MM-DD HH24:MI:SS' )
+      </if>
+      ${sql}
+    </set>
+  </update>
+</mapper>

+ 348 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/model/EmsWaterRealtime.java

@@ -0,0 +1,348 @@
+package com.steerinfo.ems.emswaterrealtime.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+@ApiModel(value="null")
+public class EmsWaterRealtime implements IBasePO<String> {
+    /**
+     * 表主键(MeterId,DECIMAL,0)
+     */
+    @ApiModelProperty(value="表主键",required=true)
+    private String meterid;
+
+    /**
+     * SIM卡号(PhoneNo,VARCHAR,11)
+     */
+    @ApiModelProperty(value="SIM卡号",required=true)
+    private String phoneno;
+
+    /**
+     * 地址编码(AddressCode,VARCHAR,10)
+     */
+    @ApiModelProperty(value="地址编码",required=true)
+    private String addresscode;
+
+    /**
+     * 用水类型(M_UserType,VARCHAR,20)
+     */
+    @ApiModelProperty(value="用水类型",required=true)
+    private String mUsertype;
+
+    /**
+     * 站点类型(M_Type,VARCHAR,50)
+     */
+    @ApiModelProperty(value="站点类型",required=false)
+    private String mType;
+
+    /**
+     * 站点名称(M_Name,VARCHAR,50)
+     */
+    @ApiModelProperty(value="站点名称",required=false)
+    private String mName;
+
+    /**
+     * 户号(M_DoorNo,VARCHAR,20)
+     */
+    @ApiModelProperty(value="户号",required=false)
+    private String mDoorno;
+
+    /**
+     * 管径大小(M_PipeDn,VARCHAR,20)
+     */
+    @ApiModelProperty(value="管径大小",required=false)
+    private String mPipedn;
+
+    /**
+     * 管线材质(M_Material,VARCHAR,20)
+     */
+    @ApiModelProperty(value="管线材质",required=false)
+    private String mMaterial;
+
+    /**
+     * 变比(M_Ratio,VARCHAR,5)
+     */
+    @ApiModelProperty(value="变比",required=false)
+    private String mRatio;
+
+    /**
+     * 刷新时间(CreateTime,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="刷新时间",required=false)
+    private String createtime;
+
+    /**
+     * 正向读数(ForValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="正向读数",required=false)
+    private BigDecimal forvalue;
+
+    /**
+     * 反向读数(RevValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="反向读数",required=false)
+    private BigDecimal revvalue;
+
+    /**
+     * 管道压力(PressValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="管道压力",required=false)
+    private BigDecimal pressvalue;
+
+    /**
+     * 瞬时流量(RealValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="瞬时流量",required=false)
+    private BigDecimal realvalue;
+
+    /**
+     * 累计流量(SumValue,DECIMAL,9)
+     */
+    @ApiModelProperty(value="累计流量",required=false)
+    private BigDecimal sumvalue;
+
+    /**
+     * 电池电压(CelVal,DECIMAL,5)
+     */
+    @ApiModelProperty(value="电池电压",required=false)
+    private BigDecimal celval;
+
+    /**
+     * 网络信号(NetVal,DECIMAL,38)
+     */
+    @ApiModelProperty(value="网络信号",required=false)
+    private BigDecimal netval;
+
+    /**
+     * 状态标识(IsStat,CHAR,1)
+     */
+    @ApiModelProperty(value="状态标识",required=false)
+    private String isstat;
+
+    /**
+     * 设备id(DeviceId,VARCHAR,20)
+     */
+    @ApiModelProperty(value="设备id",required=false)
+    private String deviceid;
+
+    /**
+     * 读取时间(ReadTime,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="读取时间",required=false)
+    private String readtime;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String getId() {
+        return this.meterid;
+    }
+
+    @Override
+    public void setId(String meterid) {
+        this.meterid = meterid;
+    }
+
+    public String getMeterid() {
+        return meterid;
+    }
+
+    public void setMeterid(String meterid) {
+        this.meterid = meterid;
+    }
+
+    public String getPhoneno() {
+        return phoneno;
+    }
+
+    public void setPhoneno(String phoneno) {
+        this.phoneno = phoneno == null ? null : phoneno.trim();
+    }
+
+    public String getAddresscode() {
+        return addresscode;
+    }
+
+    public void setAddresscode(String addresscode) {
+        this.addresscode = addresscode == null ? null : addresscode.trim();
+    }
+
+    public String getmUsertype() {
+        return mUsertype;
+    }
+
+    public void setmUsertype(String mUsertype) {
+        this.mUsertype = mUsertype == null ? null : mUsertype.trim();
+    }
+
+    public String getmType() {
+        return mType;
+    }
+
+    public void setmType(String mType) {
+        this.mType = mType == null ? null : mType.trim();
+    }
+
+    public String getmName() {
+        return mName;
+    }
+
+    public void setmName(String mName) {
+        this.mName = mName == null ? null : mName.trim();
+    }
+
+    public String getmDoorno() {
+        return mDoorno;
+    }
+
+    public void setmDoorno(String mDoorno) {
+        this.mDoorno = mDoorno == null ? null : mDoorno.trim();
+    }
+
+    public String getmPipedn() {
+        return mPipedn;
+    }
+
+    public void setmPipedn(String mPipedn) {
+        this.mPipedn = mPipedn == null ? null : mPipedn.trim();
+    }
+
+    public String getmMaterial() {
+        return mMaterial;
+    }
+
+    public void setmMaterial(String mMaterial) {
+        this.mMaterial = mMaterial == null ? null : mMaterial.trim();
+    }
+
+    public String getmRatio() {
+        return mRatio;
+    }
+
+    public void setmRatio(String mRatio) {
+        this.mRatio = mRatio == null ? null : mRatio.trim();
+    }
+
+    public String getCreatetime() {
+        return createtime;
+    }
+
+    public void setCreatetime(String createtime) {
+        this.createtime = createtime;
+    }
+
+    public BigDecimal getForvalue() {
+        return forvalue;
+    }
+
+    public void setForvalue(BigDecimal forvalue) {
+        this.forvalue = forvalue;
+    }
+
+    public BigDecimal getRevvalue() {
+        return revvalue;
+    }
+
+    public void setRevvalue(BigDecimal revvalue) {
+        this.revvalue = revvalue;
+    }
+
+    public BigDecimal getPressvalue() {
+        return pressvalue;
+    }
+
+    public void setPressvalue(BigDecimal pressvalue) {
+        this.pressvalue = pressvalue;
+    }
+
+    public BigDecimal getRealvalue() {
+        return realvalue;
+    }
+
+    public void setRealvalue(BigDecimal realvalue) {
+        this.realvalue = realvalue;
+    }
+
+    public BigDecimal getSumvalue() {
+        return sumvalue;
+    }
+
+    public void setSumvalue(BigDecimal sumvalue) {
+        this.sumvalue = sumvalue;
+    }
+
+    public BigDecimal getCelval() {
+        return celval;
+    }
+
+    public void setCelval(BigDecimal celval) {
+        this.celval = celval;
+    }
+
+    public BigDecimal getNetval() {
+        return netval;
+    }
+
+    public void setNetval(BigDecimal netval) {
+        this.netval = netval;
+    }
+
+    public String getIsstat() {
+        return isstat;
+    }
+
+    public void setIsstat(String isstat) {
+        this.isstat = isstat == null ? null : isstat.trim();
+    }
+
+    public String getDeviceid() {
+        return deviceid;
+    }
+
+    public void setDeviceid(String deviceid) {
+        this.deviceid = deviceid == null ? null : deviceid.trim();
+    }
+
+    public String getReadtime() {
+        return readtime;
+    }
+
+    public void setReadtime(String readtime) {
+        this.readtime = readtime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", meterid=").append(meterid);
+        sb.append(", phoneno=").append(phoneno);
+        sb.append(", addresscode=").append(addresscode);
+        sb.append(", mUsertype=").append(mUsertype);
+        sb.append(", mType=").append(mType);
+        sb.append(", mName=").append(mName);
+        sb.append(", mDoorno=").append(mDoorno);
+        sb.append(", mPipedn=").append(mPipedn);
+        sb.append(", mMaterial=").append(mMaterial);
+        sb.append(", mRatio=").append(mRatio);
+        sb.append(", createtime=").append(createtime);
+        sb.append(", forvalue=").append(forvalue);
+        sb.append(", revvalue=").append(revvalue);
+        sb.append(", pressvalue=").append(pressvalue);
+        sb.append(", realvalue=").append(realvalue);
+        sb.append(", sumvalue=").append(sumvalue);
+        sb.append(", celval=").append(celval);
+        sb.append(", netval=").append(netval);
+        sb.append(", isstat=").append(isstat);
+        sb.append(", deviceid=").append(deviceid);
+        sb.append(", readtime=").append(readtime);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 30 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/service/IEmsWaterRealtimeService.java

@@ -0,0 +1,30 @@
+package com.steerinfo.ems.emswaterrealtime.service;
+
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.framework.service.IBaseService;
+
+import java.util.List;
+
+/**
+ * EmsWaterRealtime服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IEmsWaterRealtimeService extends IBaseService<EmsWaterRealtime, String>{
+
+    List<EmsWaterRealtime> getWaterListByArmMeter();
+
+   int dataGeneration();
+
+    void getcalpoint();
+
+    void getWaterTenMinutes();
+}

+ 172 - 0
src/main/java/com/steerinfo/ems/emswaterrealtime/service/impl/EmsWaterRealtimeServiceImpl.java

@@ -0,0 +1,172 @@
+package com.steerinfo.ems.emswaterrealtime.service.impl;
+
+import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.Utils.DateUtils;
+import com.steerinfo.ems.emswaterrealtime.mapper.EmsWaterRealtimeMapper;
+import com.steerinfo.ems.emswaterrealtime.model.EmsWaterRealtime;
+import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
+import com.steerinfo.ems.formula.model.Formula;
+import com.steerinfo.ems.formula.service.IFormulaService;
+import com.steerinfo.ems.ifmesemsswapfile.service.impl.IfMesEmsSwapfileServiceImpl;
+import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
+import com.steerinfo.framework.datasource.DataSourceKey;
+import com.steerinfo.framework.datasource.TargetDataSource;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * EmsWaterRealtime服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-08-24 07:52
+ * 类描述
+ * 修订历史:
+ * 日期:2021-08-24
+ * 作者:generator
+ * 参考:
+ * 描述:EmsWaterRealtime服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "emsWaterRealtimeService")
+public class EmsWaterRealtimeServiceImpl extends BaseServiceImpl<EmsWaterRealtime, String> implements IEmsWaterRealtimeService {
+
+    private static final Logger logger = LoggerFactory.getLogger(IfMesEmsSwapfileServiceImpl.class);
+
+    @Autowired
+    private EmsWaterRealtimeMapper emsWaterRealtimeMapper;
+
+    @Override
+    protected IBaseMapper<EmsWaterRealtime, String> getMapper() {
+        return emsWaterRealtimeMapper;
+    }
+
+    List<EmsWaterRealtime> emsWaterRealtimeList;
+
+    @Override
+    @TargetDataSource(dataSourceKey = DataSourceKey.DB_OTHER)
+    public List<EmsWaterRealtime> getWaterListByArmMeter() {
+           // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+        //List<EmsWaterRealtime>
+                emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterListByArmMeter();
+        return emsWaterRealtimeList;
+    }
+
+    @Override
+    public int dataGeneration() {
+
+        int addSize = 0;
+        int updateSize = 0;
+        try {
+            EmsWaterRealtime model;
+            // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+            //List<EmsWaterRealtime> emsWaterRealtimeList = getWaterListByArmMeter();
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                emsWaterRealtime.setReadtime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss"));
+                model = emsWaterRealtimeMapper.selectByPrimaryKey(emsWaterRealtime.getMeterid());
+                if(model !=null){
+                    emsWaterRealtimeMapper.updateByPrimaryKey(emsWaterRealtime);
+                    updateSize+=1;
+                    continue;
+                }else {
+                    addSize+= emsWaterRealtimeMapper.insert(emsWaterRealtime);
+                }
+            }
+            String clock = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            HashMap<String,Object> hashMap = new HashMap<String,Object>();
+            hashMap.put("clock",clock);
+            List<EmsWaterRealtime> emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterTenMinutes();
+            StringBuffer sub = new StringBuffer();
+            String table="EMS_WATER";
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                String[] tens = emsWaterRealtime.getmMaterial().split("\\.");
+                String tag = tens[1];
+                //多个表生成数据就填加table;
+                table = tens[0];
+                String sql = ","+tag + " = " + "'" + emsWaterRealtime.getSumvalue() + "'";
+                sub.append(sql);
+            }
+            hashMap.put("table",table);
+            hashMap.put("sql",sub.toString());
+            updateSize += emsWaterRealtimeMapper.updateWaterMinutes(hashMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+        }
+        logger.info("本次总共新增水数据条数:" + addSize);
+        logger.info("本次总共更新水数据条数:" + updateSize);
+        return addSize+updateSize;
+    }
+
+
+    @Override
+    public void getWaterTenMinutes() {
+        int addSize = 0;
+        int updateSize = 0;
+        int i = 0;
+        try {
+            EmsWaterRealtime model;
+            // emsWaterRealtimeMapper.selectByPrimaryKey("1");//.getWaterListByArmMeter();
+            String clock1 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            String clock2 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            HashMap<String,Object> hashMap = new HashMap<String,Object>();
+            hashMap.put("clock1",clock1);
+            hashMap.put("clock2",clock2);
+            addSize += emsWaterRealtimeMapper.insertWaterTenMinutes(hashMap);
+            List<EmsWaterRealtime> emsWaterRealtimeList = emsWaterRealtimeMapper.getWaterTenMinutes();
+            StringBuffer sub = new StringBuffer();
+            String table="EMS_WATER_TIMING";
+            for (EmsWaterRealtime emsWaterRealtime : emsWaterRealtimeList){
+                i++;
+                String[] tens = emsWaterRealtime.getmType().split("\\.");
+                String tag = tens[1];
+                //多个表生成数据就填加table;
+                table = tens[0];
+                String sql = ","+tag + " = " + "'" + emsWaterRealtime.getSumvalue() + "'";
+                sub.append(sql);
+            }
+            clock2 = DateUtils.dateStr(new Date(),"yyyy-MM-dd hh:mm:ss");
+            hashMap.put("table",table);
+            hashMap.put("clock2",clock2);
+            hashMap.put("sql",sub.toString());
+            updateSize += emsWaterRealtimeMapper.updateWaterTenMinutes(hashMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+        }
+        logger.info("本次总共新增水数据条数:" + addSize);
+        logger.info("本次总共更新水数据条数:" + updateSize);
+        //return addSize+updateSize;
+    }
+
+    @Autowired
+    IFormulaService formulaService;
+
+    @Override
+    public void getcalpoint() {
+        List<TRmCalpoint> tRmCalpoints = emsWaterRealtimeMapper.getcalpoint();
+        for(TRmCalpoint model : tRmCalpoints){
+            Formula formula = new Formula();
+            formula.setCode(model.getItemid());
+            String itemdesc = model.getItemdesc(); // 项目描述
+            formula.setDescription(itemdesc!=null && !itemdesc.trim().isEmpty() ? itemdesc : model.getTagAlias());
+            // formula.setClock(DateUtils.getCurrentTime("yyyyMM"));
+            formula.setClock("202001");
+            formula.setIsavailable("1");
+            formula.setRevisetime(DateUtils.getCurrentTime("yyyy-MM-dd HH:mm:ss"));
+            formula.setTablename("T_RM_CALPOINT_VALUE");
+            formula.setSourcecode("R(T_RM_CALPOINT_VALUE," + model.getItemid() + ")");
+            formula.setRevisor(JwtUtil.getUseridByToken());
+
+            formulaService.add(formula);
+        }
+
+    }
+}

+ 114 - 26
src/main/java/com/steerinfo/ems/ifmesemsswapfile/controller/IfMesEmsSwapfileController.java

@@ -1,30 +1,22 @@
 package com.steerinfo.ems.ifmesemsswapfile.controller;
 
-import java.util.Arrays;
-import java.util.HashMap;
-
+import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
+import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
+import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/${api.version}/ifmesemsswapfile")
@@ -56,15 +48,7 @@ public class IfMesEmsSwapfileController extends BaseRESTfulController {
         PageList<IfMesEmsSwapfile> list = ifMesEmsSwapfileService.queryLikeForPage(parmas, pageNum, pageSize);
         return success(list);
     }
-    
-    // @ApiOperation(value="创建", notes="根据IfMesEmsSwapfile对象创建")
-    // @ApiImplicitParam(name = "IfMesEmsSwapfile", value = "详细实体IfMesEmsSwapfile", required = true, dataType = "IfMesEmsSwapfile")
-    // //@RequiresPermissions("trmunit:create")
-    // @PostMapping(value = "/")
-    // public RESTfulResult add(@ModelAttribute IfMesEmsSwapfile model){
-    //     IfMesEmsSwapfile IfMesEmsSwapfile = ifMesEmsSwapfileService.add(model);
-    //     return success(IfMesEmsSwapfile);
-    // }
+
 
     @ApiOperation(value="立即从MES同步数据", notes="从MES同步投入产出数据")
     @PostMapping(value = "/synchronousMesAnEmsData")
@@ -73,5 +57,109 @@ public class IfMesEmsSwapfileController extends BaseRESTfulController {
         return success(s);
     }
 
+    @GetMapping("/getLgDateProd")
+    public RESTfulResult getLgDateProd (){
+        ifMesEmsSwapfileService.getLgDateProd();
+        return success();
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("tpmcaseact:view")
+    @GetMapping(value = "/queryList/")
+    public RESTfulResult queryList(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        if(parmas.containsKey("workprocid") && parmas.get("workprocid") != null && !"".equals(parmas.get("workprocid").toString())){
+            PageList<Map<String, Object>> list = ifMesEmsSwapfileService.getQueryList(parmas, pageNum, pageSize);
+            return success(list);
+        }
+        return failed(null, "菜单工序id为空,请联系管理员");
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    @GetMapping(value = "/queryProductAndMaterial/")
+    public RESTfulResult queryProductAndMaterial(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        if(parmas.containsKey("workprocid") && parmas.get("workprocid") != null && !"".equals(parmas.get("workprocid").toString())){
+            if(parmas.containsKey("type") && parmas.get("type") != null && !"".equals(parmas.get("type").toString())) {
+                Object type = parmas.get("type");
+                if ("1".equals(type)) {
+                    parmas.put("table_name","T_RM_WORKPROC_MATERIAL");
+                    parmas.put("table_name2","T_RM_WORKPROC_MATERIAL_VALUE");
+                    parmas.put("listing","MATERIALID");
+                } else if ("2".equals(type)) {
+                    parmas.put("table_name","T_RM_WORKPROC_PRODUCT");
+                    parmas.put("table_name2","T_RM_WORKPROC_PRODUCT_VALUE");
+                    parmas.put("listing","PRODUCTID");
+                } else {
+                    return failed(null, "数据类型有误");
+                }
+                PageList<Map<String, Object>> list = ifMesEmsSwapfileService.queryProductAndMaterial(parmas, pageNum, pageSize);
+                return success(list);
+            }
+            return failed(null,"请选择数据类型");
+        }
+        return failed(null, "菜单工序id为空,请联系管理员");
+    }
+
+    @ApiOperation(value="批量更新详细信息", notes="根据传过来的parmas数组信息来更新详细信息")
+    @ApiImplicitParam(name = "parmas", value = "详细实体usageData", required = true, dataType = "usageData")
+    @PutMapping(value = "/updateProductAndMaterial", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult updateProductAndMaterial(@RequestBody HashMap[] parmas) {
 
+        for (int i = 0; i < parmas.length; i++) {
+            HashMap parma = parmas[i];
+            Object type = parma.get("type");
+            if (parma.containsKey("type") && parma.get("type") != null && !"".equals(parma.get("type").toString())) {
+                if ("1".equals(type)) {
+                    parma.put("table_name", "T_RM_WORKPROC_MATERIAL_VALUE");
+                } else if ("2".equals(type)) {
+                    parma.put("table_name", "T_RM_WORKPROC_PRODUCT_VALUE");
+                } else {
+                    return failed(null, "数据类型有误");
+                }
+                if (!parma.containsKey("itemid") || parma.get("itemid") == null || "".equals(parma.get("itemid").toString())) {
+                    return failed(null, "缺少参数itemid");
+                }
+                if (!parma.containsKey("clock") || parma.get("clock") == null || "".equals(parma.get("clock").toString())) {
+                    return failed(null, "缺少参数clock");
+                }
+                if (!parma.containsKey("timegranid") || parma.get("timegranid") == null || "".equals(parma.get("timegranid").toString())) {
+                    return failed(null, "缺少参数timegranid");
+                }
+                if (!parma.containsKey("actualvalue") || parma.get("actualvalue") == null || "".equals(parma.get("actualvalue").toString())) {
+                    return failed(null, "缺少参数actualvalue");
+                }
+                if (!parma.containsKey("correctvalue") || parma.get("correctvalue") == null || "".equals(parma.get("correctvalue").toString())) {
+                    return failed(null, "缺少参数correctvalue");
+                }
+                if (!parma.containsKey("apportvalue") || parma.get("apportvalue") == null || "".equals(parma.get("apportvalue").toString())) {
+                    return failed(null, "缺少参数apportvalue");
+                }
+                parma.put("upman", JwtUtil.getUseridByToken());
+                parma.put("uptime", DateUtils.getCurrentTimetoDate("yyyy-MM-dd HH:mm:ss"));
+                ifMesEmsSwapfileService.updateProductAndMaterial(parma);
+            }
+        }
+        return success();
+    }
+    @Autowired
+    ITRmWorkprocProductValueService tRmWorkprocProductValueService;
+
+    @Autowired
+    ITRmWorkprocMaterialValueService tRmWorkprocMaterialValueService;
+
+    @ApiOperation(value="从T_RM_PRODUCT,T_RM_MATERIAL生成模板数据", notes="从生成投入产出数据模板")
+    @GetMapping(value = "/generateProductAndMaterial")
+    public RESTfulResult generateProductAndMaterial(@ModelAttribute IfMesEmsSwapfile model){
+        String s = ifMesEmsSwapfileService.generateProductAndMaterial();
+        tRmWorkprocProductValueService.synchronousData();
+        tRmWorkprocMaterialValueService.synchronousData();
+        return success(s);
+    }
 }

+ 14 - 6
src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.java

@@ -1,19 +1,27 @@
 package com.steerinfo.ems.ifmesemsswapfile.mapper;
 
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.framework.mapper.IBaseMapper;
-import com.steerinfo.framework.service.pagehelper.PageList;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface IfMesEmsSwapfileMapper extends IBaseMapper<IfMesEmsSwapfile, String> {
     int insert(IfMesEmsSwapfile model);
+
     int updateStatus(HashMap<String, Object> model);
+
     List<IfMesEmsSwapfile> selectNewMaterial(HashMap<String, Object> model);
+
     BigDecimal getSUM(HashMap<String, Object> model);
+
+    List<Map<String, Object>> getQueryList(HashMap<String, Object> parmas);
+
+    List<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas);
+
+    int updateProductAndMaterial(HashMap<String, Object> parmas);
 }

+ 81 - 4
src/main/java/com/steerinfo/ems/ifmesemsswapfile/mapper/IfMesEmsSwapfileMapper.xml

@@ -15,9 +15,10 @@
     <result column="CREATETIME" jdbcType="DATE" property="createtime" />
     <result column="STATUS" jdbcType="VARCHAR" property="status" />
     <result column="SENDTIME" jdbcType="DATE" property="sendtime" />
+    <result column="MEMO" jdbcType="DATE" property="memo" />
   </resultMap>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
     from IF_MES_EMS_SWAPFILE
     where FID = #{id,jdbcType=VARCHAR}
   </select>
@@ -67,7 +68,7 @@
   </delete>
   
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
     <where>
         <if test="fid != null and fid != ''">
@@ -113,7 +114,7 @@
   </select>
 
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
     <where>
         <if test="fid != null and fid != ''">
@@ -159,7 +160,7 @@
   </select>
 
   <select id="selectNewMaterial" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME
+    select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
       from IF_MES_EMS_SWAPFILE
       where TYPE = #{type,jdbcType=VARCHAR}
         and STATUS in ('0','9')
@@ -293,4 +294,80 @@
     </trim>
   </insert>
 
+  <select id="getQueryList" parameterType="java.util.HashMap" resultType = "Map">
+      SELECT s.FID, s.TYPE, s.WORKS, s.PRODLINE, CASE WHEN s.TYPE = 1 THEN m.WORKPROCID WHEN s.TYPE = 2 THEN p.WORKPROCID END AS WORKPROCID, s.PRODATE, s.ORDERNO, s.MATERIALCODE, s.MATERIALNAME, s.UNIT, s.QTY, s.CREATETIME, s.STATUS, s.SENDTIME, s.MEMO
+      FROM IF_MES_EMS_SWAPFILE s
+      LEFT JOIN T_RM_WORKPROC_PRODUCT p ON s.MATERIALCODE = p.MES_MATERIALCODE
+      LEFT JOIN T_RM_WORKPROC_MATERIAL m ON s.MATERIALCODE = m.MES_MATERIALCODE
+      WHERE (m.WORKPROCID IN (${workProcids}) OR p.WORKPROCID IN (${workProcids}))
+      <if test="prodate != null and prodate != ''">
+      AND s.PRODATE >= to_date(#{prodate}, 'yyyy-mm-dd')
+      </if>
+      <if test="prodate2 != null and prodate2 != ''">
+          AND s.PRODATE &lt;= to_date(#{prodate2}, 'yyyy-mm-dd')
+      </if>
+      <if test="workproc != null and workproc != ''">
+          AND (p.WORKPROCID LIKE '%${workproc}%' OR m.WORKPROCID LIKE '%${workproc}%')
+      </if>
+      <if test="materialname != null and materialname != ''">
+          AND s.MATERIALNAME LIKE '%${materialname}%'
+      </if>
+      <if test="materialcode != null and materialcode != ''">
+          AND s.MATERIALCODE LIKE '%${materialcode}%'
+      </if>
+      <if test="prodline != null and prodline != ''">
+          AND s.PRODLINE LIKE '%${prodline}%'
+      </if>
+      <if test="type != null and type != ''">
+          AND s.TYPE LIKE '%${type}%'
+      </if>
+      ORDER BY s.PRODATE
+  </select>
+
+    <select id="queryProductAndMaterial" parameterType="java.util.HashMap" resultType = "Map">
+        SELECT A.ITEMID, A.CLOCK, A.TIMEGRANID, A.ACTUALVALUE, A.CORRECTVALUE
+             , A.APPORTVALUE, A.BZ, A.USERID, A.UPDATETIME, A.UPMAN
+             , A.UPTIME, B.WORKPROCID, B.MES_MATERIALCODE, B.UNITID, B.${listing} AS MATERIALNAME
+        FROM ${table_name2} A
+        LEFT JOIN ${table_name} B ON A.ITEMID = B.ITEMID
+        WHERE B.WORKPROCID IN (${workProcids})
+        <if test="clock != null and clock != ''">
+            AND A.CLOCK >= #{clock}
+        </if>
+        <if test="clock2 != null and clock2 != ''">
+            AND A.CLOCK &lt;= #{clock2}
+        </if>
+        AND B.ITEMTYPE = 'R'
+        AND B.USEFLAG = '1'
+        AND B.ISFINANCEDATA = '1'
+        <if test="workproc != null and workproc != ''">
+            AND B.WORKPROCID IN (${workProcs})
+        </if>
+        <if test="materialcode != null and materialcode != ''">
+            AND B.MES_MATERIALCODE LIKE '%${materialcode}%'
+        </if>
+        <if test="itemid != null and itemid != ''">
+            AND A.ITEMID LIKE '%${itemid}%'
+        </if>
+        <if test="itemtype !=null and itemtype!='' ">
+            AND B.ITEMTYPE = #{itemtype}
+        </if>
+        <if test="materialname !=null and materialname!='' ">
+           AND B.${listing} = #{materialname}
+        </if>
+        ORDER BY A.CLOCK,B.SEQNO
+    </select>
+
+    <update id="updateProductAndMaterial" parameterType="java.util.HashMap">
+        UPDATE ${table_name}
+        SET APPORTVALUE = #{apportvalue},
+        CORRECTVALUE = #{correctvalue},
+        BZ = #{bz},
+        UPMAN = #{upman},
+        UPTIME = #{uptime}
+        WHERE ITEMID = #{itemid}
+        AND CLOCK = #{clock}
+        AND TIMEGRANID = #{timegranid}
+        AND ACTUALVALUE = #{actualvalue}
+    </update>
 </mapper>

+ 17 - 5
src/main/java/com/steerinfo/ems/ifmesemsswapfile/model/IfMesEmsSwapfile.java

@@ -1,13 +1,11 @@
 package com.steerinfo.ems.ifmesemsswapfile.model;
 
-import java.math.BigDecimal;
-
+import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.framework.model.IBasePO;
-
 import io.swagger.annotations.ApiModelProperty;
 
-import com.alibaba.fastjson.JSONObject;
-import com.steerinfo.ems.Utils.DateUtils;
+import java.math.BigDecimal;
 
 public class IfMesEmsSwapfile implements IBasePO<String> {
 
@@ -91,6 +89,12 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
     @ApiModelProperty(value="读取时间",required=false)
     private String sendtime;
 
+    /**
+     * 读取时间(SENDTIME,DATE,7)
+     */
+    @ApiModelProperty(value="备注",required=false)
+    private String memo;
+
     public String getFid() {
         return fid;
     }
@@ -182,6 +186,13 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
         this.sendtime = sendtime == null ? null : sendtime;
     }
 
+    public String getMemo() {
+        return memo;
+    }
+    public void setMemo(String memo) {
+        this.memo = memo == null ? null : memo;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -201,6 +212,7 @@ public class IfMesEmsSwapfile implements IBasePO<String> {
         sb.append(", createtime=").append(createtime);
         sb.append(", status=").append(status);
         sb.append(", sendtime=").append(sendtime);
+        sb.append(", memo=").append(memo);
         sb.append("]");
         return sb.toString();
     }

+ 44 - 6
src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/IIfMesEmsSwapfileService.java

@@ -1,20 +1,20 @@
 package com.steerinfo.ems.ifmesemsswapfile.service;
 
+import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.framework.service.pagehelper.PageList;
+
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Set;
-
-import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
-import com.steerinfo.framework.service.IBaseService;
-import com.steerinfo.framework.service.pagehelper.PageList;
+import java.util.Map;
 
 
 public interface IIfMesEmsSwapfileService extends IBaseService<IfMesEmsSwapfile, String>{
 
     /**
-	 * EMS获取MES数据
+	 * EMS获取MES投入产出数据
 	 * @return
 	 */
 	String synchronousMesAnEmsData();
@@ -44,4 +44,42 @@ public interface IIfMesEmsSwapfileService extends IBaseService<IfMesEmsSwapfile,
 	 * @return
 	 */
 	String synchronousMesFromProd(Date d);
+
+	/**
+	 * 获取生产数据
+	 */
+	public  void  getLgDateProd();
+
+	/**
+	 * 查询所有数据
+	 *
+	 * @param parmas
+	 * @param pageNum
+	 * @param pageSize
+	 * @return
+	 */
+	PageList<Map<String, Object>> getQueryList(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize);
+
+	/**
+	 * 查询投入产出数据
+	 *
+	 * @param parmas
+	 * @param pageNum
+	 * @param pageSize
+	 * @return
+	 */
+	PageList<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize);
+
+	/**
+	 * 修改投入产出数据
+	 * @param parmas 参数
+	 * @return
+	 */
+	int updateProductAndMaterial(HashMap<String, Object> parmas);
+
+	/**
+	 * 生成投入产出数据模板
+	 * @return
+	 */
+	String generateProductAndMaterial();
 }

+ 192 - 35
src/main/java/com/steerinfo/ems/ifmesemsswapfile/service/impl/IfMesEmsSwapfileServiceImpl.java

@@ -1,26 +1,35 @@
 package com.steerinfo.ems.ifmesemsswapfile.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.ems.Utils.DateUtils;
+import com.steerinfo.ems.Utils.HttpRequestMes;
 import com.steerinfo.ems.ifmesemsswapfile.mapper.IfMesEmsSwapfileMapper;
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
-import com.steerinfo.ems.Utils.HttpRequestMes;
+import com.steerinfo.ems.trmmaterial.model.TRmMaterial;
+import com.steerinfo.ems.trmmaterial.service.ITRmMaterialService;
+import com.steerinfo.ems.trmproduct.model.TRmProduct;
+import com.steerinfo.ems.trmproduct.service.ITRmProductService;
+import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
+import com.steerinfo.ems.trmworkprocmaterial.service.ITRmWorkprocMaterialService;
+import com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct;
+import com.steerinfo.ems.trmworkprocproduct.service.ITRmWorkprocProductService;
+import com.steerinfo.feigen.model.LgWeight;
+import com.steerinfo.feigen.service.LgWeightFeigenService;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
+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;
 
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
 @Service(value = "ifMesEmsSwapfileService")
 public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfile, String> implements IIfMesEmsSwapfileService {
 	
@@ -28,6 +37,20 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 
     @Autowired
     private IfMesEmsSwapfileMapper ifmesemsswapfilemapper;
+    @Autowired
+	private LgWeightFeigenService lgWeightFeigenService;
+
+	@Autowired
+	ITRmMaterialService tRmMaterialService;
+
+	@Autowired
+	ITRmProductService tRmProductService;
+
+	@Autowired
+	ITRmWorkprocMaterialService tRmWorkprocMaterialService;
+
+	@Autowired
+	ITRmWorkprocProductService tRmWorkprocProductService;
 
     @Override
     protected IBaseMapper<IfMesEmsSwapfile, String> getMapper() {
@@ -37,39 +60,58 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
     public String synchronousMesAnEmsData() {
 		int addSize = 0;
 		int updateSize = 0;
-		int errorSize = 0;
 		String url = "http://172.16.100.91:8093/mes_interface/mesdata"; // 投入产出数据
+		/*
+		 * {"fid":"202102200037","createtime":1614001724000,"works":"8004","orderno":"000010022368",
+		 * "materialname":"二体系︱铁水","memo":"铁区报工","mespzid":"CC_1011GL2_000010022368_2021-02-20",
+		 * "type":"2","prodline":"1011GL2","unit":"吨","toemsid":"CC_1011GL2_000010022368_2021-02-20_1",
+		 * "prodate":1613750400000,"qty":2974.9,"materialcode":"7300000001","sendtime":"2021-02-21 08:49:29","status":"9"}
+		 * */
 		while (true) {
-			String res = HttpRequestMes.httpRequestMes(url, "get", null);
-			JSONArray ja = JSONArray.parseArray(res);
-			if (ja != null && !ja.isEmpty()) {
-				logger.info("获取投入产出数据条数:" + ja.size());
-				for (int i = 0; i < ja.size(); i++) {
-					JSONObject jo = (JSONObject) ja.get(i);
-					if(!jo.containsKey("fid")){
-						errorSize += 1;
-						continue;
-					}
-					IfMesEmsSwapfile model = new IfMesEmsSwapfile();
-					model.jsonobjectToIfMesEmsSwapfile(jo);
-					if(model.getStatus().equals("9")){
-						logger.info("修改数据:" + jo.toJSONString());
-					}
-					if (ifmesemsswapfilemapper.updateByPrimaryKey(model) == 0){
-						addSize += ifmesemsswapfilemapper.insert(model);
-					}else{
-						updateSize +=1;
+			try {
+				String res = HttpRequestMes.httpRequestMes(url, "get", null);
+				JSONArray ja = JSONArray.parseArray(res);
+				if (ja != null && !ja.isEmpty()) {
+					logger.info("获取投入产出数据条数:" + ja.size());
+					for (int i = 0; i < ja.size(); i++) {
+						JSONObject jo = (JSONObject) ja.get(i);
+						if(!jo.containsKey("fid")){
+							continue;
+						}
+						// 新数据
+						IfMesEmsSwapfile model = new IfMesEmsSwapfile();
+						model.jsonobjectToIfMesEmsSwapfile(jo);
+						// 原数据
+						String fid = jo.getString("fid");
+						IfMesEmsSwapfile ime = ifmesemsswapfilemapper.selectByPrimaryKey(fid);
+						if(ime!=null){
+							ifmesemsswapfilemapper.updateByPrimaryKey(model);
+							updateSize +=1;
+							logger.info("修改数据:" + jo.toJSONString());
+							if (!model.getStatus().equals("9")) {
+								logger.error("有重复不正常的数据,fid:"+ fid + ",status:" + model.getStatus());
+							}
+						}else{
+							addSize += ifmesemsswapfilemapper.insert(model);
+							if (!model.getStatus().equals("0")) {
+								logger.error("有新增不正常的数据,fid:"+ fid + ",status:" + model.getStatus());
+							}
+						}
+						HttpRequestMes.httpRequestMes(url, "post", "[{\"id\":\"" + jo.getString("fid") + "\",\"status\":\"1\"}]");
 					}
-					HttpRequestMes.httpRequestMes(url, "post", "[{\"id\":\"" + jo.getString("fid") + "\",\"status\":\"1\"}]");
+					logger.info("结束一次投入产出数据同步。");
+				} else {
+					break;
 				}
-			} else {
+			} catch (Exception e) {
+				e.printStackTrace();
+				logger.error("投入产出数据同步出错了。", e);
 				break;
 			}
 		}
 		logger.info("本次总共新增投入产出数据条数:" + addSize);
 		logger.info("本次总共更新投入产出数据条数:" + updateSize);
-		logger.info("本次总共错误投入产出数据条数:" + errorSize);
-        return "本次新增" + addSize + "条,更新" + updateSize + "条,失败" + errorSize + "条。";
+        return "本次新增" + addSize + "条,更新" + updateSize + "条。";
 	}
 
 	public List<IfMesEmsSwapfile> selectNewMaterial(HashMap<String, Object> model) {
@@ -120,4 +162,119 @@ public class IfMesEmsSwapfileServiceImpl extends BaseServiceImpl<IfMesEmsSwapfil
 		logger.info("从正式环境同步MES投入产出数据--执行完毕--");
 		return null;
 	}
+
+
+	//获取炼钢的产出数据
+	public  void  getLgDateProd(){
+		List<LgWeight> lgWeights = lgWeightFeigenService.QueryWeightByTime();
+		for (LgWeight lgWeight : lgWeights) {
+			IfMesEmsSwapfile model = new IfMesEmsSwapfile();
+			model.setType("2");
+			model.setWorks("1036LG1");
+			model.setProdline("1036LG1");
+			model.setProdate(lgWeight.getDate());
+			model.setMaterialname(lgWeight.getType());
+			model.setUnit("吨");
+			model.setQty(lgWeight.getWeight());
+			model.setCreatetime(DateUtils.dateStr(new Date(),"yyyy-MM-dd"));
+			model.setStatus("0");
+			model.setFid(DateUtils.dateStr(new Date(),"yyyyMMddHHmmss"));
+			ifmesemsswapfilemapper.insert(model);
+		}
+		System.out.println("接收成功...");
+	}
+
+	@Override
+	public PageList<Map<String, Object>> getQueryList(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
+		PageHelper.startPage(pageNum, pageSize);
+		//Calendar cal = Calendar.getInstance();
+		//cal.add(Calendar.HOUR_OF_DAY, 1);
+		//cal.add(Calendar.DAY_OF_YEAR, -1);
+		//String clock = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
+		//parmas.put("clockt", clock); // 可以修改的clock
+		//parmas.put("clocktm", clock.substring(0, 7)); // 可以修改的clock(月)
+		if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
+			String workProcids = parmas.get("workprocid").toString();
+			workProcids = "'" + workProcids.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcids", workProcids);
+		}
+		List<Map<String, Object>> rows = ifmesemsswapfilemapper.getQueryList(parmas);
+		PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
+		return pageInfo;
+	}
+	@Override
+	public PageList<Map<String, Object>> queryProductAndMaterial(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
+		PageHelper.startPage(pageNum, pageSize);
+		if(parmas.get("workprocid")!=null && !parmas.get("workprocid").toString().isEmpty()){
+			String workProcids = parmas.get("workprocid").toString();
+			workProcids = "'" + workProcids.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcids", workProcids);
+		}
+		if(parmas.get("workproc")!=null && !parmas.get("workproc").toString().isEmpty()){
+			String workProcs = parmas.get("workproc").toString();
+			workProcs = "'" + workProcs.replaceAll(",", "','").replaceAll(",", "','") + "'";
+			parmas.put("workProcs", workProcs);
+		}
+		List<Map<String, Object>> rows = ifmesemsswapfilemapper.queryProductAndMaterial(parmas);
+		PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
+		return pageInfo;
+	}
+
+	@Override
+	public int updateProductAndMaterial(HashMap<String, Object> parmas) {
+		return ifmesemsswapfilemapper.updateProductAndMaterial(parmas);
+	}
+
+	@Override
+	public String generateProductAndMaterial() {
+		HashMap hashMap = new HashMap<String, String>();
+		List<TRmProduct> tRmProducts = tRmProductService.query(hashMap);
+		List<TRmMaterial> trmMaterials = tRmMaterialService.query(hashMap);
+		List<TRmWorkprocProduct> tRmWorkprocProducts = tRmWorkprocProductService.query(hashMap);
+		List<TRmWorkprocMaterial> tRmWorkprocMaterials = tRmWorkprocMaterialService.query(hashMap);
+		IfMesEmsSwapfile model = new IfMesEmsSwapfile();
+		IfMesEmsSwapfile ifMesEmsSwapfile;
+		String materialName;
+		int addSize = 0;
+		for (TRmWorkprocProduct tRmWorkprocProduct : tRmWorkprocProducts) {
+			ifMesEmsSwapfile = ifmesemsswapfilemapper.selectByPrimaryKey(tRmWorkprocProduct.getProductid()+tRmWorkprocProduct.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+			if(ifMesEmsSwapfile == null)
+			{
+				materialName = tRmProductService.getById(tRmWorkprocProduct.getProductid()).getName();
+				model.setType("2");
+				model.setWorks(tRmWorkprocProduct.getWorkprocid());
+				model.setProdline(tRmWorkprocProduct.getMesProdline());
+				model.setProdate(DateUtils.dateStr(new Date(),"yyyy-MM-dd"));
+				model.setMaterialname(materialName);
+				model.setMaterialcode(tRmWorkprocProduct.getMesMaterialcode());
+				model.setUnit(tRmWorkprocProduct.getUnitid());
+				model.setQty(new BigDecimal(0));
+				// DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss")
+				model.setCreatetime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss"));
+				model.setStatus("0");
+				model.setFid(tRmWorkprocProduct.getProductid()+tRmWorkprocProduct.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+				addSize += ifmesemsswapfilemapper.insert(model);
+			}
+		}
+		for (TRmWorkprocMaterial tRmWorkprocMaterial : tRmWorkprocMaterials) {
+			ifMesEmsSwapfile = ifmesemsswapfilemapper.selectByPrimaryKey(tRmWorkprocMaterial.getMaterialid()+tRmWorkprocMaterial.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+			if(ifMesEmsSwapfile == null)
+			{
+				materialName = tRmMaterialService.getById(tRmWorkprocMaterial.getMaterialid()).getName();
+				model.setType("1");
+				model.setWorks(tRmWorkprocMaterial.getWorkprocid());
+				model.setProdline(tRmWorkprocMaterial.getMesProdline());
+				model.setProdate(DateUtils.dateStr(new Date(),"yyyy-MM-dd"));
+				model.setMaterialname(materialName);
+				model.setMaterialcode(tRmWorkprocMaterial.getMesMaterialcode());
+				model.setUnit(tRmWorkprocMaterial.getUnitid());
+				model.setQty(new BigDecimal(0));
+				model.setCreatetime(DateUtils.dateStr(new Date(),"yyyy-MM-dd hh-mm-ss"));
+				model.setStatus("0");
+				model.setFid(tRmWorkprocMaterial.getMaterialid()+tRmWorkprocMaterial.getMesProdline()+DateUtils.dateStr(new Date(),"yyyyMMdd"));
+				addSize += ifmesemsswapfilemapper.insert(model);
+			}
+		}
+		return "本次共生成" + addSize + "条";
+	}
 }

+ 21 - 0
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/controller/TRmWorkprocMaterialValueController.java

@@ -4,6 +4,7 @@ import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
 import com.steerinfo.ems.formula.service.IFormulaService;
+import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
 import com.steerinfo.ems.trmworkprocmaterial.mapper.TRmWorkprocMaterialMapper;
 import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
 import com.steerinfo.ems.trmworkprocmaterialvalue.mapper.TRmWorkprocMaterialValueMapper;
@@ -46,6 +47,9 @@ public class TRmWorkprocMaterialValueController extends BaseRESTfulController {
     @Autowired
     private TRmWorkprocMaterialMapper tRmWorkprocMaterialMapper;
     
+    @Autowired
+    IIfMesEmsSwapfileService ifMesEmsSwapfileService;
+    
     @Autowired
     IFormulaService formulaService;
 
@@ -237,6 +241,10 @@ public class TRmWorkprocMaterialValueController extends BaseRESTfulController {
 		if (timegranid==null || timegranid.isEmpty()) {
     		return failed(null, "请传入时间粒度");
     	}
+		ifMesEmsSwapfileService.synchronousMesAnEmsData();
+		tRmWorkprocMaterialValueService.synchronousData();
+		tRmWorkprocMaterialValueService.synchronousData4();
+		tRmWorkprocMaterialValueService.synchronousData5();
 		parmas.put("useflag", "1");
 		// 查询需要统计的计量点信息
 		List<TRmWorkprocMaterial> l = tRmWorkprocMaterialMapper.selectByParameters(parmas);
@@ -251,4 +259,17 @@ public class TRmWorkprocMaterialValueController extends BaseRESTfulController {
         return success();
     }
     
+    @ApiOperation(value="批量重新计算", notes="")
+    @ApiImplicitParam(name = "TRmWorkprocMaterialValue", value = "详细实体TRmWorkprocMaterialValue", required = true, dataType = "TRmWorkprocMaterialValue")
+    @PutMapping(value = "/batchCompute", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult batchCompute(@RequestBody TRmWorkprocMaterialValue[] model){
+    	if(model.length<1){
+    		return failed(null, "请勾选数据");
+    	}
+    	for (int i = 0; i< model.length; i++) {
+    		TRmWorkprocMaterialValue tv = model[i];
+    		tRmWorkprocMaterialValueService.restatData(tv.getItemid(), tv.getClock(), tv.getTimegranid());
+    	}
+    	return success();
+    }
 }

+ 6 - 2
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/mapper/TRmWorkprocMaterialValueMapper.xml

@@ -174,7 +174,9 @@
         APPORTVALUE,
         UCVALUE,
         SUMUCVALUE,
-        BZ
+        BZ,
+        USERID,
+        UPDATETIME
       )
       VALUES
         (
@@ -189,7 +191,9 @@
           #{qty,jdbcType=DECIMAL},
           0,
           0,
-          'MES' || '-' || to_char(SYSDATE,'yyyy/MM/dd HH24:mi:ss') || ' fid:' || #{fid,jdbcType=VARCHAR}
+          'MES' || '-' || to_char(SYSDATE,'yyyy/MM/dd HH24:mi:ss') || ' fid:' || #{fid,jdbcType=VARCHAR},
+          #{userid,jdbcType=VARCHAR},
+          #{updatetime,jdbcType=VARCHAR}
         )
   </insert>
 

+ 10 - 0
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/ITRmWorkprocMaterialValueService.java

@@ -48,6 +48,16 @@ public interface ITRmWorkprocMaterialValueService extends IBaseService<TRmWorkpr
 	 * 将IF_MES_EMS_SWAPFILE中未读取的数据进行处理,将数据保存至T_RM_WORKPROC_MATERIAL_VALUE
 	 */
 	void synchronousData();
+	
+	/**
+	 * 原料购入0数据处理(type=4)
+	 */
+	void synchronousData4();
+	
+	/**
+	 * 原料库存-数据处理(type=5)
+	 */
+	void synchronousData5();
 
     /**
      * 原材料定时任务,先处理IF_MES_EMS_SWAPFILE数据,然后公式计算或者粒度累加,生成计算公式生成数据的日数据,以及月数据、年数据(新增或者更新)

+ 124 - 97
src/main/java/com/steerinfo/ems/trmworkprocmaterialvalue/service/impl/TRmWorkprocMaterialValueServiceImpl.java

@@ -1,40 +1,35 @@
 package com.steerinfo.ems.trmworkprocmaterialvalue.service.impl;
 
-import com.steerinfo.ems.formula.model.Formula;
-import com.steerinfo.ems.formula.service.IFormulaService;
-import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
-import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
-import com.steerinfo.framework.mapper.IBaseMapper;
-import com.steerinfo.framework.service.impl.BaseServiceImpl;
-import com.steerinfo.framework.service.pagehelper.PageHelper;
-import com.steerinfo.framework.service.pagehelper.PageList;
-import com.steerinfo.ems.trmworkprocmaterialvalue.model.TRmWorkprocMaterialValue;
-import com.steerinfo.ems.trmworkprocmaterialvalue.mapper.TRmWorkprocMaterialValueMapper;
-import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
-import com.steerinfo.auth.utils.JwtUtil;
 import com.steerinfo.ems.Utils.BigDecimalUtil;
 import com.steerinfo.ems.Utils.DateUtils;
-import com.steerinfo.ems.common.DateTypeEnum;
+import com.steerinfo.ems.formula.model.Formula;
+import com.steerinfo.ems.formula.service.IFormulaService;
 import com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile;
 import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
 import com.steerinfo.ems.trmmaterial.mapper.TRmMaterialMapper;
 import com.steerinfo.ems.trmmaterial.model.TRmMaterial;
 import com.steerinfo.ems.trmmaterial.service.ITRmMaterialService;
-import com.steerinfo.ems.trmworkproc.model.TRmWorkproc;
 import com.steerinfo.ems.trmworkproc.service.ITRmWorkprocService;
+import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
 import com.steerinfo.ems.trmworkprocmaterial.service.ITRmWorkprocMaterialService;
+import com.steerinfo.ems.trmworkprocmaterialvalue.mapper.TRmWorkprocMaterialValueMapper;
+import com.steerinfo.ems.trmworkprocmaterialvalue.model.TRmWorkprocMaterialValue;
+import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
+import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+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;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.transaction.annotation.Transactional;
-
 /**
  * TRmWorkprocMaterialValue服务实现:
  * @author generator
@@ -202,70 +197,82 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 					}
 					String itemid = "";
 					String wid = "";
-					if (mline.endsWith("GX1")) { // 一高线-ZY9102
-						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
-						if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
-							wid = "ZY9102";
-							itemid = wid + mid + "R";
-						}
-					} else if (mline.endsWith("GX3")) { // 三高线-ZY9103
-						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
-						if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
-							wid = "ZY9103";
-							itemid = wid + mid + "R";
-						}
-					} else if (mline.endsWith("GX2")) { // 二高线-ZY9201
-						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
-						if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
-							wid = "ZY9201";
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("GX4") || mline.endsWith("GX5")) { // 四五高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9202");
-						if(tw!=null && tw.getName().equalsIgnoreCase("四五高线")){
-							wid = "ZY9202";
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("QT1")) { // 一球团-ZY6100
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY6100");
-						if(tw!=null && tw.getName().equalsIgnoreCase("一球团")){
-							wid = "ZY6100";
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("QT2")) { // 二球团-ZY6200
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY6200");
-						if(tw!=null && tw.getName().equalsIgnoreCase("二球团")){
-							wid = "ZY6200";
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("BC1")) { // 一棒材-ZY9101
-						wid = "ZY9101";
-						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-						if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
-						wid = "ZY7202";
-						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-						if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("JH1")) { // 一焦化-ZY4100
-						wid = "ZY4100";
-						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-						if(tw!=null && tw.getName().equalsIgnoreCase("一焦化")){
-							itemid = wid + mid + "R";
-						}
-					} else if(mline.endsWith("JH2")) { // 二焦化-ZY4200
-						wid = "ZY4200";
-						TRmWorkproc tw = tRmWorkprocService.getById(wid);
-						if(tw!=null && tw.getName().equalsIgnoreCase("二焦化")){
-							itemid = wid + mid + "R";
-						}
-					}
+					//if (mline.endsWith("GX1")) { // 一高线-ZY9102
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
+					//		wid = "ZY9102";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if (mline.endsWith("GX3")) { // 三高线-ZY9103
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
+					//		wid = "ZY9103";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if (mline.endsWith("GX2")) { // 二高线-ZY9201
+					//	// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
+					//		wid = "ZY9201";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("GX4") || mline.endsWith("GX5")) { // 四五高线
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY9202");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("四五高线")){
+					//		wid = "ZY9202";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("QT1")) { // 一球团-ZY6100
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY6100");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一球团")){
+					//		wid = "ZY6100";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("QT2")) { // 二球团-ZY6200
+					//	TRmWorkproc tw = tRmWorkprocService.getById("ZY6200");
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二球团")){
+					//		wid = "ZY6200";
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("BC1")) { // 一棒材-ZY9101
+					//	wid = "ZY9101";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
+					//	wid = "ZY7202";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("JH1")) { // 一焦化-ZY4100
+					//	wid = "ZY4100";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一焦化")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("JH2")) { // 二焦化-ZY4200
+					//	wid = "ZY4200";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二焦化")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("LG1")) { // 一炼钢 - ZY8100
+					//	wid = "ZY8100";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("一炼钢")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//} else if(mline.endsWith("LG2")) { // 二炼钢-ZY8200
+					//	wid = "ZY8200";
+					//	TRmWorkproc tw = tRmWorkprocService.getById(wid);
+					//	if(tw!=null && tw.getName().equalsIgnoreCase("二炼钢")){
+					//		itemid = wid + mid + "R";
+					//	}
+					//}
 					if(!itemid.isEmpty() && !mid.isEmpty()){
 						twm = tRmWorkprocMaterialService.getById(itemid);
 						if(twm!=null){
@@ -327,6 +334,8 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
                     insertObj.put("itemid", twm.getItemid());
                     insertObj.put("qty", swapfile.getQty());
                     insertObj.put("fid", swapfile.getFid());
+					insertObj.put("userid", "系统");
+					insertObj.put("updatetime", DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
                     try {
                         int upSize = tRmWorkprocMaterialValueMapper.updateValue(insertObj);
                         if (upSize == 0) {
@@ -379,7 +388,7 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 			if (swapfile.getStatus().equals("9")) {
 				// 在T_RM_WORKPROC_MATERIAL中查找匹配的itemId
 				HashMap<String, Object> itemObj = new HashMap<String, Object>();
-				itemObj.put("mes_materialcode", swapfile.getMaterialcode());
+				itemObj.put("mesMaterialcode", swapfile.getMaterialcode());
 				itemObj.put("workprocid", "ZYG000");
 				itemObj.put("itemtype", "R");
 				itemObj.put("code", "0");
@@ -410,7 +419,7 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 			}
 			// 在T_RM_WORKPROC_MATERIAL中查找匹配的itemId
 			HashMap<String, Object> itemObj = new HashMap<String, Object>();
-			itemObj.put("mes_materialcode", swapfile.getMaterialcode());
+			itemObj.put("mesMaterialcode", swapfile.getMaterialcode());
 			itemObj.put("workprocid", "ZYG000");
 			itemObj.put("itemtype", "R");
 			itemObj.put("code", "0");
@@ -568,7 +577,7 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 			if (swapfile.getStatus().equals("9")) {
 				// 在T_RM_WORKPROC_MATERIAL中查找匹配的itemId
 				HashMap<String, Object> itemObj = new HashMap<String, Object>();
-				itemObj.put("mes_materialcode", swapfile.getMaterialcode());
+				itemObj.put("mesMaterialcode", swapfile.getMaterialcode());
 				itemObj.put("workprocid", "ZYF000");
 				itemObj.put("itemtype", "R");
 				itemObj.put("code", "0");
@@ -599,7 +608,7 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 			}
 			// 在T_RM_WORKPROC_MATERIAL中查找匹配的itemId
 			HashMap<String, Object> itemObj = new HashMap<String, Object>();
-			itemObj.put("mes_materialcode", swapfile.getMaterialcode());
+			itemObj.put("mesMaterialcode", swapfile.getMaterialcode());
 			itemObj.put("workprocid", "ZYF000");
 			itemObj.put("itemtype", "R");
 			itemObj.put("code", "0");
@@ -804,8 +813,14 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
         		id.put("timegranid", "MONTH");
         		// 获取原数据
             	TRmWorkprocMaterialValue tv = tRmWorkprocMaterialValueMapper.selectByPrimaryKey(id);
-            	// 月数据等于,日数据之和
-        		Double val = this.getSumvalue(tm.getItemid(),clock,"DAY");
+        		Double val = 0d;
+        		if(tm.getCode().equals("1")) {
+        			// 公式计算类型
+        			val = formulaService.getValByItemid(tm.getItemid(), "MONTH", clock, 0);
+        		} else {
+        			// 月数据等于,日数据之和
+        			val = this.getSumvalue(tm.getItemid(),clock,"DAY");
+        		}
         		// 获取产量
                 Map<String, BigDecimal> outPut = tRmWorkprocProductValueService.getOutPut(tm.getWorkprocid(),clock,"MONTH","R");
                 Double sjcl = outPut.get("SJCL").doubleValue();
@@ -840,8 +855,14 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
         		id.put("timegranid", "YEAR");
         		// 获取原数据
 				TRmWorkprocMaterialValue tv = tRmWorkprocMaterialValueMapper.selectByPrimaryKey(id);
-				// 年数据等于,月数据之和
-        		Double val = this.getSumvalue(tm.getItemid(),clock,"MONTH");
+        		Double val = 0d;
+        		if(tm.getCode().equals("1")) {
+        			// 公式计算类型
+        			val = formulaService.getValByItemid(tm.getItemid(), "YEAR", clock, 0);
+        		} else {
+        			// 年数据等于,月数据之和
+        			val = this.getSumvalue(tm.getItemid(),clock,"MONTH");
+        		}
         		// 获取产量
                 Map<String, BigDecimal> outPut = tRmWorkprocProductValueService.getOutPut(tm.getWorkprocid(),clock,"YEAR","R");
                 Double sjcl = outPut.get("SJCL").doubleValue();
@@ -902,21 +923,20 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 		TRmWorkprocMaterial twm = tRmWorkprocMaterialService.getById(itemid);
 		Short digits = twm.getDigits() == null ? 2 : twm.getDigits();
 		String code = twm.getCode();
-		String mes_materialcode = twm.getMesMaterialcode();
+		String mesMaterialcode = twm.getMesMaterialcode();
 		String mes_prodline = twm.getMesProdline();
-		if (code.equals("0") && (mes_materialcode ==null || mes_prodline ==null || mes_materialcode.isEmpty() || mes_prodline.isEmpty())) {
+		if (code.equals("0") && (mesMaterialcode ==null || mes_prodline ==null || mesMaterialcode.isEmpty() || mes_prodline.isEmpty())) {
 			logger.info("原材料[" + itemid + "]MES物料编码或者产线信息不完整");
 			return "原料编码或者产线信息不完整";
 		}
 		try {
-			// 日粒度为MES数据计算或者公式计算,其他情况为低粒度累加
 			if(timegranid.equalsIgnoreCase("DAY")){
 				HashMap<String, Object> hpm = new HashMap<String, Object>();
 				hpm.put("clock", clock);
 				hpm.put("itemid", itemid);
 				hpm.put("timegranid", timegranid);
 				hpm.put("itemtype", itemid.substring(itemid.length()-1, itemid.length()));
-				hpm.put("materialcode", mes_materialcode);
+				hpm.put("materialcode", mesMaterialcode);
 				hpm.put("prodline", mes_prodline);
 				// 计算值
 	            Double actualvalue = 0d;
@@ -966,7 +986,14 @@ public class TRmWorkprocMaterialValueServiceImpl extends BaseServiceImpl<TRmWork
 		            maps.put("timegranid", "MONTH");
 	        	}
 	        	// 计算值
-	        	BigDecimal actualvalue = new BigDecimal(tRmWorkprocMaterialValueMapper.getSumvalue(maps)).setScale(digits, RoundingMode.HALF_UP);
+	        	BigDecimal actualvalue = BigDecimal.ZERO;
+	        	if(code.equals("0")){
+	        		// 小粒度累加
+	        		actualvalue = new BigDecimal(tRmWorkprocMaterialValueMapper.getSumvalue(maps)).setScale(digits, RoundingMode.HALF_UP);
+				}else if(code.equals("1")){
+					// 公式计算型
+					actualvalue = new BigDecimal(formulaService.getValByItemid(itemid, timegranid, clock, 0)).setScale(digits, RoundingMode.HALF_UP);
+				}
 	            TRmWorkprocMaterialValue tv = tRmWorkprocMaterialValueMapper.selectByPrimaryKey(id);
 	            if(tv!=null && tv.getActualvalue().doubleValue() != actualvalue.doubleValue()){
 					tv.setActualvalue(actualvalue);

+ 59 - 29
src/main/java/com/steerinfo/ems/trmworkprocproductvalue/controller/TRmWorkprocProductValueController.java

@@ -3,15 +3,15 @@ package com.steerinfo.ems.trmworkprocproductvalue.controller;
 import com.steerinfo.auth.utils.JwtUtil;
 import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.ems.formula.service.IFormulaService;
-import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
-import com.steerinfo.ems.trmworkprocmaterialvalue.model.TRmWorkprocMaterialValue;
+import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
 import com.steerinfo.ems.trmworkprocproduct.mapper.TRmWorkprocProductMapper;
 import com.steerinfo.ems.trmworkprocproduct.model.TRmWorkprocProduct;
 import com.steerinfo.ems.trmworkprocproduct.service.ITRmWorkprocProductService;
+import com.steerinfo.feigen.model.LgWeight;
+import com.steerinfo.feigen.service.LgWeightFeigenService;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
-import com.steerinfo.ems.trmworkprocproductvalue.mapper.TRmWorkprocProductValueMapper;
 import com.steerinfo.ems.trmworkprocproductvalue.model.TRmWorkprocProductValue;
 import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
 import io.swagger.annotations.ApiImplicitParam;
@@ -55,6 +55,11 @@ public class TRmWorkprocProductValueController extends BaseRESTfulController {
     
     @Autowired
     IFormulaService formulaService;
+    
+    @Autowired
+    IIfMesEmsSwapfileService ifMesEmsSwapfileService;
+    @Autowired
+    LgWeightFeigenService lgWeightFeigen;
 
     @ApiOperation(value="获取列表", notes="分页查询")
     @ApiImplicitParams({
@@ -64,7 +69,7 @@ public class TRmWorkprocProductValueController extends BaseRESTfulController {
     //@RequiresPermissions("trmworkprocproductvalue:view")
     @GetMapping(value = "/")
     public RESTfulResult list(@RequestParam HashMap<String, Object> parmas,Integer pageNum, Integer pageSize){
-        // PageList<TRmWorkprocProductValue> list = tRmWorkprocProductValueService.queryForPage(parmas, pageNum, pageSize);
+        tRmWorkprocProductValueService.setDate(new Date());
     	if(parmas.containsKey("productid") && parmas.get("productid") != null && !"".equals(parmas.get("productid").toString())){
             String productid = parmas.get("productid").toString();
             if(productid.indexOf(",") == -1){
@@ -218,33 +223,41 @@ public class TRmWorkprocProductValueController extends BaseRESTfulController {
     @ApiImplicitParam(name = "usageData", value = "详细实体usageData", required = true, dataType = "usageData")
     @PutMapping(value = "/batchUpdate", produces  = "application/json;charset=UTF-8")
     public RESTfulResult batchupdate(@RequestBody TRmWorkprocProductValue[] model){
-        int failnum = 0;
-        ArrayList<String> failmsgs = new ArrayList<String>();
-        String userId = JwtUtil.getUseridByToken();
-        for(int i = 0;i < model.length;i++){
-            HashMap<String, Object> m = new HashMap<String, Object>();
-            m.put("clock", model[i].getClock());
-            m.put("timegranid", model[i].getTimegranid());
-            m.put("itemid", model[i].getItemid());
-            m.put("itemtype", model[i].getItemtype());
-            try {
-                logger.info("T_RM_WORKPROC_PRODUCT_VALUE表的数据发生修改(操作人ID:" + userId + "):");
-                logger.info("修改前数据是" + tRmWorkprocProductValueService.getById(m).toString());
-                model[i].setUpman(userId);
-                model[i].setUptime(DateUtils.getCurrentTimetoDate("yyyy-MM-dd HH:mm:ss"));
-                TRmWorkprocProductValue usageData = tRmWorkprocProductValueService.updateForUKey(model[i]);
-                logger.info("修改后数据是" + usageData.toString());
-            }
-            catch(Exception e){
-                failnum++;
-                failmsgs.add(m.toString());
-                logger.error("T_RM_WORKPROC_PRODUCT_VALUE表的数据修改出现错误,错误原因是" + e + ",id是" + m.toString());
+        for (int i = 0; i < model.length; i++) {
+            TRmWorkprocProductValue model1 = model[i];
+            if (model1==null){
+                return failed(null, "请传入主键参数");
             }
+            TRmWorkprocProductValue tRmWorkprocProductValue =tRmWorkprocProductValueService.updateForUKey(model1);
         }
-        if(failnum > 0){
-            logger.info("本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条");
-            return success(failmsgs, "51","本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条,失败的数据id:" + failmsgs.toString());
-        }
+//        int failnum = 0;
+//        ArrayList<String> failmsgs = new ArrayList<String>();
+//        String userId = JwtUtil.getUseridByToken();
+//        for(int i = 0;i < model.length;i++){
+//            HashMap<String, Object> m = new HashMap<String, Object>();
+//            m.put("clock", model[i].getClock());
+//            m.put("timegranid", model[i].getTimegranid());
+//            m.put("itemid", model[i].getItemid());
+//            m.put("itemtype", model[i].getItemtype());
+//            m.put("correctvalue",model[i].getCorrectvalue());
+//            try {
+//                logger.info("T_RM_WORKPROC_PRODUCT_VALUE表的数据发生修改(操作人ID:" + userId + "):");
+//                logger.info("修改前数据是" + tRmWorkprocProductValueService.getById(m).toString());
+//                model[i].setUpman(userId);
+//                model[i].setUptime(DateUtils.getCurrentTimetoDate("yyyy-MM-dd HH:mm:ss"));
+//                TRmWorkprocProductValue usageData = tRmWorkprocProductValueService.updateForUKey(model[i]);
+//                logger.info("修改后数据是" + usageData.toString());
+//            }
+//            catch(Exception e){
+//                failnum++;
+//                failmsgs.add(m.toString());
+//                logger.error("T_RM_WORKPROC_PRODUCT_VALUE表的数据修改出现错误,错误原因是" + e + ",id是" + m.toString());
+//            }
+//        }
+//        if(failnum > 0){
+//            logger.info("本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条");
+//            return success(failmsgs, "51","本次共修改" + model.length + "条数据,其中成功" + (model.length - failnum) + "条,失败" + failnum + "条,失败的数据id:" + failmsgs.toString());
+//        }
         return success();
     }
 
@@ -413,6 +426,9 @@ public class TRmWorkprocProductValueController extends BaseRESTfulController {
     		return failed(null, "请传入时间粒度");
     	}
 		parmas.put("useflag", "1");
+		ifMesEmsSwapfileService.synchronousMesAnEmsData();
+		tRmWorkprocProductValueService.synchronousData();
+		tRmWorkprocProductValueService.synchronousOrderData();
 		// 查询需要统计的项目
 		List<TRmWorkprocProduct> l = tRmWorkprocProductMapper.selectByParameters(parmas);
 		String res = "";
@@ -425,4 +441,18 @@ public class TRmWorkprocProductValueController extends BaseRESTfulController {
 		}
         return success();
     }
+    
+    @ApiOperation(value="批量重新计算", notes="")
+    @ApiImplicitParam(name = "TRmWorkprocProductValue", value = "详细实体TRmWorkprocProductValue", required = true, dataType = "TRmWorkprocProductValue")
+    @PutMapping(value = "/batchCompute", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult batchCompute(@RequestBody TRmWorkprocProductValue[] model){
+    	if(model.length<1){
+    		return failed(null, "请勾选数据");
+    	}
+    	for (int i = 0; i< model.length; i++) {
+    		TRmWorkprocProductValue tv = model[i];
+    		tRmWorkprocProductValueService.restatData(tv.getItemid(), tv.getClock(), tv.getTimegranid());
+    	}
+    	return success();
+    }
 }

+ 188 - 49
src/main/java/com/steerinfo/ems/trmworkprocproductvalue/mapper/TRmWorkprocProductValueMapper.xml

@@ -13,8 +13,14 @@
     <result column="CORRECTVALUE" jdbcType="DECIMAL" property="correctvalue" />
     <result column="APPORTVALUE" jdbcType="DECIMAL" property="apportvalue" />
     <result column="BZ" jdbcType="VARCHAR" property="bz" />
-    <result column="USERID" jdbcType="VARCHAR" property="userid"/>
-    <result column="UPDATETIME" jdbcType="VARCHAR" property="updatetime"/>
+    <result column="USERID" jdbcType="VARCHAR" property="userid" />
+    <result column="UPDATETIME" jdbcType="OTHER" property="updatetime" />
+    <result column="UPMAN" jdbcType="VARCHAR" property="upman" />
+    <result column="UPTIME" jdbcType="TIMESTAMP" property="uptime" />
+    <result column="BZ2" jdbcType="VARCHAR" property="bz2" />
+    <result column="QRMAN" jdbcType="VARCHAR" property="qrman" />
+    <result column="QRTIME" jdbcType="VARCHAR" property="qrtime" />
+    <result column="RTPVALUE" jdbcType="DECIMAL" property="rtpvalue" />
   </resultMap>
   <delete id="deleteByPrimaryKey" parameterType="map">
     delete from T_RM_WORKPROC_PRODUCT_VALUE
@@ -25,47 +31,77 @@
   </delete>
   <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
     delete from T_RM_WORKPROC_PRODUCT_VALUE
-    where 1!=1 
-      <if test="itemtype != null and itemtype != ''">
-        and ITEMTYPE = #{itemtype}
-      </if>
-      <if test="clock != null and clock != ''">
-        and CLOCK = #{clock}
-      </if>
-      <if test="timegranid != null and timegranid != ''">
-        and TIMEGRANID = #{timegranid}
-      </if>
-      <if test="sumvalue != null">
-        and SUMVALUE = #{sumvalue}
-      </if>
-      <if test="islock != null and islock != ''">
-        and ISLOCK = #{islock}
-      </if>
-      <if test="lockid != null and lockid != ''">
-        and LOCKID = #{lockid}
-      </if>
-      <if test="actualvalue != null">
-        and ACTUALVALUE = #{actualvalue}
-      </if>
-      <if test="correctvalue != null">
-        and CORRECTVALUE = #{correctvalue}
-      </if>
-      <if test="apportvalue != null">
-        and APPORTVALUE = #{apportvalue}
-      </if>
-      <if test="bz != null and bz != ''">
-        and BZ = #{bz}
-      </if>
+    where 1!=1
+    <if test="itemtype != null and itemtype != ''">
+      or ITEMTYPE = #{itemtype}
+    </if>
+    <if test="clock != null and clock != ''">
+      or CLOCK = #{clock}
+    </if>
+    <if test="timegranid != null and timegranid != ''">
+      or TIMEGRANID = #{timegranid}
+    </if>
+    <if test="sumvalue != null">
+      or SUMVALUE = #{sumvalue}
+    </if>
+    <if test="islock != null and islock != ''">
+      or ISLOCK = #{islock}
+    </if>
+    <if test="lockid != null and lockid != ''">
+      or LOCKID = #{lockid}
+    </if>
+    <if test="actualvalue != null">
+      or ACTUALVALUE = #{actualvalue}
+    </if>
+    <if test="correctvalue != null">
+      or CORRECTVALUE = #{correctvalue}
+    </if>
+    <if test="apportvalue != null">
+      or APPORTVALUE = #{apportvalue}
+    </if>
+    <if test="bz != null and bz != ''">
+      or BZ = #{bz}
+    </if>
+    <if test="userid != null and userid != ''">
+      or USERID = #{userid}
+    </if>
+    <if test="updatetime != null">
+      or UPDATETIME = #{updatetime}
+    </if>
+    <if test="upman != null and upman != ''">
+      or UPMAN = #{upman}
+    </if>
+    <if test="uptime != null">
+      or TO_CHAR(UPTIME,'yyyy-MM-dd') = '#{uptime}'
+    </if>
+    <if test="bz2 != null and bz2 != ''">
+      or BZ2 = #{bz2}
+    </if>
+    <if test="qrman != null and qrman != ''">
+      or QRMAN = #{qrman}
+    </if>
+    <if test="qrtime != null and qrtime != ''">
+      or QRTIME = #{qrtime}
+    </if>
+    <if test="rtpvalue != null">
+      or RTPVALUE = #{rtpvalue}
+    </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.ems.trmworkprocproductvalue.model.TRmWorkprocProductValue">
-    insert into T_RM_WORKPROC_PRODUCT_VALUE (ITEMID, ITEMTYPE, CLOCK, 
-      TIMEGRANID, SUMVALUE, ISLOCK, 
-      LOCKID, ACTUALVALUE, CORRECTVALUE, 
-      APPORTVALUE, BZ,USERID,UPDATETIME)
-    values (#{itemid,jdbcType=VARCHAR}, #{itemtype,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR}, 
-      #{timegranid,jdbcType=VARCHAR}, #{sumvalue,jdbcType=DECIMAL}, #{islock,jdbcType=VARCHAR}, 
-      #{lockid,jdbcType=VARCHAR}, #{actualvalue,jdbcType=DECIMAL}, #{correctvalue,jdbcType=DECIMAL}, 
-      #{apportvalue,jdbcType=DECIMAL}, #{bz,jdbcType=VARCHAR},#{userid,jdbcType=VARCHAR},#{updatetime,jdbcType=VARCHAR})
+    insert into T_RM_WORKPROC_PRODUCT_VALUE (ITEMID, ITEMTYPE, CLOCK,
+      TIMEGRANID, SUMVALUE, ISLOCK,
+      LOCKID, ACTUALVALUE, CORRECTVALUE,
+      APPORTVALUE, BZ, USERID,
+      UPDATETIME, UPMAN, UPTIME,
+      BZ2, QRMAN, QRTIME,
+      RTPVALUE)
+    values (#{itemid,jdbcType=VARCHAR}, #{itemtype,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR},
+      #{timegranid,jdbcType=VARCHAR}, #{sumvalue,jdbcType=DECIMAL}, #{islock,jdbcType=VARCHAR},
+      #{lockid,jdbcType=VARCHAR}, #{actualvalue,jdbcType=DECIMAL}, #{correctvalue,jdbcType=DECIMAL},
+      #{apportvalue,jdbcType=DECIMAL}, #{bz,jdbcType=VARCHAR}, #{userid,jdbcType=VARCHAR},
+      #{updatetime,jdbcType=OTHER}, #{upman,jdbcType=VARCHAR}, #{uptime,jdbcType=TIMESTAMP},
+      #{bz2,jdbcType=VARCHAR}, #{qrman,jdbcType=VARCHAR}, #{qrtime,jdbcType=VARCHAR},
+      #{rtpvalue,jdbcType=DECIMAL})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.ems.trmworkprocproductvalue.model.TRmWorkprocProductValue">
     insert into T_RM_WORKPROC_PRODUCT_VALUE
@@ -103,6 +139,30 @@
       <if test="bz != null">
         BZ,
       </if>
+      <if test="userid != null">
+        USERID,
+      </if>
+      <if test="updatetime != null">
+        UPDATETIME,
+      </if>
+      <if test="upman != null">
+        UPMAN,
+      </if>
+      <if test="uptime != null">
+        UPTIME,
+      </if>
+      <if test="bz2 != null">
+        BZ2,
+      </if>
+      <if test="qrman != null">
+        QRMAN,
+      </if>
+      <if test="qrtime != null">
+        QRTIME,
+      </if>
+      <if test="rtpvalue != null">
+        RTPVALUE,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="itemid != null">
@@ -138,6 +198,30 @@
       <if test="bz != null">
         #{bz,jdbcType=VARCHAR},
       </if>
+      <if test="userid != null">
+        #{userid,jdbcType=VARCHAR},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=OTHER},
+      </if>
+      <if test="upman != null">
+        #{upman,jdbcType=VARCHAR},
+      </if>
+      <if test="uptime != null">
+        #{uptime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bz2 != null">
+        #{bz2,jdbcType=VARCHAR},
+      </if>
+      <if test="qrman != null">
+        #{qrman,jdbcType=VARCHAR},
+      </if>
+      <if test="qrtime != null">
+        #{qrtime,jdbcType=VARCHAR},
+      </if>
+      <if test="rtpvalue != null">
+        #{rtpvalue,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.trmworkprocproductvalue.model.TRmWorkprocProductValue">
@@ -148,7 +232,15 @@
       ACTUALVALUE = #{actualvalue,jdbcType=DECIMAL},
       CORRECTVALUE = #{correctvalue,jdbcType=DECIMAL},
       APPORTVALUE = #{apportvalue,jdbcType=DECIMAL},
-      BZ = #{bz,jdbcType=VARCHAR}
+      BZ = #{bz,jdbcType=VARCHAR},
+      USERID = #{userid,jdbcType=VARCHAR},
+      UPDATETIME = #{updatetime,jdbcType=OTHER},
+      UPMAN = #{upman,jdbcType=VARCHAR},
+      UPTIME = #{uptime,jdbcType=TIMESTAMP},
+      BZ2 = #{bz2,jdbcType=VARCHAR},
+      QRMAN = #{qrman,jdbcType=VARCHAR},
+      QRTIME = #{qrtime,jdbcType=VARCHAR},
+      RTPVALUE = #{rtpvalue,jdbcType=DECIMAL}
     where ITEMID = #{itemid,jdbcType=VARCHAR}
       and ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
       and CLOCK = #{clock,jdbcType=VARCHAR}
@@ -178,21 +270,37 @@
       <if test="bz != null">
         BZ = #{bz,jdbcType=VARCHAR},
       </if>
+      <if test="userid != null">
+        USERID = #{userid,jdbcType=VARCHAR},
+      </if>
+      <if test="updatetime != null">
+        UPDATETIME = #{updatetime,jdbcType=OTHER},
+      </if>
       <if test="upman != null">
         UPMAN = #{upman,jdbcType=VARCHAR},
       </if>
       <if test="uptime != null">
         UPTIME = #{uptime,jdbcType=TIMESTAMP},
       </if>
+      <if test="bz2 != null">
+        BZ2 = #{bz2,jdbcType=VARCHAR},
+      </if>
+      <if test="qrman != null">
+        QRMAN = #{qrman,jdbcType=VARCHAR},
+      </if>
+      <if test="qrtime != null">
+        QRTIME = #{qrtime,jdbcType=VARCHAR},
+      </if>
+      <if test="rtpvalue != null">
+        RTPVALUE = #{rtpvalue,jdbcType=DECIMAL},
+      </if>
     </set>
     where ITEMID = #{itemid,jdbcType=VARCHAR}
-      and ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
-      and CLOCK = #{clock,jdbcType=VARCHAR}
-      and TIMEGRANID = #{timegranid,jdbcType=VARCHAR}
+    and CLOCK = #{clock,jdbcType=VARCHAR}
+    and TIMEGRANID = #{timegranid,jdbcType=VARCHAR}
   </update>
   <select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
-    select ITEMID, ITEMTYPE, CLOCK, TIMEGRANID, SUMVALUE, ISLOCK, LOCKID, ACTUALVALUE, 
-    CORRECTVALUE, APPORTVALUE, BZ
+    select ITEMID,ITEMTYPE,CLOCK,TIMEGRANID, SUMVALUE,ISLOCK,LOCKID,ACTUALVALUE,CORRECTVALUE,APPORTVALUE,BZ,BZ2,QRMAN,QRTIME,RTPVALUE
     from T_RM_WORKPROC_PRODUCT_VALUE
     where ITEMID = #{itemid,jdbcType=VARCHAR}
       and ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
@@ -210,9 +318,9 @@
   </select>
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     select ITEMID, ITEMTYPE, CLOCK, TIMEGRANID, SUMVALUE, ISLOCK, LOCKID, ACTUALVALUE, 
-    CORRECTVALUE, APPORTVALUE, BZ
+    CORRECTVALUE, APPORTVALUE, BZ,BZ2,QRMAN, QRTIME, RTPVALUE
     from T_RM_WORKPROC_PRODUCT_VALUE
-    <where> 
+    <where>
       <if test="itemtype != null and itemtype != ''">
         and ITEMTYPE = #{itemtype}
       </if>
@@ -246,6 +354,18 @@
       <if test="itemid != null and itemid != ''">
         and ITEMID = #{itemid}
       </if>
+      <if test="bz2 != null and bz2 != ''">
+        and BZ2 = #{bz2}
+      </if>
+      <if test="qrman != null and qrman != ''">
+        and QRMAN = #{qrman}
+      </if>
+      <if test="qrtime != null and qrtime != ''">
+        and QRTIME = #{qrtime}
+      </if>
+      <if test="rtpvalue != null and rtpvalue != ''">
+        and RTPVALUE = #{rtpvalue}
+      </if>
     </where>
   </select>
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
@@ -348,6 +468,22 @@
        <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
           when #{item.itemid,jdbcType=VARCHAR} then #{item.bz,jdbcType=VARCHAR}
        </foreach>
+    ,BZ2=
+    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
+      when #{item.itemid,jdbcType=VARCHAR} then #{item.bz2,jdbcType=VARCHAR}
+    </foreach>
+    ,QRMAN=
+    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
+      when #{item.itemid,jdbcType=VARCHAR} then #{item.qrman,jdbcType=VARCHAR}
+    </foreach>
+    ,QRTIME=
+    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
+      when #{item.itemid,jdbcType=VARCHAR} then #{item.qrtime,jdbcType=VARCHAR}
+    </foreach>
+    ,RTPVALUE=
+    <foreach collection="list" item="item" index="index" separator=" " open="case ITEMID" close="end">
+      when #{item.itemid,jdbcType=VARCHAR} then #{item.rtpvalue,jdbcType=DECIMAL}
+    </foreach>
      where ITEMID in 
      <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
     #{item.itemid,jdbcType=VARCHAR}
@@ -487,6 +623,9 @@ FROM
            <if test="itemtype !=null and itemtype!='' ">
                AND wp.itemtype = #{itemtype}
            </if>
+           <if test="itemid != null and itemid != ''">
+	          and t.itemid = #{itemid}
+	       </if>
 	   </where>
 	   order by t.TIMEGRANID desc, t.CLOCK desc
     </select>

+ 87 - 32
src/main/java/com/steerinfo/ems/trmworkprocproductvalue/model/TRmWorkprocProductValue.java

@@ -10,86 +10,110 @@ public class TRmWorkprocProductValue implements IBasePO<HashMap<String, Object>>
     /**
      * 关联ID(ITEMID,VARCHAR,40)
      */
-    @ApiModelProperty(value="关联ID",required=false)
+    @ApiModelProperty(value = "关联ID", required = false)
     private String itemid;
 
     /**
      * 数据类别(ITEMTYPE,VARCHAR,40)
      */
-    @ApiModelProperty(value="数据类别",required=false)
+    @ApiModelProperty(value = "数据类别", required = false)
     private String itemtype;
 
     /**
      * 时间(CLOCK,VARCHAR,40)
      */
-    @ApiModelProperty(value="时间",required=false)
+    @ApiModelProperty(value = "时间", required = false)
     private String clock;
 
     /**
      * 粒度代码(TIMEGRANID,VARCHAR,40)
      */
-    @ApiModelProperty(value="粒度代码",required=false)
+    @ApiModelProperty(value = "粒度代码", required = false)
     private String timegranid;
 
     /**
      * 累计值(SUMVALUE,DECIMAL,30)
      */
-    @ApiModelProperty(value="累计值",required=true)
+    @ApiModelProperty(value = "累计值", required = true)
     private BigDecimal sumvalue;
 
     /**
      * 是否锁定(ISLOCK,VARCHAR,1)
      */
-    @ApiModelProperty(value="是否锁定",required=true)
+    @ApiModelProperty(value = "是否锁定", required = true)
     private String islock;
 
     /**
      * 锁定报表ID(LOCKID,VARCHAR,64)
      */
-    @ApiModelProperty(value="锁定报表ID",required=true)
+    @ApiModelProperty(value = "锁定报表ID", required = true)
     private String lockid;
 
     /**
      * 计算值(ACTUALVALUE,DECIMAL,30)
      */
-    @ApiModelProperty(value="计算值",required=true)
+    @ApiModelProperty(value = "计算值", required = true)
     private BigDecimal actualvalue;
 
     /**
      * 修正值(CORRECTVALUE,DECIMAL,30)
      */
-    @ApiModelProperty(value="修正值",required=true)
+    @ApiModelProperty(value = "修正值", required = true)
     private BigDecimal correctvalue;
 
     /**
      * 最终值(APPORTVALUE,DECIMAL,30)
      */
-    @ApiModelProperty(value="最终值",required=true)
+    @ApiModelProperty(value = "最终值", required = true)
     private BigDecimal apportvalue;
 
-    @ApiModelProperty(value = "用户id",required =true )
+    @ApiModelProperty(value = "用户id", required = true)
     private String userid;
 
-    @ApiModelProperty(value = "创建时间",required = true)
+    @ApiModelProperty(value = "创建时间", required = true)
     private String updatetime;
     /**
      * 备注(BZ,VARCHAR,400)
      */
-    @ApiModelProperty(value="备注",required=true)
+    @ApiModelProperty(value = "备注", required = true)
     private String bz;
 
     /**
      * 修改人(UPMAN,VARCHAR,10)
      */
-    @ApiModelProperty(value="修改人",required=true)
+    @ApiModelProperty(value = "修改人", required = true)
     private String upman;
 
     /**
      * 修改时间(UPTIME,TIMESTAMP,7)
      */
-    @ApiModelProperty(value="修改时间",required=true)
+    @ApiModelProperty(value = "修改时间", required = true)
     private Date uptime;
 
+    /**
+     * 备注(BZ2,VARCHAR,400)
+     */
+    @ApiModelProperty(value = "备注2", required = true)
+    private String bz2;
+
+    /**
+     * 确认人(QRMAN,VARCHAR,40)
+     */
+    @ApiModelProperty(value = "确认人", required = true)
+    private String qrman;
+
+    /**
+     * 确认时间(QRTIME,VARCHAR,40)
+     */
+    @ApiModelProperty(value = "确认时间", required = true)
+    private String qrtime;
+
+    /**
+     * 上报产量(RTPVALUE,DECIMAL,30)
+     */
+    @ApiModelProperty(value = "上报产量", required = true)
+    private BigDecimal rtpvalue;
+
     private static final long serialVersionUID = 1L;
 
     public String getItemid() {
@@ -193,7 +217,7 @@ public class TRmWorkprocProductValue implements IBasePO<HashMap<String, Object>>
     }
 
     public void setUpdatetime(String updatetime) {
-        this.updatetime = updatetime == null ?  null : updatetime.trim();
+        this.updatetime = updatetime == null ? null : updatetime.trim();
     }
 
     public String getUpman() {
@@ -212,6 +236,37 @@ public class TRmWorkprocProductValue implements IBasePO<HashMap<String, Object>>
         this.uptime = uptime;
     }
 
+    public String getBz2() {
+        return bz2;
+    }
+
+    public void setBz2(String bz2) {
+        this.bz2 = bz2;
+    }
+
+    public String getQrman() {
+        return qrman;
+    }
+
+    public void setQrman(String qrman) {
+        this.qrman = qrman;
+    }
+
+    public String getQrtime() {
+        return qrtime;
+    }
+
+    public void setQrtime(String qrtime) {
+        this.qrtime = qrtime;
+    }
+
+    public BigDecimal getRtpvalue() {
+        return rtpvalue;
+    }
+
+    public void setRtpvalue(BigDecimal rtpvalue) {
+        this.rtpvalue = rtpvalue;
+    }
 
     @Override
     public String toString() {
@@ -240,21 +295,21 @@ public class TRmWorkprocProductValue implements IBasePO<HashMap<String, Object>>
     }
 
     @Override
-	public HashMap<String, Object> getId() {
-		HashMap<String, Object> m = new HashMap<String, Object>();
-		m.put("clock", clock);
-		m.put("timegranid", timegranid);
-		m.put("itemid", itemid);
-		m.put("itemtype", itemtype);
-		return m;
-	}
-
-	@Override
-	public void setId(HashMap<String, Object> id) {
-		this.clock = id.get("clock") == null ? "" : id.get("clock").toString().trim();
-		this.timegranid = id.get("timegranid") == null ? "" : id.get("timegranid").toString().trim();
-		this.itemid = id.get("itemid") == null ? "" : id.get("itemid").toString().trim();
-		this.itemtype = id.get("itemtype") == null ? "" : id.get("itemtype").toString().trim();
-	}
+    public HashMap<String, Object> getId() {
+        HashMap<String, Object> m = new HashMap<String, Object>();
+        m.put("clock", clock);
+        m.put("timegranid", timegranid);
+        m.put("itemid", itemid);
+        m.put("itemtype", itemtype);
+        return m;
+    }
+
+    @Override
+    public void setId(HashMap<String, Object> id) {
+        this.clock = id.get("clock") == null ? "" : id.get("clock").toString().trim();
+        this.timegranid = id.get("timegranid") == null ? "" : id.get("timegranid").toString().trim();
+        this.itemid = id.get("itemid") == null ? "" : id.get("itemid").toString().trim();
+        this.itemtype = id.get("itemtype") == null ? "" : id.get("itemtype").toString().trim();
+    }
 
 }

+ 96 - 96
src/main/java/com/steerinfo/ems/trmworkprocproductvalue/service/impl/TRmWorkprocProductValueServiceImpl.java

@@ -101,7 +101,7 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
 
 	/**
 	 * 获取生产数据
-	 * 将IF_MES_EMS_SWAPFILE中未读取的数据进行处理,将数据保存至T_RM_WORKPROC_PRODUCT_VALUE
+	 * 将IF_MES_EMS_SWAPFILE中未读取的数据进行处理,将数据保存至 T_RM_WORKPROC_PRODUCT_VALUE
 	 */
 	public void synchronousData() {
 		int success = 0;
@@ -166,7 +166,7 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
 			if (relationItem.size() > 1) {
 				failure++;
 				logger.info("[错误][多条的关联项]" + DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss") + " :IF_MES_EMS_SWAPFILE中 FID 为 " + swapfile.getFid() + " 的数据在T_RM_WORKPROC_PRODUCT中找到" + relationItem.size() + "条对应关系;( MES物料编码:" + swapfile.getMaterialcode() + " ,MES物料名称:" + swapfile.getMaterialname() + " ,MES产线编码:" + swapfile.getProdline() + " )" );
-				logger.info("关联项");
+				logger.info("关联项: ");
 				for (int u = 0; u < relationItem.size(); u++) {
 					logger.info(relationItem.get(u).getItemid()+";");
 				}
@@ -205,98 +205,98 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
 					String itemidpr = ""; // 炼钢、轧钢主产品项目ID
 					boolean addPr = false; // 是否添加到主产品(根据产品名称头判断)
 					String wid = "";
-					if (mline.endsWith("BC1")) { // 棒材线
-						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9101");
-						if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
-							wid = "ZY9101";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9101CP18R";
-							if (mname.startsWith("棒材︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GX1")) { // 一高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
-						if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
-							wid = "ZY9102";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9102CP19R";
-							if (mname.startsWith("一高线︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GX2")) { // 二高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
-						if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
-							wid = "ZY9201";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9201CP19R";
-							if (mname.startsWith("二高线︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GX3")) { // 三高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
-						if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
-							wid = "ZY9103";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9103CP19R";
-							if (mname.startsWith("三高线︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GX4")) { // 四高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9203");
-						if(tw!=null && tw.getName().equalsIgnoreCase("四高线")){
-							wid = "ZY9203";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9203CP19R";
-							if (mname.startsWith("四高线︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GX5")) { // 五高线
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY9204");
-						if(tw!=null && tw.getName().equalsIgnoreCase("五高线")){
-							wid = "ZY9204";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY9204CP19R";
-							if (mname.startsWith("五高线︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY7202");
-						if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
-							wid = "ZY7202";
-							itemid = wid + pid + "R";
-							itemidpr = "ZY7202CP14R";
-							if (mname.startsWith("二体系︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("LG1")) { // 一炼钢
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY8100");
-						if(tw!=null && tw.getName().equalsIgnoreCase("一炼钢")){
-							wid = "ZY8100";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY8100CP17R";
-							if (mname.startsWith("一体系︱")){
-								addPr = true;
-							}
-						}
-					} else if(mline.endsWith("LG2")) { // 二炼钢
-						TRmWorkproc tw = tRmWorkprocService.getById("ZY8200");
-						if(tw!=null && tw.getName().equalsIgnoreCase("二炼钢")){
-							wid = "ZY8200";
-							itemid = wid+ pid + "R";
-							itemidpr = "ZY8200CP17R";
-							if (mname.startsWith("二体系︱")){
-								addPr = true;
-							}
-						}
-					}
+//					if (mline.endsWith("BC1")) { // 棒材线
+//						// MES工序与EMS工序没有关联,这里防止修改工序后造成数据错误,增加一次判断,下同
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9101");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("棒材线")){
+//							wid = "ZY9101";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9101CP18R";
+//							if (mname.startsWith("棒材︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GX1")) { // 一高线
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9102");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("一高线")){
+//							wid = "ZY9102";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9102CP19R";
+//							if (mname.startsWith("一高线︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GX2")) { // 二高线
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9201");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("二高线")){
+//							wid = "ZY9201";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9201CP19R";
+//							if (mname.startsWith("二高线︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GX3")) { // 三高线
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9103");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("三高线")){
+//							wid = "ZY9103";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9103CP19R";
+//							if (mname.startsWith("三高线︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GX4")) { // 四高线
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9203");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("四高线")){
+//							wid = "ZY9203";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9203CP19R";
+//							if (mname.startsWith("四高线︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GX5")) { // 五高线
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY9204");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("五高线")){
+//							wid = "ZY9204";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY9204CP19R";
+//							if (mname.startsWith("五高线︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("GL3")) { // 二炼铁2#1280高炉-ZY7202
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY7202");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("二炼铁2#1280高炉")){
+//							wid = "ZY7202";
+//							itemid = wid + pid + "R";
+//							itemidpr = "ZY7202CP14R";
+//							if (mname.startsWith("二体系︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("LG1")) { // 一炼钢
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY8100");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("一炼钢")){
+//							wid = "ZY8100";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY8100CP17R";
+//							if (mname.startsWith("一体系︱")){
+//								addPr = true;
+//							}
+//						}
+//					} else if(mline.endsWith("LG2")) { // 二炼钢
+//						TRmWorkproc tw = tRmWorkprocService.getById("ZY8200");
+//						if(tw!=null && tw.getName().equalsIgnoreCase("二炼钢")){
+//							wid = "ZY8200";
+//							itemid = wid+ pid + "R";
+//							itemidpr = "ZY8200CP17R";
+//							if (mname.startsWith("二体系︱")){
+//								addPr = true;
+//							}
+//						}
+//					}
 					if(!itemid.isEmpty() && !pid.isEmpty()){ // 更新 TRmWorkprocProduct,让其关联IF_MES_EMS_SWAPFILE数据(Mes_prodline、Mes_prodline)
 						twp = tRmWorkprocProductService.getById(itemid);
 						if (twp!=null){
@@ -367,7 +367,7 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
 					insertObj.put("itemtype", "R");
 					insertObj.put("qty", swapfile.getQty());
 					insertObj.put("fid", swapfile.getFid());
-					insertObj.put("userid", "1");
+					insertObj.put("userid", "系统");
 					insertObj.put("updatetime", DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
 					try {
 						int upSize = tRmWorkprocProductValueMapper.updateValue(insertObj);
@@ -679,7 +679,7 @@ public class TRmWorkprocProductValueServiceImpl extends BaseServiceImpl<TRmWorkp
     // @Transactional(rollbackFor = Exception.class)
     public void setDate(Date date) {
     	this.synchronousData();
-    	this.synchronousOrderData();
+    	//this.synchronousOrderData();
     	Calendar calendar = Calendar.getInstance();
     	calendar.setTime(date);
         // 获取项目信息-用于每日计算,包括实绩与计划

+ 36 - 24
src/main/java/com/steerinfo/task/SpringCronTask.java

@@ -1,21 +1,27 @@
 package com.steerinfo.task;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledFuture;
-
+import com.steerinfo.ems.Utils.DateUtils;
+import com.steerinfo.ems.emsetiming.service.IEmsETimingService;
+import com.steerinfo.ems.emswaterrealtime.service.IEmsWaterRealtimeService;
 import com.steerinfo.ems.ifemsmesactitem.service.IIfEmsMesActitemService;
+import com.steerinfo.ems.ifmesemsproductorder.service.IIfMesEmsProductorderService;
+import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
 import com.steerinfo.ems.ifmesemswatermonitor.service.IIfMesEmsWatermonitorService;
 import com.steerinfo.ems.mesemsdieseloil.service.IMesEmsDieseloilService;
 import com.steerinfo.ems.tcm0312.controller.TCm0312Controller;
 import com.steerinfo.ems.trmactvalue.service.ITRmActValueService;
 import com.steerinfo.ems.trmbalancevalue.service.ITRmBalanceValueService;
 import com.steerinfo.ems.trmcalpoint.service.ITRmCalpointService;
-
+import com.steerinfo.ems.trmcalpointvalue.service.ITRmCalpointValueService;
+import com.steerinfo.ems.trmdfvalue.service.ITRmDfValueService;
+import com.steerinfo.ems.trmdwvalue.service.ITRmDwValueService;
+import com.steerinfo.ems.trmindexvalue.service.ITRmIndexValueService;
+import com.steerinfo.ems.trmplanvalue.service.ITRmPlanValueService;
+import com.steerinfo.ems.trmtransfereactvalue.service.ITRmTransfereActValueService;
+import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
+import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
+import com.steerinfo.ems.usagedata.service.IUsageDataService;
+import com.steerinfo.ems.zghbjkbzlog.service.IZghbjkbzLogService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,20 +35,13 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
 import org.springframework.scheduling.support.CronTrigger;
 import org.springframework.stereotype.Service;
 
-import com.steerinfo.ems.Utils.DateUtils;
-import com.steerinfo.ems.emsetiming.service.IEmsETimingService;
-import com.steerinfo.ems.ifmesemsproductorder.service.IIfMesEmsProductorderService;
-import com.steerinfo.ems.ifmesemsswapfile.service.IIfMesEmsSwapfileService;
-import com.steerinfo.ems.trmcalpointvalue.service.ITRmCalpointValueService;
-import com.steerinfo.ems.trmdfvalue.service.ITRmDfValueService;
-import com.steerinfo.ems.trmdwvalue.service.ITRmDwValueService;
-import com.steerinfo.ems.trmindexvalue.service.ITRmIndexValueService;
-import com.steerinfo.ems.trmplanvalue.service.ITRmPlanValueService;
-import com.steerinfo.ems.trmtransfereactvalue.service.ITRmTransfereActValueService;
-import com.steerinfo.ems.trmworkprocmaterialvalue.service.ITRmWorkprocMaterialValueService;
-import com.steerinfo.ems.trmworkprocproductvalue.service.ITRmWorkprocProductValueService;
-import com.steerinfo.ems.usagedata.service.IUsageDataService;
-import com.steerinfo.ems.zghbjkbzlog.service.IZghbjkbzLogService;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledFuture;
 
 @EnableScheduling
 @Service(value = "springCronTask")
@@ -96,6 +95,8 @@ public class SpringCronTask implements SchedulingConfigurer{
     ITRmCalpointService tRmCalpointService;
 	@Autowired
     ITRmDfValueService tRmDfValueService;
+	@Autowired
+	IEmsWaterRealtimeService emsWaterRealtimeService;
 
 	/**
 	 * SchedulingConfigurer接口的方法实现,加载后自动运行
@@ -272,7 +273,18 @@ public class SpringCronTask implements SchedulingConfigurer{
                 	long start = new Date().getTime();
                 	tRmDfValueService.state(new Date());
                 	logger.info("定时任务"+taskId+"执行时长:" + (new Date().getTime() - start)/1000 + "秒");
-                }
+                } else if(taskId.equalsIgnoreCase("120")){
+					// 获取大用户水系统数据 5分钟一次
+					long start = new Date().getTime();
+					emsWaterRealtimeService.getWaterListByArmMeter();
+					emsWaterRealtimeService.dataGeneration();
+					logger.info("定时任务"+taskId+"执行时长:" + (new Date().getTime() - start)/1000 + "秒");
+				} else if(taskId.equalsIgnoreCase("121")){
+					// 根据计量点配置生成水数据 10分钟一次
+					long start = new Date().getTime();
+					emsWaterRealtimeService.getWaterTenMinutes();
+					logger.info("定时任务"+taskId+"执行时长:" + (new Date().getTime() - start)/1000 + "秒");
+				}
             }
         };
 	}