From 4460a78b776cfb6254fac6c4688a1cd344fc2c10 Mon Sep 17 00:00:00 2001
From: Leon <3066758958@qq.com>
Date: Wed, 11 Aug 2021 16:51:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E7=BB=B4=E6=8A=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/controller/PrinterController.java | 93 +++++++++++++
.../mesnac/common/enums/HandleEnum.java | 2 +
.../mesnac/common}/mapper/PrinterMapper.java | 6 +-
.../mesnac/common}/model/Printer.java | 11 +-
.../common}/service/PrinterService.java | 6 +-
.../service/impl/PrinterServiceImpl.java | 10 +-
.../main/resources/mapper/PrinterMapper.xml | 34 ++---
integration/pom.xml | 4 +-
.../meapi/controller/PrinterController.java | 130 ------------------
9 files changed, 131 insertions(+), 165 deletions(-)
create mode 100644 common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java
rename {meapi/src/main/java/com/foreverwin/mesnac/meapi => common/src/main/java/com/foreverwin/mesnac/common}/mapper/PrinterMapper.java (67%)
rename {meapi/src/main/java/com/foreverwin/mesnac/meapi => common/src/main/java/com/foreverwin/mesnac/common}/model/Printer.java (91%)
rename {meapi/src/main/java/com/foreverwin/mesnac/meapi => common/src/main/java/com/foreverwin/mesnac/common}/service/PrinterService.java (81%)
rename {meapi/src/main/java/com/foreverwin/mesnac/meapi => common/src/main/java/com/foreverwin/mesnac/common}/service/impl/PrinterServiceImpl.java (83%)
rename {meapi => common}/src/main/resources/mapper/PrinterMapper.xml (94%)
delete mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/PrinterController.java
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java
new file mode 100644
index 00000000..17e6ee63
--- /dev/null
+++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java
@@ -0,0 +1,93 @@
+package com.foreverwin.mesnac.common.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.foreverwin.mesnac.common.enums.HandleEnum;
+import com.foreverwin.mesnac.common.model.Printer;
+import com.foreverwin.modular.core.util.CommonMethods;
+import com.foreverwin.modular.core.util.R;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import com.foreverwin.mesnac.common.service.PrinterService;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *
+ * @author Leon.L
+ * @since 2021-08-11
+ */
+@RestController
+@RequestMapping("/PRINTER")
+public class PrinterController {
+
+ @Autowired
+ public PrinterService printerService;
+
+ /**
+ * 查询所有数据
+ *
+ * @return
+ */
+ @ResponseBody
+ @GetMapping("")
+ public R getPrinterList(Printer printer){
+ List result;
+ try {
+ String site = CommonMethods.getSite();
+ printer.setSite(site);
+
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.setEntity(printer);
+ result = printerService.list(queryWrapper);
+ } catch (Exception e) {
+ return R.failed(e.getMessage());
+ }
+
+ return R.ok(result);
+ }
+
+ @ResponseBody
+ @GetMapping("/getPrinter")
+ public R savePrinter(String printer) {
+ Printer result = null;
+ try {
+ String site = CommonMethods.getSite();
+ String handle = HandleEnum.PRINT.getHandle(site, printer);
+ result = printerService.getById(handle);
+ } catch (Exception e) {
+ return R.failed(e.getMessage());
+ }
+
+ return R.ok(result);
+ }
+
+ @ResponseBody
+ @PostMapping("/savePrinter")
+ public R savePrinter(Printer printer) {
+ try {
+ LocalDateTime nowDate = LocalDateTime.now();
+ String site = CommonMethods.getSite();
+
+ String handle = HandleEnum.PRINT.getHandle(site, printer.getPrinter());
+ Printer printerModel = printerService.getById(handle);
+ if (printerModel == null) {
+ printer.setHandle(handle);
+ printer.setSite(site);
+ printer.setCreatedDateTime(nowDate);
+ printer.setModifiedDateTime(nowDate);
+ printerService.save(printer);
+ } else {
+ printerModel.setDescription(printer.getDescription());
+ printerModel.setModifiedDateTime(nowDate);
+ printerService.updateById(printerModel);
+ }
+ } catch (Exception e) {
+ return R.failed(e.getMessage());
+ }
+
+ return R.ok();
+ }
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java
index 7a72e34a..3e3b1ca7 100644
--- a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java
@@ -20,6 +20,8 @@ public enum HandleEnum {
/**物料清单**/
BOM("BOMBO:","BOMBO:{0},{1},{2},{3}"),
+ PRINT("PrintBO:", "StatusBO:{0},{1}"),
+
/**叫料**/
CALL_ITEM("CallItemBO:", "CallItemBO:{0},{1}"),
diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/PrinterMapper.java b/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrinterMapper.java
similarity index 67%
rename from meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/PrinterMapper.java
rename to common/src/main/java/com/foreverwin/mesnac/common/mapper/PrinterMapper.java
index da30ef1c..c5884313 100644
--- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/PrinterMapper.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/mapper/PrinterMapper.java
@@ -1,6 +1,6 @@
-package com.foreverwin.mesnac.meapi.mapper;
+package com.foreverwin.mesnac.common.mapper;
-import com.foreverwin.mesnac.meapi.model.Printer;
+import com.foreverwin.mesnac.common.model.Printer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository;
*
*
* @author Leon.L
- * @since 2021-07-22
+ * @since 2021-08-11
*/
@Repository
public interface PrinterMapper extends BaseMapper {
diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Printer.java b/common/src/main/java/com/foreverwin/mesnac/common/model/Printer.java
similarity index 91%
rename from meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Printer.java
rename to common/src/main/java/com/foreverwin/mesnac/common/model/Printer.java
index dde11f5f..3c07a59f 100644
--- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Printer.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/model/Printer.java
@@ -1,7 +1,8 @@
-package com.foreverwin.mesnac.meapi.model;
+package com.foreverwin.mesnac.common.model;
import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime;
@@ -15,15 +16,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
*
*
* @author Leon.L
- * @since 2021-07-22
+ * @since 2021-08-11
*/
-@TableName("PRINTER")
+@TableName("Z_PRINTER")
public class Printer extends Model {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- @TableField("HANDLE")
+ @TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
@TableField("SITE")
private String site;
diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/PrinterService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/PrinterService.java
similarity index 81%
rename from meapi/src/main/java/com/foreverwin/mesnac/meapi/service/PrinterService.java
rename to common/src/main/java/com/foreverwin/mesnac/common/service/PrinterService.java
index 0e63e6a4..50d35fbc 100644
--- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/PrinterService.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/service/PrinterService.java
@@ -1,7 +1,7 @@
-package com.foreverwin.mesnac.meapi.service;
+package com.foreverwin.mesnac.common.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.foreverwin.mesnac.meapi.model.Printer;
+import com.foreverwin.mesnac.common.model.Printer;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
@@ -13,7 +13,7 @@ import java.util.List;
*
*
* @author Leon.L
- * @since 2021-07-22
+ * @since 2021-08-11
*/
public interface PrinterService extends IService {
diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/PrinterServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrinterServiceImpl.java
similarity index 83%
rename from meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/PrinterServiceImpl.java
rename to common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrinterServiceImpl.java
index 3d461f85..c8ac3174 100644
--- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/PrinterServiceImpl.java
+++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrinterServiceImpl.java
@@ -1,11 +1,11 @@
-package com.foreverwin.mesnac.meapi.service.impl;
+package com.foreverwin.mesnac.common.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.foreverwin.mesnac.meapi.model.Printer;
-import com.foreverwin.mesnac.meapi.mapper.PrinterMapper;
-import com.foreverwin.mesnac.meapi.service.PrinterService;
+import com.foreverwin.mesnac.common.model.Printer;
+import com.foreverwin.mesnac.common.mapper.PrinterMapper;
+import com.foreverwin.mesnac.common.service.PrinterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,7 +18,7 @@ import java.util.List;
*
*
* @author Leon.L
- * @since 2021-07-22
+ * @since 2021-08-11
*/
@Service
@Transactional(rollbackFor = Exception.class)
diff --git a/meapi/src/main/resources/mapper/PrinterMapper.xml b/common/src/main/resources/mapper/PrinterMapper.xml
similarity index 94%
rename from meapi/src/main/resources/mapper/PrinterMapper.xml
rename to common/src/main/resources/mapper/PrinterMapper.xml
index 503ec683..08976fde 100644
--- a/meapi/src/main/resources/mapper/PrinterMapper.xml
+++ b/common/src/main/resources/mapper/PrinterMapper.xml
@@ -1,9 +1,9 @@
-
+
-
+
@@ -22,7 +22,7 @@