瀏覽代碼

Merge remote-tracking branch 'origin/master'

xiahan 1 年之前
父節點
當前提交
3f07b3e6e3

+ 3 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsProductDetailService.java

@@ -5,6 +5,7 @@ import com.rongwei.bsentity.domain.ApsProductDetailDo;
 import com.rongwei.rwcommon.base.R;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -22,4 +23,6 @@ public interface ApsProductDetailService extends IService<ApsProductDetailDo> {
     R updateCustomOrder(Map<String, Object> params);
 
     R updateMergeCustomOrder(@RequestBody Map<String, Object> params);
+
+    R updateOrSaveProductDetails(List<ApsProductDetailDo> req);
 }

+ 11 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java

@@ -1,6 +1,7 @@
 package com.rongwei.bscommon.sys.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bscommon.sys.dao.ApsProductDetailDao;
 import com.rongwei.bscommon.sys.service.ApsProductDetailService;
@@ -13,6 +14,7 @@ import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.ArrayList;
@@ -445,4 +447,13 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
             return R.error("获取客户订单系统订单失败,请联系管理员");
         }
     }
+
+    @Override
+    @Transactional
+    public R updateOrSaveProductDetails(List<ApsProductDetailDo> req) {
+        if (ObjectUtil.isNotEmpty(req) && req.size() > 0) {
+            this.saveOrUpdateBatch(req);
+        }
+        return R.ok();
+    }
 }

+ 16 - 0
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductDetailController.java

@@ -2,6 +2,7 @@ package com.rongwei.bsserver.controller;
 
 
 import com.rongwei.bscommon.sys.service.ApsProductDetailService;
+import com.rongwei.bsentity.domain.ApsProductDetailDo;
 import com.rongwei.rwcommon.base.R;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -68,5 +70,19 @@ public class ApsProductDetailController {
             return R.error("获取客户订单系统订单失败,请联系管理员");
         }
     }
+
+    /**
+     * 更新或保存产品明细
+     */
+    @PostMapping("/updateOrSaveProductDetails")
+    public R updateOrSaveProductDetails(@RequestBody List<ApsProductDetailDo> req) {
+        try {
+            log.info("更新或保存产品明细;参数为:{}", req);
+            return apsProductDetailService.updateOrSaveProductDetails(req);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("更新或保存产品明细失败,请联系管理员");
+        }
+    }
 }