|
|
@@ -2,45 +2,66 @@ package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import javax.persistence.criteria.CriteriaBuilder;
|
|
|
+import javax.persistence.criteria.CriteriaQuery;
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
|
+import javax.persistence.criteria.Root;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.PurchaseNoticeDao;
|
|
|
+import com.uas.platform.b2b.dao.SaleSendDao;
|
|
|
import com.uas.platform.b2b.model.PurchaseNotice;
|
|
|
import com.uas.platform.b2b.model.SaleSend;
|
|
|
import com.uas.platform.b2b.service.PurchaseNoticeService;
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
+import com.uas.platform.core.model.Status;
|
|
|
|
|
|
@Service
|
|
|
-public class PurchaseNoticeServiceImpl implements PurchaseNoticeService{
|
|
|
+public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseNoticeDao purchaseNoticeDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SaleSendDao saleSendDao;
|
|
|
|
|
|
@Override
|
|
|
public void save(List<PurchaseNotice> notices) {
|
|
|
// TODO
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<PurchaseNotice> findAllByPageInfo(PageInfo pageInfo) {
|
|
|
- // TODO
|
|
|
- return null;
|
|
|
+ public Page<PurchaseNotice> findAllByPageInfo(final PageInfo pageInfo) {
|
|
|
+ return purchaseNoticeDao.findAll(new Specification<PurchaseNotice>() {
|
|
|
+
|
|
|
+ public Predicate toPredicate(Root<PurchaseNotice> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
+ query.where(pageInfo.getPredicates(root, builder));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }, pageInfo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PurchaseNotice findById(Long id) {
|
|
|
- // TODO
|
|
|
- return null;
|
|
|
+ return purchaseNoticeDao.findOne(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void send(SaleSend send) {
|
|
|
// TODO
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void send(List<SaleSend> sends) {
|
|
|
// TODO
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -51,38 +72,51 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService{
|
|
|
|
|
|
@Override
|
|
|
public List<PurchaseNotice> findNotUploadNotice() {
|
|
|
- // TODO
|
|
|
- return null;
|
|
|
+ return purchaseNoticeDao.findByVendUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onNoticeDownSuccess(String[] idArray) {
|
|
|
- // TODO
|
|
|
-
|
|
|
+ for (String id : idArray) {
|
|
|
+ PurchaseNotice notice = purchaseNoticeDao.findOne(Long.parseLong(id));
|
|
|
+ if (notice != null) {
|
|
|
+ notice.setSendStatus((short) Status.DOWNLOADED.value());
|
|
|
+ purchaseNoticeDao.save(notice);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SaleSend> findNotUploadSend() {
|
|
|
- // TODO
|
|
|
- return null;
|
|
|
+ return saleSendDao.findByCustUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(), (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SaleSend> findNotSendSend() {
|
|
|
- // TODO
|
|
|
- return null;
|
|
|
+ return saleSendDao.findByEnUUAndBackStatus(SystemSession.getUser().getEnterprise().getUu(), (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onSendUploadSuccess(String[] idArray) {
|
|
|
- // TODO
|
|
|
-
|
|
|
+ for (String id : idArray) {
|
|
|
+ SaleSend send = saleSendDao.findOne(Long.parseLong(id));
|
|
|
+ if (send != null) {
|
|
|
+ send.setSendStatus((short) Status.DOWNLOADED.value());
|
|
|
+ saleSendDao.save(send);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onSendDownSuccess(String[] idArray) {
|
|
|
- // TODO
|
|
|
-
|
|
|
+ for (String id : idArray) {
|
|
|
+ SaleSend send = saleSendDao.findOne(Long.parseLong(id));
|
|
|
+ if (send != null) {
|
|
|
+ send.setBackStatus((short) Status.DOWNLOADED.value());
|
|
|
+ saleSendDao.save(send);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|