| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.javaweb.cms.util.CmsConstants; |
| | | import com.javaweb.common.core.domain.AjaxResult; |
| | | import com.javaweb.common.utils.Arith; |
| | | import com.javaweb.geo.domain.Hole; |
| | | import com.javaweb.geo.domain.HoleMedia; |
| | | import com.javaweb.geo.domain.Project; |
| | | import com.javaweb.geo.domain.TubLog; |
| | | import com.javaweb.geo.domain.*; |
| | | import com.javaweb.geo.enums.RecordType; |
| | | import com.javaweb.geo.mapper.ProjectCameraMapper; |
| | | import com.javaweb.geo.mapper.TubLogMapper; |
| | | import com.javaweb.geo.service.IHoleMediaService; |
| | | import com.javaweb.geo.service.IHoleService; |
| | | import com.javaweb.geo.service.IProjectService; |
| | | import com.javaweb.geo.service.*; |
| | | import com.javaweb.geo.vo.DrillDateVo; |
| | | import com.javaweb.geo.vo.IndexVo; |
| | | import com.javaweb.geo.vo.ProjectProcessVO; |
| | | import com.javaweb.system.service.ISysConfigService; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.javaweb.common.config.Global; |
| | | import com.javaweb.common.core.controller.BaseController; |
| | | import com.javaweb.framework.util.ShiroUtils; |
| | |
| | | import com.javaweb.system.domain.SysUser; |
| | | import com.javaweb.system.service.ISysMenuService; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | |
| | | */ |
| | | @Controller |
| | | public class SysIndexController extends BaseController { |
| | | |
| | | private String prefix = "system/camera_tub"; |
| | | |
| | | |
| | | private String appkey = "af786eacc71d43ef9393c028cf4face7"; |
| | | private String secret = "9ad87671f63d2258af6fd9b2e5fa6005"; |
| | | private String postUrl ="https://open.ys7.com/api/lapp/token/get"; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | |
| | | @Autowired |
| | | private TubLogMapper tubLogMapper; |
| | | |
| | | @Autowired |
| | | private ProjectCameraMapper projectCameraMapper; |
| | | |
| | | @Autowired |
| | | private IProjectCameraService cameraService; |
| | | |
| | | @Autowired |
| | | private IHoleLogService holeLogService; |
| | | |
| | | |
| | | private String getAdminIndex() { |
| | | return configService.selectConfigByKey(CmsConstants.KEY_ADMIN_INDEX); |
| | |
| | | @RequestMapping("/admin") |
| | | public String admin() { |
| | | return "forward:/index"; |
| | | } |
| | | |
| | | @RequestMapping("/system/camera") |
| | | public String cameraList() { |
| | | return prefix + "/camera_list"; |
| | | } |
| | | |
| | | @RequestMapping("/system/tub") |
| | | public String tubList() { |
| | | return prefix + "/tub_list"; |
| | | } |
| | | |
| | | // 系统首页 |
| | |
| | | public String main(ModelMap mmap) { |
| | | mmap.put("version", Global.getVersion()); |
| | | |
| | | String loginname = ShiroUtils.getLoginName(); |
| | | mmap.put("loginuser",loginname); |
| | | return "main"; |
| | | } |
| | | |
| | | // 系统介绍 |
| | | @ResponseBody |
| | | @GetMapping("/system/project") |
| | | @GetMapping("/system/stat/project") |
| | | public AjaxResult project() { |
| | | AjaxResult ajaxResult = AjaxResult.success(); |
| | | List<Project> projects = projectService.selectProjectList(new Project()); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/totalProcess") |
| | | @GetMapping("/system/stat/totalProcess") |
| | | public AjaxResult totalProcess() { |
| | | AjaxResult ajaxResult = AjaxResult.success(); |
| | | Hole hole = holeService.selectHoleTotalProcess(); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/projectProcess") |
| | | @GetMapping("/system/stat/projectProcess") |
| | | public AjaxResult projectProcess() { |
| | | AjaxResult ajaxResult = AjaxResult.success(); |
| | | List<Hole> holes = holeService.selectHoleProjectProcess(); |
| | | Map<String, Double> holeMap = new HashMap<>(); |
| | | for (Hole hole : holes) { |
| | | Double val = Arith.div(hole.getFootageCpl(), hole.getFootage(), 2); |
| | | val = Arith.round(val * 100, 2); |
| | | Double val =0.0d; |
| | | if(ObjectUtil.isNotEmpty(hole.getFootageCpl()) && ObjectUtil.isNotEmpty(hole.getFootage())) { |
| | | val = Arith.div(hole.getFootageCpl(), hole.getFootage(), 2); |
| | | val = Arith.round(val * 100, 2); |
| | | } |
| | | holeMap.put(hole.getProjectId(), val); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/indexDataCount") |
| | | @GetMapping("/system/stat/indexDataCount") |
| | | public AjaxResult indexDataCount() { |
| | | IndexVo result = new IndexVo(); |
| | | //=============================查询场地数量=============================== |
| | |
| | | HoleMedia holeMedia = holeMediaService.selectHoleMediaNumber(); |
| | | result.setFileCount(holeMedia.getNumber()); |
| | | |
| | | Integer cameraCount = projectCameraMapper.count(); |
| | | result.setCameraCount(cameraCount); |
| | | return AjaxResult.success("查询成功",result); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/tubLogData") |
| | | @GetMapping("/system/stat/tubLogData") |
| | | public AjaxResult tubLogData() { |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | List<TubLog> tubLogs = tubLogMapper.countTubLogDate(null); |
| | |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * 获取在线摄像头的信息 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/stat/cameraData") |
| | | public AjaxResult cameraData() { |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | List<ProjectCamera> cameraDataList = cameraService.selectCameraDataOnLine(); |
| | | ajaxResult.put("cameraData",cameraDataList); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * 根据projectId获取在线摄像头的信息 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/stat/cameraData/{projectId}") |
| | | public AjaxResult cameraData2(@PathVariable("projectId") String projectId) { |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | |
| | | ProjectCamera param = new ProjectCamera(); |
| | | param.setProjectId(projectId); |
| | | List<ProjectCamera> cameraDataList = cameraService.selectProjectCameraList(param); |
| | | if (!ObjectUtils.isEmpty(cameraDataList)){ |
| | | for (ProjectCamera item : cameraDataList) { |
| | | String url = item.getIp(); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("appKey", appkey); |
| | | paramMap.put("appSecret", secret); |
| | | |
| | | HttpResponse response = HttpRequest.post(postUrl) .form(paramMap).execute(); |
| | | String body = response.body(); |
| | | JSONObject jsonObject = JSONUtil.parseObj(body); |
| | | String code = jsonObject.getStr("code"); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | if(code.equals("200")){ |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | | String token = data.getStr("accessToken"); |
| | | buffer.append("https://open.ys7.com/console/jssdk/pc.html?accessToken="); |
| | | buffer.append(token); |
| | | buffer.append("&url="); |
| | | buffer.append(url); |
| | | } |
| | | logger.debug(buffer.toString()); |
| | | item.setUrl(buffer.toString()); |
| | | } |
| | | } |
| | | ajaxResult.put("cameraDataList",cameraDataList); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | /** |
| | | * 根据projectId获取在线摄像头的信息 |
| | | * @return |
| | | */ |
| | | @GetMapping("/player") |
| | | public String player(String projectId,ModelMap mmap) { |
| | | ProjectCamera param = new ProjectCamera(); |
| | | param.setProjectId(projectId); |
| | | List<ProjectCamera> cameraDataList = cameraService.selectProjectCameraList(param); |
| | | if (!ObjectUtils.isEmpty(cameraDataList)){ |
| | | for (ProjectCamera item : cameraDataList) { |
| | | String url = item.getIp(); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("appKey", appkey); |
| | | paramMap.put("appSecret", secret); |
| | | |
| | | HttpResponse response = HttpRequest.post(postUrl) .form(paramMap).execute(); |
| | | String body = response.body(); |
| | | JSONObject jsonObject = JSONUtil.parseObj(body); |
| | | String code = jsonObject.getStr("code"); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | if(code.equals("200")){ |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | | String token = data.getStr("accessToken"); |
| | | buffer.append("https://open.ys7.com/console/jssdk/pc.html?accessToken="); |
| | | buffer.append(token); |
| | | buffer.append("&url="); |
| | | buffer.append(url); |
| | | } |
| | | item.setUrl(buffer.toString()); |
| | | } |
| | | } |
| | | |
| | | mmap.put("cameraDataList",cameraDataList); |
| | | return prefix + "/player2"; |
| | | } |
| | | |
| | | /** |
| | | * 统计最近10天进尺量 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/system/stat/sumHoleLog") |
| | | public AjaxResult sumHoleLog() { |
| | | AjaxResult ajaxResult = AjaxResult.success(); |
| | | List<DrillDateVo> drillDateList = holeLogService.SUMHoleLog(); |
| | | ajaxResult.put("drillDateList",drillDateList); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | } |