|
|
|
@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.jingcheng.cms.constants.Constants;
|
|
|
|
|
import com.jingcheng.cms.mapper.*;
|
|
|
|
@ -52,12 +53,21 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andEqualTo("state",Constants.STATE_VALID);
|
|
|
|
|
String honorLevel = jsonObject.getString("honorLevel");
|
|
|
|
|
String honorDescription = jsonObject.getString("honorDescription");
|
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("ptqIds");
|
|
|
|
|
List<Long> ptqIds = jsonArray != null ? jsonArray.toJavaList(Long.class) : new ArrayList<>();
|
|
|
|
|
List<String> honorEmployees = new ArrayList<>();
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel)) {
|
|
|
|
|
Honor honor = new Honor();
|
|
|
|
|
honor.setHonorLevel(honorLevel);
|
|
|
|
|
honor.setState(Constants.STATE_VALID);
|
|
|
|
|
List<Honor> honors = honorMapper.select(honor);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel) || StringUtils.isNotEmpty(honorDescription)) {
|
|
|
|
|
Example example1 = new Example(Honor.class);
|
|
|
|
|
Example.Criteria criteria1 = example1.createCriteria();
|
|
|
|
|
criteria1.andEqualTo("state",Constants.STATE_VALID);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel)) {
|
|
|
|
|
criteria1.andEqualTo("honorLevel", honorLevel);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(honorDescription)) {
|
|
|
|
|
criteria1.andLike("honorDescription", "%"+honorDescription+"%");
|
|
|
|
|
}
|
|
|
|
|
List<Honor> honors = honorMapper.selectByExample(example1);
|
|
|
|
|
honorEmployees.addAll(honors.stream().map(item -> item.getEmployeeNo()).collect(Collectors.toSet()));
|
|
|
|
|
}
|
|
|
|
|
Integer current = jsonObject.getInteger("current") == null ? 1 : jsonObject.getInteger("current");
|
|
|
|
@ -68,11 +78,11 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|
|
|
|
if (StringUtils.isNotEmpty(employee.getMobile())) criteria.andLike("mobile", "%"+employee.getMobile()+"%");
|
|
|
|
|
if (null != employee.getPostId()) criteria.andEqualTo("postId", employee.getPostId());
|
|
|
|
|
if (null != employee.getGroupsId()) criteria.andEqualTo("groupsId", employee.getGroupsId());
|
|
|
|
|
if (null != employee.getPtqId()) criteria.andEqualTo("ptqId", employee.getPtqId());
|
|
|
|
|
if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds);
|
|
|
|
|
if (null != employee.getSkillLevelId()) criteria.andEqualTo("skillLevelId", employee.getSkillLevelId());
|
|
|
|
|
if (null != employee.getHighestEducationId()) criteria.andEqualTo("highestEducationId", employee.getHighestEducationId());
|
|
|
|
|
List<Employee> employeeList = employeeMapper.selectByExample(example);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel) && honorEmployees.size() == 0) employeeList = new ArrayList<>();
|
|
|
|
|
if ((StringUtils.isNotEmpty(honorLevel) || StringUtils.isNotEmpty(honorDescription)) && honorEmployees.size() == 0) employeeList = new ArrayList<>();
|
|
|
|
|
JSONObject pageJson = PageUtils.page(employeeList,current,pageSize);
|
|
|
|
|
return pageJson;
|
|
|
|
|
}
|
|
|
|
@ -85,12 +95,21 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andEqualTo("state",Constants.STATE_VALID);
|
|
|
|
|
String honorLevel = jsonObject.getString("honorLevel");
|
|
|
|
|
String honorDescription = jsonObject.getString("honorDescription");
|
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("ptqIds");
|
|
|
|
|
List<Long> ptqIds = jsonArray.toJavaList(Long.class);
|
|
|
|
|
List<String> honorEmployees = new ArrayList<>();
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel)) {
|
|
|
|
|
Honor honor = new Honor();
|
|
|
|
|
honor.setHonorLevel(honorLevel);
|
|
|
|
|
honor.setState(Constants.STATE_VALID);
|
|
|
|
|
List<Honor> honors = honorMapper.select(honor);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel) || StringUtils.isNotEmpty(honorDescription)) {
|
|
|
|
|
Example example1 = new Example(Honor.class);
|
|
|
|
|
Example.Criteria criteria1 = example1.createCriteria();
|
|
|
|
|
criteria1.andEqualTo("state",Constants.STATE_VALID);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel)) {
|
|
|
|
|
criteria1.andEqualTo("honorLevel", honorLevel);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(honorDescription)) {
|
|
|
|
|
criteria1.andLike("honorDescription", "%"+honorDescription+"%");
|
|
|
|
|
}
|
|
|
|
|
List<Honor> honors = honorMapper.selectByExample(example1);
|
|
|
|
|
honorEmployees.addAll(honors.stream().map(item -> item.getEmployeeNo()).collect(Collectors.toSet()));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(employee.getEmployeeNo())) criteria.andLike("employeeNo", "%"+employee.getEmployeeNo()+"%");
|
|
|
|
@ -99,11 +118,11 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|
|
|
|
if (StringUtils.isNotEmpty(employee.getMobile())) criteria.andLike("mobile", "%"+employee.getMobile()+"%");
|
|
|
|
|
if (null != employee.getPostId()) criteria.andEqualTo("postId", employee.getPostId());
|
|
|
|
|
if (null != employee.getGroupsId()) criteria.andEqualTo("groupsId", employee.getGroupsId());
|
|
|
|
|
if (null != employee.getPtqId()) criteria.andEqualTo("ptqId", employee.getPtqId());
|
|
|
|
|
if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds);
|
|
|
|
|
if (null != employee.getSkillLevelId()) criteria.andEqualTo("skillLevelId", employee.getSkillLevelId());
|
|
|
|
|
if (null != employee.getHighestEducationId()) criteria.andEqualTo("highestEducationId", employee.getHighestEducationId());
|
|
|
|
|
List<Employee> employeeList = employeeMapper.selectByExample(example);
|
|
|
|
|
if (StringUtils.isNotEmpty(honorLevel) && honorEmployees.size() == 0) employeeList = new ArrayList<>();
|
|
|
|
|
if ((StringUtils.isNotEmpty(honorLevel) || StringUtils.isNotEmpty(honorDescription)) && honorEmployees.size() == 0) employeeList = new ArrayList<>();
|
|
|
|
|
ExportParams exportParams = new ExportParams();
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams,Employee.class, employeeList);
|
|
|
|
|
ExcelUtils.export(workbook, response, "员工导出");
|
|
|
|
@ -198,7 +217,7 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|
|
|
|
employeeListUpdate.add(employee);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
employeeMapper.insertList(employeeListInsert);
|
|
|
|
|
if(employeeListInsert.size() > 0) employeeMapper.insertList(employeeListInsert);
|
|
|
|
|
if (employeeListUpdate != null && employeeListUpdate.size() != 0) {
|
|
|
|
|
for (Employee employee : employeeListUpdate) {
|
|
|
|
|
employeeMapper.updateByPrimaryKey(employee);
|
|
|
|
|