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-biz/src/main/java/jnpf/service/impl/ProductServiceImpl.java |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/service/impl/ProductServiceImpl.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/service/impl/ProductServiceImpl.java
new file mode 100644
index 0000000..0e06edd
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/service/impl/ProductServiceImpl.java
@@ -0,0 +1,111 @@
+package jnpf.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import jnpf.base.BillRuleApi;
+import jnpf.base.UserInfo;
+import jnpf.base.service.SuperServiceImpl;
+import jnpf.entity.ProductEntity;
+import jnpf.entity.ProductEntryEntity;
+import jnpf.exception.DataException;
+import jnpf.mapper.ProductEntryMapper;
+import jnpf.mapper.ProductMapper;
+import jnpf.model.product.ProductPagination;
+import jnpf.service.ProductService;
+import jnpf.util.RandomUtil;
+import jnpf.util.UserProvider;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 閿�鍞鍗�
+ * 鐗堟湰锛� V3.1.0
+ * 鐗堟潈锛� 寮曡繄淇℃伅鎶�鏈湁闄愬叕鍙革紙https://www.jnpfsoft.com锛�
+ * 浣滆�咃細 JNPF寮�鍙戝钩鍙扮粍
+ * 鏃ユ湡锛� 2021-07-10 10:40:59
+ */
+@Service
+@RequiredArgsConstructor
+public class ProductServiceImpl extends SuperServiceImpl<ProductMapper, ProductEntity> implements ProductService {
+
+
+
+    private final BillRuleApi billRuleApi;
+
+    private final ProductEntryMapper productEntryMapper;
+
+    @Override
+    public List<ProductEntity> getList(ProductPagination productPagination) {
+        return this.baseMapper.getList(productPagination);
+    }
+
+    @Override
+    public ProductEntity getInfo(String id) {
+        return this.baseMapper.getInfo(id);
+    }
+
+    @Override
+    @DSTransactional(rollbackFor = Exception.class)
+    public void create(ProductEntity entity, List<ProductEntryEntity> productEntryList) throws DataException {
+        UserInfo userInfo = UserProvider.getUser();
+        String code = billRuleApi.getBillNumber("OrderNumber").getData();
+        entity.setEnCode(code);
+        //绫诲瀷
+        entity.setType("甯傚満娲诲姩");
+        //鍒跺崟
+        entity.setSalesmanId(userInfo.getUserId());
+        entity.setSalesmanName(userInfo.getUserName());
+        entity.setSalesmanDate(new Date());
+        //鐘舵��
+        entity.setAuditState(1);
+        entity.setGoodsState(1);
+        entity.setCloseState(1);
+        entity.setCreatorUserId(userInfo.getUserId());
+        entity.setCreatorTime(new Date());
+        entity.setId(RandomUtil.uuId());
+        this.save(entity);
+        for (ProductEntryEntity product : productEntryList) {
+            product.setId(RandomUtil.uuId());
+            product.setActivity("甯傚満閮ㄥ叏鍥介椋庡仴搴峰ア鎶�");
+            product.setType("甯傚満娲诲姩");
+            product.setUtil("鏀�");
+            product.setCommandType("鍞竴鐮�");
+            product.setProductId(entity.getId());
+            productEntryMapper.insert(product);
+        }
+    }
+
+    @Override
+    @DSTransactional(rollbackFor = Exception.class)
+    public boolean update(String id, ProductEntity entity, List<ProductEntryEntity> productEntryList) {
+        entity.setId(id);
+        entity.setLastModifyUserId(UserProvider.getUser().getUserId());
+        entity.setLastModifyTime(new Date());
+        QueryWrapper<ProductEntryEntity> entryWrapper = new QueryWrapper<>();
+        entryWrapper.lambda().eq(ProductEntryEntity::getProductId, entity.getId());
+        productEntryMapper.delete(entryWrapper);
+        for (ProductEntryEntity product : productEntryList) {
+            product.setId(RandomUtil.uuId());
+            product.setProductId(entity.getId());
+            productEntryMapper.insert(product);
+        }
+        return this.updateById(entity);
+    }
+
+    @Override
+    @DSTransactional(rollbackFor = Exception.class)
+    public void delete(ProductEntity entity) {
+        if (entity != null) {
+            QueryWrapper<ProductEntryEntity> entryWrapper = new QueryWrapper<>();
+            entryWrapper.lambda().eq(ProductEntryEntity::getProductId, entity.getId());
+            productEntryMapper.delete(entryWrapper);
+            this.removeById(entity.getId());
+        }
+    }
+
+
+}

--
Gitblit v1.8.0