前端接口

This commit is contained in:
邱贞招 2024-09-19 11:25:42 +08:00
parent 5e4985c7c9
commit c58d84e756
41 changed files with 1444 additions and 415 deletions

View File

@ -0,0 +1,154 @@
package com.ruoyi.web.controller.app;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.agent.RlAgent;
import com.ruoyi.system.domain.city.RlCity;
import com.ruoyi.system.domain.city.RlCityQuery;
import com.ruoyi.system.domain.store.StoreQuery;
import com.ruoyi.system.service.IRlAgentService;
import com.ruoyi.system.service.IRlCityService;
import com.ruoyi.system.service.IRlModelService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.store.RlStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* app接口不需要登录的
* 校验
* @author ruoyi
*/
@RestController
@RequestMapping("/app")
public class AppController extends BaseController
{
@Resource
private IRlCityService rlCityService;
@Autowired
private ISysDictDataService dictDataService;
@Resource
private IRlAgentService rlAgentService;
@Autowired
private IRlModelService eModelService;
@Autowired
private RlStoreService storeService;
/**
* 查询城市列表
*/
@GetMapping("/city/list")
public AjaxResult cityList(RlCityQuery city)
{
logger.info("查询城市列表【city="+city+"");
List<RlCity> list = rlCityService.selectRlCityList(city);
return success(list);
}
/**
* 获取出租周期列表
*/
@GetMapping("/getRentalPeriod")
public AjaxResult cityList()
{
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("rl_rental_period");
List<SysDictData> list = dictDataService.selectDictDataList(sysDictData);
return success(list);
}
/**
* 根据城市id获取代理商
*/
@GetMapping("/getAgentByCityId")
public AjaxResult getAgentByCityId(Long cityId)
{
logger.info("根据城市id获取代理商【cityId="+cityId+"");
return success(rlAgentService.selectRlAgentByCityId(cityId));
}
/**
* 根据城市id获取车型列表
*/
@GetMapping("/getModelListByCityId")
public AjaxResult getModelListByCityId(Long cityId)
{
logger.info("根据城市id获取车型列表【cityId="+cityId+"");
RlAgent rlAgent = rlAgentService.selectRlAgentByCityId(cityId);
if(rlAgent!=null){
return success(eModelService.selectEModelListByAgentId(rlAgent.getAgentId()));
}
return error("代理商不存在");
}
/**
* 根据定位获取哪个城市
*/
@GetMapping("/getCity")
public AjaxResult getCity(String lon,String lat)
{
logger.info("根据定位获取哪个城市【lon="+lon+",lat="+lat+"");
AjaxResult ajax = AjaxResult.success();
String city = rlCityService.getCityByLocation(lon,lat);
ajax.put(AjaxResult.DATA_TAG, city);
return ajax;
}
/**
* 根据定位获取详细地址
*/
@GetMapping("/getAddress")
public AjaxResult getAddress(String lon,String lat)
{
logger.info("根据定位获取哪个城市【lon="+lon+",lat="+lat+"");
AjaxResult ajax = AjaxResult.success();
String city = rlCityService.getAddressByLocation(lon,lat);
ajax.put(AjaxResult.DATA_TAG, city);
return ajax;
}
/**
* 根据店铺id获取店铺详情
*/
@GetMapping("/getStore")
public AjaxResult getStore(Long storeId)
{
logger.info("根据城市id获取车型列表【storeId="+storeId+"");
return success(storeService.selectSmStoreById(storeId));
}
/**
* 根据代理商id获取店铺列表
*/
@GetMapping("/getStoreListByAgentId")
public AjaxResult getStoreListByAgentId(Long agentId,String lon,String lat)
{
logger.info("根据代理商id获取店铺列表【agentId="+agentId+",lon="+lon+",lat="+lat+"");
StoreQuery storeQuery = new StoreQuery();
storeQuery.setAgentId(agentId);
storeQuery.setPhoneLon(lon);
storeQuery.setPhoneLat(lat);
return success(storeService.selectSmStoreList(storeQuery));
}
}

View File

@ -13,7 +13,7 @@ import com.ruoyi.common.utils.DateUtils;
//import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.common.utils.map.GpsCoordinateUtils;
import com.ruoyi.system.domain.RlDevice;
import com.ruoyi.system.domain.RlModel;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.domain.RlOnlineLog;
import com.ruoyi.system.service.IRlDeviceService;
import com.ruoyi.system.service.IRlModelService;

View File

@ -0,0 +1,98 @@
package com.ruoyi.web.controller.rl;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.agent.RlAgent;
import com.ruoyi.system.service.IRlAgentService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 代理商Controller
*
* @author qzz
* @date 2024-09-18
*/
@RestController
@RequestMapping("/system/agent")
public class RlAgentController extends BaseController
{
@Resource
private IRlAgentService rlAgentService;
/**
* 查询代理商列表
*/
@PreAuthorize("@ss.hasPermi('system:agent:list')")
@GetMapping("/list")
public TableDataInfo list(RlAgent rlAgent)
{
startPage();
List<RlAgent> list = rlAgentService.selectRlAgentList(rlAgent);
return getDataTable(list);
}
/**
* 导出代理商列表
*/
@PreAuthorize("@ss.hasPermi('system:agent:export')")
@Log(title = "代理商", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RlAgent rlAgent)
{
List<RlAgent> list = rlAgentService.selectRlAgentList(rlAgent);
ExcelUtil<RlAgent> util = new ExcelUtil<RlAgent>(RlAgent.class);
util.exportExcel(response, list, "代理商数据");
}
/**
* 获取代理商详细信息
*/
@PreAuthorize("@ss.hasPermi('system:agent:query')")
@GetMapping(value = "/{agentId}")
public AjaxResult getInfo(@PathVariable("agentId") Long agentId)
{
return success(rlAgentService.selectRlAgentByAgentId(agentId));
}
/**
* 新增代理商
*/
@PreAuthorize("@ss.hasPermi('system:agent:add')")
@Log(title = "代理商", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RlAgent rlAgent)
{
return toAjax(rlAgentService.insertRlAgent(rlAgent));
}
/**
* 修改代理商
*/
@PreAuthorize("@ss.hasPermi('system:agent:edit')")
@Log(title = "代理商", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RlAgent rlAgent)
{
return toAjax(rlAgentService.updateRlAgent(rlAgent));
}
/**
* 删除代理商
*/
@PreAuthorize("@ss.hasPermi('system:agent:remove')")
@Log(title = "代理商", businessType = BusinessType.DELETE)
@DeleteMapping("/{agentIds}")
public AjaxResult remove(@PathVariable Long[] agentIds)
{
return toAjax(rlAgentService.deleteRlAgentByAgentIds(agentIds));
}
}

View File

