From c636b24ea2876e0ed6c39d15299e44f9e5844d04 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Thu, 26 Sep 2024 16:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/AppVerifyController.java | 16 +++++++++ .../ruoyi/system/domain/agent/RlAgentVO.java | 4 +++ .../system/domain/area/RlOperatingArea.java | 4 +++ .../system/domain/area/RlOperatingAreaVO.java | 2 +- .../system/mapper/RlOperatingAreaMapper.java | 9 +++++ .../service/IRlOperatingAreaService.java | 9 +++++ .../service/impl/RlAgentServiceImpl.java | 27 +++++++++++++-- .../impl/RlOperatingAreaServiceImpl.java | 13 ++++++++ .../mapper/system/RlOperatingAreaMapper.xml | 33 +++++++------------ 9 files changed, 91 insertions(+), 26 deletions(-) diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 21da23f..03ec45a 100644 --- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -7,6 +7,7 @@ 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.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.wx.vo.PrepayResponseVO; import com.ruoyi.system.domain.device.RlDevice; import com.ruoyi.system.domain.device.RlDeviceQuery; @@ -317,4 +318,19 @@ public class AppVerifyController extends BaseController return AjaxResult.success(priceVO); } + /** + * 根据用户编号获取详细信息 + */ + @GetMapping(value = { "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) + { + AjaxResult ajax = AjaxResult.success(); + if (StringUtils.isNotNull(userId)) + { + RlUser rlUser = rlUserService.selectUserById(userId); + ajax.put(AjaxResult.DATA_TAG, rlUser); + } + return ajax; + } + } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/agent/RlAgentVO.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/agent/RlAgentVO.java index 820112f..f98d251 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/agent/RlAgentVO.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/agent/RlAgentVO.java @@ -10,4 +10,8 @@ public class RlAgentVO extends RlAgent{ /** 取消规则列表 */ private List cancelRuleList; + + private String longitude; + + private String latitude; } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingArea.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingArea.java index 0ca76ff..e68d81c 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingArea.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingArea.java @@ -65,4 +65,8 @@ public class RlOperatingArea extends BaseEntity /** 运营结束时间 */ @Excel(name = "运营结束时间") private String areaTimeEnd; + + /** 代理商id */ + @Excel(name = "代理商id") + private Long agentId; } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingAreaVO.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingAreaVO.java index 1237fee..0341cbb 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingAreaVO.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/area/RlOperatingAreaVO.java @@ -3,5 +3,5 @@ package com.ruoyi.system.domain.area; import lombok.Data; @Data -public class RlOperatingAreaVO { +public class RlOperatingAreaVO extends RlOperatingArea{ } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlOperatingAreaMapper.java b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlOperatingAreaMapper.java index 236294c..521e710 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlOperatingAreaMapper.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlOperatingAreaMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.system.mapper; import com.ruoyi.system.domain.area.RlOperatingArea; +import com.ruoyi.system.domain.area.RlOperatingAreaVO; import java.util.List; @@ -21,6 +22,14 @@ public interface RlOperatingAreaMapper */ public RlOperatingArea selectRlOperatingAreaByAreaId(Long areaId); + /** + * 查询运营区 + * + * @param agentId 运营区主键 + * @return 运营区 + */ + public RlOperatingAreaVO selectRlOperatingAreaByAgentId(Long agentId); + /** * 查询运营区列表 * diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOperatingAreaService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOperatingAreaService.java index c26e37f..ffa9c63 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOperatingAreaService.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOperatingAreaService.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.area.RlOperatingArea; +import com.ruoyi.system.domain.area.RlOperatingAreaVO; /** * 运营区Service接口 @@ -19,6 +20,14 @@ public interface IRlOperatingAreaService */ public RlOperatingArea selectRlOperatingAreaByAreaId(Long areaId); + /** + * 根据代理商id查询运营区 + * + * @param agentId 运营区主键 + * @return 运营区 + */ + public RlOperatingAreaVO selectRlOperatingAreaByAgentId(Long agentId); + /** * 查询运营区列表 * diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlAgentServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlAgentServiceImpl.java index b0d4141..b58cca4 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlAgentServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlAgentServiceImpl.java @@ -1,11 +1,15 @@ package com.ruoyi.system.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.ruoyi.system.domain.agent.RlAgent; import com.ruoyi.system.domain.agent.RlAgentVO; +import com.ruoyi.system.domain.area.RlOperatingArea; +import com.ruoyi.system.domain.area.RlOperatingAreaVO; import com.ruoyi.system.domain.cancelRule.RlCancelRule; import com.ruoyi.system.mapper.RlAgentMapper; import com.ruoyi.system.service.IRlAgentService; import com.ruoyi.system.service.IRlCancelRuleService; +import com.ruoyi.system.service.IRlOperatingAreaService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -26,6 +30,9 @@ public class RlAgentServiceImpl implements IRlAgentService @Resource private IRlCancelRuleService cancelRuleService; + @Resource + private IRlOperatingAreaService areaService; + /** * 查询代理商 * @@ -36,9 +43,21 @@ public class RlAgentServiceImpl implements IRlAgentService public RlAgentVO selectRlAgentByAgentId(Long agentId) { RlAgentVO rlAgentVO = rlAgentMapper.selectRlAgentByAgentId(agentId); + if(ObjectUtil.isNull(rlAgentVO)){ + throw new RuntimeException("代理商不存在"); + } + getAgentInfo(rlAgentVO); + return rlAgentVO; + } + + private void getAgentInfo(RlAgentVO rlAgentVO) { List rlCancelRules = cancelRuleService.selectRlCancelRuleListByAgentId(rlAgentVO.getAgentId()); rlAgentVO.setCancelRuleList(rlCancelRules); - return rlAgentVO; + RlOperatingAreaVO rlOperatingArea = areaService.selectRlOperatingAreaByAgentId(rlAgentVO.getAgentId()); + if(ObjectUtil.isNotNull(rlOperatingArea)){ + rlAgentVO.setLongitude(rlOperatingArea.getLongitude()); + rlAgentVO.setLatitude(rlOperatingArea.getLatitude()); + } } @@ -52,8 +71,10 @@ public class RlAgentServiceImpl implements IRlAgentService public RlAgentVO selectRlAgentByCityId(Long cityId) { RlAgentVO rlAgentVO = rlAgentMapper.selectRlAgentByCityId(cityId); - List rlCancelRules = cancelRuleService.selectRlCancelRuleListByAgentId(rlAgentVO.getAgentId()); - rlAgentVO.setCancelRuleList(rlCancelRules); + if(ObjectUtil.isNull(rlAgentVO)){ + throw new RuntimeException("代理商不存在"); + } + getAgentInfo(rlAgentVO); return rlAgentVO; } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOperatingAreaServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOperatingAreaServiceImpl.java index 9c69dc6..ca86238 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOperatingAreaServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOperatingAreaServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.domain.area.RlOperatingArea; +import com.ruoyi.system.domain.area.RlOperatingAreaVO; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.RlOperatingAreaMapper; import com.ruoyi.system.service.IRlOperatingAreaService; @@ -33,6 +34,18 @@ public class RlOperatingAreaServiceImpl implements IRlOperatingAreaService return rlOperatingAreaMapper.selectRlOperatingAreaByAreaId(areaId); } + /** + * 查询运营区 + * + * @param agentId 运营区主键 + * @return 运营区 + */ + @Override + public RlOperatingAreaVO selectRlOperatingAreaByAgentId(Long agentId) + { + return rlOperatingAreaMapper.selectRlOperatingAreaByAgentId(agentId); + } + /** * 查询运营区列表 * diff --git a/ridelease-system/src/main/resources/mapper/system/RlOperatingAreaMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlOperatingAreaMapper.xml index 0af4ee7..5212b59 100644 --- a/ridelease-system/src/main/resources/mapper/system/RlOperatingAreaMapper.xml +++ b/ridelease-system/src/main/resources/mapper/system/RlOperatingAreaMapper.xml @@ -3,24 +3,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - + + select area_id, area_name, boundary, boundary_str, longitude, latitude, create_by, create_time, status, area_time, area_out_outage, area_out_dispatch, agreement, area_time_start, area_time_end from rl_operating_area @@ -28,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + insert into rl_operating_area @@ -111,9 +100,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from rl_operating_area where area_id in + delete from rl_operating_area where area_id in #{areaId} - \ No newline at end of file +