EmployeeServiceImpl.java
1.98 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
45
46
47
48
49
50
51
52
53
54
55
56
package com.bsth.service.schedule.impl;
import com.bsth.entity.Personnel;
import com.bsth.service.schedule.EmployeeService;
import com.bsth.service.schedule.exception.ScheduleException;
import com.bsth.service.schedule.utils.DataToolsFile;
import com.bsth.service.schedule.utils.DataToolsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
/**
* Created by xu on 16/12/15.
*/
@Service
public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implements EmployeeService {
@Autowired
@Qualifier(value = "employee_dataTool")
private DataToolsService dataToolsService;
@Override
public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
return dataToolsService.uploadFile(filename, filedata);
}
@Override
public void importData(File file, Map<String, Object> params) throws ScheduleException {
dataToolsService.importData(file, params);
}
@Override
public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
return dataToolsService.exportData(params);
}
@Override
@Transactional
public void validate_gh(Personnel personnel) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (personnel.getId() != null) {
param.put("id_ne", personnel.getId());
}
param.put("companyCode_eq", personnel.getCompanyCode());
param.put("jobCode_eq", personnel.getJobCode());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("相同公司工号重复");
}
}
}