| | |
| | | @GetMapping("getalevels")
|
| | | public ResultBean<Map<String,AlarmSensorLevel>> getAlarmLevelByMonitorPointId(int mpid){
|
| | | AlarmConfig alarmConfig = alarmConfigService.queryByMonitorPointId(mpid).get();
|
| | | Map<String,AlarmSensorLevel> alarmSensorLevelMap = alarmConfig.getValue().getAlarmLevels();
|
| | | // 当前非取默认值,未设值将用默认值覆盖
|
| | | if(alarmConfig.getId()!=null){
|
| | | AlarmConfigValue defaultAlarmValue = alarmConfigService.getDefaultAlarmConfigValue();
|
| | | Map<String,AlarmSensorLevel> defaultSensorLevelMap = defaultAlarmValue.getAlarmLevels();
|
| | | Map<String,AlarmSensorLevel> alarmSensorLevelMapNotZO = alarmSensorLevelMap.entrySet().stream().collect(
|
| | | HashMap::new,
|
| | | (map,entry) -> {
|
| | | AlarmSensorLevel alarmSensorLevel = entry.getValue();
|
| | | if(alarmSensorLevel.isEnable()||alarmSensorLevel.isDegressEnable()){
|
| | | map.put(entry.getKey(),entry.getValue());
|
| | | }
|
| | | },
|
| | | (oMap,nMap) -> {
|
| | | oMap.putAll(nMap);
|
| | | }
|
| | | );
|
| | | // 已设置的选项覆盖默认选项
|
| | | defaultSensorLevelMap.putAll(alarmSensorLevelMapNotZO);
|
| | | alarmSensorLevelMap = defaultSensorLevelMap;
|
| | | }
|
| | |
|
| | | ResultBean<Map<String,AlarmSensorLevel>> resultBean = new ResultBean();
|
| | | resultBean.setCode(ResultBean.SUCCESS);
|
| | | resultBean.setData(alarmConfig.getValue().getAlarmLevels());
|
| | | resultBean.setData(alarmSensorLevelMap);
|
| | | return resultBean;
|
| | | }
|
| | | }
|
| | |
| | | public Optional<AlarmConfigValue> queryValueByOrganizationId(int organizationId); |
| | | public Optional<AlarmConfig> queryByOrganizationId(int organizationId); |
| | | public Optional<AlarmConfig> queryByMonitorPointId(int mpId); |
| | | public AlarmConfigValue getDefaultAlarmConfigValue(); |
| | | void addOrModify(AlarmConfig alarmConfig); |
| | | |
| | | } |
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.moral.common.util.MyBatisBaseMapUtil;
|
| | | import com.moral.common.util.*;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | | import com.moral.common.bean.Constants;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.Crypto;
|
| | | import com.moral.common.util.ResourceUtil;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.OperateUser;
|
| | | import com.moral.mapper.OperateUserMapper;
|
| | | import com.moral.service.OperateUserService;
|
| | |
| | | operateUser.setPassword(Crypto.md5(ResourceUtil.getValue("password")));
|
| | | return operateUserMapper.insertSelective(operateUser);
|
| | | }else {
|
| | | if(!StringUtils.isNullOrEmpty(operateUser.getPassword())){
|
| | | // 明码加密
|
| | | operateUser.setPassword(Crypto.md5(operateUser.getPassword()));
|
| | | }
|
| | | return operateUserMapper.updateByPrimaryKeySelective(operateUser);
|
| | | }
|
| | | }
|
| | |
| | | id, organization_id, value, create_time, update_time |
| | | </sql> |
| | | <select id="selectByOrganizationId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
| | | select |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from alarm_config |
| | | where organization_id = #{organizationId,jdbcType=INTEGER} |
| | |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | <select id="selectByMonitorPointId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
| | | select |
| | | acg.* |
| | | from alarm_config acg |
| | | LEFT JOIN monitor_point mpt on acg.organization_id = mpt.organization_id |
| | | where mpt.id = #{mpId,jdbcType=INTEGER} |
| | | </select> |
| | | </mapper> |
| | |
| | | ORDER BY |
| | | s.id |
| | | </select> |
| | | <select id="getDeviceVersionIdByMonitorPoint" resultType="map"> |
| | | <select id="getDeviceVersionIdByMonitorPoint" resultType="java.util.Map"> |
| | | SELECT |
| | | device_version_id deviceVersionId |
| | | FROM |
| | |
| | | GROUP BY |
| | | device_version_id |
| | | </select> |
| | | <select id="getDeviceVersionIdByAreaCode" resultType="int"> |
| | | <select id="getDeviceVersionIdByAreaCode" resultType="java.lang.Integer"> |
| | | SELECT DISTINCT |
| | | d.device_version_id |
| | | FROM |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="getDeviceMacByMonitorPointAndDeviceVersion" resultType="string"> |
| | | <select id="getDeviceMacByMonitorPointAndDeviceVersion" resultType="java.lang.String"> |
| | | SELECT |
| | | mac |
| | | FROM |