|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.acs.AcsConfig; |
|
|
|
import org.nl.common.domain.query.PageQuery; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
@ -19,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalTime; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
@ -44,7 +47,27 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl |
|
|
|
Page<Param> paramPage = paramMapper.selectPage(page.build(), queryWrapper); |
|
|
|
return paramPage; |
|
|
|
} |
|
|
|
public Map<String, Object> queryParam(){ |
|
|
|
HashMap<String, Object> map = new HashMap<String, Object>(); |
|
|
|
//白班充电阈值
|
|
|
|
Param electric = this.findByCode(AcsConfig.ELECTRIC); |
|
|
|
if (ObjectUtil.isEmpty(electric)) throw new BadRequestException("白班充电阈值参数异常"); |
|
|
|
//晚班充电阈值
|
|
|
|
Param electric2 = this.findByCode(AcsConfig.ELECTRIC2); |
|
|
|
if (ObjectUtil.isEmpty(electric2)) throw new BadRequestException("晚班充电阈值参数异常"); |
|
|
|
//白班开始时间
|
|
|
|
Param electric_begin = this.findByCode(AcsConfig.ELECTRIC_BEGIN); |
|
|
|
if (ObjectUtil.isEmpty(electric_begin)) throw new BadRequestException("白班开始时间参数异常"); |
|
|
|
//白班结束时间
|
|
|
|
Param electric_end = this.findByCode(AcsConfig.ELECTRIC_END); |
|
|
|
if (ObjectUtil.isEmpty(electric_end)) throw new BadRequestException("白班结束时间参数异常"); |
|
|
|
|
|
|
|
map.put("electric",electric.getValue()); |
|
|
|
map.put("electric2",electric2.getValue()); |
|
|
|
map.put("electric_begin",electric_begin.getValue()); |
|
|
|
map.put("electric_end",electric_end.getValue()); |
|
|
|
return map; |
|
|
|
} |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void create(Param param) { |
|
|
@ -94,4 +117,48 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl |
|
|
|
Param param = paramMapper.selectOne(queryWrapper); |
|
|
|
return param; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void setParam(Map whereJson){ |
|
|
|
Integer electric = (Integer) whereJson.get("electric"); |
|
|
|
Integer electric2 = (Integer) whereJson.get("electric2"); |
|
|
|
String electric_begin = (String) whereJson.get("electric_begin"); |
|
|
|
String electric_end = (String) whereJson.get("electric_end"); |
|
|
|
|
|
|
|
String now_time = DateUtil.now(); |
|
|
|
//白班充电阈值
|
|
|
|
Param param_electric = this.findByCode(AcsConfig.ELECTRIC); |
|
|
|
if (ObjectUtil.isEmpty(param_electric)) throw new BadRequestException("白班充电阈值参数异常"); |
|
|
|
param_electric.setValue(electric.toString()); |
|
|
|
param_electric.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
param_electric.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
param_electric.setUpdate_time(now_time); |
|
|
|
paramMapper.updateById(param_electric); |
|
|
|
//晚班充电阈值
|
|
|
|
Param param_electric2 = this.findByCode(AcsConfig.ELECTRIC2); |
|
|
|
if (ObjectUtil.isEmpty(param_electric2)) throw new BadRequestException("晚班充电阈值参数异常"); |
|
|
|
param_electric2.setValue(electric2.toString()); |
|
|
|
param_electric2.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
param_electric2.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
param_electric2.setUpdate_time(now_time); |
|
|
|
paramMapper.updateById(param_electric2); |
|
|
|
//白班开始时间
|
|
|
|
Param param_electric_begin = this.findByCode(AcsConfig.ELECTRIC_BEGIN); |
|
|
|
if (ObjectUtil.isEmpty(param_electric_begin)) throw new BadRequestException("白班开始时间参数异常"); |
|
|
|
param_electric_begin.setValue(electric_begin); |
|
|
|
param_electric_begin.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
param_electric_begin.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
param_electric_begin.setUpdate_time(now_time); |
|
|
|
paramMapper.updateById(param_electric_begin); |
|
|
|
//白班结束时间
|
|
|
|
Param param_electric_end = this.findByCode(AcsConfig.ELECTRIC_END); |
|
|
|
if (ObjectUtil.isEmpty(param_electric_end)) throw new BadRequestException("白班开始时间参数异常"); |
|
|
|
param_electric_end.setValue(electric_end); |
|
|
|
param_electric_end.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
param_electric_end.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
param_electric_end.setUpdate_time(now_time); |
|
|
|
paramMapper.updateById(param_electric_end); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|