|
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Repository; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
//访客数据接口
|
|
|
|
//访客数据接口
|
|
|
|
@Repository |
|
|
|
@Repository |
|
|
@ -51,9 +52,11 @@ public class VisitorDao extends BaseDao<Visitor> { |
|
|
|
|
|
|
|
|
|
|
|
//加载所有访客信息
|
|
|
|
//加载所有访客信息
|
|
|
|
public Page<Visitor> loadAllVisitor(VisitorQuery visitorQuery) { |
|
|
|
public Page<Visitor> loadAllVisitor(VisitorQuery visitorQuery) { |
|
|
|
long count = mongoTemplate.count(new Query(), entityClass()); |
|
|
|
Criteria criteria = Criteria.where("appointment").regex(Pattern.compile(".*") + visitorQuery.getAppointment() + ".*"); |
|
|
|
|
|
|
|
Query query = new Query(criteria); |
|
|
|
|
|
|
|
long count = mongoTemplate.count(query, entityClass()); |
|
|
|
Page<Visitor> page = new Page<>(count, visitorQuery.getCurrentPage(), pageSize); |
|
|
|
Page<Visitor> page = new Page<>(count, visitorQuery.getCurrentPage(), pageSize); |
|
|
|
List<Visitor> visitorList = mongoTemplate.find(new Query().with(PageRequest.of(visitorQuery.getCurrentPage().intValue() - 1, pageSize)), entityClass()); |
|
|
|
List<Visitor> visitorList = mongoTemplate.find(query.with(PageRequest.of(visitorQuery.getCurrentPage().intValue() - 1, pageSize)), entityClass()); |
|
|
|
page.setList(visitorList); |
|
|
|
page.setList(visitorList); |
|
|
|
return page; |
|
|
|
return page; |
|
|
|
} |
|
|
|
} |
|
|
@ -63,7 +66,7 @@ public class VisitorDao extends BaseDao<Visitor> { |
|
|
|
return mongoTemplate.updateFirst(new Query(Criteria.where(LookupOperationUtil.idKey).is(visitorForm.getId())), Update.update("status", visitorForm.getStatus()).set("managerName", visitorForm.getManagerName()), entityClass()).wasAcknowledged(); |
|
|
|
return mongoTemplate.updateFirst(new Query(Criteria.where(LookupOperationUtil.idKey).is(visitorForm.getId())), Update.update("status", visitorForm.getStatus()).set("managerName", visitorForm.getManagerName()), entityClass()).wasAcknowledged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//用户加载访客信息
|
|
|
|
private List<Visitor> load(com.community.pocket.entity.vo.android.VisitorQuery visitorQuery, Criteria criteria) { |
|
|
|
private List<Visitor> load(com.community.pocket.entity.vo.android.VisitorQuery visitorQuery, Criteria criteria) { |
|
|
|
if (visitorQuery.getStartDate() != null && visitorQuery.getEndDate() != null) { |
|
|
|
if (visitorQuery.getStartDate() != null && visitorQuery.getEndDate() != null) { |
|
|
|
criteria = criteria.andOperator(Criteria.where("time").gte(visitorQuery.getStartDate().getTime()), Criteria.where("time").lte(visitorQuery.getEndDate().getTime())); |
|
|
|
criteria = criteria.andOperator(Criteria.where("time").gte(visitorQuery.getStartDate().getTime()), Criteria.where("time").lte(visitorQuery.getEndDate().getTime())); |
|
|
|