update 人员
This commit is contained in:
parent
ed9dee7a0d
commit
9642903945
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,20 +272,24 @@ 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 (!before.equals(after)){
|
if (ObjectUtil.isNotNull(after)){
|
||||||
Alteration alteration = new Alteration();
|
System.out.println("after = " + after);
|
||||||
alteration.setDetails(details);
|
if (!before.equals(after)){
|
||||||
alteration.setFieldName(fieldName);
|
Alteration alteration = new Alteration();
|
||||||
alteration.setType(type);
|
alteration.setDetails(details);
|
||||||
alteration.setRelevancyId(id);
|
alteration.setFieldName(fieldName);
|
||||||
if (ObjectUtil.isNotNull(before)){
|
alteration.setType(type);
|
||||||
alteration.setBeforeChange( before.toString());
|
alteration.setRelevancyId(id);
|
||||||
}else {
|
if (ObjectUtil.isNotNull(before)){
|
||||||
alteration.setBeforeChange("无");
|
alteration.setBeforeChange( before.toString());
|
||||||
|
}else {
|
||||||
|
alteration.setBeforeChange("无");
|
||||||
|
}
|
||||||
|
alteration.setAfterChange(after.toString());
|
||||||
|
alterationMapper.insert(alteration);
|
||||||
}
|
}
|
||||||
alteration.setAfterChange(after.toString());
|
|
||||||
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)){
|
||||||
|
|
Loading…
Reference in New Issue