Explorar o código

lrl -2021-12-16

lirl %!s(int64=3) %!d(string=hai) anos
pai
achega
e33ea1e001

+ 3 - 2
src/main/java/com/steerinfo/ems/foldthevalues/service/impl/FoldTheValuesServiceImpl.java

@@ -137,14 +137,15 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
             foldTheValue.setId(month+foldTheValues.getMaterialno());
             foldTheValue.setClock(clock);
             if(foldTheValues.getMaterialsource().equals("三电厂")){
+                foldTheValue.setDescription("热值");
                 foldTheValue.setCode(df.format(jse.eval(foldTheValues.getEstimatedvalue()+"/"+days+"*0.03412/100")).toString());
             }
             if(foldTheValues.getMaterialsource().equals("机焦厂")){
+                foldTheValue.setDescription("灰分");
                 foldTheValue.setCode(df.format(jse.eval("(29727+(10-"+foldTheValues.getEstimatedvalue()+"/"+days+")*334)/29307.6")));
             }
             foldTheValue.setIsavailable("0");
             foldTheValue.setUnitid("032");
-            foldTheValue.setDescription("灰分");
             hashMap.put("materialno",foldTheValues.getMaterialno());
             foldTheValue.setBz("取本月热值检测结果平均值("+foldTheValuesMapper.getavgDate(hashMap)+")进行热值换算");
             foldTheValue.setMaterialno(foldTheValues.getMaterialno());
@@ -183,7 +184,7 @@ public class FoldTheValuesServiceImpl extends BaseServiceImpl<FoldTheValues, Str
             foldTheValue.setTimegranid("DAY");
             foldTheValue.setUnitid("032");
             foldTheValue.setDescription("灰分");
-            foldTheValue.setBz("采用当天热值进行换算,当天无检测结果,则取最近热值进行换算");
+            foldTheValue.setBz("采用当天灰分进行换算,当天无检测结果,则取最近灰分进行换算");
             foldTheValuesMapper.insert(foldTheValue);
         }
         

+ 17 - 17
src/main/java/com/steerinfo/ems/trmactitem/controller/TRmActItemController.java

@@ -283,26 +283,26 @@ public class TRmActItemController extends BaseRESTfulController {
                     logger.info("修改前数据是" + old.toString());
                     String oldMintimegranid = old.getMintimegranid();
                     // 如果修改最小时间粒度,判断公式是否合法(最小时间粒度影响公式计算)
-                    if(!oldMintimegranid.equalsIgnoreCase(model[i].getMintimegranid())){
-                        HashMap<String, Object> parmas = new HashMap<>();
-                        parmas.put("code", model[i].getItemid());
-                        parmas.put("clock", DateUtils.dateStr(new Date(), "yyyyMM"));
-                        // 获取公式
-                        Formula fm = formulaService.getFormulaCodeClock(parmas);
-                        String res = formulaService.checkFormulaMint(fm, model[i].getMintimegranid());
-                        if(!res.isEmpty()){
-                            warnmsg.add(model[i].getId() + ":" + res);
-                        }
-                    }
+//                    if(!oldMintimegranid.equalsIgnoreCase(model[i].getMintimegranid())){
+//                        HashMap<String, Object> parmas = new HashMap<>();
+//                        parmas.put("code", model[i].getItemid());
+//                        parmas.put("clock", DateUtils.dateStr(new Date(), "yyyyMM"));
+//                        // 获取公式
+//                        Formula fm = formulaService.getFormulaCodeClock(parmas);
+//                        String res = formulaService.checkFormulaMint(fm, model[i].getMintimegranid());
+//                        if(!res.isEmpty()){
+//                            warnmsg.add(model[i].getId() + ":" + res);
+//                        }
+//                    }
                     model[i].setDefaulman(userId);
                     model[i].setModificationtime(DateUtils.dateStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
                     TRmActItem trmData = tRmActItemService.modify(model[i]);
-                    if(model[i].getItemdesc()!=null && !model[i].getItemdesc().trim().isEmpty()) {
-                        Map<String, Object> pm = new HashMap<>();
-                        pm.put("code", model[i].getItemid());
-                        pm.put("description", model[i].getItemdesc().trim());
-                        formulaService.updateDesBycode(pm);
-                    }
+//                    if(model[i].getItemdesc()!=null && !model[i].getItemdesc().trim().isEmpty()) {
+//                        Map<String, Object> pm = new HashMap<>();
+//                        pm.put("code", model[i].getItemid());
+//                        pm.put("description", model[i].getItemdesc().trim());
+//                        formulaService.updateDesBycode(pm);
+//                    }
                     logger.info("修改后数据是" + trmData.toString());
                 }
 

+ 18 - 3
src/main/java/com/steerinfo/ems/trmbalancevalue/mapper/TRmBalanceValueMapper.xml

@@ -588,12 +588,13 @@
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
     <!-- 能源平衡管理-平衡表数据维护页面,查询数据 -->
     <select id="getBalanceitemList" parameterType="java.util.HashMap" resultType = "Map">
-        SELECT
-        ta.itemid,
+        SELECT ta.itemid,
         ta.ENERGYID,
         ta.ITEMNAME,
-        tu.id as UNITID ,
+        tu.id as UNITID,
         tv.CLOCK,
+        trv.apportvalue as SJZ,
+        tv.APPORTVALUE - trv.apportvalue as FTZ,
         tv.APPORTVALUE,
         tv.SUMVALUE,
         tv.ACTUALVALUE,
@@ -640,6 +641,20 @@
               and  clock =#{clock}
           </if>
         </where>) tv ON ta.itemid = tv.itemid
