fix
Helius
2022-09-22 5a8bb0c1dde052c6c95d545f53ae27d42338529d
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -90,7 +90,6 @@
    }
    @Override
    public FebsResponse findLeaderListInPage(ApiLeaderListDto apiLeaderListDto) {
        //根据当前位置的经纬度查询在所属配送区域内的团长
@@ -167,6 +166,11 @@
        apiLeaderInfoVo.setTownship(mallTeamLeader.getTownship());
        apiLeaderInfoVo.setDetailAddress(mallTeamLeader.getDetailAddress());
        apiLeaderInfoVo.setAddressArea(mallTeamLeader.getAddressArea());
        MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode());
        if(ObjectUtil.isNotEmpty(mallElectronicFence)){
            String longLatStr = mallElectronicFence.getLonglatiarr();
            apiLeaderInfoVo.setLonglatiarr(longLatStr);
        }
        return new FebsResponse().success().data(apiLeaderInfoVo);
    }
@@ -175,7 +179,17 @@
        MallMember member = LoginUserUtil.getLoginUser();
        IPage<MallOrderInfo> page = new Page<>(apiLeaderOrderListDto.getPageNum(), apiLeaderOrderListDto.getPageSize());
        apiLeaderOrderListDto.setMemberId(member.getId());
        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiLeaderOrderListInPage(page, apiLeaderOrderListDto);
//        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiLeaderOrderListInPage(page, apiLeaderOrderListDto);
        IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectNewApiLeaderOrderListInPage(page, apiLeaderOrderListDto);
        if(CollUtil.isNotEmpty(mallOrderInfos.getRecords())){
            for(MallOrderInfo mallOrderInfo : mallOrderInfos.getRecords()){
                Long orderInfoId = mallOrderInfo.getId();
                List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfoId);
                if(CollUtil.isNotEmpty(mallOrderItemList)){
                    mallOrderInfo.setItems(mallOrderItemList);
                }
            }
        }
        return MallOrderInfoConversion.INSTANCE.entitysToVos(mallOrderInfos.getRecords());
    }
@@ -204,18 +218,17 @@
            mallOrderInfoMapper.updateById(mallOrderInfo);
            OrderStateDto orderStateDto = new OrderStateDto();
            orderStateDto.setOrderNo(mallOrderInfo.getOrderNo());
            String productNames = getProductNames(mallOrderInfo.getMemberId(), mallOrderInfo.getId());
            orderStateDto.setGoodsName(StrUtil.sub(productNames,0,10)+"...");
            orderStateDto.setOrderState("待自提");
            orderStateDto.setTakeCode(mallOrderInfo.getTakeCode());
            orderStateDto.setGoodsName(StrUtil.sub(productNames,0,20)+"...");
            String takeUniqueCode = mallOrderInfo.getTakeUniqueCode();
            MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode);
            orderStateDto.setAddressArea(StrUtil.sub(mallTeamLeader.getAddressArea(),0,10)+"...");
            orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,10)+"...");
            orderStateDto.setAddressArea(StrUtil.sub(mallTeamLeader.getAddressArea(),0,20)+"...");
            orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,20)+"...");
            orderStateDto.setLeaderPhone(mallTeamLeader.getPhone());
            orderStateDto.setOpenId(mallMemberMapper.selectById(mallOrderInfo.getMemberId()).getOpenId());
            DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_ONE.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_ONE.getCode());
            DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getCode());
            orderStateDto.setTemplateId(dataDictionaryCustom.getValue());
            orderStateDto.setRemark("果蔬等生鲜,请尽快取货");
            iXcxPayService.pushOrderToAddress(orderStateDto);
        }
        return new FebsResponse().success().message("确认成功");
@@ -291,6 +304,15 @@
            apiLeaderInfoVo.setTownship(mallTeamLeader.getTownship());
            apiLeaderInfoVo.setDetailAddress(mallTeamLeader.getDetailAddress());
            apiLeaderInfoVo.setAddressArea(mallTeamLeader.getAddressArea());
            MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode());
            if(ObjectUtil.isNotEmpty(mallElectronicFence)){
                apiLeaderInfoVo.setLonglatiarr(mallElectronicFence.getLonglatiarr());
            }
            apiLeaderInfoVo.setLongitude(mallTeamLeader.getLongitude());
            apiLeaderInfoVo.setLatitude(mallTeamLeader.getLatitude());
        }
        if(ObjectUtil.isEmpty(apiLeaderInfoVo)){
            return new FebsResponse().success();
        }
        return new FebsResponse().success().data(apiLeaderInfoVo);
    }
@@ -495,4 +517,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())*1000;
                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);
    }
}