| | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.GaoDeMapUtil; |
| | | import com.ruoyi.common.core.utils.SnowflakeIdWorker; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | |
| | | Page<Order> data = orderClient.queryPage(orderQueryRequest).getData(); |
| | | List<MasterWorker> list = masterWorkerService.lambdaQuery() |
| | | .eq(MasterWorker::getIsDelete, 0).list(); |
| | | if (null != data) { |
| | | for (Order record : data.getRecords()) { |
| | | // 回收服务信息 |
| | | Integer serverId = record.getServerId(); |
| | | MasterWorker masterWorker = masterWorkerService.lambdaQuery() |
| | | .eq(MasterWorker::getId, serverId) |
| | | .eq(MasterWorker::getIsDelete, 0).one(); |
| | | MasterWorker masterWorker = list.stream().filter(e -> e.getId().equals(serverId)).findFirst().orElse(null); |
| | | if (null != masterWorker) { |
| | | record.setServerName(masterWorker.getRealName()); |
| | | record.setServerPhone(masterWorker.getPhone()); |
| | |
| | | public R<String> importTemplate(HttpServletResponse response) throws Exception { |
| | | List<FrozenBuckleImportDTO> list = new ArrayList<>(); |
| | | FrozenBuckleImportDTO bean = new FrozenBuckleImportDTO(); |
| | | |
| | | list.add(bean); |
| | | |
| | | // 这里URLEncoder.encode可以防止中文乱码 |
| | | String fileName = URLEncoder.encode("订单导入模板", "UTF-8"); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | |
| | | String area = frozenBuckleImportDTO.getArea(); |
| | | String address = frozenBuckleImportDTO.getReservationAddress(); |
| | | |
| | | String time = frozenBuckleImportDTO.getTime(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try{ |
| | | format.parse(time); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("上门时间格式错误"); |
| | | } |
| | | |
| | | if(!StringUtils.hasLength(address)){ |
| | | return R.fail("详细地址不能为空"); |
| | | } |
| | | // 解析地址经纬度 |
| | | CityInfoVO cityInfoVO = GaoDeMapUtil.getAddressInfo(province + city + area + address).getDatas(); |
| | | CityInfoVO cityInfoVO = GaoDeMapUtil.getAddressInfo((province==null?"":province) |
| | | + (city==null?"":city) |
| | | + (area==null?"":area) |
| | | + address).getDatas(); |
| | | if(cityInfoVO==null||Objects.isNull(cityInfoVO.getLongitude()) || Objects.isNull(cityInfoVO.getLatitude())){ |
| | | return R.fail("地址输入不正确"); |
| | | } |
| | | String areaCode = cityInfoVO.getCode(); |
| | | String provinceCode = areaCode.substring(0, 2) + "0000"; |
| | | String cityCode = areaCode.substring(0, 4) + "00"; |
| | |
| | | order.setAreaCode(areaCode); |
| | | order.setLongitude(cityInfoVO.getLongitude()); |
| | | order.setLatitude(cityInfoVO.getLatitude()); |
| | | |
| | | if (!StringUtils.hasLength(city)){ |
| | | order.setCity(cityInfoVO.getCity()); |
| | | } |
| | | // 站点信息 |
| | | Site site = sites.stream().filter(e -> e.getSiteName().equals(frozenBuckleImportDTO.getSiteName())).findFirst().orElse(null); |
| | | if(Objects.nonNull(site)){ |
| | |
| | | order.setServeId(recoveryServe.getId()); |
| | | order.setServePrice(recoveryServe.getDefaultPrice()); |
| | | }else { |
| | | return R.fail("回收服务不存在"); |
| | | return R.fail("服务信息不存在"); |
| | | } |
| | | RecoveryServePrice one = recoveryServePriceService.lambdaQuery().eq(RecoveryServePrice::getCity, order.getCityCode()).eq(RecoveryServePrice::getRecoveryServeId, order.getServeId()).eq(BaseEntity::getIsDelete, 0).one(); |
| | | if (one==null) { |