package com.lyht.business.analysisCalculation.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.lyht.base.hibernate.common.PageResults;
import com.lyht.business.analysisCalculation.bean.Result;
import com.lyht.business.analysisCalculation.bean.ResultFifth;
import com.lyht.business.analysisCalculation.bean.ResultFourth;
import com.lyht.business.analysisCalculation.bean.ResultJg;
import com.lyht.business.analysisCalculation.bean.ResultSecond;
import com.lyht.business.analysisCalculation.bean.ResultSixthResult;
import com.lyht.business.analysisCalculation.dao.ResultDao;
import com.lyht.business.analysisCalculation.dao.ResultFifthDao;
import com.lyht.business.analysisCalculation.dao.ResultFourthDao;
import com.lyht.business.analysisCalculation.dao.ResultJgDao;
import com.lyht.business.analysisCalculation.dao.ResultSecondDao;
import com.lyht.business.analysisCalculation.dao.ResultSecondQlDao;
import com.lyht.business.analysisCalculation.dao.ResultSixthDao;
import com.lyht.business.analysisCalculation.dao.ResultSixthResultDao;
import com.lyht.business.analysisCalculation.dao.ResultThirdLessDao;
import com.lyht.business.analysisCalculation.dao.ResultThridDao;
import com.lyht.business.analysisCalculation.dao.StPptnDayRDao;
import com.lyht.business.analysisCalculation.formbean.ResultFifthFormBean;
import com.lyht.business.analysisCalculation.formbean.ResultFormBean;
import com.lyht.business.analysisCalculation.formbean.ResultFourthFormBean;
import com.lyht.business.analysisCalculation.formbean.ResultThridFormBean;
import com.lyht.business.consumer.hydrologicalData.bean.River;
import com.lyht.business.consumer.hydrologicalData.bean.Stbprp;
import com.lyht.business.consumer.hydrologicalData.dao.RiverDao;
import com.lyht.business.consumer.hydrologicalData.dao.StbprpDao;
import com.lyht.business.consumer.hydrologicalData.formbean.RiverFormBean;
import com.lyht.business.consumer.hydrologicalData.formbean.TsqxFormBean;
import com.lyht.business.system.bean.SysStaff;
import com.lyht.util.CommonUtil;
import com.lyht.util.DateUtil;
import com.lyht.util.ExcelUtils;
import com.lyht.util.Line;
import com.lyht.util.LineDifference;
import com.lyht.util.Point;
import com.lyht.util.Randomizer;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*作者: 刘魁
*脚本日期:2018年6月4日 15:24:11
*说明: 产流计算结果service
*/
@Service
@Scope("prototype")
@Transactional
public class ResultService {
@Resource ResultDao resuldDao;
@Resource RiverDao riverDao;
@Resource ResultJgDao rjDao;
@Resource ResultThridDao resultThridDao;
@Resource ResultThirdLessDao resultThridLessDao;
@Resource ResultFourthDao resultFourthDao;
@Resource
private ResultSixthDao rxDao;
@Resource
private ResultFifthDao rfDao;
@Resource
private ResultSecondDao rsDao;
@Resource
private ResultSecondQlDao resultSecondQlDao;
@Resource
private ResultSixthResultDao resultSixthResultDao;
@Resource private StbprpDao stbprpDao;
@Resource private StPptnDayRDao stpptndayrDao;
/**
* 删除整场洪水信息
* @param stcd
* @param params
*/
@Transactional
public void deleteAllDataResult(String stcd,String params){
JSONArray dataList = JSONArray.fromObject(params);
String pchs="";
if(dataList!=null && dataList.size()>0){
for(int i=0;i<dataList.size();i++){
JSONObject json = dataList.getJSONObject(i);
if(json.containsKey("PCH")){
if(pchs!=null && pchs.trim().length()>0){
pchs=pchs+",'"+json.getString("PCH")+"'";
}else{
pchs="'"+json.getString("PCH")+"'";
}
}
}
}
if(pchs!=null && pchs.trim().length()>0){
String[] tableList = new String[]{"C_RESULT","C_FIFTH_PA","C_RESULT_FIFTH",
"C_RESULT_FOURTH","C_RESULT_JG","C_RESULT_SECOND", "C_RESULT_SECOND_QL",
"C_RESULT_SIX_PPA","C_RESULT_SIXTH","C_RESULT_SIXTH_RESULT","C_RESULT_THRID",
"C_RESULT_THRID_LESS","H_RESULT","H_RESULT_FOURTH", "H_RESULT_FOURTH_E",
"H_RESULT_FOURTH_Q","H_RESULT_FOURTH_ZHCX","H_RESULT_SECOND",
"H_RESULT_SECOND_ZHCX","H_RESULT_THIRD_ZHCX","H_RESULT_THRID","H_RESULT_ZHCX"};
for(int i=0;i<tableList.length;i++){
resultSixthResultDao.deleteTableData(tableList[i], stcd, pchs);
}
}
}
/**
* 删除产流计算第三步计算结果
* @param stcd
* @param pch
*/
@Transactional
public void deleteStep3Result(String stcd,String pch){
resultThridDao.deleteResultByStcdAndPch(stcd, pch);
resultThridLessDao.deleteByStcdAndPch(stcd, pch);
ResultSecond rs = rsDao.queryResultSecondByStcdAndPch(stcd, pch);
rs.setRs(null);
rs.setSqt3(null);
rsDao.saveOrUpdate(rs);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<Map> queryStep1Jyl(String stcd,String start,String end,String interval){
List<Map> resultList = new ArrayList<Map>();
start=start+":00";
end=end+":00";
String searchStart=CommonUtil.getAfterMinitsDateTime(start, -Integer.valueOf(interval));
searchStart=searchStart.substring(0, 16);//输入的查询开始时间的前一个间隔开始时间作为查询数据的开始时间
List<Map> jylList = this.resuldDao.queryStep1Jyl(stcd, searchStart, end);
end=CommonUtil.getAfterMinitsDateTime(end, Integer.valueOf(interval));//扩大一个时间间隔
String endTime=start;//
String startTime=searchStart+":00";
while(CommonUtil.compareLessDateTime(endTime, end)){
Map map = new HashMap();
double drp=getJylData(startTime,endTime,jylList);
map.put("DT", endTime.subSequence(0, 16));
map.put("DRP", drp);
resultList.add(map);
startTime=endTime;
endTime=CommonUtil.getAfterMinitsDateTime(endTime, Integer.valueOf(interval));
}
return resultList;
}
@SuppressWarnings("rawtypes")
private double getJylData(String start,String end,List<Map> jylList){
double result=0;
if(jylList!=null && jylList.size()>0){
for(int i=0;i<jylList.size();i++){
Map map = jylList.get(i);
if(map!=null && CommonUtil.trim(map.get("BTM")).length()>0
&& CommonUtil.trim(map.get("STM")).length()>0){
String btm = CommonUtil.trim(map.get("BTM"));
String stm = CommonUtil.trim(map.get("STM"));
btm=btm+":00";
stm=stm+":00";
double drp=0;
if(CommonUtil.trim(map.get("DRP")).length()>0){
drp=CommonUtil.getFloatValue(CommonUtil.trim(map.get("DRP")));
}
if(CommonUtil.compareMoreDateTime(start, btm)
&& CommonUtil.compareLessDateTime(end, stm)){
//[3,7]在[0,8]之中的情况结果为[3,7]
long interval=CommonUtil.getDifferenceTime(start, end);
long sjc=CommonUtil.getDifferenceTime(btm, stm);
result = drp*interval/sjc;
double val=new BigDecimal(result).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();//保留2位小数
return val;
}else if(CommonUtil.compareMoreDateTime(start, btm)
&& !CommonUtil.compareLessDateTime(end, stm)
&& !CommonUtil.compareLessDateTime(stm, start)){
//[3,7]在[2,6]结果为[3,6]
long interval=CommonUtil.getDifferenceTime(start, stm);
long sjc=CommonUtil.getDifferenceTime(btm, stm);
result = result+drp*interval/sjc;
}else if(!CommonUtil.compareMoreDateTime(start, btm)
&& CommonUtil.compareMoreDateTime(end, stm)){
//[3,7]在[4,6]结果为[4,6]
result=result+drp;
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
项目水资源分析模拟综合平,长江经济带小水电基础信息管理系统,java_basic.java.io,_myproject.zip (2000个子文件)
test.css 180KB
zui.css 180KB
zui.css 180KB
zui.min.css 167KB
zui.min.css 167KB
bootstrap.css 143KB
bootstrap.css 143KB
zui.lite.css 131KB
zui.lite.css 131KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
zui.lite.min.css 105KB
zui.lite.min.css 105KB
bootstrap.min.css 101KB
layui.css 68KB
layui.css 59KB
easyui.css 47KB
ueditor.css 40KB
ueditor.css 40KB
ueditor.min.css 33KB
ueditor.min.css 33KB
zui-theme-green.css 32KB
zui-theme-green.css 32KB
zui-theme-brown.css 32KB
zui-theme-brown.css 32KB
zui-theme-blue.css 32KB
zui-theme-blue.css 32KB
zui-theme-yellow.css 32KB
zui-theme-yellow.css 32KB
zui-theme-default.css 32KB
zui-theme-default.css 32KB
zui-theme-purple.css 31KB
zui-theme-purple.css 31KB
zui-theme-bluegrey.css 31KB
zui-theme-bluegrey.css 31KB
zui-theme-indigo.css 31KB
zui-theme-indigo.css 31KB
zui-theme.css 31KB
zui-theme.css 31KB
zui-theme-red.css 31KB
zui-theme-red.css 31KB
zui-theme-black.css 29KB
zui-theme-black.css 29KB
font-awesome.min.css 28KB
font-awesome.min.css 28KB
zui-theme.min.css 27KB
zui-theme.min.css 27KB
bootstrap-theme.css 25KB
bootstrap-theme.css 25KB
bootstrap-theme.min.css 24KB
bootstrap-theme.min.css 24KB
bootstrap-table-group-by.css 24KB
bootstrap-table-group-by.css 24KB
kindeditor.css 23KB
kindeditor.css 23KB
bootstrap-editable.css 21KB
bootstrap-editable.css 21KB
kindeditor.min.css 19KB
kindeditor.min.css 19KB
style.css 16KB
bootstrap-responsive.min.css 16KB
zui.uploader.css 16KB
zui.uploader.css 16KB
fullcalendar.min.css 15KB
fullcalendar.min.css 15KB
layer.css 14KB
layer.css 14KB
leaflet.css 13KB
zui.uploader.min.css 13KB
zui.uploader.min.css 13KB
leaflet-src-1.0.3.css 13KB
leaflet-src-1.0.3.css 13KB
chosen.css 12KB
chosen.css 12KB
bootstrap-datetimepicker.min.css 11KB
bootstrap-datetimepicker.min.css 11KB
fullcalendar.css 11KB
fullcalendar.css 11KB
chosen.min.css 10KB
chosen.min.css 10KB
ui-dialog.css 10KB
layui.mobile.css 10KB
layui.mobile.css 10KB
leaflet.css 9KB
leaflet.css 9KB
shujujiansuo.css 9KB
search2.css 9KB
awesome.css 8KB
awesome.css 8KB
awesome.css 8KB
awesome.css 8KB
css.css 8KB
css.css 8KB
laydate.css 7KB
laydate.css 7KB
zui.dashboard.css 7KB
zui.dashboard.css 7KB
bootstrap-table.css 7KB
bootstrap-table.css 7KB
huanbaotongji.css 7KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
好家伙VCC
- 粉丝: 1779
- 资源: 9088
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Shell和Python的大数据0408班级保险项目设计源码
- 基于Vue.js的JavaScript家教网HTML前端设计源码
- 基于C语言的redis0.1版本设计源码解析与解读
- 基于JavaScript的图书管理系统设计源码
- 基于Python语言的Struts2安全漏洞扫描工具设计源码
- 基于ESP8266和Wi-Fi的超声波测距继电器自动控制小电器设计源码
- 基于Kotlin的安卓终端App设计源码
- 基于Html与Java融合的flower-tms花卉售后系统设计源码
- 基于PyQt5和数据库的人脸识别考勤打卡系统设计源码
- 基于Vue和JavaScript的某省汽车票订票助手前端页面设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功