Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/ydool/staff/controller/OrganizationController.java
This commit is contained in:
zhuyy 2023-02-10 17:48:28 +08:00
commit dacef7ad56
15 changed files with 279 additions and 72 deletions

View File

@ -1,5 +1,8 @@
package com.ydool.common.constant; package com.ydool.common.constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* @author msh * @author msh
* @version 1.0 * @version 1.0
@ -38,7 +41,7 @@ public class ArgsConst {
/** /**
* 附件所属变更 * 附件所属变更
*/ */
public static final String CHANGE = "Change"; public static final String CHANGE = "change";
/** /**
* 附件所属人员 * 附件所属人员
*/ */
@ -52,4 +55,9 @@ public class ArgsConst {
*/ */
public static final String DIRECTORS = "directors"; public static final String DIRECTORS = "directors";
/**
* 选调
*/
public static final String EXCHANGE = "exchange";
} }

View File

@ -42,6 +42,8 @@ public interface UrlConstant {
String PERSONNEL_INDICATORS = API + "/personnel_indicators"; String PERSONNEL_INDICATORS = API + "/personnel_indicators";
String ALTERATION = API + "/alteration"; String ALTERATION = API + "/alteration";
String Attachment = API + "/attachment";
/** /**

View File

@ -0,0 +1,70 @@
package com.ydool.staff.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
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.RestController;
import javax.annotation.Resource;
/**
* @author msh
* @version 1.0
* @date 2023/2/10 12:01
*/
@RestController
@RequestMapping(UrlConstant.ALTERATION)
@Api(tags = "附件", value = "附件")
@ApiSupport(order = 1)
public class AttachmentController extends BaseController {
@Resource
private IAttachmentService attachmentService;
@GetMapping("/selectOrganizationFileList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "根据id查附件列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "关联Id"),
@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "type", value = "附件类型:personnel人员change变更organization机构exchange选调,directors:董监")})
public AjaxResult selectOrganizationFileList(String id, String type){
return attachmentService.selectOrganizationFileList(getPage(),id, type);
}
@GetMapping("/download")
@ApiOperation(value = "下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")})
public void download(String path, String fileName) {
String fullFilePath = UploadUtils.getWebRoot() + path;
UploadUtils.download(response, fullFilePath, fileName);
}
@GetMapping("/fileList")
@ApiOperation(value = "文件列表")
@ApiImplicitParams({@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "id", value = "人员id", required = true)})
public AjaxResult fileList(String id) {
return attachmentService.fileList(getPage(), id);
}
@PostMapping("/deleteFile")
@ApiOperation(value = "删除附件")
public AjaxResult deleteFile(@RequestBody IdsRequest ids){
return attachmentService.deleteFile(ids);
}
}

View File

@ -46,14 +46,21 @@ public class ExchangeController extends BaseController {
@GetMapping("exchangePage") @GetMapping("exchangePage")
@ApiOperation(value = "人员选调列表,传id查一条",response = ExchangePageDto.class) @ApiOperation(value = "人员选调列表",response = ExchangePageDto.class)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "current", value = "当前页"), @ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"), @ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "id", value = "人员选调id")}) @ApiImplicitParam(name = "id", value = "人员选调id")})
public AjaxResult exchangePage(String id){ public AjaxResult exchangePage(){
return exchangeService.exchangePage(getPage(),id); return exchangeService.exchangePage(getPage());
} }
@GetMapping("selectById")
@ApiOperation(value = "查看")
@ApiImplicitParam(name = "id", value = "人员选调id")
public AjaxResult selectById(String id){
return exchangeService.selectById(id);
}
@PostMapping("saveExchange") @PostMapping("saveExchange")
@ApiOperation(value = "新增人员选调",response = ExchangeRequest.class) @ApiOperation(value = "新增人员选调",response = ExchangeRequest.class)
@ -68,8 +75,8 @@ public class ExchangeController extends BaseController {
@GetMapping("deleteExchange") @GetMapping("deleteExchange")
@ApiOperation(value = "删除人员选调",response = PersonnelDeleteRequest.class) @ApiOperation(value = "删除人员选调",response = PersonnelDeleteRequest.class)
public AjaxResult deleteExchange(@RequestBody PersonnelDeleteRequest request){ public AjaxResult deleteExchange(@RequestBody PersonnelDeleteRequest ids){
return exchangeService.deleteExchangeById(request); return exchangeService.deleteExchangeById(ids);
} }
} }

