|
@@ -1,42 +1,60 @@
|
|
|
package com.uas.platform.b2b.service.impl;
|
|
package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import com.uas.platform.b2b.dao.PurchaseForecastAllDao;
|
|
import com.uas.platform.b2b.dao.PurchaseForecastAllDao;
|
|
|
-import com.uas.platform.b2b.model.PurchaseForecastAll;
|
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.PurchaseForecastAllItemDao;
|
|
|
|
|
+import com.uas.platform.b2b.model.PurchaseForecastAllItem;
|
|
|
import com.uas.platform.b2b.service.PurchaseForecastOrderService;
|
|
import com.uas.platform.b2b.service.PurchaseForecastOrderService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
+import com.uas.platform.b2b.support.XingePusher;
|
|
|
import com.uas.platform.core.model.Status;
|
|
import com.uas.platform.core.model.Status;
|
|
|
-
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class PurchaseForecastOrderServiceImpl implements PurchaseForecastOrderService {
|
|
public class PurchaseForecastOrderServiceImpl implements PurchaseForecastOrderService {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PurchaseForecastAllItemDao purchaseForecastAllItemDao;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private PurchaseForecastAllDao purchaseForecastAllDao;
|
|
private PurchaseForecastAllDao purchaseForecastAllDao;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public void save(List<PurchaseForecastAll> convertPurchase) {
|
|
|
|
|
- purchaseForecastAllDao.save(convertPurchase);
|
|
|
|
|
|
|
+ public List<PurchaseForecastAllItem> save(List<PurchaseForecastAllItem> items) {
|
|
|
|
|
+ List<PurchaseForecastAllItem> items2 = purchaseForecastAllItemDao.save(items);
|
|
|
|
|
+ Set<Long> vendUsers = new HashSet<Long>();
|
|
|
|
|
+ for(PurchaseForecastAllItem item : items2) {
|
|
|
|
|
+ //每一个相关的供应商联系人每次只接收到一条推送通知
|
|
|
|
|
+ if(! vendUsers.contains(item.getVendUserUU())) {
|
|
|
|
|
+ if(item.getVendUserUU() != null) {
|
|
|
|
|
+ XingePusher.pushSingleAccountAndroid(item.getVendUserUU().toString(),
|
|
|
|
|
+ "客户对您下达了新的采购预测", "", null);
|
|
|
|
|
+ XingePusher.pushSingleAccountIOS(item.getVendUserUU().toString(),
|
|
|
|
|
+ "客户对您下达了新的采购预测");
|
|
|
|
|
+ }
|
|
|
|
|
+ vendUsers.add(item.getVendUserUU());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return items2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public List<PurchaseForecastAll> findNotUploadOrder() {
|
|
|
|
|
- return purchaseForecastAllDao.findByVendUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
|
|
|
|
+ public List<PurchaseForecastAllItem> findNotUploadOrder() {
|
|
|
|
|
+ return purchaseForecastAllItemDao.findByVendUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
(short) Status.NOT_UPLOAD.value());
|
|
(short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onEndDownSuccess(String[] idArray) {
|
|
public void onEndDownSuccess(String[] idArray) {
|
|
|
for (String id : idArray) {
|
|
for (String id : idArray) {
|
|
|
- PurchaseForecastAll orderItem = purchaseForecastAllDao.findOne(Long.parseLong(id));
|
|
|
|
|
- if (orderItem != null) {
|
|
|
|
|
- orderItem.setSendStatus((short) Status.DOWNLOADED.value());
|
|
|
|
|
- purchaseForecastAllDao.save(orderItem);
|
|
|
|
|
- // 明细结案情况下,明细状态为已回复(即不再处理),时同时修改主记录状态
|
|
|
|
|
- // updateOrderStatus(orderItem.getOrder().getId());
|
|
|
|
|
|
|
+ PurchaseForecastAllItem forecastAllItem = purchaseForecastAllItemDao.findOne(Long.parseLong(id));
|
|
|
|
|
+ if (forecastAllItem != null) {
|
|
|
|
|
+ forecastAllItem.setSendStatus((short) Status.DOWNLOADED.value());
|
|
|
|
|
+ purchaseForecastAllItemDao.save(forecastAllItem);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|