| | |
| | | /** |
| | | * 功能描述: 高德地图Key |
| | | */ |
| | | private static final String GAO_DE_KEY = "37331f325a4f4ea25bc0d4e1900a1730"; |
| | | private static final String GAO_DE_KEY = "2f22a10b75e0c24a074de515f3cdcaea"; |
| | | |
| | | /** |
| | | * 功能描述: 根据地址名称得到两个地址间的距离 |
| | |
| | | * @return 两个定位点之间的距离 |
| | | */ |
| | | public static Result<Long> getDistance(String startLonLat, String endLonLat) { |
| | | System.err.println("======"+startLonLat+"===="+endLonLat); |
| | | // 返回起始地startAddr与目的地endAddr之间的距离,单位:米 |
| | | String queryUrl = |
| | | "http://restapi.amap.com/v3/distance?key=" + GAO_DE_KEY + "&origins=" + startLonLat |
| | | + "&destination=" |
| | | + endLonLat; |
| | | String queryResult = getResponse(queryUrl); |
| | | System.err.println("======"+queryResult); |
| | | JSONObject job = JSONObject.parseObject(queryResult); |
| | | JSONArray ja = job.getJSONArray("results"); |
| | | JSONObject jobO = JSONObject.parseObject(ja.getString(0)); |
| | |
| | | @ApiOperation(value = "订单id列表-分页", tags = {"后台-订单管理"}) |
| | | @PostMapping(value = "/queryIdList") |
| | | public R<List<String>> queryIdList(@RequestBody OrderQueryRequest orderQueryRequest) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (null == loginUser) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | if (loginUser.getIsFranchisee()) { |
| | | if (null == orderQueryRequest.getCityList() || orderQueryRequest.getCityList().isEmpty()) { |
| | | orderQueryRequest.setCityList(loginUser.getCityList()); |
| | | } else { |
| | | orderQueryRequest.getCityList().addAll(loginUser.getCityList()); |
| | | } |
| | | } |
| | | List<Integer> servIds = new ArrayList<>(); |
| | | if (orderQueryRequest.getClassNameId()!=null){ |
| | | List<Integer> classIds = recoveryClassifyService.lambdaQuery().eq(RecoveryClassify::getId, orderQueryRequest.getClassNameId()).list().stream().map(RecoveryClassify::getId).collect(Collectors.toList()); |
| | | servIds = recoveryServeService.lambdaQuery().eq(BaseEntity::getIsDelete,0).in(RecoveryServe::getClassifyId, classIds).list().stream().map(RecoveryServe::getId).collect(Collectors.toList()); |
| | | } |
| | | if(orderQueryRequest.getServeId()!=null){ |
| | | servIds.add(orderQueryRequest.getServeId()); |
| | | } |
| | | orderQueryRequest.setServIds(servIds); |
| | | Integer franchiseeId = loginUser.getSysUser().getFranchiseeId(); |
| | | if (franchiseeId!=null) { |
| | | Franchisee byId = franchiseeService.getById(franchiseeId); |
| | | String[] siteIds = byId.getSiteIds().split(","); |
| | | orderQueryRequest.setSiteIds(siteIds); |
| | | if (loginUser.getIsFranchisee() && siteIds.length == 0) { |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return R.ok(orderService.queryIdList(orderQueryRequest)); |
| | | } |
| | | /** |
| | |
| | | import com.ruoyi.admin.service.UserService; |
| | | import com.ruoyi.admin.vo.PageDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/region") |
| | | @Api(value = "后台-首页", tags = {"后台-首页"}) |
| | | @Api(value = "后台-版本管理", tags = {"后台-版本管理"}) |
| | | public class RegionController { |
| | | |
| | | @Resource |
| | |
| | | return R.ok(appVersionPage); |
| | | |
| | | } |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @PostMapping("/version/add") |
| | | @ApiOperation(value = "添加", tags = {"后台-版本管理"}) |
| | |
| | | com.ruoyi.system.api.domain.SysUser sysUser = tokenService.getLoginUser().getSysUser(); |
| | | appVersion.setCreateBy(String.valueOf(sysUser.getUserId())); |
| | | appMapper.insert(appVersion); |
| | | // redisService.setCacheObject("version",appVersion); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/version/delete/{id}") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.entity.Franchisee; |
| | | import com.ruoyi.admin.entity.Site; |
| | | import com.ruoyi.admin.service.FranchiseeService; |
| | | import com.ruoyi.admin.service.SiteService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.entity.OrderResultVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | .page(Page.of(pageNum, pageSize))); |
| | | } |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private FranchiseeService franchiseeService; |
| | | /** |
| | | * 站点列表 |
| | | */ |
| | | @ApiOperation(value = "站点列表", tags = {"后台-系统设置-站点管理"}) |
| | | @GetMapping(value = "/list") |
| | | public R<List<Site>> list(String siteName) { |
| | | return R.ok(siteService.lambdaQuery().orderByDesc(Site::getCreateTime).like(siteName!=null&&siteName!="", Site::getSiteName, siteName) |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Integer franchiseeId = loginUser.getSysUser().getFranchiseeId(); |
| | | String[] siteIds = new String[0]; |
| | | |
| | | if (franchiseeId!=null) { |
| | | Franchisee byId = franchiseeService.getById(franchiseeId); |
| | | siteIds = byId.getSiteIds().split(","); |
| | | if (loginUser.getIsFranchisee() && siteIds.length == 0) { |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return R.ok(siteService.lambdaQuery().orderByDesc(Site::getCreateTime).in(siteIds.length>0, Site::getId, siteIds).like(siteName!=null&&siteName!="", Site::getSiteName, siteName) |
| | | .eq(Site::getIsDelete, 0) |
| | | .list()); |
| | | } |
| | |
| | | <if test="data.completeTimeEnd != null and data.completeTimeEnd != ''"> |
| | | and DATE(o.complete_time) <![CDATA[ <= ]]> #{data.completeTimeEnd} |
| | | </if> |
| | | <if test="data.siteIds != null and data.siteIds.size() != 0"> |
| | | and o.site_id in |
| | | <foreach collection="data.siteIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by o.createTime desc |
| | | </select> |
| | |
| | | |
| | | @PostMapping("/version/check") |
| | | @ApiOperation(value = "获取最新的版本信息", tags = {"自动更新"}) |
| | | public R<AppVersion> check() { |
| | | public R check() { |
| | | AppVersion appVersion = appMapper.selectOne(new QueryWrapper<AppVersion>().orderByDesc("createTime").eq("is_delete", 0).last("limit 1")); |
| | | // Object version = redisService.getCacheObject("version"); |
| | | return R.ok(appVersion); |
| | | } |
| | | /** |
| | |
| | | @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true) |
| | | }) |
| | | public R<List<OrderListVO>> orderNotHandle(@RequestParam String longitude, @RequestParam String latitude) { |
| | | |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录已失效!"); |
| | |
| | | package com.ruoyi.worker.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.cache.manager.IFileLoader; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | |
| | | import lombok.Synchronized; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true) |
| | | }) |
| | | @Synchronized |
| | | public R<Boolean> coordinate(@RequestParam Double longitude, @RequestParam Double latitude) { |
| | | |
| | | System.err.println("调用记录经纬度"+ LocalDateTime.now()); |
| | |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | Object cacheObject2 = redisService.getCacheObject("LOCK" + loginWorker.getUserid()); |
| | | if (cacheObject2!=null){ |
| | | return R.ok(); |
| | | }else { |
| | | redisService.setCacheObject("LOCK" + loginWorker.getUserid(),"1", 10L, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | // 获取当天时间 |
| | | String today = DateUtils.dateTimeNow("yyyy-MM-dd"); |
| | | Integer workerId = loginWorker.getUserid(); |
| | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | // 减去三十分钟 |
| | | LocalDateTime thirtyMinutesAgo = now.minusMinutes(10); |
| | | LocalDateTime thirtyMinutesAgo = now.minusMinutes(5); |
| | | |
| | | // 定义日期时间格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | redisService.deleteObject("LOCK" + loginWorker.getUserid()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | |
| | | // 检查差值是否小于等于2分钟 |
| | | long minutes = Math.abs(duration.toMinutes()); |
| | | return minutes >= 10; |
| | | return minutes >= 5; |
| | | } |
| | | /** |
| | | * 师傅端-定时调度记录师傅当天的轨迹标点 |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "文件", name = "file", dataType = "MultipartFile", required = true) |
| | | }) |
| | | public R<String> pic(@RequestParam("file") MultipartFile file,@RequestParam String longitude,@RequestParam String address, |
| | | @RequestParam String latitude) { |
| | | @Synchronized |
| | | public R<String> pic(@RequestParam("file") MultipartFile file,String longitude,String address, |
| | | String latitude) { |
| | | // Result<String> address = GaoDeMapUtil.getAddress(longitude, latitude); |
| | | |
| | | // return R.fail(); |
| | | |
| | | // 获取当前时间 |
| | | |
| | |
| | | |
| | | |
| | | String url = tencentCosUtil.upLoadFile(watermarkFile); |
| | | // String url = tencentCosUtil.upLoadFile(file); |
| | | log.error("==========="+LocalDateTime.now()); |
| | | return R.ok(url); |
| | | |