#机器人的二维码模块
This commit is contained in:
@@ -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<SysQrCode> page, SysQrCode qrCode) {
|
||||
IPage<SysQrCode> 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<SysQrCode> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotConfig> page, SysRobotConfig config) {
|
||||
IPage<SysRobotConfig> 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<SysRobotConfig> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotCountry> page, SysRobotCountry country) {
|
||||
IPage<SysRobotCountry> 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<SysRobotCountry> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotModel> page, SysRobotModel model) {
|
||||
IPage<SysRobotModel> 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<SysRobotModel> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotProvince> page, SysRobotProvince province) {
|
||||
IPage<SysRobotProvince> 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<SysRobotProvince> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotType> page, SysRobotType type) {
|
||||
IPage<SysRobotType> 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<SysRobotType> 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();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +214,21 @@
|
||||
<version>6.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--二维码-->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<!-- OkHttp3依赖 -->
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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));
|
||||
|
||||
@@ -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<SysQrCode> {
|
||||
}
|
||||
@@ -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<SysRobotConfig> {
|
||||
}
|
||||
@@ -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<SysRobotCountry> {
|
||||
}
|
||||
@@ -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<SysRobotModel> {
|
||||
}
|
||||
@@ -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<SysRobotProvince> {
|
||||
}
|
||||
@@ -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<SysRobotType> {
|
||||
}
|
||||
@@ -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<SysQrCode> {
|
||||
|
||||
IPage<SysQrCode> selectQrCodePage(IPage<SysQrCode> page, SysQrCode qrCode);
|
||||
|
||||
List<SysQrCode> 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);
|
||||
}
|
||||
@@ -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<SysRobotConfig> {
|
||||
|
||||
IPage<SysRobotConfig> selectPage(IPage<SysRobotConfig> page, SysRobotConfig config);
|
||||
|
||||
List<SysRobotConfig> selectList(SysRobotConfig config);
|
||||
|
||||
boolean checkStoreValueUnique(SysRobotConfig config);
|
||||
}
|
||||
@@ -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<SysRobotCountry> {
|
||||
|
||||
IPage<SysRobotCountry> selectPage(IPage<SysRobotCountry> page, SysRobotCountry country);
|
||||
|
||||
List<SysRobotCountry> selectList(SysRobotCountry country);
|
||||
|
||||
boolean checkStoreValueUnique(SysRobotCountry country);
|
||||
}
|
||||
@@ -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<SysRobotModel> {
|
||||
|
||||
IPage<SysRobotModel> selectPage(IPage<SysRobotModel> page, SysRobotModel model);
|
||||
|
||||
List<SysRobotModel> selectList(SysRobotModel model);
|
||||
|
||||
boolean checkStoreValueUnique(SysRobotModel model);
|
||||
}
|
||||
@@ -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<SysRobotProvince> {
|
||||
|
||||
IPage<SysRobotProvince> selectPage(IPage<SysRobotProvince> page, SysRobotProvince province);
|
||||
|
||||
List<SysRobotProvince> selectList(SysRobotProvince province);
|
||||
|
||||
boolean checkStoreValueUnique(SysRobotProvince province);
|
||||
}
|
||||
@@ -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<SysRobotType> {
|
||||
|
||||
IPage<SysRobotType> selectPage(IPage<SysRobotType> page, SysRobotType type);
|
||||
|
||||
List<SysRobotType> selectList(SysRobotType type);
|
||||
|
||||
boolean checkStoreValueUnique(SysRobotType type);
|
||||
}
|
||||
@@ -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<SysQrCodeMapper, SysQrCode> 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<SysQrCode> selectQrCodePage(IPage<SysQrCode> page, SysQrCode qrCode) {
|
||||
LambdaQueryWrapper<SysQrCode> 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<SysQrCode> selectQrCodeList(SysQrCode qrCode) {
|
||||
LambdaQueryWrapper<SysQrCode> 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<SysQrCode> 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<EncodeHintType, Object> 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<SysQrCode> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotConfigMapper, SysRobotConfig> implements ISysRobotConfigService {
|
||||
|
||||
@Override
|
||||
public IPage<SysRobotConfig> selectPage(IPage<SysRobotConfig> page, SysRobotConfig config) {
|
||||
LambdaQueryWrapper<SysRobotConfig> 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<SysRobotConfig> selectList(SysRobotConfig config) {
|
||||
LambdaQueryWrapper<SysRobotConfig> 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<SysRobotConfig> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysRobotConfig::getStoreValue, config.getStoreValue());
|
||||
if (config.getId() != null) {
|
||||
wrapper.ne(SysRobotConfig::getId, config.getId());
|
||||
}
|
||||
return this.count(wrapper) == 0;
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotCountryMapper, SysRobotCountry> implements ISysRobotCountryService {
|
||||
|
||||
@Override
|
||||
public IPage<SysRobotCountry> selectPage(IPage<SysRobotCountry> page, SysRobotCountry country) {
|
||||
LambdaQueryWrapper<SysRobotCountry> 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<SysRobotCountry> selectList(SysRobotCountry country) {
|
||||
LambdaQueryWrapper<SysRobotCountry> 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<SysRobotCountry> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysRobotCountry::getStoreValue, country.getStoreValue());
|
||||
if (country.getId() != null) {
|
||||
wrapper.ne(SysRobotCountry::getId, country.getId());
|
||||
}
|
||||
return this.count(wrapper) == 0;
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotModelMapper, SysRobotModel> implements ISysRobotModelService {
|
||||
|
||||
@Override
|
||||
public IPage<SysRobotModel> selectPage(IPage<SysRobotModel> page, SysRobotModel model) {
|
||||
LambdaQueryWrapper<SysRobotModel> 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<SysRobotModel> selectList(SysRobotModel model) {
|
||||
LambdaQueryWrapper<SysRobotModel> 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<SysRobotModel> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysRobotModel::getStoreValue, model.getStoreValue());
|
||||
if (model.getId() != null) {
|
||||
wrapper.ne(SysRobotModel::getId, model.getId());
|
||||
}
|
||||
return this.count(wrapper) == 0;
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotProvinceMapper, SysRobotProvince> implements ISysRobotProvinceService {
|
||||
|
||||
@Override
|
||||
public IPage<SysRobotProvince> selectPage(IPage<SysRobotProvince> page, SysRobotProvince province) {
|
||||
LambdaQueryWrapper<SysRobotProvince> 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<SysRobotProvince> selectList(SysRobotProvince province) {
|
||||
LambdaQueryWrapper<SysRobotProvince> 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<SysRobotProvince> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysRobotProvince::getStoreValue, province.getStoreValue());
|
||||
if (province.getId() != null) {
|
||||
wrapper.ne(SysRobotProvince::getId, province.getId());
|
||||
}
|
||||
return this.count(wrapper) == 0;
|
||||
}
|
||||
}
|
||||
@@ -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<SysRobotTypeMapper, SysRobotType> implements ISysRobotTypeService {
|
||||
|
||||
@Override
|
||||
public IPage<SysRobotType> selectPage(IPage<SysRobotType> page, SysRobotType type) {
|
||||
LambdaQueryWrapper<SysRobotType> 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<SysRobotType> selectList(SysRobotType type) {
|
||||
LambdaQueryWrapper<SysRobotType> 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<SysRobotType> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysRobotType::getStoreValue, type.getStoreValue());
|
||||
if (type.getId() != null) {
|
||||
wrapper.ne(SysRobotType::getId, type.getId());
|
||||
}
|
||||
return this.count(wrapper) == 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user