Merge remote-tracking branch 'origin/master'
# Conflicts:
# ximon-admin/src/main/java/com/sandu/ximon/admin/service/MonitorService.java
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | * @TableName light_pole_heeling_equipment |
| | | */ |
| | | @TableName(value ="light_pole_heeling_equipment") |
| | | @Data |
| | | public class LightPoleHeelingEquipment implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç¯æå¾æMAC设å¤å°å |
| | | */ |
| | | private String mac; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.domain.LightPoleHeelingEquipment; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @Entity com.sandu.ximon.dao.domain.LightPoleHeelingEquipment |
| | | */ |
| | | @Mapper |
| | | public interface LightPoleHeelingEquipmentMapper extends BaseMapper<LightPoleHeelingEquipment> { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | List<Monitor> listMonitorByKeyword1(String keyword, int bindingState1, int bindingState2); |
| | | |
| | | |
| | | List<MonitorBo> listMonitorByIds(String keyword, Long clientId, int bindingState, int equipmentState); |
| | | List<MonitorBo> listMonitorByIds(String keyword, int bindingState, int equipmentState, Long userid); |
| | | |
| | | List<String> listMonitorDeviceSerial(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.LightPoleHeelingEquipmentMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightPoleHeelingEquipment"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,mac,create_time |
| | | </sql> |
| | | </mapper> |
| | |
| | | OR t1.note LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | OR t3.pole_code LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | </if> |
| | | <if test="bindingState != 2"> |
| | | AND t1.binding_state = #{bindingState} |
| | | </if> |
| | | <if test="equipmentState != 2"> |
| | | AND t1.equipment_state = #{equipmentState} |
| | | </if> |
| | | <if test="userid != null"> |
| | | AND (t3.user_id = #{userid} OR t3.client_id = #{userid}) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="listMonitorDeviceSerial" resultType="java.lang.String"> |
| | |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | AND (t3.user_id = #{clientId} OR t3.client_id = #{clientId}) |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.RoleParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.RoleService; |
| | | import com.sandu.ximon.dao.domain.Role; |
| | | import com.sandu.ximon.dao.domain.RoleDetail; |
| | |
| | | @RestController |
| | | @RequestMapping("/v1/role") |
| | | public class RoleController { |
| | | |
| | | private PermissionConfig permissionConfig; |
| | | private final RoleService roleService; |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listRole(BaseConditionVO conditionVO) { |
| | | if (!permissionConfig.check("è§è²ç®¡ç")) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | |
| | | List<RoleDetail> roleDetails = roleService.listRole(conditionVO.getPageNo(), conditionVO.getPageSize()); |
| | | return ResponseUtil.success(roleDetails); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addRole(@Validated @RequestBody RoleParam param) { |
| | | boolean result = roleService.addRole(param); |
| | |
| | | if (loginUserInfo == null) { |
| | | return null; |
| | | } |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(loginUserInfo.getAdministratorType())) { |
| | | if (!AdministratorEnums.ADMIN.getCode().equals(loginUserInfo.getAdministratorType())) { |
| | | return loginUserInfo.getUserId(); |
| | | } |
| | | return null; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeelingEquipment; |
| | | import com.sandu.ximon.dao.mapper.LightPoleHeelingEquipmentMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | | * @date 2022/4/13 16:52 |
| | | */ |
| | | @Service |
| | | public class LightPoleHeelingEquipmentService extends BaseServiceImpl<LightPoleHeelingEquipmentMapper, LightPoleHeelingEquipment> { |
| | | } |
| | |
| | | import com.sandu.ximon.admin.param.LightPoleHeelingListParam; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeeling; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeelingEquipment; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.mapper.LightPoleHeelingMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @AllArgsConstructor |
| | | public class LightPoleHeelingService extends BaseServiceImpl<LightPoleHeelingMapper, LightPoleHeeling> { |
| | | private LightPoleHeelingMapper lightPoleHeelingMapper; |
| | | private LightPoleHeelingEquipmentService lightPoleHeelingEquipmentService; |
| | | |
| | | /** |
| | | * æ¨¡ç³æ¥è¯¢ |
| | |
| | | } else { |
| | | lightPoleHeeling.setWarningLevel(0);//æ£å¸¸ |
| | | } |
| | | /** |
| | | * å°ç¯æå¾æç¡¬ä»¶æ·»å å°ç¡¬ä»¶è¡¨ |
| | | */ |
| | | LightPoleHeelingEquipment one = lightPoleHeelingEquipmentService.getOne(Wrappers.lambdaQuery(LightPoleHeelingEquipment.class).eq(LightPoleHeelingEquipment::getMac, deviceName)); |
| | | if (one == null) { |
| | | LightPoleHeelingEquipment equipment = new LightPoleHeelingEquipment(); |
| | | equipment.setMac(deviceName); |
| | | lightPoleHeelingEquipmentService.save(equipment); |
| | | } |
| | | |
| | | return save(lightPoleHeeling); |
| | | } |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.MonitorParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentBo; |
| | | import com.sandu.ximon.dao.bo.MonitorBo; |
| | | import com.sandu.ximon.dao.domain.Monitor; |
| | | import com.sandu.ximon.admin.dto.YSY_AccessTokenDto; |
| | |
| | | String s = HttpUtil.post(YSY_URL + ACCESSTOKEN_URL, paramMap); |
| | | YSY_AccessTokenDto accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class); |
| | | return accessTokenDto.getData().getAccessToken(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åè¤ç³äºæåå¤´ä¿¡æ¯ æ ééªè¯accessToken |
| | | * @return |
| | | */ |
| | | public YSY_MonitorDto.MonitorDto getMonitorInfo(String deviceSerial) { |
| | | String token = getAccessToken(); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("accessToken", token); |
| | | paramMap.put("deviceSerial", deviceSerial); |
| | | String s = HttpUtil.post(YSY_URL + GET_DEVICE_URL, paramMap); |
| | | YSY_MonitorDto monitorDto = JSON.parseObject(s, YSY_MonitorDto.class); |
| | | return monitorDto.getData(); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | |
| | | import com.sandu.ximon.dao.mapper.PoleBindingMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | |
| | | Integer deviceType = param.getDeviceType(); |
| | | // if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) { |
| | | // } |
| | | LambdaQueryWrapper<PoleBinding> eq = Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId); |
| | | List<PoleBinding> list = list(eq); |
| | | if (list.size() != 0){ |
| | | for (PoleBinding poleBinding : list) { |
| | | if (poleBinding.getDeviceType().equals(deviceType)) { |
| | | throw new BusinessException("è¯¥ç¯æå·²ç»å®è¿ç¸åç±»å设å¤"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, param.getDeviceCode())); |
| | | if (one == null) { |
| | |
| | | } |
| | | } |
| | | |
| | | public PoleBinding getPoleIdByMac(String deviceCode){ |
| | | return getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode)); |
| | | public PoleBinding getPoleIdByMac(String deviceCode) { |
| | | return getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode)); |
| | | } |
| | | } |
| | |
| | | * æ¨¡ç³æ¥è¯¢ |
| | | */ |
| | | public List<WaterQualityEquipmentBo> listWaterQualityEquipmentByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | | List<WaterQualityEquipmentBo> waterQualityEquipmentBoList = waterQualityEquipmentMapper.listWaterQualityEquipmentByIds(keyword, clientId); |
| | | List<WaterQualityEquipmentBo> waterQualityEquipmentBoList; |
| | | //为空æ¯è¶
管 |
| | | if (SecurityUtils.getClientId() == null) { |
| | | waterQualityEquipmentBoList = waterQualityEquipmentMapper.listWaterQualityEquipmentByIds(keyword, null); |
| | | } else { |
| | | waterQualityEquipmentBoList = waterQualityEquipmentMapper.listWaterQualityEquipmentByIds(keyword, userId); |
| | | } |
| | | return waterQualityEquipmentBoList; |
| | | } |
| | | |