|
@@ -3,8 +3,12 @@ package com.gqy.document.service.impl;
|
|
|
import com.gqy.common.utils.bean.BeanUtils;
|
|
|
import com.gqy.document.domain.DcProduct;
|
|
|
import com.gqy.document.domain.DcSpec;
|
|
|
+import com.gqy.document.domain.DcSystemProduct;
|
|
|
+import com.gqy.document.domain.DcWorkSystem;
|
|
|
import com.gqy.document.mapper.DcProductMapper;
|
|
|
import com.gqy.document.mapper.DcSpecMapper;
|
|
|
+import com.gqy.document.mapper.DcSystemProductMapper;
|
|
|
+import com.gqy.document.mapper.DcWorkSystemMapper;
|
|
|
import com.gqy.document.service.IDcProductService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@@ -19,6 +23,11 @@ public class DcProductServiceImpl implements IDcProductService {
|
|
|
@Autowired
|
|
|
private DcProductMapper dcProductMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DcWorkSystemMapper dcWorkSystemMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DcSystemProductMapper dcSystemProductMapper;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -27,30 +36,48 @@ public class DcProductServiceImpl implements IDcProductService {
|
|
|
*/
|
|
|
public int add(Map<String, Object> params) {
|
|
|
|
|
|
- DcProduct product = new DcProduct();
|
|
|
- // 拷贝参数
|
|
|
- BeanUtils.copyProperties(params, product);
|
|
|
- // 保存
|
|
|
- dcProductMapper.insertDcProduct(product);
|
|
|
- // 产品id
|
|
|
- int dcpId = product.getDcp_id();
|
|
|
-
|
|
|
- //工程系统表 保存信息 dc_work_system
|
|
|
- //系统产品表 保存信息 dc_system_product
|
|
|
-
|
|
|
-
|
|
|
- // 规格管理
|
|
|
- List<Map> specs = (List<Map>) params.get("specs");
|
|
|
- for (Map spec : specs) {
|
|
|
- // 规格
|
|
|
- DcSpec dcSpec = new DcSpec();
|
|
|
- //设置 产品id
|
|
|
- dcSpec.setPs_p_id(dcpId);
|
|
|
+ try {
|
|
|
+ DcProduct product = new DcProduct();
|
|
|
// 拷贝参数
|
|
|
- BeanUtils.copyProperties(spec, dcSpec);
|
|
|
+ BeanUtils.copyProperties(params, product);
|
|
|
+ // 保存
|
|
|
+ dcProductMapper.insertDcProduct(product);
|
|
|
+ // 产品id
|
|
|
+ int dcpId = product.getDcp_id();
|
|
|
+ //系统类别id
|
|
|
+ int sys_no = Integer.parseInt((String) params.get("sys_no"));
|
|
|
+ //工程id
|
|
|
+ int wr_id = Integer.parseInt((String) params.get("wr_id"));
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // 工程系统表 保存信息 dc_work_system
|
|
|
+ DcWorkSystem workSystem = new DcWorkSystem();
|
|
|
+ workSystem.setWr_id(wr_id);
|
|
|
+ workSystem.setSys_id(sys_no);
|
|
|
+
|
|
|
+ dcWorkSystemMapper.insertDcWorkSystem(workSystem);
|
|
|
+
|
|
|
+ // 系统产品表 保存信息 dc_system_product
|
|
|
+ DcSystemProduct systemProduct = new DcSystemProduct();
|
|
|
+ systemProduct.setSys_no(sys_no);
|
|
|
+ systemProduct.setP_id(dcpId);
|
|
|
+ dcSystemProductMapper.insertDcSystemProduct(systemProduct);
|
|
|
+
|
|
|
+ // 规格管理
|
|
|
+ List<Map> specs = (List<Map>) params.get("specs");
|
|
|
+ for (Map spec : specs) {
|
|
|
+ // 规格
|
|
|
+ DcSpec dcSpec = new DcSpec();
|
|
|
+ //设置 产品id
|
|
|
+ dcSpec.setPs_p_id(dcpId);
|
|
|
+ // 拷贝参数
|
|
|
+ BeanUtils.copyProperties(spec, dcSpec);
|
|
|
+
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
return 0;
|
|
|
}
|
|
|
}
|