Commit 948cdc1e authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer' into developer

parents da8857fb f0fb7968
......@@ -17,7 +17,7 @@ public class DateUtils {
public static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String MINUTE_PATTERN = "yyyy-MM-dd HH:mm";
public static final String HOUR_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String HOUR_PATTERN = "yyyy-MM-dd HH";
public static final String DATE_PATTERN = "yyyy-MM-dd";
public static final String MONTH_PATTERN = "yyyy-MM";
public static final String YEAR_PATTERN = "yyyy";
......@@ -136,7 +136,6 @@ public class DateUtils {
return cal.getTime();
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
......@@ -154,7 +153,8 @@ public class DateUtils {
* 时间格式化成字符串
*
* @param date Date
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN, 如果为空,则为yyyy-MM-dd
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN,
* 如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
......@@ -186,7 +186,6 @@ public class DateUtils {
return content;
}
/*
* 将时间戳转换为时间
*/
......@@ -202,7 +201,8 @@ public class DateUtils {
* 字符串解析成时间对象
*
* @param dateTimeString String
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @param pattern StrUtils.DATE_TIME_PATTERN ||
* StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
......@@ -215,6 +215,35 @@ public class DateUtils {
}
/**
* 字符串解析成时间对象
*
* @param dateTimeString String
* @param pattern StrUtils.DATE_TIME_PATTERN ||
* StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
public static Date dateParse(String dateTimeString) {
if (dateTimeString == null) {
return null;
}
try {
if (dateTimeString.length() == 10) {
return dateParse(dateTimeString, DateUtils.DATE_PATTERN);
} else if (dateTimeString.length() == 13) {
return dateParse(dateTimeString, DateUtils.HOUR_PATTERN);
} else if (dateTimeString.length() == 16) {
return dateParse(dateTimeString, DateUtils.MINUTE_PATTERN);
} else {
return dateParse(dateTimeString, DateUtils.DATE_TIME_PATTERN);
}
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
/**
* 将日期时间格式成只有日期的字符串(可以直接使用dateFormat,Pattern为Null进行格式化)
*
* @param dateTime Date
......@@ -227,8 +256,7 @@ public class DateUtils {
}
/**
* 当时、分、秒为00:00:00时,将日期时间格式成只有日期的字符串,
* 当时、分、秒不为00:00:00时,直接返回
* 当时、分、秒为00:00:00时,将日期时间格式成只有日期的字符串, 当时、分、秒不为00:00:00时,直接返回
*
* @param dateTime Date
* @return
......@@ -568,8 +596,8 @@ public class DateUtils {
List list = new ArrayList();
Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
aCalendar.set(yearParam, monthParam - 1, 1);
int year = aCalendar.get(Calendar.YEAR);//年份
int month = aCalendar.get(Calendar.MONTH) + 1;//月份
int year = aCalendar.get(Calendar.YEAR);// 年份
int month = aCalendar.get(Calendar.MONTH) + 1;// 月份
int day = aCalendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
......@@ -578,7 +606,6 @@ public class DateUtils {
return list;
}
/**
* 当前月的结束时间,即2012-01-31 23:59:59
*
......@@ -601,21 +628,32 @@ public class DateUtils {
}
public static void main(String[] args) throws Exception {
/*System.out.println(dateTimeToDate(new Date()));
System.out.println(dateParse("2017-02-04 14:58:20", null));
System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
/*
* System.out.println(dateTimeToDate(new Date()));
* System.out.println(dateParse("2017-02-04 14:58:20", null));
* System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
* System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new
* Date())));
*/
// System.out.println(dateBetween(dateParse("2017-01-30", null),
// dateParse("2017-02-01", null)));
// System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null),
// dateParse("2017-02-01", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
//System.out.println(getDate(dateParse("2017-01-17", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
//System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils
* System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
* System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));
*/
// System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07",
// StrUtils.MONTH_PATTERN), -12), StrUtils
// .MONTH_PATTERN));
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
/*
* System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02",
* "yyyy-MM")), null));
* System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)),
* null));
*/
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_YEAR));
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_MONTH));
......@@ -650,8 +688,8 @@ public class DateUtils {
try {
date = shortSdf.parse(dateStr);
calendar.setTime(date);
int month = calendar.get(Calendar.MONTH) + 1;//月份
int year = calendar.get(Calendar.YEAR);//年份
int month = calendar.get(Calendar.MONTH) + 1;// 月份
int year = calendar.get(Calendar.YEAR);// 年份
int day = calendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
String source = year + "-" + month + "-" + i;
......@@ -706,7 +744,6 @@ public class DateUtils {
return age;
}
/**
* 根据两个日期返回相差的时分秒
*
......
......@@ -108,6 +108,12 @@ public class JpStationDto extends BaseDto {
@ExcelIgnore
private String type;
/**
* 电站类型
*/
@ExcelIgnore
private String stationType;
/**
* 组织编码
*/
@ExcelIgnore
......
......@@ -31,11 +31,11 @@ public interface DayGenerateMapper extends BaseMapper<DayGenerate> {
@UserEmpower(field ={"regional_companies_code"},dealerField ={"amos_company_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<PowerCurveDto> getDayGeneratqx(@Param("date") String month, @Param("thirdStationId") String thirdStationId,@Param("dto")List<String> statioId);
List<PowerCurveDto> getDayGeneratqx(@Param("date") String month,@Param("regionalCompaniesCode") String regionalCompaniesCode, @Param("amosCompanyCode") String amosCompanyCode, @Param("stationType") String stationType, @Param("thirdStationId") String thirdStationId,@Param("dto")List<String> statioId);
@UserEmpower(field ={"regional_companies_code"},dealerField ={"amos_company_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<PowerCurveDto> getMonthGenerateqx(@Param("date") String month, @Param("thirdStationId") String thirdStationId, @Param("dto")List<String> statioId);
List<PowerCurveDto> getMonthGenerateqx(@Param("date") String month,@Param("regionalCompaniesCode") String regionalCompaniesCode, @Param("amosCompanyCode") String amosCompanyCode, @Param("stationType") String stationType, @Param("thirdStationId") String thirdStationId, @Param("dto")List<String> statioId);
@UserEmpower(field ={"regional_companies_code"},dealerField ={"amos_company_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<PowerCurveDto> getYearGenerateqx(@Param("date") String month, @Param("thirdStationId") String thirdStationId, @Param("dto")List<String> statioId);
List<PowerCurveDto> getYearGenerateqx(@Param("date") String month,@Param("regionalCompaniesCode") String regionalCompaniesCode, @Param("amosCompanyCode") String amosCompanyCode, @Param("stationType") String stationType, @Param("thirdStationId") String thirdStationId, @Param("dto")List<String> statioId);
@UserEmpower(field ={"regional_companies_code"},dealerField ={"amos_company_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
......
......@@ -47,6 +47,15 @@
#{item}
</foreach>
</if>
<if test="regionalCompaniesCode!=null and regionalCompaniesCode != ''">
and regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode!=null and amosCompanyCode != ''">
and amos_company_code = #{amosCompanyCode}
</if>
<if test="stationType!=null and stationType != ''">
and stationType = #{stationType}
</if>
<if test="thirdStationId!=null and thirdStationId != ''">
and third_station_id = #{thirdStationId}
......@@ -72,6 +81,16 @@
</foreach>
</if>
<if test="regionalCompaniesCode!=null and regionalCompaniesCode != ''">
and regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode!=null and amosCompanyCode != ''">
and amos_company_code = #{amosCompanyCode}
</if>
<if test="stationType!=null and stationType != ''">
and stationType = #{stationType}
</if>
<if test="thirdStationId!=null and thirdStationId != ''">
and third_station_id = #{thirdStationId}
</if>
......@@ -96,6 +115,16 @@
</foreach>
</if>
<if test="regionalCompaniesCode!=null and regionalCompaniesCode != ''">
and regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode!=null and amosCompanyCode != ''">
and amos_company_code = #{amosCompanyCode}
</if>
<if test="stationType!=null and stationType != ''">
and stationType = #{stationType}
</if>
<if test="thirdStationId!=null and thirdStationId != ''">
and third_station_id = #{thirdStationId}
</if>
......
......@@ -241,17 +241,17 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
map= getDayListOfMonth(reviewDto.getTimeDateMonth());
// if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(),reviewDto.getThirdStationId(), null);
data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(),reviewDto.getRegionalCompaniesCode(), reviewDto.getAmosCompanyCode(), reviewDto.getStationType(),reviewDto.getThirdStationId(), null);
// }
}else if(type.equals("year")){
map= getyearListOfMonth(reviewDto.getTimeDateYear());
// if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(),reviewDto.getThirdStationId(), null);
data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(),reviewDto.getRegionalCompaniesCode(), reviewDto.getAmosCompanyCode(), reviewDto.getStationType(),reviewDto.getThirdStationId(), null);
// }
}else{
map= getyearList();
// if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getYearGenerateqx(null,reviewDto.getThirdStationId(), null);
data = dayGenerateMapper.getYearGenerateqx(null,reviewDto.getRegionalCompaniesCode(), reviewDto.getAmosCompanyCode(), reviewDto.getStationType(),reviewDto.getThirdStationId(), null);
// }
}
listx = map.get("x");
......
......@@ -40,6 +40,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -759,16 +761,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL";
if(gatewayIds.size()>0){
orgCode =gatewayIds.get(0)+"%";
orgCode =gatewayIds.get(0)+'%';
}
if (WarningPeriodEnum.DAY.getName().equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
......@@ -787,10 +790,10 @@ public class IdxBizFanHealthIndexController extends BaseController {
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate = DateUtils.dateAddHours(DateUtils.dateParse(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateAddHours(DateUtils.dateParse(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
......@@ -810,10 +813,10 @@ public class IdxBizFanHealthIndexController extends BaseController {
}else {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate = DateUtils.dateAddHours(DateUtils.dateParse(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateAddHours(DateUtils.dateParse(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode);
......
......@@ -424,11 +424,11 @@ public class IdxBizPvHealthIndexController extends BaseController {
if (WarningPeriodEnum.DAY.getName().equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate =DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
......@@ -448,10 +448,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate = DateUtils.dateAddHours(DateUtils.dateParse(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateAddHours(DateUtils.dateParse(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(PvHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
......@@ -474,10 +474,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
SimpleDateFormat formatterNYRSF = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
Date endDate = DateUtils.dateAddHours(DateUtils.dateParse(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
Date startDate = DateUtils.dateAddHours(DateUtils.dateParse(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode);
......
......@@ -112,8 +112,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}else{
Date currentDayStartTime =dateFormat.parse(startTime);
Date currentDayEndTime = dateFormat.parse(endTime);
Date currentDayStartTime =DateUtils.dateParse(startTime);
Date currentDayEndTime = DateUtils.dateParse(endTime);
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}
......
......@@ -22,7 +22,7 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
// "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"<if test='orgCode!= null'>AND org_code like '%${orgCode}%' </if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
......@@ -44,7 +44,7 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='orgCode!= null'>AND org_code like '%${orgCode}%' </if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" +
"</script>")
int selectDataTotal(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("orgCode")String orgCode);
......
......@@ -318,7 +318,6 @@
<modules>
<module>amos-boot-biz-common</module>
<module>amos-boot-core</module>
<module>amos-boot-utils</module>
<module>amos-boot-data</module>
<module>amos-boot-system-jxiop</module>
</modules>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment