diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java new file mode 100644 index 0000000..19c3fab --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java @@ -0,0 +1,68 @@ +package com.casic.missiles.model.workbench; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 工作台-日历日程安排表 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@ApiModel +@Data +@TableName("workbench_calendar_schedule") +public class WorkbenchCalendarSchedule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id", dataType = "Long") + @TableId("id") + private Long id; + + @ApiModelProperty(value = "id", dataType = "Long") + @NotNull(message = "登录用户id不能为空") + @TableField("user_id") + private Long userId; + + /** + * 日程日期 + */ + @ApiModelProperty(value = "日期(格式:2023-06-16)", dataType = "String") + @NotEmpty(message = "日期不能为空") + @TableField("schedule_date") + private String scheduleDate; + + /** + * 日程安排事宜 + */ + @ApiModelProperty(value = "日程安排", dataType = "String") + @NotEmpty(message = "日程安排不能为空") + @TableField("schedule_matters") + private String scheduleMatters; + + /** + * 创建时间 + */ + @ApiModelProperty(hidden = true) + @TableField("create_time") + private String createTime; + + /** + * 更新时间 + */ + @ApiModelProperty(hidden = true) + @TableField("update_time") + private String updateTime; + +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java new file mode 100644 index 0000000..19c3fab --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java @@ -0,0 +1,68 @@ +package com.casic.missiles.model.workbench; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 工作台-日历日程安排表 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@ApiModel +@Data +@TableName("workbench_calendar_schedule") +public class WorkbenchCalendarSchedule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id", dataType = "Long") + @TableId("id") + private Long id; + + @ApiModelProperty(value = "id", dataType = "Long") + @NotNull(message = "登录用户id不能为空") + @TableField("user_id") + private Long userId; + + /** + * 日程日期 + */ + @ApiModelProperty(value = "日期(格式:2023-06-16)", dataType = "String") + @NotEmpty(message = "日期不能为空") + @TableField("schedule_date") + private String scheduleDate; + + /** + * 日程安排事宜 + */ + @ApiModelProperty(value = "日程安排", dataType = "String") + @NotEmpty(message = "日程安排不能为空") + @TableField("schedule_matters") + private String scheduleMatters; + + /** + * 创建时间 + */ + @ApiModelProperty(hidden = true) + @TableField("create_time") + private String createTime; + + /** + * 更新时间 + */ + @ApiModelProperty(hidden = true) + @TableField("update_time") + private String updateTime; + +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java new file mode 100644 index 0000000..48a14ac --- /dev/null +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java @@ -0,0 +1,71 @@ +package com.casic.missiles.service.Impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.mapper.workbench.WorkbenchCalendarScheduleMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 工作台-日历日程安排表 服务实现类 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Service +public class WorkbenchCalendarScheduleServiceImpl extends ServiceImpl implements IWorkbenchCalendarScheduleService { + @Autowired + private WorkbenchCalendarScheduleMapper calendarScheduleMapper; + + @Override + public Map> calendarScheduleList(CalendarScheduleListRequest request) { + String calendarMonth = request.getCalendarMonth(); + Long userId = request.getUserId(); + List list = calendarScheduleMapper.selectListByMonth(calendarMonth, userId); + if(CollectionUtils.isEmpty(list)){ + return new HashMap<>(); + } + Map> resultMap = list.stream().collect( + Collectors.groupingBy(WorkbenchCalendarSchedule::getScheduleDate) + ); + return resultMap; + } + + @Override + public ReturnDTO calendarScheduleAdd(List calendarScheduleList) { + if (this.saveBatch(calendarScheduleList)) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO updateCalendarSchedule(WorkbenchCalendarSchedule calendarSchedule) { + if(calendarScheduleMapper.updateById(calendarSchedule) > 0) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO deleteCalendarSchedule(Long id) { + if(calendarScheduleMapper.deleteById(id) > 0){ + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } +} diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java new file mode 100644 index 0000000..19c3fab --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java @@ -0,0 +1,68 @@ +package com.casic.missiles.model.workbench; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 工作台-日历日程安排表 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@ApiModel +@Data +@TableName("workbench_calendar_schedule") +public class WorkbenchCalendarSchedule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id", dataType = "Long") + @TableId("id") + private Long id; + + @ApiModelProperty(value = "id", dataType = "Long") + @NotNull(message = "登录用户id不能为空") + @TableField("user_id") + private Long userId; + + /** + * 日程日期 + */ + @ApiModelProperty(value = "日期(格式:2023-06-16)", dataType = "String") + @NotEmpty(message = "日期不能为空") + @TableField("schedule_date") + private String scheduleDate; + + /** + * 日程安排事宜 + */ + @ApiModelProperty(value = "日程安排", dataType = "String") + @NotEmpty(message = "日程安排不能为空") + @TableField("schedule_matters") + private String scheduleMatters; + + /** + * 创建时间 + */ + @ApiModelProperty(hidden = true) + @TableField("create_time") + private String createTime; + + /** + * 更新时间 + */ + @ApiModelProperty(hidden = true) + @TableField("update_time") + private String updateTime; + +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java new file mode 100644 index 0000000..48a14ac --- /dev/null +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java @@ -0,0 +1,71 @@ +package com.casic.missiles.service.Impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.mapper.workbench.WorkbenchCalendarScheduleMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 工作台-日历日程安排表 服务实现类 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Service +public class WorkbenchCalendarScheduleServiceImpl extends ServiceImpl implements IWorkbenchCalendarScheduleService { + @Autowired + private WorkbenchCalendarScheduleMapper calendarScheduleMapper; + + @Override + public Map> calendarScheduleList(CalendarScheduleListRequest request) { + String calendarMonth = request.getCalendarMonth(); + Long userId = request.getUserId(); + List list = calendarScheduleMapper.selectListByMonth(calendarMonth, userId); + if(CollectionUtils.isEmpty(list)){ + return new HashMap<>(); + } + Map> resultMap = list.stream().collect( + Collectors.groupingBy(WorkbenchCalendarSchedule::getScheduleDate) + ); + return resultMap; + } + + @Override + public ReturnDTO calendarScheduleAdd(List calendarScheduleList) { + if (this.saveBatch(calendarScheduleList)) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO updateCalendarSchedule(WorkbenchCalendarSchedule calendarSchedule) { + if(calendarScheduleMapper.updateById(calendarSchedule) > 0) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO deleteCalendarSchedule(Long id) { + if(calendarScheduleMapper.deleteById(id) > 0){ + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java index 7802cb3..3b0566c 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java @@ -4,37 +4,22 @@ import com.casic.missiles.dto.ReturnDTO; import com.casic.missiles.dto.ReturnUtil; import com.casic.missiles.dto.business.dispatch.ReadSampleDTO; -import com.casic.missiles.enums.BusinessExceptionEnum; -import com.casic.missiles.exception.BusinessException; import com.casic.missiles.mapper.MeterFixedAssetsMapper; import com.casic.missiles.mapper.customer.CustomerSampleMapper; import com.casic.missiles.model.customer.CustomerSampleInfo; import com.casic.missiles.model.equipment.EquipmentFixedAssets; import com.casic.missiles.service.business.IBusinessReadWriterService; -import com.casic.missiles.service.listeners.device.CodeGunDataListener; import com.casic.missiles.utils.ConvertUtils; -import com.casic.missiles.utils.SerialPortUtil; -import com.gg.reader.api.dal.GClient; -import com.gg.reader.api.dal.HandlerTagEpcLog; -import com.gg.reader.api.dal.HandlerTagEpcOver; -import com.gg.reader.api.protocol.gx.*; -import com.gg.reader.api.utils.UsbHidUtils; -import com.rfid.API.CommonReader; -import com.rfid.API.ProtocolVersion; -import com.rfid.API.Util; -import com.rfid.API.core.BaseReader; -import com.rfid.API.entityclass.ScanTagParameter; -import com.rfid.ui.GlobalData; import gnu.io.SerialPort; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.hid4java.HidDevice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ForkJoinPool; /** * @Description: 读写器相关业务 @@ -54,218 +39,32 @@ public static SerialPort serialPort = null; @Override - public ReturnDTO> sampleReadList() { - // TODO: 2023/3/21 实际场景若有多个读写器连接需要设计读取实现方案,将ip入库或配置文件 - ReturnDTO> tIdsReturnDTO = tIdNewReadList(); - if (tIdsReturnDTO.getCode().equals(ReturnUtil.success().getCode())) { - Set tidsData = tIdsReturnDTO.getData(); - if(CollectionUtils.isEmpty(tidsData)) { - return ReturnUtil.success(new ArrayList<>()); - } - //查询标签样品信息 - List resultList = queryReadSampleList(tidsData); - return ReturnUtil.success(resultList); + public ReturnDTO> sampleReadList(Set strSet) { + if (CollectionUtils.isEmpty(strSet)) { + return ReturnUtil.success(new ArrayList<>()); } - return ReturnUtil.failed(); - } - - @Override - public ReturnDTO> tIdReadList() { - GClient client = new GClient(); - try { - //if (client.openSerial("COM11:115200", 2000)) - if (!client.openTcp("192.168.1.168:8160", 0)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - Set tIds = receiveTIds(client); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> tIdNewReadList() { - CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); - try { -// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); -// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); - reader.setProtocol(ProtocolVersion.CRP); - reader.setReaderProtocol(ProtocolVersion.CRP); -// reader.setPortSum(4);//只对LRP的有效 - reader.connect(false, new BaseReader.IConnectListener() { - @Override - public void callback(boolean b) { -// log.info("大读写器设备连接状态:" + b); - } - }); - if (reader.getIsConnected() == true) { - Set tIds = receiveNewTIds(reader); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } else { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - } catch (InterruptedException e) { - log.error("大读写器读取标签异常:{}", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } finally { - //不断开连接,读写器会每秒发送心跳 -// reader.disconnect(); - } - } - - private Set receiveNewTIds(CommonReader reader) throws InterruptedException { - Set tIds = new HashSet<>(); -// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 -// ScanTagParameter param = new ScanTagParameter(); -// param.antenna = 0x0001; -// param.isLoop = true;//持续盘点 -// boolean b = reader.reader_Inventory(param, (byte) 0x0001); - boolean b1 = reader.ScanTID(0x0001, true, 1111); - log.info("大读写器开始盘点:" + b1); - reader.OnTagDataReceivedHandle = (gateName, tagData) -> { - if (tagData != null && tagData.getTID() != null) { - String tid = Util.convertByteArrayToHexString(tagData.getTID()); - log.info("大读写器TID标签读取成功"); - tIds.add(tid); - } - }; - //连续读取3s - TimeUnit.SECONDS.sleep(3); -// reader.disconnect(); - boolean stop = reader.reader_StopInventory(); - return tIds; - } - - @Override - public ReturnDTO> tIdMiniReadList() { - GClient client = new GClient(); - Set tIds = new HashSet<>(); - try { - List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); - if (CollectionUtils.isEmpty(attachedHidDevices)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - //循环每个USB接口数据 - for (HidDevice hidDevice : attachedHidDevices) { - if (client.openUsbHid(hidDevice)) { - tIds.addAll(receiveTIds(client)); - } - } - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> codeGunReadList() { - SerialPortUtil serialPortUtil = null; - Set resultSet = new HashSet<>(); - try { - //添加监听器 - serialPortUtil = SerialPortUtil.getSerialPortUtil(); - List ports = serialPortUtil.findPort(); - log.info("有线扫码枪,当前可用串口:{}", ports); - if (CollectionUtils.isEmpty(ports)) { - return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); - } - for (String port : ports) { - //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 - serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); - serialPortUtil.addListener(serialPort, new CodeGunDataListener()); - } - //监听器接收指定时间的数据 - TimeUnit.SECONDS.sleep(10); - resultSet.addAll(CodeGunDataListener.dataSet); - CodeGunDataListener.dataSet = new HashSet<>(); - } catch (Exception e) { - log.error("有线扫码枪识别失败,异常:", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); - } finally { - if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { - //删除监听器 - serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); - serialPortUtil.closePort(serialPort); - } - } - return ReturnUtil.success(resultSet); - } - - @Override - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - //获取设备列表 - List firstFixedAssets = new ArrayList<>(); - List secondFixedAssets = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - QueryWrapper gunQueryWrapper = new QueryWrapper<>(); - gunQueryWrapper.eq("is_del", 0); - gunQueryWrapper.in("equipment_no", gunSet); - firstFixedAssets = meterFixedAssetsMapper.selectList(gunQueryWrapper); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - QueryWrapper tIdsQueryWrapper = new QueryWrapper<>(); - tIdsQueryWrapper.eq("is_del", 0); - tIdsQueryWrapper.in("label_bind", tIdsSet); - secondFixedAssets = meterFixedAssetsMapper.selectList(tIdsQueryWrapper); - } - List resultList = new ArrayList<>(); - resultList.addAll(firstFixedAssets); - resultList.addAll(secondFixedAssets); + //查询标签样品信息 + List resultList = queryReadSampleList(strSet); return ReturnUtil.success(resultList); } @Override - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); + public ReturnDTO> equipmentLabelReadList(Set strSet) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", 0); + queryWrapper.and(QueryWrapper -> QueryWrapper.in("equipment_no", strSet).or().in("label_bind", strSet)); + List resultList = meterFixedAssetsMapper.selectList(queryWrapper); + return ReturnUtil.success(resultList); + } + + @Override + public ReturnDTO> sampleLabelReadList(Set strSet) { //样品列表 List firstSamples = new ArrayList<>(); List secondSamples = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - firstSamples = queryGunReadSampleList(gunSet); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - secondSamples = queryReadSampleList(tIdsSet); + if (!CollectionUtils.isEmpty(strSet)) { + firstSamples = queryGunReadSampleList(strSet); + secondSamples = queryReadSampleList(strSet); } List resultList = new ArrayList<>(); resultList.addAll(firstSamples); @@ -273,31 +72,6 @@ return ReturnUtil.success(resultList); } - @Override - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //小读写器识别tId列表 - ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); - Set minTIdsSet = new HashSet<>(); - if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { - minTIdsSet.addAll(minTIdReturnDTO.getData()); - } - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - Set resultSet = new HashSet<>(); - resultSet.addAll(tIdsSet); - resultSet.addAll(minTIdsSet); - return ReturnUtil.success(resultSet); - } - private List queryGunReadSampleList(Set gunSet) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("is_del", 0); @@ -316,74 +90,238 @@ return resultList; } - private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { - Set gunSet = new HashSet<>(); - ReturnDTO> gunReturnDTO = setReturnDTO; - if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { - gunSet.addAll(gunReturnDTO.getData()); - } - return gunSet; - } +// @Override +// public ReturnDTO> tIdReadList() { +// GClient client = new GClient(); +// try { +// //if (client.openSerial("COM11:115200", 2000)) +// if (!client.openTcp("192.168.1.168:8160", 0)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// Set tIds = receiveTIds(client); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> tIdNewReadList() { +// CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); +// try { +//// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); +//// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); +// reader.setProtocol(ProtocolVersion.CRP); +// reader.setReaderProtocol(ProtocolVersion.CRP); +//// reader.setPortSum(4);//只对LRP的有效 +// reader.connect(false, new BaseReader.IConnectListener() { +// @Override +// public void callback(boolean b) { +//// log.info("大读写器设备连接状态:" + b); +// } +// }); +// if (reader.getIsConnected() == true) { +// Set tIds = receiveNewTIds(reader); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } else { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// } catch (InterruptedException e) { +// log.error("大读写器读取标签异常:{}", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } finally { +// //不断开连接,读写器会每秒发送心跳 +//// reader.disconnect(); +// } +// } +// +// private Set receiveNewTIds(CommonReader reader) throws InterruptedException { +// Set tIds = new HashSet<>(); +//// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 +//// ScanTagParameter param = new ScanTagParameter(); +//// param.antenna = 0x0001; +//// param.isLoop = true;//持续盘点 +//// boolean b = reader.reader_Inventory(param, (byte) 0x0001); +// boolean b1 = reader.ScanTID(0x0001, true, 1111); +// log.info("大读写器开始盘点:" + b1); +// reader.OnTagDataReceivedHandle = (gateName, tagData) -> { +// if (tagData != null && tagData.getTID() != null) { +// String tid = Util.convertByteArrayToHexString(tagData.getTID()); +// log.info("大读写器TID标签读取成功"); +// tIds.add(tid); +// } +// }; +// //连续读取3s +// TimeUnit.SECONDS.sleep(3); +//// reader.disconnect(); +// boolean stop = reader.reader_StopInventory(); +// return tIds; +// } +// +// @Override +// public ReturnDTO> tIdMiniReadList() { +// GClient client = new GClient(); +// Set tIds = new HashSet<>(); +// try { +// List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); +// if (CollectionUtils.isEmpty(attachedHidDevices)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// //循环每个USB接口数据 +// for (HidDevice hidDevice : attachedHidDevices) { +// if (client.openUsbHid(hidDevice)) { +// tIds.addAll(receiveTIds(client)); +// } +// } +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> codeGunReadList() { +// SerialPortUtil serialPortUtil = null; +// Set resultSet = new HashSet<>(); +// try { +// //添加监听器 +// serialPortUtil = SerialPortUtil.getSerialPortUtil(); +// List ports = serialPortUtil.findPort(); +// log.info("有线扫码枪,当前可用串口:{}", ports); +// if (CollectionUtils.isEmpty(ports)) { +// return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); +// } +// for (String port : ports) { +// //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 +// serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); +// serialPortUtil.addListener(serialPort, new CodeGunDataListener()); +// } +// //监听器接收指定时间的数据 +// TimeUnit.SECONDS.sleep(10); +// resultSet.addAll(CodeGunDataListener.dataSet); +// CodeGunDataListener.dataSet = new HashSet<>(); +// } catch (Exception e) { +// log.error("有线扫码枪识别失败,异常:", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); +// } finally { +// if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { +// //删除监听器 +// serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); +// serialPortUtil.closePort(serialPort); +// } +// } +// return ReturnUtil.success(resultSet); +// } +// +// @Override +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// //异步请求大读写器 +// ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { +// @SneakyThrows +// @Override +// protected ReturnDTO> compute() { +//// return tIdReadList(); +// return tIdNewReadList(); +// } +// }); +// //小读写器识别tId列表 +// ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); +// Set minTIdsSet = new HashSet<>(); +// if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { +// minTIdsSet.addAll(minTIdReturnDTO.getData()); +// } +// //大读写器识别tId列表 +// Set tIdsSet = queryGunReturnDTO(taskResponse.get()); +// Set resultSet = new HashSet<>(); +// resultSet.addAll(tIdsSet); +// resultSet.addAll(minTIdsSet); +// return ReturnUtil.success(resultSet); - private Set receiveTIds(GClient client) throws InterruptedException { - Set tIds = new HashSet<>(); - //标签上报事件、结束事件订阅 - eventSubscribe(tIds, client); +// } - // 4个天线读卡, 读取EPC数据区以及TID数据区 - MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); - msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); - // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 - // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 - msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); - ParamEpcReadTid tid = new ParamEpcReadTid(); - tid.setMode(EnumG.ParamTidMode_Auto); - tid.setLen(6); - msgBaseInventoryEpc.setReadTid(tid); - client.sendSynMsg(msgBaseInventoryEpc); - if (0 == msgBaseInventoryEpc.getRtCode()) { - log.info("EPC、TID标签读取成功"); - } else { - log.info("EPC、TID标签读取失败"); - client.close(); - return new HashSet<>(); - } - //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) - TimeUnit.SECONDS.sleep(3); - // 停止指令,空闲态 - MsgBaseStop msgBaseStop = new MsgBaseStop(); - client.sendSynMsg(msgBaseStop); - if (0 == msgBaseStop.getRtCode()) { - log.info("EPC、TID标签停止读取成功"); - } else { - log.info("EPC、TID标签停止读取失败"); - } - return tIds; - } - - private void eventSubscribe(Set set, GClient client) { - // 订阅标签上报事件 - client.onTagEpcLog = new HandlerTagEpcLog() { - @Override - public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { - // 回调内部如有阻塞,会影响API正常使用 - // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 - if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { - System.out.println(logBaseEpcInfo); - log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); - set.add(logBaseEpcInfo.getTid()); - } - } - }; - // 上报结束事件 - client.onTagEpcOver = new HandlerTagEpcOver() { - @Override - public void log(String readName, LogBaseEpcOver logBaseEpcOver) { - if (null != logBaseEpcOver) { - log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); - } - } - }; - } +// private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { +// Set gunSet = new HashSet<>(); +// ReturnDTO> gunReturnDTO = setReturnDTO; +// if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { +// gunSet.addAll(gunReturnDTO.getData()); +// } +// return gunSet; +// } +// +// private Set receiveTIds(GClient client) throws InterruptedException { +// Set tIds = new HashSet<>(); +// //标签上报事件、结束事件订阅 +// eventSubscribe(tIds, client); +// +// // 4个天线读卡, 读取EPC数据区以及TID数据区 +// MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); +// msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); +// // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 +// // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 +// msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); +// ParamEpcReadTid tid = new ParamEpcReadTid(); +// tid.setMode(EnumG.ParamTidMode_Auto); +// tid.setLen(6); +// msgBaseInventoryEpc.setReadTid(tid); +// client.sendSynMsg(msgBaseInventoryEpc); +// if (0 == msgBaseInventoryEpc.getRtCode()) { +// log.info("EPC、TID标签读取成功"); +// } else { +// log.info("EPC、TID标签读取失败"); +// client.close(); +// return new HashSet<>(); +// } +// //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) +// TimeUnit.SECONDS.sleep(3); +// // 停止指令,空闲态 +// MsgBaseStop msgBaseStop = new MsgBaseStop(); +// client.sendSynMsg(msgBaseStop); +// if (0 == msgBaseStop.getRtCode()) { +// log.info("EPC、TID标签停止读取成功"); +// } else { +// log.info("EPC、TID标签停止读取失败"); +// } +// return tIds; +// } +// +// private void eventSubscribe(Set set, GClient client) { +// // 订阅标签上报事件 +// client.onTagEpcLog = new HandlerTagEpcLog() { +// @Override +// public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { +// // 回调内部如有阻塞,会影响API正常使用 +// // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 +// if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { +// System.out.println(logBaseEpcInfo); +// log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); +// set.add(logBaseEpcInfo.getTid()); +// } +// } +// }; +// // 上报结束事件 +// client.onTagEpcOver = new HandlerTagEpcOver() { +// @Override +// public void log(String readName, LogBaseEpcOver logBaseEpcOver) { +// if (null != logBaseEpcOver) { +// log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); +// } +// } +// }; +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java new file mode 100644 index 0000000..19c3fab --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java @@ -0,0 +1,68 @@ +package com.casic.missiles.model.workbench; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 工作台-日历日程安排表 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@ApiModel +@Data +@TableName("workbench_calendar_schedule") +public class WorkbenchCalendarSchedule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id", dataType = "Long") + @TableId("id") + private Long id; + + @ApiModelProperty(value = "id", dataType = "Long") + @NotNull(message = "登录用户id不能为空") + @TableField("user_id") + private Long userId; + + /** + * 日程日期 + */ + @ApiModelProperty(value = "日期(格式:2023-06-16)", dataType = "String") + @NotEmpty(message = "日期不能为空") + @TableField("schedule_date") + private String scheduleDate; + + /** + * 日程安排事宜 + */ + @ApiModelProperty(value = "日程安排", dataType = "String") + @NotEmpty(message = "日程安排不能为空") + @TableField("schedule_matters") + private String scheduleMatters; + + /** + * 创建时间 + */ + @ApiModelProperty(hidden = true) + @TableField("create_time") + private String createTime; + + /** + * 更新时间 + */ + @ApiModelProperty(hidden = true) + @TableField("update_time") + private String updateTime; + +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java new file mode 100644 index 0000000..48a14ac --- /dev/null +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java @@ -0,0 +1,71 @@ +package com.casic.missiles.service.Impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.mapper.workbench.WorkbenchCalendarScheduleMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 工作台-日历日程安排表 服务实现类 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Service +public class WorkbenchCalendarScheduleServiceImpl extends ServiceImpl implements IWorkbenchCalendarScheduleService { + @Autowired + private WorkbenchCalendarScheduleMapper calendarScheduleMapper; + + @Override + public Map> calendarScheduleList(CalendarScheduleListRequest request) { + String calendarMonth = request.getCalendarMonth(); + Long userId = request.getUserId(); + List list = calendarScheduleMapper.selectListByMonth(calendarMonth, userId); + if(CollectionUtils.isEmpty(list)){ + return new HashMap<>(); + } + Map> resultMap = list.stream().collect( + Collectors.groupingBy(WorkbenchCalendarSchedule::getScheduleDate) + ); + return resultMap; + } + + @Override + public ReturnDTO calendarScheduleAdd(List calendarScheduleList) { + if (this.saveBatch(calendarScheduleList)) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO updateCalendarSchedule(WorkbenchCalendarSchedule calendarSchedule) { + if(calendarScheduleMapper.updateById(calendarSchedule) > 0) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO deleteCalendarSchedule(Long id) { + if(calendarScheduleMapper.deleteById(id) > 0){ + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java index 7802cb3..3b0566c 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java @@ -4,37 +4,22 @@ import com.casic.missiles.dto.ReturnDTO; import com.casic.missiles.dto.ReturnUtil; import com.casic.missiles.dto.business.dispatch.ReadSampleDTO; -import com.casic.missiles.enums.BusinessExceptionEnum; -import com.casic.missiles.exception.BusinessException; import com.casic.missiles.mapper.MeterFixedAssetsMapper; import com.casic.missiles.mapper.customer.CustomerSampleMapper; import com.casic.missiles.model.customer.CustomerSampleInfo; import com.casic.missiles.model.equipment.EquipmentFixedAssets; import com.casic.missiles.service.business.IBusinessReadWriterService; -import com.casic.missiles.service.listeners.device.CodeGunDataListener; import com.casic.missiles.utils.ConvertUtils; -import com.casic.missiles.utils.SerialPortUtil; -import com.gg.reader.api.dal.GClient; -import com.gg.reader.api.dal.HandlerTagEpcLog; -import com.gg.reader.api.dal.HandlerTagEpcOver; -import com.gg.reader.api.protocol.gx.*; -import com.gg.reader.api.utils.UsbHidUtils; -import com.rfid.API.CommonReader; -import com.rfid.API.ProtocolVersion; -import com.rfid.API.Util; -import com.rfid.API.core.BaseReader; -import com.rfid.API.entityclass.ScanTagParameter; -import com.rfid.ui.GlobalData; import gnu.io.SerialPort; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.hid4java.HidDevice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ForkJoinPool; /** * @Description: 读写器相关业务 @@ -54,218 +39,32 @@ public static SerialPort serialPort = null; @Override - public ReturnDTO> sampleReadList() { - // TODO: 2023/3/21 实际场景若有多个读写器连接需要设计读取实现方案,将ip入库或配置文件 - ReturnDTO> tIdsReturnDTO = tIdNewReadList(); - if (tIdsReturnDTO.getCode().equals(ReturnUtil.success().getCode())) { - Set tidsData = tIdsReturnDTO.getData(); - if(CollectionUtils.isEmpty(tidsData)) { - return ReturnUtil.success(new ArrayList<>()); - } - //查询标签样品信息 - List resultList = queryReadSampleList(tidsData); - return ReturnUtil.success(resultList); + public ReturnDTO> sampleReadList(Set strSet) { + if (CollectionUtils.isEmpty(strSet)) { + return ReturnUtil.success(new ArrayList<>()); } - return ReturnUtil.failed(); - } - - @Override - public ReturnDTO> tIdReadList() { - GClient client = new GClient(); - try { - //if (client.openSerial("COM11:115200", 2000)) - if (!client.openTcp("192.168.1.168:8160", 0)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - Set tIds = receiveTIds(client); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> tIdNewReadList() { - CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); - try { -// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); -// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); - reader.setProtocol(ProtocolVersion.CRP); - reader.setReaderProtocol(ProtocolVersion.CRP); -// reader.setPortSum(4);//只对LRP的有效 - reader.connect(false, new BaseReader.IConnectListener() { - @Override - public void callback(boolean b) { -// log.info("大读写器设备连接状态:" + b); - } - }); - if (reader.getIsConnected() == true) { - Set tIds = receiveNewTIds(reader); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } else { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - } catch (InterruptedException e) { - log.error("大读写器读取标签异常:{}", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } finally { - //不断开连接,读写器会每秒发送心跳 -// reader.disconnect(); - } - } - - private Set receiveNewTIds(CommonReader reader) throws InterruptedException { - Set tIds = new HashSet<>(); -// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 -// ScanTagParameter param = new ScanTagParameter(); -// param.antenna = 0x0001; -// param.isLoop = true;//持续盘点 -// boolean b = reader.reader_Inventory(param, (byte) 0x0001); - boolean b1 = reader.ScanTID(0x0001, true, 1111); - log.info("大读写器开始盘点:" + b1); - reader.OnTagDataReceivedHandle = (gateName, tagData) -> { - if (tagData != null && tagData.getTID() != null) { - String tid = Util.convertByteArrayToHexString(tagData.getTID()); - log.info("大读写器TID标签读取成功"); - tIds.add(tid); - } - }; - //连续读取3s - TimeUnit.SECONDS.sleep(3); -// reader.disconnect(); - boolean stop = reader.reader_StopInventory(); - return tIds; - } - - @Override - public ReturnDTO> tIdMiniReadList() { - GClient client = new GClient(); - Set tIds = new HashSet<>(); - try { - List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); - if (CollectionUtils.isEmpty(attachedHidDevices)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - //循环每个USB接口数据 - for (HidDevice hidDevice : attachedHidDevices) { - if (client.openUsbHid(hidDevice)) { - tIds.addAll(receiveTIds(client)); - } - } - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> codeGunReadList() { - SerialPortUtil serialPortUtil = null; - Set resultSet = new HashSet<>(); - try { - //添加监听器 - serialPortUtil = SerialPortUtil.getSerialPortUtil(); - List ports = serialPortUtil.findPort(); - log.info("有线扫码枪,当前可用串口:{}", ports); - if (CollectionUtils.isEmpty(ports)) { - return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); - } - for (String port : ports) { - //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 - serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); - serialPortUtil.addListener(serialPort, new CodeGunDataListener()); - } - //监听器接收指定时间的数据 - TimeUnit.SECONDS.sleep(10); - resultSet.addAll(CodeGunDataListener.dataSet); - CodeGunDataListener.dataSet = new HashSet<>(); - } catch (Exception e) { - log.error("有线扫码枪识别失败,异常:", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); - } finally { - if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { - //删除监听器 - serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); - serialPortUtil.closePort(serialPort); - } - } - return ReturnUtil.success(resultSet); - } - - @Override - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - //获取设备列表 - List firstFixedAssets = new ArrayList<>(); - List secondFixedAssets = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - QueryWrapper gunQueryWrapper = new QueryWrapper<>(); - gunQueryWrapper.eq("is_del", 0); - gunQueryWrapper.in("equipment_no", gunSet); - firstFixedAssets = meterFixedAssetsMapper.selectList(gunQueryWrapper); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - QueryWrapper tIdsQueryWrapper = new QueryWrapper<>(); - tIdsQueryWrapper.eq("is_del", 0); - tIdsQueryWrapper.in("label_bind", tIdsSet); - secondFixedAssets = meterFixedAssetsMapper.selectList(tIdsQueryWrapper); - } - List resultList = new ArrayList<>(); - resultList.addAll(firstFixedAssets); - resultList.addAll(secondFixedAssets); + //查询标签样品信息 + List resultList = queryReadSampleList(strSet); return ReturnUtil.success(resultList); } @Override - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); + public ReturnDTO> equipmentLabelReadList(Set strSet) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", 0); + queryWrapper.and(QueryWrapper -> QueryWrapper.in("equipment_no", strSet).or().in("label_bind", strSet)); + List resultList = meterFixedAssetsMapper.selectList(queryWrapper); + return ReturnUtil.success(resultList); + } + + @Override + public ReturnDTO> sampleLabelReadList(Set strSet) { //样品列表 List firstSamples = new ArrayList<>(); List secondSamples = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - firstSamples = queryGunReadSampleList(gunSet); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - secondSamples = queryReadSampleList(tIdsSet); + if (!CollectionUtils.isEmpty(strSet)) { + firstSamples = queryGunReadSampleList(strSet); + secondSamples = queryReadSampleList(strSet); } List resultList = new ArrayList<>(); resultList.addAll(firstSamples); @@ -273,31 +72,6 @@ return ReturnUtil.success(resultList); } - @Override - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //小读写器识别tId列表 - ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); - Set minTIdsSet = new HashSet<>(); - if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { - minTIdsSet.addAll(minTIdReturnDTO.getData()); - } - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - Set resultSet = new HashSet<>(); - resultSet.addAll(tIdsSet); - resultSet.addAll(minTIdsSet); - return ReturnUtil.success(resultSet); - } - private List queryGunReadSampleList(Set gunSet) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("is_del", 0); @@ -316,74 +90,238 @@ return resultList; } - private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { - Set gunSet = new HashSet<>(); - ReturnDTO> gunReturnDTO = setReturnDTO; - if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { - gunSet.addAll(gunReturnDTO.getData()); - } - return gunSet; - } +// @Override +// public ReturnDTO> tIdReadList() { +// GClient client = new GClient(); +// try { +// //if (client.openSerial("COM11:115200", 2000)) +// if (!client.openTcp("192.168.1.168:8160", 0)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// Set tIds = receiveTIds(client); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> tIdNewReadList() { +// CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); +// try { +//// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); +//// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); +// reader.setProtocol(ProtocolVersion.CRP); +// reader.setReaderProtocol(ProtocolVersion.CRP); +//// reader.setPortSum(4);//只对LRP的有效 +// reader.connect(false, new BaseReader.IConnectListener() { +// @Override +// public void callback(boolean b) { +//// log.info("大读写器设备连接状态:" + b); +// } +// }); +// if (reader.getIsConnected() == true) { +// Set tIds = receiveNewTIds(reader); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } else { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// } catch (InterruptedException e) { +// log.error("大读写器读取标签异常:{}", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } finally { +// //不断开连接,读写器会每秒发送心跳 +//// reader.disconnect(); +// } +// } +// +// private Set receiveNewTIds(CommonReader reader) throws InterruptedException { +// Set tIds = new HashSet<>(); +//// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 +//// ScanTagParameter param = new ScanTagParameter(); +//// param.antenna = 0x0001; +//// param.isLoop = true;//持续盘点 +//// boolean b = reader.reader_Inventory(param, (byte) 0x0001); +// boolean b1 = reader.ScanTID(0x0001, true, 1111); +// log.info("大读写器开始盘点:" + b1); +// reader.OnTagDataReceivedHandle = (gateName, tagData) -> { +// if (tagData != null && tagData.getTID() != null) { +// String tid = Util.convertByteArrayToHexString(tagData.getTID()); +// log.info("大读写器TID标签读取成功"); +// tIds.add(tid); +// } +// }; +// //连续读取3s +// TimeUnit.SECONDS.sleep(3); +//// reader.disconnect(); +// boolean stop = reader.reader_StopInventory(); +// return tIds; +// } +// +// @Override +// public ReturnDTO> tIdMiniReadList() { +// GClient client = new GClient(); +// Set tIds = new HashSet<>(); +// try { +// List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); +// if (CollectionUtils.isEmpty(attachedHidDevices)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// //循环每个USB接口数据 +// for (HidDevice hidDevice : attachedHidDevices) { +// if (client.openUsbHid(hidDevice)) { +// tIds.addAll(receiveTIds(client)); +// } +// } +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> codeGunReadList() { +// SerialPortUtil serialPortUtil = null; +// Set resultSet = new HashSet<>(); +// try { +// //添加监听器 +// serialPortUtil = SerialPortUtil.getSerialPortUtil(); +// List ports = serialPortUtil.findPort(); +// log.info("有线扫码枪,当前可用串口:{}", ports); +// if (CollectionUtils.isEmpty(ports)) { +// return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); +// } +// for (String port : ports) { +// //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 +// serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); +// serialPortUtil.addListener(serialPort, new CodeGunDataListener()); +// } +// //监听器接收指定时间的数据 +// TimeUnit.SECONDS.sleep(10); +// resultSet.addAll(CodeGunDataListener.dataSet); +// CodeGunDataListener.dataSet = new HashSet<>(); +// } catch (Exception e) { +// log.error("有线扫码枪识别失败,异常:", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); +// } finally { +// if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { +// //删除监听器 +// serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); +// serialPortUtil.closePort(serialPort); +// } +// } +// return ReturnUtil.success(resultSet); +// } +// +// @Override +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// //异步请求大读写器 +// ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { +// @SneakyThrows +// @Override +// protected ReturnDTO> compute() { +//// return tIdReadList(); +// return tIdNewReadList(); +// } +// }); +// //小读写器识别tId列表 +// ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); +// Set minTIdsSet = new HashSet<>(); +// if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { +// minTIdsSet.addAll(minTIdReturnDTO.getData()); +// } +// //大读写器识别tId列表 +// Set tIdsSet = queryGunReturnDTO(taskResponse.get()); +// Set resultSet = new HashSet<>(); +// resultSet.addAll(tIdsSet); +// resultSet.addAll(minTIdsSet); +// return ReturnUtil.success(resultSet); - private Set receiveTIds(GClient client) throws InterruptedException { - Set tIds = new HashSet<>(); - //标签上报事件、结束事件订阅 - eventSubscribe(tIds, client); +// } - // 4个天线读卡, 读取EPC数据区以及TID数据区 - MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); - msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); - // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 - // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 - msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); - ParamEpcReadTid tid = new ParamEpcReadTid(); - tid.setMode(EnumG.ParamTidMode_Auto); - tid.setLen(6); - msgBaseInventoryEpc.setReadTid(tid); - client.sendSynMsg(msgBaseInventoryEpc); - if (0 == msgBaseInventoryEpc.getRtCode()) { - log.info("EPC、TID标签读取成功"); - } else { - log.info("EPC、TID标签读取失败"); - client.close(); - return new HashSet<>(); - } - //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) - TimeUnit.SECONDS.sleep(3); - // 停止指令,空闲态 - MsgBaseStop msgBaseStop = new MsgBaseStop(); - client.sendSynMsg(msgBaseStop); - if (0 == msgBaseStop.getRtCode()) { - log.info("EPC、TID标签停止读取成功"); - } else { - log.info("EPC、TID标签停止读取失败"); - } - return tIds; - } - - private void eventSubscribe(Set set, GClient client) { - // 订阅标签上报事件 - client.onTagEpcLog = new HandlerTagEpcLog() { - @Override - public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { - // 回调内部如有阻塞,会影响API正常使用 - // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 - if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { - System.out.println(logBaseEpcInfo); - log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); - set.add(logBaseEpcInfo.getTid()); - } - } - }; - // 上报结束事件 - client.onTagEpcOver = new HandlerTagEpcOver() { - @Override - public void log(String readName, LogBaseEpcOver logBaseEpcOver) { - if (null != logBaseEpcOver) { - log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); - } - } - }; - } +// private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { +// Set gunSet = new HashSet<>(); +// ReturnDTO> gunReturnDTO = setReturnDTO; +// if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { +// gunSet.addAll(gunReturnDTO.getData()); +// } +// return gunSet; +// } +// +// private Set receiveTIds(GClient client) throws InterruptedException { +// Set tIds = new HashSet<>(); +// //标签上报事件、结束事件订阅 +// eventSubscribe(tIds, client); +// +// // 4个天线读卡, 读取EPC数据区以及TID数据区 +// MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); +// msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); +// // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 +// // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 +// msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); +// ParamEpcReadTid tid = new ParamEpcReadTid(); +// tid.setMode(EnumG.ParamTidMode_Auto); +// tid.setLen(6); +// msgBaseInventoryEpc.setReadTid(tid); +// client.sendSynMsg(msgBaseInventoryEpc); +// if (0 == msgBaseInventoryEpc.getRtCode()) { +// log.info("EPC、TID标签读取成功"); +// } else { +// log.info("EPC、TID标签读取失败"); +// client.close(); +// return new HashSet<>(); +// } +// //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) +// TimeUnit.SECONDS.sleep(3); +// // 停止指令,空闲态 +// MsgBaseStop msgBaseStop = new MsgBaseStop(); +// client.sendSynMsg(msgBaseStop); +// if (0 == msgBaseStop.getRtCode()) { +// log.info("EPC、TID标签停止读取成功"); +// } else { +// log.info("EPC、TID标签停止读取失败"); +// } +// return tIds; +// } +// +// private void eventSubscribe(Set set, GClient client) { +// // 订阅标签上报事件 +// client.onTagEpcLog = new HandlerTagEpcLog() { +// @Override +// public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { +// // 回调内部如有阻塞,会影响API正常使用 +// // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 +// if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { +// System.out.println(logBaseEpcInfo); +// log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); +// set.add(logBaseEpcInfo.getTid()); +// } +// } +// }; +// // 上报结束事件 +// client.onTagEpcOver = new HandlerTagEpcOver() { +// @Override +// public void log(String readName, LogBaseEpcOver logBaseEpcOver) { +// if (null != logBaseEpcOver) { +// log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); +// } +// } +// }; +// } } diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java b/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java index 9310599..918b059 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: @@ -15,19 +14,19 @@ */ public interface IBusinessReadWriterService { - ReturnDTO> sampleReadList(); + ReturnDTO> sampleReadList(Set strSet); - ReturnDTO> tIdReadList(); + ReturnDTO> equipmentLabelReadList(Set strSet); - ReturnDTO> tIdNewReadList() throws InterruptedException; + ReturnDTO> sampleLabelReadList(Set strSet); - ReturnDTO> tIdMiniReadList(); - - ReturnDTO> codeGunReadList(); - - ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException; - - ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException; - - ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException; +// ReturnDTO> tIdReadList(); +// +// ReturnDTO> tIdNewReadList() throws InterruptedException; +// +// ReturnDTO> tIdMiniReadList(); +// +// ReturnDTO> codeGunReadList(); +// +// ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException; } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java index 6f81ad7..2fe4e1f 100644 --- a/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/business/BusinessReadWriterController.java @@ -8,13 +8,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: 读写器 @@ -32,13 +29,32 @@ /** * 大读写器 - * TCP连接 * 读取读写器获取标签信息、业务信息(新建委托书和待收入中使用,新建委托书中增加通过读写器获取样品按钮) */ @ApiOperation("获取读写器识别的样品列表") - @GetMapping("/sample/readList") - public ReturnDTO> sampleReadList() { - return readWriterService.sampleReadList(); + @PostMapping("/sample/readList") + public ReturnDTO> sampleReadList(@RequestBody Set strSet) { + return readWriterService.sampleReadList(strSet); + } + + /** + * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是设备编号,读写器扫描结果是设备标签绑定 + */ + @ApiOperation("测量设备标签识别按钮接口") + @PostMapping("/equipment/label/readList") + public ReturnDTO> equipmentLabelReadList(@RequestBody Set strSet) { + return readWriterService.equipmentLabelReadList(strSet); + } + + /** + * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 + * 已实现有线扫码枪(二维码)和大读写器结合扫描,扫码枪扫描结果是样品编号,读写器扫描结果是样品标签绑定 + */ + @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") + @PostMapping("/sample/label/readList") + public ReturnDTO> sampleLabelReadList(@RequestBody Set strSet) { + return readWriterService.sampleLabelReadList(strSet); } /** @@ -49,9 +65,9 @@ */ // @ApiOperation("原厂家获取大读写器识别的标签TID列表") // @GetMapping("/tId/readList") - public ReturnDTO> tIdReadList() { - return readWriterService.tIdReadList(); - } +// public ReturnDTO> tIdReadList() { +// return readWriterService.tIdReadList(); +// } /** * 新厂家 @@ -59,22 +75,22 @@ * TCP连接,需配置和192.168.1.201一个段 * 读取读写器获取标签TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("新厂家获取大读写器识别的标签TID列表") - @GetMapping("/tId/readList") - public ReturnDTO> tIdNewReadList() throws InterruptedException { - return readWriterService.tIdNewReadList(); - } +// @ApiOperation("新厂家获取大读写器识别的标签TID列表") +// @GetMapping("/tId/readList") +// public ReturnDTO> tIdNewReadList() throws InterruptedException { +// return readWriterService.tIdNewReadList(); +// } /** * 小读写器 * USB-HID连接(HID是一种USB通信协议,无需安装驱动就能进行交互) * 读取读写器获取TID列表,用于标签绑定,前端从结果中选取一个标签传入标签绑定接口 */ - @ApiOperation("获取小读写器识别的标签TID列表") - @GetMapping("/tId/mini/readList") - public ReturnDTO> tIdMiniReadList() { - return readWriterService.tIdMiniReadList(); - } +// @ApiOperation("获取小读写器识别的标签TID列表") +// @GetMapping("/tId/mini/readList") +// public ReturnDTO> tIdMiniReadList() { +// return readWriterService.tIdMiniReadList(); +// } /** * 有线扫码枪(二维码)(徐州、西昌均使用) @@ -83,38 +99,18 @@ * 二维码由样品编号/设备编号生成 * 扫描收入、扫描检完等,以及大读写器的补充(包括新建委托书和待收入中使用) */ - @ApiOperation("获取有线扫码枪识别列表") - @GetMapping("/code/gun/readList") - public ReturnDTO> codeGunReadList() { - return readWriterService.codeGunReadList(); - } - - /** - * 测量设备中标签识别按钮,实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为设备列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("测量设备标签识别按钮接口") - @GetMapping("/equipment/label/readList") - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.equipmentLabelReadList(); - } - - /** - * 扫描收入、扫描检完、新建委托书、待收入等获取样品列表,需要实现接口调用有线扫码枪(二维码)和读写器设备结合的结果,识别的结果先展示为样品列表,点击某一个再查详情 - * 已实现有线扫码枪(二维码)和大读写器结合扫描 - */ - @ApiOperation("扫描收入、扫描检完、新建委托书、待收入等标签识别获取样品列表") - @GetMapping("/sample/label/readList") - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - return readWriterService.sampleLabelReadList(); - } +// @ApiOperation("获取有线扫码枪识别列表") +// @GetMapping("/code/gun/readList") +// public ReturnDTO> codeGunReadList() { +// return readWriterService.codeGunReadList(); +// } /** * 标签绑定功能,实现大读写器和小读写器识别结合的结果TID列表 */ - @ApiOperation("大读写器和小读写器识别结合标签绑定功能") - @GetMapping("/all/tId/readList") - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - return readWriterService.allTidReadList(); - } +// @ApiOperation("大读写器和小读写器识别结合标签绑定功能") +// @GetMapping("/all/tId/readList") +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// return readWriterService.allTidReadList(); +// } } diff --git a/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java new file mode 100644 index 0000000..c40024e --- /dev/null +++ b/casic-metering-api/src/main/java/com/casic/missiles/controller/workbench/WorkbenchCalendarScheduleController.java @@ -0,0 +1,80 @@ +package com.casic.missiles.controller.workbench; + +import cn.hutool.core.lang.Assert; +import com.casic.missiles.dto.IdDTO; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.model.exception.enums.CoreExceptionEnum; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 工作台-日历日程安排表 前端控制器 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Api(tags = "工作台模块-日历日程") +@RestController +@RequestMapping("/workbench/calendarSchedule") +public class WorkbenchCalendarScheduleController { + @Autowired + private IWorkbenchCalendarScheduleService calendarScheduleService; + + @ApiOperation("日程列表") + @PostMapping("/list") + public ReturnDTO>> calendarScheduleList(@RequestBody @Valid CalendarScheduleListRequest request, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return ReturnUtil.success(calendarScheduleService.calendarScheduleList(request)); + } + + @ApiOperation("日程新增(批量)") + @PostMapping("/add") + @ResponseBody + public ReturnDTO add(@RequestBody List calendarScheduleList, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + return calendarScheduleService.calendarScheduleAdd(calendarScheduleList); + } + + @ApiOperation("日程编辑") + @PostMapping("/update") + @ResponseBody + public ReturnDTO update(@RequestBody WorkbenchCalendarSchedule calendarSchedule, BindingResult bindingResult) { + if(bindingResult.hasErrors()){ + throw new BusinessException(CoreExceptionEnum.REQUEST_NULL.getCode(), bindingResult.getFieldError().getDefaultMessage()); + } + Assert.isFalse(Objects.isNull(calendarSchedule.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.updateCalendarSchedule(calendarSchedule); + } + + @ApiOperation("日程删除") + @PostMapping("/delete") + @ResponseBody + public ReturnDTO delete(@RequestBody @Valid IdDTO idDTO) { + Assert.isFalse(Objects.isNull(idDTO.getId()), () -> { + throw new BusinessException(BusinessExceptionEnum.ID_NULL); + }); + return calendarScheduleService.deleteCalendarSchedule(idDTO.getId()); + } +} diff --git a/casic-metering-api/src/main/resources/config/application.yml b/casic-metering-api/src/main/resources/config/application.yml index 848ee5e..c06a3b9 100644 --- a/casic-metering-api/src/main/resources/config/application.yml +++ b/casic-metering-api/src/main/resources/config/application.yml @@ -123,9 +123,9 @@ code: generate: #作者 - author: cz + author: wangpeng #待生成对象表名 - table-name: system_download_center + table-name: workbench_calendar_schedule reminder: #节点--common模块config包 ReminderNodeConfig配置 node: diff --git a/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java new file mode 100644 index 0000000..885694b --- /dev/null +++ b/casic-metering-dao/src/main/java/com/casic/missiles/mapper/workbench/WorkbenchCalendarScheduleMapper.java @@ -0,0 +1,20 @@ +package com.casic.missiles.mapper.workbench; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 工作台-日历日程安排表 Mapper 接口 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface WorkbenchCalendarScheduleMapper extends BaseMapper { + + List selectListByMonth(@Param("calendarMonth") String calendarMonth, @Param("userId") Long userId); +} diff --git a/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml new file mode 100644 index 0000000..8c3a369 --- /dev/null +++ b/casic-metering-dao/src/main/resources/mapper/workbench/WorkbenchCalendarScheduleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + id, user_id, schedule_date, schedule_matters, create_time, update_time + + + + diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java new file mode 100644 index 0000000..7c515b9 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListDTO.java @@ -0,0 +1,19 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:40 + */ +@ApiModel +@Data +public class CalendarScheduleListDTO { + @ApiModelProperty(value = "id", dataType = "Long") + private Long id; + @ApiModelProperty(value = "日程安排", dataType = "String") + private String scheduleMatters; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java new file mode 100644 index 0000000..d2b86f5 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListRequest.java @@ -0,0 +1,24 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 9:42 + */ +@ApiModel +@Data +public class CalendarScheduleListRequest { + @NotEmpty(message = "查询年月不能为空") + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String calendarMonth; + @NotNull(message = "登录用户id不能为空") + @ApiModelProperty(value = "登录用户id", dataType = "Long") + private Long userId; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java new file mode 100644 index 0000000..878d483 --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/dto/workbench/CalendarScheduleListResponse.java @@ -0,0 +1,21 @@ +package com.casic.missiles.dto.workbench; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Description: + * @Author: wangpeng + * @Date: 2023/6/16 10:25 + */ +@ApiModel +@Data +public class CalendarScheduleListResponse { + @ApiModelProperty(value = "年月(格式:2023-06)", dataType = "String") + private String scheduleDate; + @ApiModelProperty(value = "日程列表", dataType = "List") + private List scheduleMattersList; +} diff --git a/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java new file mode 100644 index 0000000..19c3fab --- /dev/null +++ b/casic-metering-model/src/main/java/com/casic/missiles/model/workbench/WorkbenchCalendarSchedule.java @@ -0,0 +1,68 @@ +package com.casic.missiles.model.workbench; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 工作台-日历日程安排表 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@ApiModel +@Data +@TableName("workbench_calendar_schedule") +public class WorkbenchCalendarSchedule implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id", dataType = "Long") + @TableId("id") + private Long id; + + @ApiModelProperty(value = "id", dataType = "Long") + @NotNull(message = "登录用户id不能为空") + @TableField("user_id") + private Long userId; + + /** + * 日程日期 + */ + @ApiModelProperty(value = "日期(格式:2023-06-16)", dataType = "String") + @NotEmpty(message = "日期不能为空") + @TableField("schedule_date") + private String scheduleDate; + + /** + * 日程安排事宜 + */ + @ApiModelProperty(value = "日程安排", dataType = "String") + @NotEmpty(message = "日程安排不能为空") + @TableField("schedule_matters") + private String scheduleMatters; + + /** + * 创建时间 + */ + @ApiModelProperty(hidden = true) + @TableField("create_time") + private String createTime; + + /** + * 更新时间 + */ + @ApiModelProperty(hidden = true) + @TableField("update_time") + private String updateTime; + +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java new file mode 100644 index 0000000..48a14ac --- /dev/null +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/WorkbenchCalendarScheduleServiceImpl.java @@ -0,0 +1,71 @@ +package com.casic.missiles.service.Impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.ReturnUtil; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.enums.BusinessExceptionEnum; +import com.casic.missiles.exception.BusinessException; +import com.casic.missiles.mapper.workbench.WorkbenchCalendarScheduleMapper; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; +import com.casic.missiles.service.workbench.IWorkbenchCalendarScheduleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 工作台-日历日程安排表 服务实现类 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +@Service +public class WorkbenchCalendarScheduleServiceImpl extends ServiceImpl implements IWorkbenchCalendarScheduleService { + @Autowired + private WorkbenchCalendarScheduleMapper calendarScheduleMapper; + + @Override + public Map> calendarScheduleList(CalendarScheduleListRequest request) { + String calendarMonth = request.getCalendarMonth(); + Long userId = request.getUserId(); + List list = calendarScheduleMapper.selectListByMonth(calendarMonth, userId); + if(CollectionUtils.isEmpty(list)){ + return new HashMap<>(); + } + Map> resultMap = list.stream().collect( + Collectors.groupingBy(WorkbenchCalendarSchedule::getScheduleDate) + ); + return resultMap; + } + + @Override + public ReturnDTO calendarScheduleAdd(List calendarScheduleList) { + if (this.saveBatch(calendarScheduleList)) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO updateCalendarSchedule(WorkbenchCalendarSchedule calendarSchedule) { + if(calendarScheduleMapper.updateById(calendarSchedule) > 0) { + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } + + @Override + public ReturnDTO deleteCalendarSchedule(Long id) { + if(calendarScheduleMapper.deleteById(id) > 0){ + return ReturnUtil.success(); + } + throw new BusinessException(BusinessExceptionEnum.HANDLE_FAILED); + } +} diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java index 7802cb3..3b0566c 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/Impl/business/BusinessReadWriterServiceImpl.java @@ -4,37 +4,22 @@ import com.casic.missiles.dto.ReturnDTO; import com.casic.missiles.dto.ReturnUtil; import com.casic.missiles.dto.business.dispatch.ReadSampleDTO; -import com.casic.missiles.enums.BusinessExceptionEnum; -import com.casic.missiles.exception.BusinessException; import com.casic.missiles.mapper.MeterFixedAssetsMapper; import com.casic.missiles.mapper.customer.CustomerSampleMapper; import com.casic.missiles.model.customer.CustomerSampleInfo; import com.casic.missiles.model.equipment.EquipmentFixedAssets; import com.casic.missiles.service.business.IBusinessReadWriterService; -import com.casic.missiles.service.listeners.device.CodeGunDataListener; import com.casic.missiles.utils.ConvertUtils; -import com.casic.missiles.utils.SerialPortUtil; -import com.gg.reader.api.dal.GClient; -import com.gg.reader.api.dal.HandlerTagEpcLog; -import com.gg.reader.api.dal.HandlerTagEpcOver; -import com.gg.reader.api.protocol.gx.*; -import com.gg.reader.api.utils.UsbHidUtils; -import com.rfid.API.CommonReader; -import com.rfid.API.ProtocolVersion; -import com.rfid.API.Util; -import com.rfid.API.core.BaseReader; -import com.rfid.API.entityclass.ScanTagParameter; -import com.rfid.ui.GlobalData; import gnu.io.SerialPort; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.hid4java.HidDevice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ForkJoinPool; /** * @Description: 读写器相关业务 @@ -54,218 +39,32 @@ public static SerialPort serialPort = null; @Override - public ReturnDTO> sampleReadList() { - // TODO: 2023/3/21 实际场景若有多个读写器连接需要设计读取实现方案,将ip入库或配置文件 - ReturnDTO> tIdsReturnDTO = tIdNewReadList(); - if (tIdsReturnDTO.getCode().equals(ReturnUtil.success().getCode())) { - Set tidsData = tIdsReturnDTO.getData(); - if(CollectionUtils.isEmpty(tidsData)) { - return ReturnUtil.success(new ArrayList<>()); - } - //查询标签样品信息 - List resultList = queryReadSampleList(tidsData); - return ReturnUtil.success(resultList); + public ReturnDTO> sampleReadList(Set strSet) { + if (CollectionUtils.isEmpty(strSet)) { + return ReturnUtil.success(new ArrayList<>()); } - return ReturnUtil.failed(); - } - - @Override - public ReturnDTO> tIdReadList() { - GClient client = new GClient(); - try { - //if (client.openSerial("COM11:115200", 2000)) - if (!client.openTcp("192.168.1.168:8160", 0)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - Set tIds = receiveTIds(client); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> tIdNewReadList() { - CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); - try { -// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); -// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); - reader.setProtocol(ProtocolVersion.CRP); - reader.setReaderProtocol(ProtocolVersion.CRP); -// reader.setPortSum(4);//只对LRP的有效 - reader.connect(false, new BaseReader.IConnectListener() { - @Override - public void callback(boolean b) { -// log.info("大读写器设备连接状态:" + b); - } - }); - if (reader.getIsConnected() == true) { - Set tIds = receiveNewTIds(reader); - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } else { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - } catch (InterruptedException e) { - log.error("大读写器读取标签异常:{}", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); - } finally { - //不断开连接,读写器会每秒发送心跳 -// reader.disconnect(); - } - } - - private Set receiveNewTIds(CommonReader reader) throws InterruptedException { - Set tIds = new HashSet<>(); -// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 -// ScanTagParameter param = new ScanTagParameter(); -// param.antenna = 0x0001; -// param.isLoop = true;//持续盘点 -// boolean b = reader.reader_Inventory(param, (byte) 0x0001); - boolean b1 = reader.ScanTID(0x0001, true, 1111); - log.info("大读写器开始盘点:" + b1); - reader.OnTagDataReceivedHandle = (gateName, tagData) -> { - if (tagData != null && tagData.getTID() != null) { - String tid = Util.convertByteArrayToHexString(tagData.getTID()); - log.info("大读写器TID标签读取成功"); - tIds.add(tid); - } - }; - //连续读取3s - TimeUnit.SECONDS.sleep(3); -// reader.disconnect(); - boolean stop = reader.reader_StopInventory(); - return tIds; - } - - @Override - public ReturnDTO> tIdMiniReadList() { - GClient client = new GClient(); - Set tIds = new HashSet<>(); - try { - List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); - if (CollectionUtils.isEmpty(attachedHidDevices)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); - } - //循环每个USB接口数据 - for (HidDevice hidDevice : attachedHidDevices) { - if (client.openUsbHid(hidDevice)) { - tIds.addAll(receiveTIds(client)); - } - } - if (CollectionUtils.isEmpty(tIds)) { - return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); - } - return ReturnUtil.success(tIds); - } catch (InterruptedException e) { - log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); - return ReturnUtil.failed(); - } finally { - client.close(); - } - } - - @Override - public ReturnDTO> codeGunReadList() { - SerialPortUtil serialPortUtil = null; - Set resultSet = new HashSet<>(); - try { - //添加监听器 - serialPortUtil = SerialPortUtil.getSerialPortUtil(); - List ports = serialPortUtil.findPort(); - log.info("有线扫码枪,当前可用串口:{}", ports); - if (CollectionUtils.isEmpty(ports)) { - return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); - } - for (String port : ports) { - //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 - serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); - serialPortUtil.addListener(serialPort, new CodeGunDataListener()); - } - //监听器接收指定时间的数据 - TimeUnit.SECONDS.sleep(10); - resultSet.addAll(CodeGunDataListener.dataSet); - CodeGunDataListener.dataSet = new HashSet<>(); - } catch (Exception e) { - log.error("有线扫码枪识别失败,异常:", e.getMessage()); - return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); - } finally { - if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { - //删除监听器 - serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); - serialPortUtil.closePort(serialPort); - } - } - return ReturnUtil.success(resultSet); - } - - @Override - public ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - //获取设备列表 - List firstFixedAssets = new ArrayList<>(); - List secondFixedAssets = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - QueryWrapper gunQueryWrapper = new QueryWrapper<>(); - gunQueryWrapper.eq("is_del", 0); - gunQueryWrapper.in("equipment_no", gunSet); - firstFixedAssets = meterFixedAssetsMapper.selectList(gunQueryWrapper); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - QueryWrapper tIdsQueryWrapper = new QueryWrapper<>(); - tIdsQueryWrapper.eq("is_del", 0); - tIdsQueryWrapper.in("label_bind", tIdsSet); - secondFixedAssets = meterFixedAssetsMapper.selectList(tIdsQueryWrapper); - } - List resultList = new ArrayList<>(); - resultList.addAll(firstFixedAssets); - resultList.addAll(secondFixedAssets); + //查询标签样品信息 + List resultList = queryReadSampleList(strSet); return ReturnUtil.success(resultList); } @Override - public ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //有线扫码枪(二维码)识别设备id列表 - Set gunSet = queryGunReturnDTO(this.codeGunReadList()); - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); + public ReturnDTO> equipmentLabelReadList(Set strSet) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", 0); + queryWrapper.and(QueryWrapper -> QueryWrapper.in("equipment_no", strSet).or().in("label_bind", strSet)); + List resultList = meterFixedAssetsMapper.selectList(queryWrapper); + return ReturnUtil.success(resultList); + } + + @Override + public ReturnDTO> sampleLabelReadList(Set strSet) { //样品列表 List firstSamples = new ArrayList<>(); List secondSamples = new ArrayList<>(); - if (!CollectionUtils.isEmpty(gunSet)) { - firstSamples = queryGunReadSampleList(gunSet); - } - if (!CollectionUtils.isEmpty(tIdsSet)) { - secondSamples = queryReadSampleList(tIdsSet); + if (!CollectionUtils.isEmpty(strSet)) { + firstSamples = queryGunReadSampleList(strSet); + secondSamples = queryReadSampleList(strSet); } List resultList = new ArrayList<>(); resultList.addAll(firstSamples); @@ -273,31 +72,6 @@ return ReturnUtil.success(resultList); } - @Override - public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { - //异步请求大读写器 - ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { - @SneakyThrows - @Override - protected ReturnDTO> compute() { -// return tIdReadList(); - return tIdNewReadList(); - } - }); - //小读写器识别tId列表 - ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); - Set minTIdsSet = new HashSet<>(); - if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { - minTIdsSet.addAll(minTIdReturnDTO.getData()); - } - //大读写器识别tId列表 - Set tIdsSet = queryGunReturnDTO(taskResponse.get()); - Set resultSet = new HashSet<>(); - resultSet.addAll(tIdsSet); - resultSet.addAll(minTIdsSet); - return ReturnUtil.success(resultSet); - } - private List queryGunReadSampleList(Set gunSet) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("is_del", 0); @@ -316,74 +90,238 @@ return resultList; } - private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { - Set gunSet = new HashSet<>(); - ReturnDTO> gunReturnDTO = setReturnDTO; - if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { - gunSet.addAll(gunReturnDTO.getData()); - } - return gunSet; - } +// @Override +// public ReturnDTO> tIdReadList() { +// GClient client = new GClient(); +// try { +// //if (client.openSerial("COM11:115200", 2000)) +// if (!client.openTcp("192.168.1.168:8160", 0)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// Set tIds = receiveTIds(client); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> tIdNewReadList() { +// CommonReader reader = new CommonReader("Reader1", GlobalData.ConnectType.TcpClient.name(), "192.168.1.201:9090"); +// try { +//// CommonReader reader = new CommonReader("Reader1", "RS232", "COM20:115200"); +//// CommonReader reader = new CommonReader("Reader1", "USB-HID", ""); +// reader.setProtocol(ProtocolVersion.CRP); +// reader.setReaderProtocol(ProtocolVersion.CRP); +//// reader.setPortSum(4);//只对LRP的有效 +// reader.connect(false, new BaseReader.IConnectListener() { +// @Override +// public void callback(boolean b) { +//// log.info("大读写器设备连接状态:" + b); +// } +// }); +// if (reader.getIsConnected() == true) { +// Set tIds = receiveNewTIds(reader); +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } else { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// } catch (InterruptedException e) { +// log.error("大读写器读取标签异常:{}", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.FAIL_READ_EPC_TID.getCode(), BusinessExceptionEnum.FAIL_READ_EPC_TID.getMessage()); +// } finally { +// //不断开连接,读写器会每秒发送心跳 +//// reader.disconnect(); +// } +// } +// +// private Set receiveNewTIds(CommonReader reader) throws InterruptedException { +// Set tIds = new HashSet<>(); +//// boolean a = reader.BuzzerControl(true, false);//蜂鸣器协议 +//// ScanTagParameter param = new ScanTagParameter(); +//// param.antenna = 0x0001; +//// param.isLoop = true;//持续盘点 +//// boolean b = reader.reader_Inventory(param, (byte) 0x0001); +// boolean b1 = reader.ScanTID(0x0001, true, 1111); +// log.info("大读写器开始盘点:" + b1); +// reader.OnTagDataReceivedHandle = (gateName, tagData) -> { +// if (tagData != null && tagData.getTID() != null) { +// String tid = Util.convertByteArrayToHexString(tagData.getTID()); +// log.info("大读写器TID标签读取成功"); +// tIds.add(tid); +// } +// }; +// //连续读取3s +// TimeUnit.SECONDS.sleep(3); +//// reader.disconnect(); +// boolean stop = reader.reader_StopInventory(); +// return tIds; +// } +// +// @Override +// public ReturnDTO> tIdMiniReadList() { +// GClient client = new GClient(); +// Set tIds = new HashSet<>(); +// try { +// List attachedHidDevices = UsbHidUtils.getAttachedHidDevices(); +// if (CollectionUtils.isEmpty(attachedHidDevices)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED.getMessage()); +// } +// //循环每个USB接口数据 +// for (HidDevice hidDevice : attachedHidDevices) { +// if (client.openUsbHid(hidDevice)) { +// tIds.addAll(receiveTIds(client)); +// } +// } +// if (CollectionUtils.isEmpty(tIds)) { +// return ReturnUtil.failed(BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getCode(), BusinessExceptionEnum.READ_WRITER_NOT_CONNECTED_OR_NO_TID.getMessage()); +// } +// return ReturnUtil.success(tIds); +// } catch (InterruptedException e) { +// log.error("读写器循环读取事件时间设置,异常信息:{}", e.getMessage()); +// return ReturnUtil.failed(); +// } finally { +// client.close(); +// } +// } +// +// @Override +// public ReturnDTO> codeGunReadList() { +// SerialPortUtil serialPortUtil = null; +// Set resultSet = new HashSet<>(); +// try { +// //添加监听器 +// serialPortUtil = SerialPortUtil.getSerialPortUtil(); +// List ports = serialPortUtil.findPort(); +// log.info("有线扫码枪,当前可用串口:{}", ports); +// if (CollectionUtils.isEmpty(ports)) { +// return ReturnUtil.failed(BusinessExceptionEnum.NO_PROPERLY_CONNECTED.getMessage()); +// } +// for (String port : ports) { +// //有线扫码枪已经设置的是一次读取一个,要是多个这里逻辑需要调整 +// serialPort = serialPortUtil.openPort(port, 19200, SerialPort.DATABITS_8, SerialPort.PARITY_NONE, SerialPort.PARITY_ODD); +// serialPortUtil.addListener(serialPort, new CodeGunDataListener()); +// } +// //监听器接收指定时间的数据 +// TimeUnit.SECONDS.sleep(10); +// resultSet.addAll(CodeGunDataListener.dataSet); +// CodeGunDataListener.dataSet = new HashSet<>(); +// } catch (Exception e) { +// log.error("有线扫码枪识别失败,异常:", e.getMessage()); +// return ReturnUtil.failed(BusinessExceptionEnum.HANDLE_FAILED.getMessage()); +// } finally { +// if (Objects.nonNull(serialPortUtil) && Objects.nonNull(serialPort)) { +// //删除监听器 +// serialPortUtil.removeListener(serialPort, new CodeGunDataListener()); +// serialPortUtil.closePort(serialPort); +// } +// } +// return ReturnUtil.success(resultSet); +// } +// +// @Override +// public ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException { +// //异步请求大读写器 +// ForkJoinTask>> taskResponse = forkJoinPool.submit(new RecursiveTask>>() { +// @SneakyThrows +// @Override +// protected ReturnDTO> compute() { +//// return tIdReadList(); +// return tIdNewReadList(); +// } +// }); +// //小读写器识别tId列表 +// ReturnDTO> minTIdReturnDTO = this.tIdMiniReadList(); +// Set minTIdsSet = new HashSet<>(); +// if (ReturnUtil.success().getCode().equals(minTIdReturnDTO.getCode()) && Objects.nonNull(minTIdReturnDTO.getData())) { +// minTIdsSet.addAll(minTIdReturnDTO.getData()); +// } +// //大读写器识别tId列表 +// Set tIdsSet = queryGunReturnDTO(taskResponse.get()); +// Set resultSet = new HashSet<>(); +// resultSet.addAll(tIdsSet); +// resultSet.addAll(minTIdsSet); +// return ReturnUtil.success(resultSet); - private Set receiveTIds(GClient client) throws InterruptedException { - Set tIds = new HashSet<>(); - //标签上报事件、结束事件订阅 - eventSubscribe(tIds, client); +// } - // 4个天线读卡, 读取EPC数据区以及TID数据区 - MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); - msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); - // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 - // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 - msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); - ParamEpcReadTid tid = new ParamEpcReadTid(); - tid.setMode(EnumG.ParamTidMode_Auto); - tid.setLen(6); - msgBaseInventoryEpc.setReadTid(tid); - client.sendSynMsg(msgBaseInventoryEpc); - if (0 == msgBaseInventoryEpc.getRtCode()) { - log.info("EPC、TID标签读取成功"); - } else { - log.info("EPC、TID标签读取失败"); - client.close(); - return new HashSet<>(); - } - //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) - TimeUnit.SECONDS.sleep(3); - // 停止指令,空闲态 - MsgBaseStop msgBaseStop = new MsgBaseStop(); - client.sendSynMsg(msgBaseStop); - if (0 == msgBaseStop.getRtCode()) { - log.info("EPC、TID标签停止读取成功"); - } else { - log.info("EPC、TID标签停止读取失败"); - } - return tIds; - } - - private void eventSubscribe(Set set, GClient client) { - // 订阅标签上报事件 - client.onTagEpcLog = new HandlerTagEpcLog() { - @Override - public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { - // 回调内部如有阻塞,会影响API正常使用 - // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 - if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { - System.out.println(logBaseEpcInfo); - log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); - set.add(logBaseEpcInfo.getTid()); - } - } - }; - // 上报结束事件 - client.onTagEpcOver = new HandlerTagEpcOver() { - @Override - public void log(String readName, LogBaseEpcOver logBaseEpcOver) { - if (null != logBaseEpcOver) { - log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); - } - } - }; - } +// private Set queryGunReturnDTO(ReturnDTO> setReturnDTO) { +// Set gunSet = new HashSet<>(); +// ReturnDTO> gunReturnDTO = setReturnDTO; +// if (ReturnUtil.success().getCode().equals(gunReturnDTO.getCode()) && Objects.nonNull(gunReturnDTO.getData())) { +// gunSet.addAll(gunReturnDTO.getData()); +// } +// return gunSet; +// } +// +// private Set receiveTIds(GClient client) throws InterruptedException { +// Set tIds = new HashSet<>(); +// //标签上报事件、结束事件订阅 +// eventSubscribe(tIds, client); +// +// // 4个天线读卡, 读取EPC数据区以及TID数据区 +// MsgBaseInventoryEpc msgBaseInventoryEpc = new MsgBaseInventoryEpc(); +// msgBaseInventoryEpc.setAntennaEnable(EnumG.AntennaNo_1 | EnumG.AntennaNo_2 | EnumG.AntennaNo_3 | EnumG.AntennaNo_4); +// // 0: 单次读取模式,读写器尽在各个使能的天线上进行一轮读卡操作便结束读卡操作并自动进入空闲状态 +// // 1: 连续读取模式,读写器一直进行读卡操作直到读写器收到停止指令后结束读卡 +// msgBaseInventoryEpc.setInventoryMode(EnumG.InventoryMode_Inventory); +// ParamEpcReadTid tid = new ParamEpcReadTid(); +// tid.setMode(EnumG.ParamTidMode_Auto); +// tid.setLen(6); +// msgBaseInventoryEpc.setReadTid(tid); +// client.sendSynMsg(msgBaseInventoryEpc); +// if (0 == msgBaseInventoryEpc.getRtCode()) { +// log.info("EPC、TID标签读取成功"); +// } else { +// log.info("EPC、TID标签读取失败"); +// client.close(); +// return new HashSet<>(); +// } +// //连续读取,让事件接收3秒,也可采用单次读取方式(没有连续读取识别效果好) +// TimeUnit.SECONDS.sleep(3); +// // 停止指令,空闲态 +// MsgBaseStop msgBaseStop = new MsgBaseStop(); +// client.sendSynMsg(msgBaseStop); +// if (0 == msgBaseStop.getRtCode()) { +// log.info("EPC、TID标签停止读取成功"); +// } else { +// log.info("EPC、TID标签停止读取失败"); +// } +// return tIds; +// } +// +// private void eventSubscribe(Set set, GClient client) { +// // 订阅标签上报事件 +// client.onTagEpcLog = new HandlerTagEpcLog() { +// @Override +// public void log(String readName, LogBaseEpcInfo logBaseEpcInfo) { +// // 回调内部如有阻塞,会影响API正常使用 +// // 标签回调数量较多,请将标签数据先缓存起来再作业务处理 +// if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) { +// System.out.println(logBaseEpcInfo); +// log.info("收到标签上报事件,{}", logBaseEpcInfo.toString()); +// set.add(logBaseEpcInfo.getTid()); +// } +// } +// }; +// // 上报结束事件 +// client.onTagEpcOver = new HandlerTagEpcOver() { +// @Override +// public void log(String readName, LogBaseEpcOver logBaseEpcOver) { +// if (null != logBaseEpcOver) { +// log.info("收到标签上报结束事件,{}", logBaseEpcOver.toString()); +// } +// } +// }; +// } } diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java b/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java index 9310599..918b059 100644 --- a/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/business/IBusinessReadWriterService.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; /** * @Description: @@ -15,19 +14,19 @@ */ public interface IBusinessReadWriterService { - ReturnDTO> sampleReadList(); + ReturnDTO> sampleReadList(Set strSet); - ReturnDTO> tIdReadList(); + ReturnDTO> equipmentLabelReadList(Set strSet); - ReturnDTO> tIdNewReadList() throws InterruptedException; + ReturnDTO> sampleLabelReadList(Set strSet); - ReturnDTO> tIdMiniReadList(); - - ReturnDTO> codeGunReadList(); - - ReturnDTO> equipmentLabelReadList() throws ExecutionException, InterruptedException; - - ReturnDTO> sampleLabelReadList() throws ExecutionException, InterruptedException; - - ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException; +// ReturnDTO> tIdReadList(); +// +// ReturnDTO> tIdNewReadList() throws InterruptedException; +// +// ReturnDTO> tIdMiniReadList(); +// +// ReturnDTO> codeGunReadList(); +// +// ReturnDTO> allTidReadList() throws ExecutionException, InterruptedException; } diff --git a/casic-metering-service/src/main/java/com/casic/missiles/service/workbench/IWorkbenchCalendarScheduleService.java b/casic-metering-service/src/main/java/com/casic/missiles/service/workbench/IWorkbenchCalendarScheduleService.java new file mode 100644 index 0000000..b97e877 --- /dev/null +++ b/casic-metering-service/src/main/java/com/casic/missiles/service/workbench/IWorkbenchCalendarScheduleService.java @@ -0,0 +1,28 @@ +package com.casic.missiles.service.workbench; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.casic.missiles.dto.ReturnDTO; +import com.casic.missiles.dto.workbench.CalendarScheduleListRequest; +import com.casic.missiles.model.workbench.WorkbenchCalendarSchedule; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 工作台-日历日程安排表 服务类 + *

+ * + * @author wangpeng + * @since 2023-06-16 + */ +public interface IWorkbenchCalendarScheduleService extends IService { + + Map> calendarScheduleList(CalendarScheduleListRequest request); + + ReturnDTO calendarScheduleAdd(List calendarScheduleList); + + ReturnDTO updateCalendarSchedule(WorkbenchCalendarSchedule calendarSchedule); + + ReturnDTO deleteCalendarSchedule(Long id); +}