View File

@ -84,25 +84,6 @@ public class PersonnelController extends BaseController {
} }
@GetMapping("/download")
@ApiOperation(value = "下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")})
public void download(String path, String fileName) {
String fullFilePath = UploadUtils.getWebRoot() + path;
UploadUtils.download(response, fullFilePath, fileName);
}
@GetMapping("/fileList")
@ApiOperation(value = "文件列表")
@ApiImplicitParams({@ApiImplicitParam(name = "current", value = "当前页"), @ApiImplicitParam(name = "size", value = "每页条数"), @ApiImplicitParam(name = "id", value = "人员id", required = true)})
public AjaxResult fileList(String id) {
return attachmentService.fileList(new Page<Attachment>(getPageNum(), getPageSize()), id);
}
@PostMapping("/deleteFile")
@ApiOperation(value = "删除附件")
public AjaxResult deleteFile(@RequestBody IdsRequest ids){
return attachmentService.deleteFile(ids);
}
} }

View File

@ -0,0 +1,68 @@
package com.ydool.staff.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.staff.entity.Attachment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author msh
* @version 1.0
* @date 2023/2/2 17:15
*/
@Data
public class ExchangeOneDto {
@ApiModelProperty(value = "员工id")
private String personnelId;
@ApiModelProperty(value = "调入企业名称")
private String willCompanyName;
@ApiModelProperty(value = "调入信用代码")
private String willCOde;
@ApiModelProperty(value = "调出企业名称")
private String originalCompanyName;
@ApiModelProperty(value = "调入信用代码")
private String originalCode;
@ApiModelProperty(value = "姓名")
private String userName;
@ApiModelProperty(value = "身份证号")
private String cardId;
@ApiModelProperty(value = "现所在部门")
private String nowDept;
@ApiModelProperty(value = "拟所在部门")
private String willDept;
@ApiModelProperty(value = "现任岗位职务")
private String nowPosition;
@ApiModelProperty(value = "拟任岗位职务")
private String willPosition;
@ApiModelProperty(value = "选调理由")
private String excReason;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "选调相关附件")
private List<AttachmentDto> excFiles;
@ApiModelProperty(value = "初审意见")
private String firstTrialRemark;
@ApiModelProperty(value = "终审意见")
private String finalTrialRemark;
}

View File

@ -97,7 +97,7 @@ public class Personnel extends BaseEntity {
private String personnelCharacter; private String personnelCharacter;
@ApiModelProperty(value = "年薪") @ApiModelProperty(value = "年薪")
private BigDecimal annualSalary; private Integer annualSalary;
@ApiModelProperty(value = "入职时间") @ApiModelProperty(value = "入职时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")

View File

@ -46,7 +46,7 @@ public class ChangeRequest {
@ApiModelProperty(value = "年薪") @ApiModelProperty(value = "年薪")
@NotBlank(message = "年薪不能为空") @NotBlank(message = "年薪不能为空")
private BigDecimal annualSalary; private Integer annualSalary;
@ApiModelProperty(value = "退休时间") @ApiModelProperty(value = "退休时间")
@NotNull(message = "退休时间不能为空") @NotNull(message = "退休时间不能为空")

View File

@ -1,5 +1,6 @@
package com.ydool.staff.request; package com.ydool.staff.request;
import com.ydool.staff.dto.AttachmentDto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -36,6 +37,6 @@ public class ExchangeRequest {
private String remark; private String remark;
@ApiModelProperty(value = "选调相关附件") @ApiModelProperty(value = "选调相关附件")
private List<AttachmentRequest> attachmentList; private List<AttachmentDto> attachmentList;
} }

View File

@ -26,6 +26,6 @@ public interface IAttachmentService {
AjaxResult deleteFile(IdsRequest ids); AjaxResult deleteFile(IdsRequest ids);
AjaxResult selectOrganizationFileList(String id); AjaxResult selectOrganizationFileList(Page page,String id,String type);
} }

