From 67bc217ccb7a845ad3633b699ed7c7aa518941df Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 16 Sep 2022 17:16:43 +0800
Subject: [PATCH] 20220902
---
src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java | 8 ++
src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java | 2
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java | 30 +++++++++
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java | 43 ++++++++++++++
src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java | 15 ++++
src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java | 2
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java | 1
src/main/java/cc/mrbird/febs/mall/dto/ApiCreateOrderVerifyDto.java | 19 ++++++
src/main/java/cc/mrbird/febs/mall/dto/ApiLeaderListDto.java | 3 +
9 files changed, 121 insertions(+), 2 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java b/src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
index a2c68fc..6024226 100644
--- a/src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
+++ b/src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -25,6 +25,7 @@
registration.excludePathPatterns("/api/news/**");
registration.excludePathPatterns("/api/member/cashOutSetting");
registration.excludePathPatterns("/api/leader/leaderList");
+ registration.excludePathPatterns("/api/leader/leaderListInFence");
registration.excludePathPatterns("/api/leader/leaderTitle");
registration.excludePathPatterns("/api/xcxPay/wxpayCallback");
registration.excludePathPatterns("/api/xcxPay/rechargeCallBack");
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java
index ba25382..7bfe863 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallOrderController.java
@@ -33,6 +33,14 @@
private final IApiMallOrderInfoService mallOrderInfoService;
private final IXcxPayService iXcxPayService;
+
+ @ApiOperation(value = "创建订单--验证收货地址是否在配送范围内 true | false", notes = "创建订单--验证收货地址是否在配送范围内")
+ @PostMapping(value = "/createOrderVerify")
+ public FebsResponse createOrderVerify(@RequestBody ApiCreateOrderVerifyDto apiCreateOrderVerifyDto) {
+ Boolean verifyState = mallOrderInfoService.createOrderVerify(apiCreateOrderVerifyDto);
+ return new FebsResponse().success().data(verifyState);
+ }
+
@ApiOperation(value = "创建订单", notes = "创建订单")
@PostMapping(value = "/createOrder")
public FebsResponse createOrder(@RequestBody AddOrderDto addOrderDto) {
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java
index 70544d8..3354f45 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java
@@ -35,15 +35,28 @@
return iApiMallTeamLeaderService.applyLeader(apiApplayLeaderDto);
}
+
/**
* 团长列表
*/
- @ApiOperation(value = "团长列表", notes = "团长列表")
+ @ApiOperation(value = "团长列表(查询当前位置商品配送范围内的所有团长)", notes = "团长列表(查询当前位置商品配送范围内的所有团长)")
@ApiResponses({
@ApiResponse(code = 200, message = "success", response = ApiLeaderListVo.class)
})
@PostMapping(value = "/leaderList")
public FebsResponse leaderList(@RequestBody @Valid ApiLeaderListDto apiLeaderListDto) {
+ return iApiMallTeamLeaderService.findSomeLeaderListInPage(apiLeaderListDto);
+ }
+
+ /**
+ * 团长列表
+ */
+ @ApiOperation(value = "团长列表(查询当前经纬度在团长配送范围内的团长)", notes = "团长列表(查询当前经纬度在团长配送范围内的团长)")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "success", response = ApiLeaderListVo.class)
+ })
+ @PostMapping(value = "/leaderListInFence")
+ public FebsResponse leaderListInFence(@RequestBody @Valid ApiLeaderListDto apiLeaderListDto) {
return iApiMallTeamLeaderService.findLeaderListInPage(apiLeaderListDto);
}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiCreateOrderVerifyDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiCreateOrderVerifyDto.java
new file mode 100644
index 0000000..33dd86d
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiCreateOrderVerifyDto.java
@@ -0,0 +1,19 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ApiCreateOrderVerifyDto", description = "参数接收类")
+public class ApiCreateOrderVerifyDto {
+
+ @NotNull(message = "参数不能为空")
+ @ApiModelProperty(value = "地址ID", example = "1")
+ private Long addressId;
+
+ @ApiModelProperty(value = "提货团长特征码", example = "1")
+ private String takeUniqueCode;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiLeaderListDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiLeaderListDto.java
index 4a902e8..8bb0f12 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/ApiLeaderListDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiLeaderListDto.java
@@ -28,4 +28,7 @@
@NotNull(message = "请选择您的地址")
private Double latitude;
+ @ApiModelProperty(hidden = true)
+ private Double rangeSize;
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java
index 6779c55..da3baa5 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallOrderInfoService.java
@@ -39,4 +39,6 @@
FebsResponse applyRefundOrder(ApplyRefundOrderDto applyRefundOrderDto);
FebsResponse cancelRefundOrder(Long id);
+
+ Boolean createOrderVerify(ApiCreateOrderVerifyDto apiCreateOrderVerifyDto);
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java
index 83825fa..e9d495d 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java
@@ -35,4 +35,6 @@
FebsResponse leaderProfit();
List<ApiOrderProfitVo> findLeaderProfitListInPage(ApiOrderProfitDto apiOrderProfitDto);
+
+ FebsResponse findSomeLeaderListInPage(ApiLeaderListDto apiLeaderListDto);
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
index f152ab7..2a3f376 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -8,10 +8,12 @@
import cc.mrbird.febs.mall.conversion.MallGoodsCommentConversion;
import cc.mrbird.febs.mall.conversion.MallOrderInfoConversion;
import cc.mrbird.febs.mall.conversion.MallOrderRefundConversion;
+import cc.mrbird.febs.mall.conversion.MallTeamLeaderConversion;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.*;
+import cc.mrbird.febs.mall.vo.ApiLeaderListVo;
import cc.mrbird.febs.mall.vo.OrderDetailVo;
import cc.mrbird.febs.mall.vo.OrderListVo;
import cc.mrbird.febs.mall.vo.OrderRefundVo;
@@ -27,6 +29,8 @@
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -843,4 +847,43 @@
return new FebsResponse().success().message("已取消");
}
+ @Override
+ public Boolean createOrderVerify(ApiCreateOrderVerifyDto apiCreateOrderVerifyDto) {
+ Boolean flag = false;
+ Long addressId = apiCreateOrderVerifyDto.getAddressId();
+ String takeUniqueCode = apiCreateOrderVerifyDto.getTakeUniqueCode();
+
+ MallAddressInfo mallAddressInfo = mallAddressInfoMapper.selectById(addressId);
+ if(ObjectUtil.isEmpty(mallAddressInfo)){
+ return flag;
+ }
+ MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(takeUniqueCode);
+ if(ObjectUtil.isEmpty(mallElectronicFence)){
+ return flag;
+ }
+ //{"data":{"count":1,"results":[{"gfid":800899,"gfname":"87053658_fence","in":0}]},"errcode":10000,"errdetail":null,"errmsg":"OK"}
+ String resultsStr = iMallElectronicFenceService.fenceToLocation(mallElectronicFence.getGKey(),
+ mallElectronicFence.getServiceId(),
+ mallAddressInfo.getLongitude() + "," + mallAddressInfo.getLatitude(),
+ mallElectronicFence.getGid());
+ if("fail".equals(resultsStr)){
+ return flag;
+ }
+ JSONArray objects = JSONUtil.parseArray(resultsStr);
+ for(Object obj : objects){
+ //{"gfid":800899,"gfname":"87053658_fence","in":0}
+ JSONObject jsonObject = JSONUtil.parseObj(obj);
+ String gfid = jsonObject.get("gfid").toString();
+ String in = jsonObject.get("in").toString();
+ String gfname = jsonObject.get("gfname").toString();
+ //指定坐标是否在围栏中
+ //1:在,
+ //0:不在;
+ if("1".equals(in)){
+ flag = true;
+ }
+ }
+ return flag;
+ }
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
index 8c0aa60..53a206e 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -90,7 +90,6 @@
}
-
@Override
public FebsResponse findLeaderListInPage(ApiLeaderListDto apiLeaderListDto) {
//根据当前位置的经纬度查询在所属配送区域内的团长
@@ -291,6 +290,9 @@
apiLeaderInfoVo.setTownship(mallTeamLeader.getTownship());
apiLeaderInfoVo.setDetailAddress(mallTeamLeader.getDetailAddress());
apiLeaderInfoVo.setAddressArea(mallTeamLeader.getAddressArea());
+ }
+ if(ObjectUtil.isEmpty(apiLeaderInfoVo)){
+ return new FebsResponse().success();
}
return new FebsResponse().success().data(apiLeaderInfoVo);
}
@@ -495,4 +497,30 @@
return MallLeaderAchieveConversion.INSTANCE.entitysToVos(mallLeaderAchieves.getRecords());
}
+ @Override
+ public FebsResponse findSomeLeaderListInPage(ApiLeaderListDto apiLeaderListDto) {
+ Page<MallTeamLeader> page = new Page<>(apiLeaderListDto.getPageNum(), apiLeaderListDto.getPageSize());
+ IPage<MallTeamLeader> mallTeamLeaderIPage = this.baseMapper.selectApiLeaderListInPage(page, apiLeaderListDto);
+ List<ApiLeaderListVo> apiLeaderListVos = new ArrayList<>();
+
+ DataDictionaryCustom rangeSwitchDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SWITCH.getType(), DataDictionaryEnum.RANGE_SWITCH.getCode());
+ if (ObjectUtil.isNotNull(rangeSwitchDic)) {
+ int rangeSwitch = Integer.parseInt(rangeSwitchDic.getValue());
+ if(1 == rangeSwitch){
+ DataDictionaryCustom rangeSizeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SIZE.getType(), DataDictionaryEnum.RANGE_SIZE.getCode());
+ double rangeSize = Double.parseDouble(rangeSizeDic.getValue());
+ for(MallTeamLeader mallTeamLeader : mallTeamLeaderIPage.getRecords()){
+ Double distance = mallTeamLeader.getDistance();
+ if(distance <= rangeSize){
+ ApiLeaderListVo apiLeaderListVo = MallTeamLeaderConversion.INSTANCE.entityToApiVo(mallTeamLeader);
+ apiLeaderListVos.add(apiLeaderListVo);
+ }
+ }
+ }else{
+ apiLeaderListVos = MallTeamLeaderConversion.INSTANCE.entitysToVos(mallTeamLeaderIPage.getRecords());
+ }
+ }
+ return new FebsResponse().success().data(apiLeaderListVos);
+ }
+
}
--
Gitblit v1.9.1