增加打印机相关,更改打包方式
This commit is contained in:
parent
f667a9f02c
commit
f789c6c823
|
|
@ -117,32 +117,15 @@
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>*.properties</exclude>
|
|
||||||
<exclude>*.yml</exclude>
|
|
||||||
<exclude>*.xml</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!-- 跳过单元测试 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.6</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<skipTests>true</skipTests>
|
||||||
<descriptor>src/assembly/assembly.xml</descriptor>
|
|
||||||
</descriptors>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name="tb_print_machine")
|
||||||
|
public class TbPrintMachine implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "`id`")
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(name = "`name`",nullable = false)
|
||||||
|
@NotBlank
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "`type`")
|
||||||
|
@ApiModelProperty(value = "printer")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name = "`connection_type`")
|
||||||
|
@ApiModelProperty(value = "现在打印机支持USB 和 网络、蓝牙")
|
||||||
|
private String connectionType;
|
||||||
|
|
||||||
|
@Column(name = "`address`")
|
||||||
|
@ApiModelProperty(value = "ip地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Column(name = "`port`")
|
||||||
|
@ApiModelProperty(value = "端口")
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
@Column(name = "`sub_type`")
|
||||||
|
@ApiModelProperty(value = "打印类型(分类)")
|
||||||
|
private String subType;
|
||||||
|
|
||||||
|
@Column(name = "`status`")
|
||||||
|
@ApiModelProperty(value = "状态 online")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Column(name = "`shop_id`")
|
||||||
|
@ApiModelProperty(value = "店铺Id")
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
@Column(name = "`category_ids`")
|
||||||
|
@ApiModelProperty(value = "分类Id")
|
||||||
|
private String categoryIds;
|
||||||
|
|
||||||
|
@Column(name = "`content_type`")
|
||||||
|
@ApiModelProperty(value = "现在打印机支持USB 和 网络两种")
|
||||||
|
private String contentType;
|
||||||
|
|
||||||
|
@Column(name = "`config`")
|
||||||
|
@ApiModelProperty(value = "主配置")
|
||||||
|
private String config;
|
||||||
|
|
||||||
|
@Column(name = "`created_at`")
|
||||||
|
@ApiModelProperty(value = "createdAt")
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
@Column(name = "`updated_at`")
|
||||||
|
@ApiModelProperty(value = "updatedAt")
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
@Column(name = "`category_list`")
|
||||||
|
@ApiModelProperty(value = "分类")
|
||||||
|
private String categoryList;
|
||||||
|
|
||||||
|
@Column(name = "`sort`")
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Column(name = "`vendor_id`")
|
||||||
|
@ApiModelProperty(value = "Android打印机需要标识设备ID ")
|
||||||
|
private String vendorId;
|
||||||
|
|
||||||
|
@Column(name = "`product_id`")
|
||||||
|
@ApiModelProperty(value = "Android打印机需要标识设备ID ")
|
||||||
|
private String productId;
|
||||||
|
|
||||||
|
public void copy(TbPrintMachine source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.repository;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.domain.TbPrintMachine;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
public interface TbPrintMachineRepository extends JpaRepository<TbPrintMachine, Integer>, JpaSpecificationExecutor<TbPrintMachine> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.rest;
|
||||||
|
|
||||||
|
import me.zhengjie.annotation.Log;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.domain.TbPrintMachine;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.TbPrintMachineService;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.PrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "/shop/print管理")
|
||||||
|
@RequestMapping("/api/tbPrintMachine")
|
||||||
|
public class TbPrintMachineController {
|
||||||
|
|
||||||
|
private final TbPrintMachineService tbPrintMachineService;
|
||||||
|
|
||||||
|
// @Log("导出数据")
|
||||||
|
// @ApiOperation("导出数据")
|
||||||
|
// @GetMapping(value = "/download")
|
||||||
|
// public void exportTbPrintMachine(HttpServletResponse response, TbPrintMachineQueryCriteria criteria) throws IOException {
|
||||||
|
// tbPrintMachineService.download(tbPrintMachineService.queryAll(criteria), response);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询/shop/print")
|
||||||
|
@ApiOperation("查询/shop/print")
|
||||||
|
public ResponseEntity<Object> queryTbPrintMachine(TbPrintMachineQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity<>(tbPrintMachineService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增/shop/print")
|
||||||
|
@ApiOperation("新增/shop/print")
|
||||||
|
public ResponseEntity<Object> createTbPrintMachine(@Validated @RequestBody PrintMachineDto resources){
|
||||||
|
return new ResponseEntity<>(tbPrintMachineService.create(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ResponseEntity<Object> createTbPrintMachine(@PathVariable Integer id){
|
||||||
|
return new ResponseEntity<>(tbPrintMachineService.findById(id),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改/shop/print")
|
||||||
|
@ApiOperation("修改/shop/print")
|
||||||
|
public ResponseEntity<Object> updateTbPrintMachine(@Validated @RequestBody PrintMachineDto resources){
|
||||||
|
tbPrintMachineService.update(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Log("删除/shop/print")
|
||||||
|
@ApiOperation("删除/shop/print")
|
||||||
|
public ResponseEntity<Object> deleteTbPrintMachine(@RequestBody Integer[] ids) {
|
||||||
|
tbPrintMachineService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.domain.TbPrintMachine;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.PrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineQueryCriteria;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineVO;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description 服务接口
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
public interface TbPrintMachineService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
List<TbPrintMachineVO> queryAll(TbPrintMachineQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<TbPrintMachineDto>
|
||||||
|
*/
|
||||||
|
// List<TbPrintMachineDto> queryAll(TbPrintMachineQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param id ID
|
||||||
|
* @return TbPrintMachineDto
|
||||||
|
*/
|
||||||
|
TbPrintMachineVO findById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param resources /
|
||||||
|
* @return TbPrintMachineDto
|
||||||
|
*/
|
||||||
|
TbPrintMachine create(PrintMachineDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param resources /
|
||||||
|
*/
|
||||||
|
void update(PrintMachineDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Integer[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<TbPrintMachineDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 12847
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PrintConfig {
|
||||||
|
private String width;
|
||||||
|
private String printerNum;
|
||||||
|
|
||||||
|
private List<TbShopCategory> categoryList;
|
||||||
|
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
private String feet;
|
||||||
|
|
||||||
|
private String autoCut;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
@Data
|
||||||
|
public class PrintMachineDto {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 设备名称 */
|
||||||
|
@NotNull(message = "设备名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** printer */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络、蓝牙 */
|
||||||
|
private String connectionType;
|
||||||
|
|
||||||
|
/** ip地址 */
|
||||||
|
@NotNull(message = "设备号不能为空")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 端口 */
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/** 打印类型(分类) */
|
||||||
|
private String subType;
|
||||||
|
|
||||||
|
/** 状态 online */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 店铺Id */
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/** 分类Id */
|
||||||
|
private String categoryIds;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络两种 */
|
||||||
|
private String contentType;
|
||||||
|
|
||||||
|
/** 主配置 */
|
||||||
|
private PrintConfig config;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
/** 分类 */
|
||||||
|
private String categoryList;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String vendorId;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String productId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbPrintMachineDto implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 设备名称 */
|
||||||
|
@NotNull(message = "设备名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** printer */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络、蓝牙 */
|
||||||
|
private String connectionType;
|
||||||
|
|
||||||
|
/** ip地址 */
|
||||||
|
@NotNull(message = "设备号不能为空")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 端口 */
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/** 打印类型(分类) */
|
||||||
|
private String subType;
|
||||||
|
|
||||||
|
/** 状态 online */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 店铺Id */
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/** 分类Id */
|
||||||
|
private String categoryIds;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络两种 */
|
||||||
|
private String contentType;
|
||||||
|
|
||||||
|
/** 主配置 */
|
||||||
|
private String config;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
/** 分类 */
|
||||||
|
private String categoryList;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String vendorId;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String productId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
import me.zhengjie.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class TbPrintMachineQueryCriteria{
|
||||||
|
|
||||||
|
/** 模糊 */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 精确 */
|
||||||
|
@Query
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Query
|
||||||
|
private String shopId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TbPrintMachineVO {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 设备名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** printer */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络、蓝牙 */
|
||||||
|
private String connectionType;
|
||||||
|
|
||||||
|
/** ip地址 */
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 端口 */
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/** 打印类型(分类) */
|
||||||
|
private String subType;
|
||||||
|
|
||||||
|
/** 状态 online */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 店铺Id */
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/** 分类Id */
|
||||||
|
private String categoryIds;
|
||||||
|
|
||||||
|
/** 现在打印机支持USB 和 网络两种 */
|
||||||
|
private String contentType;
|
||||||
|
|
||||||
|
/** 主配置 */
|
||||||
|
private JSONObject config;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
/** 分类 */
|
||||||
|
private String categoryList;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String vendorId;
|
||||||
|
|
||||||
|
/** Android打印机需要标识设备ID */
|
||||||
|
private String productId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import me.zhengjie.exception.BadRequestException;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.domain.TbPrintMachine;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.PrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineVO;
|
||||||
|
import me.zhengjie.utils.*;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.repository.TbPrintMachineRepository;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.TbPrintMachineService;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineDto;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineQueryCriteria;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.mapstruct.TbPrintMachineMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description 服务实现
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TbPrintMachineServiceImpl implements TbPrintMachineService {
|
||||||
|
|
||||||
|
private final TbPrintMachineRepository tbPrintMachineRepository;
|
||||||
|
private final TbPrintMachineMapper tbPrintMachineMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TbPrintMachineVO> queryAll(TbPrintMachineQueryCriteria criteria, Pageable pageable){
|
||||||
|
Page<TbPrintMachine> page = tbPrintMachineRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
|
List<TbPrintMachineVO> printMachineVOList = new ArrayList<>();
|
||||||
|
for (TbPrintMachine dtoData : page.getContent()) {
|
||||||
|
TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
|
||||||
|
if (dtoData.getConfig() != null){
|
||||||
|
tbPrintMachineVO.setConfig(ListUtil.stringToJSONObject(dtoData.getConfig()));
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(dtoData,tbPrintMachineVO);
|
||||||
|
printMachineVOList.add(tbPrintMachineVO);
|
||||||
|
}
|
||||||
|
return printMachineVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<TbPrintMachineDto> queryAll(TbPrintMachineQueryCriteria criteria){
|
||||||
|
// List<TbPrintMachineDto> dto = tbPrintMachineMapper.toDto(tbPrintMachineRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
|
// List<TbPrintMachineVO> printMachineVOList = new ArrayList<>();
|
||||||
|
// for (TbPrintMachineDto dtoData : dto) {
|
||||||
|
// TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
|
||||||
|
// if (dtoData.getConfig() != null){
|
||||||
|
// tbPrintMachineVO.setConfig(ListUtil.stringChangeList(dtoData.getConfig()));
|
||||||
|
// }
|
||||||
|
// BeanUtils.copyProperties(dtoData,tbPrintMachineVO);
|
||||||
|
// printMachineVOList.add(tbPrintMachineVO);
|
||||||
|
// }
|
||||||
|
// return printMachineVOList;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public TbPrintMachineVO findById(Integer id) {
|
||||||
|
TbPrintMachine tbPrintMachine = tbPrintMachineRepository.findById(id).orElseGet(TbPrintMachine::new);
|
||||||
|
if (tbPrintMachine.getId() == null){
|
||||||
|
throw new BadRequestException("数据有误");
|
||||||
|
}
|
||||||
|
TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
|
||||||
|
if (tbPrintMachine.getConfig() != null){
|
||||||
|
tbPrintMachineVO.setConfig(ListUtil.stringToJSONObject(tbPrintMachine.getConfig()));
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(tbPrintMachine,tbPrintMachineVO);
|
||||||
|
ValidationUtil.isNull(tbPrintMachine.getId(),"TbPrintMachine","id",id);
|
||||||
|
return tbPrintMachineVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public TbPrintMachine create(PrintMachineDto resources) {
|
||||||
|
TbPrintMachine tbPrintMachine = new TbPrintMachine();
|
||||||
|
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
if (resources.getConfig() != null){
|
||||||
|
tbPrintMachine.setConfig(ListUtil.toString(resources.getConfig()));
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(resources,tbPrintMachine);
|
||||||
|
return tbPrintMachineRepository.save(tbPrintMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(PrintMachineDto resources) {
|
||||||
|
TbPrintMachine tbPrintMachine = tbPrintMachineRepository.findById(resources.getId()).orElseGet(TbPrintMachine::new);
|
||||||
|
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
if (resources.getConfig() != null){
|
||||||
|
tbPrintMachine.setConfig(ListUtil.toString(resources.getConfig()));
|
||||||
|
}
|
||||||
|
ValidationUtil.isNull( tbPrintMachine.getId(),"TbPrintMachine","id",resources.getId());
|
||||||
|
BeanUtils.copyProperties(resources,tbPrintMachine);
|
||||||
|
tbPrintMachineRepository.save(tbPrintMachine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Integer[] ids) {
|
||||||
|
for (Integer id : ids) {
|
||||||
|
tbPrintMachineRepository.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<TbPrintMachineDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (TbPrintMachineDto tbPrintMachine : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("设备名称", tbPrintMachine.getName());
|
||||||
|
map.put("printer", tbPrintMachine.getType());
|
||||||
|
map.put("现在打印机支持USB 和 网络、蓝牙", tbPrintMachine.getConnectionType());
|
||||||
|
map.put("ip地址", tbPrintMachine.getAddress());
|
||||||
|
map.put("端口", tbPrintMachine.getPort());
|
||||||
|
map.put("打印类型(分类)", tbPrintMachine.getSubType());
|
||||||
|
map.put("状态 online", tbPrintMachine.getStatus());
|
||||||
|
map.put("店铺Id", tbPrintMachine.getShopId());
|
||||||
|
map.put("分类Id", tbPrintMachine.getCategoryIds());
|
||||||
|
map.put("现在打印机支持USB 和 网络两种", tbPrintMachine.getContentType());
|
||||||
|
map.put("主配置", tbPrintMachine.getConfig());
|
||||||
|
map.put(" createdAt", tbPrintMachine.getCreatedAt());
|
||||||
|
map.put(" updatedAt", tbPrintMachine.getUpdatedAt());
|
||||||
|
map.put("分类", tbPrintMachine.getCategoryList());
|
||||||
|
map.put("排序", tbPrintMachine.getSort());
|
||||||
|
map.put("Android打印机需要标识设备ID ", tbPrintMachine.getVendorId());
|
||||||
|
map.put("Android打印机需要标识设备ID ", tbPrintMachine.getProductId());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package me.zhengjie.modules.shopInfo.shopPrint.service.mapstruct;
|
||||||
|
|
||||||
|
import me.zhengjie.base.BaseMapper;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.domain.TbPrintMachine;
|
||||||
|
import me.zhengjie.modules.shopInfo.shopPrint.service.dto.TbPrintMachineDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @author lyf
|
||||||
|
* @date 2024-02-28
|
||||||
|
**/
|
||||||
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
|
public interface TbPrintMachineMapper extends BaseMapper<TbPrintMachineDto, TbPrintMachine> {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue