From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master
---
jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/CustomerController.java | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 166 insertions(+), 0 deletions(-)
diff --git a/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/CustomerController.java b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/CustomerController.java
new file mode 100644
index 0000000..de7b305
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/CustomerController.java
@@ -0,0 +1,166 @@
+package jnpf.controller;
+
+import io.seata.spring.annotation.GlobalTransactional;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jnpf.base.ActionResult;
+import jnpf.base.Pagination;
+import jnpf.base.controller.SuperController;
+import jnpf.base.vo.PageListVO;
+import jnpf.constant.MsgCode;
+import jnpf.entity.CustomerEntity;
+import jnpf.model.customer.CustomerCrForm;
+import jnpf.model.customer.CustomerInfoVO;
+import jnpf.model.customer.CustomerListVO;
+import jnpf.model.customer.CustomerUpForm;
+import jnpf.service.CustomerService;
+import jnpf.util.JsonUtil;
+import jnpf.util.RandomUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import jakarta.validation.Valid;
+import java.util.List;
+
+/**
+ * 瀹㈡埛淇℃伅
+ *
+ * @鐗堟湰锛� V3.1.0
+ * @鐗堟潈锛� 寮曡繄淇℃伅鎶�鏈湁闄愬叕鍙革紙https://www.jnpfsoft.com锛�
+ * @浣滆�咃細 JNPF寮�鍙戝钩鍙扮粍
+ * @鏃ユ湡锛� 2021-07-10 14:09:05
+ */
+@Slf4j
+@RestController
+@Tag(name = "瀹㈡埛淇℃伅", description = "Customer")
+@RequestMapping("/saleOrder/Customer")
+@RequiredArgsConstructor
+public class CustomerController extends SuperController<CustomerService, CustomerEntity> {
+
+ private final CustomerService customerService;
+
+ /**
+ * 鍒楄〃
+ *
+ * @param pagination 鍒嗛〉妯″瀷
+ * @return
+ */
+ @GetMapping
+ @Operation(summary = "鍒楄〃")
+ public ActionResult<PageListVO<CustomerListVO>> list(Pagination pagination) {
+ pagination.setPageSize(50);
+ pagination.setCurrentPage(1);
+ List<CustomerEntity> list = customerService.getList(pagination);
+ List<CustomerListVO> listVO = JsonUtil.getJsonToList(list, CustomerListVO.class);
+ PageListVO<CustomerListVO> vo = new PageListVO<>();
+ vo.setList(listVO);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鍒涘缓
+ *
+ * @param customerCrForm 鏂板缓妯″瀷
+ * @return
+ */
+ @PostMapping
+ @Operation(summary = "鍒涘缓")
+ @Parameter(name = "customerCrForm", description = "瀹㈡埛妯″瀷", required = true)
+ public ActionResult<Object> create(@RequestBody @Valid CustomerCrForm customerCrForm) {
+ CustomerEntity entity = JsonUtil.getJsonToBean(customerCrForm, CustomerEntity.class);
+ customerService.create(entity);
+ return ActionResult.success(MsgCode.SU001.get());
+ }
+
+ /**
+ * 淇℃伅
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @GetMapping("/{id}")
+ @Operation(summary = "淇℃伅")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<CustomerInfoVO> info(@PathVariable("id") String id) {
+ CustomerEntity entity = customerService.getInfo(id);
+ CustomerInfoVO vo = JsonUtil.getJsonToBean(entity, CustomerInfoVO.class);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鏇存柊
+ *
+ * @param id 涓婚敭
+ * @param customerUpForm 淇敼妯″瀷
+ * @return
+ */
+ @PutMapping("/{id}")
+ @Operation(summary = "鏇存柊")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @Parameter(name = "customerUpForm", description = "瀹㈡埛妯″瀷", required = true)
+ public ActionResult<Object> update(@PathVariable("id") String id, @RequestBody @Valid CustomerUpForm customerUpForm) {
+ CustomerEntity entity = JsonUtil.getJsonToBean(customerUpForm, CustomerEntity.class);
+ boolean ok = customerService.update(id, entity);
+ if (ok) {
+ return ActionResult.success(MsgCode.SU004.get());
+ }
+ return ActionResult.fail(MsgCode.FA002.get());
+ }
+
+ /**
+ * 鍒犻櫎
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @DeleteMapping("/{id}")
+ @Operation(summary = "鍒犻櫎")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ public ActionResult<Object> delete(@PathVariable("id") String id) {
+ CustomerEntity entity = customerService.getInfo(id);
+ if (entity != null) {
+ customerService.delete(entity);
+ }
+ return ActionResult.success(MsgCode.SU003.get());
+ }
+
+
+ /**
+ * 鍒涘缓
+ *
+ * @return
+ */
+ @GlobalTransactional
+ @Operation(summary = "鍒涘缓瀹㈡埛锛歋EATA璋冪敤绀轰緥鎴愬姛鎺ュ彛")
+ @PostMapping("/createSuccess")
+ public ActionResult<Object> createSuccess() {
+ CustomerCrForm customerCrForm1 = new CustomerCrForm();
+ customerCrForm1.setCustomerName(RandomUtil.uuId());
+ customerCrForm1.setCode(RandomUtil.uuId());
+ customerCrForm1.setName(RandomUtil.uuId());
+ customerCrForm1.setAddress(RandomUtil.uuId());
+ return create(customerCrForm1);
+ }
+
+
+ /**
+ * 鍒涘缓
+ *
+ * @return
+ */
+ @GlobalTransactional
+ @Operation(summary = "鍒涘缓瀹㈡埛锛歋EATA璋冪敤绀轰緥澶辫触鎺ュ彛")
+ @PostMapping("/createFail")
+ public ActionResult<Object> createFail() {
+ CustomerCrForm customerCrForm1 = new CustomerCrForm();
+ customerCrForm1.setCustomerName(RandomUtil.uuId());
+ customerCrForm1.setCode(RandomUtil.uuId());
+ customerCrForm1.setName(RandomUtil.uuId());
+ customerCrForm1.setAddress(RandomUtil.uuId());
+ return create(customerCrForm1);
+ }
+
+
+}
--
Gitblit v1.8.0