diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysQrCodeController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysQrCodeController.java new file mode 100644 index 0000000..e188612 --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysQrCodeController.java @@ -0,0 +1,93 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysQrCode; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysQrCodeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "二维码管理") +@RestController +@RequestMapping("/system/qrcode") +public class SysQrCodeController { + + @Autowired + private ISysQrCodeService qrCodeService; + + @PreAuthorize("@ss.hasPermi('system:qrcode:list')") + @ApiOperation("分页查询二维码") + @GetMapping("/page") + public AjaxResult page(Page page, SysQrCode qrCode) { + IPage result = qrCodeService.selectQrCodePage(page, qrCode); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:list')") + @ApiOperation("查询二维码列表") + @GetMapping("/list") + public AjaxResult list(SysQrCode qrCode) { + List list = qrCodeService.selectQrCodeList(qrCode); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:query')") + @ApiOperation("查询二维码详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(qrCodeService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:query')") + @ApiOperation("根据序列号查询二维码") + @GetMapping("/serial/{serialNumber}") + public AjaxResult getBySerialNumber(@PathVariable String serialNumber) { + return AjaxResult.success(qrCodeService.selectBySerialNumber(serialNumber)); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:generate')") + @ApiOperation("生成二维码并保存记录") + @PostMapping("/generate") + public AjaxResult generate(@RequestParam Long modelId, + @RequestParam Long configId, + @RequestParam Long typeId, + @RequestParam Long countryId, + @RequestParam Long provinceId) { + SysQrCode qrCode = qrCodeService.generateQrCodeWithImage( + modelId, configId, typeId, countryId, provinceId); + return AjaxResult.success(qrCode); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:bind')") + @ApiOperation("绑定设备") + @PostMapping("/bind/{qrCodeId}/{deviceId}") + public AjaxResult bindDevice(@PathVariable Long qrCodeId, + @PathVariable Long deviceId) { + return toAjax(qrCodeService.bindDevice(qrCodeId, deviceId)); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:unbind')") + @ApiOperation("解绑设备") + @PostMapping("/unbind/{qrCodeId}") + public AjaxResult unbindDevice(@PathVariable Long qrCodeId) { + return toAjax(qrCodeService.unbindDevice(qrCodeId)); + } + + @PreAuthorize("@ss.hasPermi('system:qrcode:remove')") + @ApiOperation("删除二维码") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(qrCodeService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotConfigController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotConfigController.java new file mode 100644 index 0000000..69b66bc --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotConfigController.java @@ -0,0 +1,78 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysRobotConfig; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysRobotConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "机器人配置管理") +@RestController +@RequestMapping("/system/robot/config") +public class SysRobotConfigController { + + @Autowired + private ISysRobotConfigService configService; + + @PreAuthorize("@ss.hasPermi('system:robot:config:list')") + @ApiOperation("分页查询机器人配置") + @GetMapping("/page") + public AjaxResult page(Page page, SysRobotConfig config) { + IPage result = configService.selectPage(page, config); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:robot:config:list')") + @ApiOperation("查询机器人配置列表") + @GetMapping("/list") + public AjaxResult list(SysRobotConfig config) { + List list = configService.selectList(config); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:robot:config:query')") + @ApiOperation("查询机器人配置详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(configService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:config:add')") + @ApiOperation("新增机器人配置") + @PostMapping + public AjaxResult add(@RequestBody SysRobotConfig config) { + if (!configService.checkStoreValueUnique(config)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(configService.save(config)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:config:edit')") + @ApiOperation("修改机器人配置") + @PutMapping + public AjaxResult edit(@RequestBody SysRobotConfig config) { + if (!configService.checkStoreValueUnique(config)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(configService.updateById(config)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:config:remove')") + @ApiOperation("删除机器人配置") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(configService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotCountryController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotCountryController.java new file mode 100644 index 0000000..3e3c36d --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotCountryController.java @@ -0,0 +1,78 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysRobotCountry; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysRobotCountryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "国家管理") +@RestController +@RequestMapping("/system/robot/country") +public class SysRobotCountryController { + + @Autowired + private ISysRobotCountryService countryService; + + @PreAuthorize("@ss.hasPermi('system:robot:country:list')") + @ApiOperation("分页查询国家") + @GetMapping("/page") + public AjaxResult page(Page page, SysRobotCountry country) { + IPage result = countryService.selectPage(page, country); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:robot:country:list')") + @ApiOperation("查询国家列表") + @GetMapping("/list") + public AjaxResult list(SysRobotCountry country) { + List list = countryService.selectList(country); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:robot:country:query')") + @ApiOperation("查询国家详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(countryService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:country:add')") + @ApiOperation("新增国家") + @PostMapping + public AjaxResult add(@RequestBody SysRobotCountry country) { + if (!countryService.checkStoreValueUnique(country)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(countryService.save(country)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:country:edit')") + @ApiOperation("修改国家") + @PutMapping + public AjaxResult edit(@RequestBody SysRobotCountry country) { + if (!countryService.checkStoreValueUnique(country)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(countryService.updateById(country)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:country:remove')") + @ApiOperation("删除国家") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(countryService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotModelController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotModelController.java new file mode 100644 index 0000000..a750649 --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotModelController.java @@ -0,0 +1,78 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysRobotModel; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysRobotModelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "机器人型号管理") +@RestController +@RequestMapping("/system/robot/model") +public class SysRobotModelController { + + @Autowired + private ISysRobotModelService modelService; + + @PreAuthorize("@ss.hasPermi('system:robot:model:list')") + @ApiOperation("分页查询机器人型号") + @GetMapping("/page") + public AjaxResult page(Page page, SysRobotModel model) { + IPage result = modelService.selectPage(page, model); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:robot:model:list')") + @ApiOperation("查询机器人型号列表") + @GetMapping("/list") + public AjaxResult list(SysRobotModel model) { + List list = modelService.selectList(model); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:robot:model:query')") + @ApiOperation("查询机器人型号详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(modelService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:model:add')") + @ApiOperation("新增机器人型号") + @PostMapping + public AjaxResult add(@RequestBody SysRobotModel model) { + if (!modelService.checkStoreValueUnique(model)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(modelService.save(model)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:model:edit')") + @ApiOperation("修改机器人型号") + @PutMapping + public AjaxResult edit(@RequestBody SysRobotModel model) { + if (!modelService.checkStoreValueUnique(model)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(modelService.updateById(model)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:model:remove')") + @ApiOperation("删除机器人型号") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(modelService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotProvinceController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotProvinceController.java new file mode 100644 index 0000000..875e210 --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotProvinceController.java @@ -0,0 +1,78 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysRobotProvince; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysRobotProvinceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "省份管理") +@RestController +@RequestMapping("/system/robot/province") +public class SysRobotProvinceController { + + @Autowired + private ISysRobotProvinceService provinceService; + + @PreAuthorize("@ss.hasPermi('system:robot:province:list')") + @ApiOperation("分页查询省份") + @GetMapping("/page") + public AjaxResult page(Page page, SysRobotProvince province) { + IPage result = provinceService.selectPage(page, province); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:robot:province:list')") + @ApiOperation("查询省份列表") + @GetMapping("/list") + public AjaxResult list(SysRobotProvince province) { + List list = provinceService.selectList(province); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:robot:province:query')") + @ApiOperation("查询省份详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(provinceService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:province:add')") + @ApiOperation("新增省份") + @PostMapping + public AjaxResult add(@RequestBody SysRobotProvince province) { + if (!provinceService.checkStoreValueUnique(province)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(provinceService.save(province)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:province:edit')") + @ApiOperation("修改省份") + @PutMapping + public AjaxResult edit(@RequestBody SysRobotProvince province) { + if (!provinceService.checkStoreValueUnique(province)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(provinceService.updateById(province)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:province:remove')") + @ApiOperation("删除省份") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(provinceService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotTypeController.java b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotTypeController.java new file mode 100644 index 0000000..b0eb806 --- /dev/null +++ b/maibu-admin/src/main/java/com/maibu/web/controller/system/SysRobotTypeController.java @@ -0,0 +1,78 @@ +package com.maibu.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.maibu.core.business.sys_robot_qrcode.SysRobotType; +import com.maibu.core.domain.AjaxResult; +import com.maibu.service.ISysRobotTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +@Api(tags = "机器人类型管理") +@RestController +@RequestMapping("/system/robot/type") +public class SysRobotTypeController { + + @Autowired + private ISysRobotTypeService typeService; + + @PreAuthorize("@ss.hasPermi('system:robot:type:list')") + @ApiOperation("分页查询机器人类型") + @GetMapping("/page") + public AjaxResult page(Page page, SysRobotType type) { + IPage result = typeService.selectPage(page, type); + return AjaxResult.success(result.getRecords(), (int) result.getTotal()); + } + + @PreAuthorize("@ss.hasPermi('system:robot:type:list')") + @ApiOperation("查询机器人类型列表") + @GetMapping("/list") + public AjaxResult list(SysRobotType type) { + List list = typeService.selectList(type); + return AjaxResult.success(list); + } + + @PreAuthorize("@ss.hasPermi('system:robot:type:query')") + @ApiOperation("查询机器人类型详情") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(typeService.getById(id)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:type:add')") + @ApiOperation("新增机器人类型") + @PostMapping + public AjaxResult add(@RequestBody SysRobotType type) { + if (!typeService.checkStoreValueUnique(type)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(typeService.save(type)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:type:edit')") + @ApiOperation("修改机器人类型") + @PutMapping + public AjaxResult edit(@RequestBody SysRobotType type) { + if (!typeService.checkStoreValueUnique(type)) { + return AjaxResult.error("存储值已存在"); + } + return toAjax(typeService.updateById(type)); + } + + @PreAuthorize("@ss.hasPermi('system:robot:type:remove')") + @ApiOperation("删除机器人类型") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(typeService.removeByIds(Arrays.asList(ids))); + } + + protected AjaxResult toAjax(boolean result) { + return result ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/maibu-common/pom.xml b/maibu-common/pom.xml index 1a2f6d2..7385db3 100644 --- a/maibu-common/pom.xml +++ b/maibu-common/pom.xml @@ -214,6 +214,21 @@ 6.10.0 + + + com.google.zxing + core + 3.5.1 + + + + com.google.zxing + javase + 3.5.1 + + + + diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysQrCode.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysQrCode.java new file mode 100644 index 0000000..91389b4 --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysQrCode.java @@ -0,0 +1,54 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("sys_qr_code") +public class SysQrCode implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String serialNumber; + + private Long modelId; + + private Long configId; + + private Long typeId; + + private Long countryId; + + private Long provinceId; + + private String qrCodeUrl; + + private String qrCodeContent; + + private Integer status; + + private Long deviceId; + + private LocalDateTime bindTime; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} \ No newline at end of file diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotConfig.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotConfig.java new file mode 100644 index 0000000..53d2c70 --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotConfig.java @@ -0,0 +1,40 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("sys_robot_config") +public class SysRobotConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String storeValue; + + private String displayName; + + private Integer sortOrder; + + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} \ No newline at end of file diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotCountry.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotCountry.java new file mode 100644 index 0000000..4bd81da --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotCountry.java @@ -0,0 +1,40 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("sys_robot_country") +public class SysRobotCountry implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String storeValue; + + private String displayName; + + private Integer sortOrder; + + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} \ No newline at end of file diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotModel.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotModel.java new file mode 100644 index 0000000..adedf6e --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotModel.java @@ -0,0 +1,40 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("sys_robot_model") +public class SysRobotModel implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String storeValue; + + private String displayName; + + private Integer sortOrder; + + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} \ No newline at end of file diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotProvince.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotProvince.java new file mode 100644 index 0000000..243a910 --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotProvince.java @@ -0,0 +1,40 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("sys_robot_province") +public class SysRobotProvince implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String storeValue; + + private String displayName; + + private Integer sortOrder; + + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} \ No newline at end of file diff --git a/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotType.java b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotType.java new file mode 100644 index 0000000..42bd0c0 --- /dev/null +++ b/maibu-common/src/main/java/com/maibu/core/business/sys_robot_qrcode/SysRobotType.java @@ -0,0 +1,41 @@ +package com.maibu.core.business.sys_robot_qrcode; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +@TableName("sys_robot_type") +public class SysRobotType { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private String storeValue; + + private String displayName; + + private Integer sortOrder; + + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + private String remark; + + @TableLogic + private Integer delFlag; +} diff --git a/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/IOTWorkOrderController.java b/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/IOTWorkOrderController.java index 0357114..73cdc64 100644 --- a/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/IOTWorkOrderController.java +++ b/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/IOTWorkOrderController.java @@ -62,7 +62,7 @@ public class IOTWorkOrderController extends BaseController { @PreAuthorize("@ss.hasPermi('iot:workOrder:dispatch')") @Log(title = "工单派发", businessType = BusinessType.UPDATE) - @PutMapping("/dispatch") + @PostMapping("/dispatch") @ApiOperation("派发工单") public AjaxResult dispatch(@RequestBody WorkOrderDispatchDTO dispatchDTO) { return toAjax(workOrderService.dispatchWorkOrder(dispatchDTO)); @@ -78,7 +78,7 @@ public class IOTWorkOrderController extends BaseController { @PreAuthorize("@ss.hasPermi('iot:workOrder:complete')") @Log(title = "工单完成", businessType = BusinessType.UPDATE) - @PutMapping("/complete") + @PostMapping("/complete") @ApiOperation("完成工单") public AjaxResult complete(@RequestBody IOTWorkOrder workOrder) { return toAjax(workOrderService.completeWorkOrder(workOrder)); @@ -86,7 +86,7 @@ public class IOTWorkOrderController extends BaseController { @PreAuthorize("@ss.hasPermi('iot:workOrder:suspend')") @Log(title = "工单挂起", businessType = BusinessType.UPDATE) - @PutMapping("/suspend/{id}") + @PostMapping("/suspend/{id}") @ApiOperation("挂起工单") public AjaxResult suspend(@PathVariable Long id) { return toAjax(workOrderService.suspendWorkOrder(id)); diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysQrCodeMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysQrCodeMapper.java new file mode 100644 index 0000000..1589b26 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysQrCodeMapper.java @@ -0,0 +1,10 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import com.maibu.core.business.sys_robot_qrcode.SysQrCode; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysQrCodeMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotConfigMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotConfigMapper.java new file mode 100644 index 0000000..1018b39 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotConfigMapper.java @@ -0,0 +1,9 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.maibu.core.business.sys_robot_qrcode.SysRobotConfig; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysRobotConfigMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotCountryMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotCountryMapper.java new file mode 100644 index 0000000..05a42ea --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotCountryMapper.java @@ -0,0 +1,10 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import com.maibu.core.business.sys_robot_qrcode.SysRobotCountry; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysRobotCountryMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotModelMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotModelMapper.java new file mode 100644 index 0000000..b1747ce --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotModelMapper.java @@ -0,0 +1,9 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.maibu.core.business.sys_robot_qrcode.SysRobotModel; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysRobotModelMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotProvinceMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotProvinceMapper.java new file mode 100644 index 0000000..c029a68 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotProvinceMapper.java @@ -0,0 +1,9 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.maibu.core.business.sys_robot_qrcode.SysRobotProvince; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysRobotProvinceMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotTypeMapper.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotTypeMapper.java new file mode 100644 index 0000000..c95d8ad --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/mapper/SysRobotTypeMapper.java @@ -0,0 +1,9 @@ +package com.maibu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.maibu.core.business.sys_robot_qrcode.SysRobotType; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SysRobotTypeMapper extends BaseMapper { +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysQrCodeService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysQrCodeService.java new file mode 100644 index 0000000..2e2c012 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysQrCodeService.java @@ -0,0 +1,25 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysQrCode; + +import java.util.List; + +public interface ISysQrCodeService extends IService { + + IPage selectQrCodePage(IPage page, SysQrCode qrCode); + + List selectQrCodeList(SysQrCode qrCode); + + String generateUniqueSerialNumber(Long modelId, Long configId, Long countryId, Long provinceId); + + SysQrCode generateQrCodeWithImage(Long modelId, Long configId, Long typeId, + Long countryId, Long provinceId); + + SysQrCode selectBySerialNumber(String serialNumber); + + boolean bindDevice(Long qrCodeId, Long deviceId); + + boolean unbindDevice(Long qrCodeId); +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotConfigService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotConfigService.java new file mode 100644 index 0000000..64d8499 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotConfigService.java @@ -0,0 +1,16 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysRobotConfig; + +import java.util.List; + +public interface ISysRobotConfigService extends IService { + + IPage selectPage(IPage page, SysRobotConfig config); + + List selectList(SysRobotConfig config); + + boolean checkStoreValueUnique(SysRobotConfig config); +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotCountryService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotCountryService.java new file mode 100644 index 0000000..07e15c3 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotCountryService.java @@ -0,0 +1,16 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysRobotCountry; + +import java.util.List; + +public interface ISysRobotCountryService extends IService { + + IPage selectPage(IPage page, SysRobotCountry country); + + List selectList(SysRobotCountry country); + + boolean checkStoreValueUnique(SysRobotCountry country); +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotModelService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotModelService.java new file mode 100644 index 0000000..e007441 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotModelService.java @@ -0,0 +1,16 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysRobotModel; + +import java.util.List; + +public interface ISysRobotModelService extends IService { + + IPage selectPage(IPage page, SysRobotModel model); + + List selectList(SysRobotModel model); + + boolean checkStoreValueUnique(SysRobotModel model); +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotProvinceService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotProvinceService.java new file mode 100644 index 0000000..d6718ea --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotProvinceService.java @@ -0,0 +1,16 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysRobotProvince; + +import java.util.List; + +public interface ISysRobotProvinceService extends IService { + + IPage selectPage(IPage page, SysRobotProvince province); + + List selectList(SysRobotProvince province); + + boolean checkStoreValueUnique(SysRobotProvince province); +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotTypeService.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotTypeService.java new file mode 100644 index 0000000..c78af88 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/ISysRobotTypeService.java @@ -0,0 +1,16 @@ +package com.maibu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.maibu.core.business.sys_robot_qrcode.SysRobotType; + +import java.util.List; + +public interface ISysRobotTypeService extends IService { + + IPage selectPage(IPage page, SysRobotType type); + + List selectList(SysRobotType type); + + boolean checkStoreValueUnique(SysRobotType type); +} \ No newline at end of file diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysQrCodeServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysQrCodeServiceImpl.java new file mode 100644 index 0000000..3f0241c --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysQrCodeServiceImpl.java @@ -0,0 +1,202 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import com.maibu.core.business.sys_robot_qrcode.*; +import com.maibu.mapper.*; +import com.maibu.service.ISysQrCodeService; +import com.maibu.utils.MinioUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +@Slf4j +@Service +public class SysQrCodeServiceImpl extends ServiceImpl implements ISysQrCodeService { + + @Autowired + private SysRobotModelMapper robotModelMapper; + + @Autowired + private SysRobotConfigMapper robotConfigMapper; + + @Autowired + private SysRobotTypeMapper robotTypeMapper; + + @Autowired + private SysRobotCountryMapper robotCountryMapper; + + @Autowired + private SysRobotProvinceMapper robotProvinceMapper; + + @Autowired + private MinioUtil minioUtil; + + @Override + public IPage selectQrCodePage(IPage page, SysQrCode qrCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(qrCode.getSerialNumber() != null, SysQrCode::getSerialNumber, qrCode.getSerialNumber()) + .eq(qrCode.getModelId() != null, SysQrCode::getModelId, qrCode.getModelId()) + .eq(qrCode.getConfigId() != null, SysQrCode::getConfigId, qrCode.getConfigId()) + .eq(qrCode.getTypeId() != null, SysQrCode::getTypeId, qrCode.getTypeId()) + .eq(qrCode.getCountryId() != null, SysQrCode::getCountryId, qrCode.getCountryId()) + .eq(qrCode.getProvinceId() != null, SysQrCode::getProvinceId, qrCode.getProvinceId()) + .eq(qrCode.getStatus() != null, SysQrCode::getStatus, qrCode.getStatus()) + .eq(qrCode.getDeviceId() != null, SysQrCode::getDeviceId, qrCode.getDeviceId()) + .orderByDesc(SysQrCode::getCreateTime); + return this.page(page, wrapper); + } + + @Override + public List selectQrCodeList(SysQrCode qrCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(qrCode.getSerialNumber() != null, SysQrCode::getSerialNumber, qrCode.getSerialNumber()) + .eq(qrCode.getModelId() != null, SysQrCode::getModelId, qrCode.getModelId()) + .eq(qrCode.getConfigId() != null, SysQrCode::getConfigId, qrCode.getConfigId()) + .eq(qrCode.getTypeId() != null, SysQrCode::getTypeId, qrCode.getTypeId()) + .eq(qrCode.getCountryId() != null, SysQrCode::getCountryId, qrCode.getCountryId()) + .eq(qrCode.getProvinceId() != null, SysQrCode::getProvinceId, qrCode.getProvinceId()) + .eq(qrCode.getStatus() != null, SysQrCode::getStatus, qrCode.getStatus()) + .orderByDesc(SysQrCode::getCreateTime); + return this.list(wrapper); + } + + @Override + public String generateUniqueSerialNumber(Long modelId, Long configId, Long countryId, Long provinceId) { + SysRobotModel model = robotModelMapper.selectById(modelId); + SysRobotConfig config = robotConfigMapper.selectById(configId); + SysRobotCountry country = robotCountryMapper.selectById(countryId); + SysRobotProvince province = robotProvinceMapper.selectById(provinceId); + + if (model == null || config == null || country == null || province == null) { + throw new RuntimeException("基础数据不存在"); + } + + StringBuilder serialNumber = new StringBuilder(); + serialNumber.append(model.getStoreValue()); + serialNumber.append(config.getStoreValue()); + serialNumber.append("-"); + serialNumber.append(country.getStoreValue()); + serialNumber.append("-"); + serialNumber.append(province.getStoreValue()); + serialNumber.append("-"); + + long timestamp = System.currentTimeMillis(); + String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 16); + serialNumber.append(timestamp).append("-").append(uuid); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysQrCode::getSerialNumber, serialNumber.toString()); + if (this.count(wrapper) > 0) { + return generateUniqueSerialNumber(modelId, configId, countryId, provinceId); + } + + return serialNumber.toString(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public SysQrCode generateQrCodeWithImage(Long modelId, Long configId, Long typeId, + Long countryId, Long provinceId) { + String serialNumber = generateUniqueSerialNumber(modelId, configId, countryId, provinceId); + + String qrCodeUrl = generateAndUploadQrImage(serialNumber); + + SysQrCode qrCode = new SysQrCode(); + qrCode.setSerialNumber(serialNumber); + qrCode.setModelId(modelId); + qrCode.setConfigId(configId); + qrCode.setTypeId(typeId); + qrCode.setCountryId(countryId); + qrCode.setProvinceId(provinceId); + qrCode.setQrCodeUrl(qrCodeUrl); + qrCode.setQrCodeContent(serialNumber); + qrCode.setStatus(0); + + this.save(qrCode); + return qrCode; + } + + private String generateAndUploadQrImage(String serialNumber) { + try { + QRCodeWriter qrCodeWriter = new QRCodeWriter(); + Map hints = new HashMap<>(); + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + hints.put(EncodeHintType.ERROR_CORRECTION, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.H); + + BitMatrix bitMatrix = qrCodeWriter.encode(serialNumber, BarcodeFormat.QR_CODE, 300, 300, hints); + + BufferedImage image = MatrixToImageWriter.toBufferedImage(bitMatrix); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(image, "PNG", baos); + byte[] imageBytes = baos.toByteArray(); + + String objectName = "qrcode/" + serialNumber + ".png"; + ByteArrayInputStream bais = new ByteArrayInputStream(imageBytes); + + minioUtil.uploadFile(objectName, bais, "image/png"); + + return minioUtil.getPublicUrl(objectName); + + } catch (Exception e) { + log.error("生成二维码图片并上传MinIO失败: {}", serialNumber, e); + throw new RuntimeException("生成二维码图片失败", e); + } + } + + @Override + public SysQrCode selectBySerialNumber(String serialNumber) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysQrCode::getSerialNumber, serialNumber); + return this.getOne(wrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean bindDevice(Long qrCodeId, Long deviceId) { + SysQrCode qrCode = this.getById(qrCodeId); + if (qrCode == null) { + throw new RuntimeException("二维码不存在"); + } + if (qrCode.getStatus() == 1) { + throw new RuntimeException("二维码已绑定设备"); + } + + qrCode.setDeviceId(deviceId); + qrCode.setStatus(1); + qrCode.setBindTime(LocalDateTime.now()); + return this.updateById(qrCode); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean unbindDevice(Long qrCodeId) { + SysQrCode qrCode = this.getById(qrCodeId); + if (qrCode == null) { + throw new RuntimeException("二维码不存在"); + } + + qrCode.setDeviceId(null); + qrCode.setStatus(0); + qrCode.setBindTime(null); + return this.updateById(qrCode); + } +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotConfigServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotConfigServiceImpl.java new file mode 100644 index 0000000..19802be --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotConfigServiceImpl.java @@ -0,0 +1,45 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.maibu.core.business.sys_robot_qrcode.SysRobotConfig; +import com.maibu.mapper.SysRobotConfigMapper; +import com.maibu.service.ISysRobotConfigService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.List; + +@Service +public class SysRobotConfigServiceImpl extends ServiceImpl implements ISysRobotConfigService { + + @Override + public IPage selectPage(IPage page, SysRobotConfig config) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(config.getStoreValue()), SysRobotConfig::getStoreValue, config.getStoreValue()) + .like(StringUtils.hasText(config.getDisplayName()), SysRobotConfig::getDisplayName, config.getDisplayName()) + .eq(config.getStatus() != null, SysRobotConfig::getStatus, config.getStatus()) + .orderByAsc(SysRobotConfig::getSortOrder); + return this.page(page, wrapper); + } + + @Override + public List selectList(SysRobotConfig config) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(config.getStoreValue()), SysRobotConfig::getStoreValue, config.getStoreValue()) + .like(StringUtils.hasText(config.getDisplayName()), SysRobotConfig::getDisplayName, config.getDisplayName()) + .eq(config.getStatus() != null, SysRobotConfig::getStatus, config.getStatus()) + .orderByAsc(SysRobotConfig::getSortOrder); + return this.list(wrapper); + } + + @Override + public boolean checkStoreValueUnique(SysRobotConfig config) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRobotConfig::getStoreValue, config.getStoreValue()); + if (config.getId() != null) { + wrapper.ne(SysRobotConfig::getId, config.getId()); + } + return this.count(wrapper) == 0; + } +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotCountryServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotCountryServiceImpl.java new file mode 100644 index 0000000..5c4a4b7 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotCountryServiceImpl.java @@ -0,0 +1,45 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.maibu.core.business.sys_robot_qrcode.SysRobotCountry; +import com.maibu.mapper.SysRobotCountryMapper; +import com.maibu.service.ISysRobotCountryService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.List; + +@Service +public class SysRobotCountryServiceImpl extends ServiceImpl implements ISysRobotCountryService { + + @Override + public IPage selectPage(IPage page, SysRobotCountry country) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(country.getStoreValue()), SysRobotCountry::getStoreValue, country.getStoreValue()) + .like(StringUtils.hasText(country.getDisplayName()), SysRobotCountry::getDisplayName, country.getDisplayName()) + .eq(country.getStatus() != null, SysRobotCountry::getStatus, country.getStatus()) + .orderByAsc(SysRobotCountry::getSortOrder); + return this.page(page, wrapper); + } + + @Override + public List selectList(SysRobotCountry country) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(country.getStoreValue()), SysRobotCountry::getStoreValue, country.getStoreValue()) + .like(StringUtils.hasText(country.getDisplayName()), SysRobotCountry::getDisplayName, country.getDisplayName()) + .eq(country.getStatus() != null, SysRobotCountry::getStatus, country.getStatus()) + .orderByAsc(SysRobotCountry::getSortOrder); + return this.list(wrapper); + } + + @Override + public boolean checkStoreValueUnique(SysRobotCountry country) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRobotCountry::getStoreValue, country.getStoreValue()); + if (country.getId() != null) { + wrapper.ne(SysRobotCountry::getId, country.getId()); + } + return this.count(wrapper) == 0; + } +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotModelServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotModelServiceImpl.java new file mode 100644 index 0000000..a6ad48d --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotModelServiceImpl.java @@ -0,0 +1,45 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.maibu.core.business.sys_robot_qrcode.SysRobotModel; +import com.maibu.mapper.SysRobotModelMapper; +import com.maibu.service.ISysRobotModelService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.List; + +@Service +public class SysRobotModelServiceImpl extends ServiceImpl implements ISysRobotModelService { + + @Override + public IPage selectPage(IPage page, SysRobotModel model) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(model.getStoreValue()), SysRobotModel::getStoreValue, model.getStoreValue()) + .like(StringUtils.hasText(model.getDisplayName()), SysRobotModel::getDisplayName, model.getDisplayName()) + .eq(model.getStatus() != null, SysRobotModel::getStatus, model.getStatus()) + .orderByAsc(SysRobotModel::getSortOrder); + return this.page(page, wrapper); + } + + @Override + public List selectList(SysRobotModel model) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(model.getStoreValue()), SysRobotModel::getStoreValue, model.getStoreValue()) + .like(StringUtils.hasText(model.getDisplayName()), SysRobotModel::getDisplayName, model.getDisplayName()) + .eq(model.getStatus() != null, SysRobotModel::getStatus, model.getStatus()) + .orderByAsc(SysRobotModel::getSortOrder); + return this.list(wrapper); + } + + @Override + public boolean checkStoreValueUnique(SysRobotModel model) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRobotModel::getStoreValue, model.getStoreValue()); + if (model.getId() != null) { + wrapper.ne(SysRobotModel::getId, model.getId()); + } + return this.count(wrapper) == 0; + } +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotProvinceServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotProvinceServiceImpl.java new file mode 100644 index 0000000..38bc092 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotProvinceServiceImpl.java @@ -0,0 +1,45 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.maibu.core.business.sys_robot_qrcode.SysRobotProvince; +import com.maibu.mapper.SysRobotProvinceMapper; +import com.maibu.service.ISysRobotProvinceService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.List; + +@Service +public class SysRobotProvinceServiceImpl extends ServiceImpl implements ISysRobotProvinceService { + + @Override + public IPage selectPage(IPage page, SysRobotProvince province) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(province.getStoreValue()), SysRobotProvince::getStoreValue, province.getStoreValue()) + .like(StringUtils.hasText(province.getDisplayName()), SysRobotProvince::getDisplayName, province.getDisplayName()) + .eq(province.getStatus() != null, SysRobotProvince::getStatus, province.getStatus()) + .orderByAsc(SysRobotProvince::getSortOrder); + return this.page(page, wrapper); + } + + @Override + public List selectList(SysRobotProvince province) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(province.getStoreValue()), SysRobotProvince::getStoreValue, province.getStoreValue()) + .like(StringUtils.hasText(province.getDisplayName()), SysRobotProvince::getDisplayName, province.getDisplayName()) + .eq(province.getStatus() != null, SysRobotProvince::getStatus, province.getStatus()) + .orderByAsc(SysRobotProvince::getSortOrder); + return this.list(wrapper); + } + + @Override + public boolean checkStoreValueUnique(SysRobotProvince province) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRobotProvince::getStoreValue, province.getStoreValue()); + if (province.getId() != null) { + wrapper.ne(SysRobotProvince::getId, province.getId()); + } + return this.count(wrapper) == 0; + } +} diff --git a/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotTypeServiceImpl.java b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotTypeServiceImpl.java new file mode 100644 index 0000000..3821df2 --- /dev/null +++ b/maibu-service/maibu-system-service/src/main/java/com/maibu/service/impl/SysRobotTypeServiceImpl.java @@ -0,0 +1,45 @@ +package com.maibu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.maibu.core.business.sys_robot_qrcode.SysRobotType; +import com.maibu.mapper.SysRobotTypeMapper; +import com.maibu.service.ISysRobotTypeService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.List; + +@Service +public class SysRobotTypeServiceImpl extends ServiceImpl implements ISysRobotTypeService { + + @Override + public IPage selectPage(IPage page, SysRobotType type) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(type.getStoreValue()), SysRobotType::getStoreValue, type.getStoreValue()) + .like(StringUtils.hasText(type.getDisplayName()), SysRobotType::getDisplayName, type.getDisplayName()) + .eq(type.getStatus() != null, SysRobotType::getStatus, type.getStatus()) + .orderByAsc(SysRobotType::getSortOrder); + return this.page(page, wrapper); + } + + @Override + public List selectList(SysRobotType type) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StringUtils.hasText(type.getStoreValue()), SysRobotType::getStoreValue, type.getStoreValue()) + .like(StringUtils.hasText(type.getDisplayName()), SysRobotType::getDisplayName, type.getDisplayName()) + .eq(type.getStatus() != null, SysRobotType::getStatus, type.getStatus()) + .orderByAsc(SysRobotType::getSortOrder); + return this.list(wrapper); + } + + @Override + public boolean checkStoreValueUnique(SysRobotType type) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRobotType::getStoreValue, type.getStoreValue()); + if (type.getId() != null) { + wrapper.ne(SysRobotType::getId, type.getId()); + } + return this.count(wrapper) == 0; + } +}