|
|
@@ -1,12 +1,11 @@
|
|
|
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.erp.model.PurchaseForecast;
|
|
|
import com.uas.platform.b2b.erp.service.PurchaseForecastService;
|
|
|
+import com.uas.platform.b2b.erp.service.VendorService;
|
|
|
import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
-import com.uas.platform.b2b.temporary.model.PartnershipRecord;
|
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -30,6 +29,14 @@ public class PurchaseForecastServiceImpl implements PurchaseForecastService {
|
|
|
@Autowired
|
|
|
private PurchaseForecastAllDao purchaseForecastDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private VendorService vendorService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 应用来源
|
|
|
+ */
|
|
|
+ private final String APPID = "uas";
|
|
|
+
|
|
|
@Override
|
|
|
public List<PurchaseForecastAllItem> convertPurchaseForecast(List<PurchaseForecast> purchaseForecasts) {
|
|
|
List<PurchaseForecastAllItem> items = new ArrayList<PurchaseForecastAllItem>();
|
|
|
@@ -59,7 +66,7 @@ public class PurchaseForecastServiceImpl implements PurchaseForecastService {
|
|
|
if (vendors.size() == 0) {
|
|
|
vendor = addVendor(item);
|
|
|
if (null != vendor) {
|
|
|
- addPartnerShipRecord(vendor); // 添加合作伙伴关系
|
|
|
+ vendorService.addPartnerShipRecord(vendor, APPID); // 添加合作伙伴关系
|
|
|
}
|
|
|
} else {
|
|
|
vendor = vendors.get(0);
|
|
|
@@ -93,31 +100,6 @@ public class PurchaseForecastServiceImpl implements PurchaseForecastService {
|
|
|
return items;
|
|
|
}
|
|
|
|
|
|
- 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
|
|
|
public List<PurchaseForecastAllItem> convertEDIPurchaseForecast(List<PurchaseForecast> purchaseForecasts, Long enUU) {
|
|
|
List<PurchaseForecastAllItem> items = new ArrayList<PurchaseForecastAllItem>();
|
|
|
@@ -146,7 +128,7 @@ public class PurchaseForecastServiceImpl implements PurchaseForecastService {
|
|
|
if (vendors.size() == 0) {
|
|
|
vendor = addVendor(item);
|
|
|
if (null != vendor) {
|
|
|
- addPartnerShipRecord(vendor);
|
|
|
+ vendorService.addPartnerShipRecord(vendor, APPID); // 添加合作伙伴关系
|
|
|
}
|
|
|
} else {
|
|
|
vendor = vendors.get(0);
|
|
|
@@ -183,7 +165,7 @@ public class PurchaseForecastServiceImpl implements PurchaseForecastService {
|
|
|
/**
|
|
|
* 添加供应商资料
|
|
|
*
|
|
|
- * @param forecast
|
|
|
+ * @param forecastItem
|
|
|
*/
|
|
|
private Vendor addVendor(PurchaseForecastAllItem forecastItem) {
|
|
|
Enterprise enterprise = enterpriseDao.findOne(forecastItem.getVendUU());
|