DutyEmployeeServiceImpl.java
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.bsth.service.sys.impl;
import com.bsth.entity.sys.DutyEmployee;
import com.bsth.repository.sys.DutyEmployeeRepository;
import com.bsth.service.impl.BaseServiceImpl;
import com.bsth.service.sys.DutyEmployeeService;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Created by panzhao on 2017/1/5.
*/
@Service
public class DutyEmployeeServiceImpl extends BaseServiceImpl<DutyEmployee, Long> implements DutyEmployeeService {
@Autowired
DutyEmployeeRepository dutyEmployeeRepository;
@Override
public Map<String, Object> save(DutyEmployee dutyEmployee) {
//登入时间,当前时间 - 10分钟
dutyEmployee.setTs(System.currentTimeMillis() - (1000 * 60 * 10));
return super.save(dutyEmployee);
}
/**
* 获取当班调度
*
* @param lineCode 线路编码
* @param startTime 开始时间 yyyy-MM-ddHH:mm
* @param endTime 结束时间 yyyy-MM-ddHH:mm
* @return
*/
public List<DutyEmployee> getDutyEmployee(String lineCode, String startTime, String endTime) {
DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
return dutyEmployeeRepository.findByLineAndTime(lineCode + ",", fmtyyyyMMddHHmm.parseMillis(startTime), fmtyyyyMMddHHmm.parseMillis(endTime));
}
}