修改导入模板

This commit is contained in:
mash 2024-11-12 14:36:54 +08:00
parent ac5577fecc
commit 109ac5d32e
7 changed files with 441 additions and 305 deletions

View File

@ -1,5 +1,9 @@
package com.ydool.staff.controller; package com.ydool.staff.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController; import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant; import com.ydool.common.constant.UrlConstant;
@ -8,31 +12,37 @@ import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto; import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.SelectRequest; import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.excel.ExcelPersonnel; import com.ydool.staff.excel.ExcelPersonnel;
import com.ydool.staff.request.ChangeRequest; import com.ydool.staff.excel.PersonnelExportVO;
import com.ydool.staff.request.GiveAuditRequest; import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService; import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.DictData;
import com.ydool.system.service.impl.DictDataServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author msh * @author msh
@ -48,9 +58,11 @@ public class PersonnelController extends BaseController {
private IPersonnelService personnelService; private IPersonnelService personnelService;
@Autowired @Autowired
IAttachmentService attachmentService; IAttachmentService attachmentService;
@Autowired
DictDataServiceImpl dataService;
@PostMapping( "personnelList") @PostMapping("personnelList")
@ApiOperation(value = "人员列表",response = PersonnelDto.class) @ApiOperation(value = "人员列表", response = PersonnelDto.class)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "orderBy", value = "排序顺序 降序desc升序asc"), @ApiImplicitParam(name = "orderBy", value = "排序顺序 降序desc升序asc"),
@ApiImplicitParam(name = "column", value = "排序字段 字段名"), @ApiImplicitParam(name = "column", value = "排序字段 字段名"),
@ -59,53 +71,132 @@ public class PersonnelController extends BaseController {
@ApiImplicitParam(name = "isInfo", value = "是否退休列表"), @ApiImplicitParam(name = "isInfo", value = "是否退休列表"),
@ApiImplicitParam(name = "deptId", value = "部门id"), @ApiImplicitParam(name = "deptId", value = "部门id"),
}) })
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column,Boolean isInfo,String deptId){ public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy, String column, Boolean isInfo, String deptId) {
return personnelService.personnelList(getPage(),request,orderBy,column,isInfo,deptId); return personnelService.personnelList(getPage(), request, orderBy, column, isInfo, deptId);
} }
@GetMapping("getById") @GetMapping("getById")
@ApiOperation(value = "查询一条",response = PersonnelUpdateDto.class) @ApiOperation(value = "查询一条", response = PersonnelUpdateDto.class)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id",value = "id" ), @ApiImplicitParam(name = "id", value = "id"),
@ApiImplicitParam(name = "type",value = "修改类型修改传update审批传audit" ), @ApiImplicitParam(name = "type", value = "修改类型修改传update审批传audit"),
@ApiImplicitParam(name = "personnelType",value = "人员类型人员personnel变更change" ), @ApiImplicitParam(name = "personnelType", value = "人员类型人员personnel变更change"),
}) })
public AjaxResult getById(String id,String type,String personnelType){ public AjaxResult getById(String id, String type, String personnelType) {
return personnelService.getById(id,type,personnelType); return personnelService.getById(id, type, personnelType);
} }
@PostMapping(value = "savePersonnel") @PostMapping(value = "savePersonnel")
@ApiOperation(value = "新增人员申报",response = PersonnelRequest.class) @ApiOperation(value = "新增人员申报", response = PersonnelRequest.class)
public AjaxResult savePersonnel(@Validated @RequestBody PersonnelRequest personnelRequest){ public AjaxResult savePersonnel(@Validated @RequestBody PersonnelRequest personnelRequest) {
return personnelService.savePersonnel(personnelRequest); return personnelService.savePersonnel(personnelRequest);
} }
@PostMapping(value = "deletePersonnel") @PostMapping(value = "deletePersonnel")
@ApiOperation(value = "删除/批量删除人员",response = PersonnelDeleteRequest.class) @ApiOperation(value = "删除/批量删除人员", response = PersonnelDeleteRequest.class)
public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest request){ public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest request) {
return personnelService.deleteByIds(request); return personnelService.deleteByIds(request);
} }
@PostMapping(value = "updatePersonnel") @PostMapping(value = "updatePersonnel")
@ApiOperation(value = "修改人员") @ApiOperation(value = "修改人员")
public AjaxResult updatePersonnel(@RequestBody PersonnelUpdateRequest personnelDeleteRequest){ public AjaxResult updatePersonnel(@RequestBody PersonnelUpdateRequest personnelDeleteRequest) {
return personnelService.updatePersonnel(personnelDeleteRequest); return personnelService.updatePersonnel(personnelDeleteRequest);
} }
@PostMapping(value = "updateChange") @PostMapping(value = "updateChange")
@ApiOperation(value = "人员变更") @ApiOperation(value = "人员变更")
public AjaxResult updateChange(@RequestBody PersonnelUpdateRequest request){ public AjaxResult updateChange(@RequestBody PersonnelUpdateRequest request) {
return personnelService.updateChange(request); return personnelService.updateChange(request);
} }
@GetMapping("getEntityParam") @GetMapping("getEntityParam")
@ApiOperation(value = "获取实体参数名",response = ExcelPersonnel.class) @ApiOperation(value = "获取实体参数名", response = ExcelPersonnel.class)
public AjaxResult getEntityParam(){ public AjaxResult getEntityParam() {
return personnelService.getEntityParam(); return personnelService.getEntityParam();
} }
@PostMapping("export") @PostMapping("export")
@ApiOperation(value = "导出接口") @ApiOperation(value = "导出接口")
public void export(@RequestBody PersonnelDeleteRequest personnelParam,HttpServletResponse response){ public void export(@RequestBody PersonnelDeleteRequest personnelParam, HttpServletResponse response) {
personnelService.export(personnelParam,response); personnelService.export(personnelParam, response);
}
@GetMapping("import-template")
@ApiOperation(value = "导入模板")
public void importTemplate(HttpServletResponse response) {
try {
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
String fileName = URLEncoder.encode("企业人员申报.xlsx", StandardCharsets.UTF_8.name());
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
Map<String, List<String>> dicData = getDictData();
// 创建ExcelWriter对象并指定模板
EasyExcel.write(response.getOutputStream(), PersonnelExportVO.class)
.registerWriteHandler(new SheetWriteHandler() {
@Override
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
}
@Override
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
Field[] declaredFields = writeSheetHolder.getClazz().getDeclaredFields();
// 创建约束指定下拉列表的选项
for (int i = 0; i < declaredFields.length; i++) {
String name = declaredFields[i].getName();
List<String> listOfValues = dicData.get(name);
if (listOfValues != null && !listOfValues.isEmpty()) {
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 20000, i, i);
DataValidationHelper helper = writeSheetHolder.getSheet().getDataValidationHelper();
DataValidationConstraint constraint = helper.createExplicitListConstraint(listOfValues.toArray(new String[0]));
DataValidation dataValidation = helper.createValidation(constraint, cellRangeAddressList);
dataValidation.setShowErrorBox(true);
writeSheetHolder.getSheet().addValidationData(dataValidation);
}
}
}
})
.sheet("企业人员申报").doWrite(new ArrayList<PersonnelExportVO>()); // 这里传null是因为我们只是导出模板没有数据需要写入
} catch (Exception e) {
e.printStackTrace();
}
}
private Map<String, List<String>> getDictData() {
Map<String, String> codeKeyMap = getStringStringMap();
Map<String, List<String>> map = new HashMap<>();
codeKeyMap.forEach((code, key) -> {
List<DictData> dictDataList = dataService.listByCode(code);
List<String> dataList = dictDataList.stream().map(DictData::getLabel).collect(Collectors.toList());
map.put(key, dataList);
});
List<DictData> dictSex = dataService.listByCode("t_dict_sex");
List<String> gender = dictSex.stream().map(DictData::getValue).collect(Collectors.toList());
map.put("gender", gender);
map.put("personnelCharacter", Arrays.asList("年薪人员", "非年薪人员"));
map.put("freshGraduate", Arrays.asList("", ""));
return map;
}
private static Map<String, String> getStringStringMap() {
Map<String, String> codeKeyMap = new HashMap<>();
codeKeyMap.put("t_dict_nation", "nation");
codeKeyMap.put("t_dict_politics_status", "politicsStatus");
codeKeyMap.put("t_dict_education", "education");
codeKeyMap.put("t_dict_specialty_name", "jobTitle");
codeKeyMap.put("t_dict_position", "position");
codeKeyMap.put("t_dict_personnel_type", "personnelType");
codeKeyMap.put("t_dict_department", "presentDept");
codeKeyMap.put("t_dict_contract_form", "contractModality");
codeKeyMap.put("t_dict_hire", "hireType");
codeKeyMap.put("t_dict_credentials", "qualification");
codeKeyMap.put("t_dict_staff_state", "workState");
return codeKeyMap;
} }
/** /**
@ -123,7 +214,7 @@ public class PersonnelController extends BaseController {
@PostMapping(value = "giveAudit") @PostMapping(value = "giveAudit")
@ApiOperation(value = "送审") @ApiOperation(value = "送审")
public AjaxResult giveAudit(@RequestBody GiveAuditRequest request){ public AjaxResult giveAudit(@RequestBody GiveAuditRequest request) {
return personnelService.giveAudit(request); return personnelService.giveAudit(request);
} }
@ -131,15 +222,15 @@ public class PersonnelController extends BaseController {
@ApiOperation(value = "查看近两月是否有人退休") @ApiOperation(value = "查看近两月是否有人退休")
@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/ @Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/
//@Scheduled(cron = "0 */1 * * * ?") /*每分钟更新一次*/ //@Scheduled(cron = "0 */1 * * * ?") /*每分钟更新一次*/
public void getPersonnelRetire(){ public void getPersonnelRetire() {
personnelService.getPersonnelRetire(); personnelService.getPersonnelRetire();
} }
@GetMapping("updatePersonnelRetire") @GetMapping("updatePersonnelRetire")
@ApiOperation(value = "处理退休事件") @ApiOperation(value = "处理退休事件")
@ApiImplicitParam(name = "id",value = "人员id") @ApiImplicitParam(name = "id", value = "人员id")
public AjaxResult updatePersonnelRetire(String id){ public AjaxResult updatePersonnelRetire(String id) {
return personnelService.updatePersonnelRetire(id); return personnelService.updatePersonnelRetire(id);
} }
} }

