bug修改2.2

This commit is contained in:
mash 2023-02-24 11:02:30 +08:00
parent 81671e21cd
commit 8272cd7324
10 changed files with 48 additions and 32 deletions

View File

@ -33,8 +33,10 @@ public class AlterationController extends BaseController {
@GetMapping( "alterationPage") @GetMapping( "alterationPage")
@ApiOperation(value = "变更记录列表") @ApiOperation(value = "变更记录列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "员工id")}) @ApiImplicitParam(name = "id", value = "员工id"),
public AjaxResult alterationPage(String id){ @ApiImplicitParam(name = "personnelType", value = "人员类型personnel人员 change变更")
return alterationService.alterationList(id); })
public AjaxResult alterationPage(String id,String personnelType){
return alterationService.alterationList(id,personnelType);
} }
} }

View File

@ -48,9 +48,13 @@ public class AuditController extends BaseController {
@GetMapping("audtiLog") @GetMapping("audtiLog")
@ApiOperation(value = "处理日志",response = AuditLogDto.class) @ApiOperation(value = "处理日志",response = AuditLogDto.class)
@ApiImplicitParam(name = "id",value = "员工id") @ApiImplicitParams({
public AjaxResult audtiLog(String id){ @ApiImplicitParam(name = "id",value = "员工id"),
return auditLogService.auditLog(id); @ApiImplicitParam(name = "personnelType",value = "人员类型personnel人员 change变更")
})
public AjaxResult audtiLog(String id, String personnelType){
return auditLogService.auditLog(id,personnelType);
} }

View File

@ -63,10 +63,11 @@ public class PersonnelController extends BaseController {
@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" ),
}) })
public AjaxResult getById(String id,String type){ public AjaxResult getById(String id,String type,String personnelType){
return personnelService.getById(id,type); return personnelService.getById(id,type,personnelType);
} }
@PostMapping(value = "savePersonnel") @PostMapping(value = "savePersonnel")

View File

@ -1,6 +1,5 @@
package com.ydool.staff.service; package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
/** /**
@ -13,7 +12,7 @@ import com.ydool.common.data.dto.AjaxResult;
*/ */
public interface IAlterationService { public interface IAlterationService {
AjaxResult alterationList(String id); AjaxResult alterationList(String id, String personnelType);
} }

View File

@ -12,6 +12,6 @@ import com.ydool.common.data.dto.AjaxResult;
*/ */
public interface IAuditLogService { public interface IAuditLogService {
AjaxResult auditLog(String id); AjaxResult auditLog(String id, String personnelType);
} }

View File

