客服
This commit is contained in:
parent
c7b9a3da9f
commit
d1a67d6f37
|
@ -101,4 +101,10 @@ public interface AreaService
|
|||
*/
|
||||
public List<Long> selectIdList(AreaQuery query);
|
||||
|
||||
/**
|
||||
* 查询附近的运营区
|
||||
* @param query
|
||||
*/
|
||||
public AreaVO selectNearBy(AreaQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.bst.area.service.impl;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -14,13 +15,16 @@ import com.ruoyi.bst.agreement.service.AgreementService;
|
|||
import com.ruoyi.bst.area.domain.Area;
|
||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.area.domain.enums.AreaStatus;
|
||||
import com.ruoyi.bst.area.domain.vo.LocationAreaVO;
|
||||
import com.ruoyi.bst.area.mapper.AreaMapper;
|
||||
import com.ruoyi.bst.area.service.AreaDashboard;
|
||||
import com.ruoyi.bst.area.service.AreaService;
|
||||
import com.ruoyi.bst.area.utils.AreaUtil;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.areaSub.domain.AreaSubVO;
|
||||
import com.ruoyi.bst.areaSub.service.AreaSubService;
|
||||
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
@ -50,6 +54,9 @@ public class AreaServiceImpl implements AreaService
|
|||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
@Autowired
|
||||
private AreaDashboard areaDashboard;
|
||||
|
||||
/**
|
||||
* 查询运营区
|
||||
*
|
||||
|
@ -203,4 +210,38 @@ public class AreaServiceImpl implements AreaService
|
|||
public List<Long> selectIdList(AreaQuery query) {
|
||||
return areaMapper.selectIdByQuery(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AreaVO selectNearBy(AreaQuery query) {
|
||||
if (query.getCenter() == null) {
|
||||
log.error("中心坐标不能为空");
|
||||
return null;
|
||||
}
|
||||
if (query.getCenter().size() != 2) {
|
||||
log.error("中心坐标格式错误,必须包含经度和纬度");
|
||||
return null;
|
||||
}
|
||||
query.setStatus(AreaStatus.ENABLED.getCode());
|
||||
|
||||
// 按设备数量排序,查询附近的运营区
|
||||
Long areaId = query.getId();
|
||||
query.setId(null);
|
||||
List<LongIntegerVO> list = areaDashboard.selectMaxOfDeviceCountAreaId(query);
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果有传运营区ID,则优先找运营区
|
||||
LongIntegerVO max = null;
|
||||
if (areaId != null) {
|
||||
max = list.stream().filter(item -> Objects.equals(item.getKey(), areaId)).findFirst().orElse(null);
|
||||
}
|
||||
// 若没有找到对应运营区,则取设备数量最多的运营区
|
||||
if (max == null) {
|
||||
max = list.get(0);
|
||||
}
|
||||
|
||||
// 查询运营区详情
|
||||
return this.selectAreaById(max.getKey());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.bst.customerService.domain.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 小程序客服查询
|
||||
*/
|
||||
@Data
|
||||
public class AppCustomerQuery {
|
||||
|
||||
@ApiModelProperty("中心点经纬度")
|
||||
private List<BigDecimal> center;
|
||||
|
||||
@ApiModelProperty("半径")
|
||||
private BigDecimal radius;
|
||||
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -16,8 +14,6 @@ import com.ruoyi.bst.area.service.AreaService;
|
|||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
@ -54,34 +50,7 @@ public class AppAreaController extends BaseController {
|
|||
if (query.getRadius() == null || query.getRadius().compareTo(BigDecimal.ZERO) <= 0 || query.getRadius().compareTo(BigDecimal.valueOf(10000)) > 0) {
|
||||
return error("半径必须在0-10000之间");
|
||||
}
|
||||
if (query.getCenter() == null) {
|
||||
return error("中心坐标不能为空");
|
||||
}
|
||||
if (query.getCenter().size() != 2) {
|
||||
return error("中心坐标格式错误,必须包含经度和纬度");
|
||||
}
|
||||
setQuery(query);
|
||||
|
||||
// 按设备数量排序,查询附近的运营区
|
||||
Long areaId = query.getId();
|
||||
query.setId(null);
|
||||
List<LongIntegerVO> list = areaDashboard.selectMaxOfDeviceCountAreaId(query);
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
// 如果有传运营区ID,则优先找运营区
|
||||
LongIntegerVO max = null;
|
||||
if (areaId != null) {
|
||||
max = list.stream().filter(item -> Objects.equals(item.getKey(), areaId)).findFirst().orElse(null);
|
||||
}
|
||||
// 若没有找到对应运营区,则取设备数量最多的运营区
|
||||
if (max == null) {
|
||||
max = list.get(0);
|
||||
}
|
||||
|
||||
// 查询运营区详情
|
||||
return success(areaService.selectAreaById(max.getKey()));
|
||||
return success(areaService.selectNearBy(query));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,27 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
||||
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||
import com.ruoyi.bst.customerService.domain.enums.CustomerServiceStatus;
|
||||
import com.ruoyi.bst.customerService.service.CustomerServiceService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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 com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.area.service.AreaService;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceVO;
|
||||
import com.ruoyi.bst.customerService.domain.dto.AppCustomerQuery;
|
||||
import com.ruoyi.bst.customerService.service.CustomerServiceService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/customerService")
|
||||
public class AppCustomerServiceController extends BaseController {
|
||||
|
@ -23,14 +30,44 @@ public class AppCustomerServiceController extends BaseController {
|
|||
@Autowired
|
||||
private CustomerServiceService customerServiceService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private AreaService areaService;
|
||||
|
||||
@ApiOperation("获取客服列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CustomerServiceQuery query) {
|
||||
startPage();
|
||||
startOrderBy();
|
||||
query.setIsEnabled(CustomerServiceStatus.ENABLE.getStatus());
|
||||
query.setDeleted(false);
|
||||
return getDataTable(customerServiceService.selectCustomerServiceList(query));
|
||||
public AjaxResult list(AppCustomerQuery query) {
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
|
||||
|
||||
// 售后客服
|
||||
UserVO user = userService.selectUserById(getUserId());
|
||||
Long areaId = user.getAreaId();
|
||||
if (areaId != null) {
|
||||
CustomerServiceQuery afterQuery = new CustomerServiceQuery();
|
||||
afterQuery.setAreaId(areaId);
|
||||
ajax.put("after", customerServiceService.selectCustomerServiceList(afterQuery));
|
||||
}
|
||||
|
||||
// 售前客服
|
||||
if (query.getRadius() != null && query.getCenter() != null && query.getCenter().size() >= 2) {
|
||||
// 查询运营区
|
||||
AreaQuery areaQuery = new AreaQuery();
|
||||
areaQuery.setCenter(query.getCenter());
|
||||
areaQuery.setRadius(query.getRadius());
|
||||
areaQuery.setId(user.getAreaId());
|
||||
AreaVO area = areaService.selectNearBy(areaQuery);
|
||||
|
||||
// 查询运营区客服
|
||||
CustomerServiceQuery beforeQuery = new CustomerServiceQuery();
|
||||
beforeQuery.setAreaId(area.getId());
|
||||
ajax.put("before", customerServiceService.selectCustomerServiceList(beforeQuery));
|
||||
}
|
||||
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user