|
|
@@ -49,6 +49,7 @@ import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
@@ -730,7 +731,7 @@ public class PurchaseInquiryServiceImpl implements PurchaseInquiryService {
|
|
|
|
|
|
@Override
|
|
|
public List<InquiryMessage> getMessageList() {
|
|
|
- String sql = "select * from (select p.id_id id,p.id_prid productId from purc$puinquiryitems p left join purc$puinquiry i on i.in_id = p.id_inid where i.in_isopen = 1 and i.in_enuu <> "
|
|
|
+ String sql = "select * from (select p.id_id id,p.id_prid productId,p.id_date as \"date\" from purc$puinquiryitems p left join purc$puinquiry i on i.in_id = p.id_inid where i.in_isopen = 1 and i.in_enuu <> "
|
|
|
+ SystemSession.getUser().getEnterprise().getUu()
|
|
|
+ "and i.in_enddate > trunc(sysdate) and nvl(p.id_overdue, 0) <> 1 order by id_id desc) where rownum <= 7";
|
|
|
List<PurcInquiryItem> items = commonDao.query(sql, PurcInquiryItem.class);
|
|
|
@@ -741,13 +742,40 @@ public class PurchaseInquiryServiceImpl implements PurchaseInquiryService {
|
|
|
Product prod = productDao.findOne(item.getProductId());
|
|
|
message.setPordName(prod.getTitle());
|
|
|
item = purcInquiryItemDao.findOne(item.getId());
|
|
|
+ message.setRead(getReadStatus(item.getId(), SystemSession.getUser().getUserUU()));
|
|
|
message.setInid(item.getId());
|
|
|
+ message.setLastest(isToday(item.getDate()));
|
|
|
messages.add(message);
|
|
|
}
|
|
|
}
|
|
|
return messages;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断该条单据是否当天单据
|
|
|
+ *
|
|
|
+ * @param date
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean isToday(Date date) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
|
|
|
+ String inDate = sdf.format(date);
|
|
|
+ String nowDate = sdf.format(new Date());
|
|
|
+ return inDate.equals(nowDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当前公共询价明细的阅读状态
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param userUU
|
|
|
+ */
|
|
|
+ private boolean getReadStatus(Long id, Long userUU) {
|
|
|
+ String sql = "select count(1) from inquiryitems$readstatus where id_id = " + id + " and id_useruu = " + userUU;
|
|
|
+ Integer count = commonDao.queryForObject(sql, Integer.class);
|
|
|
+ return count == 0 ? false : true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onReplyInvalid(List<Inquiry> inquiries) {
|
|
|
final Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
@@ -853,4 +881,10 @@ public class PurchaseInquiryServiceImpl implements PurchaseInquiryService {
|
|
|
}
|
|
|
return deleteCount;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setReadStatus(Long id) {
|
|
|
+ if(null != id)
|
|
|
+ purchaseInquiryItemDao.setReadStatus(id, SystemSession.getUser().getUserUU());
|
|
|
+ }
|
|
|
}
|