change - 尖峰平谷完善

master
wenjy 3 years ago
parent 990fdbf22a
commit 61bba9aeec

@ -27,8 +27,12 @@ public class AddTestData {
@GetMapping("/info")
public boolean analyze(){
try{
Date date = new Date();
List<Date> ds = test(date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,-1);
List<Date> ds = test(calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Date d : ds) {

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.api;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.system.domain.BaseJfpgInfo;
import com.ruoyi.system.domain.ScadaEmsElectricloss;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author WenJY
@ -28,10 +30,13 @@ public class JfpgAnalyzeController {
@Autowired
private IScadaEmsElectriclossService scadaEmsElectriclossService;
@GetMapping("/info")
public String Analyze(){
List<BaseJfpgInfo> jfpgInfoList = baseJfpgInfoService.selectBaseJfpgInfoList(new BaseJfpgInfo(1L));
List<ScadaEmsElectricloss> scadaEmsElectriclossList = scadaEmsElectriclossService.selectScadaEmsElectriclossList(new ScadaEmsElectricloss());
List<BaseJfpgInfo> jfpgInfoList = baseJfpgInfoService.selectBaseJfpgInfoList(new BaseJfpgInfo(0L));
//List<ScadaEmsElectricloss> scadaEmsElectriclossList = scadaEmsElectriclossService.selectScadaEmsElectriclossList(new ScadaEmsElectricloss());
Map<String,List<BaseJfpgInfo>> jfpgMap = jfpgInfoList.stream().collect(Collectors.groupingBy(BaseJfpgInfo :: getTimeframeName));
// 尖
@ -41,7 +46,7 @@ public class JfpgAnalyzeController {
// 谷
return "";
return JSONArray.toJSONString(jfpgMap);
}
}

@ -90,7 +90,20 @@ public class BaseJfpgInfoController extends BaseController
@ResponseBody
public AjaxResult addSave(BaseJfpgInfo baseJfpgInfo)
{
switch(baseJfpgInfo.getTimeframeCode()){
case 0:
baseJfpgInfo.setTimeframeName("尖");
break;
case 1:
baseJfpgInfo.setTimeframeName("峰");
break;
case 2:
baseJfpgInfo.setTimeframeName("平");
break;
case 3:
baseJfpgInfo.setTimeframeName("谷");
break;
}
baseJfpgInfo.setUuid(UUIDTool.generate());
baseJfpgInfo.setCreatedBy(ShiroUtils.getLoginName());
@ -118,6 +131,20 @@ public class BaseJfpgInfoController extends BaseController
@ResponseBody
public AjaxResult editSave(BaseJfpgInfo baseJfpgInfo)
{
switch(baseJfpgInfo.getTimeframeCode()){
case 0:
baseJfpgInfo.setTimeframeName("尖");
break;
case 1:
baseJfpgInfo.setTimeframeName("峰");
break;
case 2:
baseJfpgInfo.setTimeframeName("平");
break;
case 3:
baseJfpgInfo.setTimeframeName("谷");
break;
}
baseJfpgInfo.setUpdatedBy(ShiroUtils.getLoginName());
baseJfpgInfo.setUpdatedTime(new Date());
return toAjax(baseJfpgInfoService.updateBaseJfpgInfo(baseJfpgInfo));

@ -6,12 +6,12 @@ spring:
druid:
# 主库数据源
master:
# url: jdbc:oracle:thin:@124.70.0.226:1521:ORCL
# username: system
# password: 123456
url: jdbc:oracle:thin:@10.100.71.101:1521:ORCL
username: aucma
password: aucma
url: jdbc:oracle:thin:@124.70.0.226:1521:ORCL
username: system
password: 123456
# url: jdbc:oracle:thin:@10.100.71.101:1521:ORCL
# username: aucma
# password: aucma
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -11,8 +11,11 @@
<div class="select-list">
<ul>
<li>
<label>时段名称:</label>
<input type="text" name="timeframeName"/>
<label>时段类型:</label>
<select name="timeframeCode" th:with="type=${@dict.getType('sys_jfpg_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>是否启用:</label>
@ -66,6 +69,7 @@
var editFlag = [[${@permission.hasPermi('ems:JfpgInfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('ems:JfpgInfo:remove')}]];
var deleteFlagDatas = [[${@dict.getType('delete_flag')}]];
var timeframeCodeDatas = [[${@dict.getType('sys_jfpg_type')}]];
var prefix = ctx + "ems/JfpgInfo";
$(function() {
@ -83,11 +87,13 @@
field: 'uuid',
title: 'UUID',
visible: false
},
{
field: 'timeframeName',
title: '时段名称'
},
},{
field: 'timeframeCode',
title: '时段类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(timeframeCodeDatas, value);
}
},
{
field: 'timeframeBegin',
title: '时段开始'

@ -8,9 +8,11 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-JfpgInfo-add">
<div class="form-group">
<label class="col-sm-3 control-label">时段名称</label>
<label class="col-sm-3 control-label">时段类型</label>
<div class="col-sm-8">
<input name="timeframeName" class="form-control" type="text">
<select name="timeframeCode" class="form-control m-b" th:with="type=${@dict.getType('sys_jfpg_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">

@ -8,10 +8,13 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-JfpgInfo-edit" th:object="${baseJfpgInfo}">
<input name="uuid" th:field="*{uuid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">时段名称:</label>
<div class="form-group">
<label class="col-sm-3 control-label">时段类型:</label>
<div class="col-sm-8">
<input name="timeframeName" th:field="*{timeframeName}" class="form-control" type="text">
<select name="timeframeCode" class="form-control m-b" th:with="type=${@dict.getType('sys_jfpg_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{timeframeCode}"></option>
</select>
</div>
</div>
<div class="form-group">

@ -27,6 +27,9 @@ public class BaseJfpgInfo extends BaseEntity
/** UUID */
private String uuid;
@Excel(name="时段编号")
private Integer timeframeCode;
/** 时段名称 */
@Excel(name = "时段名称")
private String timeframeName;
@ -156,6 +159,14 @@ public class BaseJfpgInfo extends BaseEntity
return updatedTime;
}
public Integer getTimeframeCode() {
return timeframeCode;
}
public void setTimeframeCode(Integer timeframeCode) {
this.timeframeCode = timeframeCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BaseJfpgInfo" id="BaseJfpgInfoResult">
<result property="uuid" column="uuid" />
<result property="timeframeCode" column="timeframe_code" />
<result property="timeframeName" column="timeframe_name" />
<result property="timeframeBegin" column="timeframe_begin" />
<result property="timeframeEnd" column="timeframe_end" />
@ -18,12 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBaseJfpgInfoVo">
select uuid, timeframe_name, timeframe_begin, timeframe_end, timeframe_price, delete_flag, created_by, created_time, updated_by, updated_time from base_jfpg_info
select uuid, timeframe_code, timeframe_name, timeframe_begin, timeframe_end, timeframe_price, delete_flag, created_by, created_time, updated_by, updated_time from base_jfpg_info
</sql>
<select id="selectBaseJfpgInfoList" parameterType="BaseJfpgInfo" resultMap="BaseJfpgInfoResult">
<include refid="selectBaseJfpgInfoVo"/>
<where>
<where>
<if test="timeframeCode != null and timeframeCode != ''"> and timeframe_code = #{timeframeCode}</if>
<if test="timeframeName != null and timeframeName != ''"> and timeframe_name like concat(concat('%', #{timeframeName}), '%')</if>
<if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if>
<if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
@ -43,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into base_jfpg_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uuid != null">uuid,</if>
<if test="timeframeCode != null">timeframe_code,</if>
<if test="timeframeName != null">timeframe_name,</if>
<if test="timeframeBegin != null">timeframe_begin,</if>
<if test="timeframeEnd != null">timeframe_end,</if>
@ -55,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uuid != null">#{uuid},</if>
<if test="timeframeCode != null">#{timeframeCode},</if>
<if test="timeframeName != null">#{timeframeName},</if>
<if test="timeframeBegin != null">#{timeframeBegin},</if>
<if test="timeframeEnd != null">#{timeframeEnd},</if>
@ -70,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateBaseJfpgInfo" parameterType="BaseJfpgInfo">
update base_jfpg_info
<trim prefix="SET" suffixOverrides=",">
<if test="timeframeCode != null">timeframe_code = #{timeframeCode},</if>
<if test="timeframeName != null">timeframe_name = #{timeframeName},</if>
<if test="timeframeBegin != null">timeframe_begin = #{timeframeBegin},</if>
<if test="timeframeEnd != null">timeframe_end = #{timeframeEnd},</if>

Loading…
Cancel
Save