diff --git a/extracted_code.txt b/extracted_code.txt new file mode 100644 index 0000000..15c6966 --- /dev/null +++ b/extracted_code.txt @@ -0,0 +1,3123 @@ +CameraController.java: +package cn.iocoder.yudao.module.camera.controller.admin.camera; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.camera.vo.CameraPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.camera.vo.CameraRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.camera.vo.CameraSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.camera.CameraDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO; +import cn.iocoder.yudao.module.camera.dal.entity.TreeVo; +import cn.iocoder.yudao.module.camera.framework.netty.intellBlink.CameraPhotoDecoder; +import cn.iocoder.yudao.module.camera.framework.netty.intellBlink.CameraPhotoInfo; +import cn.iocoder.yudao.module.camera.service.camera.CameraService; +import cn.iocoder.yudao.module.camera.service.street.StreetService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.annotation.security.PermitAll; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 相机") +@RestController +@RequestMapping("/logistics/camera") +@Validated +public class CameraController { +@Resource +private CameraService cameraService; +@Resource +private StreetService streetService; +@PostMapping("/logisticsResults") +@Operation(summary = "货位状态查看") +@PermitAll +public CommonResult> logisticsResults(@Valid @RequestBody CameraPhotoInfo createReqVO) { +CameraPhotoInfo cameraPhotoInfo = CameraPhotoDecoder.cameraPhotoInfoMap.get(createReqVO.getPosition()); +if(cameraPhotoInfo != null ){ +if(cameraPhotoInfo.getMode()!=null && cameraPhotoInfo.getMode().equals("AGV")){ +cameraPhotoInfo.setMode("AGV"); +CameraPhotoDecoder.cameraPhotoInfoMap.put(createReqVO.getPosition(),cameraPhotoInfo); +} +}else { +cameraPhotoInfo = createReqVO; +cameraPhotoInfo.setResult(0); +CameraPhotoDecoder.cameraPhotoInfoMap.put(createReqVO.getPosition(),cameraPhotoInfo); +} +List list =new ArrayList<>(); +list.add(cameraPhotoInfo); +return success(list); +} +@PostMapping("/create") +@Operation(summary = "创建相机") +public CommonResult createCamera(@Valid @RequestBody CameraSaveReqVO createReqVO) { +return success(cameraService.createCamera(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新相机") +public CommonResult updateCamera(@Valid @RequestBody CameraSaveReqVO updateReqVO) { +cameraService.updateCamera(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除相机") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteCamera(@RequestParam("id") Integer id) { +cameraService.deleteCamera(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得相机") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getCamera(@RequestParam("id") Integer id) { +CameraDO camera = cameraService.getCamera(id); +return success(BeanUtils.toBean(camera, CameraRespVO.class)); +} +@PostMapping("/tree") +@Operation(summary = "获得相机树") +@PermitAll +public CommonResult> tree() { +List camera = cameraService.list(); +List street = streetService.list(); +List cameraTreeVos = new ArrayList<>(); +for (StreetDO streetDO : street) { +TreeVo cameraTreeVo = new TreeVo(); +cameraTreeVo.setLabel(streetDO.getName()); +cameraTreeVo.setChildren(new ArrayList<>()); +for (CameraDO cameraDO : camera) { +if (cameraDO.getId().equals(streetDO.getCamera2Id()) || cameraDO.getId().equals(streetDO.getCamera1Id())) { +TreeVo treeVo = new TreeVo(); +treeVo.setLabel(cameraDO.getName()); +treeVo.setId(cameraDO.getId().toString()); +cameraTreeVo.getChildren().add(treeVo); +} +} +cameraTreeVos.add(cameraTreeVo); +} +return success(cameraTreeVos); +} +@GetMapping("/page") +@Operation(summary = "获得相机分页") +public CommonResult> getCameraPage(@Valid CameraPageReqVO pageReqVO) { +PageResult pageResult = cameraService.getCameraPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, CameraRespVO.class)); +} +@GetMapping("/list") +@Operation(summary = "获得相机list") +public CommonResult> getCameraList() { +List pageResult = cameraService.list(); +return success(BeanUtils.toBean(pageResult, CameraRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出相机 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportCameraExcel(@Valid CameraPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = cameraService.getCameraPage(pageReqVO).getList(); +ExcelUtils.write(response, "相机.xls", "数据", CameraRespVO.class, +BeanUtils.toBean(list, CameraRespVO.class)); +} +} +CameraPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.camera.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 相机分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CameraPageReqVO extends PageParam { +@Schema(description = "名称", example = "赵六") +private String name; +@Schema(description = "类型", example = "2") +private Integer type; +@Schema(description = "流媒体ip") +private String rtcServer; +@Schema(description = "流媒体端口") +private Integer rtcServerPort; +@Schema(description = "rtsp端口") +private Integer rtspPort; +@Schema(description = "通道", example = "D1") +private String channel; +@Schema(description = "录像机ip") +private String recorderIp; +} +CameraRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.camera.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - 相机 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CameraRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31657") +@ExcelProperty("id") +private Integer id; +@Schema(description = "名称", example = "赵六") +@ExcelProperty("名称") +private String name; +@Schema(description = "类型", example = "2") +@ExcelProperty(value = "类型", converter = DictConvert.class) +@DictFormat("camera_type") +private Integer type; +@Schema(description = "ip") +@ExcelProperty("ip") +private String ip; +@Schema(description = "端口") +@ExcelProperty("端口") +private Integer port; +@Schema(description = "流媒体ip") +@ExcelProperty("流媒体ip") +private String rtcServer; +@Schema(description = "流媒体端口") +@ExcelProperty("流媒体端口") +private Integer rtcServerPort; +@Schema(description = "rtsp端口") +@ExcelProperty("rtsp端口") +private Integer rtspPort; +@Schema(description = "通道", example = "D1") +@ExcelProperty("通道") +private String channel; +@Schema(description = "录像机ip") +@ExcelProperty("录像机ip") +private String recorderIp; +} +CameraSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.camera.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - 相机新增/修改 Request VO") +@Data +public class CameraSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31657") +private Integer id; +@Schema(description = "名称", example = "赵六") +private String name; +@Schema(description = "类型", example = "2") +private Integer type; +@Schema(description = "ip") +private String ip; +@Schema(description = "端口") +private Integer port; +@Schema(description = "用户名") +private String user; +@Schema(description = "密码") +private String password; +@Schema(description = "流媒体ip") +private String rtcServer; +@Schema(description = "流媒体端口") +private Integer rtcServerPort; +@Schema(description = "rtsp端口") +private Integer rtspPort; +@Schema(description = "通道", example = "D1") +private String channel; +@Schema(description = "录像机ip") +private String recorderIp; +} +CameraIoController.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraio; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo.CameraIoPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo.CameraIoRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo.CameraIoSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.camera.CameraDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.cameraio.CameraIoDO; +import cn.iocoder.yudao.module.camera.service.camera.CameraService; +import cn.iocoder.yudao.module.camera.service.cameraio.CameraIoService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 相机预置点位") +@RestController +@RequestMapping("/logistics/camera-io") +@Validated +public class CameraIoController { +@Resource +private CameraIoService cameraIoService; +@Resource +private CameraService cameraService; +@PostMapping("/create") +@Operation(summary = "创建相机预置点位") +public CommonResult createCameraIo(@Valid @RequestBody CameraIoSaveReqVO createReqVO) { +List list = cameraIoService.list(new QueryWrapper() +.eq("camera_id", createReqVO.getCameraId())); +Integer ptzId = list.stream().map(CameraIoDO::getPtzId).max(Integer::compareTo).orElse(0)+1; +createReqVO.setPtzId(ptzId); +int i= cameraIoService.createCameraIo(createReqVO); +CameraDO cameraIoDO = cameraService.getById(createReqVO.getCameraId()); +return success(i); +} +@PostMapping("/callPtz") +@Operation(summary = "调用预置点位") +public CommonResult callPtz(@Valid @RequestBody CameraIoSaveReqVO createReqVO) { +CameraDO cameraIoDO = cameraService.getById(createReqVO.getCameraId()); +return success(cameraIoService.createCameraIo(createReqVO)); +} +@PostMapping("/overwritePtz") +@Operation(summary = "创建或覆盖相机预置点位") +public CommonResult overwritePtz(@Valid @RequestBody CameraIoSaveReqVO createReqVO) { +CameraDO cameraIoDO = cameraService.getById(createReqVO.getCameraId()); +return success(cameraIoService.createCameraIo(createReqVO)); +} +@PostMapping("/list") +@Operation(summary = "获得相机预置点位分页") +public CommonResult> list(@Valid @RequestBody CameraIoPageReqVO pageReqVO) { +List pageResult = cameraIoService.list(new QueryWrapper() +.eq("camera_id", pageReqVO.getCameraId()) +.orderByAsc("id")); +return success(BeanUtils.toBean(pageResult, CameraIoRespVO.class)); +} +@DeleteMapping("/delete") +@Operation(summary = "删除相机预置点位") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteCameraIo(@RequestParam("id") Integer id) { +cameraIoService.deleteCameraIo(id); +return success(true); +} +@PutMapping("/update") +@Operation(summary = "更新相机预置点位") +public CommonResult updateCameraIo(@Valid @RequestBody CameraIoSaveReqVO updateReqVO) { +cameraIoService.updateCameraIo(updateReqVO); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得相机预置点位") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getCameraIo(@RequestParam("id") Integer id) { +CameraIoDO cameraIo = cameraIoService.getCameraIo(id); +return success(BeanUtils.toBean(cameraIo, CameraIoRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得相机预置点位分页") +public CommonResult> getCameraIoPage(@Valid CameraIoPageReqVO pageReqVO) { +PageResult pageResult = cameraIoService.getCameraIoPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, CameraIoRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出相机预置点位 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportCameraIoExcel(@Valid CameraIoPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = cameraIoService.getCameraIoPage(pageReqVO).getList(); +ExcelUtils.write(response, "相机预置点位.xls", "数据", CameraIoRespVO.class, +BeanUtils.toBean(list, CameraIoRespVO.class)); +} +} +CameraIoPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 相机预置点位分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CameraIoPageReqVO extends PageParam { +@Schema(description = "预置点名", example = "张三") +private String name; +@Schema(description = "预置点code") +private String code; +@Schema(description = "相机id", example = "11423") +private Integer cameraId; +@Schema(description = "预置点id", example = "25023") +private Integer ptzId; +@Schema(description = "位置") +private String position; +@Schema(description = "对焦") +private String focusing; +@Schema(description = "光圈") +private String aperture; +@Schema(description = "倍数") +private String multiple; +} +CameraIoRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +@Schema(description = "管理后台 - 相机预置点位 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CameraIoRespVO { +@Schema(description = "预置点id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10596") +@ExcelProperty("预置点id") +private Integer id; +@Schema(description = "预置点名", example = "张三") +@ExcelProperty("预置点名") +private String name; +@Schema(description = "预置点code") +@ExcelProperty("预置点code") +private String code; +@Schema(description = "相机id", example = "11423") +@ExcelProperty("相机id") +private Integer cameraId; +@Schema(description = "预置点id", example = "25023") +@ExcelProperty("预置点id") +private Integer ptzId; +@Schema(description = "位置") +@ExcelProperty("位置") +private String position; +@Schema(description = "对焦") +@ExcelProperty("对焦") +private String focusing; +@Schema(description = "光圈") +@ExcelProperty("光圈") +private String aperture; +@Schema(description = "倍数") +@ExcelProperty("倍数") +private String multiple; +} +CameraIoSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraio.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - 相机预置点位新增/修改 Request VO") +@Data +public class CameraIoSaveReqVO { +@Schema(description = "预置点id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10596") +private Integer id; +@Schema(description = "预置点名", example = "张三") +private String name; +@Schema(description = "预置点code") +private String code; +@Schema(description = "相机id", example = "11423") +private Integer cameraId; +@Schema(description = "预置点id", example = "25023") +private Integer ptzId; +@Schema(description = "位置") +private String position; +@Schema(description = "对焦") +private String focusing; +@Schema(description = "光圈") +private String aperture; +@Schema(description = "倍数") +private String multiple; +} +CameraIoConfigController.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo.CameraIoConfigPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo.CameraIoConfigRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo.CameraIoConfigSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.cameraioconfig.CameraIoConfigDO; +import cn.iocoder.yudao.module.camera.service.cameraioconfig.CameraIoConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 预置点位配置") +@RestController +@RequestMapping("/logistics/camera-io-config") +@Validated +public class CameraIoConfigController { +@Resource +private CameraIoConfigService cameraIoConfigService; +@PostMapping("/create") +@Operation(summary = "创建预置点位配置") +public CommonResult createCameraIoConfig(@Valid @RequestBody CameraIoConfigSaveReqVO createReqVO) { +return success(cameraIoConfigService.createCameraIoConfig(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新预置点位配置") +public CommonResult updateCameraIoConfig(@Valid @RequestBody CameraIoConfigSaveReqVO updateReqVO) { +cameraIoConfigService.updateCameraIoConfig(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除预置点位配置") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteCameraIoConfig(@RequestParam("id") Integer id) { +cameraIoConfigService.deleteCameraIoConfig(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得预置点位配置") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getCameraIoConfig(@RequestParam("id") Integer id) { +CameraIoConfigDO cameraIoConfig = cameraIoConfigService.getCameraIoConfig(id); +return success(BeanUtils.toBean(cameraIoConfig, CameraIoConfigRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得预置点位配置分页") +public CommonResult> getCameraIoConfigPage(@Valid CameraIoConfigPageReqVO pageReqVO) { +PageResult pageResult = cameraIoConfigService.getCameraIoConfigPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, CameraIoConfigRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出预置点位配置 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportCameraIoConfigExcel(@Valid CameraIoConfigPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = cameraIoConfigService.getCameraIoConfigPage(pageReqVO).getList(); +ExcelUtils.write(response, "预置点位配置.xls", "数据", CameraIoConfigRespVO.class, +BeanUtils.toBean(list, CameraIoConfigRespVO.class)); +} +} +CameraIoConfigPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 预置点位配置分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CameraIoConfigPageReqVO extends PageParam { +@Schema(description = "预置点位code") +private String code; +@Schema(description = "预置点位名称", example = "赵六") +private String name; +} +CameraIoConfigRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +@Schema(description = "管理后台 - 预置点位配置 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CameraIoConfigRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6144") +@ExcelProperty("id") +private Integer id; +@Schema(description = "预置点位code") +@ExcelProperty("预置点位code") +private String code; +@Schema(description = "预置点位名称", example = "赵六") +@ExcelProperty("预置点位名称") +private String name; +} +CameraIoConfigSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.cameraioconfig.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - 预置点位配置新增/修改 Request VO") +@Data +public class CameraIoConfigSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6144") +private Integer id; +@Schema(description = "预置点位code") +private String code; +@Schema(description = "预置点位名称", example = "赵六") +private String name; +} +CheckLogController.java: +package cn.iocoder.yudao.module.camera.controller.admin.checklog; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.checklog.vo.CheckLogPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.checklog.vo.CheckLogRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.checklog.vo.CheckLogSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.checklog.CheckLogDO; +import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; +import cn.iocoder.yudao.module.system.service.dict.DictDataService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 盘点") +@RestController +@RequestMapping("/logistics/check-log") +@Validated +public class CheckLogController { +@Resource +private CheckLogService checkLogService; +@PostMapping("/create") +@Operation(summary = "创建盘点") +public CommonResult createCheckLog(@Valid @RequestBody CheckLogSaveReqVO createReqVO) { +return success(checkLogService.createCheckLog(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新盘点") +public CommonResult updateCheckLog(@Valid @RequestBody CheckLogSaveReqVO updateReqVO) { +checkLogService.updateCheckLog(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除盘点") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteCheckLog(@RequestParam("id") Integer id) { +checkLogService.deleteCheckLog(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得盘点") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getCheckLog(@RequestParam("id") Integer id) { +CheckLogDO checkLog = checkLogService.getCheckLog(id); +return success(BeanUtils.toBean(checkLog, CheckLogRespVO.class)); +} +@Resource +private DictDataService dictDataService; +@PostMapping("/getColumns") +@Operation(summary = "获得盘点类型") +public CommonResult> getColumns() { +Map dictDataList = dictDataService.getDictDataList("scan_conf"); +List dictDataDOS = dictDataList.values().stream().filter(dictDataDO -> !dictDataDO.getValue().equals("0")).toList(); +return success(dictDataDOS); +} +@GetMapping("/page") +@Operation(summary = "获得盘点分页") +public CommonResult> getCheckLogPage(@Valid CheckLogPageReqVO pageReqVO) { +PageResult pageResult = checkLogService.getCheckLogPage(pageReqVO); +return success(pageResult); +} +@GetMapping("/export-excel") +@Operation(summary = "导出盘点 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportCheckLogExcel(@Valid CheckLogPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = checkLogService.getCheckLogPage(pageReqVO).getList(); +ExcelUtils.write(response, "盘点.xls", "数据", CheckLogRespVO.class, +BeanUtils.toBean(list, CheckLogRespVO.class)); +} +} +CheckLogPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.checklog.vo; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - 盘点分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CheckLogPageReqVO extends PageParam { +@Schema(description = "盘点批次号", example = "001_11") +private String lotnum; +@Schema(description = "层") +private Short row; +@Schema(description = "列") +private Short column; +@Schema(description = "巷道id", example = "16940") +private Integer streetId; +@Schema(description = "修改时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] exportTime; +@Schema(description = "taskid", example = "24302") +private String taskId; +@Schema(description = "1:左 2:右") +private Integer direction; +@Schema(description = "1:浅侧 2:深测") +private Integer side; +@Schema(description = "1:盘点异常 2:盘点正确 3:人工核对正确", example = "1") +private Integer status; +@Schema(description = "货位号") +private String storagCode; +} +CheckLogRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.checklog.vo; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - 盘点 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CheckLogRespVO { +@Schema(description = "id") +@ExcelProperty("id") +private LocalDateTime id; +@Schema(description = "盘点批次号", example = "001_11") +@ExcelProperty("盘点批次号") +private String lotnum; +@Schema(description = "层") +@ExcelProperty("层") +private Short row; +@Schema(description = "列") +@ExcelProperty("列") +private Short column; +@Schema(description = "托盘码") +@ExcelProperty("托盘码") +private String trayCode; +@Schema(description = "操作前图片") +@ExcelProperty("操作前图片") +private String pic; +@Schema(description = "巷道id", example = "16940") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "巷道名", example = "16940") +@ExcelProperty("巷道名") +private String streetName; +@Schema(description = "修改时间") +@ExcelProperty("修改时间") +private LocalDateTime exportTime; +@Schema(description = "taskid", example = "24302") +@ExcelProperty("taskid") +private String taskId; +@Schema(description = "1:左 2:右") +@ExcelProperty("1:左 2:右") +private Integer direction; +@Schema(description = "1:浅侧 2:深测") +@ExcelProperty("1:浅侧 2:深测") +private Integer side; +@Schema(description = "1:盘点异常 2:盘点正确 3:人工核对正确", example = "1") +@ExcelProperty(value = "1:盘点异常 2:盘点正确 3:人工核对正确", converter = DictConvert.class) +@DictFormat("check_status") +private Integer status; +@Schema(description = "货位号") +@ExcelProperty("货位号") +private String storagCode; +} +CheckLogSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.checklog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +@Schema(description = "管理后台 - 盘点新增/修改 Request VO") +@Data +public class CheckLogSaveReqVO { +} +LightSourceController.java: +package cn.iocoder.yudao.module.camera.controller.admin.lightsource; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo.LightSourcePageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo.LightSourceRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo.LightSourceSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.LightSourceDO; +import cn.iocoder.yudao.module.camera.service.lightsource.LightSourceService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 光源") +@RestController +@RequestMapping("/logistics/light-source") +@Validated +public class LightSourceController { +@Resource +private LightSourceService lightSourceService; +@PostMapping("/create") +@Operation(summary = "创建光源") +public CommonResult createLightSource(@Valid @RequestBody LightSourceSaveReqVO createReqVO) { +return success(lightSourceService.createLightSource(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新光源") +public CommonResult updateLightSource(@Valid @RequestBody LightSourceSaveReqVO updateReqVO) { +lightSourceService.updateLightSource(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除光源") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteLightSource(@RequestParam("id") Integer id) { +lightSourceService.deleteLightSource(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得光源") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getLightSource(@RequestParam("id") Integer id) { +LightSourceDO lightSource = lightSourceService.getLightSource(id); +return success(BeanUtils.toBean(lightSource, LightSourceRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得光源分页") +public CommonResult> getLightSourcePage(@Valid LightSourcePageReqVO pageReqVO) { +PageResult pageResult = lightSourceService.getLightSourcePage(pageReqVO); +return success(BeanUtils.toBean(pageResult, LightSourceRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出光源 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportLightSourceExcel(@Valid LightSourcePageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = lightSourceService.getLightSourcePage(pageReqVO).getList(); +ExcelUtils.write(response, "光源.xls", "数据", LightSourceRespVO.class, +BeanUtils.toBean(list, LightSourceRespVO.class)); +} +} +LightSourcePageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 光源分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class LightSourcePageReqVO extends PageParam { +@Schema(description = "巷道id", example = "641") +private Integer streetId; +@Schema(description = "ip", example = "192.168.1.1") +private String ip; +@Schema(description = "端口", example = "2000") +private String port; +@Schema(description = "方向 ", example = "1") +private Integer direction; +@Schema(description = "信息") +private String info; +@Schema(description = "类型", example = "2") +private Integer type; +} +LightSourceRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - 光源 Response VO") +@Data +@ExcelIgnoreUnannotated +public class LightSourceRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "22832") +@ExcelProperty("id") +private Integer id; +@Schema(description = "巷道id", requiredMode = Schema.RequiredMode.REQUIRED, example = "641") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "ip", example = "192.168.1.1") +@ExcelProperty("ip") +private String ip; +@Schema(description = "端口", example = "2000") +@ExcelProperty("端口") +private String port; +@Schema(description = "方向 ", example = "1") +@ExcelProperty(value = "方向 ", converter = DictConvert.class) +@DictFormat("direction") +private Integer direction; +@Schema(description = "信息") +@ExcelProperty("信息") +private String info; +@Schema(description = "类型", example = "2") +@ExcelProperty(value = "类型", converter = DictConvert.class) +@DictFormat("light_type") +private Integer type; +} +LightSourceSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.lightsource.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import jakarta.validation.constraints.*; +@Schema(description = "管理后台 - 光源新增/修改 Request VO") +@Data +public class LightSourceSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "22832") +private Integer id; +@Schema(description = "巷道id", requiredMode = Schema.RequiredMode.REQUIRED, example = "641") +@NotNull(message = "巷道id不能为空") +private Integer streetId; +@Schema(description = "ip", example = "192.168.1.1") +private String ip; +@Schema(description = "端口", example = "2000") +private String port; +@Schema(description = "方向 ", example = "1") +private Integer direction; +@Schema(description = "信息") +private String info; +@Schema(description = "类型", example = "2") +private Integer type; +} +OrderController.java: +package cn.iocoder.yudao.module.camera.controller.admin.order; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.order.vo.OrderPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.order.vo.OrderRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.order.vo.OrderSaveReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.order.vo.OrderStatistics; +import cn.iocoder.yudao.module.camera.dal.dataobject.order.OrderDO; +import cn.iocoder.yudao.module.camera.dal.entity.echarts.EChartsOption; +import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService; +import cn.iocoder.yudao.module.camera.service.order.OrderService; +import cn.iocoder.yudao.module.camera.service.stock.StockService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 随行记录") +@RestController +@RequestMapping("/logistics/order") +@Validated +public class OrderController { +@Resource +private OrderService orderService; +@Resource +private CheckLogService checkLogService; +@Resource +private StockService stockService; +@PostMapping("/create") +@Operation(summary = "创建随行记录") +public CommonResult createOrder(@Valid @RequestBody OrderSaveReqVO createReqVO) { +return success(orderService.createOrder(createReqVO)); +} +@PostMapping("/statistics") +@Operation(summary = "首页个数统计") +public CommonResult statistics() { +LocalDate today = LocalDate.now(); +LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); +LocalDateTime firstDayOfMonthStart = firstDayOfMonth.atStartOfDay(); +DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); +String firstDayOfMonthStr = firstDayOfMonthStart.format(formatter); +OrderStatistics orderStatistics = new OrderStatistics(); +orderStatistics.setOrderCount(orderService.count(null,null)); +orderStatistics.setOrderMonthCount(orderService.count(firstDayOfMonthStr,null)); +orderStatistics.setCheckLogCount(checkLogService.count(null,null)); +orderStatistics.setCheckLogMonthCount(checkLogService.count(firstDayOfMonthStr,null)); +return success(orderStatistics); +} +@PostMapping("/laneInventoryStatistics") +@Operation(summary = "首页巷道随行统计") +public CommonResult laneInventoryStatistics() { +EChartsOption bars = orderService.laneInventoryStatistics(); +return success(bars); +} +@PostMapping("/laneInventoryLine") +@Operation(summary = "首页巷道随行折线图") +public CommonResult laneInventoryLine() { +EChartsOption bars = orderService.laneInventoryLine(); +return success(bars); +} +@PutMapping("/update") +@Operation(summary = "更新随行记录") +public CommonResult updateOrder(@Valid @RequestBody OrderSaveReqVO updateReqVO) { +orderService.updateOrder(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除随行记录") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteOrder(@RequestParam("id") Long id) { +orderService.deleteOrder(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得随行记录") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getOrder(@RequestParam("id") Long id) { +OrderDO order = orderService.getOrder(id); +return success(BeanUtils.toBean(order, OrderRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得随行记录分页") +public CommonResult> getOrderPage(@Valid OrderPageReqVO pageReqVO) { +PageResult pageResult = orderService.getOrderPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, OrderRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出随行记录 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportOrderExcel(@Valid OrderPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = orderService.getOrderPage(pageReqVO).getList(); +ExcelUtils.write(response, "随行记录.xls", "数据", OrderRespVO.class, +BeanUtils.toBean(list, OrderRespVO.class)); +} +} +OrderPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.order.vo; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - 随行记录分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OrderPageReqVO extends PageParam { +@Schema(description = "开始时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] startTime; +@Schema(description = "结束时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] endTime; +@Schema(description = "巷道id") +private String srmNumber; +@Schema(description = "随行工单号", example = "26503") +private String taskId; +@Schema(description = "1:左 2:右") +private Integer fromDirection; +@Schema(description = "出列") +private Integer fromColumn; +@Schema(description = "出层") +private Integer fromRow; +@Schema(description = "出库内外") +private Integer fromSeparation; +@Schema(description = "图片地址") +private String pics; +@Schema(description = "wms货物code") +private String trayCode; +@Schema(description = "子标签") +private String storageCode; +@Schema(description = "1:左 2:右") +private Integer toDirection; +@Schema(description = "入列") +private Integer toColumn; +@Schema(description = "出库内外") +private Integer toSeparation; +@Schema(description = "入层") +private Integer toRow; +} +OrderRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.order.vo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - 随行记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class OrderRespVO { +@Schema(description = "id") +@ExcelProperty("id") +private LocalDateTime id; +@Schema(description = "开始时间") +@ExcelProperty("开始时间") +private LocalDateTime startTime; +@Schema(description = "巷道id") +@ExcelProperty("巷道id") +private String srmNumber; +@Schema(description = "随行工单号", example = "26503") +@ExcelProperty("随行工单号") +private String taskId; +@Schema(description = "1:库内 2:库外") +@ExcelProperty("1:库内 2:库外") +private Integer fromSide; +@Schema(description = "1:左 2:右") +@ExcelProperty("1:左 2:右") +private Integer fromDirection; +@Schema(description = "出列") +@ExcelProperty("出列") +private Integer fromColumn; +@Schema(description = "出层") +@ExcelProperty("出层") +private Integer fromRow; +@Schema(description = "出库内外") +@ExcelProperty("出库内外") +private Integer fromSeparation; +@Schema(description = "图片地址") +@ExcelProperty("图片地址") +private String pics; +@Schema(description = "wms货物code") +@ExcelProperty("wms货物code") +private String trayCode; +@Schema(description = "子标签") +@ExcelProperty("子标签") +private String storageCode; +@Schema(description = "1:左 2:右") +@ExcelProperty("1:左 2:右") +private Integer toDirection; +@Schema(description = "入列") +@ExcelProperty("入列") +private Integer toColumn; +@Schema(description = "视频1") +private String videoPath2 ; +@Schema(description = "视频1") +private String videoPath1 ; +@Schema(description = "出库内外") +@ExcelProperty("出库内外") +private Integer toSeparation; +@Schema(description = "入层") +@ExcelProperty("入层") +private Integer toRow; +} +OrderSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.order.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +@Schema(description = "管理后台 - 随行记录新增/修改 Request VO") +@Data +public class OrderSaveReqVO { +@Schema(description = "巷道id") +private String srmNumber; +@Schema(description = "随行工单号", example = "26503") +private String taskId; +@Schema(description = "1:左 2:右") +private Integer fromDirection; +@Schema(description = "出列") +private Integer fromColumn; +@Schema(description = "出层") +private Integer fromRow; +@Schema(description = "出库内外") +private Integer fromSeparation; +@Schema(description = "图片地址") +private String pics; +@Schema(description = "wms货物code") +private String trayCode; +@Schema(description = "子标签") +private String storageCode; +@Schema(description = "1:左 2:右") +private Integer toDirection; +@Schema(description = "入列") +private Integer toColumn; +@Schema(description = "出库内外") +private Integer toSeparation; +@Schema(description = "入层") +private Integer toRow; +} +OrderStatistics.java: +package cn.iocoder.yudao.module.camera.controller.admin.order.vo; +import lombok.Data; +@Data +public class OrderStatistics { +private Long orderCount; +private Long checkLogCount; +private Long checkLogMonthCount; +private Long orderMonthCount; +} +RfidController.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfid; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.rfid.vo.RfidPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.rfid.vo.RfidRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.rfid.vo.RfidSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.rfid.RfidDO; +import cn.iocoder.yudao.module.camera.service.rfid.RfidService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - RFID") +@RestController +@RequestMapping("/logistics/rfid") +@Validated +public class RfidController { +@Resource +private RfidService rfidService; +@PostMapping("/create") +@Operation(summary = "创建RFID") +public CommonResult createRfid(@Valid @RequestBody RfidSaveReqVO createReqVO) { +return success(rfidService.createRfid(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新RFID") +public CommonResult updateRfid(@Valid @RequestBody RfidSaveReqVO updateReqVO) { +rfidService.updateRfid(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除RFID") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteRfid(@RequestParam("id") Integer id) { +rfidService.deleteRfid(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得RFID") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getRfid(@RequestParam("id") Integer id) { +RfidDO rfid = rfidService.getRfid(id); +return success(BeanUtils.toBean(rfid, RfidRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得RFID分页") +public CommonResult> getRfidPage(@Valid RfidPageReqVO pageReqVO) { +PageResult pageResult = rfidService.getRfidPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, RfidRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出RFID Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportRfidExcel(@Valid RfidPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = rfidService.getRfidPage(pageReqVO).getList(); +ExcelUtils.write(response, "RFID.xls", "数据", RfidRespVO.class, +BeanUtils.toBean(list, RfidRespVO.class)); +} +} +RfidPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfid.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - RFID分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class RfidPageReqVO extends PageParam { +@Schema(description = "巷道id", example = "8923") +private Integer streetId; +@Schema(description = "方向") +private Integer direction; +@Schema(description = "ip") +private String ip; +@Schema(description = "端口") +private Integer port; +} +RfidRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfid.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - RFID Response VO") +@Data +@ExcelIgnoreUnannotated +public class RfidRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3186") +@ExcelProperty("id") +private Integer id; +@Schema(description = "巷道id", example = "8923") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "方向") +@ExcelProperty(value = "方向", converter = DictConvert.class) +@DictFormat("direction") +private Integer direction; +@Schema(description = "ip") +@ExcelProperty("ip") +private String ip; +@Schema(description = "端口") +@ExcelProperty("端口") +private Integer port; +} +RfidSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfid.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - RFID新增/修改 Request VO") +@Data +public class RfidSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3186") +private Integer id; +@Schema(description = "巷道id", example = "8923") +private Integer streetId; +@Schema(description = "方向") +private Integer direction; +@Schema(description = "ip") +private String ip; +@Schema(description = "端口") +private Integer port; +} +RfidLiveController.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlive; +import jakarta.annotation.Resource; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; +import cn.iocoder.yudao.module.camera.controller.admin.rfidlive.vo.*; +import cn.iocoder.yudao.module.camera.dal.dataobject.rfidlive.RfidLiveDO; +import cn.iocoder.yudao.module.camera.service.rfidlive.RfidLiveService; +@Tag(name = "管理后台 - rfid当前记录情况") +@RestController +@RequestMapping("/logistics/rfid-live") +@Validated +public class RfidLiveController { +@Resource +private RfidLiveService rfidLiveService; +@PostMapping("/create") +@Operation(summary = "创建rfid当前记录情况") +public CommonResult createRfidLive(@Valid @RequestBody RfidLiveSaveReqVO createReqVO) { +return success(rfidLiveService.createRfidLive(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新rfid当前记录情况") +public CommonResult updateRfidLive(@Valid @RequestBody RfidLiveSaveReqVO updateReqVO) { +rfidLiveService.updateRfidLive(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除rfid当前记录情况") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteRfidLive(@RequestParam("id") Integer id) { +rfidLiveService.deleteRfidLive(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得rfid当前记录情况") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getRfidLive(@RequestParam("id") Integer id) { +RfidLiveDO rfidLive = rfidLiveService.getRfidLive(id); +return success(BeanUtils.toBean(rfidLive, RfidLiveRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得rfid当前记录情况分页") +public CommonResult> getRfidLivePage(@Valid RfidLivePageReqVO pageReqVO) { +PageResult pageResult = rfidLiveService.getRfidLivePage(pageReqVO); +return success(BeanUtils.toBean(pageResult, RfidLiveRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出rfid当前记录情况 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportRfidLiveExcel(@Valid RfidLivePageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = rfidLiveService.getRfidLivePage(pageReqVO).getList(); +ExcelUtils.write(response, "rfid当前记录情况.xls", "数据", RfidLiveRespVO.class, +BeanUtils.toBean(list, RfidLiveRespVO.class)); +} +} +RfidLivePageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlive.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - rfid当前记录情况分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class RfidLivePageReqVO extends PageParam { +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "16455") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "深浅") +private Integer side; +@Schema(description = "行") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "入库时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +@Schema(description = "rfid ", example = "5970") +private Integer rfidId; +@Schema(description = "随行id", example = "13774") +private Integer orderId; +@Schema(description = "任务id", example = "3172") +private Integer taskId; +} +RfidLiveRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlive.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - rfid当前记录情况 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RfidLiveRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "288") +@ExcelProperty("id") +private Integer id; +@Schema(description = "wms托盘码") +@ExcelProperty("wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "16455") +@ExcelProperty("巷道") +private Integer streetId; +@Schema(description = "左右") +@ExcelProperty(value = "左右", converter = DictConvert.class) +@DictFormat("direction") +private Integer direction; +@Schema(description = "深浅") +@ExcelProperty(value = "深浅", converter = DictConvert.class) +@DictFormat("side") +private Integer side; +@Schema(description = "行") +@ExcelProperty("行") +private Integer row; +@Schema(description = "列") +@ExcelProperty("列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +@ExcelProperty("rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "入库时间") +@ExcelProperty("入库时间") +private LocalDateTime createTime; +@Schema(description = "rfid ", example = "5970") +@ExcelProperty("rfid ") +private Integer rfidId; +@Schema(description = "随行id", example = "13774") +@ExcelProperty("随行id") +private Integer orderId; +@Schema(description = "任务id", example = "3172") +@ExcelProperty("任务id") +private Integer taskId; +} +RfidLiveSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlive.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - rfid当前记录情况新增/修改 Request VO") +@Data +public class RfidLiveSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "288") +private Integer id; +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "16455") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "深浅") +private Integer side; +@Schema(description = "行") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "rfid ", example = "5970") +private Integer rfidId; +@Schema(description = "随行id", example = "13774") +private Integer orderId; +@Schema(description = "任务id", example = "3172") +private Integer taskId; +} +RfidLogController.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlog; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo.RfidLogPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo.RfidLogRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo.RfidLogSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.rfidlog.RfidLogDO; +import cn.iocoder.yudao.module.camera.service.rfidlog.RfidLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - rfid历史记录情况") +@RestController +@RequestMapping("/logistics/rfid-log") +@Validated +public class RfidLogController { +@Resource +private RfidLogService rfidLogService; +@PostMapping("/create") +@Operation(summary = "创建rfid历史记录情况") +public CommonResult createRfidLog(@Valid @RequestBody RfidLogSaveReqVO createReqVO) { +return success(rfidLogService.createRfidLog(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新rfid历史记录情况") +public CommonResult updateRfidLog(@Valid @RequestBody RfidLogSaveReqVO updateReqVO) { +rfidLogService.updateRfidLog(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除rfid历史记录情况") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteRfidLog(@RequestParam("id") Integer id) { +rfidLogService.deleteRfidLog(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得rfid历史记录情况") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getRfidLog(@RequestParam("id") Integer id) { +RfidLogDO rfidLog = rfidLogService.getRfidLog(id); +return success(BeanUtils.toBean(rfidLog, RfidLogRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得rfid历史记录情况分页") +public CommonResult> getRfidLogPage(@Valid RfidLogPageReqVO pageReqVO) { +PageResult pageResult = rfidLogService.getRfidLogPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, RfidLogRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出rfid历史记录情况 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportRfidLogExcel(@Valid RfidLogPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = rfidLogService.getRfidLogPage(pageReqVO).getList(); +ExcelUtils.write(response, "rfid历史记录情况.xls", "数据", RfidLogRespVO.class, +BeanUtils.toBean(list, RfidLogRespVO.class)); +} +} +RfidLogPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - rfid历史记录情况分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class RfidLogPageReqVO extends PageParam { +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "27536") +private Integer streetId; +@Schema(description = "位置左右") +private Integer direction; +@Schema(description = "1:库内 2:库外") +private Integer side; +@Schema(description = "行") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "入库时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +@Schema(description = "rfid ", example = "32260") +private Integer rfidId; +@Schema(description = "任务id", example = "20217") +private Integer taskId; +@Schema(description = "1:存货,2:取货") +private Integer movement; +@Schema(description = "托盘码,没扫描上为空") +private String trayCode; +} +RfidLogRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +@Schema(description = "管理后台 - rfid历史记录情况 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RfidLogRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28707") +@ExcelProperty("id") +private Integer id; +@Schema(description = "wms托盘码") +@ExcelProperty("wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "27536") +@ExcelProperty("巷道") +private Integer streetId; +@Schema(description = "位置左右") +@ExcelProperty("位置左右") +private Integer direction; +@Schema(description = "1:库内 2:库外") +@ExcelProperty("1:库内 2:库外") +private Integer side; +@Schema(description = "行") +@ExcelProperty("行") +private Integer row; +@Schema(description = "列") +@ExcelProperty("列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +@ExcelProperty("rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "入库时间") +@ExcelProperty("入库时间") +private LocalDateTime createTime; +@Schema(description = "rfid ", example = "32260") +@ExcelProperty("rfid ") +private Integer rfidId; +@Schema(description = "任务id", example = "20217") +@ExcelProperty("任务id") +private Integer taskId; +@Schema(description = "1:存货,2:取货") +@ExcelProperty("1:存货,2:取货") +private Integer movement; +@Schema(description = "托盘码,没扫描上为空") +@ExcelProperty("托盘码,没扫描上为空") +private String trayCode; +} +RfidLogSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.rfidlog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - rfid历史记录情况新增/修改 Request VO") +@Data +public class RfidLogSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28707") +private Integer id; +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "巷道", example = "27536") +private Integer streetId; +@Schema(description = "位置左右") +private Integer direction; +@Schema(description = "1:库内 2:库外") +private Integer side; +@Schema(description = "行") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "rfid扫描托盘码") +private String rfidTrayCode; +@Schema(description = "rfid ", example = "32260") +private Integer rfidId; +@Schema(description = "任务id", example = "20217") +private Integer taskId; +@Schema(description = "1:存货,2:取货") +private Integer movement; +@Schema(description = "托盘码,没扫描上为空") +private String trayCode; +} +SensorGunController.java: +import jakarta.annotation.Resource; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; +@Tag(name = "管理后台 - 扫码枪") +@RestController +@RequestMapping("/logistics/sensor-gun") +@Validated +@Resource +@PostMapping("/create") +@Operation(summary = "创建扫码枪") +} +@PutMapping("/update") +@Operation(summary = "更新扫码枪") +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除扫码枪") +@Parameter(name = "id", description = "编号", required = true) +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得扫码枪") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +} +@GetMapping("/page") +@Operation(summary = "获得扫码枪分页") +} +@GetMapping("/export-excel") +@Operation(summary = "导出扫码枪 Excel") +@ApiAccessLog(operateType = EXPORT) +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +} +} +SensorGunPageReqVO.java: +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 扫码枪分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Schema(description = "巷道id", example = "25123") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "ip") +private String ip; +@Schema(description = "端口") +private Integer port; +} +SensorGunRespVO.java: +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - 扫码枪 Response VO") +@Data +@ExcelIgnoreUnannotated +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5583") +@ExcelProperty("id") +private Integer id; +@Schema(description = "巷道id", example = "25123") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "左右") +@ExcelProperty(value = "左右", converter = DictConvert.class) +@DictFormat("direction") +private Integer direction; +@Schema(description = "ip") +@ExcelProperty("ip") +private String ip; +@Schema(description = "端口") +@ExcelProperty("端口") +private Integer port; +} +SensorGunSaveReqVO.java: +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - 扫码枪新增/修改 Request VO") +@Data +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5583") +private Integer id; +@Schema(description = "巷道id", example = "25123") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "ip") +private String ip; +@Schema(description = "端口") +private Integer port; +} +StockController.java: +package cn.iocoder.yudao.module.camera.controller.admin.stock; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockSaveReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.stock.vo.StockStreetList; +import cn.iocoder.yudao.module.camera.dal.dataobject.checklog.CheckLogDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.resources.URLResourcesDo; +import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO; +import cn.iocoder.yudao.module.camera.dal.entity.ScanData; +import cn.iocoder.yudao.module.camera.dal.entity.ScanDateReqs; +import cn.iocoder.yudao.module.camera.dal.entity.ScanStatus; +import cn.iocoder.yudao.module.camera.dal.entity.echarts.EChartsOption; +import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService; +import cn.iocoder.yudao.module.camera.service.plc.PLCServiceImpl; +import cn.iocoder.yudao.module.camera.service.resources.URLResourcesService; +import cn.iocoder.yudao.module.camera.service.scan.ScanServiceFactory; +import cn.iocoder.yudao.module.camera.service.stock.StockService; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; +import cn.iocoder.yudao.module.system.service.dict.DictDataService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 盘点状态") +@RestController +@RequestMapping("/logistics/stock") +@Validated +@Slf4j +public class StockController { +@Resource +private StockService stockService; +@PostMapping("/create") +@Operation(summary = "创建盘点状态") +public CommonResult createStock(@Valid @RequestBody StockSaveReqVO createReqVO) { +return success(stockService.createStock(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新盘点状态") +public CommonResult updateStock(@Valid @RequestBody StockSaveReqVO updateReqVO) { +stockService.updateStock(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除盘点状态") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteStock(@RequestParam("id") Long id) { +stockService.deleteStock(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得盘点状态") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getStock(@RequestParam("id") Long id) { +StockDO stock = stockService.getStock(id); +return success(BeanUtils.toBean(stock, StockRespVO.class)); +} +@GetMapping("/getStreetList") +@Operation(summary = "获得巷道所有盘点状态") +public CommonResult getStreetList(@RequestParam("streetId") Long id, @RequestParam("direction") long direction) { +StockStreetList stockStreetList = new StockStreetList(); +stockStreetList.setStreetId(Math.toIntExact(id)); +stockStreetList.setDirection((int) direction); +StockStreetList stock = stockService.getStreetList(stockStreetList); +return success(stock); +} +@PostMapping("/laneInventoryStatistics") +@Operation(summary = "首页巷道盘点统计") +public CommonResult laneInventoryStatistics() { +EChartsOption bars = stockService.laneInventoryStatistics(); +return success(bars); +} +@Resource +private DictDataService dictDataService; +@PostMapping("/getStreetStatus") +@Operation(summary = "获得巷道所有盘点状态") +public CommonResult> getStreetStatus(@RequestBody ScanData scanData) { +List stockStreetList = stockService.list(new QueryWrapper() +.eq(scanData.getStreetId()!=null,"street_Id", scanData.getStreetId()) +.eq(scanData.getDirection()!=null,"direction", scanData.getDirection())); +Map dictValueMap = dictDataService.getDictValueMap("check_status"); +List scanDataList = BeanUtils.toBean(stockStreetList, ScanDateReqs.class); +for (ScanDateReqs scan:scanDataList){ +scan.setColour(dictValueMap.get(String.valueOf(scan.getStatus())).getColorType()); +scan.setStatusString(dictValueMap.get(String.valueOf(scan.getStatus())).getLabel()); +} +return success(scanDataList); +} +@Resource +CheckLogService checkLogService; +@Resource +private ScanServiceFactory scanServiceFactory; +@Resource +@Resource +URLResourcesService urlResourcesService; +@PostMapping("/getStockStatus") +@Operation(summary = "获得盘点状态") +public CommonResult getStockStatus(@RequestBody ScanData scanData) { +ScanData scan = null; +Map dictValueMap = dictDataService.getDictValueMap("check_status"); +Map scanConf = dictDataService.getDictDataList("scan_conf"); +if (scanData.getCheckLogId() != null) { +CheckLogDO checkLogDO = checkLogService.getById(scanData.getCheckLogId()); +scan = BeanUtils.toBean(checkLogDO, ScanData.class); +List urlResourcesDos = urlResourcesService.list(new QueryWrapper().eq("uuid", checkLogDO.getPic())); +scan.setImages(urlResourcesDos); +}else if (scanData.getStockId() != null){ +StockDO stockDOS = stockService.getById(scanData.getStockId()); +scan = BeanUtils.toBean(stockDOS, ScanData.class); +List urlResourcesDos = urlResourcesService.list(new QueryWrapper().eq("uuid", stockDOS.getCheckPic())); +scan.setImages(urlResourcesDos); +} +List scanStatuses = new ArrayList<>(); +ScanData finalScan = scan; +for (DictDataDO v:scanConf.values()){ +if (!v.getValue().equals("0")){ +ScanStatus scanStatus = BeanUtils.toBean(v, ScanStatus.class); +try { +String wmsType = "wms" + PLCServiceImpl.capitalize(v.getLabel()); +Field dictCode = ScanStatus.class.getDeclaredField("code"); +Field dictWmsCode = ScanStatus.class.getDeclaredField("wmsCode"); +Field scanCode = getFieldFromHierarchy(finalScan.getClass(), v.getLabel()); +Field scanWmsCode = getFieldFromHierarchy(finalScan.getClass(), wmsType); +if (scanCode != null && scanWmsCode != null) { +dictCode.setAccessible(true); +dictWmsCode.setAccessible(true); +scanCode.setAccessible(true); +scanWmsCode.setAccessible(true); +dictCode.set(scanStatus, scanCode.get(finalScan)); +dictWmsCode.set(scanStatus, scanWmsCode.get(finalScan)); +} else { +System.out.println("Fields not found in the hierarchy."); +} +System.out.println("ScanStatus Code: " + dictCode.get(scanStatus)); +System.out.println("ScanStatus WMS Code: " + dictWmsCode.get(scanStatus)); +} catch (NoSuchFieldException e) { +throw new RuntimeException(e); +} catch (IllegalAccessException e) { +throw new RuntimeException(e); +} +scanStatuses.add(scanStatus); +} +}; +if (scan != null) { +scan.setScan(scanStatuses); +scan.setColour(dictValueMap.get(String.valueOf(scan.getStatus())).getColorType()); +scan.setStatusString(dictValueMap.get(String.valueOf(scan.getStatus())).getLabel()); +} +return success(scan); +} +public static Field getFieldFromHierarchy(Class clazz, String fieldName) { +while (clazz != null) { +try { +return clazz.getDeclaredField(fieldName); +} catch (NoSuchFieldException e) { +clazz = clazz.getSuperclass(); +} +} +return null; +} +@GetMapping("/page") +@Operation(summary = "获得盘点状态分页") +public CommonResult> getStockPage(@Valid StockPageReqVO pageReqVO) { +PageResult pageResult = stockService.getStockPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, StockRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出盘点状态 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportStockExcel(@Valid StockPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = stockService.getStockPage(pageReqVO).getList(); +ExcelUtils.write(response, "盘点状态.xls", "数据", StockRespVO.class, +BeanUtils.toBean(list, StockRespVO.class)); +} +} +StockPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.stock.vo; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - 盘点状态分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class StockPageReqVO extends PageParam { +@Schema(description = "盘点批次好") +private String lotnum; +@Schema(description = "工单任务号") +private String orderNum; +@Schema(description = "盘点任务号") +private String checkNum; +@Schema(description = "扫描条码") +private String code; +@Schema(description = "扫描品规") +private String category; +@Schema(description = "扫描数量", example = "26853") +private Integer count; +@Schema(description = "WMS系统中的条码") +private String wmsCode; +@Schema(description = "WMS系统中的品规") +private String wmsCategory; +@Schema(description = "WMS数量", example = "15545") +private Integer wmsCount; +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "托盘码") +private String trayCode; +@Schema(description = "巷道id", example = "18124") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "内外") +private Integer side; +@Schema(description = "层") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "操作前图片") +private String preoperationPic; +@Schema(description = "操作后图片") +private String overoperationPic; +@Schema(description = "盘点图片") +private String checkPic; +@Schema(description = "时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] exportTime; +@Schema(description = "子标签") +private String subtag; +@Schema(description = "taskId", example = "18629") +private Integer taskWmsId; +@Schema(description = "地址") +private String addre; +@Schema(description = "检查id", example = "17967") +private Integer checkId; +@Schema(description = "视觉状态") +private String statusVision; +@Schema(description = "0:未盘点 1:盘点异常 2:盘点正确 3:人工核对正确", example = "2") +private String status; +@Schema(description = "是否上传1上传") +private String reply; +@Schema(description = "创建时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +} +StockRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.stock.vo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - 盘点状态 Response VO") +@Data +@ExcelIgnoreUnannotated +public class StockRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11784") +@ExcelProperty("id") +private Long id; +@Schema(description = "盘点批次好") +@ExcelProperty("盘点批次好") +private String lotnum; +@Schema(description = "工单任务号") +@ExcelProperty("工单任务号") +private String orderNum; +@Schema(description = "盘点任务号") +@ExcelProperty("盘点任务号") +private String checkNum; +@Schema(description = "扫描条码") +@ExcelProperty("扫描条码") +private String code; +@Schema(description = "扫描品规") +@ExcelProperty("扫描品规") +private String category; +@Schema(description = "扫描数量", example = "26853") +@ExcelProperty("扫描数量") +private Integer count; +@Schema(description = "WMS系统中的条码") +@ExcelProperty("WMS系统中的条码") +private String wmsCode; +@Schema(description = "WMS系统中的品规") +@ExcelProperty("WMS系统中的品规") +private String wmsCategory; +@Schema(description = "WMS数量", example = "15545") +@ExcelProperty("WMS数量") +private Integer wmsCount; +@Schema(description = "wms托盘码") +@ExcelProperty("wms托盘码") +private String wmsTrayCode; +@Schema(description = "托盘码") +@ExcelProperty("托盘码") +private String trayCode; +@Schema(description = "巷道id", example = "18124") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "左右") +@ExcelProperty("左右") +private Integer direction; +@Schema(description = "内外") +@ExcelProperty("内外") +private Integer side; +@Schema(description = "层") +@ExcelProperty("层") +private Integer row; +@Schema(description = "列") +@ExcelProperty("列") +private Integer column; +@Schema(description = "操作前图片") +@ExcelProperty("操作前图片") +private String preoperationPic; +@Schema(description = "操作后图片") +@ExcelProperty("操作后图片") +private String overoperationPic; +@Schema(description = "盘点图片") +@ExcelProperty("盘点图片") +private String checkPic; +@Schema(description = "时间") +@ExcelProperty("时间") +private LocalDateTime exportTime; +@Schema(description = "子标签") +@ExcelProperty("子标签") +private String subtag; +@Schema(description = "taskId", example = "18629") +@ExcelProperty("taskId") +private Integer taskWmsId; +@Schema(description = "地址") +@ExcelProperty("地址") +private String addre; +@Schema(description = "检查id", example = "17967") +@ExcelProperty("检查id") +private Integer checkId; +@Schema(description = "视觉状态") +@ExcelProperty("视觉状态") +private String statusVision; +@Schema(description = "0:未盘点 1:盘点异常 2:盘点正确 3:人工核对正确", example = "2") +@ExcelProperty("0:未盘点 1:盘点异常 2:盘点正确 3:人工核对正确") +private String status; +@Schema(description = "是否上传1上传") +@ExcelProperty("是否上传1上传") +private String reply; +@Schema(description = "创建时间") +@ExcelProperty("创建时间") +private LocalDateTime createTime; +} +StockSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.stock.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - 盘点状态新增/修改 Request VO") +@Data +public class StockSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11784") +private Long id; +@Schema(description = "盘点批次好") +private String lotnum; +@Schema(description = "工单任务号") +private String orderNum; +@Schema(description = "盘点任务号") +private String checkNum; +@Schema(description = "扫描条码") +private String code; +@Schema(description = "扫描品规") +private String category; +@Schema(description = "扫描数量", example = "26853") +private Integer count; +@Schema(description = "WMS系统中的条码") +private String wmsCode; +@Schema(description = "WMS系统中的品规") +private String wmsCategory; +@Schema(description = "WMS数量", example = "15545") +private Integer wmsCount; +@Schema(description = "wms托盘码") +private String wmsTrayCode; +@Schema(description = "托盘码") +private String trayCode; +@Schema(description = "巷道id", example = "18124") +private Integer streetId; +@Schema(description = "左右") +private Integer direction; +@Schema(description = "内外") +private Integer side; +@Schema(description = "层") +private Integer row; +@Schema(description = "列") +private Integer column; +@Schema(description = "操作前图片") +private String preoperationPic; +@Schema(description = "操作后图片") +private String overoperationPic; +@Schema(description = "盘点图片") +private String checkPic; +@Schema(description = "时间") +private LocalDateTime exportTime; +@Schema(description = "子标签") +private String subtag; +@Schema(description = "taskId", example = "18629") +private Integer taskWmsId; +@Schema(description = "地址") +private String addre; +@Schema(description = "检查id", example = "17967") +private Integer checkId; +@Schema(description = "视觉状态") +private String statusVision; +@Schema(description = "0:未盘点 1:盘点异常 2:盘点正确 3:人工核对正确", example = "2") +private String status; +@Schema(description = "是否上传1上传") +private String reply; +@Schema(description = "货位号") +private String storageCode; +} +StockStreetList.java: +package cn.iocoder.yudao.module.camera.controller.admin.stock.vo; +import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO; +import lombok.Data; +import java.util.List; +@Data +public class StockStreetList { +private StreetDO streetDO; +private int rows; +private int columns ; +private int streetId; +private int direction; +private List buttons; +} +StreetController.java: +package cn.iocoder.yudao.module.camera.controller.admin.street; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.street.vo.StreetPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.street.vo.StreetRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.street.vo.StreetSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.rfid.RfidDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.LightSourceDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO; +import cn.iocoder.yudao.module.camera.framework.light.LightFactory; +import cn.iocoder.yudao.module.camera.service.lightsource.LightSourceService; +import cn.iocoder.yudao.module.camera.service.street.StreetService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - 巷道") +@RestController +@RequestMapping("/logistics/street") +@Validated +public class StreetController { +@Resource +private StreetService streetService; +@Resource +private LightSourceService lightSourceService; +@PostMapping("/create") +@Operation(summary = "创建巷道") +public CommonResult createStreet(@Valid @RequestBody StreetSaveReqVO createReqVO) { +return success(streetService.createStreet(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新巷道") +public CommonResult updateStreet(@Valid @RequestBody StreetSaveReqVO updateReqVO) { +streetService.updateStreet(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除巷道") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteStreet(@RequestParam("id") Integer id) { +streetService.deleteStreet(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得巷道") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getStreet(@RequestParam("id") Integer id) { +StreetDO street = streetService.getStreet(id); +StreetRespVO streetRespVO = BeanUtils.toBean(street, StreetRespVO.class); +streetService.getCameraName(streetRespVO); +return success(streetRespVO); +} +@GetMapping("/page") +@Operation(summary = "获得巷道分页") +public CommonResult> getStreetPage(@Valid StreetPageReqVO pageReqVO) { +PageResult pageResult = streetService.getStreetPage(pageReqVO); +PageResult streetRespVO =BeanUtils.toBean(pageResult, StreetRespVO.class); +streetService.getCameraName(streetRespVO.getList()); +return success(streetRespVO); +} +@GetMapping("/list") +@Operation(summary = "获得巷道列表") +public CommonResult> list() { +List pageResult = streetService.list(); +List streetRespVO =BeanUtils.toBean(pageResult, StreetRespVO.class); +streetService.getCameraName(streetRespVO); +return success(streetRespVO); +} +@GetMapping("/export-excel") +@Operation(summary = "导出巷道 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportStreetExcel(@Valid StreetPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = streetService.getStreetPage(pageReqVO).getList(); +ExcelUtils.write(response, "巷道.xls", "数据", StreetRespVO.class, +BeanUtils.toBean(list, StreetRespVO.class)); +} +@GetMapping("/sensor-gun/list-by-street-id") +@Operation(summary = "获得扫码枪列表") +@Parameter(name = "streetId", description = "巷道id") +} +@GetMapping("/light-source/list-by-street-id") +@Operation(summary = "获得光源列表") +@Parameter(name = "streetId", description = "巷道id") +public CommonResult> getLightSourceListByStreetId(@RequestParam("streetId") Integer streetId) { +return success(streetService.getLightSourceListByStreetId(streetId)); +} +@GetMapping("/rfid/list-by-street-id") +@Operation(summary = "获得rfid列表") +@Parameter(name = "streetId", description = "巷道id") +public CommonResult> getRFIDListByStreetId(@RequestParam("streetId") Integer streetId) { +return success(streetService.getRFIDListByStreetId(streetId)); +} +@GetMapping("/lightSource/open") +@Operation(summary = "开启全部光源") +@Parameter(name = "streetId", description = "巷道id") +public CommonResult openLightSource(){ +List list = lightSourceService.list(); +for(LightSourceDO lightSourceDO : list){ +LightFactory.LightController(lightSourceDO,1); +} +return success("开启全部光源"); +} +@GetMapping("/lightSource/close") +@Operation(summary = "关闭全部光源") +public CommonResult closeLightSource(){ +List list = lightSourceService.list(); +for(LightSourceDO lightSourceDO : list){ +LightFactory.LightController(lightSourceDO,0); +} +return success("开启全部光源"); +} +@GetMapping("/lightSource/open/{streetId}") +@Operation(summary = "开启单个巷道光源") +public CommonResult openStreetLightSource(@PathVariable Integer streetId){ +List list = streetService.getLightSourceListByStreetId(streetId); +for(LightSourceDO lightSourceDO : list){ +LightFactory.LightController(lightSourceDO,1); +} +return success("开启全部光源"); +} +@GetMapping("/lightSource/close/{streetId}") +@Operation(summary = "关闭单个巷道光源") +public CommonResult closeStreetLightSource(@PathVariable Integer streetId){ +List list = streetService.getLightSourceListByStreetId(streetId); +for(LightSourceDO lightSourceDO : list){ +LightFactory.LightController(lightSourceDO,0); +} +return success("开启全部光源"); +} +} +StreetPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.street.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +@Schema(description = "管理后台 - 巷道分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class StreetPageReqVO extends PageParam { +@Schema(description = "名称", example = "李四") +private String name; +@Schema(description = "巷道id", example = "16768") +private String plcId; +} +StreetRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.street.vo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - 巷道 Response VO") +@Data +@ExcelIgnoreUnannotated +public class StreetRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9507") +@ExcelProperty("id") +private Integer id; +@Schema(description = "名称", example = "李四") +@ExcelProperty("名称") +private String name; +@Schema(description = "巷道id", example = "16768") +@ExcelProperty("巷道id") +private String plcId; +@Schema(description = "巷道ip") +@ExcelProperty("巷道ip") +private String plcIp; +@Schema(description = "巷道端口") +@ExcelProperty("巷道端口") +private Integer plcPort; +@Schema(description = "左货架类型 0:单伸 1:双伸", example = "1") +@ExcelProperty("左货架类型 0:单伸 1:双伸") +private Integer leftType; +@Schema(description = "左货架列数量") +@ExcelProperty("左货架列数量") +private Integer leftColumn; +@Schema(description = "左货架行数量") +@ExcelProperty("左货架行数量") +private Integer leftRow; +@Schema(description = "右货架类型 0:单伸 1:双伸", example = "1") +@ExcelProperty("右货架类型 0:单伸 1:双伸") +private Integer rightType; +@Schema(description = "右货架列数量") +@ExcelProperty("右货架列数量") +private Integer rightColumn; +@Schema(description = "右货架行数量") +@ExcelProperty("右货架行数量") +private Integer rightRow; +@Schema(description = "球机1", example = "28615") +@ExcelProperty("球机") +private Integer camera1Id; +@Schema(description = "球机1名称", example = "28615") +@ExcelProperty("球机名") +private String camera1Name; +@Schema(description = "球机", example = "9539") +@ExcelProperty("球机名") +private Integer camera2Id; +@Schema(description = "球机2名称", example = "9539") +@ExcelProperty("球机") +private String camera2Name; +@Schema(description = "修改时间") +@ExcelProperty("修改时间") +private LocalDateTime updateTime; +} +StreetSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.street.vo; +import cn.iocoder.yudao.module.camera.dal.dataobject.rfid.RfidDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.LightSourceDO; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import java.util.List; +@Schema(description = "管理后台 - 巷道新增/修改 Request VO") +@Data +public class StreetSaveReqVO { +@Schema(description = "id", example = "id") +private Integer id; +@Schema(description = "名称", example = "李四") +private String name; +@Schema(description = "巷道id", example = "16768") +private String plcId; +@Schema(description = "巷道ip") +private String plcIp; +@Schema(description = "巷道端口") +private Integer plcPort; +@Schema(description = "左货架类型 0:单伸 1:双伸", example = "1") +private Integer leftType; +@Schema(description = "左货架列数量") +private Integer leftColumn; +@Schema(description = "左货架行数量") +private Integer leftRow; +@Schema(description = "右货架类型 0:单伸 1:双伸", example = "1") +private Integer rightType; +@Schema(description = "右货架列数量") +private Integer rightColumn; +@Schema(description = "右货架行数量") +private Integer rightRow; +@Schema(description = "球机", example = "28615") +private Integer camera1Id; +@Schema(description = "球机", example = "9539") +private Integer camera2Id; +@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED) +@NotNull(message = "是否删除不能为空") +private Boolean deleted = false; +@Schema(description = "扫码枪列表") +@Schema(description = "扫码枪列表") +private List rfids; +@Schema(description = "光源列表") +private List lightSources; +} +TcpClientController.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclient; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo.TcpClientPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo.TcpClientRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo.TcpClientSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.tcpclient.TcpClientDO; +import cn.iocoder.yudao.module.camera.framework.netty.NettyClientInter; +import cn.iocoder.yudao.module.camera.service.tcpclient.TcpClientService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - netty客户端连接") +@RestController +@RequestMapping("/logistics/tcp-client") +@Validated +public class TcpClientController { +@Resource +private TcpClientService tcpClientService; +@Resource +private NettyClientInter nettyClientInter; +@PostMapping("/create") +@Operation(summary = "创建netty客户端连接") +public CommonResult createTcpClient(@Valid @RequestBody TcpClientSaveReqVO createReqVO) { +return success(tcpClientService.createTcpClient(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新netty客户端连接") +public CommonResult updateTcpClient(@Valid @RequestBody TcpClientSaveReqVO updateReqVO) { +tcpClientService.updateTcpClient(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除netty客户端连接") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteTcpClient(@RequestParam("id") Integer id) { +tcpClientService.deleteTcpClient(id); +return success(true); +} +@PutMapping("/conn") +@Operation(summary = "连接netty客户端连接") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult connTcpClient(@RequestParam("id") Integer id) { +TcpClientRespVO item =BeanUtils.toBean(tcpClientService.getTcpClient(id), TcpClientRespVO.class) ; +if(nettyClientInter.getStatus(tcpClientService.getNettyVo(item)) == 1){ +return error(523,"已连接成功"); +}else { +tcpClientService.connect(id); +return success(true); +} +} +@DeleteMapping("/disconn") +@Operation(summary = "断连netty客户端连接") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult disconnTcpClient(@RequestParam("id") Integer id) { +TcpClientRespVO item =BeanUtils.toBean(tcpClientService.getTcpClient(id), TcpClientRespVO.class) ; +if(nettyClientInter.getStatus(tcpClientService.getNettyVo(item)) == 1){ +tcpClientService.disConnect(id); +return success(true); +}else { +return error(523,"已断开连接"); +} +} +@GetMapping("/get") +@Operation(summary = "获得netty客户端连接") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getTcpClient(@RequestParam("id") Integer id) { +TcpClientDO tcpClient = tcpClientService.getTcpClient(id); +return success(BeanUtils.toBean(tcpClient, TcpClientRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得netty客户端连接分页") +public CommonResult> getTcpClientPage(@Valid TcpClientPageReqVO pageReqVO) { +PageResult pageResult = tcpClientService.getTcpClientPage(pageReqVO); +PageResult page = BeanUtils.toBean(pageResult, TcpClientRespVO.class); +page.getList().forEach(item -> { +item.setStatus(nettyClientInter.getStatus(tcpClientService.getNettyVo(item))); +}); +return success(page); +} +@GetMapping("/export-excel") +@Operation(summary = "导出netty客户端连接 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportTcpClientExcel(@Valid TcpClientPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = tcpClientService.getTcpClientPage(pageReqVO).getList(); +ExcelUtils.write(response, "netty客户端连接.xls", "数据", TcpClientRespVO.class, +BeanUtils.toBean(list, TcpClientRespVO.class)); +} +} +TcpClientPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - netty客户端连接分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TcpClientPageReqVO extends PageParam { +@Schema(description = "连接名称", example = "李四") +private String name; +@Schema(description = "端口") +private Integer port; +@Schema(description = "ip") +private String ip; +@Schema(description = "处理器类型", example = "2") +private String type; +@Schema(description = "创建时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +@Schema(description = "重试个数", example = "-1") +private Integer reconnectNum; +@Schema(description = "重试间隔时间", example = "3000") +private Integer reconnectInterval; +} +TcpClientRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.time.LocalDateTime; +@Schema(description = "管理后台 - netty客户端连接 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TcpClientRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6449") +@ExcelProperty("id") +private Integer id; +@Schema(description = "连接名称", example = "李四") +@ExcelProperty("连接名称") +private String name; +@Schema(description = "连接状态", example = "1") +@ExcelProperty("状态") +private Integer status; +@Schema(description = "端口") +@ExcelProperty("端口") +private Integer port; +@Schema(description = "ip") +@ExcelProperty("ip") +private String ip; +@Schema(description = "处理器类型", example = "2") +@ExcelProperty(value = "处理器类型", converter = DictConvert.class) +@DictFormat("tcp_processor") +private String type; +@Schema(description = "创建时间") +@ExcelProperty("创建时间") +private LocalDateTime createTime; +@Schema(description = "重试个数", example = "-1") +@ExcelProperty("重试个数") +private Integer reconnectNum; +@Schema(description = "重试间隔时间", example = "3000") +@ExcelProperty("重试间隔时间") +private Integer reconnectInterval; +} +TcpClientSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclient.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - netty客户端连接新增/修改 Request VO") +@Data +public class TcpClientSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6449") +private Integer id; +@Schema(description = "连接名称", example = "李四") +private String name; +@Schema(description = "端口") +private Integer port; +@Schema(description = "ip") +private String ip; +@Schema(description = "处理器类型", example = "2") +private String type; +@Schema(description = "重试个数", example = "-1") +private Integer reconnectNum; +@Schema(description = "重试间隔时间", example = "3000") +private Integer reconnectInterval; +} +TcpClientLogController.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo.TcpClientLogPageReqVO; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo.TcpClientLogRespVO; +import cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo.TcpClientLogSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.tcpclientlog.TcpClientLogDO; +import cn.iocoder.yudao.module.camera.service.tcpclientlog.TcpClientLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "管理后台 - netty客户端日志") +@RestController +@RequestMapping("/logistics/tcp-client-log") +@Validated +public class TcpClientLogController { +@Resource +private TcpClientLogService tcpClientLogService; +@PostMapping("/create") +@Operation(summary = "创建netty客户端连接日志") +public CommonResult createTcpClientLog(@Valid @RequestBody TcpClientLogSaveReqVO createReqVO) { +return success(tcpClientLogService.createTcpClientLog(createReqVO)); +} +@PutMapping("/update") +@Operation(summary = "更新netty客户端连接日志") +public CommonResult updateTcpClientLog(@Valid @RequestBody TcpClientLogSaveReqVO updateReqVO) { +tcpClientLogService.updateTcpClientLog(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除netty客户端连接日志") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteTcpClientLog(@RequestParam("id") Integer id) { +tcpClientLogService.deleteTcpClientLog(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得netty客户端连接日志") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getTcpClientLog(@RequestParam("id") Integer id) { +TcpClientLogDO tcpClientLog = tcpClientLogService.getTcpClientLog(id); +return success(BeanUtils.toBean(tcpClientLog, TcpClientLogRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得netty客户端连接分页日志") +public CommonResult> getTcpClientLogPage(@Valid TcpClientLogPageReqVO pageReqVO) { +PageResult pageResult = tcpClientLogService.getTcpClientLogPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, TcpClientLogRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出netty客户端连接日志 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportTcpClientLogExcel(@Valid TcpClientLogPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = tcpClientLogService.getTcpClientLogPage(pageReqVO).getList(); +ExcelUtils.write(response, "netty客户端连接.xls", "数据", TcpClientLogRespVO.class, +BeanUtils.toBean(list, TcpClientLogRespVO.class)); +} +} +TcpClientLogPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "管理后台 - netty客户端连接分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TcpClientLogPageReqVO extends PageParam { +@Schema(description = "连接名称", example = "张三") +private String name; +@Schema(description = "端口") +private Integer port; +@Schema(description = "ip") +private String ip; +@Schema(description = "处理器类型", example = "1") +private String tcpType; +@Schema(description = "创建时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +@Schema(description = "信息") +private String info; +@Schema(description = "类型,接收或发送", example = "2") +private Integer type; +} +TcpClientLogRespVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "管理后台 - netty客户端连接 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TcpClientLogRespVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18307") +@ExcelProperty("id") +private Integer id; +@Schema(description = "连接名称", example = "张三") +@ExcelProperty("连接名称") +private String name; +@Schema(description = "端口") +@ExcelProperty("端口") +private Integer port; +@Schema(description = "ip") +@ExcelProperty("ip") +private String ip; +@Schema(description = "处理器类型", example = "1") +@ExcelProperty(value = "处理器类型", converter = DictConvert.class) +@DictFormat("tcp_processor") +private String tcpType; +@Schema(description = "创建时间") +@ExcelProperty("创建时间") +private LocalDateTime createTime; +@Schema(description = "信息") +@ExcelProperty("信息") +private String info; +@Schema(description = "类型,接收或发送", example = "2") +@ExcelProperty(value = "类型,接收或发送", converter = DictConvert.class) +@DictFormat("tcp_log_status") +private Integer type; +} +TcpClientLogSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.admin.tcpclientlog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "管理后台 - netty客户端连接新增/修改 Request VO") +@Data +public class TcpClientLogSaveReqVO { +@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18307") +private Integer id; +@Schema(description = "连接名称", example = "张三") +private String name; +@Schema(description = "端口") +private Integer port; +@Schema(description = "ip") +private String ip; +@Schema(description = "处理器类型", example = "1") +private String tcpType; +@Schema(description = "信息") +private String info; +@Schema(description = "类型,接收或发送", example = "2") +private Integer type; +} +AppStockLogController.java: +package cn.iocoder.yudao.module.camera.controller.app.stocklog; +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.camera.controller.app.stocklog.vo.AppStockLogPageReqVO; +import cn.iocoder.yudao.module.camera.controller.app.stocklog.vo.AppStockLogRespVO; +import cn.iocoder.yudao.module.camera.controller.app.stocklog.vo.AppStockLogSaveReqVO; +import cn.iocoder.yudao.module.camera.dal.dataobject.stocklog.StockLogDO; +import cn.iocoder.yudao.module.camera.framework.netty.streetAlgorithm.executor.AlgorithmDelayTask; +import cn.iocoder.yudao.module.camera.service.stocklog.StockLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import java.io.IOException; +import java.util.List; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +@Tag(name = "用户 APP - 货位历史") +@RestController +@RequestMapping("/logistics/stock-log") +@Validated +public class AppStockLogController { +@Resource +private StockLogService stockLogService; +@PostMapping("/create") +@Operation(summary = "创建货位历史") +public CommonResult createStockLog(@Valid @RequestBody AppStockLogSaveReqVO createReqVO) { +return success(stockLogService.createStockLog(createReqVO)); +} +@PostMapping("/taskSetHttp") +@Operation(summary = "货位情况上传测试") +public CommonResult taskSetHttp( @RequestBody AlgorithmDelayTask algorithmDelayTask) { +System.out.println(algorithmDelayTask); +return success(1); +} +@PutMapping("/update") +@Operation(summary = "更新货位历史") +public CommonResult updateStockLog(@Valid @RequestBody AppStockLogSaveReqVO updateReqVO) { +stockLogService.updateStockLog(updateReqVO); +return success(true); +} +@DeleteMapping("/delete") +@Operation(summary = "删除货位历史") +@Parameter(name = "id", description = "编号", required = true) +public CommonResult deleteStockLog(@RequestParam("id") Integer id) { +stockLogService.deleteStockLog(id); +return success(true); +} +@GetMapping("/get") +@Operation(summary = "获得货位历史") +@Parameter(name = "id", description = "编号", required = true, example = "1024") +public CommonResult getStockLog(@RequestParam("id") Integer id) { +StockLogDO stockLog = stockLogService.getStockLog(id); +return success(BeanUtils.toBean(stockLog, AppStockLogRespVO.class)); +} +@GetMapping("/page") +@Operation(summary = "获得货位历史分页") +public CommonResult> getStockLogPage(@Valid AppStockLogPageReqVO pageReqVO) { +PageResult pageResult = stockLogService.getStockLogPage(pageReqVO); +return success(BeanUtils.toBean(pageResult, AppStockLogRespVO.class)); +} +@GetMapping("/export-excel") +@Operation(summary = "导出货位历史 Excel") +@ApiAccessLog(operateType = EXPORT) +public void exportStockLogExcel(@Valid AppStockLogPageReqVO pageReqVO, +HttpServletResponse response) throws IOException { +pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); +List list = stockLogService.getStockLogPage(pageReqVO).getList(); +ExcelUtils.write(response, "货位历史.xls", "数据", AppStockLogRespVO.class, +BeanUtils.toBean(list, AppStockLogRespVO.class)); +} +} +AppStockLogPageReqVO.java: +package cn.iocoder.yudao.module.camera.controller.app.stocklog.vo; +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +@Schema(description = "用户 APP - 货位历史分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AppStockLogPageReqVO extends PageParam { +@Schema(description = "左右", example = "1") +private Integer direction; +@Schema(description = "内外", example = "1") +private Integer side; +@Schema(description = "层", example = "5") +private Integer row; +@Schema(description = "列", example = "20") +private Integer column; +@Schema(description = "随行工单号", example = "12") +private String orderNum; +@Schema(description = "状态", example = "1") +private Integer type; +@Schema(description = "创建时间") +@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) +private LocalDateTime[] createTime; +} +AppStockLogRespVO.java: +package cn.iocoder.yudao.module.camera.controller.app.stocklog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +@Schema(description = "用户 APP - 货位历史 Response VO") +@Data +@ExcelIgnoreUnannotated +public class AppStockLogRespVO { +@Schema(description = "巷道id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6409") +@ExcelProperty("巷道id") +private Integer streetId; +@Schema(description = "左右", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") +@ExcelProperty(value = "左右", converter = DictConvert.class) +@DictFormat("direction") +private Integer direction; +@Schema(description = "内外", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") +@ExcelProperty(value = "内外", converter = DictConvert.class) +@DictFormat("side") +private Integer side; +@Schema(description = "层", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") +@ExcelProperty("层") +private Integer row; +@Schema(description = "列", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") +@ExcelProperty("列") +private Integer column; +@Schema(description = "随行工单号", example = "12") +@ExcelProperty("随行工单号") +private String orderNum; +@Schema(description = "图片") +@ExcelProperty("图片") +private String pic; +@Schema(description = "状态", example = "1") +@ExcelProperty(value = "状态", converter = DictConvert.class) +@DictFormat("check_status") +private Integer type; +@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) +@ExcelProperty("创建时间") +private LocalDateTime createTime; +} +AppStockLogSaveReqVO.java: +package cn.iocoder.yudao.module.camera.controller.app.stocklog.vo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +@Schema(description = "用户 APP - 货位历史新增/修改 Request VO") +@Data +public class AppStockLogSaveReqVO { +} +CameraDO.java: +package cn.iocoder.yudao.module.camera.dal.dataobject.camera; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +@TableName("logistics_camera") +@KeySequence("logistics_camera_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CameraDO extends BaseDO { +@TableId +private Integer id; +private String name; +private Integer type; +private String ip; +private Integer port; +private String user; +private String password; +private Integer ptzId; +private String rtcServer; +private Integer rtcServerPort; +private Integer rtspPort; +private String channel; +private String recorderIp; +} +CameraIoDO.java: +package cn.iocoder.yudao.module.camera.dal.dataobject.cameraio; +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +@TableName("logistics_camera_io") +@KeySequence("logistics_camera_io_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CameraIoDO extends BaseDO { +@TableId +private Integer id; +private String name; +private String code; +private Integer cameraId; +private Integer ptzId; +private String position; +private String focusing; +private String aperture; +private String multiple; +} +CameraIoConfigDO.java: +package cn.iocoder.yudao.module.camera.dal.dataobject.cameraioconfig; +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +@TableName("logistics_camera_io_config") +@KeySequence("logistics_camera_io_config_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CameraIoConfigDO extends BaseDO { +@TableId +private Integer id; +private String code; +private String name; +} +CheckLogDO.java: +package cn.iocoder.yudao.module.camera.dal.dataobject.checklog; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.resources.URLResourcesDo; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +import java.time.LocalDateTime; +import java.util.List; +@TableName("logistics_check_log") +@KeySequence("logistics_check_log_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CheckLogDO extends BaseDO { +private String lotnum; +private Integer direction; +private Integer side; +@TableField("`row`") +private Integer row; +@TableField("`column`") +private Integer column; +private String code; +private String wmsCode; +private String trayCode; +private String wmsTrayCode; +private String category; +private String count; +private Integer status; +private String checkNum; +private String pic; +private Integer streetId; +@TableField(exist = false) +private String streetName; +@TableField(exist = false) +private List urlResources; +private LocalDateTime exportTime; +@TableId +private Integer id; +private String subtag; +private String taskId; +private String wmsCategory; +private String wmsCount; +private String statusVision; +} +OrderDO.java: diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/stock/StockController.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/stock/StockController.java index fe1f3a9..be75be1 100644 --- a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/stock/StockController.java +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/stock/StockController.java @@ -20,6 +20,8 @@ import cn.iocoder.yudao.module.camera.dal.entity.echarts.EChartsOption; import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService; import cn.iocoder.yudao.module.camera.service.plc.PLCServiceImpl; import cn.iocoder.yudao.module.camera.service.resources.URLResourcesService; +import cn.iocoder.yudao.module.camera.service.scan.ScanServiceFactory; +import cn.iocoder.yudao.module.camera.service.sensorgun.SensorGunService; import cn.iocoder.yudao.module.camera.service.stock.StockService; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; import cn.iocoder.yudao.module.system.service.dict.DictDataService; @@ -30,6 +32,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -47,6 +50,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @RestController @RequestMapping("/logistics/stock") @Validated +@Slf4j public class StockController { @Resource @@ -127,8 +131,44 @@ public class StockController { @Resource CheckLogService checkLogService; + @Resource + private ScanServiceFactory scanServiceFactory; + + @Resource + private SensorGunService sensorService ; +// +// @PostMapping("/getStreetStatus") +// @Operation(summary = "获得巷道所有盘点状态") +// //@Parameter(name = "id", description = "巷道id", required = true, example = "1024") +// @PreAuthorize("@ss.hasPermission('logistics:stock:getStreetList')") +// public CommonResult> scan(@RequestBody ScanData scanData) { +// cn.iocoder.yudao.module.camera.dal.dataobject.sensorgun.SensorGunDO sensorGun = sensorService.getOne(new QueryWrapper() +// .eq("street_id", scanData.getId()) +// .eq("direction", scanData.getDirection())); +// +// String trayCode = ""; +// if (sensorGun == null) { +// log.error("no sensor gun config in database ,street id:{},direction:{}", scanData.getId(), scanData.getDirection()); +// } else { +// Map photos = getStart(sensorGun.getIp()); +// if(photos.get("code") != null){ +// photos.put("code",photos.get("code").replaceAll("^0+", "")); +// } +// +// +// scanData.setCode(photos.get("code")); +// +// +// String path = "http://" + dictDataService.parseDictData("base_conf", "local_path").getValue() + ":9007/pic/"+ photos.get("url"); +// urlResourcesService.save(URLResourcesDo.builder().url(path).uuid(stockDO.getCheckPic()).type("1").little("扫码枪").build()); +//// trayCode = readOCR(sensorGun.getIp(), sensorGun.getPort()); +// } +// return success(scanDataList); +// } @Resource URLResourcesService urlResourcesService; + + @PostMapping("/getStockStatus") @Operation(summary = "获得盘点状态") //@Parameter(name = "id", description = "巷道id", required = true, example = "1024") diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/street/StreetController.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/street/StreetController.java index ef80773..932b928 100644 --- a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/street/StreetController.java +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/controller/admin/street/StreetController.java @@ -173,7 +173,7 @@ public class StreetController { LightFactory.LightController(lightSourceDO,1); } - return success("开启全部光源"); + return success("开启光源"+streetId); } @GetMapping("/lightSource/close/{streetId}") @@ -184,6 +184,6 @@ public class StreetController { LightFactory.LightController(lightSourceDO,0); } - return success("开启全部光源"); + return success("close光源"+streetId); } } \ No newline at end of file diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/CodeExtractor.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/CodeExtractor.java new file mode 100644 index 0000000..83ea91d --- /dev/null +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/CodeExtractor.java @@ -0,0 +1,4 @@ +package cn.iocoder.yudao.module.camera.service.plc; + +public class CodeExtractor { +} diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/PLCServiceImpl.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/PLCServiceImpl.java index f028dc5..8dfee15 100644 --- a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/PLCServiceImpl.java +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/plc/PLCServiceImpl.java @@ -8,12 +8,14 @@ import cn.iocoder.yudao.module.camera.dal.dataobject.resources.URLResourcesDo; import cn.iocoder.yudao.module.camera.dal.dataobject.sensorgun.SensorGunDO; import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO; import cn.iocoder.yudao.module.camera.dal.dataobject.stocklog.StockLogDO; +import cn.iocoder.yudao.module.camera.dal.dataobject.street.LightSourceDO; import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO; import cn.iocoder.yudao.module.camera.dal.entity.ScanData; import cn.iocoder.yudao.module.camera.dal.mysql.checklog.CheckLogMapper; import cn.iocoder.yudao.module.camera.dal.mysql.order.OrderMapper; import cn.iocoder.yudao.module.camera.dal.mysql.sensorgun.SensorGunMapper; import cn.iocoder.yudao.module.camera.dal.mysql.stocklog.StockLogMapper; +import cn.iocoder.yudao.module.camera.framework.light.LightFactory; import cn.iocoder.yudao.module.camera.framework.netty.ksec.KsecDataInfo; import cn.iocoder.yudao.module.camera.framework.netty.ksec.KsecInfo; import cn.iocoder.yudao.module.camera.framework.netty.streetAlgorithm.executor.AlgorithmDelayTask; @@ -21,6 +23,7 @@ import cn.iocoder.yudao.module.camera.framework.netty.streetAlgorithm.executor.G import cn.iocoder.yudao.module.camera.service.camera.CameraService; import cn.iocoder.yudao.module.camera.service.cameraio.CameraIoService; import cn.iocoder.yudao.module.camera.service.checklog.CheckLogService; +import cn.iocoder.yudao.module.camera.service.lightsource.LightSourceService; import cn.iocoder.yudao.module.camera.service.resources.URLResourcesService; import cn.iocoder.yudao.module.camera.service.scan.ScanGunScanServiceImpl; import cn.iocoder.yudao.module.camera.service.scan.ScanServiceFactory; @@ -183,6 +186,8 @@ public class PLCServiceImpl implements PLCService { @Resource ScanServiceFactory scanServiceFactory; + @Resource + LightSourceService lightSourceService; ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); // 设置线程最大执行时间,单位为毫秒 @@ -196,6 +201,8 @@ public class PLCServiceImpl implements PLCService { //头部拍照 StreetDO street = streetService.getStreetByPlcId(dataInfo.getSRMNumber()); + LightSourceDO lightSourceDO = lightSourceService.getOne(new QueryWrapper().eq("street_id", street.getId()).last("limit 1")); + LightFactory.LightController(lightSourceDO,1); // 获取记录 StockDO stock = stockService.getOne( new QueryWrapper() @@ -316,6 +323,8 @@ public class PLCServiceImpl implements PLCService { long end = System.currentTimeMillis(); long s = end - startTime; log.info("time:{}millisecond", s); + + LightFactory.LightController(lightSourceDO,0); // //ocr识别 // AlgorithmDelayTask algorithmDelayTask = new AlgorithmDelayTask(dataInfo.getFromDirection(),street.getPlcId() // ,dataInfo.getTaskId(),10000,code,"E1",dataInfo.getFromRow(),dataInfo.getFromColumn()); @@ -329,6 +338,9 @@ public class PLCServiceImpl implements PLCService { //头部拍照 StreetDO street = streetService.getStreetByPlcId(dataInfo.getSRMNumber()); + + LightSourceDO lightSourceDO = lightSourceService.getOne(new QueryWrapper().eq("street_id", street.getId()).last("limit 1")); + LightFactory.LightController(lightSourceDO,1); // 获取记录 StockDO stock = stockService.getOne( new QueryWrapper() @@ -469,8 +481,10 @@ public class PLCServiceImpl implements PLCService { algorithmDelayTask.setUuid(uuid); getPhotoDelayExecutor.communicationFactory(algorithmDelayTask); - + LightFactory.LightController(lightSourceDO,0); } + + public static String capitalize(String str) { if (str == null || str.isEmpty()) { return str; diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/postConstruct/LightConstruct.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/postConstruct/LightConstruct.java index 531327b..28e8341 100644 --- a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/postConstruct/LightConstruct.java +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/postConstruct/LightConstruct.java @@ -20,8 +20,7 @@ public class LightConstruct { public void nettyClientInit(){ List list = lightSourceService.list(); for(LightSourceDO lightSourceDO : list){ - LightFactory.LightController(lightSourceDO,1); + LightFactory.LightController(lightSourceDO,0); } - } } diff --git a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/scan/ScanGunScanServiceImpl.java b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/scan/ScanGunScanServiceImpl.java index 21e89d5..5222211 100644 --- a/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/scan/ScanGunScanServiceImpl.java +++ b/yudao-module-logistics/yudao-module-logistics-biz/src/main/java/cn/iocoder/yudao/module/camera/service/scan/ScanGunScanServiceImpl.java @@ -1,20 +1,26 @@ package cn.iocoder.yudao.module.camera.service.scan; +import cn.iocoder.yudao.module.camera.dal.dataobject.resources.URLResourcesDo; import cn.iocoder.yudao.module.camera.dal.dataobject.sensorgun.SensorGunDO; import cn.iocoder.yudao.module.camera.dal.dataobject.stock.StockDO; import cn.iocoder.yudao.module.camera.dal.dataobject.street.StreetDO; import cn.iocoder.yudao.module.camera.dal.entity.ScanData; import cn.iocoder.yudao.module.camera.framework.netty.ksec.KsecDataInfo; +import cn.iocoder.yudao.module.camera.service.resources.URLResourcesService; import cn.iocoder.yudao.module.camera.service.sensorgun.SensorGunService; +import cn.iocoder.yudao.module.system.service.dict.DictDataService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; import java.io.*; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; @Slf4j @Service("scanGunScanService") @@ -80,6 +86,10 @@ public class ScanGunScanServiceImpl implements ScanService{ byte[]bytes = startCmd.getBytes(StandardCharsets.UTF_8); os.write(bytes); } + @Resource + private URLResourcesService urlResourcesService; + @Resource + private DictDataService dictDataService; private static String read(InputStream inStream) throws IOException { BufferedReader bd = new BufferedReader(new InputStreamReader(inStream)); @@ -88,14 +98,51 @@ public class ScanGunScanServiceImpl implements ScanService{ @Override public ScanData scan(StreetDO streetDO, KsecDataInfo dataInfo, StockDO stockDO) { ScanData scanData = new ScanData(); - SensorGunDO sensorGun = sensorService.getOne(new QueryWrapper().eq("street_id", streetDO.getId()).eq("direction", dataInfo.getFromDirection())); + SensorGunDO sensorGun = sensorService.getOne(new QueryWrapper() + .eq("street_id", streetDO.getId()) + .eq("direction", dataInfo.getFromDirection())); + String trayCode = ""; if (sensorGun == null) { log.error("no sensor gun config in database ,street id:{},direction:{}", streetDO.getId(), dataInfo.getFromDirection()); } else { - trayCode = readOCR(sensorGun.getIp(), sensorGun.getPort()); + Map photos = getStart(sensorGun.getIp()); + if(photos.get("code") != null){ + photos.put("code",photos.get("code").replaceAll("^0+", "")); + } + + + scanData.setCode(photos.get("code")); + + + String path = "http://" + dictDataService.parseDictData("base_conf", "local_path").getValue() + ":9007/pic/"+ photos.get("url"); + urlResourcesService.save(URLResourcesDo.builder().url(path).uuid(stockDO.getCheckPic()).type("1").little("扫码枪").build()); +// trayCode = readOCR(sensorGun.getIp(), sensorGun.getPort()); } - scanData.setCode(trayCode); return scanData; } + @Resource + private RestTemplate restTemplate; + + + public Map getStart(String ip) { + + String url = String.format("http://127.0.0.1:9002/start?ip=%s", ip); + + try { +// // 准备POST请求参数 +// Map requestBody = new HashMap<>(); +// requestBody.put("aisle", aisle); + + // 发送POST请求并直接转换为Map + Map response = restTemplate.getForObject(url, Map.class); + + log.info("Received photo paths response: {}", response); + return response; + } catch (Exception e) { + // 处理异常 + e.printStackTrace(); + return new HashMap<>(); + } + } }