|  |  |  | 
|---|
|  |  |  | import com.ld.igds.data.SnapImgDto; | 
|---|
|  |  |  | import com.ld.igds.inout.dto.ApiInoutData; | 
|---|
|  |  |  | import com.ld.igds.inout.dto.InoutCameraDto; | 
|---|
|  |  |  | import com.ld.igds.inout.manager.InoutDeviceManager; | 
|---|
|  |  |  | import com.ld.igds.inout.manager.InoutEventControlManager; | 
|---|
|  |  |  | import com.ld.igds.models.InoutConf; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | public class InoutApiController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private InoutDeviceManager inoutDeviceManager; | 
|---|
|  |  |  | private InoutEventControlManager inoutEventControl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取车牌识别信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/get-plateNum") | 
|---|
|  |  |  | public PageResponse<ApiInoutData> getPlateNum(@RequestBody ApiInoutData param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getProtocol())) { | 
|---|
|  |  |  | param.setErrorMsg("当前车牌识别未配置通讯协议,无法执行"); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007, param); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (null == param.getIp()) { | 
|---|
|  |  |  | param.setErrorMsg("出入库配置中没有配置如入登记的车牌识别"); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007, param); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "出入库配置中没有配置如入登记的车牌识别"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param = inoutDeviceManager.getPlateNum(param); | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getProtocol())) { | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "当前车牌识别未配置通讯协议,无法执行"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param = inoutEventControl.getPlateNum(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getErrorMsg())) { | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000, param); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取车牌识别信息 | 
|---|
|  |  |  | * 获取智慧卡信息 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param param 车牌识别数据信息 | 
|---|
|  |  |  | * @param param 获取智慧卡信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @RequestMapping("/ic-card-num") | 
|---|
|  |  |  | public PageResponse<ApiInoutData> getIcCardNum(@RequestBody ApiInoutData param) { | 
|---|
|  |  |  | @RequestMapping("/get-icCard") | 
|---|
|  |  |  | public PageResponse<ApiInoutData> getIcCard(@RequestBody ApiInoutData param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getProtocol())) { | 
|---|
|  |  |  | param.setErrorMsg("当前智慧卡未配置通讯协议,无法执行"); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007, param); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "当前智慧卡未配置通讯协议,无法执行"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (null == param.getIp()) { | 
|---|
|  |  |  | param.setErrorMsg("出入库配置中没有配置智慧卡信息"); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007, param); | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "出入库配置中没有配置智慧卡信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param = inoutDeviceManager.getIcCardNum(param); | 
|---|
|  |  |  | param = inoutEventControl.getIcCardNum(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getErrorMsg())) { | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000, param); | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | PageResponse<InoutCameraDto> inoutVideoPlay(@RequestBody InoutCameraDto param) { | 
|---|
|  |  |  | param.setErrorMsg(null); | 
|---|
|  |  |  | param = inoutDeviceManager.inoutVideoPlay(param); | 
|---|
|  |  |  | param = inoutEventControl.inoutVideoPlay(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(param.getErrorMsg())) { | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "成功", param); | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | PageResponse<String> keepLive(@RequestBody InoutCameraDto param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String msg = inoutDeviceManager.videoKeepLive(param); | 
|---|
|  |  |  | String msg = inoutEventControl.videoKeepLive(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000, msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | PageResponse<SnapImgDto> cutImg(@RequestBody SnapImgDto param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param = inoutDeviceManager.snapImg(param); | 
|---|
|  |  |  | param = inoutEventControl.snapImg(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000, param); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | view.addObject("length", length); | 
|---|
|  |  |  | view.addObject("width", width); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InoutConf inoutConf = inoutDeviceManager.getInoutConf(id); | 
|---|
|  |  |  | InoutConf inoutConf = inoutEventControl.getInoutConf(id); | 
|---|
|  |  |  | view.addObject("data", inoutConf); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | view.setViewName("admin/inout/video-hik"); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/notice-weight-done") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | PageResponse<String> noticeWeightDone(@RequestBody ApiInoutData param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String msg = inoutDeviceManager.noticeWeightDone(param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new PageResponse<>(RespCodeEnum.CODE_0000, msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //    @RequestMapping("/notice-weight-done") | 
|---|
|  |  |  | //    public @ResponseBody | 
|---|
|  |  |  | //    PageResponse<String> noticeWeightDone(@RequestBody ApiInoutData param) { | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        String msg = inoutEventControl.noticeWeightDone(param); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        return new PageResponse<>(RespCodeEnum.CODE_0000, msg); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|