f0e48d8a 张雷

禅道BUG修改

1 个父辈 d36bf3f5
......@@ -75,7 +75,7 @@ public class ReportViewUtil {
sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( ");
sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 ");
if(StringUtils.isNotEmpty(inSqlPart)){
if(StringUtils.isNotEmpty(departIds)){
sb.append(" and depart_id in ("+inSqlPart+") ");
}
if(!StringUtils.isEmpty(startTime)) {
......@@ -139,7 +139,10 @@ public class ReportViewUtil {
itemIds = itemIds.substring(1);
}
sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( ");
sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE depart_id in ("+inSqlPart+")");
sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 ");
if(StringUtils.isNotEmpty(departIds)){
sb.append("and depart_id in ("+inSqlPart+")");
}
if(!StringUtils.isEmpty(dataTime)) {
sb.append("and data_time like'"+dataTime+"%'");
}
......@@ -198,7 +201,7 @@ public class ReportViewUtil {
sb.append("`a`.`depart_id` AS `depart_id` from (( ");
sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 ");
if(!StringUtils.isEmpty(inSqlPart)) {
if(!StringUtils.isEmpty(departIds)) {
sb.append(" and depart_id in ("+inSqlPart+")");
}
if(!StringUtils.isEmpty(startTime)) {
......
......@@ -6,6 +6,7 @@ import java.math.BigDecimal;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
......@@ -317,6 +318,10 @@ public class DateUtils {
return simpleDateFormat.format(date);
}
public static String date2Str(Date date, SimpleDateFormat date_sdf) {
return null == date ? null : date_sdf.format(date);
}
/**
* <pre>
* 日期字符串转秒
......@@ -451,4 +456,66 @@ public class DateUtils {
return new String[]{hbStartTime, hbEndTime};
}
/**
* 同比
* @param month
* @return
*/
public static String getTbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth sameMonthLastYear = yearMonth.minusYears(1);
return sameMonthLastYear.format(formatter); // 同比
}
/**
* 环比
* @param month
* @return
*/
public static String getHbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth previousMonth = yearMonth.minusMonths(1);
return previousMonth.format(formatter); // 环比
}
/**
* 获取同比时间
* @param date
* @return
*/
public static String getTbDate(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
try{
Date dateTime = sdf.parse(date);
calendar.setTime(dateTime);
}catch (Exception e){
calendar.setTime(new Date());
}
calendar.add(Calendar.YEAR, -1);
Date preDate = calendar.getTime();
return sdf.format(preDate);
}
/**
* 获取环比时间
* @param date
* @return
*/
public static String getHbDate(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
try{
Date dateTime = sdf.parse(date);
calendar.setTime(dateTime);
}catch (Exception e){
calendar.setTime(new Date());
}
calendar.add(Calendar.MONTH, -1);
Date preDate = calendar.getTime();
return sdf.format(preDate);
}
}
......
......@@ -78,6 +78,19 @@
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.14.v20181114" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.14.v20181114" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.55" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:itextpdf:5.5.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:html2pdf:4.0.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:forms:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:kernel:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:io:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:commons:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:layout:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:svg:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:styled-xml-parser:7.2.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.itextpdf:font-asian:7.2.3" level="project" />
<orderEntry type="library" name="Maven: com.kingtroldata:core:2.0.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4.1" level="project" />
......@@ -193,7 +206,6 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.12.0" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
......@@ -339,7 +351,6 @@
<orderEntry type="library" name="Maven: com.googlecode.aviator:aviator:4.2.7" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.github.stuxuhai:jpinyin:1.1.8" level="project" />
</component>
</module>
\ No newline at end of file
......
......@@ -88,7 +88,6 @@ public class SysCommandCentreController {
}
}
/* FReportItemv currenteportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
//上月数据
FReportItemv lastMonthReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,reportItemvParam.getLastMonthStartDate() , reportItemvParam.getLastMonthEndDate() );
......@@ -98,10 +97,10 @@ public class SysCommandCentreController {
//整理数据
List<FRportlCommandCenterVO> fReportItemvList = arrangeFRportlCommandCenterVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);*/
//年数据统计:
String total = factoryInfoService.querySumProScale();
total = DigitalUtils.multiply(total,"10000");
total = String.format("%.2f", Double.parseDouble(total));
// total = DigitalUtils.multiply(total,"10000");
fReportItemvList.add( new FRportlCommandCenterVO( total,"0","0"));
//todo 演示暂时注释
......
......@@ -7,6 +7,7 @@ import com.skua.modules.report.entity.FReportItemv;
import com.skua.modules.report.mapper.FReportItemMapper;
import com.skua.modules.report.vo.*;
import com.skua.modules.report.mapper.FReportItemvMapper;
import com.skua.tool.util.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -120,29 +121,27 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
@Override
public DepartDrugResult getYhTotal(String month) {
String monthTb = getTbMonth(month);//同比时间
String monthHb = getHbMonth(month);//环比时间
// String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
// String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
// String departId = "1519193830953553920,1519200041706954752,1816759403152666624,1818214145808531456,1818214519948836864," +
// " 1818214642204409856,1818214704200417280,1818214745841467392,1818214781186867200,1818214830096646144,1818214870622011392," +
// " 1818214905388597248,1818214961122508800,1818215007217909760,1818215052952600576,1818215093192753152,1818215141427249152," +
// " 1818215178001580032,1818215228744269824,1818215268359471104,1818215307165171712,1818215363477897216,1818215411217465344";
// String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month);
// String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthTb);
// String dataViewName2119hb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, monthHb);
//
// String field3a24 = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
// "YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
// String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, month);
// String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, monthTb);
// String dataViewName3a24hb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, monthHb);
DepartDrugResult departDrugResult = new DepartDrugResult();
departDrugResult.setZyh("0");
departDrugResult.setZyhHb("0");
departDrugResult.setZyhTb("0");
String monthTb = DateUtils.getTbMonth(month);//同比时间
String monthHb = DateUtils.getHbMonth(month);//环比时间
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", "", month);
String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", "", monthTb);
String dataViewName2119hb = ReportViewUtil.buildViewLike(view2119,"CSL", "", monthHb);
String field3a24 = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, "", month);
String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, "", monthTb);
String dataViewName3a24hb = ReportViewUtil.buildViewLike(view3a24,field3a24, "", monthHb);
DepartDrugResult departDrugResult = fReportItemvMapper.getYhData(month,monthTb,monthHb,
dataViewName3a24,dataViewName3a24tb,dataViewName3a24hb);
if(departDrugResult == null){
departDrugResult = new DepartDrugResult();
}
List<DepartDrugDataVO> drugList = new ArrayList<>();
drugList = fReportItemvMapper.getYhList(month,monthTb,monthHb);
drugList = fReportItemvMapper.getYhList(month,monthTb,monthHb,
dataViewName2119,dataViewName2119tb,dataViewName2119hb,
dataViewName3a24,dataViewName3a24tb,dataViewName3a24hb);
departDrugResult.setDrugList(drugList);
return departDrugResult;
}
......
......@@ -663,6 +663,8 @@ public class ScreenDataController {
String dataDepartId = sysFactoryInfoVO.getDepartId();
if (ConvertUtils.isNotEmpty(dataDepartId)) {
queryWrapper.in("d.id", dataDepartId.split(","));
} else{
queryWrapper.in("d.id", BaseContextHandler.getDeparts().split(","));
}
queryWrapper.orderByAsc("d.depart_order");
List<SysFactoryInfoVO> factoryInfoVOS = sysFactoryInfoService.getFactoryListByWrapper(queryWrapper);
......
......@@ -30,6 +30,8 @@ public class ScreenDataServiceImpl implements IScreenDataService {
private IFactoryInfoService factoryInfoService;
@Resource
private ScreenMapper screenMapper;
private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
@Override
public Map<String, Object> getDifferData(String startDate, String itemTags, String departId, String type, JdbcTemplate masterDB) {
......@@ -211,8 +213,6 @@ public class ScreenDataServiceImpl implements IScreenDataService {
@Override
public List<Map<String, Object>> getYhdlqs(StatisticsParams statisticsParams) {
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParams.getStartDate();
String endDate = statisticsParams.getEndDate();
......@@ -256,8 +256,6 @@ public class ScreenDataServiceImpl implements IScreenDataService {
@Override
public List<Map<String, Object>> getYhylqs(StatisticsParams statisticsParams) {
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParams.getStartDate();
String endDate = statisticsParams.getEndDate();
......
......@@ -169,12 +169,12 @@ skua:
#消息推送
push:
#是否开启流程消息推送
process-enable: false
process-enable: true
mob:
appSecret: 4e21ddb344233a5a3ec6b3446310efe1
appKey: 35e7ed05966f2
appSecret: fd97aba79649a0322934a9c88bfceff3
appKey: 3a2653ad36727
pushHostName: http://api.push.mob.com/v3/push/createPush
packageName: com.kingtrol.flutter_factoryApp
packageName: com.kingtrol.flutter_zhongye
iosProduction: 0
# 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理)
flow:
......
......@@ -166,10 +166,10 @@ skua:
#是否开启流程消息推送
process-enable: false
mob:
appSecret: 4e21ddb344233a5a3ec6b3446310efe1
appKey: 35e7ed05966f2
appSecret: fd97aba79649a0322934a9c88bfceff3
appKey: 3a2653ad36727
pushHostName: http://api.push.mob.com/v3/push/createPush
packageName: com.kingtrol.flutter_factoryApp
packageName: com.kingtrol.flutter_zhongye
iosProduction: 0
# 自定义逻辑,以','分割(e.g: messagePush:消息推送完后处理)
flow:
......
......@@ -88,6 +88,17 @@ public class FactoryCenterController {
return result;
}
//厂区削减量统计
@ApiOperation(value="厂区削减量统计", notes="厂区削减量统计")
@GetMapping(value = "/getSzXjltj")
public Result<List<Map<String, Object>>> getSzXjltj(StatisticsParam statisticsParam) {
Result<List<Map<String, Object>>> result = new Result<List<Map<String, Object>>>();
List<Map<String, Object>> list = factoryCenterService.getYhtj(statisticsParam);
result.setSuccess(true);
result.setResult(list);
return result;
}
/**
* <pre>
* <获取指定厂站报警阈值
......
......@@ -16,15 +16,25 @@
FROM
${view2119tb} v2119
WHERE
v2119.depart_id = #{departId}
AND v2119.time &gt;= #{startDateTb}
v2119.time &gt;= #{startDateTb}
AND v2119.time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v2119.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
LEFT ( v2119.time, 7 )
) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time
WHERE v.depart_id = #{departId}
AND v.time &gt;= #{startDate}
WHERE v.time &gt;= #{startDate}
AND v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
LEFT ( v.time, 7 )
</select>
......@@ -47,9 +57,14 @@
FROM
${view2119} v2119
WHERE
v2119.depart_id = #{departId}
AND v2119.time &gt;= #{startDate}
v2119.time &gt;= #{startDate}
AND v2119.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v2119.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v2119.time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
left join (
......@@ -67,21 +82,36 @@
FROM
${view2119tb} v2119
WHERE
v2119.depart_id = #{departId}
AND time &gt;= #{startDateTb}
time &gt;= #{startDateTb}
AND time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v2119.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v2119.time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDateTb}
v3.time &gt;= #{startDateTb}
AND v3.time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v3.time, 7 )
) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDate}
v3.time &gt;= #{startDate}
AND v3.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v3.time, 7 )
</select>
......@@ -103,9 +133,14 @@
FROM
${view2119} v2119
WHERE
v2119.depart_id = #{departId}
AND v2119.time &gt;= #{startDate}
v2119.time &gt;= #{startDate}
AND v2119.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v2119.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v2119.time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
left join (
......@@ -123,21 +158,36 @@
FROM
${view2119tb} v2119
WHERE
v2119.depart_id = #{departId}
AND v2119.time &gt;= #{startDateTb}
v2119.time &gt;= #{startDateTb}
AND v2119.time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v2119.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v2119.time, 7 )
) v2 on LEFT(v3.time,7) = v2.time
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDateTb}
v3.time &gt;= #{startDateTb}
AND v3.time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v3.time, 7 )
) pre on right(pre.time,2) = right(LEFT(v3.time,7),2)
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDate}
v3.time &gt;= #{startDate}
AND v3.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY LEFT ( v3.time, 7 )
</select>
......@@ -180,15 +230,25 @@
FROM
${view3a24tb} v3
WHERE
v3.depart_id = #{departId}
AND v3.time &gt;= #{startDateTb}
v3.time &gt;= #{startDateTb}
AND v3.time &lt;= #{endDateTb}
<if test="departId!=null and departId!=''">
AND v3.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
LEFT ( v3.time, 7 )
) v2 on RIGHT( LEFT ( v.time, 7 ), 2 ) = v2.time
WHERE v.depart_id = #{departId}
AND v.time &gt;= #{startDate}
WHERE v.time &gt;= #{startDate}
AND v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
LEFT ( v.time, 7 )
</select>
......
......@@ -6,7 +6,6 @@ import com.skua.core.context.SpringContextUtils;
import com.skua.core.service.IFactoryInfoService;
import com.skua.core.service.IPgQueryService;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.DateUtils;
import com.skua.core.util.DoubleOperaUtils;
import com.skua.modules.dataAnalysis.mapper.FactoryCenterMapper;
import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
......@@ -14,6 +13,7 @@ import com.skua.modules.dataAnalysis.vo.StatisticsParam;
import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO;
import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService;
import com.skua.tool.util.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
......@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
......@@ -39,6 +40,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Autowired
private ISysMonitorMetricInfoService sysMonitorMetricInfoService;
private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
@Override
public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) {
List<WaterQualityMonitoringDetailVO> list = new ArrayList<>();
......@@ -188,11 +192,9 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public Map<String, Object> getData(String departId,String month) {
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
Map<String, Object> map = new HashMap<>();
String monthTb = getTbMonth(month);
String monthHb = getHbMonth(month);
String monthTb = DateUtils.getTbMonth(month);
String monthHb = DateUtils.getHbMonth(month);
String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ,WNL", departId, month);
String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, month);
Map<String, Object> valueMap = factoryCenterMapper.getData(month, departId, dataViewName3a24, dataViewName2119);
......@@ -285,45 +287,19 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
return map;
}
/**
* 同比
* @param month
* @return
*/
public static String getTbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth sameMonthLastYear = yearMonth.minusYears(1);
return sameMonthLastYear.format(formatter); // 同比
}
/**
* 环比
* @param month
* @return
*/
public static String getHbMonth(String month) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth = YearMonth.parse(month, formatter);
YearMonth previousMonth = yearMonth.minusMonths(1);
return previousMonth.format(formatter); // 环比
}
@Override
public List<Map<String, Object>> getCnltj(StatisticsParam statisticsParam) {
String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = "2023-01-01";
String endDateTb = "2023-09-31";
String view3a24 = ReportViewUtil.buildView(wnReport, "WNL", statisticsParam.getDepartId(), startDate,endDate);
String view3a24tb = ReportViewUtil.buildView(wnReport, "WNL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String dataView3a24 = ReportViewUtil.buildView(view3a24, "WNL", statisticsParam.getDepartId(), startDate,endDate);
String dataView3a24tb = ReportViewUtil.buildView(view3a24, "WNL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getCnltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),
view3a24,view3a24tb,view2119,view2119tb);
dataView3a24,dataView3a24tb,dataView2119,dataView2119tb);
if(list.size() == 0){
List<String> monthList = getMonthsBetween(startDate,endDate);
for ( String month : monthList ) {
......@@ -341,19 +317,17 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public List<Map<String, Object>> getHdltj(StatisticsParam statisticsParam) {
String wnReport = "3a243d5715b9e1a3753c180872ca0df9";
String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = "2023-01-01";
String endDateTb = "2023-09-31";
String view3a24 = ReportViewUtil.buildView(wnReport, "DLHJ", statisticsParam.getDepartId(), startDate,endDate);
String view3a24tb = ReportViewUtil.buildView(wnReport, "DLHJ", statisticsParam.getDepartId(), startDateTb,endDateTb);
String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String dataView3a24 = ReportViewUtil.buildView(view3a24, "DLHJ", statisticsParam.getDepartId(), startDate,endDate);
String dataView3a24tb = ReportViewUtil.buildView(view3a24, "DLHJ", statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getHdltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),
view3a24,view3a24tb,view2119,view2119tb);
dataView3a24,dataView3a24tb,dataView2119,dataView2119tb);
if(list.size() == 0){
List<String> monthList = getMonthsBetween(startDate,endDate);
for ( String month : monthList ) {
......@@ -371,15 +345,14 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public List<Map<String, Object>> getWssltj(StatisticsParam statisticsParam) {
String slReport = "2119ecbf53a1d2d0708258ff67cfd9e1";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = "2023-01-01";
String endDateTb = "2023-12-31";
String view2119 = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String view2119tb = ReportViewUtil.buildView(slReport, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getWssltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),view2119,view2119tb);
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String dataView2119 = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getWssltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),dataView2119,dataView2119tb);
if(list.size() == 0){
List<String> monthList = getMonthsBetween(startDate,endDate);
for ( String month : monthList ) {
......@@ -395,16 +368,15 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public List<Map<String, Object>> getYhtj(StatisticsParam statisticsParam) {
String yjReport = "3a243d5715b9e1a3753c180872ca0df9";
List<Map<String, Object>> list = new ArrayList<>();
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = "2023-01-01";
String endDateTb = "2023-12-31";
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String yjField = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ,YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String view3a24 = ReportViewUtil.buildView(yjReport, yjField, statisticsParam.getDepartId(), startDate,endDate);
String view3a24tb = ReportViewUtil.buildView(yjReport, yjField, statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getYhtj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),view3a24,view3a24tb);
String dataView3a24 = ReportViewUtil.buildView(view3a24, yjField, statisticsParam.getDepartId(), startDate,endDate);
String dataView3a24tb = ReportViewUtil.buildView(view3a24, yjField, statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getYhtj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),dataView3a24,dataView3a24tb);
if(list.size() == 0){
List<String> monthList = getMonthsBetween(startDate,endDate);
for ( String month : monthList ) {
......@@ -453,6 +425,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Override
public Map<String, Object> getHourWaterData(StatisticsParam statisticsParam) {
SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, Object> map = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
Map<String, Object> chartsMap = new HashMap<>();
......@@ -489,7 +462,7 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
if (!CollectionUtils.isEmpty(list1)) {
// Map<String, Object> map1 = list1.get(0);
for (Map<String, Object> map1 : list1) {
String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), DateUtils.datetimeFormat);
String time = DateUtils.date2Str(new Date(Long.parseLong(map1.get("time").toString()) * 1000), datetimeFormat);
xlist.add(time);
String jscod;
if (!org.apache.commons.lang3.StringUtils.isEmpty(jscod = fieldsMap.get("JSCOD"))) {
......@@ -581,4 +554,5 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
}
return months;
}
}
......
......@@ -109,5 +109,12 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
* @param monthHb
* @return
*/
List<DepartDrugDataVO> getYhList(String month, String monthTb, String monthHb);
List<DepartDrugDataVO> getYhList(@Param("month") String month, @Param("monthTb") String monthTb, @Param("monthHb") String monthHb,
@Param("dataViewName2119") String dataViewName2119, @Param("dataViewName2119tb") String dataViewName2119tb,
@Param("dataViewName2119hb") String dataViewName2119hb, @Param("dataViewName3a24") String dataViewName3a24,
@Param("dataViewName3a24tb") String dataViewName3a24tb, @Param("dataViewName3a24hb") String dataViewName3a24hb);
DepartDrugResult getYhData(@Param("month") String month, @Param("monthTb") String monthTb, @Param("monthHb") String monthHb,
@Param("dataViewName3a24") String dataViewName3a24,@Param("dataViewName3a24tb") String dataViewName3a24tb,
@Param("dataViewName3a24hb") String dataViewName3a24hb);
}
......
......@@ -153,8 +153,150 @@
</select>
<select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO">
select d.id AS depart_id,d.depart_name,'0' as yjdh,'0' as yjdh_tb,'0' as yjdh_hb from sys_depart d
where d.depart_type = '1'
SELECT
d.id AS depart_id,
d.depart_name,
IFNULL(dh.yjdh,0) AS yjdh,
IFNULL(dhtb.yjdh,0) AS yjdh_tb,
IFNULL(dhhb.yjdh,0) AS yjdh_hb
FROM
sys_depart d
LEFT JOIN (
SELECT
v3.depart_id,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
FROM
${dataViewName3a24} v3
LEFT JOIN (
SELECT
v.depart_id,
SUM( IFNULL( v.CSL, 0 ) ) AS clsl
FROM
${dataViewName2119} v
WHERE
LEFT ( v.time, 7 ) = #{month}
GROUP BY
v.depart_id
) v2 ON v2.depart_id = v3.depart_id
WHERE
LEFT ( v3.time, 7 ) = #{month}
GROUP BY
v3.depart_id
) dh ON dh.depart_id = d.id
LEFT JOIN (
SELECT
v3.depart_id,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
FROM
${dataViewName3a24tb} v3
LEFT JOIN (
SELECT
v.depart_id,
SUM( IFNULL( v.CSL, 0 ) ) AS clsl
FROM
${dataViewName2119tb} v
WHERE
LEFT ( v.time, 7 ) = #{monthTb}
GROUP BY
v.depart_id
) v2 ON v2.depart_id = v3.depart_id
WHERE
LEFT ( v3.time, 7 ) = #{monthTb}
GROUP BY
v3.depart_id
) dhtb ON dhtb.depart_id = d.id
LEFT JOIN (
SELECT
v3.depart_id,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+SUM( IFNULL( v3.PFS, 0 ) )+
SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+
SUM( IFNULL( v3.CH3COONA, 0 ) )+SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS yjdh
FROM
${dataViewName3a24hb} v3
LEFT JOIN (
SELECT
v.depart_id,
SUM( IFNULL( v.CSL, 0 ) ) AS clsl
FROM
${dataViewName2119hb} v
WHERE
LEFT ( v.time, 7 ) = #{monthHb}
GROUP BY
v.depart_id
) v2 ON v2.depart_id = v3.depart_id
WHERE
LEFT ( v3.time, 7 ) = #{monthHb}
GROUP BY
v3.depart_id
) dhhb ON dhhb.depart_id = d.id
WHERE
d.depart_type = '1'
ORDER BY dh.yjdh desc,d.depart_order
</select>
<select id="getYhData" resultType="com.skua.modules.report.vo.DepartDrugResult">
SELECT
IFNULL(dh.yjdh,0) AS zyh,
IFNULL(dhtb.yjdh,0) AS zyh_tb,
IFNULL(dhhb.yjdh,0) AS zyh_hb
FROM
(
SELECT
'zyh' type,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
FROM
${dataViewName3a24} v3
WHERE
LEFT ( v3.time, 7 ) = #{month}
) dh
LEFT JOIN (
SELECT
'zyh' type,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+
SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+
SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+
SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
FROM
${dataViewName3a24tb} v3
WHERE
LEFT ( v3.time, 7 ) = #{monthTb}
) dhtb ON dhtb.type = dh.type
LEFT JOIN (
SELECT
'zyh' type,
ROUND((SUM( IFNULL( v3.PAMRJ, 0 ) )+SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+
SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+SUM( IFNULL( v3.PFS, 0 ) )+
SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+
SUM( IFNULL( v3.CH3COONA, 0 ) )+SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+
SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+
SUM( IFNULL( v3.H2O2, 0 ) )),0) AS yjdh
FROM
${dataViewName3a24hb} v3
WHERE
LEFT ( v3.time, 7 ) = #{monthHb}
) dhhb ON dhhb.type = dh.type
</select>
</mapper>
......
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig;
import com.skua.modules.system.vo.SysFactoryInfo.*;
import com.skua.modules.system.vo.SysFactoryInfoNewVO;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -88,6 +89,7 @@ public interface SysFactoryInfoMapper extends BaseMapper<SysFactoryInfo> {
List<Map<String, Object>> queryUpLow(@Param("id") String id);
@Anonymous
@Select("SELECT d.id as depart_id, d.depart_name AS name,d.depart_name AS depart_name,d.depart_type," +
"(select depart_name from sys_depart sd where d.parent_id = sd.id ) areaName,f.* " +
"FROM sys_depart d " +
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!