View File

@ -7,10 +7,10 @@ import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle; import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.ydool.common.converter.EasyExcelLocalDateConverter; import com.ydool.common.converter.EasyExcelLocalDateConverter;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment;
import java.time.LocalDate; import java.time.LocalDate;
@ -26,27 +26,27 @@ import java.time.LocalDate;
@ContentStyle(verticalAlignment = VerticalAlignment.CENTER) @ContentStyle(verticalAlignment = VerticalAlignment.CENTER)
public class ExcelPersonnel { public class ExcelPersonnel {
@ExcelProperty(value = "统一社会信用代码" ) @ExcelProperty(value = "统一社会信用代码")
@ApiModelProperty(value = "统一社会信用代码") @ApiModelProperty(value = "统一社会信用代码")
private String socialCreditCode; private String socialCreditCode;
@ExcelProperty("姓名")
@ApiModelProperty(value = "姓名")
private String userName;
@ExcelProperty("企业名称") @ExcelProperty("企业名称")
@ApiModelProperty(value = "企业名称") @ApiModelProperty(value = "企业名称")
private String companyName; private String companyName;
@ExcelProperty("姓名")
@ApiModelProperty(value = "姓名")
private String userName;
@ExcelProperty("性别") @ExcelProperty("性别")
@ApiModelProperty(value = "性别") @ApiModelProperty(value = "性别")
private String gender; private String gender;
@ExcelProperty(value = "出生日期" , converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "出生日期", converter = EasyExcelLocalDateConverter.class)
@ApiModelProperty(value = "出生日期") @ApiModelProperty(value = "出生日期")
private LocalDate birthday; private LocalDate birthday;
@ -136,7 +136,7 @@ public class ExcelPersonnel {
private Integer annualSalary; private Integer annualSalary;
@ExcelProperty(value = "入职时间" , converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "入职时间", converter = EasyExcelLocalDateConverter.class)
@ApiModelProperty(value = "入职时间") @ApiModelProperty(value = "入职时间")
private LocalDate hireDate; private LocalDate hireDate;
@ -146,17 +146,17 @@ public class ExcelPersonnel {
private LocalDate retirementTime; private LocalDate retirementTime;
@ExcelProperty(value ="离职时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "离职时间", converter = EasyExcelLocalDateConverter.class)
@ApiModelProperty(value = "离职时间") @ApiModelProperty(value = "离职时间")
private LocalDate resignationTime; private LocalDate resignationTime;
@ExcelProperty(value = "退休返聘开始时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘开始时间", converter = EasyExcelLocalDateConverter.class)
@ApiModelProperty(value = "退休返聘开始时间") @ApiModelProperty(value = "退休返聘开始时间")
private LocalDate txfpStartTime; private LocalDate txfpStartTime;
@ExcelProperty(value = "退休返聘结束时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘结束时间", converter = EasyExcelLocalDateConverter.class)
@ApiModelProperty(value = "退休返聘结束时间") @ApiModelProperty(value = "退休返聘结束时间")
private LocalDate txfpEndTime; private LocalDate txfpEndTime;

View File

@ -2,38 +2,37 @@ package com.ydool.staff.excel;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.ydool.common.converter.EasyExcelLocalDateConverter; import com.ydool.common.converter.EasyExcelLocalDateConverter;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import java.time.LocalDate; import java.time.LocalDate;
@Data @Data
@AllArgsConstructor @HeadRowHeight(20)
@NoArgsConstructor @ColumnWidth(20)
@HeadStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@ContentStyle(verticalAlignment = VerticalAlignment.CENTER)
public class PersonnelExportVO { public class PersonnelExportVO {
@ExcelProperty(value = "统一社会信用代码" )
private String socialCreditCode;
@ExcelProperty("姓名")
private String userName;
@ExcelProperty("企业名称") @ExcelProperty("企业名称")
private String companyName; private String companyName;
@ExcelProperty("姓名")
private String userName;
@ExcelProperty("性别") @ExcelProperty("性别")
private String gender; private String gender;
@ExcelProperty(value = "出生日期" , converter = EasyExcelLocalDateConverter.class)
private LocalDate birthday;
@ExcelProperty("身份证号") @ExcelProperty("身份证号")
private String numberId; private String numberId;
@ -66,7 +65,7 @@ public class PersonnelExportVO {
private String hireType; private String hireType;
@ExcelProperty("执业资格证书") @ExcelProperty("执业资格")
private String qualification; private String qualification;
@ -90,7 +89,7 @@ public class PersonnelExportVO {
private String personnelType; private String personnelType;
@ExcelProperty("状态") @ExcelProperty("工状态")
private String workState; private String workState;
@ -102,23 +101,19 @@ public class PersonnelExportVO {
private Integer annualSalary; private Integer annualSalary;
@ExcelProperty(value = "入职时间" , converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "入职时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate hireDate; private LocalDate hireDate;
@ExcelProperty(value = "退休时间", converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "离职时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate retirementTime;
@ExcelProperty(value ="离职时间",converter = EasyExcelLocalDateConverter.class)
private LocalDate resignationTime; private LocalDate resignationTime;
@ExcelProperty(value = "退休返聘开始时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘开始时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate txfpStartTime; private LocalDate txfpStartTime;
@ExcelProperty(value = "退休返聘结束时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘结束时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate txfpEndTime; private LocalDate txfpEndTime;
@ -130,21 +125,4 @@ public class PersonnelExportVO {
private String remark; private String remark;
@ExcelProperty("初审意见")
private String firstTrialRemark;
@ExcelProperty("终审意见")
private String finalTrialRemark;
@ExcelProperty("变更标志")
private String alterationSign;
@ExcelProperty("单据状态")
private String receipts;
} }

View File

@ -1,10 +1,14 @@
package com.ydool.staff.excel; package com.ydool.staff.excel;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.ydool.common.converter.EasyExcelLocalDateConverter; import com.ydool.common.converter.EasyExcelLocalDateConverter;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import java.time.LocalDate; import java.time.LocalDate;
@ -14,8 +18,10 @@ import java.time.LocalDate;
* @date 2023/2/14 11:55 * @date 2023/2/14 11:55
*/ */
@Data @Data
@AllArgsConstructor @HeadRowHeight(20)
@NoArgsConstructor @ColumnWidth(20)
@HeadStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@ContentStyle(verticalAlignment = VerticalAlignment.CENTER)
public class PersonnelFailMsgVO { public class PersonnelFailMsgVO {
@ExcelProperty("统一社会信用代码") @ExcelProperty("统一社会信用代码")
@ -34,7 +40,7 @@ public class PersonnelFailMsgVO {
private String gender; private String gender;
@ExcelProperty(value = "出生日期" , converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "出生日期", converter = EasyExcelLocalDateConverter.class)
private LocalDate birthday; private LocalDate birthday;
@ExcelProperty("身份证号") @ExcelProperty("身份证号")
@ -105,7 +111,7 @@ public class PersonnelFailMsgVO {
private Integer annualSalary; private Integer annualSalary;
@ExcelProperty(value = "入职时间" , converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "入职时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate hireDate; private LocalDate hireDate;
@ -113,15 +119,15 @@ public class PersonnelFailMsgVO {
private LocalDate retirementTime; private LocalDate retirementTime;
@ExcelProperty(value ="离职时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "离职时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate resignationTime; private LocalDate resignationTime;
@ExcelProperty(value = "退休返聘开始时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘开始时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate txfpStartTime; private LocalDate txfpStartTime;
@ExcelProperty(value = "退休返聘结束时间",converter = EasyExcelLocalDateConverter.class) @ExcelProperty(value = "退休返聘结束时间", converter = EasyExcelLocalDateConverter.class)
private LocalDate txfpEndTime; private LocalDate txfpEndTime;
@ -133,22 +139,6 @@ public class PersonnelFailMsgVO {
private String remark; private String remark;
@ExcelProperty("初审意见")
private String firstTrialRemark;
@ExcelProperty("终审意见")
private String finalTrialRemark;
@ExcelProperty("变更标志")
private String alterationSign;
@ExcelProperty("单据状态")
private String receipts;
@ExcelProperty(value = "结果") @ExcelProperty(value = "结果")
private String failMsg; private String failMsg;
} }

View File

@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@ -93,6 +94,15 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
if (CollectionUtil.isEmpty(asList)) { if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空"); return AjaxResult.fail().msg("Id不能为空");
} else { } else {
List<String> organizationIds = organizationMapper.selectList(Wrappers.lambdaQuery(Organization.class).eq(Organization::getAuditState, 3).in(Organization::getId, asList))
.stream().map(Organization::getId).collect(Collectors.toList());
List<Places> places = placesMapper.selectList(Wrappers.lambdaQuery(Places.class).in(Places::getOrganizationId, organizationIds));
if (places.stream().anyMatch(e -> personnelService.count(Wrappers.lambdaQuery(Personnel.class).eq(Personnel::getRecruitNumber, e.getOdd())) > 0)) {
return AjaxResult.fail("招聘单号已被使用!");
}
int i = organizationMapper.deleteBatchIds(asList); int i = organizationMapper.deleteBatchIds(asList);
if (i > 0) { if (i > 0) {
personnelIndicatorsMapper.delete(new LambdaQueryWrapper<PersonnelIndicators>().in(PersonnelIndicators::getOrganizationId, asList)); personnelIndicatorsMapper.delete(new LambdaQueryWrapper<PersonnelIndicators>().in(PersonnelIndicators::getOrganizationId, asList));
@ -173,7 +183,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
.orderByAsc(Places::getOdd)); .orderByAsc(Places::getOdd));
for (Places place : places) { for (Places place : places) {
int count = personnelService.count(new LambdaQueryWrapper<Personnel>().eq(Personnel::getRecruitNumber, place.getOdd())); int count = personnelService.count(new LambdaQueryWrapper<Personnel>().eq(Personnel::getRecruitNumber, place.getOdd()));
if (count<place.getSum()){ if (count < place.getSum()) {
PlacesDto dto = BeanUtil.copyProperties(place, PlacesDto.class); PlacesDto dto = BeanUtil.copyProperties(place, PlacesDto.class);
dtoList.add(dto); dtoList.add(dto);
} }

View File

@ -11,6 +11,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.common.cache.ConfigCache; import com.ydool.common.cache.ConfigCache;
@ -19,21 +20,13 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.CacheUtil; import com.ydool.common.utils.CacheUtil;
import com.ydool.common.utils.ColumnUtil; import com.ydool.common.utils.ColumnUtil;
import com.ydool.common.utils.EasyExcelAlibabaUtil; import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.oa.workFlow.data.entity.WorkFlow;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice; import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService; import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.staff.dto.AttachmentDto; import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.PersonnelByExchangeDto; import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.dto.PersonnelDto; import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto; import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Alteration; import com.ydool.staff.entity.*;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.PersonnelMiddle;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.excel.ExcelPersonnel; import com.ydool.staff.excel.ExcelPersonnel;
import com.ydool.staff.excel.PersonnelExportVO; import com.ydool.staff.excel.PersonnelExportVO;
import com.ydool.staff.excel.PersonnelFailMsgVO; import com.ydool.staff.excel.PersonnelFailMsgVO;
@ -54,32 +47,25 @@ import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IAuditService; import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IPersonnelMiddleService; import com.ydool.staff.service.IPersonnelMiddleService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.Config; import com.ydool.system.entity.*;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper; import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.DeptMapper; import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper; import com.ydool.system.mapper.UserMapper;
import com.ydool.system.service.impl.DictDataServiceImpl;
import com.ydool.system.service.impl.DictTypeServiceImpl;
import com.ydool.system.service.impl.UserServiceImpl; import com.ydool.system.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.time.format.DateTimeFormatter;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -135,6 +121,10 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Autowired @Autowired
private UserServiceImpl userService; private UserServiceImpl userService;
@Autowired
DictDataServiceImpl dictDataService;
@Autowired
DictTypeServiceImpl dictTypeService;
/** /**
* 人员列表 * 人员列表
@ -142,8 +132,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @return * @return
*/ */
@Override @Override
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo,String deptId) { public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo, String deptId) {
QueryWrapper<Personnel> wrapper = selectWrapper(request, orderBy, column,isInfo); QueryWrapper<Personnel> wrapper = selectWrapper(request, orderBy, column, isInfo);
User user = userService.getOne(new QueryWrapper<User>().lambda() User user = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getId, StpUtil.getLoginIdAsString()) .eq(User::getId, StpUtil.getLoginIdAsString())
.last("limit 1") .last("limit 1")
@ -161,9 +151,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class); PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName()); CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
Dept dept = deptMapper.selectById(e.getPresentDept()); Dept dept = deptMapper.selectById(e.getPresentDept());
dto.setAlterationSign("0".equals(e.getAlterationSign())?"未变更":("1".equals(e.getAlterationSign())?"变更中":"变更完成")); dto.setAlterationSign("0".equals(e.getAlterationSign()) ? "未变更" : ("1".equals(e.getAlterationSign()) ? "变更中" : "变更完成"));
dto.setChangeAlterationSign("0".equals(e.getChangeAlterationSign())?"未变更":("1".equals(e.getChangeAlterationSign())?"变更中":"变更完成")); dto.setChangeAlterationSign("0".equals(e.getChangeAlterationSign()) ? "未变更" : ("1".equals(e.getChangeAlterationSign()) ? "变更中" : "变更完成"));
if (ObjectUtil.isNotNull(companyName)){ if (ObjectUtil.isNotNull(companyName)) {
dto.setCompanyName(companyName.getCompanyName()); dto.setCompanyName(companyName.getCompanyName());
} }
if (ObjectUtil.isNotNull(dept)) { if (ObjectUtil.isNotNull(dept)) {
@ -181,34 +171,34 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @param type update修改 audit审批 * @param type update修改 audit审批
* @return * @return
*/ */
public AjaxResult getById(String id,String type,String personnelType) { public AjaxResult getById(String id, String type, String personnelType) {
if (StrUtil.isBlank(id)) { if (StrUtil.isBlank(id)) {
return AjaxResult.fail().msg("id不能为空查询失败"); return AjaxResult.fail().msg("id不能为空查询失败");
} }
Personnel personnel = new Personnel(); Personnel personnel = new Personnel();
if (!type.equals(ArgsConst.UPDATE)){ if (!type.equals(ArgsConst.UPDATE)) {
BeanUtil.copyProperties(personnelMapper.selectById(id),personnel); BeanUtil.copyProperties(personnelMapper.selectById(id), personnel);
}else { } else {
LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>() LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>()
.eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getState, "1") .eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getState, "1")
.eq(PersonnelMiddle::getType, personnelType); .eq(PersonnelMiddle::getType, personnelType);
PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper); PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(middle)){ if (ObjectUtil.isNotEmpty(middle)) {
BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel); BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()), personnel);
}else { } else {
BeanUtil.copyProperties(personnelMapper.selectById(id),personnel); BeanUtil.copyProperties(personnelMapper.selectById(id), personnel);
} }
} }
if (ObjectUtil.isEmpty(personnel))return AjaxResult.fail().msg("该人员不存在!"); if (ObjectUtil.isEmpty(personnel)) return AjaxResult.fail().msg("该人员不存在!");
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class); PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
LambdaQueryWrapper<Audit> wrapper = new LambdaQueryWrapper<Audit>() LambdaQueryWrapper<Audit> wrapper = new LambdaQueryWrapper<Audit>()
.eq(Audit::getPersonnelId, id) .eq(Audit::getPersonnelId, id)
.eq(Audit::getPerType,personnelType) .eq(Audit::getPerType, personnelType)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString()) .eq(Audit::getApprover, StpUtil.getLoginIdAsString())
.eq(Audit::getAuditState, ArgsConst.WAITING); .eq(Audit::getAuditState, ArgsConst.WAITING);
Audit audit = auditMapper.selectOne(wrapper); Audit audit = auditMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(audit)){ if (ObjectUtil.isNotEmpty(audit)) {
personnelUpdateDto.setAuditBtn(true); personnelUpdateDto.setAuditBtn(true);
} }
personnelUpdateDto.setBeforeId(id); personnelUpdateDto.setBeforeId(id);
@ -225,13 +215,13 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult personnelByExchangeList() { public AjaxResult personnelByExchangeList() {
List<Personnel> list = list(new LambdaQueryWrapper<Personnel>().eq(Personnel::getState,"2").eq(Personnel::getAuditState,3).eq(Personnel::getWorkState,"在职")); List<Personnel> list = list(new LambdaQueryWrapper<Personnel>().eq(Personnel::getState, "2").eq(Personnel::getAuditState, 3).eq(Personnel::getWorkState, "在职"));
List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class); List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class);
for (PersonnelByExchangeDto dto : dtos) { for (PersonnelByExchangeDto dto : dtos) {
CompanyName companyName = companyNameMapper.selectById(dto.getCompanyName()); CompanyName companyName = companyNameMapper.selectById(dto.getCompanyName());
dto.setCompanyName(companyName.getCompanyName()); dto.setCompanyName(companyName.getCompanyName());
//Dept dept = deptMapper.selectById(dto.getPresentDept()); // Dept dept = deptMapper.selectById(dto.getPresentDept());
//dto.setPresentDept(dept.getName()); // dto.setPresentDept(dept.getName());
} }
return AjaxResult.ok().data(dtos); return AjaxResult.ok().data(dtos);
} }
@ -245,7 +235,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) { public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
if (!IdcardUtil.isValidCard(personnelRequest.getNumberId())){ if (!IdcardUtil.isValidCard(personnelRequest.getNumberId())) {
return AjaxResult.fail().msg("身份证号格式不正确!"); return AjaxResult.fail().msg("身份证号格式不正确!");
} }
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class); Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
@ -260,7 +250,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getJobTitleFile(), ArgsConst.JOBTITLE_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getJobTitleFile(), ArgsConst.JOBTITLE_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, personnel.getId(), ArgsConst.SAVE);
if("audit".equals(personnelRequest.getType())){ if ("audit".equals(personnelRequest.getType())) {
personnel.setAlterationSign("1"); personnel.setAlterationSign("1");
updateById(personnel); updateById(personnel);
GiveAuditRequest request = new GiveAuditRequest(); GiveAuditRequest request = new GiveAuditRequest();
@ -278,9 +268,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public AjaxResult deleteByIds(PersonnelDeleteRequest ids) { public AjaxResult deleteByIds(PersonnelDeleteRequest ids) {
List<String> asList = Arrays.asList(ids.getIds()); List<String> asList = Arrays.asList(ids.getIds());
for (String s : asList) { for (String s : asList) {
Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper<Personnel>().eq(Personnel::getId,s).eq(Personnel::getAlterationSign,"1") Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper<Personnel>().eq(Personnel::getId, s).eq(Personnel::getAlterationSign, "1")
.eq(Personnel::getChangeAlterationSign,"1").in(Personnel::getAuditState,1,2).in(Personnel::getChangeAuditState,1,2)); .eq(Personnel::getChangeAlterationSign, "1").in(Personnel::getAuditState, 1, 2).in(Personnel::getChangeAuditState, 1, 2));
if (ObjectUtil.isNotEmpty(personnel)){ if (ObjectUtil.isNotEmpty(personnel)) {
return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!"); return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!");
} }
} }
@ -306,19 +296,19 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ','); String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String engage = StringUtils.join(saveFilePath(engageFile, ArgsConst.ENGAGE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ','); String engage = StringUtils.join(saveFilePath(engageFile, ArgsConst.ENGAGE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String job = StringUtils.join(saveFilePath(jobTitleFile, ArgsConst.JOBTITLE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ','); String job = StringUtils.join(saveFilePath(jobTitleFile, ArgsConst.JOBTITLE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
if (StrUtil.isNotBlank(card)){ if (StrUtil.isNotBlank(card)) {
per.setCardFile(card); per.setCardFile(card);
} }
if (StrUtil.isNotBlank(education)){ if (StrUtil.isNotBlank(education)) {
per.setEducationFile(education); per.setEducationFile(education);
} }
if (StrUtil.isNotBlank(audit)){ if (StrUtil.isNotBlank(audit)) {
per.setAuditFile(audit); per.setAuditFile(audit);
} }
if (StrUtil.isNotBlank(engage)){ if (StrUtil.isNotBlank(engage)) {
per.setEngageFile(engage); per.setEngageFile(engage);
} }
if (StrUtil.isNotBlank(job)){ if (StrUtil.isNotBlank(job)) {
per.setJobTitleFile(job); per.setJobTitleFile(job);
} }
saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE); saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE);
@ -329,7 +319,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setState("2"); per.setState("2");
per.setAlterationSign("1"); per.setAlterationSign("1");
boolean update = updateById(per); boolean update = updateById(per);
if("audit".equals(updateRequest.getType())){ if ("audit".equals(updateRequest.getType())) {
GiveAuditRequest request = new GiveAuditRequest(); GiveAuditRequest request = new GiveAuditRequest();
String[] ids = new String[]{per.getId()}; String[] ids = new String[]{per.getId()};
request.setIds(ids); request.setIds(ids);
@ -349,13 +339,18 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
List<AttachmentRequest> auditFiles = request.getAuditFileList(); List<AttachmentRequest> auditFiles = request.getAuditFileList();
PersonnelMiddle middle = new PersonnelMiddle(); PersonnelMiddle middle = new PersonnelMiddle();
String type = ArgsConst.CHANGE; String type = ArgsConst.CHANGE;
PersonnelMiddle personnelMiddle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, request.getId()).eq(PersonnelMiddle::getState,"1")); PersonnelMiddle personnelMiddle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, request.getId()).eq(PersonnelMiddle::getState, "1"));
String id = null;String card = null;String jobTitle = null;String engage = null;String education =null;String audit = null; String id = null;
if (ObjectUtil.isNotNull(personnelMiddle)){ String card = null;
String jobTitle = null;
String engage = null;
String education = null;
String audit = null;
if (ObjectUtil.isNotNull(personnelMiddle)) {
id = personnelMiddle.getBeforeId(); id = personnelMiddle.getBeforeId();
card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ','); card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ',');
jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ','); jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ',');
engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type,id), ','); engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type, id), ',');
education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ','); education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ',');
audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ','); audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ',');
saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE); saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE);
@ -363,11 +358,11 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, id, ArgsConst.UPDATE); saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, id, ArgsConst.UPDATE);
saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, id, ArgsConst.UPDATE); saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, id, ArgsConst.UPDATE);
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE); saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE);
}else { } else {
id = request.getId(); id = request.getId();
card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ','); card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ',');
jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ','); jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ',');
engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type,id), ','); engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type, id), ',');
education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ','); education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ',');
audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ','); audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ',');
saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE); saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE);
@ -377,30 +372,30 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE); saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE);
} }
Personnel per = get(id); Personnel per = get(id);
if (per.getChangeAuditState()==2) { if (per.getChangeAuditState() == 2) {
return AjaxResult.fail().msg("待领导审批,不能变更数据"); return AjaxResult.fail().msg("待领导审批,不能变更数据");
} }
per.setChangeAlterationSign("1"); per.setChangeAlterationSign("1");
boolean update = updateById(per); boolean update = updateById(per);
middle.setBeforeId(per.getId()); middle.setBeforeId(per.getId());
per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,id,ColumnUtil.getFieldName(Personnel::getRecruitNumber)).toString()); per.setRecruitNumber(saveAlteration("人员招聘单号更改", per.getRecruitNumber(), request.getRecruitNumber(), type, id, ColumnUtil.getFieldName(Personnel::getRecruitNumber)).toString());
per.setUserName(saveAlteration("姓名更改",per.getUserName(),request.getUserName(),type,id,ColumnUtil.getFieldName(Personnel::getUserName)).toString()); per.setUserName(saveAlteration("姓名更改", per.getUserName(), request.getUserName(), type, id, ColumnUtil.getFieldName(Personnel::getUserName)).toString());
per.setGender(saveAlteration("性别更改",per.getGender(),request.getGender(),type,id,ColumnUtil.getFieldName(Personnel::getGender)).toString()); per.setGender(saveAlteration("性别更改", per.getGender(), request.getGender(), type, id, ColumnUtil.getFieldName(Personnel::getGender)).toString());
per.setBirthday(LocalDate.parse(saveAlteration("出生日期更改",per.getBirthday(),request.getBirthday(),type,id, ColumnUtil.getFieldName(Personnel::getBirthday)).toString())); per.setBirthday(LocalDate.parse(saveAlteration("出生日期更改", per.getBirthday(), request.getBirthday(), type, id, ColumnUtil.getFieldName(Personnel::getBirthday)).toString()));
per.setNumberId(saveAlteration("身份证号更改",per.getNumberId(),request.getNumberId(),type,id,ColumnUtil.getFieldName(Personnel::getNumberId)).toString()); per.setNumberId(saveAlteration("身份证号更改", per.getNumberId(), request.getNumberId(), type, id, ColumnUtil.getFieldName(Personnel::getNumberId)).toString());
per.setNation(saveAlteration("民族更改",per.getNation(),request.getNation(),type,id,ColumnUtil.getFieldName(Personnel::getNation)).toString()); per.setNation(saveAlteration("民族更改", per.getNation(), request.getNation(), type, id, ColumnUtil.getFieldName(Personnel::getNation)).toString());
per.setPoliticsStatus(saveAlteration("政治面貌更改",per.getPoliticsStatus(),request.getPoliticsStatus(),type,id,ColumnUtil.getFieldName(Personnel::getPoliticsStatus)).toString()); per.setPoliticsStatus(saveAlteration("政治面貌更改", per.getPoliticsStatus(), request.getPoliticsStatus(), type, id, ColumnUtil.getFieldName(Personnel::getPoliticsStatus)).toString());
per.setEducation(saveAlteration("学历更改",per.getEducation(),request.getEducation(),type,id,ColumnUtil.getFieldName(Personnel::getEducation)).toString()); per.setEducation(saveAlteration("学历更改", per.getEducation(), request.getEducation(), type, id, ColumnUtil.getFieldName(Personnel::getEducation)).toString());
per.setFreshGraduate(saveAlteration("是否应届毕业生更改",per.getFreshGraduate(),request.getFreshGraduate(),type,id,ColumnUtil.getFieldName(Personnel::getFreshGraduate)).toString()); per.setFreshGraduate(saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), request.getFreshGraduate(), type, id, ColumnUtil.getFieldName(Personnel::getFreshGraduate)).toString());
per.setAcademy(saveAlteration("毕业院校更改",per.getAcademy(),request.getAcademy(),type,id,ColumnUtil.getFieldName(Personnel::getAcademy)).toString()); per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), request.getAcademy(), type, id, ColumnUtil.getFieldName(Personnel::getAcademy)).toString());
per.setSpecialty(saveAlteration("专业更改",per.getSpecialty(),request.getSpecialty(),type,id,ColumnUtil.getFieldName(Personnel::getSpecialty)).toString()); per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), request.getSpecialty(), type, id, ColumnUtil.getFieldName(Personnel::getSpecialty)).toString());
per.setHireType(saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,id,ColumnUtil.getFieldName(Personnel::getHireType)).toString()); per.setHireType(saveAlteration("录用方式更改", per.getHireType(), request.getHireType(), type, id, ColumnUtil.getFieldName(Personnel::getHireType)).toString());
per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,id,ColumnUtil.getFieldName(Personnel::getQualification)).toString()); per.setQualification(saveAlteration("执业资格更改", per.getQualification(), request.getQualification(), type, id, ColumnUtil.getFieldName(Personnel::getQualification)).toString());
per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,id,ColumnUtil.getFieldName(Personnel::getJobTitle)).toString()); per.setJobTitle(saveAlteration("专业技术职称更改", per.getJobTitle(), request.getJobTitle(), type, id, ColumnUtil.getFieldName(Personnel::getJobTitle)).toString());
per.setContractModality(saveAlteration("合同形式更改",per.getContractModality(),request.getContractModality(),type,id,ColumnUtil.getFieldName(Personnel::getContractModality)).toString()); per.setContractModality(saveAlteration("合同形式更改", per.getContractModality(), request.getContractModality(), type, id, ColumnUtil.getFieldName(Personnel::getContractModality)).toString());
per.setPersonnelType(saveAlteration("人员类型更改",per.getPersonnelType(),request.getPersonnelType(),type,id,ColumnUtil.getFieldName(Personnel::getPersonnelType)).toString()); per.setPersonnelType(saveAlteration("人员类型更改", per.getPersonnelType(), request.getPersonnelType(), type, id, ColumnUtil.getFieldName(Personnel::getPersonnelType)).toString());
per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,id,ColumnUtil.getFieldName(Personnel::getWorkState)).toString()); per.setWorkState(saveAlteration("工作状态更改", per.getWorkState(), request.getWorkState(), type, id, ColumnUtil.getFieldName(Personnel::getWorkState)).toString());
per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,id,ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)).toString()); per.setPersonnelCharacter(saveAlteration("人员性质更改", per.getPersonnelCharacter(), request.getPersonnelCharacter(), type, id, ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)).toString());
per.setAnnualSalary((Integer) saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, id, ColumnUtil.getFieldName(Personnel::getAnnualSalary))); per.setAnnualSalary((Integer) saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, id, ColumnUtil.getFieldName(Personnel::getAnnualSalary)));
if (ObjectUtil.isNotNull(per.getHireDate())) { if (ObjectUtil.isNotNull(per.getHireDate())) {
per.setHireDate(LocalDate.parse(saveAlteration("入职时间更改", per.getHireDate(), request.getHireDate(), type, id, ColumnUtil.getFieldName(Personnel::getHireDate)).toString())); per.setHireDate(LocalDate.parse(saveAlteration("入职时间更改", per.getHireDate(), request.getHireDate(), type, id, ColumnUtil.getFieldName(Personnel::getHireDate)).toString()));
@ -418,22 +413,22 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setTxfpEndTime(LocalDate.parse(saveAlteration("退休返聘结束时间更改", per.getTxfpEndTime(), request.getTxfpEndTime(), type, id, ColumnUtil.getFieldName(Personnel::getTxfpEndTime)).toString())); per.setTxfpEndTime(LocalDate.parse(saveAlteration("退休返聘结束时间更改", per.getTxfpEndTime(), request.getTxfpEndTime(), type, id, ColumnUtil.getFieldName(Personnel::getTxfpEndTime)).toString()));
} }
per.setRemark(saveAlteration("备注更改", per.getRemark(), request.getRemark(), type, id, ColumnUtil.getFieldName(Personnel::getRemark)).toString()); per.setRemark(saveAlteration("备注更改", per.getRemark(), request.getRemark(), type, id, ColumnUtil.getFieldName(Personnel::getRemark)).toString());
if (StrUtil.isNotBlank(card)){ if (StrUtil.isNotBlank(card)) {
per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,id,ColumnUtil.getFieldName(Personnel::getCardFile)).toString()); per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, id, ColumnUtil.getFieldName(Personnel::getCardFile)).toString());
} }
if (StrUtil.isNotBlank(jobTitle)){ if (StrUtil.isNotBlank(jobTitle)) {
per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,id,ColumnUtil.getFieldName(Personnel::getEngageFile)).toString()); per.setEngageFile(saveAlteration("聘任证书附件更改", per.getEngageFile(), jobTitle, type, id, ColumnUtil.getFieldName(Personnel::getEngageFile)).toString());
} }
if (StrUtil.isNotBlank(engage)){ if (StrUtil.isNotBlank(engage)) {
per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,id,ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString()); per.setJobTitleFile(saveAlteration("职称证书附件更改", per.getJobTitleFile(), engage, type, id, ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString());
} }
if (StrUtil.isNotBlank(education)){ if (StrUtil.isNotBlank(education)) {
per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,id,ColumnUtil.getFieldName(Personnel::getEducationFile)).toString()); per.setEducationFile(saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, id, ColumnUtil.getFieldName(Personnel::getEducationFile)).toString());
} }
if (StrUtil.isNotBlank(audit)){ if (StrUtil.isNotBlank(audit)) {
per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,id,ColumnUtil.getFieldName(Personnel::getAuditFile)).toString()); per.setAuditFile(saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, id, ColumnUtil.getFieldName(Personnel::getAuditFile)).toString());
} }
if (ObjectUtil.isEmpty(personnelMiddle)){ if (ObjectUtil.isEmpty(personnelMiddle)) {
per.setId(""); per.setId("");
per.setState("1"); per.setState("1");
per.setChangeAlterationSign("1"); per.setChangeAlterationSign("1");
@ -441,19 +436,19 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
middle.setAfterId(per.getId()); middle.setAfterId(per.getId());
middle.setType(ArgsConst.CHANGE); middle.setType(ArgsConst.CHANGE);
personnelMiddleService.savePer(middle); personnelMiddleService.savePer(middle);
}else { } else {
per.setState("1"); per.setState("1");
per.setId(personnelMiddle.getAfterId()); per.setId(personnelMiddle.getAfterId());
updateById(per); updateById(per);
} }
if("audit".equals(request.getType())){ if ("audit".equals(request.getType())) {
GiveAuditRequest req = new GiveAuditRequest(); GiveAuditRequest req = new GiveAuditRequest();
String[] ids = new String[]{id}; String[] ids = new String[]{id};
req.setIds(ids); req.setIds(ids);
req.setType(ArgsConst.CHANGE); req.setType(ArgsConst.CHANGE);
return giveAudit(req); return giveAudit(req);
} }
return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!"); return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!");
} }
@ -496,7 +491,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
for (AttachmentRequest request : file) { for (AttachmentRequest request : file) {
if (ArgsConst.UPDATE.equals(args)) { if (ArgsConst.UPDATE.equals(args)) {
attachmentService.deleteById(type, id); attachmentService.deleteById(type, id);
} if (ArgsConst.CHANGE.equals(args)) { }
if (ArgsConst.CHANGE.equals(args)) {
attachmentService.deleteById(type, id); attachmentService.deleteById(type, id);
} }
path.add(request.getPath()); path.add(request.getPath());
@ -506,11 +502,11 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return null; return null;
} }
public Object saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){ public Object saveAlteration(String details, Object before, Object after, String type, String id, String fieldName) {
if (ObjectUtil.isNotNull(after)){ if (ObjectUtil.isNotNull(after)) {
if (!after.equals(before)){ if (!after.equals(before)) {
Alteration one = alterationMapper.selectOne(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id).eq(Alteration::getFieldName, fieldName)); Alteration one = alterationMapper.selectOne(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id).eq(Alteration::getFieldName, fieldName));
if (ObjectUtil.isNotEmpty(one)){ if (ObjectUtil.isNotEmpty(one)) {
one.setDetails(details); one.setDetails(details);
one.setFieldName(fieldName); one.setFieldName(fieldName);
one.setType(type); one.setType(type);
@ -522,7 +518,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
one.setAfterChange(after.toString()); one.setAfterChange(after.toString());
alterationMapper.updateById(one); alterationMapper.updateById(one);
}else { } else {
Alteration alteration = new Alteration(); Alteration alteration = new Alteration();
alteration.setDetails(details); alteration.setDetails(details);
@ -538,9 +534,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
alterationMapper.insert(alteration); alterationMapper.insert(alteration);
} }
} }
return after; return after;
} }
return before; return before;
} }
public List<AttachmentDto> nameAndPath(String file, String id) { public List<AttachmentDto> nameAndPath(String file, String id) {
@ -563,30 +559,30 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return null; return null;
} }
public QueryWrapper selectWrapper(SelectRequest request, String orderBy, String column, Boolean isInfo){ public QueryWrapper selectWrapper(SelectRequest request, String orderBy, String column, Boolean isInfo) {
QueryWrapper<Personnel> wrapper = new QueryWrapper<>(); QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
if(ArgsConst.PERSONNEL.equals(request.getType())){ if (ArgsConst.PERSONNEL.equals(request.getType())) {
wrapper.lambda().ne(Personnel::getAuditState,"3"); wrapper.lambda().ne(Personnel::getAuditState, "3");
}else{ } else {
wrapper.lambda().eq(isInfo,Personnel::getIsInfo,true).eq(Personnel::getAuditState,"3").ne(Personnel::getState,1).ne(Personnel::getState,0); wrapper.lambda().eq(isInfo, Personnel::getIsInfo, true).eq(Personnel::getAuditState, "3").ne(Personnel::getState, 1).ne(Personnel::getState, 0);
} }
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType()) wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType())
.eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept()) .eq(StrUtil.isNotBlank(request.getPresentDept()), Personnel::getPresentDept, request.getPresentDept())
.eq(StrUtil.isNotBlank(request.getPoliticsStatus()),Personnel::getPoliticsStatus,request.getPoliticsStatus()) .eq(StrUtil.isNotBlank(request.getPoliticsStatus()), Personnel::getPoliticsStatus, request.getPoliticsStatus())
.eq(StrUtil.isNotBlank(request.getHireType()),Personnel::getHireType,request.getHireType()) .eq(StrUtil.isNotBlank(request.getHireType()), Personnel::getHireType, request.getHireType())
.eq(StrUtil.isNotBlank(request.getPosition()),Personnel::getPosition,request.getPosition()) .eq(StrUtil.isNotBlank(request.getPosition()), Personnel::getPosition, request.getPosition())
.eq(StrUtil.isNotBlank(request.getContractModality()),Personnel::getContractModality,request.getContractModality()) .eq(StrUtil.isNotBlank(request.getContractModality()), Personnel::getContractModality, request.getContractModality())
.eq(StrUtil.isNotBlank(request.getQualification()),Personnel::getQualification,request.getQualification()) .eq(StrUtil.isNotBlank(request.getQualification()), Personnel::getQualification, request.getQualification())
.eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType()) .eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType())
.eq(ObjectUtil.isNotNull(request.getHireDate()),Personnel::getHireDate,request.getHireDate()) .eq(ObjectUtil.isNotNull(request.getHireDate()), Personnel::getHireDate, request.getHireDate())
.eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime()) .eq(ObjectUtil.isNotNull(request.getResignationTime()), Personnel::getResignationTime, request.getResignationTime())
.eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState()) .eq(StrUtil.isNotBlank(request.getWorkState()), Personnel::getWorkState, request.getWorkState())
.eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getReceipts,request.getReceipts()) .eq(StrUtil.isNotBlank(request.getReceipts()), Personnel::getReceipts, request.getReceipts())
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign()) .eq(StrUtil.isNotBlank(request.getAlterationSign()), Personnel::getAlterationSign, request.getAlterationSign())
.eq(StrUtil.isNotBlank(request.getChangeAlterationSign()),Personnel::getChangeAlterationSign,request.getChangeAlterationSign()); .eq(StrUtil.isNotBlank(request.getChangeAlterationSign()), Personnel::getChangeAlterationSign, request.getChangeAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName()) wrapper.lambda().like(Personnel::getUserName, request.getUserName())
.like(Personnel::getNumberId,request.getNumberId()) .like(Personnel::getNumberId, request.getNumberId())
.exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " + .exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " +
"t_lc_personnel.company_name = t2.id and t2.company_name like '%" + request.getCompanyName() + "%'"); "t_lc_personnel.company_name = t2.id and t2.company_name like '%" + request.getCompanyName() + "%'");
wrapper.lambda().orderByDesc(Personnel::getCreatedAt); wrapper.lambda().orderByDesc(Personnel::getCreatedAt);
@ -599,70 +595,72 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return wrapper; return wrapper;
} }
public void export(PersonnelDeleteRequest param ,HttpServletResponse response) { public void export(PersonnelDeleteRequest param, HttpServletResponse response) {
List<Personnel> list = list(); List<Personnel> list = list();
List<ExcelPersonnel> personnelList = BeanUtil.copyToList(list, ExcelPersonnel.class); List<ExcelPersonnel> personnelList = BeanUtil.copyToList(list, ExcelPersonnel.class);
for (ExcelPersonnel excelPersonnel : personnelList) { for (ExcelPersonnel excelPersonnel : personnelList) {
CompanyName companyName = companyNameMapper.selectById(excelPersonnel.getCompanyName()); CompanyName companyName = companyNameMapper.selectById(excelPersonnel.getCompanyName());
Dept dept = deptMapper.selectById(excelPersonnel.getPresentDept()); Dept dept = deptMapper.selectById(excelPersonnel.getPresentDept());
if (ObjectUtil.isNotEmpty(companyName)){ if (ObjectUtil.isNotEmpty(companyName)) {
excelPersonnel.setCompanyName(companyName.getCompanyName()); excelPersonnel.setCompanyName(companyName.getCompanyName());
} }
if (ObjectUtil.isNotEmpty(dept)){ if (ObjectUtil.isNotEmpty(dept)) {
excelPersonnel.setPresentDept(dept.getName()); excelPersonnel.setPresentDept(dept.getName());
} }
excelPersonnel.setGender("1".equals(excelPersonnel.getGender())?"":""); excelPersonnel.setGender("1".equals(excelPersonnel.getGender()) ? "" : "0".equals(excelPersonnel.getGender()) ? "" : "未知");
excelPersonnel.setFreshGraduate("1".equals(excelPersonnel.getFreshGraduate())?"":""); excelPersonnel.setFreshGraduate("1".equals(excelPersonnel.getFreshGraduate()) ? "" : "");
} }
String fileName = "企业人员申报" + System.currentTimeMillis() + ".xlsx"; String fileName = "企业人员申报" + System.currentTimeMillis() + ".xlsx";
Set<String> includeColumnFiledNames = new HashSet<>(); Set<String> includeColumnFiledNames = new HashSet<>(Arrays.asList(param.getIds()));
for (String s : param.getIds()) { // 导出
includeColumnFiledNames.add(s); EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnel.class, personnelList, fileName, includeColumnFiledNames);
}
//导出
EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnel.class, personnelList, fileName,includeColumnFiledNames);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult importPersonnel(MultipartFile excl) { public AjaxResult importPersonnel(MultipartFile excl) {
//判断文件类型
String reg = ".+(.xlsx)$"; String reg = ".+(.xlsx)$";
String suffix = FileUtil.getSuffix(excl.getOriginalFilename()); String suffix = FileUtil.getSuffix(excl.getOriginalFilename());
if (!Pattern.matches(reg, excl.getOriginalFilename())){ if (!Pattern.matches(reg, excl.getOriginalFilename())) {
return AjaxResult.fail("必须上传后缀为" + suffix + "的文件"); return AjaxResult.fail("必须上传后缀为" + suffix + "的文件");
} }
if (!"企业人员申报模板.xlsx".equals(excl.getOriginalFilename())){ if (!"企业人员申报.xlsx".equals(excl.getOriginalFilename())) {
return AjaxResult.fail("必须上传 企业人员申报模板.xlsx 文件"); return AjaxResult.fail("必须上传 企业人员申报.xlsx 文件");
} }
//导出数据 // 导出数据
List<PersonnelFailMsgVO> failList = new ArrayList<>(); List<PersonnelFailMsgVO> failList = new ArrayList<>();
if (!excl.isEmpty()) { if (!excl.isEmpty()) {
List<PersonnelExportVO> personnelExportVOS = EasyExcelAlibabaUtil.excelToList(excl, List<PersonnelExportVO> personnelExportVOS = EasyExcelAlibabaUtil.excelToList(excl, PersonnelExportVO.class);
PersonnelExportVO.class); if (CollectionUtil.isEmpty(personnelExportVOS)) {
if (CollectionUtil.isEmpty(personnelExportVOS)){ return AjaxResult.fail("导入数据不能为空!");
return AjaxResult.fail("模板必须要有数据");
} }
for (PersonnelExportVO personnelExportVO : personnelExportVOS) { for (PersonnelExportVO personnelExportVO : personnelExportVOS) {
System.out.println("通讯录信息" + personnelExportVO); // 校验通讯录信息
//校验通讯录信息
PersonnelFailMsgVO failMsgVO = checkPersonnelExportVO(personnelExportVO); PersonnelFailMsgVO failMsgVO = checkPersonnelExportVO(personnelExportVO);
//错误数据 不保存 // 错误数据 不保存
if (StrUtil.isNotBlank(failMsgVO.getFailMsg())) { if (StrUtil.isNotBlank(failMsgVO.getFailMsg())) {
failList.add(failMsgVO); failList.add(failMsgVO);
} else { } else {
//转义 // 转义
Personnel personnel = BeanUtil.copyProperties(personnelExportVO, Personnel.class); Personnel personnel = BeanUtil.copyProperties(personnelExportVO, Personnel.class);
CompanyName selectOne = companyNameMapper.selectOne(Wrappers.lambdaQuery(CompanyName.class).eq(CompanyName::getCompanyName, personnelExportVO.getCompanyName()));
if (selectOne != null) {
personnel.setCompanyName(selectOne.getId());
personnel.setSocialCreditCode(selectOne.getCreditCode());
}
personnel.setBirthday(birthday(personnelExportVO.getNumberId()));
personnel.setRetirementTime(retirementTime(personnelExportVO.getNumberId()));
personnel.setFreshGraduate("".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0"); personnel.setFreshGraduate("".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0");
//保存 personnel.setGender("".equals(personnelExportVO.getGender()) ? "1" : "".equals(personnelExportVO.getGender()) ? "0" : "2");
// 保存
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + (save(personnel) ? "导入成功" : "导入失败")); failMsgVO.setFailMsg(failMsgVO.getFailMsg() + (save(personnel) ? "导入成功" : "导入失败"));
failList.add(failMsgVO); failList.add(failMsgVO);
} }
} }
} }
//导出导入结果 // 导出导入结果
String download = EasyExcelAlibabaUtil.download(PersonnelFailMsgVO.class, failList, "通讯录导入结果"); String download = EasyExcelAlibabaUtil.download(PersonnelFailMsgVO.class, failList, "企业人员申报导入结果");
return AjaxResult.ok().data(download).msg("导入完成"); return AjaxResult.ok().data(download).msg("导入完成");
} }
@ -681,38 +679,38 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public AjaxResult giveAudit(GiveAuditRequest request) { public AjaxResult giveAudit(GiveAuditRequest request) {
String[] ids = request.getIds(); String[] ids = request.getIds();
String s = verifyIds(ids, request.getType()); String s = verifyIds(ids, request.getType());
if (StrUtil.isNotBlank(s)){ if (StrUtil.isNotBlank(s)) {
return AjaxResult.fail().msg(s); return AjaxResult.fail().msg(s);
} }
String loginId = (String) StpUtil.getLoginId(); String loginId = (String) StpUtil.getLoginId();
for (String id : ids) { for (String id : ids) {
for(int i=0;i<=1;i++ ){ for (int i = 0; i <= 1; i++) {
Audit audit = new Audit(); Audit audit = new Audit();
audit.setPersonnelId(id); audit.setPersonnelId(id);
audit.setPerType(request.getType()); audit.setPerType(request.getType());
if(i==0){ if (i == 0) {
audit.setAuditState(ArgsConst.SUBMIT); audit.setAuditState(ArgsConst.SUBMIT);
audit.setAuditOrder(ArgsConst.GIVE_AUDIT); audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
audit.setApprover(loginId); audit.setApprover(loginId);
audit.setApproverTime(new Date()); audit.setApproverTime(new Date());
}else { } else {
audit.setAuditOrder(ArgsConst.LAST); audit.setAuditOrder(ArgsConst.LAST);
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
audit.setAuditState(ArgsConst.WAITING); audit.setAuditState(ArgsConst.WAITING);
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())); User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setApprover(user.getId()); audit.setApprover(user.getId());
//通知 // 通知
User loginUser = userMapper.selectById(loginId); User loginUser = userMapper.selectById(loginId);
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE); workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setUserId(user.getId()); workFlowNotice.setUserId(user.getId());
if (request.getType().equals(ArgsConst.PERSONNEL)){ if (request.getType().equals(ArgsConst.PERSONNEL)) {
workFlowNotice.setTitle(loginUser.getUserName() + "的企业人员申报待你审批"); workFlowNotice.setTitle(loginUser.getUserName() + "的企业人员申报待你审批");
workFlowNotice.setFlowType(ArgsConst.PERSONNEL); workFlowNotice.setFlowType(ArgsConst.PERSONNEL);
}else if(request.getType().equals(ArgsConst.CHANGE)){ } else if (request.getType().equals(ArgsConst.CHANGE)) {
workFlowNotice.setTitle(loginUser.getUserName() + "的人员变更申报待你审批"); workFlowNotice.setTitle(loginUser.getUserName() + "的人员变更申报待你审批");
workFlowNotice.setFlowType(ArgsConst.CHANGE); workFlowNotice.setFlowType(ArgsConst.CHANGE);
}else { } else {
workFlowNotice.setTitle(loginUser.getUserName() + "的人员选调申报待你审批"); workFlowNotice.setTitle(loginUser.getUserName() + "的人员选调申报待你审批");
workFlowNotice.setFlowType(ArgsConst.EXCHANGE); workFlowNotice.setFlowType(ArgsConst.EXCHANGE);
} }
@ -721,21 +719,21 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
auditMapper.insert(audit); auditMapper.insert(audit);
} }
if (ArgsConst.PERSONNEL.equals(request.getType())){ if (ArgsConst.PERSONNEL.equals(request.getType())) {
Personnel personnel = get(id); Personnel personnel = get(id);
personnel.setAuditState(2); personnel.setAuditState(2);
updateById(personnel); updateById(personnel);
} }
if (ArgsConst.CHANGE.equals(request.getType())){ if (ArgsConst.CHANGE.equals(request.getType())) {
PersonnelMiddle one = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, id)); PersonnelMiddle one = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, id));
if (ObjectUtil.isNotEmpty(one)){ if (ObjectUtil.isNotEmpty(one)) {
Personnel personnel = get(one.getBeforeId()); Personnel personnel = get(one.getBeforeId());
Personnel personnel1 = get(id); Personnel personnel1 = get(id);
personnel.setChangeAuditState(2); personnel.setChangeAuditState(2);
personnel1.setChangeAuditState(2); personnel1.setChangeAuditState(2);
updateById(personnel); updateById(personnel);
updateById(personnel1); updateById(personnel1);
}else { } else {
Personnel personnel = get(id); Personnel personnel = get(id);
personnel.setChangeAuditState(2); personnel.setChangeAuditState(2);
updateById(personnel); updateById(personnel);
@ -743,14 +741,14 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
} }
if (ArgsConst.EXCHANGE.equals(request.getType())){ if (ArgsConst.EXCHANGE.equals(request.getType())) {
Exchange exchange = exchangeMapper.selectById(id); Exchange exchange = exchangeMapper.selectById(id);
exchange.setAuditState(2); exchange.setAuditState(2);
exchangeMapper.updateById(exchange); exchangeMapper.updateById(exchange);
} }
auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交",""); auditService.saveAuditLog(id, loginId, request.getType(), "一般送审提交", "");
} }
if (ids.length==1){ if (ids.length == 1) {
return AjaxResult.ok().msg("送审成功!"); return AjaxResult.ok().msg("送审成功!");
} }
return AjaxResult.ok().msg("批量送审成功!"); return AjaxResult.ok().msg("批量送审成功!");
@ -761,50 +759,107 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public PersonnelFailMsgVO checkPersonnelExportVO(PersonnelExportVO personnelExportVO) { public PersonnelFailMsgVO checkPersonnelExportVO(PersonnelExportVO personnelExportVO) {
PersonnelFailMsgVO failMsgVO = BeanUtil.copyProperties(personnelExportVO, PersonnelFailMsgVO.class); PersonnelFailMsgVO failMsgVO = BeanUtil.copyProperties(personnelExportVO, PersonnelFailMsgVO.class);
failMsgVO.setFailMsg(""); failMsgVO.setFailMsg("");
//联系人姓名不能为空 // 联系人姓名不能为空
if (StrUtil.isBlank(personnelExportVO.getCompanyName())) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 企业名称不能为空 ");
}
if (StrUtil.isBlank(personnelExportVO.getNumberId())) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 身份证号不能为空 ");
}
if (!IdcardUtil.isValidCard(personnelExportVO.getNumberId())) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 身份证号不正确 ");
}
if (StrUtil.isBlank(personnelExportVO.getUserName())) { if (StrUtil.isBlank(personnelExportVO.getUserName())) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 姓名不能为空 "); failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 姓名不能为空 ");
} }
//校验性别 if (personnelExportVO.getHireDate() == null) {
if (!"".equals(personnelExportVO.getGender()) && !"".equals(personnelExportVO.getGender())) { failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 入职日期不能为空 ");
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 请输入正确性别,男或女 ");
} }
//校验性别 if (StrUtil.isBlank(personnelExportVO.getRecruitNumber())) {
if (!"".equals(personnelExportVO.getFreshGraduate()) && !"".equals(personnelExportVO.getGender())) { failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 人员招聘单号不能为空 ");
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 请输入正确选项,是或否 "); }
if (personnelExportVO.getPersonnelCharacter().equals("非年薪人员")) {
personnelExportVO.setAnnualSalary(0);
}
CompanyName selectOne = companyNameMapper.selectOne(Wrappers.lambdaQuery(CompanyName.class).eq(CompanyName::getCompanyName, personnelExportVO.getCompanyName()));
if (selectOne != null) {
failMsgVO.setSocialCreditCode(selectOne.getCreditCode());
}
failMsgVO.setBirthday(birthday(personnelExportVO.getNumberId()));
failMsgVO.setRetirementTime(retirementTime(personnelExportVO.getNumberId()));
Optional<Integer> pOptional = Optional.ofNullable(personnelMapper.selectCount(Wrappers.lambdaQuery(Personnel.class).eq(Personnel::getRecruitNumber, personnelExportVO.getRecruitNumber())));
Optional<Places> placesOptional = Optional.ofNullable(placesMapper.selectOne(Wrappers.lambdaQuery(Places.class).eq(Places::getOdd, personnelExportVO.getRecruitNumber())));
if (pOptional.isPresent() && placesOptional.isPresent() && pOptional.get() > placesOptional.get().getSum()) {
failMsgVO.setFailMsg("招聘名额已用完!");
} }
return failMsgVO; return failMsgVO;
} }
/**
* 计算退休时间
* @param numberId
* @return
*/
public LocalDate retirementTime(String numberId) {
// 330225 1996 09 05 0012
String org_birthday = numberId.substring(6, 14);
String org_gender = numberId.substring(16, 17);
String sex = Integer.parseInt(org_gender) % 2 == 1 ? "" : "";
String birthday = org_birthday.substring(0, 4) + "-" + org_birthday.substring(4, 6) + "-" + org_birthday.substring(6, 8);
System.out.println("birthday = " + birthday);
int plusNum = sex.equals("") ? 60 : 50;
String dateStr = (Integer.parseInt(org_birthday.substring(0, 4)) + plusNum) + "-" + org_birthday.substring(4, 6) + "-" + org_birthday.substring(6, 8);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate dateParam = LocalDate.parse(dateStr, df);
System.out.println("String => LocalDate: " + dateParam);
return dateParam;
}
public String verifyIds(String[] ids,String type){ /**
* 出手日期
* @param numberId
* @return
*/
public LocalDate birthday(String numberId) {
// 330225 1996 09 05 0012
String org_birthday = numberId.substring(6, 14);
String birthday = org_birthday.substring(0, 4) + "-" + org_birthday.substring(4, 6) + "-" + org_birthday.substring(6, 8);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate dateParam = LocalDate.parse(birthday, df);
System.out.println("String => LocalDate: " + dateParam);
return dateParam;
}
public String verifyIds(String[] ids, String type) {
String message = ""; String message = "";
for (String id : ids) { for (String id : ids) {
if (ArgsConst.PERSONNEL.equals(type)){ if (ArgsConst.PERSONNEL.equals(type)) {
Personnel personnel = get(id); Personnel personnel = get(id);
if (1 == (personnel.getAuditState())) { if (1 == (personnel.getAuditState())) {
return message="该数据已送审请勿重复操作!"; return message = "该数据已送审请勿重复操作!";
} }
if ("0".equals(personnel.getAlterationSign())) { if ("0".equals(personnel.getAlterationSign())) {
return message="变更数据未保存,不能送审!"; return message = "变更数据未保存,不能送审!";
} }
}else if (ArgsConst.CHANGE.equals(type)){ } else if (ArgsConst.CHANGE.equals(type)) {
Personnel personnel = get(id); Personnel personnel = get(id);
if (1 == (personnel.getChangeAuditState())) { if (1 == (personnel.getChangeAuditState())) {
return message="该数据已送审请勿重复操作!"; return message = "该数据已送审请勿重复操作!";
} }
if ("0".equals(personnel.getChangeAlterationSign())) { if ("0".equals(personnel.getChangeAlterationSign())) {
return message="变更数据未保存,不能送审!"; return message = "变更数据未保存,不能送审!";
} }
}else if (ArgsConst.EXCHANGE.equals(type)) { } else if (ArgsConst.EXCHANGE.equals(type)) {
Exchange exchange = exchangeMapper.selectById(id); Exchange exchange = exchangeMapper.selectById(id);
Personnel personnel = get(exchange.getPersonnelId()); Personnel personnel = get(exchange.getPersonnelId());
if ("1".equals(personnel.getAlterationSign())||"1".equals(personnel.getChangeAlterationSign())){ if ("1".equals(personnel.getAlterationSign()) || "1".equals(personnel.getChangeAlterationSign())) {
return message="该人员有变更数据,不能进行选调!"; return message = "该人员有变更数据,不能进行选调!";
} }
if ("1".equals(exchange.getAuditState())) { if ("1".equals(exchange.getAuditState())) {
return message="该数据已送审请勿重复操作!"; return message = "该数据已送审请勿重复操作!";
} }
} }
} }
@ -818,9 +873,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String nowDate = DateUtil.format(date, "yyyy-MM-dd"); String nowDate = DateUtil.format(date, "yyyy-MM-dd");
String starTime = DateUtil.format(time, "yyyy-MM-dd"); String starTime = DateUtil.format(time, "yyyy-MM-dd");
List<Personnel> list = list(new LambdaQueryWrapper<Personnel>() List<Personnel> list = list(new LambdaQueryWrapper<Personnel>()
.ne(Personnel::getAlterationSign,1).eq(Personnel::getAuditState,3).eq(Personnel::getState,2) .ne(Personnel::getAlterationSign, 1).eq(Personnel::getAuditState, 3).eq(Personnel::getState, 2)
.eq(Personnel::getWorkState,"在职").between(Personnel::getRetirementTime, nowDate, starTime).eq(Personnel::getIsInfo,false).orderByDesc(Personnel::getRetirementTime)); .eq(Personnel::getWorkState, "在职").between(Personnel::getRetirementTime, nowDate, starTime).eq(Personnel::getIsInfo, false).orderByDesc(Personnel::getRetirementTime));
if (CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)) {
CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", true); CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", true);
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())); User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
@ -829,7 +884,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE); workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setUserId(user.getId()); workFlowNotice.setUserId(user.getId());
workFlowNotice.setTitle("企业人员"+personnel.getUserName()+"待退休"); workFlowNotice.setTitle("企业人员" + personnel.getUserName() + "待退休");
workFlowNotice.setFlowType(ArgsConst.RETIRE); workFlowNotice.setFlowType(ArgsConst.RETIRE);
workFlowNotice.setFlowId(personnel.getId()); workFlowNotice.setFlowId(personnel.getId());
boolean save = workFlowNoticeService.save(workFlowNotice); boolean save = workFlowNoticeService.save(workFlowNotice);
@ -845,12 +900,12 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult updatePersonnelRetire(String id) { public AjaxResult updatePersonnelRetire(String id) {
Personnel personnel = getById(id); Personnel personnel = getById(id);
if (!"退休".equals(personnel.getWorkState())){ if (!"退休".equals(personnel.getWorkState())) {
return AjaxResult.fail("该人员未办理退休变更,请先办理退休变更!"); return AjaxResult.fail("该人员未办理退休变更,请先办理退休变更!");
} }
personnel.setIsInfo(false); personnel.setIsInfo(false);
boolean b = updateById(personnel); boolean b = updateById(personnel);
return b ?AjaxResult.ok().msg("处理成功!"):AjaxResult.fail("处理失败!"); return b ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
} }
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
@ -18,6 +19,7 @@ import com.ydool.system.service.IDictDataService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -215,5 +217,15 @@ public class DictDataServiceImpl extends BaseService<DictDataMapper, DictData> i
if (ObjectUtil.isNull(dictData)) return ""; if (ObjectUtil.isNull(dictData)) return "";
return dictData.getLabel(); return dictData.getLabel();
} }
public List<DictData> listByCode(String typeCode) {
DictType grapeDictType = dictTypeService.getOne(new LambdaQueryWrapper<DictType>().eq(DictType::getCode, typeCode));
if (grapeDictType == null) return new ArrayList<>();
List<DictData> list = list(new LambdaQueryWrapper<DictData>()
.eq(DictData::getDataType, grapeDictType.getCode())
.eq(DictData::getStatus, 1)
.orderByAsc(DictData::getSortNo));
return list;
}
} }