| | |
| | | import com.oying.modules.rider.utils.RiderSourceHttpUtils; |
| | | import com.oying.modules.system.domain.User; |
| | | import com.oying.modules.system.service.UserService; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.SecurityUtils; |
| | | import com.oying.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.oying.modules.rider.mapper.RiderInfoMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @author pxb |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void syncRiderSourceInfo(String sourcePlatform) { |
| | | public R syncRiderSourceInfo(String sourcePlatform) { |
| | | Long riderId = SecurityUtils.getCurrentUserId(); |
| | | // 添加请求参数 |
| | | List<String> phoneList = new ArrayList<>(); |
| | |
| | | RiderSourceInfoHttp riderSourceInfoHttp = RiderSourceHttpUtils.getRiderSourceInfoHttp(phoneList, sourcePlatform); |
| | | // 请求成功 |
| | | if (riderSourceInfoHttp.getCode().equals(Constants.HTTP_CODE_SUCCESS)) { |
| | | // 检查是否存在该平台的骑手信息 |
| | | QueryWrapper<RiderInfo> riderInfoQueryWrapper = new QueryWrapper<>(); |
| | | riderInfoQueryWrapper.eq(RiderInfo.COL_RIDER_ID, riderId); |
| | | RiderInfo riderInfo = riderInfoMapper.selectOne(riderInfoQueryWrapper); |
| | | // 获取骑手信息等于空 |
| | | if (!riderSourceInfoHttp.getData().isEmpty()) { |
| | | // 单个骑手信息同步只取第一条数据 |
| | | RiderSourceInfo infoHttpData = riderSourceInfoHttp.getData().get(0); |
| | | // 检查是否存在该平台的骑手信息 |
| | | QueryWrapper<RiderInfo> riderInfoQueryWrapper = new QueryWrapper<>(); |
| | | riderInfoQueryWrapper.eq(RiderInfo.COL_RIDER_ID, riderId); |
| | | RiderInfo riderInfo = riderInfoMapper.selectOne(riderInfoQueryWrapper); |
| | | // 如果存在该平台的骑手信息 |
| | | if (null == riderInfo) { |
| | | // 如果不存在,则创建新的骑手三方信息 |
| | |
| | | // 添加变更记录... |
| | | } |
| | | } |
| | | return R.success(riderInfo, "获取骑手三方数据"); |
| | | } else { |
| | | // 修改骑手信息为信息失效 |
| | | if(riderInfo != null) { |
| | | RiderInfo newRiderInfo = new RiderInfo(); |
| | | newRiderInfo.setRiderId(riderId); |
| | | newRiderInfo.setEnabled(Constants.SOURCE_ENABLED_DFF); |
| | | updateById(newRiderInfo); |
| | | } |
| | | // 获取骑手三方数据为空,抛出异常 |
| | | throw new BadRequestException("获取骑手三方数据为空"); |
| | | } |