|
@@ -1,13 +1,12 @@
|
|
|
package com.uas.platform.b2b.erp.service.impl;
|
|
package com.uas.platform.b2b.erp.service.impl;
|
|
|
|
|
|
|
|
-import com.uas.account.util.AccountUtils;
|
|
|
|
|
import com.uas.platform.b2b.dao.*;
|
|
import com.uas.platform.b2b.dao.*;
|
|
|
import com.uas.platform.b2b.erp.model.Quotation;
|
|
import com.uas.platform.b2b.erp.model.Quotation;
|
|
|
import com.uas.platform.b2b.erp.model.QuotationDecide;
|
|
import com.uas.platform.b2b.erp.model.QuotationDecide;
|
|
|
import com.uas.platform.b2b.erp.service.QuotationService;
|
|
import com.uas.platform.b2b.erp.service.QuotationService;
|
|
|
|
|
+import com.uas.platform.b2b.erp.service.VendorService;
|
|
|
import com.uas.platform.b2b.model.*;
|
|
import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
-import com.uas.platform.b2b.temporary.model.PartnershipRecord;
|
|
|
|
|
import com.uas.platform.core.model.Constant;
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -33,12 +32,16 @@ public class QuotationServiceImpl implements QuotationService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private UserDao userDao;
|
|
private UserDao userDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private VendorService vendorService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Map<String, List<SaleQuotationItem>> convertQuotation(List<Quotation> quotations) {
|
|
public Map<String, List<SaleQuotationItem>> convertQuotation(List<Quotation> quotations) {
|
|
|
Map<String, List<SaleQuotationItem>> mapSaleQuotationItem = new HashMap<String, List<SaleQuotationItem>>();
|
|
Map<String, List<SaleQuotationItem>> mapSaleQuotationItem = new HashMap<String, List<SaleQuotationItem>>();
|
|
|
List<SaleQuotationItem> saveItems = new ArrayList<SaleQuotationItem>();
|
|
List<SaleQuotationItem> saveItems = new ArrayList<SaleQuotationItem>();
|
|
|
List<SaleQuotationItem> resItems = new ArrayList<SaleQuotationItem>();
|
|
List<SaleQuotationItem> resItems = new ArrayList<SaleQuotationItem>();
|
|
|
long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
|
|
+ final String appId = "uas";// 应用来源
|
|
|
for (Quotation quotation : quotations) {
|
|
for (Quotation quotation : quotations) {
|
|
|
// 先查看是否已存在
|
|
// 先查看是否已存在
|
|
|
List<SaleQuotation> quotations2 = saleQuotationDao.findByEnUUAndCode(enUU, quotation.getQu_code());
|
|
List<SaleQuotation> quotations2 = saleQuotationDao.findByEnUUAndCode(enUU, quotation.getQu_code());
|
|
@@ -71,7 +74,7 @@ public class QuotationServiceImpl implements QuotationService {
|
|
|
} else {// 不存在对应的供应商资料,增加供应商关系
|
|
} else {// 不存在对应的供应商资料,增加供应商关系
|
|
|
vendor = addVendor(saleQuotation);
|
|
vendor = addVendor(saleQuotation);
|
|
|
if (null != vendor) {
|
|
if (null != vendor) {
|
|
|
- addPartnerShipRecord(vendor); // 添加供应商关系同时增加合作伙伴关系记录
|
|
|
|
|
|
|
+ vendorService.addPartnerShipRecord(vendor, appId); // 添加供应商关系同时增加合作伙伴关系记录
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (vendor != null && vendor.getMyEnUU() != null) {
|
|
if (vendor != null && vendor.getMyEnUU() != null) {
|
|
@@ -109,31 +112,6 @@ public class QuotationServiceImpl implements QuotationService {
|
|
|
return mapSaleQuotationItem;
|
|
return mapSaleQuotationItem;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void addPartnerShipRecord(Vendor vendor) {
|
|
|
|
|
- PartnershipRecord shipRecord = new PartnershipRecord("uas", vendor);
|
|
|
|
|
- com.uas.account.entity.PartnershipRecord record = new com.uas.account.entity.PartnershipRecord();
|
|
|
|
|
- record.setAppId(shipRecord.getAppId());
|
|
|
|
|
- record.setCustName(shipRecord.getCustName());
|
|
|
|
|
- record.setCustUID(shipRecord.getCustUID());
|
|
|
|
|
- record.setCustUserCode(shipRecord.getCustUserCode());
|
|
|
|
|
- record.setCustUserEmail(shipRecord.getCustUserEmail());
|
|
|
|
|
- record.setCustUserName(shipRecord.getCustUserName());
|
|
|
|
|
- record.setCustUserTel(shipRecord.getCustUserTel());
|
|
|
|
|
- record.setVendName(shipRecord.getVendName());
|
|
|
|
|
- record.setVendUID(shipRecord.getVendUID());
|
|
|
|
|
- record.setVendUserCode(shipRecord.getVendUserCode());
|
|
|
|
|
- record.setVendUserEmail(shipRecord.getVendUserEmail());
|
|
|
|
|
- record.setVendUserName(shipRecord.getVendUserName());
|
|
|
|
|
- record.setVendUserTel(shipRecord.getVendUserTel());
|
|
|
|
|
- try {
|
|
|
|
|
- AccountUtils.synchronizeRecord(record);
|
|
|
|
|
- vendor.setSynchStatus(Constant.YES);
|
|
|
|
|
- vendorDao.save(vendor);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<QuotationDecide> convertQuotationDecide(List<SaleQuotationItem> quotationItems) {
|
|
public List<QuotationDecide> convertQuotationDecide(List<SaleQuotationItem> quotationItems) {
|
|
|
List<QuotationDecide> decides = new ArrayList<QuotationDecide>();
|
|
List<QuotationDecide> decides = new ArrayList<QuotationDecide>();
|