|  |  |  | 
|---|
|  |  |  | package com.moral.api.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.moral.api.mapper.ManageCoordinateDetailMapper; | 
|---|
|  |  |  | import com.moral.api.mapper.ManageCoordinateMapper; | 
|---|
|  |  |  | import com.moral.api.mapper.SpecialDeviceMapper; | 
|---|
|  |  |  | import com.moral.api.pojo.form.coordinate.CoordinateCode; | 
|---|
|  |  |  | import com.moral.api.service.DeviceService; | 
|---|
|  |  |  | import com.moral.api.service.ManageCoordinateDetailService; | 
|---|
|  |  |  | import com.moral.api.service.ManageCoordinateService; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改路段 | 
|---|
|  |  |  | * @param manageCoordinate | 
|---|
|  |  |  | * @param coordinateCode | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateCoordinate(ManageCoordinate manageCoordinate) { | 
|---|
|  |  |  | public void updateCoordinate(CoordinateCode coordinateCode) { | 
|---|
|  |  |  | ManageCoordinate manageCoordinate = new ManageCoordinate(); | 
|---|
|  |  |  | BeanUtils.copyProperties(coordinateCode,manageCoordinate); | 
|---|
|  |  |  | manageCoordinate.setUpdateTime(new Date()); | 
|---|
|  |  |  | List<HashMap<String, Object>> value = coordinateCode.getValue(); | 
|---|
|  |  |  | String s = JSON.toJSONString(value); | 
|---|
|  |  |  | manageCoordinate.setValue(s); | 
|---|
|  |  |  | manageCoordinate.setBdValue(JSON.toJSONString(coordinateCode.getBdValue())); | 
|---|
|  |  |  | manageCoordinateMapper.updateById(manageCoordinate); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | queryWrapper.eq("is_del",0); | 
|---|
|  |  |  | queryWrapper.orderByDesc("coordinate_id"); | 
|---|
|  |  |  | List<ManageCoordinate> manageCoordinates = manageCoordinateMapper.selectList(queryWrapper); | 
|---|
|  |  |  | manageCoordinates.forEach(it->{ | 
|---|
|  |  |  | String value = it.getValue(); | 
|---|
|  |  |  | String bdValue = it.getBdValue(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(value)  &&  !ObjectUtils.isEmpty(bdValue)){ | 
|---|
|  |  |  | //                List<HashMap<String, Object>> hashMaps = (List<HashMap<String, Object>>)JSON.parseObject(value,List.class); | 
|---|
|  |  |  | List<HashMap<String, Object>> parse = (List<HashMap<String, Object>>) JSONArray.parse(value); | 
|---|
|  |  |  | it.setValues(parse); | 
|---|
|  |  |  | it.setBdValues((List<HashMap<String, Object>>) JSONArray.parse(bdValue)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return manageCoordinates; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据id查询路段信息 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ManageCoordinate query(Integer id) { | 
|---|
|  |  |  | ManageCoordinate manageCoordinate = manageCoordinateMapper.selectById(id); | 
|---|
|  |  |  | return manageCoordinate; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|