Commit 897a5e82 by 朱海

[add]增加接待结束时间

1 parent 23ed153f
...@@ -32,9 +32,9 @@ public class DPersonRecordDao { ...@@ -32,9 +32,9 @@ public class DPersonRecordDao {
public void createDPersonRecordBatch(List<DPersonRecord> personRecordList) { public void createDPersonRecordBatch(List<DPersonRecord> personRecordList) {
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(personRecordList.toArray()); SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(personRecordList.toArray());
String sql = "insert into d_person_record (mall_id,account_id,count_date,person_unid,group_unid,age,gender,person_type,arrive_time, leave_time, " + String sql = "insert into d_person_record (mall_id,account_id,count_date,person_unid,group_unid,age,gender,person_type,arrive_time, leave_time, " +
"visit_count, visit_duration, engage_count,engage_time,reception_count,reception_time,reception_duration,attention_count,attention_time)" + "visit_count, visit_duration, engage_count,engage_time,reception_count,reception_time,reception_duration,attention_count,attention_time,reception_end_time)" +
" values(:mallId,:accountId,:countDate,:personUnid,:groupUnid,:age,:gender,:personType,:arriveTime,:leaveTime,:visitCount,:visitDuration," + " values(:mallId,:accountId,:countDate,:personUnid,:groupUnid,:age,:gender,:personType,:arriveTime,:leaveTime,:visitCount,:visitDuration," +
":engageCount,:engageTime,:receptionCount,:receptionTime,:receptionDuration,:attentionCount,:attentionTime)"; ":engageCount,:engageTime,:receptionCount,:receptionTime,:receptionDuration,:attentionCount,:attentionTime,:receptionEndTime)";
namedParameterJdbcTemplate.batchUpdate(sql, batch); namedParameterJdbcTemplate.batchUpdate(sql, batch);
} }
......
...@@ -70,12 +70,17 @@ public class DPersonRecord { ...@@ -70,12 +70,17 @@ public class DPersonRecord {
private Integer receptionCount = 0; private Integer receptionCount = 0;
/** /**
* 接待时间 * 接待开始时间
*/ */
private Date receptionTime; private Date receptionTime;
/** /**
* 接待时长 * 接待结束时间
*/
private Date receptionEndTime;
/**
* 接待时长,不是用接待结束时间减去接待开始时间,用的是多次接待时长累加
*/ */
private Long receptionDuration; private Long receptionDuration;
......
...@@ -315,12 +315,14 @@ public class PersonRecordServiceImpl implements PersonRecordService { ...@@ -315,12 +315,14 @@ public class PersonRecordServiceImpl implements PersonRecordService {
List<DPersonReception> personReceptionList = dPersonReceptionDao.getPersonReceptionList(dPersonRecord.getMallId(), dPersonRecord.getCountDate(), dPersonRecord.getPersonUnid(), dPersonRecord.getArriveTime(), dPersonRecord.getLeaveTime()); List<DPersonReception> personReceptionList = dPersonReceptionDao.getPersonReceptionList(dPersonRecord.getMallId(), dPersonRecord.getCountDate(), dPersonRecord.getPersonUnid(), dPersonRecord.getArriveTime(), dPersonRecord.getLeaveTime());
if (CollectionUtils.isNotEmpty(personReceptionList)) { if (CollectionUtils.isNotEmpty(personReceptionList)) {
dPersonRecord.setReceptionCount(personReceptionList.size()); dPersonRecord.setReceptionCount(personReceptionList.size());
Date startTime = personReceptionList.get(0).getStartTime(); Date startTime = personReceptionList.stream().min(Comparator.comparing(DPersonReception::getStartTime)).get().getStartTime();
//接待时间早于到店时间,接待时间为进店时间+1秒 //接待时间早于到店时间,接待时间为进店时间+1秒
if (startTime.before(dPersonRecord.getArriveTime())) { if (startTime.before(dPersonRecord.getArriveTime())) {
startTime = DateUtil.offsetSecond(dPersonRecord.getArriveTime(), 1); startTime = DateUtil.offsetSecond(dPersonRecord.getArriveTime(), 1);
} }
dPersonRecord.setReceptionTime(startTime); dPersonRecord.setReceptionTime(startTime);
Date endTime = personReceptionList.stream().max(Comparator.comparing(DPersonReception::getEndTime)).get().getEndTime();
dPersonRecord.setReceptionEndTime(endTime);
dPersonRecord.setReceptionDuration(personReceptionList.stream().mapToLong(DPersonReception::getDuration).sum()); dPersonRecord.setReceptionDuration(personReceptionList.stream().mapToLong(DPersonReception::getDuration).sum());
} }
//进出匹配的人在店内的抓拍记录 //进出匹配的人在店内的抓拍记录
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!