eddb0df0 康伟

Merge remote-tracking branch 'origin/master'

2 个父辈 3cc2d625 5a450e0f
......@@ -12,6 +12,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.*;
/**
......@@ -98,7 +100,11 @@ public class PwxkybReportHandle implements ICustomHandle{
for(String key : keySet) {
if(!StringUtils.isEmpty(dataFieldDict.get(key))) {
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
if("time".equals(key)){
valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
}else{
valueEntity.setValue(handleDoubleValue(ConvertUtils.getString(valueMap.get(key))));
}
handleMap.put(dataFieldDict.get(key),valueEntity);
}
}
......@@ -107,6 +113,17 @@ public class PwxkybReportHandle implements ICustomHandle{
return list;
}
public static String handleDoubleValue(String doubleValue) {
if(doubleValue.contains("E")) {
MathContext mc = new MathContext(32);
BigDecimal bigNumber = new BigDecimal(doubleValue, mc);
BigDecimal setScale = bigNumber.setScale(4,BigDecimal.ROUND_HALF_UP);
return setScale.toString();
}else {
return ConvertUtils.getString(ConvertUtils.getDouble(doubleValue,0.0,4));
}
}
@Override
public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
return json;
......
......@@ -93,7 +93,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
String field4411 = "yslwcbl,ysjsldyqntqyy,qntqsfsl,ysfsl,sfsldbbhl,sldyyqyy,dhgyqntqyy,yyf,yhgyqntqyy,dhcmbzyy,yhcyqyy,df,sbwhf";
String dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,field4411, departId, dataTime);
String dataViewName4411tb = ReportViewUtil.buildViewLike(ReportConstant.view4411,"qntqsfsl", departId, tbYear);
String dataViewName4411tb = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl", departId, tbYear);
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
String sql = "select " +
......@@ -102,7 +102,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
" round(ifnull(tb.clsl_tb,0),4) tqysjsl, " +
" round(100*(sum(v1.CSL)/10000-ifnull(tb.clsl_tb,0))/ifnull(tb.clsl_tb,sum(v1.CSL)/10000),2) as sjsldbbhl, " +
" v6.ysjsldyqntqyy, " +
" ifnull(v7.qntqsfsl,0) as qntqsfsl, " +
" ifnull(v7.ysfsl,0) as qntqsfsl, " +
" v6.ysfsl,v6.sfsldbbhl, " +
" rtc.target_water as ndslmb, " +
" round(100*(sum(v1.CSL)/10000)/rtc.target_water,2) yslwcbl, " +
......@@ -120,7 +120,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
" round(y.dlhj_year/sum(v1.CSL),2) as bnsjdh, " +
" v6.dhcmbzyy,v6.df,v6.sbwhf, " +
" rtc.target_drug as bnyhmb, " +
" round(y.yjhl_year/sum(v1.CSL),2) as bnsjyh, " +
// " round(y.yjhl_year/sum(v1.CSL),2) as bnsjyh, " +
" round(v4.yjhl/sum(v1.CSL),2) as bnsjyh, " +
" v6.yhcyqyy " +
" from "+dataViewName2119+" v1 " +
" left join ( " +
......@@ -166,7 +167,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
" where v3a24.depart_id = '"+departId+"' and v3a24.time like CONCAT('"+dataTime+"','%') GROUP BY LEFT(v3a24.time,7)" +
" ) y on y.time = LEFT ( v1.time, 7 ) " +
" left join ( " +
" select right(left(v4411.time,7),2) time,v4411.qntqsfsl " +
" select right(left(v4411.time,7),2) time,v4411.ysfsl " +
" from "+dataViewName4411tb+" v4411 " +
" where v4411.depart_id = '"+departId+"' and v4411.time like CONCAT('"+tbYear+"','%')) v7 on right(left(v7.time,7),2) = right(left(v1.time,7),2) " +
" where v1.time like CONCAT('"+dataTime+"','%') and v1.depart_id = '"+departId+"' GROUP BY v1.depart_id,left(v1.time,7)";
......
......@@ -87,42 +87,46 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
if(!StringUtils.isEmpty(fields)) {
fields = fields.substring(1);
}
//获取实时数据
List<Map<String, Object>> pgDataList = pgQueryService.queryFactoryMonitorFromRealTimeData(departId, fields);
Map<String, Object> dataMap = new HashMap<String,Object>();
if(pgDataList!=null&&pgDataList.size()>0) {
dataMap = pgDataList.get(0);
}
String[] departArray = departId.split(",");
//根据厂区分别查询实时数据
int sort = 0;//序号
for(String depart : departArray) {
Map<String,Object> limitMap = new HashMap<>();
if(levelMap.get(depart)!=null){
List<Map<String,String>> limitList = (List<Map<String,String>>)levelMap.get(depart);
for (Map<String,String> lMap : limitList) {
limitMap.put(lMap.get("code"),lMap);
String[] departIdArr = departId.split(",");
for (String depart : departIdArr) {
List<WaterQualityMonitoringDetailVO> realTimelist = new ArrayList<>();
//获取实时数据
List<Map<String, Object>> pgDataList = pgQueryService.queryFactoryMonitorFromRealTimeData(depart, fields);
Map<String, Object> dataMap = new HashMap<String,Object>();
if(pgDataList!=null&&pgDataList.size()>0) {
dataMap = pgDataList.get(0);
Map<String,Object> limitMap = new HashMap<>();
if(levelMap.get(depart)!=null){
List<Map<String,String>> limitList = (List<Map<String,String>>)levelMap.get(depart);
for (Map<String,String> lMap : limitList) {
limitMap.put(lMap.get("code"),lMap);
}
}
}
if(parmType != null){
if("in".equals(parmType)){
sort++;
list = putInWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
}else if("out".equals(parmType)){
sort++;
list = putOutWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
if(parmType != null){
if("in".equals(parmType)){
sort++;
realTimelist = putInWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
}else if("out".equals(parmType)){
sort++;
realTimelist = putOutWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
}else{
sort++;
realTimelist = putInWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
sort++;
realTimelist = putOutWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
}
}else{
sort++;
list = putInWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
realTimelist = putInWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
sort++;
list = putOutWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
realTimelist = putOutWaterDataInList(sort,realTimelist,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
}
}else{
sort++;
list = putInWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
sort++;
list = putOutWaterDataInList(sort,list,dataMap,monitorTagMap,depart,departMap,departParentMap,limitMap);
list.addAll(realTimelist);
}
}
return list;
}
......
......@@ -483,12 +483,12 @@ public class SysFactoryInfoController {
public Result queryByDepartId(@RequestParam(name = "departId", required = true) String departId) {
Result result = new Result();
SysFactoryInfoVO sysFactoryInfo = sysFactoryInfoService.getByDepartId(departId);
JSONObject jsonObject = sysDictService.translateTDictValue(sysFactoryInfo);
JSONObject jsonObject = new JSONObject();
if (sysFactoryInfo == null) {
departId = getDepart(BaseContextHandler.getRealDepartId());
sysFactoryInfo = sysFactoryInfoService.getByDepartId(departId);
jsonObject = sysDictService.translateTDictValue(sysFactoryInfo);
}
jsonObject = sysDictService.translateTDictValue(sysFactoryInfo);
result.setResult(jsonObject);
result.setSuccess(true);
return result;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!