View File

@ -16,10 +16,12 @@ import com.ydool.staff.request.PersonnelUpdateRequest;
*/ */
public interface IExchangeService { public interface IExchangeService {
AjaxResult exchangePage(Page page, String id); AjaxResult exchangePage(Page page);
AjaxResult saveExchange(ExchangeRequest exchangeRequest); AjaxResult saveExchange(ExchangeRequest exchangeRequest);
AjaxResult deleteExchangeById(PersonnelDeleteRequest request); AjaxResult deleteExchangeById(PersonnelDeleteRequest request);
AjaxResult selectById(String id);
} }

View File

@ -78,11 +78,15 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
} }
@Override @Override
public AjaxResult selectOrganizationFileList(String id) { public AjaxResult selectOrganizationFileList(Page page, String id,String type) {
LambdaQueryWrapper<Attachment> attachmentLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Attachment> wrapper = new LambdaQueryWrapper<>();
attachmentLambdaQueryWrapper.eq(Attachment::getTargetId, id); wrapper.eq(Attachment::getTargetId, id);
attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, ArgsConst.ORGANIZATION); if(ArgsConst.PERSONNEL.equals(type)||ArgsConst.CHANGE.equals(type)){
Page<Attachment> attachmentPage = attachmentMapper.selectPage(new Page<>(), attachmentLambdaQueryWrapper); wrapper.in(Attachment::getTargetType, ArgsConst.CARD_FILE,ArgsConst.ENGAGE_FILE,ArgsConst.JOBTITLE_FILE,ArgsConst.EDUCATION_FILE,ArgsConst.AUDIT_FILE);
}else {
wrapper.eq(Attachment::getTargetType, type);
}
Page<Attachment> attachmentPage = attachmentMapper.selectPage(page, wrapper);
return AjaxResult.ok().data(attachmentPage); return AjaxResult.ok().data(attachmentPage);
} }
} }

View File

