From 2251817e41185b1d8e9450253dcaaa463dfb30e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yinjinlu-pc=5C=E5=B0=B9=E9=87=91=E8=B7=AF?= <411641505@qq.com> Date: Thu, 13 Jun 2024 11:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-print/pom.xml | 37 + .../PrintPrinterConfigController.java | 106 + .../controller/PrintTemplateController.java | 105 + .../ktg/print/domain/PrintPrinterConfig.java | 276 ++ .../com/ktg/print/domain/PrintTemplate.java | 223 + .../mapper/PrintPrinterConfigMapper.java | 63 + .../ktg/print/mapper/PrintTemplateMapper.java | 61 + .../PrintClientInfoMessageHandler.java | 35 + .../PrintServerChannelInitializer.java | 30 + .../printserver/PrintServerCloseListener.java | 18 + .../PrintServerDefaultHandler.java | 70 + .../printserver/PrintServerOpenListener.java | 20 + .../ktg/print/printserver/PrinterServer.java | 67 + .../ktg/print/protocol/PrintMessageProto.java | 4082 +++++++++++++++++ .../print/protocol/proto/PrintMessage.proto | 36 + .../service/IPrintPrinterConfigService.java | 62 + .../print/service/IPrintTemplateService.java | 61 + .../impl/PrintPrinterConfigServiceImpl.java | 96 + .../impl/PrintTemplateServiceImpl.java | 96 + .../com/ktg/print/util/ContentConverter.java | 9 + .../mapper/print/PrintPrinterConfigMapper.xml | 151 + .../mapper/print/PrintTemplateMapper.xml | 135 + 22 files changed, 5839 insertions(+) create mode 100644 ktg-print/pom.xml create mode 100644 ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java create mode 100644 ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java create mode 100644 ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java create mode 100644 ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java create mode 100644 ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java create mode 100644 ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java create mode 100644 ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java create mode 100644 ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java create mode 100644 ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto create mode 100644 ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java create mode 100644 ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java create mode 100644 ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java create mode 100644 ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java create mode 100644 ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java create mode 100644 ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml create mode 100644 ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml diff --git a/ktg-print/pom.xml b/ktg-print/pom.xml new file mode 100644 index 0000000..5b4d998 --- /dev/null +++ b/ktg-print/pom.xml @@ -0,0 +1,37 @@ + + + + ktg + com.ktg + 3.8.2 + + 4.0.0 + + ktg-print + + + 8 + 8 + + + + + io.netty + netty-all + 4.1.65.Final + + + + com.google.protobuf + protobuf-java + 3.20.3 + + + + com.ktg + ktg-common + + + \ No newline at end of file diff --git a/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java b/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java new file mode 100644 index 0000000..96d87b9 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/controller/PrintPrinterConfigController.java @@ -0,0 +1,106 @@ +package com.ktg.print.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.print.domain.PrintPrinterConfig; +import com.ktg.print.service.IPrintPrinterConfigService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; + +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 打印机配置Controller + * + * @author yinjinlu + * @date 2023-09-01 + */ +@RestController +@RequestMapping("/print/printerconfig") +public class PrintPrinterConfigController extends BaseController +{ + @Autowired + private IPrintPrinterConfigService printPrinterConfigService; + + /** + * 查询打印机配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:list')") + @GetMapping("/list") + public TableDataInfo list(PrintPrinterConfig printPrinterConfig) + { + startPage(); + List list = printPrinterConfigService.selectPrintPrinterConfigList(printPrinterConfig); + return getDataTable(list); + } + + /** + * 导出打印机配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:export')") + @Log(title = "打印机配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PrintPrinterConfig printPrinterConfig) + { + List list = printPrinterConfigService.selectPrintPrinterConfigList(printPrinterConfig); + ExcelUtil util = new ExcelUtil(PrintPrinterConfig.class); + util.exportExcel(response, list, "打印机配置数据"); + } + + /** + * 获取打印机配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:query')") + @GetMapping(value = "/{printerId}") + public AjaxResult getInfo(@PathVariable("printerId") Long printerId) + { + return AjaxResult.success(printPrinterConfigService.selectPrintPrinterConfigByPrinterId(printerId)); + } + + /** + * 新增打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:add')") + @Log(title = "打印机配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PrintPrinterConfig printPrinterConfig) + { + return toAjax(printPrinterConfigService.insertPrintPrinterConfig(printPrinterConfig)); + } + + /** + * 修改打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:edit')") + @Log(title = "打印机配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PrintPrinterConfig printPrinterConfig) + { + return toAjax(printPrinterConfigService.updatePrintPrinterConfig(printPrinterConfig)); + } + + /** + * 删除打印机配置 + */ + @PreAuthorize("@ss.hasPermi('print:printerconfig:remove')") + @Log(title = "打印机配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{printerIds}") + public AjaxResult remove(@PathVariable Long[] printerIds) + { + return toAjax(printPrinterConfigService.deletePrintPrinterConfigByPrinterIds(printerIds)); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java b/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java new file mode 100644 index 0000000..02a0857 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/controller/PrintTemplateController.java @@ -0,0 +1,105 @@ +package com.ktg.print.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.print.domain.PrintTemplate; +import com.ktg.print.service.IPrintTemplateService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 打印模板配置Controller + * + * @author yinjinlu + * @date 2024-04-17 + */ +@RestController +@RequestMapping("/print/template") +public class PrintTemplateController extends BaseController +{ + @Autowired + private IPrintTemplateService printTemplateService; + + /** + * 查询打印模板配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:template:list')") + @GetMapping("/list") + public TableDataInfo list(PrintTemplate printTemplate) + { + startPage(); + List list = printTemplateService.selectPrintTemplateList(printTemplate); + return getDataTable(list); + } + + /** + * 导出打印模板配置列表 + */ + @PreAuthorize("@ss.hasPermi('print:template:export')") + @Log(title = "打印模板配置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PrintTemplate printTemplate) + { + List list = printTemplateService.selectPrintTemplateList(printTemplate); + ExcelUtil util = new ExcelUtil(PrintTemplate.class); + util.exportExcel(response, list, "打印模板配置数据"); + } + + /** + * 获取打印模板配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('print:template:query')") + @GetMapping(value = "/{templateId}") + public AjaxResult getInfo(@PathVariable("templateId") Long templateId) + { + return AjaxResult.success(printTemplateService.selectPrintTemplateByTemplateId(templateId)); + } + + /** + * 新增打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:add')") + @Log(title = "打印模板配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PrintTemplate printTemplate) + { + printTemplateService.insertPrintTemplate(printTemplate); + return AjaxResult.success(printTemplate); + } + + /** + * 修改打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:edit')") + @Log(title = "打印模板配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PrintTemplate printTemplate) + { + return toAjax(printTemplateService.updatePrintTemplate(printTemplate)); + } + + /** + * 删除打印模板配置 + */ + @PreAuthorize("@ss.hasPermi('print:template:remove')") + @Log(title = "打印模板配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{templateIds}") + public AjaxResult remove(@PathVariable Long[] templateIds) + { + return toAjax(printTemplateService.deletePrintTemplateByTemplateIds(templateIds)); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java b/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java new file mode 100644 index 0000000..5ff98e9 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/domain/PrintPrinterConfig.java @@ -0,0 +1,276 @@ +package com.ktg.print.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 打印机配置对象 print_printer_config + * + * @author yinjinlu + * @date 2023-09-01 + */ +public class PrintPrinterConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 打印机ID */ + private Long printerId; + + /** 打印机类型 */ + @Excel(name = "打印机类型") + private String printerType; + + /** 打印机名称 */ + @Excel(name = "打印机名称") + private String printerName; + + /** 品牌 */ + @Excel(name = "品牌") + private String brand; + + /** 型号 */ + @Excel(name = "型号") + private String printerModel; + + /** 连接类型 */ + @Excel(name = "连接类型") + private String connectionType; + + /** 图片URL */ + @Excel(name = "图片URL") + private String printerUrl; + + /** 打印机IP */ + @Excel(name = "打印机IP") + private String printerIp; + + /** 打印机端口 */ + @Excel(name = "打印机端口") + private Long printerPort; + + /** 打印客户端SID */ + @Excel(name = "打印客户端SID") + private String clientSid; + + /** 打印客户端IP */ + @Excel(name = "打印客户端IP") + private String clientIp; + + /** 打印客户端端口 */ + @Excel(name = "打印客户端端口") + private Long clientPort; + + /** 启用状态 */ + @Excel(name = "启用状态") + private String enableFlag; + + /** 打印机状态 */ + @Excel(name = "打印机状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setPrinterId(Long printerId) + { + this.printerId = printerId; + } + + public Long getPrinterId() + { + return printerId; + } + public void setPrinterType(String printerType) + { + this.printerType = printerType; + } + + public String getPrinterType() + { + return printerType; + } + public void setPrinterName(String printerName) + { + this.printerName = printerName; + } + + public String getPrinterName() + { + return printerName; + } + public void setBrand(String brand) + { + this.brand = brand; + } + + public String getBrand() + { + return brand; + } + public void setPrinterModel(String printerModel) + { + this.printerModel = printerModel; + } + + public String getPrinterModel() + { + return printerModel; + } + public void setConnectionType(String connectionType) + { + this.connectionType = connectionType; + } + + public String getConnectionType() + { + return connectionType; + } + public void setPrinterUrl(String printerUrl) + { + this.printerUrl = printerUrl; + } + + public String getPrinterUrl() + { + return printerUrl; + } + public void setPrinterIp(String printerIp) + { + this.printerIp = printerIp; + } + + public String getPrinterIp() + { + return printerIp; + } + public void setPrinterPort(Long printerPort) + { + this.printerPort = printerPort; + } + + public Long getPrinterPort() + { + return printerPort; + } + public void setClientSid(String clientSid) + { + this.clientSid = clientSid; + } + + public String getClientSid() + { + return clientSid; + } + public void setClientIp(String clientIp) + { + this.clientIp = clientIp; + } + + public String getClientIp() + { + return clientIp; + } + public void setClientPort(Long clientPort) + { + this.clientPort = clientPort; + } + + public Long getClientPort() + { + return clientPort; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("printerId", getPrinterId()) + .append("printerType", getPrinterType()) + .append("printerName", getPrinterName()) + .append("brand", getBrand()) + .append("printerModel", getPrinterModel()) + .append("connectionType", getConnectionType()) + .append("printerUrl", getPrinterUrl()) + .append("printerIp", getPrinterIp()) + .append("printerPort", getPrinterPort()) + .append("clientSid", getClientSid()) + .append("clientIp", getClientIp()) + .append("clientPort", getClientPort()) + .append("enableFlag", getEnableFlag()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java b/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java new file mode 100644 index 0000000..62d7569 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/domain/PrintTemplate.java @@ -0,0 +1,223 @@ +package com.ktg.print.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 打印模板配置对象 print_template + * + * @author yinjinlu + * @date 2024-04-17 + */ +public class PrintTemplate extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 模板ID */ + private Long templateId; + + /** 模板编号 */ + @Excel(name = "模板编号") + private String templateCode; + + /** 模板名称 */ + @Excel(name = "模板名称") + private String templateName; + + /** 模板类型 */ + @Excel(name = "模板类型") + private String templateType; + + /** 模板内容 */ + @Excel(name = "模板内容") + private String templateJson; + + private String paperType; + + private Integer templateWidth; + + private Integer templateHeight; + + /** 是否默认 */ + @Excel(name = "是否默认") + private String isDefault; + + /** 启用状态 */ + @Excel(name = "启用状态") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + /** $column.columnComment */ + @Excel(name = "启用状态") + private String templatePic; + + public void setTemplateId(Long templateId) + { + this.templateId = templateId; + } + + public Long getTemplateId() + { + return templateId; + } + public void setTemplateCode(String templateCode) + { + this.templateCode = templateCode; + } + + public String getTemplateCode() + { + return templateCode; + } + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + public void setTemplateType(String templateType) + { + this.templateType = templateType; + } + + public String getTemplateType() + { + return templateType; + } + public void setTemplateJson(String templateJson) + { + this.templateJson = templateJson; + } + + public String getTemplateJson() + { + return templateJson; + } + + public String getPaperType() { + return paperType; + } + + public void setPaperType(String paperType) { + this.paperType = paperType; + } + + public Integer getTemplateWidth() { + return templateWidth; + } + + public void setTemplateWidth(Integer templateWidth) { + this.templateWidth = templateWidth; + } + + public Integer getTemplateHeight() { + return templateHeight; + } + + public void setTemplateHeight(Integer templateHeight) { + this.templateHeight = templateHeight; + } + + public void setIsDefault(String isDefault) + { + this.isDefault = isDefault; + } + + public String getIsDefault() + { + return isDefault; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + public void setTemplatePic(String templatePic) + { + this.templatePic = templatePic; + } + + public String getTemplatePic() + { + return templatePic; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("templateId", getTemplateId()) + .append("templateCode", getTemplateCode()) + .append("templateName", getTemplateName()) + .append("templateType", getTemplateType()) + .append("templateJson", getTemplateJson()) + .append("isDefault", getIsDefault()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("templatePic", getTemplatePic()) + .toString(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java b/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java new file mode 100644 index 0000000..5ee8a11 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/mapper/PrintPrinterConfigMapper.java @@ -0,0 +1,63 @@ +package com.ktg.print.mapper; + +import com.ktg.print.domain.PrintPrinterConfig; + +import java.util.List; + + +/** + * 打印机配置Mapper接口 + * + * @author yinjinlu + * @date 2023-09-01 + */ +public interface PrintPrinterConfigMapper +{ + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId); + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置集合 + */ + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig); + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 删除打印机配置 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterId(Long printerId); + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds); +} diff --git a/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java b/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java new file mode 100644 index 0000000..0162670 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/mapper/PrintTemplateMapper.java @@ -0,0 +1,61 @@ +package com.ktg.print.mapper; + +import java.util.List; +import com.ktg.print.domain.PrintTemplate; + +/** + * 打印模板配置Mapper接口 + * + * @author yinjinlu + * @date 2024-04-17 + */ +public interface PrintTemplateMapper +{ + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId); + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置集合 + */ + public List selectPrintTemplateList(PrintTemplate printTemplate); + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int insertPrintTemplate(PrintTemplate printTemplate); + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int updatePrintTemplate(PrintTemplate printTemplate); + + /** + * 删除打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + public int deletePrintTemplateByTemplateId(Long templateId); + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePrintTemplateByTemplateIds(Long[] templateIds); +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java new file mode 100644 index 0000000..7cea204 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintClientInfoMessageHandler.java @@ -0,0 +1,35 @@ +package com.ktg.print.printserver; + +import com.ktg.print.protocol.PrintMessageProto; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.group.ChannelGroup; +import io.netty.channel.group.DefaultChannelGroup; +import io.netty.util.concurrent.GlobalEventExecutor; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +public class PrintClientInfoMessageHandler extends SimpleChannelInboundHandler { + + //接收到客户端发送的客户端信息后才会保存client信息 + private Map clients = new ConcurrentHashMap<>(); + private ChannelGroup group = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); + + @Override + protected void channelRead0(ChannelHandlerContext channelHandlerContext, PrintMessageProto.PrintClientInfoMessage clientInfoMessag) throws Exception { + if(!clients.containsKey(clientInfoMessag.getSid())){ + clients.put(clientInfoMessag.getSid(),channelHandlerContext.channel()); + } + channelHandlerContext.fireChannelRead(clientInfoMessag); + group.add(channelHandlerContext.channel()); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + group.remove(ctx.channel()); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java new file mode 100644 index 0000000..c5a9a3f --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerChannelInitializer.java @@ -0,0 +1,30 @@ +package com.ktg.print.printserver; + +import com.ktg.print.protocol.PrintMessageProto; +import io.netty.channel.Channel; +import io.netty.channel.ChannelInitializer; +import io.netty.handler.codec.protobuf.ProtobufDecoder; +import io.netty.handler.codec.protobuf.ProtobufEncoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class PrintServerChannelInitializer extends ChannelInitializer { + @Autowired + private PrintServerDefaultHandler serverDefaultHandler; + + @Autowired + private PrintClientInfoMessageHandler printClientInfoMessageHandler; + + @Override + protected void initChannel(Channel ch) throws Exception { + ch.pipeline().addLast(new ProtobufVarint32FrameDecoder()); + ch.pipeline().addLast(new ProtobufDecoder(PrintMessageProto.PrintClientInfoMessage.getDefaultInstance())); + ch.pipeline().addLast(new ProtobufEncoder()); + ch.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender()); + ch.pipeline().addLast(printClientInfoMessageHandler); + ch.pipeline().addLast(serverDefaultHandler); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java new file mode 100644 index 0000000..37290f6 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerCloseListener.java @@ -0,0 +1,18 @@ +package com.ktg.print.printserver; + +import org.springframework.beans.factory.DisposableBean; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +public class PrintServerCloseListener implements DisposableBean { + + @Resource + private PrinterServer printerServer; + + @Override + public void destroy() throws Exception { + printerServer.stop(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java new file mode 100644 index 0000000..398a556 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerDefaultHandler.java @@ -0,0 +1,70 @@ +package com.ktg.print.printserver; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.group.ChannelGroup; +import io.netty.channel.group.DefaultChannelGroup; +import io.netty.util.CharsetUtil; +import io.netty.util.concurrent.GlobalEventExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +@ChannelHandler.Sharable +public class PrintServerDefaultHandler extends ChannelInboundHandlerAdapter { + + private static final Logger logger = LoggerFactory.getLogger("PrinterServerHandler"); + + /** + * 客户端连接建立 + * @param ctx + * @throws Exception + */ + @Override + public void handlerAdded(ChannelHandlerContext ctx) throws Exception { + logger.info("打印机客户端已连接!"); + } + + /** + * 客户端连接移除 + * @param ctx + * @throws Exception + */ + @Override + public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + logger.info("打印机客户端已断开!"); + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg){ + try{ + ByteBuf data = (ByteBuf) msg; + logger.info("msg recived:"+data.toString(CharsetUtil.UTF_8)); + + String replyMessage = "Server reply: " + data.toString(CharsetUtil.UTF_8)+"\n"; + ByteBuf replyByteBuf = ctx.alloc().buffer(); + replyByteBuf.writeBytes(replyMessage.getBytes()); + ctx.writeAndFlush(replyByteBuf); + }catch (Exception e){ + logger.error(e.getMessage()); + } + } + + /** + * 异常发生,关闭通道,移除客户端 + * @param ctx + * @param cause + * @throws Exception + */ + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + ctx.channel().close(); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java new file mode 100644 index 0000000..14fbf04 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrintServerOpenListener.java @@ -0,0 +1,20 @@ +package com.ktg.print.printserver; + +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +public class PrintServerOpenListener implements ApplicationRunner { + + @Resource + private PrinterServer printerServer; + + @Override + public void run(ApplicationArguments args) throws Exception { + printerServer.start(); + } + +} diff --git a/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java b/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java new file mode 100644 index 0000000..0bc9786 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/printserver/PrinterServer.java @@ -0,0 +1,67 @@ +package com.ktg.print.printserver; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.protobuf.ProtobufDecoder; +import io.netty.handler.codec.protobuf.ProtobufEncoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 基于netty的socket服务器端,与标签打印机的客户端建立长连接,实现网络远程打印 + */ +@Component +public class PrinterServer { + + @Autowired + private PrintServerChannelInitializer printServerChannelInitializer; + + @Value("${netty.server.port}") + private int port; + + @Value("${netty.server.threadcount}") + private int bossThreadCount; + + private EventLoopGroup bossGroup; + private EventLoopGroup workerGroup; + private Channel serverChannel; + + PrinterServer(){ + bossGroup = new NioEventLoopGroup(); + workerGroup = new NioEventLoopGroup(); + } + + public void start(){ + try { + ServerBootstrap serverBootstrap = new ServerBootstrap(); + serverBootstrap.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .childHandler(printServerChannelInitializer); + ChannelFuture channelFuture = serverBootstrap.bind(port).sync(); + serverChannel = channelFuture.channel(); + serverChannel.closeFuture().sync(); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + bossGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } + } + + public void stop(){ + if(serverChannel !=null){ + serverChannel.close(); + serverChannel = null; + } + } + +} diff --git a/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java b/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java new file mode 100644 index 0000000..0ab6a3b --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/protocol/PrintMessageProto.java @@ -0,0 +1,4082 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: PrintMessage.proto + +package com.ktg.print.protocol; + +public final class PrintMessageProto { + private PrintMessageProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface IQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.IQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string batchCode = 4; + * @return The batchCode. + */ + String getBatchCode(); + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + com.google.protobuf.ByteString + getBatchCodeBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.IQCPrintMessage} + */ + public static final class IQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.IQCPrintMessage) + IQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use IQCPrintMessage.newBuilder() to construct. + private IQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private IQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + batchCode_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new IQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCHCODE_FIELD_NUMBER = 4; + private volatile Object batchCode_; + /** + * string batchCode = 4; + * @return The batchCode. + */ + @Override + public String getBatchCode() { + Object ref = batchCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + @Override + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, batchCode_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, batchCode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof IQCPrintMessage)) { + return super.equals(obj); + } + IQCPrintMessage other = (IQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getBatchCode() + .equals(other.getBatchCode())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + BATCHCODE_FIELD_NUMBER; + hash = (53 * hash) + getBatchCode().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static IQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static IQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static IQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static IQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static IQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static IQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(IQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.IQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.IQCPrintMessage) + IQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + IQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.IQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + batchCode_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + } + + @Override + public IQCPrintMessage getDefaultInstanceForType() { + return IQCPrintMessage.getDefaultInstance(); + } + + @Override + public IQCPrintMessage build() { + IQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public IQCPrintMessage buildPartial() { + IQCPrintMessage result = new IQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.batchCode_ = batchCode_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof IQCPrintMessage) { + return mergeFrom((IQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(IQCPrintMessage other) { + if (other == IQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getBatchCode().isEmpty()) { + batchCode_ = other.batchCode_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + batchCode_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object batchCode_ = ""; + /** + * string batchCode = 4; + * @return The batchCode. + */ + public String getBatchCode() { + Object ref = batchCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string batchCode = 4; + * @param value The batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + batchCode_ = value; + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @return This builder for chaining. + */ + public Builder clearBatchCode() { + + batchCode_ = getDefaultInstance().getBatchCode(); + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @param value The bytes for batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + batchCode_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.IQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.IQCPrintMessage) + private static final IQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new IQCPrintMessage(); + } + + public static IQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public IQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public IQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.PQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + String getSampleLocation(); + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + com.google.protobuf.ByteString + getSampleLocationBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.PQCPrintMessage} + */ + public static final class PQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.PQCPrintMessage) + PQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use PQCPrintMessage.newBuilder() to construct. + private PQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + sampleLocation_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new PQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLELOCATION_FIELD_NUMBER = 4; + private volatile Object sampleLocation_; + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + @Override + public String getSampleLocation() { + Object ref = sampleLocation_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleLocation_ = s; + return s; + } + } + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + @Override + public com.google.protobuf.ByteString + getSampleLocationBytes() { + Object ref = sampleLocation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleLocation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleLocation_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, sampleLocation_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleLocation_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, sampleLocation_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof PQCPrintMessage)) { + return super.equals(obj); + } + PQCPrintMessage other = (PQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getSampleLocation() + .equals(other.getSampleLocation())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + SAMPLELOCATION_FIELD_NUMBER; + hash = (53 * hash) + getSampleLocation().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static PQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static PQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static PQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(PQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.PQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.PQCPrintMessage) + PQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.PQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + sampleLocation_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + } + + @Override + public PQCPrintMessage getDefaultInstanceForType() { + return PQCPrintMessage.getDefaultInstance(); + } + + @Override + public PQCPrintMessage build() { + PQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public PQCPrintMessage buildPartial() { + PQCPrintMessage result = new PQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.sampleLocation_ = sampleLocation_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof PQCPrintMessage) { + return mergeFrom((PQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(PQCPrintMessage other) { + if (other == PQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getSampleLocation().isEmpty()) { + sampleLocation_ = other.sampleLocation_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + sampleLocation_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object sampleLocation_ = ""; + /** + * string sampleLocation = 4; + * @return The sampleLocation. + */ + public String getSampleLocation() { + Object ref = sampleLocation_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleLocation_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleLocation = 4; + * @return The bytes for sampleLocation. + */ + public com.google.protobuf.ByteString + getSampleLocationBytes() { + Object ref = sampleLocation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleLocation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleLocation = 4; + * @param value The sampleLocation to set. + * @return This builder for chaining. + */ + public Builder setSampleLocation( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleLocation_ = value; + onChanged(); + return this; + } + /** + * string sampleLocation = 4; + * @return This builder for chaining. + */ + public Builder clearSampleLocation() { + + sampleLocation_ = getDefaultInstance().getSampleLocation(); + onChanged(); + return this; + } + /** + * string sampleLocation = 4; + * @param value The bytes for sampleLocation to set. + * @return This builder for chaining. + */ + public Builder setSampleLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleLocation_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.PQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.PQCPrintMessage) + private static final PQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new PQCPrintMessage(); + } + + public static PQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public PQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public PQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface OQCPrintMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.OQCPrintMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + String getSampleCode(); + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + com.google.protobuf.ByteString + getSampleCodeBytes(); + + /** + * string qcObject = 2; + * @return The qcObject. + */ + String getQcObject(); + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + com.google.protobuf.ByteString + getQcObjectBytes(); + + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + String getSampleTime(); + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + com.google.protobuf.ByteString + getSampleTimeBytes(); + + /** + * string batchCode = 4; + * @return The batchCode. + */ + String getBatchCode(); + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + com.google.protobuf.ByteString + getBatchCodeBytes(); + + /** + * string packageType = 5; + * @return The packageType. + */ + String getPackageType(); + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + com.google.protobuf.ByteString + getPackageTypeBytes(); + } + /** + * Protobuf type {@code com.ktg.print.protocol.OQCPrintMessage} + */ + public static final class OQCPrintMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.OQCPrintMessage) + OQCPrintMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use OQCPrintMessage.newBuilder() to construct. + private OQCPrintMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private OQCPrintMessage() { + sampleCode_ = ""; + qcObject_ = ""; + sampleTime_ = ""; + batchCode_ = ""; + packageType_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new OQCPrintMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + OQCPrintMessage.class, Builder.class); + } + + public static final int SAMPLECODE_FIELD_NUMBER = 1; + private volatile Object sampleCode_; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + @Override + public String getSampleCode() { + Object ref = sampleCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + @Override + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QCOBJECT_FIELD_NUMBER = 2; + private volatile Object qcObject_; + /** + * string qcObject = 2; + * @return The qcObject. + */ + @Override + public String getQcObject() { + Object ref = qcObject_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + @Override + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SAMPLETIME_FIELD_NUMBER = 3; + private volatile Object sampleTime_; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + @Override + public String getSampleTime() { + Object ref = sampleTime_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + @Override + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCHCODE_FIELD_NUMBER = 4; + private volatile Object batchCode_; + /** + * string batchCode = 4; + * @return The batchCode. + */ + @Override + public String getBatchCode() { + Object ref = batchCode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + @Override + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PACKAGETYPE_FIELD_NUMBER = 5; + private volatile Object packageType_; + /** + * string packageType = 5; + * @return The packageType. + */ + @Override + public String getPackageType() { + Object ref = packageType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + packageType_ = s; + return s; + } + } + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + @Override + public com.google.protobuf.ByteString + getPackageTypeBytes() { + Object ref = packageType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + packageType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, batchCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageType_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, packageType_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sampleCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(qcObject_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, qcObject_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sampleTime_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sampleTime_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(batchCode_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, batchCode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageType_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, packageType_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof OQCPrintMessage)) { + return super.equals(obj); + } + OQCPrintMessage other = (OQCPrintMessage) obj; + + if (!getSampleCode() + .equals(other.getSampleCode())) return false; + if (!getQcObject() + .equals(other.getQcObject())) return false; + if (!getSampleTime() + .equals(other.getSampleTime())) return false; + if (!getBatchCode() + .equals(other.getBatchCode())) return false; + if (!getPackageType() + .equals(other.getPackageType())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SAMPLECODE_FIELD_NUMBER; + hash = (53 * hash) + getSampleCode().hashCode(); + hash = (37 * hash) + QCOBJECT_FIELD_NUMBER; + hash = (53 * hash) + getQcObject().hashCode(); + hash = (37 * hash) + SAMPLETIME_FIELD_NUMBER; + hash = (53 * hash) + getSampleTime().hashCode(); + hash = (37 * hash) + BATCHCODE_FIELD_NUMBER; + hash = (53 * hash) + getBatchCode().hashCode(); + hash = (37 * hash) + PACKAGETYPE_FIELD_NUMBER; + hash = (53 * hash) + getPackageType().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static OQCPrintMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static OQCPrintMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static OQCPrintMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static OQCPrintMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static OQCPrintMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static OQCPrintMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static OQCPrintMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(OQCPrintMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.ktg.print.protocol.OQCPrintMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.OQCPrintMessage) + OQCPrintMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + OQCPrintMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.OQCPrintMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + sampleCode_ = ""; + + qcObject_ = ""; + + sampleTime_ = ""; + + batchCode_ = ""; + + packageType_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + } + + @Override + public OQCPrintMessage getDefaultInstanceForType() { + return OQCPrintMessage.getDefaultInstance(); + } + + @Override + public OQCPrintMessage build() { + OQCPrintMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public OQCPrintMessage buildPartial() { + OQCPrintMessage result = new OQCPrintMessage(this); + result.sampleCode_ = sampleCode_; + result.qcObject_ = qcObject_; + result.sampleTime_ = sampleTime_; + result.batchCode_ = batchCode_; + result.packageType_ = packageType_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof OQCPrintMessage) { + return mergeFrom((OQCPrintMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(OQCPrintMessage other) { + if (other == OQCPrintMessage.getDefaultInstance()) return this; + if (!other.getSampleCode().isEmpty()) { + sampleCode_ = other.sampleCode_; + onChanged(); + } + if (!other.getQcObject().isEmpty()) { + qcObject_ = other.qcObject_; + onChanged(); + } + if (!other.getSampleTime().isEmpty()) { + sampleTime_ = other.sampleTime_; + onChanged(); + } + if (!other.getBatchCode().isEmpty()) { + batchCode_ = other.batchCode_; + onChanged(); + } + if (!other.getPackageType().isEmpty()) { + packageType_ = other.packageType_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + sampleCode_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + qcObject_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sampleTime_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: { + batchCode_ = input.readStringRequireUtf8(); + + break; + } // case 34 + case 42: { + packageType_ = input.readStringRequireUtf8(); + + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object sampleCode_ = ""; + /** + * string sampleCode = 1; + * @return The sampleCode. + */ + public String getSampleCode() { + Object ref = sampleCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleCode = 1; + * @return The bytes for sampleCode. + */ + public com.google.protobuf.ByteString + getSampleCodeBytes() { + Object ref = sampleCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleCode = 1; + * @param value The sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleCode_ = value; + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @return This builder for chaining. + */ + public Builder clearSampleCode() { + + sampleCode_ = getDefaultInstance().getSampleCode(); + onChanged(); + return this; + } + /** + * string sampleCode = 1; + * @param value The bytes for sampleCode to set. + * @return This builder for chaining. + */ + public Builder setSampleCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleCode_ = value; + onChanged(); + return this; + } + + private Object qcObject_ = ""; + /** + * string qcObject = 2; + * @return The qcObject. + */ + public String getQcObject() { + Object ref = qcObject_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + qcObject_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string qcObject = 2; + * @return The bytes for qcObject. + */ + public com.google.protobuf.ByteString + getQcObjectBytes() { + Object ref = qcObject_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + qcObject_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string qcObject = 2; + * @param value The qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObject( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + qcObject_ = value; + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @return This builder for chaining. + */ + public Builder clearQcObject() { + + qcObject_ = getDefaultInstance().getQcObject(); + onChanged(); + return this; + } + /** + * string qcObject = 2; + * @param value The bytes for qcObject to set. + * @return This builder for chaining. + */ + public Builder setQcObjectBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + qcObject_ = value; + onChanged(); + return this; + } + + private Object sampleTime_ = ""; + /** + * string sampleTime = 3; + * @return The sampleTime. + */ + public String getSampleTime() { + Object ref = sampleTime_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sampleTime_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sampleTime = 3; + * @return The bytes for sampleTime. + */ + public com.google.protobuf.ByteString + getSampleTimeBytes() { + Object ref = sampleTime_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sampleTime_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sampleTime = 3; + * @param value The sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTime( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sampleTime_ = value; + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @return This builder for chaining. + */ + public Builder clearSampleTime() { + + sampleTime_ = getDefaultInstance().getSampleTime(); + onChanged(); + return this; + } + /** + * string sampleTime = 3; + * @param value The bytes for sampleTime to set. + * @return This builder for chaining. + */ + public Builder setSampleTimeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sampleTime_ = value; + onChanged(); + return this; + } + + private Object batchCode_ = ""; + /** + * string batchCode = 4; + * @return The batchCode. + */ + public String getBatchCode() { + Object ref = batchCode_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + batchCode_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string batchCode = 4; + * @return The bytes for batchCode. + */ + public com.google.protobuf.ByteString + getBatchCodeBytes() { + Object ref = batchCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + batchCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string batchCode = 4; + * @param value The batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCode( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + batchCode_ = value; + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @return This builder for chaining. + */ + public Builder clearBatchCode() { + + batchCode_ = getDefaultInstance().getBatchCode(); + onChanged(); + return this; + } + /** + * string batchCode = 4; + * @param value The bytes for batchCode to set. + * @return This builder for chaining. + */ + public Builder setBatchCodeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + batchCode_ = value; + onChanged(); + return this; + } + + private Object packageType_ = ""; + /** + * string packageType = 5; + * @return The packageType. + */ + public String getPackageType() { + Object ref = packageType_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + packageType_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string packageType = 5; + * @return The bytes for packageType. + */ + public com.google.protobuf.ByteString + getPackageTypeBytes() { + Object ref = packageType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + packageType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string packageType = 5; + * @param value The packageType to set. + * @return This builder for chaining. + */ + public Builder setPackageType( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + packageType_ = value; + onChanged(); + return this; + } + /** + * string packageType = 5; + * @return This builder for chaining. + */ + public Builder clearPackageType() { + + packageType_ = getDefaultInstance().getPackageType(); + onChanged(); + return this; + } + /** + * string packageType = 5; + * @param value The bytes for packageType to set. + * @return This builder for chaining. + */ + public Builder setPackageTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + packageType_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.OQCPrintMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.OQCPrintMessage) + private static final OQCPrintMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new OQCPrintMessage(); + } + + public static OQCPrintMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public OQCPrintMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public OQCPrintMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PrintClientInfoMessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.ktg.print.protocol.PrintClientInfoMessage) + com.google.protobuf.MessageOrBuilder { + + /** + * string ip = 1; + * @return The ip. + */ + String getIp(); + /** + * string ip = 1; + * @return The bytes for ip. + */ + com.google.protobuf.ByteString + getIpBytes(); + + /** + * string location = 2; + * @return The location. + */ + String getLocation(); + /** + * string location = 2; + * @return The bytes for location. + */ + com.google.protobuf.ByteString + getLocationBytes(); + + /** + * string sid = 3; + * @return The sid. + */ + String getSid(); + /** + * string sid = 3; + * @return The bytes for sid. + */ + com.google.protobuf.ByteString + getSidBytes(); + } + /** + *
+   *客户端信息
+   * 
+ * + * Protobuf type {@code com.ktg.print.protocol.PrintClientInfoMessage} + */ + public static final class PrintClientInfoMessage extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.ktg.print.protocol.PrintClientInfoMessage) + PrintClientInfoMessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use PrintClientInfoMessage.newBuilder() to construct. + private PrintClientInfoMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PrintClientInfoMessage() { + ip_ = ""; + location_ = ""; + sid_ = ""; + } + + @Override + @SuppressWarnings({"unused"}) + protected Object newInstance( + UnusedPrivateParameter unused) { + return new PrintClientInfoMessage(); + } + + @Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PrintClientInfoMessage.class, Builder.class); + } + + public static final int IP_FIELD_NUMBER = 1; + private volatile Object ip_; + /** + * string ip = 1; + * @return The ip. + */ + @Override + public String getIp() { + Object ref = ip_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + ip_ = s; + return s; + } + } + /** + * string ip = 1; + * @return The bytes for ip. + */ + @Override + public com.google.protobuf.ByteString + getIpBytes() { + Object ref = ip_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + ip_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOCATION_FIELD_NUMBER = 2; + private volatile Object location_; + /** + * string location = 2; + * @return The location. + */ + @Override + public String getLocation() { + Object ref = location_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * string location = 2; + * @return The bytes for location. + */ + @Override + public com.google.protobuf.ByteString + getLocationBytes() { + Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SID_FIELD_NUMBER = 3; + private volatile Object sid_; + /** + * string sid = 3; + * @return The sid. + */ + @Override + public String getSid() { + Object ref = sid_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sid_ = s; + return s; + } + } + /** + * string sid = 3; + * @return The bytes for sid. + */ + @Override + public com.google.protobuf.ByteString + getSidBytes() { + Object ref = sid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ip_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ip_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, location_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sid_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ip_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, ip_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, location_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sid_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof PrintClientInfoMessage)) { + return super.equals(obj); + } + PrintClientInfoMessage other = (PrintClientInfoMessage) obj; + + if (!getIp() + .equals(other.getIp())) return false; + if (!getLocation() + .equals(other.getLocation())) return false; + if (!getSid() + .equals(other.getSid())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + IP_FIELD_NUMBER; + hash = (53 * hash) + getIp().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (37 * hash) + SID_FIELD_NUMBER; + hash = (53 * hash) + getSid().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static PrintClientInfoMessage parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static PrintClientInfoMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static PrintClientInfoMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static PrintClientInfoMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(PrintClientInfoMessage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     *客户端信息
+     * 
+ * + * Protobuf type {@code com.ktg.print.protocol.PrintClientInfoMessage} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.ktg.print.protocol.PrintClientInfoMessage) + PrintClientInfoMessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + PrintClientInfoMessage.class, Builder.class); + } + + // Construct using com.ktg.print.protocol.PrintMessageProto.PrintClientInfoMessage.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + ip_ = ""; + + location_ = ""; + + sid_ = ""; + + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return PrintMessageProto.internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + } + + @Override + public PrintClientInfoMessage getDefaultInstanceForType() { + return PrintClientInfoMessage.getDefaultInstance(); + } + + @Override + public PrintClientInfoMessage build() { + PrintClientInfoMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public PrintClientInfoMessage buildPartial() { + PrintClientInfoMessage result = new PrintClientInfoMessage(this); + result.ip_ = ip_; + result.location_ = location_; + result.sid_ = sid_; + onBuilt(); + return result; + } + + @Override + public Builder clone() { + return super.clone(); + } + @Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.setField(field, value); + } + @Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, Object value) { + return super.setRepeatedField(field, index, value); + } + @Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + Object value) { + return super.addRepeatedField(field, value); + } + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof PrintClientInfoMessage) { + return mergeFrom((PrintClientInfoMessage)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(PrintClientInfoMessage other) { + if (other == PrintClientInfoMessage.getDefaultInstance()) return this; + if (!other.getIp().isEmpty()) { + ip_ = other.ip_; + onChanged(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + onChanged(); + } + if (!other.getSid().isEmpty()) { + sid_ = other.sid_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + ip_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: { + location_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: { + sid_ = input.readStringRequireUtf8(); + + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private Object ip_ = ""; + /** + * string ip = 1; + * @return The ip. + */ + public String getIp() { + Object ref = ip_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + ip_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string ip = 1; + * @return The bytes for ip. + */ + public com.google.protobuf.ByteString + getIpBytes() { + Object ref = ip_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + ip_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string ip = 1; + * @param value The ip to set. + * @return This builder for chaining. + */ + public Builder setIp( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + ip_ = value; + onChanged(); + return this; + } + /** + * string ip = 1; + * @return This builder for chaining. + */ + public Builder clearIp() { + + ip_ = getDefaultInstance().getIp(); + onChanged(); + return this; + } + /** + * string ip = 1; + * @param value The bytes for ip to set. + * @return This builder for chaining. + */ + public Builder setIpBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + ip_ = value; + onChanged(); + return this; + } + + private Object location_ = ""; + /** + * string location = 2; + * @return The location. + */ + public String getLocation() { + Object ref = location_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string location = 2; + * @return The bytes for location. + */ + public com.google.protobuf.ByteString + getLocationBytes() { + Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string location = 2; + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + location_ = value; + onChanged(); + return this; + } + /** + * string location = 2; + * @return This builder for chaining. + */ + public Builder clearLocation() { + + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + /** + * string location = 2; + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + location_ = value; + onChanged(); + return this; + } + + private Object sid_ = ""; + /** + * string sid = 3; + * @return The sid. + */ + public String getSid() { + Object ref = sid_; + if (!(ref instanceof String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + sid_ = s; + return s; + } else { + return (String) ref; + } + } + /** + * string sid = 3; + * @return The bytes for sid. + */ + public com.google.protobuf.ByteString + getSidBytes() { + Object ref = sid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (String) ref); + sid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string sid = 3; + * @param value The sid to set. + * @return This builder for chaining. + */ + public Builder setSid( + String value) { + if (value == null) { + throw new NullPointerException(); + } + + sid_ = value; + onChanged(); + return this; + } + /** + * string sid = 3; + * @return This builder for chaining. + */ + public Builder clearSid() { + + sid_ = getDefaultInstance().getSid(); + onChanged(); + return this; + } + /** + * string sid = 3; + * @param value The bytes for sid to set. + * @return This builder for chaining. + */ + public Builder setSidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sid_ = value; + onChanged(); + return this; + } + @Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.ktg.print.protocol.PrintClientInfoMessage) + } + + // @@protoc_insertion_point(class_scope:com.ktg.print.protocol.PrintClientInfoMessage) + private static final PrintClientInfoMessage DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new PrintClientInfoMessage(); + } + + public static PrintClientInfoMessage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public PrintClientInfoMessage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public PrintClientInfoMessage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + String[] descriptorData = { + "\n\022PrintMessage.proto\022\026com.ktg.print.prot" + + "ocol\"^\n\017IQCPrintMessage\022\022\n\nsampleCode\030\001 " + + "\001(\t\022\020\n\010qcObject\030\002 \001(\t\022\022\n\nsampleTime\030\003 \001(" + + "\t\022\021\n\tbatchCode\030\004 \001(\t\"c\n\017PQCPrintMessage\022" + + "\022\n\nsampleCode\030\001 \001(\t\022\020\n\010qcObject\030\002 \001(\t\022\022\n" + + "\nsampleTime\030\003 \001(\t\022\026\n\016sampleLocation\030\004 \001(" + + "\t\"s\n\017OQCPrintMessage\022\022\n\nsampleCode\030\001 \001(\t" + + "\022\020\n\010qcObject\030\002 \001(\t\022\022\n\nsampleTime\030\003 \001(\t\022\021" + + "\n\tbatchCode\030\004 \001(\t\022\023\n\013packageType\030\005 \001(\t\"C" + + "\n\026PrintClientInfoMessage\022\n\n\002ip\030\001 \001(\t\022\020\n\010" + + "location\030\002 \001(\t\022\013\n\003sid\030\003 \001(\tB+\n\026com.ktg.p" + + "rint.protocolB\021PrintMessageProtob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_ktg_print_protocol_IQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_IQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "BatchCode", }); + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_ktg_print_protocol_PQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_PQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "SampleLocation", }); + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_ktg_print_protocol_OQCPrintMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_OQCPrintMessage_descriptor, + new String[] { "SampleCode", "QcObject", "SampleTime", "BatchCode", "PackageType", }); + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_ktg_print_protocol_PrintClientInfoMessage_descriptor, + new String[] { "Ip", "Location", "Sid", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto b/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto new file mode 100644 index 0000000..41895da --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/protocol/proto/PrintMessage.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package com.ktg.print.protocol; + +option java_package = "com.ktg.print.protocol"; + +option java_outer_classname = "PrintMessageProto"; + +message IQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string batchCode = 4; +} + +message PQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string sampleLocation = 4; +} + +message OQCPrintMessage { + string sampleCode = 1; + string qcObject = 2; + string sampleTime = 3; + string batchCode = 4; + string packageType = 5; +} + +//客户端信息 +message PrintClientInfoMessage { + string ip = 1; + string location = 2; + string sid = 3; +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java b/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java new file mode 100644 index 0000000..5eb9694 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/IPrintPrinterConfigService.java @@ -0,0 +1,62 @@ +package com.ktg.print.service; + +import com.ktg.print.domain.PrintPrinterConfig; + +import java.util.List; + +/** + * 打印机配置Service接口 + * + * @author yinjinlu + * @date 2023-09-01 + */ +public interface IPrintPrinterConfigService +{ + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId); + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置集合 + */ + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig); + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig); + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的打印机配置主键集合 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds); + + /** + * 删除打印机配置信息 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + public int deletePrintPrinterConfigByPrinterId(Long printerId); +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java b/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java new file mode 100644 index 0000000..f82fc76 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/IPrintTemplateService.java @@ -0,0 +1,61 @@ +package com.ktg.print.service; + +import java.util.List; +import com.ktg.print.domain.PrintTemplate; + +/** + * 打印模板配置Service接口 + * + * @author yinjinlu + * @date 2024-04-17 + */ +public interface IPrintTemplateService +{ + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId); + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置集合 + */ + public List selectPrintTemplateList(PrintTemplate printTemplate); + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int insertPrintTemplate(PrintTemplate printTemplate); + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + public int updatePrintTemplate(PrintTemplate printTemplate); + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的打印模板配置主键集合 + * @return 结果 + */ + public int deletePrintTemplateByTemplateIds(Long[] templateIds); + + /** + * 删除打印模板配置信息 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + public int deletePrintTemplateByTemplateId(Long templateId); +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java new file mode 100644 index 0000000..f2ce98f --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintPrinterConfigServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.print.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import com.ktg.print.domain.PrintPrinterConfig; +import com.ktg.print.mapper.PrintPrinterConfigMapper; +import com.ktg.print.service.IPrintPrinterConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 打印机配置Service业务层处理 + * + * @author yinjinlu + * @date 2023-09-01 + */ +@Service +public class PrintPrinterConfigServiceImpl implements IPrintPrinterConfigService +{ + @Autowired + private PrintPrinterConfigMapper printPrinterConfigMapper; + + /** + * 查询打印机配置 + * + * @param printerId 打印机配置主键 + * @return 打印机配置 + */ + @Override + public PrintPrinterConfig selectPrintPrinterConfigByPrinterId(Long printerId) + { + return printPrinterConfigMapper.selectPrintPrinterConfigByPrinterId(printerId); + } + + /** + * 查询打印机配置列表 + * + * @param printPrinterConfig 打印机配置 + * @return 打印机配置 + */ + @Override + public List selectPrintPrinterConfigList(PrintPrinterConfig printPrinterConfig) + { + return printPrinterConfigMapper.selectPrintPrinterConfigList(printPrinterConfig); + } + + /** + * 新增打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + @Override + public int insertPrintPrinterConfig(PrintPrinterConfig printPrinterConfig) + { + printPrinterConfig.setCreateTime(DateUtils.getNowDate()); + return printPrinterConfigMapper.insertPrintPrinterConfig(printPrinterConfig); + } + + /** + * 修改打印机配置 + * + * @param printPrinterConfig 打印机配置 + * @return 结果 + */ + @Override + public int updatePrintPrinterConfig(PrintPrinterConfig printPrinterConfig) + { + printPrinterConfig.setUpdateTime(DateUtils.getNowDate()); + return printPrinterConfigMapper.updatePrintPrinterConfig(printPrinterConfig); + } + + /** + * 批量删除打印机配置 + * + * @param printerIds 需要删除的打印机配置主键 + * @return 结果 + */ + @Override + public int deletePrintPrinterConfigByPrinterIds(Long[] printerIds) + { + return printPrinterConfigMapper.deletePrintPrinterConfigByPrinterIds(printerIds); + } + + /** + * 删除打印机配置信息 + * + * @param printerId 打印机配置主键 + * @return 结果 + */ + @Override + public int deletePrintPrinterConfigByPrinterId(Long printerId) + { + return printPrinterConfigMapper.deletePrintPrinterConfigByPrinterId(printerId); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java new file mode 100644 index 0000000..d1f52f6 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/service/impl/PrintTemplateServiceImpl.java @@ -0,0 +1,96 @@ +package com.ktg.print.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.print.mapper.PrintTemplateMapper; +import com.ktg.print.domain.PrintTemplate; +import com.ktg.print.service.IPrintTemplateService; + +/** + * 打印模板配置Service业务层处理 + * + * @author yinjinlu + * @date 2024-04-17 + */ +@Service +public class PrintTemplateServiceImpl implements IPrintTemplateService +{ + @Autowired + private PrintTemplateMapper printTemplateMapper; + + /** + * 查询打印模板配置 + * + * @param templateId 打印模板配置主键 + * @return 打印模板配置 + */ + @Override + public PrintTemplate selectPrintTemplateByTemplateId(Long templateId) + { + return printTemplateMapper.selectPrintTemplateByTemplateId(templateId); + } + + /** + * 查询打印模板配置列表 + * + * @param printTemplate 打印模板配置 + * @return 打印模板配置 + */ + @Override + public List selectPrintTemplateList(PrintTemplate printTemplate) + { + return printTemplateMapper.selectPrintTemplateList(printTemplate); + } + + /** + * 新增打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + @Override + public int insertPrintTemplate(PrintTemplate printTemplate) + { + printTemplate.setCreateTime(DateUtils.getNowDate()); + return printTemplateMapper.insertPrintTemplate(printTemplate); + } + + /** + * 修改打印模板配置 + * + * @param printTemplate 打印模板配置 + * @return 结果 + */ + @Override + public int updatePrintTemplate(PrintTemplate printTemplate) + { + printTemplate.setUpdateTime(DateUtils.getNowDate()); + return printTemplateMapper.updatePrintTemplate(printTemplate); + } + + /** + * 批量删除打印模板配置 + * + * @param templateIds 需要删除的打印模板配置主键 + * @return 结果 + */ + @Override + public int deletePrintTemplateByTemplateIds(Long[] templateIds) + { + return printTemplateMapper.deletePrintTemplateByTemplateIds(templateIds); + } + + /** + * 删除打印模板配置信息 + * + * @param templateId 打印模板配置主键 + * @return 结果 + */ + @Override + public int deletePrintTemplateByTemplateId(Long templateId) + { + return printTemplateMapper.deletePrintTemplateByTemplateId(templateId); + } +} diff --git a/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java b/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java new file mode 100644 index 0000000..a3c6488 --- /dev/null +++ b/ktg-print/src/main/java/com/ktg/print/util/ContentConverter.java @@ -0,0 +1,9 @@ +package com.ktg.print.util; + +/** + * 负责将模板内容转换为具体的标签打印机协议 + */ +public class ContentConverter { + + +} diff --git a/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml b/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml new file mode 100644 index 0000000..903756e --- /dev/null +++ b/ktg-print/src/main/resources/mapper/print/PrintPrinterConfigMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select printer_id, printer_type, printer_name, brand, printer_model, connection_type, printer_url, printer_ip, printer_port, client_sid, client_ip, client_port, enable_flag, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from print_printer_config + + + + + + + + insert into print_printer_config + + printer_type, + printer_name, + brand, + printer_model, + connection_type, + printer_url, + printer_ip, + printer_port, + client_sid, + client_ip, + client_port, + enable_flag, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{printerType}, + #{printerName}, + #{brand}, + #{printerModel}, + #{connectionType}, + #{printerUrl}, + #{printerIp}, + #{printerPort}, + #{clientSid}, + #{clientIp}, + #{clientPort}, + #{enableFlag}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update print_printer_config + + printer_type = #{printerType}, + printer_name = #{printerName}, + brand = #{brand}, + printer_model = #{printerModel}, + connection_type = #{connectionType}, + printer_url = #{printerUrl}, + printer_ip = #{printerIp}, + printer_port = #{printerPort}, + client_sid = #{clientSid}, + client_ip = #{clientIp}, + client_port = #{clientPort}, + enable_flag = #{enableFlag}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where printer_id = #{printerId} + + + + delete from print_printer_config where printer_id = #{printerId} + + + + delete from print_printer_config where printer_id in + + #{printerId} + + + \ No newline at end of file diff --git a/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml b/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml new file mode 100644 index 0000000..31f2fb6 --- /dev/null +++ b/ktg-print/src/main/resources/mapper/print/PrintTemplateMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select template_id, template_code, template_name, template_type, template_json, paper_type, template_width, template_height, is_default, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, template_pic from print_template + + + + + + + + insert into print_template + + template_code, + template_name, + template_type, + template_json, + paper_type, + template_width, + template_height, + is_default, + enable_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + template_pic, + + + #{templateCode}, + #{templateName}, + #{templateType}, + #{templateJson}, + #{paperType}, + #{templateWidth}, + #{templateHeight}, + #{isDefault}, + #{enableFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{templatePic}, + + + + + update print_template + + template_code = #{templateCode}, + template_name = #{templateName}, + template_type = #{templateType}, + template_json = #{templateJson}, + paper_type = #{paperType}, + template_width = #{templateWidth}, + template_height = #{templateHeight}, + is_default = #{isDefault}, + enable_flag = #{enableFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + template_pic = #{templatePic}, + + where template_id = #{templateId} + + + + delete from print_template where template_id = #{templateId} + + + + delete from print_template where template_id in + + #{templateId} + + + \ No newline at end of file