+        inner join (SELECT ta.energyid,
+        ta.workprocid,
+        ta.propertyid,
+        tv.apportvalue,
+        tv.clock
+        FROM T_RM_ACT_ITEM ta
+        INNER JOIN T_RM_ACT_VALUE tv
+        ON ta.itemid = tv.itemid
+        WHERE ta.itemtype = 'R'
+        AND tv.timegranid = 'MONTH') trv
+        ON ta.energyid = trv.energyid
+        AND ta.workprocid = trv.workprocid
+        AND ta.propertyid = trv.propertyid
+        AND tv.clock = trv.clock
         inner JOIN T_RM_WORKPROC tw ON ta.WORKPROCID = tw.id
         inner JOIN T_RM_ENERGY tr ON ta.ENERGYID = tr.id
         inner JOIN T_RM_UNIT tu ON ta.UNITID = tu.id

+ 3 - 3
src/main/java/com/steerinfo/ems/trmbalancevalue/service/impl/TRmBalanceValueServiceImpl.java

@@ -85,13 +85,13 @@ public class TRmBalanceValueServiceImpl extends BaseServiceImpl<TRmBalanceValue,
 			}
 		}
 		// 每月前3天生成上月数据
-		if(c.get(Calendar.DAY_OF_MONTH) <= 3){
+//		if(c.get(Calendar.DAY_OF_MONTH) <= 3){
 			for (TRmActItem tRmActItem : bs) {
 				if(TimegranidUtils.getTimegranidList(tRmActItem.getMintimegranid()).contains("MONTH")){
-					this.restatData(tRmActItem.getItemid(), clockm, "MONTH");
+					this.restatData(tRmActItem.getItemid(), "2021-11", "MONTH");
 				}
 			}
-		}
+//		}
 		// 每年前3天生成去年数据
 		if(c.get(Calendar.DAY_OF_YEAR) <= 3){
 			for (TRmActItem tRmActItem : bs) {

+ 6 - 0
src/main/java/com/steerinfo/ems/trmcalpointvalue/controller/TRmCalpointValueController.java

@@ -497,4 +497,10 @@ public class TRmCalpointValueController extends BaseRESTfulController {
 
 		return success();
 	}
+
+	@GetMapping(value = "/aaa")
+	public RESTfulResult aaa(){
+		tRmCalpointValueService.insetDataForBb();
+		return success();
+	}
 }

+ 3 - 0
src/main/java/com/steerinfo/ems/trmcalpointvalue/mapper/TRmCalpointValueMapper.java

@@ -4,6 +4,7 @@ import com.steerinfo.ems.trmcalpointvalue.model.TRmCalpointValue;
 import com.steerinfo.framework.mapper.IBaseMapper;
 
 import java.util.HashMap;
+import java.util.List;
 
 import org.apache.ibatis.annotations.Mapper;
 
@@ -19,4 +20,6 @@ public interface TRmCalpointValueMapper extends IBaseMapper<TRmCalpointValue, Ha
      * @return
      */
 	Double getSumvalue(HashMap<String, Object> params);
+	//报表获取氧气数据
+	List<TRmCalpointValue>getDataForBb();
 }

+ 49 - 0
src/main/java/com/steerinfo/ems/trmcalpointvalue/mapper/TRmCalpointValueMapper.xml

@@ -678,4 +678,53 @@
           </if>
       </where>
     </select>
+  <select id="getDataForBb" resultMap="BaseResultMap">
+    select t.*, t2.itemname
+  from (select to_char(dates,'yyyy-mm-dd') as clock, itemid, APPORTVALUE, MINTVALUE, MENDVALUE
+          from EMS_ZY_DAY unpivot((APPORTVALUE, MINTVALUE, MENDVALUE)
+          for itemid in((O2_1_CL_NUM,
+                         O2_1_CL_QC,
+                         O2_1_CL_QM) as
+                         'DL502P00120001',
+                         (O2_2_GCYL_NUM,
+                          O2_2_GCYL_QC,
+                          O2_2_GCYL_QM) as
+                          'DL502P00170001',
+                          (N2_2_CL_NUM,
+                           N2_2_CL_QC,
+                           N2_2_CL_QM) as
+                          'DL486P00220001',
+                           (N2_2_GCYL_NUM,
+                           N2_2_GCYL_QC,
+                           N2_2_GCYL_QM) as
+                          'DL486P00270001',
+                           (N2_2_TCYL_NUM,
+                            N2_2_TCYL_QC,
+                            N2_2_TCYL_QM) as
+                            'DL486P00270002',
+                            (N2_2_JJYL_NUM,
+                             N2_2_JJYL_QC,
+                             N2_2_JJYL_QM) as
+                             'DL486P00210001',
+                             (N2_2_4_GLYL_NUM,
+                             N2_2_4_GLYL_QC,
+                             N2_2_4_GLYL_QM) as
+                             'DL486P00270003',
+                             (AR_2_CL_NUM,
+                              AR_2_CL_QC,
+                              AR_2_CL_QM) as
+                              'DL486P00420001',
+                              (AR_2_GCYL_NUM,
+                              AR_2_GCYL_QC,
+                              AR_2_GCYL_QM) as
+                              'DL510P00410001',
+                              (AR_2_YDQH_NUM,
+                               AR_2_YDQH_QC,
+                              AR_2_YDQH_QM) as
+                              'DL486P00270004'))) t
+      left join t_rm_calpoint t2
+        on t.itemid = t2.itemid
+        where t.clock between to_char(sysdate-7,'yyyy-mm-dd') and to_char(sysdate,'yyyy-mm-dd')
+        order by t.clock
+  </select>
 </mapper>

+ 4 - 0
src/main/java/com/steerinfo/ems/trmcalpointvalue/service/ITRmCalpointValueService.java

@@ -101,4 +101,8 @@ public interface ITRmCalpointValueService extends IBaseService<TRmCalpointValue,
      * @param clock2 结束时间
      */
     void resWData(String clock,String clock2);
+    //报表获取氧气数据
+    List<TRmCalpointValue>getDataForBb();
+    //
+    public void  insetDataForBb();
 }

+ 27 - 0
src/main/java/com/steerinfo/ems/trmcalpointvalue/service/impl/TRmCalpointValueServiceImpl.java

@@ -1,6 +1,7 @@
 package com.steerinfo.ems.trmcalpointvalue.service.impl;
 
 import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.ems.Utils.DateUtils;
 import com.steerinfo.ems.cordasconfiguration.mapper.CordasConfigurationMapper;
 import com.steerinfo.ems.cordasconfiguration.model.CordasConfiguration;
 import com.steerinfo.ems.emscalpointvalue.mapper.EmsCalpointValueMapper;
@@ -1098,4 +1099,30 @@ public class TRmCalpointValueServiceImpl extends BaseServiceImpl<TRmCalpointValu
 		emsWaterRealtimeService.getWaterHour(clock,clock2);
 		emsWaterRealtimeService.getHistoryWaterToHour();
 	}
+
+	@Override
+	public List<TRmCalpointValue> getDataForBb() {
+		return tRmCalpointValueMapper.getDataForBb();
+	}
+	public void  insetDataForBb(){
+		List<TRmCalpointValue> dataForBb = this.getDataForBb();
+		HashMap<String,Object> hashMap =  new HashMap();
+		dataForBb.forEach( item -> {
+			item.setTimegranid("DAY");
+			item.setCrman("系统");
+			item.setCorrectvalue(new BigDecimal("0"));
+			item.setActualvalue(item.getApportvalue());
+			item.setRecTime(DateUtils.dateStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
+			hashMap.put("itemid",item.getItemid());
+			hashMap.put("clock",item.getClock());
+			hashMap.put("timegranid",item.getTimegranid());
+			TRmCalpointValue tRmCalpointValue = tRmCalpointValueMapper.selectByPrimaryKey(hashMap);
+			if (tRmCalpointValue != null ){
+				tRmCalpointValueMapper.updateByPrimaryKeySelective(item);
+			}
+			else {
+				tRmCalpointValueMapper.insert(item);
+			}
+		});
+	}
 }

+ 11 - 1
src/main/java/com/steerinfo/task/SpringCronTask.java

@@ -354,7 +354,17 @@ public class SpringCronTask implements SchedulingConfigurer{
 						 e.printStackTrace();
 					 }
 					 logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
-				 }//				 else if (taskId.equalsIgnoreCase("106")) {
+				 }
+				  else if(taskId.equalsIgnoreCase("128")){
+					 long start = System.currentTimeMillis();
+					 try {
+						 tRmCalpointValueService.getDataForBb();
+					 } catch (Exception e) {
+						 e.printStackTrace();
+					 }
+					 logger.info("定时任务"+taskId+"执行时长:" + (System.currentTimeMillis() - start)/1000 + "秒");
+				 }
+// 				 else if (taskId.equalsIgnoreCase("106")) {
 //					// 获取MES水质监测数据
 //					long start = System.currentTimeMillis();
 //					ifMesEmsWatermonitorService.synchronousMesAnEmsData();