@ -6,14 +6,19 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.ExchangeOneDto;
import com.ydool.staff.dto.ExchangePageDto; import com.ydool.staff.dto.ExchangePageDto;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange; import com.ydool.staff.entity.Exchange;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.staff.entity.Organization; import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel; import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AttachmentMapper; import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper; import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.OrganizationMapper; import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper; import com.ydool.staff.mapper.PersonnelMapper;
@ -22,7 +27,9 @@ import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IExchangeService; import com.ydool.staff.service.IExchangeService;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User; import com.ydool.system.entity.User;
import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper; import com.ydool.system.mapper.UserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -49,27 +56,34 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
private PersonnelMapper personnelMapper; private PersonnelMapper personnelMapper;
@Resource @Resource
private AttachmentMapper attachmentMapper; private AttachmentMapper attachmentMapper;
@Resource @Resource
private OrganizationMapper organizationMapper; private ExchangeMapper exchangeMapper;
@Resource
private DeptMapper deptMapper;
@Resource
private CompanyNameMapper companyNameMapper;
@Resource @Resource
private UserMapper userMapper; private UserMapper userMapper;
@Override @Override
public AjaxResult exchangePage(Page page, String id) { public AjaxResult exchangePage(Page page) {
if (ObjectUtil.isNotNull(id)){
return AjaxResult.ok().data(get(id));
}
Page exchangePage = page(page, new LambdaQueryWrapper<>()); Page exchangePage = page(page, new LambdaQueryWrapper<>());
List<Exchange> list = exchangePage.getRecords(); List<Exchange> list = exchangePage.getRecords();
exchangePage.setRecords(list.stream().map(e->{ exchangePage.setRecords(list.stream().map(e->{
ExchangePageDto dto = BeanUtil.copyProperties(e, ExchangePageDto.class); ExchangePageDto dto = BeanUtil.copyProperties(e, ExchangePageDto.class);
Personnel personnel = personnelMapper.selectById(dto.getPersonnelId()); Personnel personnel = personnelMapper.selectById(dto.getPersonnelId());
Organization organization = organizationMapper.selectById(e.getWillCompanyId()); CompanyName original = companyNameMapper.selectById(personnel.getCompanyName());
CompanyName will = companyNameMapper.selectById(e.getWillCompanyId());
Dept originalDept = deptMapper.selectById(personnel.getPresentDept());
Dept willDept = deptMapper.selectById(e.getWillDept());
User user = userMapper.selectById((String)StpUtil.getLoginId()); User user = userMapper.selectById((String)StpUtil.getLoginId());
dto.setUserName(personnel.getUserName()); dto.setUserName(personnel.getUserName());
dto.setOriginalCompanyName(personnel.getCompanyName()); dto.setOriginalCompanyName(original.getCompanyName());
// dto.setWillCompanyName(organization.getCompanyName()); dto.setWillCompanyName(will.getCompanyName());
dto.setCardId(personnel.getNumberId()); dto.setCardId(personnel.getNumberId());
dto.setNowDept(personnel.getPresentDept()); dto.setNowDept(originalDept.getName());
dto.setWillDept(willDept.getName());
dto.setNowPosition(personnel.getPosition()); dto.setNowPosition(personnel.getPosition());
dto.setWritten(user.getUserName()); dto.setWritten(user.getUserName());
return dto; return dto;
@ -80,17 +94,18 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult saveExchange(ExchangeRequest exchangeRequest) { public AjaxResult saveExchange(ExchangeRequest exchangeRequest) {
List<AttachmentRequest> attachmentList = exchangeRequest.getAttachmentList(); List<AttachmentDto> attachmentList = exchangeRequest.getAttachmentList();
ArrayList<String> s = new ArrayList<>(); ArrayList<String> s = new ArrayList<>();
Exchange exchange = BeanUtil.copyProperties(exchangeRequest, Exchange.class); Exchange exchange = BeanUtil.copyProperties(exchangeRequest, Exchange.class);
for (AttachmentRequest request : attachmentList) { for (AttachmentDto request : attachmentList) {
s.add(request.getPath()); s.add(request.getPath());
exchange.setExcFile(StringUtils.join(s,',')); exchange.setExcFile(StringUtils.join(s,','));
} }
boolean save = save(exchange); boolean save = save(exchange);
for (AttachmentRequest request : attachmentList) { for (AttachmentDto request : attachmentList) {
Attachment attachment = BeanUtil.copyProperties(request, Attachment.class); Attachment attachment = BeanUtil.copyProperties(request, Attachment.class);
attachment.setTargetId(exchange.getId()); attachment.setTargetId(exchange.getId());
attachment.setTargetType(ArgsConst.EXCHANGE);
attachmentMapper.insert(attachment); attachmentMapper.insert(attachment);
} }
return save ?AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!"); return save ?AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
@ -103,10 +118,37 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
if (CollectionUtil.isEmpty(asList)) { if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空"); return AjaxResult.fail().msg("Id不能为空");
} else { } else {
int i = personnelMapper.deleteBatchIds(asList); int i = exchangeMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!"); return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
} }
} }
@Override
public AjaxResult selectById(String id) {
Exchange exchange = getById(id);
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
CompanyName nowCompany = companyNameMapper.selectById(personnel.getCompanyName());
Dept nowDept = deptMapper.selectById(personnel.getPresentDept());
CompanyName willCompany = companyNameMapper.selectById(exchange.getWillCompanyId());
Dept dept = deptMapper.selectById(exchange.getWillDept());
List<Attachment> attachments = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, exchange.getId()));
List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachments, AttachmentDto.class);
System.out.println("byId = " + exchange);
ExchangeOneDto exchangeOneDto = BeanUtil.copyProperties(exchange, ExchangeOneDto.class);
exchangeOneDto.setWillCompanyName(willCompany.getCompanyName());
exchangeOneDto.setWillCOde(willCompany.getCreditCode());
exchangeOneDto.setOriginalCompanyName(nowCompany.getCompanyName());
exchangeOneDto.setOriginalCode(nowCompany.getCreditCode());
exchangeOneDto.setUserName(personnel.getUserName());
exchangeOneDto.setCardId(personnel.getNumberId());
exchangeOneDto.setNowDept(nowDept.getName());
exchangeOneDto.setWillDept(dept.getName());
exchangeOneDto.setNowPosition(personnel.getPosition());
exchangeOneDto.setExcFiles(attachmentDtos);
return AjaxResult.ok().data(exchangeOneDto);
}
} }

View File

@ -1,9 +1,11 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
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;
@ -17,10 +19,12 @@ import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Alteration; import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.CompanyName; import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel; import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.SelectRequest; import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.mapper.AlterationMapper; import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.mapper.CompanyNameMapper; import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper; import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.ChangeRequest; import com.ydool.staff.request.ChangeRequest;
@ -36,6 +40,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.Null;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -194,20 +201,20 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type, request.getId()), ','); String engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type, request.getId()), ',');
String education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, request.getId()), ','); String education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, request.getId()), ',');
String audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, request.getId()), ','); String audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, request.getId()), ',');
saveAlteration("录用方式更改", per.getHireType(), request.getHireType(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getHireType)); saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getHireType));
saveAlteration("执业资格更改", per.getQualification(), request.getQualification(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getQualification)); saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification));
saveAlteration("专业技术职称更改", per.getJobTitle(), request.getJobTitle(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getJobTitle)); saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle));
saveAlteration("岗位职务更改", per.getPosition(), request.getPosition(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getPosition)); saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition));
saveAlteration("工作状态更改", per.getWorkState(), request.getWorkState(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getWorkState)); saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState));
saveAlteration("人员性质更改", per.getPersonnelCharacter(), request.getPersonnelCharacter(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)); saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter));
saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getAnnualSalary)); saveAlteration("年薪更改",per.getAnnualSalary(),request.getAnnualSalary(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getAnnualSalary));
saveAlteration("退休时间更改", per.getRetirementTime(), request.getRetirementTime(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getRetirementTime)); saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRetirementTime));
saveAlteration("人员招聘单号更改", per.getRecruitNumber(), request.getRecruitNumber(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getRecruitNumber)); saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber));
saveAlteration("身份证附件更改", per.getCardFile(), card, type, request.getId(), ColumnUtil.getFieldName(Personnel::getCardFile)); saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile));
saveAlteration("聘任证书附件更改", per.getEngageFile(), jobTitle, type, request.getId(), ColumnUtil.getFieldName(Personnel::getEngageFile)); saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile));
saveAlteration("职称证书附件更改", per.getJobTitleFile(), engage, type, request.getId(), ColumnUtil.getFieldName(Personnel::getJobTitleFile)); saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile));
saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, request.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile)); saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile));
saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, request.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile)); saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile));
per.setAuditState(0); per.setAuditState(0);
boolean update = updateById(per); boolean update = updateById(per);
saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE);
@ -239,6 +246,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
attachmentService.savePersonnel(attachment); attachmentService.savePersonnel(attachment);
} }
} }
} }
/** /**
@ -261,13 +269,12 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
return path; return path;
} }
return new ArrayList<>(); return null;
} }
public void saveAlteration(String details, Object before, Object after, String type, String id, String fieldName) { public void saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){
if (ObjectUtil.isNotNull(after)) { if (ObjectUtil.isNotNull(after)){
System.out.println("after = " + after); if (!after.equals(before)){
if (!before.equals(after)) {
Alteration alteration = new Alteration(); Alteration alteration = new Alteration();
alteration.setDetails(details); alteration.setDetails(details);
alteration.setFieldName(fieldName); alteration.setFieldName(fieldName);
@ -282,6 +289,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
alterationMapper.insert(alteration); alterationMapper.insert(alteration);
} }
} }
} }
public List<AttachmentDto> nameAndPath(String file, String id) { public List<AttachmentDto> nameAndPath(String file, String id) {
@ -303,16 +311,30 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return null; return null;
} }
public QueryWrapper selectWrapper(SelectRequest request, String orderBy, String column) { public QueryWrapper selectWrapper(SelectRequest request,String orderBy,String column){
QueryWrapper<Personnel> wrapper = new QueryWrapper<>(); QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType()).eq(StrUtil.isNotBlank(request.getPresentDept()), Personnel::getPresentDept, request.getPresentDept()).eq(StrUtil.isNotBlank(request.getPoliticsStatus()), Personnel::getPoliticsStatus, request.getPoliticsStatus()).eq(StrUtil.isNotBlank(request.getHireType()), Personnel::getHireType, request.getHireType()).eq(StrUtil.isNotBlank(request.getPosition()), Personnel::getPosition, request.getPosition()).eq(StrUtil.isNotBlank(request.getContractModality()), Personnel::getContractModality, request.getContractModality()).eq(StrUtil.isNotBlank(request.getQualification()), Personnel::getQualification, request.getQualification()).eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType()).eq(ObjectUtil.isNotNull(request.getHireDate()), Personnel::getHireDate, request.getHireDate()).eq(ObjectUtil.isNotNull(request.getResignationTime()), Personnel::getResignationTime, request.getResignationTime()).eq(StrUtil.isNotBlank(request.getWorkState()), Personnel::getWorkState, request.getWorkState()).eq(StrUtil.isNotBlank(request.getReceipts()), Personnel::getRecruitNumber, request.getReceipts()).eq(StrUtil.isNotBlank(request.getAlterationSign()), Personnel::getAlterationSign, request.getAlterationSign()); wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
wrapper.lambda().like(Personnel::getUserName, request.getUserName()).like(Personnel::getNumberId, request.getNumberId()) .eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept())
.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() + "%'"); .eq(StrUtil.isNotBlank(request.getPoliticsStatus()),Personnel::getPoliticsStatus,request.getPoliticsStatus())
.eq(StrUtil.isNotBlank(request.getHireType()),Personnel::getHireType,request.getHireType())
.eq(StrUtil.isNotBlank(request.getPosition()),Personnel::getPosition,request.getPosition())
.eq(StrUtil.isNotBlank(request.getContractModality()),Personnel::getContractModality,request.getContractModality())
.eq(StrUtil.isNotBlank(request.getQualification()),Personnel::getQualification,request.getQualification())
.eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
.eq(ObjectUtil.isNotNull(request.getHireDate()),Personnel::getHireDate,request.getHireDate())
.eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime())
.eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState())
.eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getRecruitNumber,request.getReceipts())
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName())
.like(Personnel::getNumberId,request.getNumberId())
/*.like(Personnel::getAuditFile,request.getFileName()).or() /*.like(Personnel::getAuditFile,request.getFileName()).or()
.like(Personnel::getCardFile,request.getFileName()).or() .like(Personnel::getCardFile,request.getFileName()).or()
.like(Personnel::getEducationFile,request.getFileName()).or() .like(Personnel::getEducationFile,request.getFileName()).or()
.like(Personnel::getEngageFile,request.getFileName()).or() .like(Personnel::getEngageFile,request.getFileName()).or()
.like(Personnel::getJobTitleFile,request.getFileName()).or()*/ .like(Personnel::getJobTitleFile,request.getFileName()).or()*/
.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() + "%'");
if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) { if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {
wrapper.orderByDesc(column); wrapper.orderByDesc(column);
} }

View File

@ -99,7 +99,7 @@ sa-token:
# token名称 (同时也是cookie名称) # token名称 (同时也是cookie名称)
token-name: x-token token-name: x-token
# token有效期单位s 默认30天, -1代表永不过期 # token有效期单位s 默认30天, -1代表永不过期
timeout: 86400 timeout: 864000
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 # token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout: 1800 activity-timeout: 1800
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)