@ -7,7 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.AsArticleClassify;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.IAsArticleClassifyService;
import com.ruoyi.system.service.IRlArticleClassifyService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -23,10 +23,10 @@ import java.util.List;
*/
@RestController
@RequestMapping("/article/classify")
public class AsArticleClassifyController extends BaseController
public class RlArticleClassifyController extends BaseController
{
@Autowired
private IAsArticleClassifyService asArticleClassifyService;
private IRlArticleClassifyService asArticleClassifyService;
/**
* 获取分类列表

View File

@ -8,8 +8,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.EtArticle;
import com.ruoyi.system.service.IAsArticleClassifyService;
import com.ruoyi.system.service.IAsArticleService;
import com.ruoyi.system.service.IRlArticleClassifyService;
import com.ruoyi.system.service.IRlArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -25,13 +25,13 @@ import java.util.List;
*/
@RestController
@RequestMapping("/admin/article")
public class AsArticleController extends BaseController
public class RlArticleController extends BaseController
{
@Autowired
private IAsArticleService asArticleService;
private IRlArticleService asArticleService;
@Autowired
private IAsArticleClassifyService asArticleClassifyService;
private IRlArticleClassifyService asArticleClassifyService;
/**
* 查询文章列表

View File

@ -0,0 +1,98 @@
package com.ruoyi.web.controller.rl;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.city.RlCity;
import com.ruoyi.system.service.IRlCityService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 城市Controller
*
* @author ruoyi
* @date 2024-09-18
*/
@RestController
@RequestMapping("/system/city")
public class RlCityController extends BaseController
{
@Resource
private IRlCityService rlCityService;
/**
* 查询城市列表
*/
@PreAuthorize("@ss.hasPermi('system:city:list')")
@GetMapping("/list")
public TableDataInfo list(RlCity rlCity)
{
startPage();
List<RlCity> list = rlCityService.selectRlCityList(rlCity);
return getDataTable(list);
}
/**
* 导出城市列表
*/
@PreAuthorize("@ss.hasPermi('system:city:export')")
@Log(title = "城市", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RlCity rlCity)
{
List<RlCity> list = rlCityService.selectRlCityList(rlCity);
ExcelUtil<RlCity> util = new ExcelUtil<RlCity>(RlCity.class);
util.exportExcel(response, list, "城市数据");
}
/**
* 获取城市详细信息
*/
@PreAuthorize("@ss.hasPermi('system:city:query')")
@GetMapping(value = "/{cityId}")
public AjaxResult getInfo(@PathVariable("cityId") Long cityId)
{
return success(rlCityService.selectRlCityByCityId(cityId));
}
/**
* 新增城市
*/
@PreAuthorize("@ss.hasPermi('system:city:add')")
@Log(title = "城市", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RlCity rlCity)
{
return toAjax(rlCityService.insertRlCity(rlCity));
}
/**
* 修改城市
*/
@PreAuthorize("@ss.hasPermi('system:city:edit')")
@Log(title = "城市", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RlCity rlCity)
{
return toAjax(rlCityService.updateRlCity(rlCity));
}
/**
* 删除城市
*/
@PreAuthorize("@ss.hasPermi('system:city:remove')")
@Log(title = "城市", businessType = BusinessType.DELETE)
@DeleteMapping("/{cityIds}")
public AjaxResult remove(@PathVariable Long[] cityIds)
{
return toAjax(rlCityService.deleteRlCityByCityIds(cityIds));
}
}

View File

@ -6,7 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.RlModel;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.service.IRlModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@ -1,337 +1,140 @@
//package com.ruoyi.common.utils.map;
//
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONArray;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import lombok.SneakyThrows;
//import lombok.experimental.UtilityClass;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.io.FileUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.geotools.data.DataUtilities;
//import org.geotools.data.collection.ListFeatureCollection;
//import org.geotools.feature.FeatureCollection;
//import org.geotools.feature.simple.SimpleFeatureBuilder;
//import org.geotools.geojson.feature.FeatureJSON;
//import org.geotools.geojson.geom.GeometryJSON;
//import org.geotools.geometry.jts.JTS;
//import org.geotools.referencing.CRS;
//import org.geotools.referencing.crs.DefaultGeographicCRS;
//import org.locationtech.jts.geom.Point;
//import org.locationtech.jts.geom.*;
//import org.locationtech.jts.io.WKTReader;
//import org.locationtech.jts.io.WKTWriter;
//import org.opengis.feature.simple.SimpleFeature;
//import org.opengis.feature.simple.SimpleFeatureType;
//import org.opengis.referencing.operation.MathTransform;
//
//import java.io.File;
//import java.util.Collection;
//import java.util.Collections;
//import java.util.List;
//
//
///**
// * GeoUtils.
// *
// * @author qiuzhenzhao
// * @date 2024/04/19
// */
//@Slf4j
//@UtilityClass
//public class GeoUtils {
// private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory();
// private static final String AUTO = "AUTO:42001,%s,%s";
// private static final WKTWriter WKT_WRITER = new WKTWriter();
// private static final WKTReader WKT_READER = new WKTReader();
package com.ruoyi.common.utils.map;
import com.alibaba.fastjson2.JSONArray;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.io.WKTWriter;
import java.util.Collection;
/**
* GeoUtils.
*
* @author qiuzhenzhao
* @date 2024/04/19
*/
@Slf4j
@UtilityClass
public class GeoUtils {
private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory();
private static final String AUTO = "AUTO:42001,%s,%s";
private static final WKTWriter WKT_WRITER = new WKTWriter();
private static final WKTReader WKT_READER = new WKTReader();
// private static final GeometryJSON GEOMETRY_JSON = new GeometryJSON(15);
// private final static FeatureJSON FEATURE_JSON = new FeatureJSON(GEOMETRY_JSON);
//
// private static final double EARTH_RADIUS = 6371000; // 地球半径单位
//
// /**
// * 合并多边形 Geographic
// * */
// public Geometry union(Collection<Geometry> geometries) {
// return GEOMETRY_FACTORY.buildGeometry(geometries).union();
// }
//
// /**
// * geometry转geojson
// * */
// @SneakyThrows
// public String geoJson(Geometry geometry) {
// SimpleFeatureType type = DataUtilities.createType("Link", "geometry:" + geometry.getGeometryType());
// SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(type);
// featureBuilder.add(geometry);
// SimpleFeature feature = featureBuilder.buildFeature(null);
// FeatureCollection<?, ?> featureCollection = new ListFeatureCollection(type, Collections.singletonList(feature));
// return FEATURE_JSON.toString(featureCollection);
// }
//
// /**
// * 定的geometry对象转换为GeoJSON格式并将其写入到指定的file中
// * */
// @SneakyThrows
// public void geoJson(Geometry geometry, File file) {
// SimpleFeatureType type = DataUtilities.createType("Link", "geometry:" + geometry.getGeometryType());
// SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(type);
// featureBuilder.add(geometry);
// SimpleFeature feature = featureBuilder.buildFeature(null);
// FeatureCollection<?, ?> featureCollection = new ListFeatureCollection(type, Collections.singletonList(feature));
// FEATURE_JSON.writeFeatureCollection(featureCollection, FileUtils.openOutputStream(file));
// }
// /**
// * wkt转Geometry对象
// * wkt格式POLYGON((x1 y1,x2 y2,x3 y3,x4 y4,x1 y1))
// * */
// public Geometry fromWkt(String wkt) {
// if (StringUtils.isBlank(wkt)) {
// return null;
// }
// try {
// return WKT_READER.read(wkt);
// } catch (Exception e) {
// log.warn(e.getMessage(), e);
// return null;
// }
// }
// /**
// * json转Geometry对象
// * 格式[[120.356267,26.941506],[120.357168,26.941262],[120.35697,26.940564]]
// * */
// public Geometry toGeometry(String json) {
// if (StringUtils.isBlank(json)) {
// return null;
// }
// try {
// // 将json转成二位数组并形成闭合
// double[][] coordinates = transform(json);
// log.info("coordinates:{}", JSON.toJSONString(coordinates));
// // 构建坐标数组
// Coordinate[] points = new Coordinate[coordinates.length];
// for (int i = 0; i < coordinates.length; i++) {
// double lon = coordinates[i][0];
// double lat = coordinates[i][1];
// points[i] = new Coordinate(lon, lat);
// }
// // 创建LinearRing对象
// LinearRing linearRing = GEOMETRY_FACTORY.createLinearRing(points);
// // 创建Polygon对象
// Polygon polygon = GEOMETRY_FACTORY.createPolygon(linearRing);
// return polygon;
// } catch (Exception e) {
// log.warn(e.getMessage(), e);
// return null;
// }
// }
//
// /**
// * json转Geometry对象 直线
// * 格式[[120.356267,26.941506],[120.357168,26.941262],[120.35697,26.940564]]
// * */
// public Geometry toGeometryByLinearRing(String json) {
// if (StringUtils.isBlank(json)) {
// return null;
// }
// try {
// // 将json转成二位数组
// double[][] coordinates = transform(json);
// log.info("coordinates:{}", JSON.toJSONString(coordinates));
// // 构建坐标数组
// Coordinate[] points = new Coordinate[coordinates.length];
// for (int i = 0; i < coordinates.length; i++) {
// double lon = coordinates[i][0];
// double lat = coordinates[i][1];
// points[i] = new Coordinate(lon, lat);
// }
// // 创建LineString对象
// LineString lineString = GEOMETRY_FACTORY.createLineString(points);
// return lineString;
// } catch (Exception e) {
// log.warn(e.getMessage(), e);
// return null;
// }
// }
//
// /**
// * 将json转成二位数组
// * */
// public double[][] transform(String json) {
// // 使用 Jackson 库解析 JSON 字符串为二维数组
// ObjectMapper objectMapper = new ObjectMapper();
// double[][] coordinates;
// try {
// coordinates = objectMapper.readValue(json, double[][].class);
// } catch (Exception e) {
// e.printStackTrace();
// return null;
// }
// // 添加闭合多边形的最后一个点
// int numPoints = coordinates.length;
// double[][] closedCoordinates = new double[numPoints + 1][2];
// for (int i = 0; i < numPoints; i++) {
// closedCoordinates[i] = coordinates[i];
// }
// closedCoordinates[numPoints] = coordinates[0]; // 将第一个点复制到最后一个点
// return closedCoordinates;
// }
//
//
//
// /**
// * Geometry对象转wkt
// * */
// public String wkt(Geometry geometry) {
// if (geometry == null) {
// return null;
// }
// try {
// return WKT_WRITER.write(geometry);
// } catch (Exception e) {
// log.warn(e.getMessage(), e);
// return null;
// }
// }
// /**
// * JSON转Geometry
// * */
// public Geometry fromJson(String json) {
// if (StringUtils.isBlank(json)) {
// return null;
// }
// try {
// return GEOMETRY_JSON.read(json);
// } catch (Exception e) {
// log.warn(e.getMessage(), e);
// return null;
// }
// }
// /**
// * 计算Geometry的面积
// * */
// @SneakyThrows
// public Double calcArea(Geometry geometry) {
// Point centroid = geometry.getCentroid();
// MathTransform mathTransform = CRS.findMathTransform(DefaultGeographicCRS.WGS84,
// CRS.decode(String.format(AUTO, centroid.getX(), centroid.getY())));
// Geometry transform = JTS.transform(geometry, mathTransform);
// return transform.getArea();
// }
//
// /**
// * 判断经纬度是否在多边形区域内
// * */
// public boolean isInCircle(String longitude, String latitude,Geometry polygon){
// /**创建一个点*/
// GeometryFactory geometryFactory = new GeometryFactory();
// Coordinate coordinate = new Coordinate(Double.parseDouble(longitude), Double.parseDouble(latitude));
// Point point = geometryFactory.createPoint(coordinate);
// return polygon.contains(point);
// }
//
// /**
// * 判断一个点是否在一个圆形区域内考虑误差距离
// * */
// public static boolean isInPolygonWithTolerance(String longitude, String latitude, Geometry polygon, double tolerance) {
// double lon = Double.parseDouble(longitude);
// double lat = Double.parseDouble(latitude);
//
// GeometryFactory geometryFactory = new GeometryFactory();
// Coordinate coordinate = new Coordinate(lon, lat);
// Point point = geometryFactory.createPoint(coordinate);
//
// if (polygon.contains(point)) {
// return true;
// } else {
// // 获取多边形的外边界
// Coordinate[] coordinates = polygon.getCoordinates();
// for (Coordinate coord : coordinates) {
// double distance = calculateDistance(lat, lon, coord.y, coord.x);
// log.info("距离----distance:{}",distance);
// if (distance <= tolerance) {
// return true;
// }
// }
// return false;
// }
// }
//
// // 将角度转换为弧度
// private static double deg2rad(double deg) {
// return deg * (Math.PI / 180);
// }
//
// // 使用 Haversine 公式计算两点间的距离
// public static double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
// double dLat = deg2rad(lat2 - lat1);
// double dLon = deg2rad(lon1 - lon2); // 修正此处为 (lon1 - lon2)
// double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
// Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
// Math.sin(dLon / 2) * Math.sin(dLon / 2);
// double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
// return EARTH_RADIUS * c;
// }
//
// public static double[][] parseJsonTrack(String jsonString) {
// JSONArray jsonArray = JSONArray.parseArray(jsonString);
// double[][] track = new double[jsonArray.size()][2];
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONArray coord = jsonArray.getJSONArray(i);
// track[i][0] = coord.getDouble(0);
// track[i][1] = coord.getDouble(1);
// }
// return track;
// }
//
// /**
// * 计算一段轨迹的总距离
// * */
// public static double calculateTotalDistance(double[][] track) {
// double totalDistance = 0;
// for (int i = 0; i < track.length - 1; i++) {
// totalDistance += haversineDistance(track[i], track[i + 1]);
// }
// return totalDistance;
// }
//
// public static double haversineDistance(double[] coord1, double[] coord2) {
// double lat1 = deg2rad(coord1[1]);
// double lon1 = deg2rad(coord1[0]);
// double lat2 = deg2rad(coord2[1]);
// double lon2 = deg2rad(coord2[0]);
//
// double dLat = lat2 - lat1;
// double dLon = lon2 - lon1;
//
// double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
// Math.cos(lat1) * Math.cos(lat2) *
// Math.sin(dLon / 2) * Math.sin(dLon / 2);
//
// double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
//
// return EARTH_RADIUS * c; // 距离
// }
//
// /**
// * 判获取到最近一个运营区
// * */
// public static boolean getNearestOperatingArea (String longitude, String latitude, List<Geometry> polygon) {
// double lon = Double.parseDouble(longitude);
// double lat = Double.parseDouble(latitude);
//
// GeometryFactory geometryFactory = new GeometryFactory();
// Coordinate coordinate = new Coordinate(lon, lat);
// Point point = geometryFactory.createPoint(coordinate);
//
// for (Geometry geometry : polygon) {
// if (geometry.contains(point)) {
// return true;
// }else{
//
// }
// }
// return false;
// }
//
//}
private static final double EARTH_RADIUS = 6371000; // 地球半径单位
/**
* 合并多边形 Geographic
* */
public Geometry union(Collection<Geometry> geometries) {
return GEOMETRY_FACTORY.buildGeometry(geometries).union();
}
/**
* 判断经纬度是否在多边形区域内
* */
public boolean isInCircle(String longitude, String latitude,Geometry polygon){
/**创建一个点*/
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate coordinate = new Coordinate(Double.parseDouble(longitude), Double.parseDouble(latitude));
Point point = geometryFactory.createPoint(coordinate);
return polygon.contains(point);
}
/**
* 判断一个点是否在一个圆形区域内考虑误差距离
* */
public static boolean isInPolygonWithTolerance(String longitude, String latitude, Geometry polygon, double tolerance) {
double lon = Double.parseDouble(longitude);
double lat = Double.parseDouble(latitude);
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate coordinate = new Coordinate(lon, lat);
Point point = geometryFactory.createPoint(coordinate);
if (polygon.contains(point)) {
return true;
} else {
// 获取多边形的外边界
Coordinate[] coordinates = polygon.getCoordinates();
for (Coordinate coord : coordinates) {
double distance = calculateDistance(lat, lon, coord.y, coord.x);
log.info("距离----distance:{}",distance);
if (distance <= tolerance) {
return true;
}
}
return false;
}
}
// 将角度转换为弧度
private static double deg2rad(double deg) {
return deg * (Math.PI / 180);
}
// 使用 Haversine 公式计算两点间的距离
public static double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
double dLat = deg2rad(lat2 - lat1);
double dLon = deg2rad(lon1 - lon2); // 修正此处为 (lon1 - lon2)
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EARTH_RADIUS * c;
}
public static double[][] parseJsonTrack(String jsonString) {
JSONArray jsonArray = JSONArray.parseArray(jsonString);
double[][] track = new double[jsonArray.size()][2];
for (int i = 0; i < jsonArray.size(); i++) {
JSONArray coord = jsonArray.getJSONArray(i);
track[i][0] = coord.getDouble(0);
track[i][1] = coord.getDouble(1);
}
return track;
}
/**
* 计算一段轨迹的总距离
* */
public static double calculateTotalDistance(double[][] track) {
double totalDistance = 0;
for (int i = 0; i < track.length - 1; i++) {
totalDistance += haversineDistance(track[i], track[i + 1]);
}
return totalDistance;
}
/**
* 计算两点之间的距离
* */
public static double haversineDistance(double[] coord1, double[] coord2) {
double lat1 = deg2rad(coord1[1]);
double lon1 = deg2rad(coord1[0]);
double lat2 = deg2rad(coord2[1]);
double lon2 = deg2rad(coord2[0]);
double dLat = lat2 - lat1;
double dLon = lon2 - lon1;
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(lat1) * Math.cos(lat2) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EARTH_RADIUS * c; // 距离
}
}

View File

@ -0,0 +1,57 @@
package com.ruoyi.system.domain.agent;
import java.math.BigDecimal;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 代理商对象 rl_agent
*
* @author qzz
* @date 2024-09-18
*/
@Data
public class RlAgent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long agentId;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 客服电话 */
@Excel(name = "客服电话")
private String servicePhone;
/** 调度费 */
@Excel(name = "调度费")
private BigDecimal dispatchFee;
/** 配送费 */
@Excel(name = "配送费")
private BigDecimal deliveryFee;
/** 城市id */
@Excel(name = "城市id")
private Long cityId;
/** 联系人 */
@Excel(name = "联系人")
private String contact;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 绑定系统用户id */
@Excel(name = "绑定系统用户id")
private Long sysUserid;
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.system.domain.agent;
import lombok.Data;
@Data
public class RlAgentQuery extends RlAgent{
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.domain.agent;
import lombok.Data;
@Data
public class RlAgentVO extends RlAgent{
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.system.domain.city;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 城市对象 rl_city
*
* @author ruoyi
* @date 2024-09-18
*/
@Data
public class RlCity extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 城市id */
private Long cityId;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 拼音 */
@Excel(name = "拼音")
private String pinyin;
/** 行政级别 */
@Excel(name = "行政级别")
private String level;
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.system.domain.city;
import lombok.Data;
@Data
public class RlCityQuery extends RlCity{
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.system.domain.city;
import lombok.Data;
/**
* 城市对象 rl_city
*
* @author ruoyi
* @date 2024-09-18
*/
@Data
public class RlCityVO extends RlCity
{
}

View File

@ -1,7 +1,8 @@
package com.ruoyi.system.domain;
package com.ruoyi.system.domain.model;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Builder;
import lombok.Data;
/**
@ -11,6 +12,7 @@ import lombok.Data;
* @date 2024-05-13
*/
@Data
//@Builder
public class RlModel extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -22,9 +24,9 @@ public class RlModel extends BaseEntity
@Excel(name = "车型")
private String model;
/** 品牌商 */
@Excel(name = "品牌")
private String brand;
/** 代理商 */
@Excel(name = "代理")
private Long agentId;
/** 满电电压 */
@Excel(name = "满电电压")
@ -38,7 +40,8 @@ public class RlModel extends BaseEntity
@Excel(name = "满电续航")
private Integer fullEndurance;
/** 已投放车辆数 */
private Integer deviceNum;
/** 简介 */
@Excel(name = "简介")
private String intro;
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.system.domain.model;
import lombok.Data;
@Data
public class RlModelQuery extends RlModel{
}

View File

@ -43,6 +43,10 @@ public class Store extends BaseEntity
@NotNull(message = "用户id不能为空", groups = {ValidGroup.Create.class})
private Long userId;
/** 代理商 */
@Excel(name = "代理商")
private Long agentId;
/** 店铺图片 */
@Excel(name = "店铺图片")
private String picture;

View File

@ -46,4 +46,10 @@ public class StoreQuery extends Store {
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("手机经度")
private String phoneLon;
@ApiModelProperty("手机纬度")
private String phoneLat;
}

View File

@ -17,25 +17,8 @@ public class StoreVo extends Store {
@ApiModelProperty("该店铺下的设备数量")
private Integer deviceCount;
@ApiModelProperty("绑定用户名称")
private String userName;
@ApiModelProperty("距离")
private double distance;
@ApiModelProperty("本日收入")
private BigDecimal todayIncome;
@ApiModelProperty("本月收入")
private BigDecimal monthIncome;
@ApiModelProperty("上月收入")
private BigDecimal lastMonthIncome;
@ApiModelProperty("在线设备数量")
private Integer onlineCount;
@ApiModelProperty("离线设备数量")
private Integer offlineCount;
@ApiModelProperty("可共享的设备数量")
private Integer availableDeviceCount;
}

View File

@ -0,0 +1,70 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.agent.RlAgent;
import java.util.List;
/**
* 代理商Mapper接口
*
* @author qzz
* @date 2024-09-18
*/
public interface RlAgentMapper
{
/**
* 查询代理商
*
* @param agentId 代理商主键
* @return 代理商
*/
public RlAgent selectRlAgentByAgentId(Long agentId);
/**
* 根据城市id查询代理商
*
* @param cityId 城市id
* @return 代理商
*/
public RlAgent selectRlAgentByCityId(Long cityId);
/**
* 查询代理商列表
*
* @param rlAgent 代理商
* @return 代理商集合
*/
public List<RlAgent> selectRlAgentList(RlAgent rlAgent);
/**
* 新增代理商
*
* @param rlAgent 代理商
* @return 结果
*/
public int insertRlAgent(RlAgent rlAgent);
/**
* 修改代理商
*
* @param rlAgent 代理商
* @return 结果
*/
public int updateRlAgent(RlAgent rlAgent);
/**
* 删除代理商
*
* @param agentId 代理商主键
* @return 结果
*/
public int deleteRlAgentByAgentId(Long agentId);
/**
* 批量删除代理商
*
* @param agentIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteRlAgentByAgentIds(Long[] agentIds);
}

View File

@ -10,7 +10,7 @@ import java.util.List;
*
* @author ruoyi
*/
public interface AsArticleClassifyMapper
public interface RlArticleClassifyMapper
{
/**
* 查询分类管理数据

View File

@ -10,7 +10,7 @@ import java.util.List;
* @author qiuzhenzhao
* @date 2023-12-06
*/
public interface AsArticleMapper
public interface RlArticleMapper
{
/**
* 查询文章

View File

@ -0,0 +1,62 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.city.RlCity;
import java.util.List;
/**
* 城市Mapper接口
*
* @author ruoyi
* @date 2024-09-18
*/
public interface RlCityMapper
{
/**
* 查询城市
*
* @param cityId 城市主键
* @return 城市
*/
public RlCity selectRlCityByCityId(Long cityId);
/**
* 查询城市列表
*
* @param rlCity 城市
* @return 城市集合
*/
public List<RlCity> selectRlCityList(RlCity rlCity);
/**
* 新增城市
*
* @param rlCity 城市
* @return 结果
*/
public int insertRlCity(RlCity rlCity);
/**
* 修改城市
*
* @param rlCity 城市
* @return 结果
*/
public int updateRlCity(RlCity rlCity);
/**
* 删除城市
*
* @param cityId 城市主键
* @return 结果
*/
public int deleteRlCityByCityId(Long cityId);
/**
* 批量删除城市
*
* @param cityIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteRlCityByCityIds(Long[] cityIds);
}

View File

@ -1,6 +1,6 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.RlModel;
import com.ruoyi.system.domain.model.RlModel;
import java.util.List;
@ -28,6 +28,14 @@ public interface RlModelMapper
*/
public List<RlModel> selectEModelList(RlModel etModel);
/**
* 查询车辆型号列表
*
* @param agentId 代理商id
* @return 车辆型号集合
*/
public List<RlModel> selectEModelListByAgentId(Long agentId);
/**
* 新增车辆型号
*

View File

@ -0,0 +1,70 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.agent.RlAgent;
import java.util.List;
/**
* 代理商Service接口
*
* @author qzz
* @date 2024-09-18
*/
public interface IRlAgentService
{
/**
* 查询代理商
*
* @param agentId 代理商主键
* @return 代理商
*/
public RlAgent selectRlAgentByAgentId(Long agentId);
/**
* 根据城市id查询代理商
*
* @param cityId 城市id
* @return 代理商
*/
public RlAgent selectRlAgentByCityId(Long cityId);
/**
* 查询代理商列表
*
* @param rlAgent 代理商
* @return 代理商集合
*/
public List<RlAgent> selectRlAgentList(RlAgent rlAgent);
/**
* 新增代理商
*
* @param rlAgent 代理商
* @return 结果
*/
public int insertRlAgent(RlAgent rlAgent);
/**
* 修改代理商
*
* @param rlAgent 代理商
* @return 结果
*/
public int updateRlAgent(RlAgent rlAgent);
/**
* 批量删除代理商
*
* @param agentIds 需要删除的代理商主键集合
* @return 结果
*/
public int deleteRlAgentByAgentIds(Long[] agentIds);
/**
* 删除代理商信息
*
* @param agentId 代理商主键
* @return 结果
*/
public int deleteRlAgentByAgentId(Long agentId);
}

View File

@ -10,7 +10,7 @@ import java.util.List;
*
* @author ruoyi
*/
public interface IAsArticleClassifyService
public interface IRlArticleClassifyService
{
/**
* 查询分类管理数据

View File

@ -10,7 +10,7 @@ import java.util.List;
* @author qiuzhenzhao
* @date 2023-12-06
*/
public interface IAsArticleService
public interface IRlArticleService
{
/**
* 查询文章

View File

@ -0,0 +1,72 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.city.RlCity;
import java.util.List;
/**
* 城市Service接口
*
* @author ruoyi
* @date 2024-09-18
*/
public interface IRlCityService
{
/**
* 查询城市
*
* @param cityId 城市主键
* @return 城市
*/
public RlCity selectRlCityByCityId(Long cityId);
/**
* 查询城市列表
*
* @param rlCity 城市
* @return 城市集合
*/
public List<RlCity> selectRlCityList(RlCity rlCity);
/**
* 新增城市
*
* @param rlCity 城市
* @return 结果
*/
public int insertRlCity(RlCity rlCity);
/**
* 修改城市
*
* @param rlCity 城市
* @return 结果
*/
public int updateRlCity(RlCity rlCity);
/**
* 批量删除城市
*
* @param cityIds 需要删除的城市主键集合
* @return 结果
*/
public int deleteRlCityByCityIds(Long[] cityIds);
/**
* 删除城市信息
*
* @param cityId 城市主键
* @return 结果
*/
public int deleteRlCityByCityId(Long cityId);
/**
* 根据定位获取哪个城市
*/
String getCityByLocation(String lon, String lat);
/**
* 根据定位获取地址
*/
String getAddressByLocation(String lon, String lat);
}

View File

@ -1,6 +1,6 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.RlModel;
import com.ruoyi.system.domain.model.RlModel;
import java.util.List;
@ -28,6 +28,15 @@ public interface IRlModelService
*/
public List<RlModel> selectEModelList(RlModel etModel);
/**
* 根据代理商id查询车辆型号列表
*
* @param agentId 代理商id
* @return 车辆型号集合
*/
public List<RlModel> selectEModelListByAgentId(Long agentId);
/**
* 新增车辆型号
*

View File

@ -0,0 +1,109 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.agent.RlAgent;
import com.ruoyi.system.mapper.RlAgentMapper;
import com.ruoyi.system.service.IRlAgentService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 代理商Service业务层处理
*
* @author qzz
* @date 2024-09-18
*/
@Service
public class RlAgentServiceImpl implements IRlAgentService
{
@Resource
private RlAgentMapper rlAgentMapper;
/**
* 查询代理商
*
* @param agentId 代理商主键
* @return 代理商
*/
@Override
public RlAgent selectRlAgentByAgentId(Long agentId)
{
return rlAgentMapper.selectRlAgentByAgentId(agentId);
}
/**
* 根据城市id查询代理商
*
* @param cityId 城市id
* @return 代理商
*/
@Override
public RlAgent selectRlAgentByCityId(Long cityId)
{
return rlAgentMapper.selectRlAgentByCityId(cityId);
}
/**
* 查询代理商列表
*
* @param rlAgent 代理商
* @return 代理商
*/
@Override
public List<RlAgent> selectRlAgentList(RlAgent rlAgent)
{
return rlAgentMapper.selectRlAgentList(rlAgent);
}
/**
* 新增代理商
*
* @param rlAgent 代理商
* @return 结果
*/
@Override
public int insertRlAgent(RlAgent rlAgent)
{
return rlAgentMapper.insertRlAgent(rlAgent);
}
/**
* 修改代理商
*
* @param rlAgent 代理商
* @return 结果
*/
@Override
public int updateRlAgent(RlAgent rlAgent)
{
return rlAgentMapper.updateRlAgent(rlAgent);
}
/**
* 批量删除代理商
*
* @param agentIds 需要删除的代理商主键
* @return 结果
*/
@Override
public int deleteRlAgentByAgentIds(Long[] agentIds)
{
return rlAgentMapper.deleteRlAgentByAgentIds(agentIds);
}
/**
* 删除代理商信息
*
* @param agentId 代理商主键
* @return 结果
*/
@Override
public int deleteRlAgentByAgentId(Long agentId)
{
return rlAgentMapper.deleteRlAgentByAgentId(agentId);
}
}

View File

@ -10,8 +10,8 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.mapper.AsArticleClassifyMapper;
import com.ruoyi.system.service.IAsArticleClassifyService;
import com.ruoyi.system.mapper.RlArticleClassifyMapper;
import com.ruoyi.system.service.IRlArticleClassifyService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -26,10 +26,10 @@ import java.util.stream.Collectors;
* @author ruoyi
*/
@Service
public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService
public class RlArticleClassifyServiceImpl implements IRlArticleClassifyService
{
@Resource
private AsArticleClassifyMapper articleClassifyMapper;
private RlArticleClassifyMapper articleClassifyMapper;
/**
* 查询分类管理数据

View File

@ -4,9 +4,9 @@ import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.AsArticleClassify;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.EtArticle;
import com.ruoyi.system.mapper.AsArticleClassifyMapper;
import com.ruoyi.system.mapper.AsArticleMapper;
import com.ruoyi.system.service.IAsArticleService;
import com.ruoyi.system.mapper.RlArticleClassifyMapper;
import com.ruoyi.system.mapper.RlArticleMapper;
import com.ruoyi.system.service.IRlArticleService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
@ -23,13 +23,13 @@ import java.util.Set;
* @date 2023-12-06
*/
@Service
public class AsArticleServiceImpl implements IAsArticleService
public class RlArticleServiceImpl implements IRlArticleService
{
@Resource
private AsArticleMapper asArticleMapper;
private RlArticleMapper rlArticleMapper;
@Resource
private AsArticleClassifyMapper articleClassifyMapper;
private RlArticleClassifyMapper articleClassifyMapper;
//
// @Resource
// private EtOperatingAreaMapper etOperatingAreaMapper;
@ -46,7 +46,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@Override
public EtArticle selectAsArticleByArticleId(Long articleId)
{
EtArticle etArticle = asArticleMapper.selectAsArticleByArticleId(articleId);
EtArticle etArticle = rlArticleMapper.selectAsArticleByArticleId(articleId);
if(ObjectUtils.isNotEmpty(etArticle)){
etArticle.setFormatCreateTime(DateUtils.getYYYY_MM_DD(etArticle.getCreateTime()));
}
@ -63,7 +63,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@DataScope(deptAlias = "d")
public List<EtArticle> selectAsArticleListByIsolate(EtArticle etArticle)
{
List<EtArticle> etArticles = asArticleMapper.selectAsArticleList(etArticle);
List<EtArticle> etArticles = rlArticleMapper.selectAsArticleList(etArticle);
// for (EtArticle etArticle1 : etArticles) {
// EtOperatingArea area = etOperatingAreaMapper.selectEtOperatingAreaByAreaId(etArticle1.getAreaId());
// SysDept sysDept = wxPayService.getDeptObjByAreaId(etArticle1.getAreaId());
@ -87,7 +87,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@Override
public List<EtArticle> selectAsArticleList(EtArticle etArticle)
{
List<EtArticle> etArticles = asArticleMapper.selectAsArticleList(etArticle);
List<EtArticle> etArticles = rlArticleMapper.selectAsArticleList(etArticle);
for (EtArticle etArticle1 : etArticles) {
etArticle.setFormatCreateTime(DateUtils.getYYYY_MM_DD(etArticle1.getCreateTime()));
}
@ -103,7 +103,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@Override
public List<EtArticle> selectAsArticleListByApp(EtArticle etArticle)
{
List<EtArticle> etArticles = asArticleMapper.selectAsArticleListByApp(etArticle);
List<EtArticle> etArticles = rlArticleMapper.selectAsArticleListByApp(etArticle);
List<EtArticle> mergedArticles = new ArrayList<>();
Set<String> seenArticleIds = new HashSet<>();
@ -120,7 +120,7 @@ public class AsArticleServiceImpl implements IAsArticleService
for (AsArticleClassify classify : classifies) {
EtArticle etArticle2 = new EtArticle();
etArticle2.setClassifyId(classify.getClassifyId().toString());
List<EtArticle> etArticles1 = asArticleMapper.selectAsArticleList(etArticle2);
List<EtArticle> etArticles1 = rlArticleMapper.selectAsArticleList(etArticle2);
for (EtArticle etArticle2Item : etArticles1) {
if (seenArticleIds.add(etArticle2Item.getArticleId().toString())) {
mergedArticles.add(etArticle2Item);
@ -143,7 +143,7 @@ public class AsArticleServiceImpl implements IAsArticleService
public int insertAsArticle(EtArticle etArticle)
{
etArticle.setCreateTime(DateUtils.getNowDate());
return asArticleMapper.insertAsArticle(etArticle);
return rlArticleMapper.insertAsArticle(etArticle);
}
/**
@ -156,7 +156,7 @@ public class AsArticleServiceImpl implements IAsArticleService
public int updateAsArticle(EtArticle etArticle)
{
etArticle.setUpdateTime(DateUtils.getNowDate());
return asArticleMapper.updateAsArticle(etArticle);
return rlArticleMapper.updateAsArticle(etArticle);
}
/**
@ -168,7 +168,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@Override
public int deleteAsArticleByArticleIds(Long[] articleIds)
{
return asArticleMapper.deleteAsArticleByArticleIds(articleIds);
return rlArticleMapper.deleteAsArticleByArticleIds(articleIds);
}
/**
@ -180,7 +180,7 @@ public class AsArticleServiceImpl implements IAsArticleService
@Override
public int deleteAsArticleByArticleId(Long articleId)
{
return asArticleMapper.deleteAsArticleByArticleId(articleId);
return rlArticleMapper.deleteAsArticleByArticleId(articleId);
}
/**
@ -191,7 +191,7 @@ public class AsArticleServiceImpl implements IAsArticleService
*/
@Override
public String[] getTagList(Long articleId) {
EtArticle etArticle = asArticleMapper.selectAsArticleByArticleId(articleId);
EtArticle etArticle = rlArticleMapper.selectAsArticleByArticleId(articleId);
String tag = etArticle.getTag();
String[] split = tag.split(",");
return split;

View File

@ -0,0 +1,151 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.city.RlCity;
import com.ruoyi.system.mapper.RlCityMapper;
import com.ruoyi.system.service.IRlCityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 城市Service业务层处理
*
* @author ruoyi
* @date 2024-09-18
*/
@Slf4j
@Service
public class RlCityServiceImpl implements IRlCityService
{
public static final String GEO_WEB_KEY = SpringUtils.getRequiredProperty("geo.key");
@Resource
private RlCityMapper rlCityMapper;
/**
* 查询城市
*
* @param cityId 城市主键
* @return 城市
*/
@Override
public RlCity selectRlCityByCityId(Long cityId)
{
return rlCityMapper.selectRlCityByCityId(cityId);
}
/**
* 查询城市列表
*
* @param rlCity 城市
* @return 城市
*/
@Override
public List<RlCity> selectRlCityList(RlCity rlCity)
{
return rlCityMapper.selectRlCityList(rlCity);
}
/**
* 新增城市
*
* @param rlCity 城市
* @return 结果
*/
@Override
public int insertRlCity(RlCity rlCity)
{
return rlCityMapper.insertRlCity(rlCity);
}
/**
* 修改城市
*
* @param rlCity 城市
* @return 结果
*/
@Override
public int updateRlCity(RlCity rlCity)
{
return rlCityMapper.updateRlCity(rlCity);
}
/**
* 批量删除城市
*
* @param cityIds 需要删除的城市主键
* @return 结果
*/
@Override
public int deleteRlCityByCityIds(Long[] cityIds)
{
return rlCityMapper.deleteRlCityByCityIds(cityIds);
}
/**
* 删除城市信息
*
* @param cityId 城市主键
* @return 结果
*/
@Override
public int deleteRlCityByCityId(Long cityId)
{
return rlCityMapper.deleteRlCityByCityId(cityId);
}
/**
* 根据定位获取哪个城市
*/
@Override
public String getCityByLocation(String lon, String lat) {
String city = null;
try {
String location = lon + "," + lat;
String url = StrUtil.format("https://restapi.amap.com/v3/geocode/regeo?key={}&location={}&&radius=1000&extensions=all", GEO_WEB_KEY, location);
String result = HttpUtils.sendGet(url);
// log.info("【根据定位获取地址】请求结果result:{}",result);
//将json字符串转换为Object
JSONObject jsonObject = JSONObject.parseObject(result,JSONObject.class);
JSONObject regeocode1 = jsonObject.getJSONObject("regeocode");
JSONObject addressComponent = regeocode1.getJSONObject("addressComponent");
city = addressComponent.getString("city");
// log.info("【根据定位获取地址】address=:【{}】",result);
return city;
} catch (Exception e) {
log.error("【根据定位获取地址】转换地址报错", e);
}
return city;
}
/**
* 根据定位获取哪个城市
*/
@Override
public String getAddressByLocation(String lon, String lat) {
String address = null;
try {
String location = lon + "," + lat;
String url = StrUtil.format("https://restapi.amap.com/v3/geocode/regeo?key={}&location={}&&radius=1000&extensions=all", GEO_WEB_KEY, location);
String result = HttpUtils.sendGet(url);
// log.info("【根据定位获取地址】请求结果result:{}",result);
//将json字符串转换为Object
JSONObject jsonObject = JSONObject.parseObject(result,JSONObject.class);
JSONObject regeocode1 = jsonObject.getJSONObject("regeocode");
address = regeocode1.getString("formatted_address");
// log.info("【根据定位获取地址】address=:【{}】",result);
return address;
} catch (Exception e) {
log.error("【根据定位获取地址】转换地址报错", e);
}
return address;
}
}

View File

@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.RlDevice;
import com.ruoyi.system.domain.RlModel;
import com.ruoyi.system.domain.model.RlModel;
import com.ruoyi.system.mapper.RlModelMapper;
import com.ruoyi.system.service.IRlDeviceService;
import com.ruoyi.system.service.IRlModelService;
@ -46,7 +46,7 @@ public class RlModelServiceImpl implements IRlModelService
RlModel etModel = rlModelMapper.selectEModelByModelId(modelId);
if(ObjectUtil.isNotNull(etModel)){
Integer allNum = eDeviceService.selectCountByModelId(modelId);
etModel.setDeviceNum(allNum);
// etModel.setDeviceNum(allNum);
}
return etModel;
}
@ -67,11 +67,24 @@ public class RlModelServiceImpl implements IRlModelService
RlDevice device = new RlDevice();
device.setModelId(model.getModelId());
Integer integer = eDeviceService.selectCountByModelId(model.getModelId());
model.setDeviceNum(integer);
// model.setDeviceNum(integer);
}
return etModels;
}
/**
* 查询车辆型号列表
*
* @param agentId 代理商id
* @return 车辆型号
*/
@Override
public List<RlModel> selectEModelListByAgentId(Long agentId)
{
List<RlModel> etModels = rlModelMapper.selectEModelListByAgentId(agentId);
return etModels;
}
/**
* 新增车辆型号
*

View File

@ -1,9 +1,11 @@
package com.ruoyi.system.service.store.impl;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.bean.collection.CollectionUtils;
import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.system.domain.store.*;
import com.ruoyi.system.domain.store.enums.StoreGroupBy;
import com.ruoyi.system.mapper.StoreMapper;
@ -16,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -72,7 +76,19 @@ public class StoreServiceImpl implements RlStoreService
@Override
public List<StoreVo> selectSmStoreList(StoreQuery store)
{
return storeMapper.selectSmStoreList(store);
List<StoreVo> storeVos = storeMapper.selectSmStoreList(store);
for (StoreVo storeVo:storeVos) {
BigDecimal lng = storeVo.getLng();
BigDecimal lat = storeVo.getLat();
if (lng != null && lat != null && StrUtil.isNotBlank(store.getPhoneLon()) && StrUtil.isNotBlank(store.getPhoneLat())) {
double[] point1 = {lng.doubleValue(), lat.doubleValue()};
double[] point2 = {Double.valueOf(store.getPhoneLon()), Double.valueOf(store.getPhoneLat())};
double distance = GeoUtils.haversineDistance(point1, point2);
BigDecimal distanceFormatted = new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP);
storeVo.setDistance(distanceFormatted.doubleValue());
}
}
return storeVos;
}
/**

View File

@ -0,0 +1,96 @@
<?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.ruoyi.system.mapper.RlAgentMapper">
<resultMap type="RlAgent" id="RlAgentResult">
<result property="agentId" column="agent_id" />
<result property="name" column="name" />
<result property="servicePhone" column="service_phone" />
<result property="dispatchFee" column="dispatch_fee" />
<result property="deliveryFee" column="delivery_fee" />
<result property="cityId" column="city_id" />
<result property="contact" column="contact" />
<result property="phone" column="phone" />
<result property="sysUserid" column="sys_userid" />
</resultMap>
<sql id="selectRlAgentVo">
select agent_id, name, service_phone, dispatch_fee, delivery_fee, city_id, contact, phone, sys_userid from rl_agent
</sql>
<select id="selectRlAgentList" parameterType="RlAgent" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="servicePhone != null and servicePhone != ''"> and service_phone = #{servicePhone}</if>
<if test="dispatchFee != null "> and dispatch_fee = #{dispatchFee}</if>
<if test="deliveryFee != null "> and delivery_fee = #{deliveryFee}</if>
<if test="cityId != null "> and city_id = #{cityId}</if>
<if test="contact != null and contact != ''"> and contact = #{contact}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="sysUserid != null "> and sys_userid = #{sysUserid}</if>
</where>
</select>
<select id="selectRlAgentByAgentId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
where agent_id = #{agentId}
</select>
<select id="selectRlAgentByCityId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
where city_id = #{cityId}
</select>
<insert id="insertRlAgent" parameterType="RlAgent" useGeneratedKeys="true" keyProperty="agentId">
insert into rl_agent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="servicePhone != null">service_phone,</if>
<if test="dispatchFee != null">dispatch_fee,</if>
<if test="deliveryFee != null">delivery_fee,</if>
<if test="cityId != null">city_id,</if>
<if test="contact != null">contact,</if>
<if test="phone != null">phone,</if>
<if test="sysUserid != null">sys_userid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="servicePhone != null">#{servicePhone},</if>
<if test="dispatchFee != null">#{dispatchFee},</if>
<if test="deliveryFee != null">#{deliveryFee},</if>
<if test="cityId != null">#{cityId},</if>
<if test="contact != null">#{contact},</if>
<if test="phone != null">#{phone},</if>
<if test="sysUserid != null">#{sysUserid},</if>
</trim>
</insert>
<update id="updateRlAgent" parameterType="RlAgent">
update rl_agent
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="servicePhone != null">service_phone = #{servicePhone},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="cityId != null">city_id = #{cityId},</if>
<if test="contact != null">contact = #{contact},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sysUserid != null">sys_userid = #{sysUserid},</if>
</trim>
where agent_id = #{agentId}
</update>
<delete id="deleteRlAgentByAgentId" parameterType="Long">
delete from rl_agent where agent_id = #{agentId}
</delete>
<delete id="deleteRlAgentByAgentIds" parameterType="String">
delete from rl_agent where agent_id in
<foreach item="agentId" collection="array" open="(" separator="," close=")">
#{agentId}
</foreach>
</delete>
</mapper>

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.AsArticleClassifyMapper">
<mapper namespace="com.ruoyi.system.mapper.RlArticleClassifyMapper">
<resultMap type="AsArticleClassify" id="AsArticleClassifyResult">
<id property="classifyId" column="classify_id" />

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.AsArticleMapper">
<mapper namespace="com.ruoyi.system.mapper.RlArticleMapper">
<resultMap type="EtArticle" id="AsArticleResult">
<result property="articleId" column="article_id" />

View File

@ -0,0 +1,66 @@
<?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.ruoyi.system.mapper.RlCityMapper">
<resultMap type="RlCity" id="RlCityResult">
<result property="cityId" column="city_id" />
<result property="name" column="name" />
<result property="pinyin" column="pinyin" />
<result property="level" column="level" />
</resultMap>
<sql id="selectRlCityVo">
select city_id, name, pinyin, level from rl_city
</sql>
<select id="selectRlCityList" parameterType="RlCity" resultMap="RlCityResult">
<include refid="selectRlCityVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
<if test="level != null and level != ''"> and level = #{level}</if>
</where>
</select>
<select id="selectRlCityByCityId" parameterType="Long" resultMap="RlCityResult">
<include refid="selectRlCityVo"/>
where city_id = #{cityId}
</select>
<insert id="insertRlCity" parameterType="RlCity" useGeneratedKeys="true" keyProperty="cityId">
insert into rl_city
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="pinyin != null">pinyin,</if>
<if test="level != null">level,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="pinyin != null">#{pinyin},</if>
<if test="level != null">#{level},</if>
</trim>
</insert>
<update id="updateRlCity" parameterType="RlCity">
update rl_city
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="pinyin != null">pinyin = #{pinyin},</if>
<if test="level != null">level = #{level},</if>
</trim>
where city_id = #{cityId}
</update>
<delete id="deleteRlCityByCityId" parameterType="Long">
delete from rl_city where city_id = #{cityId}
</delete>
<delete id="deleteRlCityByCityIds" parameterType="String">
delete from rl_city where city_id in
<foreach item="cityId" collection="array" open="(" separator="," close=")">
#{cityId}
</foreach>
</delete>
</mapper>

View File

@ -7,7 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlModel" id="EModelResult">
<result property="modelId" column="model_id" />
<result property="model" column="model" />
<result property="brand" column="brand" />
<result property="fullVoltage" column="full_voltage" />
<result property="lowVoltage" column="low_voltage" />
<result property="fullEndurance" column="full_endurance" />
@ -19,26 +18,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectEModelVo">
select model_id, model, brand, full_voltage, low_voltage, full_endurance, create_by, create_time, update_by, update_time, remark from rl_model
select model_id, model, full_voltage, low_voltage, full_endurance, create_by, create_time, update_by, update_time, remark from rl_model
</sql>
<select id="selectEModelList" parameterType="RlModel" resultMap="EModelResult">
select m.model_id, m.model, m.brand, m.full_voltage, m.low_voltage,
select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark from rl_model m
-- left join sys_dept d on d.dept_id = m.operator
where 1 = 1
<if test="model != null and model != ''"> and m.model = #{model}</if>
<if test="brand != null and brand != ''"> and m.brand = #{brand}</if>
<!-- 数据范围过滤 <if test="operator != null and operator != ''"> and m.operator = #{operator}</if> -->
${params.dataScope}
</select>
<select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult">
select m.model_id, m.model, m.brand, d.dept_name, m.full_voltage, m.low_voltage,
<select id="selectEModelListByAgentId" parameterType="RlModel" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark from rl_model m
where m.agent_id = #{agentId}
</select>
<select id="selectEModelByModelId" parameterType="Long" resultMap="EModelResult">
select m.model_id, m.model, m.full_voltage, m.low_voltage,
m.full_endurance, m.create_by, m.create_time,
m.update_by, m.update_time, m.remark from rl_model m
-- left join sys_dept d on d.dept_id = m.operator
where m.model_id = #{modelId}
</select>
@ -51,7 +54,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelId != null">model_id,</if>
<if test="model != null">model,</if>
<if test="brand != null">brand,</if>
<if test="fullVoltage != null">full_voltage,</if>
<if test="lowVoltage != null">low_voltage,</if>
<if test="fullEndurance != null">full_endurance,</if>
@ -64,7 +66,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId},</if>
<if test="model != null">#{model},</if>
<if test="brand != null">#{brand},</if>
<if test="fullVoltage != null">#{fullVoltage},</if>
<if test="lowVoltage != null">#{lowVoltage},</if>
<if test="fullEndurance != null">#{fullEndurance},</if>
@ -80,7 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update rl_model
<trim prefix="SET" suffixOverrides=",">
<if test="model != null">model = #{model},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="fullVoltage != null">full_voltage = #{fullVoltage},</if>
<if test="lowVoltage != null">low_voltage = #{lowVoltage},</if>
<if test="fullEndurance != null">full_endurance = #{fullEndurance},</if>

View File

@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.show,
ss.status,
ss.enabled,
ss.agent_id,
su.user_name as user_name
from rl_store ss
left join rl_user su on su.user_id = ss.user_id
@ -46,8 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.isDefault != null "> and ss.is_default = #{query.isDefault}</if>
<if test="query.type != null "> and ss.type = #{query.type}</if>
<if test="query.address != null and query.address != ''"> and ss.address like concat('%', #{query.address}, '%')</if>
<!-- <if test="query.deleted != null "> and ss.deleted = #{query.deleted}</if>-->
<!-- <if test="query.deleted == null "> and ss.deleted = false</if>-->
<if test="query.agentId != null "> and ss.agent_id = #{query.agentId}</if>
<if test="query.userName != null "> and su.user_name like concat('%', #{query.userName}, '%')</if>
<if test="query.status != null "> and ss.status = #{query.status}</if>
<if test="query.enabled != null "> and ss.enabled = #{query.enabled}</if>