Merge branch 'dev' of http://blit.7drlb.com:8888/r/moral into dev
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | 
|---|
|  |  |  | String content = "修改了菜单:"+manageMenuOld.getName()+";"; | 
|---|
|  |  |  | for (Object key:map.keySet()) { | 
|---|
|  |  |  | if (key.toString().equals("name")){ | 
|---|
|  |  |  | if (key.toString().equals("name")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"菜单名:"+manageMenuOld.getName()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("url")){ | 
|---|
|  |  |  | if (key.toString().equals("url")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"url地址:"+manageMenuOld.getUrl()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("icon")){ | 
|---|
|  |  |  | if (key.toString().equals("icon")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"图标地址:"+manageMenuOld.getIcon()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("parent_id")){ | 
|---|
|  |  |  | if (key.toString().equals("parent_id")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"父菜单:"+manageMenuMapper.getManageMenuById(manageMenuOld.getId()).getName()+"->"+manageMenuMapper.getManageMenuById(Integer.parseInt(map.get(key).toString())).getName()+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("order")){ | 
|---|
|  |  |  | if (key.toString().equals("order")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"同一级别菜单顺序:"+manageMenuOld.getOrder()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("desc")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"描述:"+manageMenuOld.getDesc()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | logUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); | 
|---|
|  |  |  | resultMap.put("code", ResponseCodeEnum.SUCCESS.getCode()); | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.moral.api.util.LogUtils; | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.util.TokenUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | 
|---|
|  |  |  | manageRoleMenuMapper.insertBatch(mapList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //注销token | 
|---|
|  |  |  | TokenUtils.destoryToken(id); | 
|---|
|  |  |  | List<ManageMenu> manageMenusNew = manageMenuMapper.getManageMenuByRoleId(id); | 
|---|
|  |  |  | List manageMenuOldList = new ArrayList(); | 
|---|
|  |  |  | List manageMenuNewList = new ArrayList(); | 
|---|
|  |  |  | 
|---|
|  |  |  | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | 
|---|
|  |  |  | String content = "修改了角色:"+manageRoleOld.getName()+";"; | 
|---|
|  |  |  | for (Object key:map.keySet()) { | 
|---|
|  |  |  | if (key.toString().equals("name")){ | 
|---|
|  |  |  | if (key.toString().equals("name")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"角色名:"+manageRoleOld.getName()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (key.toString().equals("desc")){ | 
|---|
|  |  |  | if (key.toString().equals("desc")&&map.get(key)!=null){ | 
|---|
|  |  |  | content = content+"备注:"+manageRoleOld.getDesc()+"->"+map.get(key)+";"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | monitorPointMap.put("key",monitorPoint.getId()); | 
|---|
|  |  |  | monitorPointtList.add(monitorPointMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | resultMap.put("manageRoles",monitorPointtList); | 
|---|
|  |  |  | resultMap.put("monitorPoints",monitorPointtList); | 
|---|
|  |  |  | resultMap.put("totalNumber",totalNumber); | 
|---|
|  |  |  | resultMap.put("current",current); | 
|---|
|  |  |  | int totalPageNumber = totalNumber/size; | 
|---|
|  |  |  | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | QueryWrapper<MonitorPoint> wapper_id = new QueryWrapper<>(); | 
|---|
|  |  |  | wapper_id.eq("id",updateMap.get("id")); | 
|---|
|  |  |  | wapper_id.eq("is_delete",Constants.NOT_DELETE); | 
|---|
|  |  |  | MonitorPoint oldMonitorPoint = monitorPointMapper.selectOne(wapper_id); | 
|---|
|  |  |  | if (oldMonitorPoint==null){ | 
|---|
|  |  |  | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (updateMap.get("name")==null||updateMap.get("name")==""){ | 
|---|
|  |  |  | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if(monitorPoint_name!=null&&!monitorPoint_name.getId().toString().equals(updateMap.get("id").toString())){ | 
|---|
|  |  |  | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | QueryWrapper<MonitorPoint> wapper_id = new QueryWrapper<>(); | 
|---|
|  |  |  | wapper_id.eq("id",updateMap.get("id")); | 
|---|
|  |  |  | wapper_id.eq("is_delete",Constants.NOT_DELETE); | 
|---|
|  |  |  | MonitorPoint oldMonitorPoint = monitorPointMapper.selectOne(wapper_id); | 
|---|
|  |  |  | if (oldMonitorPoint==null){ | 
|---|
|  |  |  | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | monitorPointMapper.updateMonitorPoint(updateMap); | 
|---|
|  |  |  | 
|---|
|  |  |  | monitorPointMap.put("key",monitorPoint.getId()); | 
|---|
|  |  |  | monitorPointtList.add(monitorPointMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | resultMap.put("manageRoles",monitorPointtList); | 
|---|
|  |  |  | resultMap.put("monitorPoints",monitorPointtList); | 
|---|
|  |  |  | resultMap.put("totalNumber",totalNumber); | 
|---|
|  |  |  | resultMap.put("current",current); | 
|---|
|  |  |  | int totalPageNumber = totalNumber/size; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.moral.api.entity.ManageRole; | 
|---|
|  |  |  | import com.moral.api.entity.Sensor; | 
|---|
|  |  |  | import com.moral.api.entity.SysDictData; | 
|---|
|  |  |  | import com.moral.api.entity.VersionSensorUnit; | 
|---|
|  |  |  | import com.moral.api.mapper.SensorMapper; | 
|---|
|  |  |  | import com.moral.api.mapper.SysDictDataMapper; | 
|---|
|  |  |  | import com.moral.api.mapper.VersionSensorUnitMapper; | 
|---|
|  |  |  | import com.moral.api.service.SensorService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.RedisConstants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.util.TokenUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired(required = false) | 
|---|
|  |  |  | private VersionSensorUnitMapper versionSensorUnitMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired(required = false) | 
|---|
|  |  |  | private SysDictDataMapper sysDictDataMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | LogUtils logUtils; | 
|---|
|  |  |  | 
|---|
|  |  |  | sensorMap.put("createTime",createTime); | 
|---|
|  |  |  | sensorMap.put("updateTime",updateTime); | 
|---|
|  |  |  | sensorMap.put("key",sensor.getId()); | 
|---|
|  |  |  | if (sensor.getDefaultUnitKey()!=null&&sensor.getDefaultUnitKey()!=""){ | 
|---|
|  |  |  | QueryWrapper<SysDictData> wrapper_VSU = new QueryWrapper(); | 
|---|
|  |  |  | wrapper_VSU.eq("is_delete",0); | 
|---|
|  |  |  | wrapper_VSU.eq("dataKey",sensor.getDefaultUnitKey()); | 
|---|
|  |  |  | wrapper_VSU.eq("dict_type_id",14); | 
|---|
|  |  |  | sensorMap.put("default_unit_key",sysDictDataMapper.selectOne(wrapper_VSU).getDataValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sensorList.add(sensorMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | resultMap.put("manageRoles",sensorList); | 
|---|
|  |  |  | resultMap.put("sensors",sensorList); | 
|---|
|  |  |  | resultMap.put("totalNumber",totleNum); | 
|---|
|  |  |  | resultMap.put("current",current); | 
|---|
|  |  |  | int totalPageNumber = totleNum/size; | 
|---|
|  |  |  | 
|---|
|  |  |  | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); | 
|---|
|  |  |  | //刷新缓存 | 
|---|
|  |  |  | refreshCache(); | 
|---|
|  |  |  | //注销token | 
|---|
|  |  |  | TokenUtils.destoryToken(Integer.parseInt(map.get("id").toString())); | 
|---|
|  |  |  | return resultMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | sensorMap.put("createTime",createTime); | 
|---|
|  |  |  | sensorMap.put("updateTime",updateTime); | 
|---|
|  |  |  | sensorMap.put("key",sensor.getId()); | 
|---|
|  |  |  | if (sensor.getDefaultUnitKey()!=null&&sensor.getDefaultUnitKey()!=""){ | 
|---|
|  |  |  | QueryWrapper<SysDictData> wrapper_VSU = new QueryWrapper(); | 
|---|
|  |  |  | wrapper_VSU.eq("is_delete",0); | 
|---|
|  |  |  | wrapper_VSU.eq("dataKey",sensor.getDefaultUnitKey()); | 
|---|
|  |  |  | wrapper_VSU.eq("dict_type_id",14); | 
|---|
|  |  |  | sensorMap.put("default_unit_key",sysDictDataMapper.selectOne(wrapper_VSU).getDataValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sensorList.add(sensorMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | resultMap.put("manageRoles",sensorList); | 
|---|
|  |  |  | resultMap.put("sensors",sensorList); | 
|---|
|  |  |  | resultMap.put("totalNumber",totleNum); | 
|---|
|  |  |  | resultMap.put("current",current); | 
|---|
|  |  |  | int totalPageNumber = totleNum/size; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | mm.id,mm.name,mm.url,mm.icon,mm.parent_id,mm.order,mm.create_time,mm.update_time,mm.is_delete | 
|---|
|  |  |  | mm.id,mm.name,mm.url,mm.icon,mm.parent_id,mm.order,mm.create_time,mm.update_time,mm.is_delete,mm.desc | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="order != null"> | 
|---|
|  |  |  | `order`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="desc != null"> | 
|---|
|  |  |  | `desc`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="name != null"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="order != null"> | 
|---|
|  |  |  | #{order}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="desc != null"> | 
|---|
|  |  |  | #{desc}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="is_delete != null"> | 
|---|
|  |  |  | is_delete = #{is_delete}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="desc != null"> | 
|---|
|  |  |  | `desc` = #{desc}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="order != null"> | 
|---|
|  |  |  | and mm.order = #{order} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="desc != null"> | 
|---|
|  |  |  | and mm.desc = #{order} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | limit #{start},#{number} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|