update 人员

This commit is contained in:
mash 2023-02-09 16:32:39 +08:00
parent ed9dee7a0d
commit 9642903945
2 changed files with 44 additions and 19 deletions

View File

@ -1,5 +1,6 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -15,9 +16,13 @@ import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.service.IAlterationService; import com.ydool.staff.service.IAlterationService;
import com.ydool.system.entity.Dept; 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 javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -32,17 +37,32 @@ import java.util.stream.Collectors;
@Service @Service
public class AlterationServiceImpl extends BaseService<AlterationMapper, Alteration> implements IAlterationService { public class AlterationServiceImpl extends BaseService<AlterationMapper, Alteration> implements IAlterationService {
@Resource
private UserMapper userMapper;
@Override @Override
public AjaxResult alterationList(String id) { public AjaxResult alterationList(String id) {
List<Alteration> list = list(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id)); List<Alteration> list = list(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id));
List<AlterationDto> alterationDtos = BeanUtil.copyToList(list, AlterationDto.class); List<AlterationDto> alterationDtos = new ArrayList<>();
for (Alteration dto : list) { DeptMapper deptMapper = SpringUtil.getBean(DeptMapper.class);
UserMapper userMapper = SpringUtil.getBean(UserMapper.class); for (Alteration alteration : list) {
User user = userMapper.selectById(dto.getCreatedId()); AlterationDto dto = BeanUtil.copyProperties(alteration, AlterationDto.class);
for (AlterationDto alterationDto : alterationDtos) { User user = userMapper.selectById(alteration.getCreatedId());
alterationDto.setCreatedName(user.getUserName()); dto.setCreatedName(user.getUserName());
if ("presentDept".equals(alteration.getFieldName())){
Dept deptBeforeChange = deptMapper.selectById(dto.getBeforeChange());
Dept deptAfterChange = deptMapper.selectById(dto.getAfterChange());
dto.setBeforeChange(deptBeforeChange.getName());
dto.setAfterChange(deptAfterChange.getName());
} }
if ("freshGraduate".equals(alteration.getFieldName())){
if ("0".equals(alteration.getBeforeChange())){
dto.setBeforeChange("");
}if ("1".equals(alteration.getAfterChange())){
dto.setAfterChange("");
}
}
alterationDtos.add(dto);
} }
return AjaxResult.ok().data(alterationDtos); return AjaxResult.ok().data(alterationDtos);
} }

View File

@ -160,6 +160,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String card = StringUtils.join(saveFilePath(cardFile, AgesConst.CARD_FILE, AgesConst.UPDATE, updateRequest.getId()), ','); String card = StringUtils.join(saveFilePath(cardFile, AgesConst.CARD_FILE, AgesConst.UPDATE, updateRequest.getId()), ',');
String education = StringUtils.join(saveFilePath(educationFile,AgesConst.EDUCATION_FILE,AgesConst.UPDATE,updateRequest.getId()),','); String education = StringUtils.join(saveFilePath(educationFile,AgesConst.EDUCATION_FILE,AgesConst.UPDATE,updateRequest.getId()),',');
String audit = StringUtils.join(saveFilePath(auditFile,AgesConst.AUDIT_FILE,AgesConst.UPDATE,updateRequest.getId()),','); String audit = StringUtils.join(saveFilePath(auditFile,AgesConst.AUDIT_FILE,AgesConst.UPDATE,updateRequest.getId()),',');
System.out.println("per = " + per);
if (per.getAuditState().equals(0)||per.getAuditState().equals(1)) { if (per.getAuditState().equals(0)||per.getAuditState().equals(1)) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!"); return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
} }
@ -271,6 +272,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
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)){
System.out.println("after = " + after);
if (!before.equals(after)){ if (!before.equals(after)){
Alteration alteration = new Alteration(); Alteration alteration = new Alteration();
alteration.setDetails(details); alteration.setDetails(details);
@ -286,6 +289,8 @@ 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){
if (StrUtil.isNotBlank(file)){ if (StrUtil.isNotBlank(file)){
List<String> cardFile = Arrays.asList(file.split(",")); List<String> cardFile = Arrays.asList(file.split(","));