master
Joe 2 years ago
parent 972637e3ab
commit fe9be91df2

Binary file not shown.

@ -47,7 +47,7 @@ public class Honor {
*
* @mbggenerated Wed May 03 18:26:57 CST 2023
*/
@Excel(name = "荣誉说明", orderNum = "3")
@Excel(name = "奖惩内容", orderNum = "3")
private String honorDescription;
/**

@ -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);

@ -48,7 +48,7 @@ public class InfoSettingServiceImpl implements InfoSettingService {
AjaxResult ajaxResult = new AjaxResult();
InfoSetting infoSetting = JSONObject.toJavaObject(jsonObject, InfoSetting.class);
JSONArray jsonArray = jsonObject.getJSONArray("infoSettingValues");
List<InfoSettingValue> infoSettingValues = jsonArray.toJavaList(InfoSettingValue.class);
List<InfoSettingValue> infoSettingValues = jsonArray != null ? jsonArray.toJavaList(InfoSettingValue.class) : new ArrayList<>();
infoSetting.setState(Constants.ENABLE);
if (null == infoSetting.getId()) {
infoSetting.setState(Constants.ENABLE);
@ -59,7 +59,7 @@ public class InfoSettingServiceImpl implements InfoSettingService {
}
infoSettingValue.setState(Constants.ENABLE);
}
infoSettingValueMapper.insertList(infoSettingValues);
if (infoSettingValues.size() > 0) infoSettingValueMapper.insertList(infoSettingValues);
} else {
infoSettingMapper.updateByPrimaryKey(infoSetting);
InfoSettingValue infoSettingValue = new InfoSettingValue();
@ -69,7 +69,7 @@ public class InfoSettingServiceImpl implements InfoSettingService {
infoSettingValue1.setSettingId(infoSetting.getId());
infoSettingValue.setState(Constants.ENABLE);
}
infoSettingValueMapper.insertList(infoSettingValues);
if (infoSettingValues.size() > 0) infoSettingValueMapper.insertList(infoSettingValues);
}
return ajaxResult;
}

Loading…
Cancel
Save