@ -29,7 +29,7 @@ public interface IPersonnelService {
*/ */
AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column); AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column);
AjaxResult getById(String id,String type); AjaxResult getById(String id,String type,String personnelType);
AjaxResult personnelByExchangeList(); AjaxResult personnelByExchangeList();
/** /**

View File

@ -1,17 +1,13 @@
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;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
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.AlterationDto; import com.ydool.staff.dto.AlterationDto;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Alteration; import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AlterationMapper; 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;
@ -21,10 +17,8 @@ import com.ydool.system.mapper.UserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@ -41,8 +35,11 @@ public class AlterationServiceImpl extends BaseService<AlterationMapper, Alterat
private UserMapper userMapper; private UserMapper userMapper;
@Override @Override
public AjaxResult alterationList(String id) { public AjaxResult alterationList(String id, String personnelType) {
List<Alteration> list = list(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id)); LambdaQueryWrapper<Alteration> wrapper = new LambdaQueryWrapper<Alteration>()
.eq(Alteration::getRelevancyId, id).eq(Alteration::getType,personnelType)
.orderByDesc(Alteration::getCreatedAt);
List<Alteration> list = list(wrapper);
List<AlterationDto> alterationDtos = new ArrayList<>(); List<AlterationDto> alterationDtos = new ArrayList<>();
DeptMapper deptMapper = SpringUtil.getBean(DeptMapper.class); DeptMapper deptMapper = SpringUtil.getBean(DeptMapper.class);
for (Alteration alteration : list) { for (Alteration alteration : list) {

View File

@ -1,11 +1,14 @@
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.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
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.AuditLogDto; import com.ydool.staff.dto.AuditLogDto;
import com.ydool.staff.entity.AuditLog; import com.ydool.staff.entity.AuditLog;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AuditLogMapper; import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.service.IAuditLogService; import com.ydool.staff.service.IAuditLogService;
import com.ydool.system.entity.User; import com.ydool.system.entity.User;
@ -29,8 +32,11 @@ public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> i
private UserMapper userMapper; private UserMapper userMapper;
@Override @Override
public AjaxResult auditLog(String id) { public AjaxResult auditLog(String id, String personnelType) {
List<AuditLog> list = list(new LambdaQueryWrapper<AuditLog>().eq(AuditLog::getPersonnelId, id).orderByDesc(AuditLog::getCreatedAt)); LambdaQueryWrapper<AuditLog> wrapper = new LambdaQueryWrapper<AuditLog>()
.eq(AuditLog::getType,personnelType)
.eq(AuditLog::getPersonnelId, id).orderByDesc(AuditLog::getCreatedAt);
List<AuditLog> list = list(wrapper);
List<AuditLogDto> auditLogDtos = BeanUtil.copyToList(list, AuditLogDto.class); List<AuditLogDto> auditLogDtos = BeanUtil.copyToList(list, AuditLogDto.class);
for (AuditLogDto auditLogDto : auditLogDtos) { for (AuditLogDto auditLogDto : auditLogDtos) {
User user = userMapper.selectById(auditLogDto.getApprover()); User user = userMapper.selectById(auditLogDto.getApprover());

View File

@ -147,6 +147,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
personnelOne.setState("2"); personnelOne.setState("2");
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){ if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){
personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion()); personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion());
personnelOne.setWorkState("在职");
personnelOne.setAlterationSign("2"); personnelOne.setAlterationSign("2");
personnelOne.setAuditState(3); personnelOne.setAuditState(3);
} }

View File

@ -143,18 +143,24 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return AjaxResult.ok().data(personnelPage); return AjaxResult.ok().data(personnelPage);
} }
public AjaxResult getById(String id,String type) { /**
* 获取一条
* @param id 人员id
* @param type update修改 audit审批
* @return
*/
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)){
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>() BeanUtil.copyProperties(personnelMapper.selectById(id),personnel);
.eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getType,ArgsConst.PERSONNEL).eq(PersonnelMiddle::getState, "1"));
BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel);
}else { }else {
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>() LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>()
.eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getType,ArgsConst.CHANGE).eq(PersonnelMiddle::getState, "1")); .eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getState, "1")
.eq(PersonnelMiddle::getType, personnelType);
PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper);
BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel); BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel);
} }
if (ObjectUtil.isEmpty(personnel))return AjaxResult.fail().msg("该人员不存在!"); if (ObjectUtil.isEmpty(personnel))return AjaxResult.fail().msg("该人员不存在!");
@ -289,8 +295,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
List<AttachmentRequest> engageFiles = request.getEngageFiles(); List<AttachmentRequest> engageFiles = request.getEngageFiles();
List<AttachmentRequest> educationFiles = request.getEducationFiles(); List<AttachmentRequest> educationFiles = request.getEducationFiles();
List<AttachmentRequest> auditFiles = request.getAuditFiles(); List<AttachmentRequest> auditFiles = request.getAuditFiles();
if ("1".equals(per.getChangeAlterationSign())) { if ("1".equals(per.getAlterationSign())) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员"); return AjaxResult.fail().msg("该人员在申报中,资料未完成审批,请等待领导审批");
} }
String type = ArgsConst.CHANGE; String type = ArgsConst.CHANGE;
String card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, request.getId()), ','); String card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, request.getId()), ',');