Merge remote-tracking branch 'origin/master'

This commit is contained in:
lijiaqi 2023-02-09 16:58:53 +08:00
commit 796e2688ce
9 changed files with 77 additions and 69 deletions

View File

@ -5,10 +5,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.staff.request.MechanismRequest;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.service.*;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
@ -35,23 +33,8 @@ public class OrganizationController extends BaseController {
@Autowired
IAttachmentService attachmentService;
// @GetMapping("/selectOrganization")
// @ApiOperation(value = "企业名称列表")
// @ApiOperationSupport(order = 1)
// public AjaxResult selectOrganization() {
// return organizationService.selectOrganization();
// }
//
// @GetMapping("/selectOrganizationByName")
// @ApiOperation(value = "企业名称查企业信息")
// @ApiOperationSupport(order = 2)
// // @ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称", required = true)})
// public AjaxResult selectOrganizationByName(String companyName) {
// return organizationService.selectOrganizationByName(companyName);
// }
/**
* =======================内设机构登记===========================
* =======================内设机构登记=========================
* @return
*/
@ -74,7 +57,7 @@ public class OrganizationController extends BaseController {
@GetMapping("/selectOrganizationByMechanism")
@ApiOperation(value = "内设机构登记详情")
@ApiOperationSupport(order = 4)
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "内设机构Id")})
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "内设机构Id", required = true)})
public AjaxResult selectOrganizationByMechanism(String id) {
return organizationService.selectOrganizationByMechanism(id);
}
@ -87,7 +70,7 @@ public class OrganizationController extends BaseController {
}
/**
* =======================机构信息=========================
* ===========================机构信息============================
* @return
*/
@ -98,36 +81,16 @@ public class OrganizationController extends BaseController {
return mechanismService.saveOrganizationMechanism(mechanismRequest);
}
// @PostMapping("/deleteMechanism")
// @ApiOperation(value = "机构信息删除")
// @ApiOperationSupport(order = 7)
// public AjaxResult deleteMechanism(@RequestBody IdsRequest id) {
// return mechanismService.deleteMechanism(id);
// }
/**
* ========================党组织信息========================
* ==========================党组织信息===========================
* @return
*/
// @GetMapping("/selectPartyOrganizationList")
// @ApiOperation(value = "党组织信息列表")
// @ApiOperationSupport(order = 8)
// public AjaxResult selectPartyOrganizationList() {
// return partyOrganizationService.selectPartyOrganizationList(new Page<PartyOrganization>(getPageNum(), getPageSize()));
// }
@PostMapping("/savePartyOrganization")
@ApiOperation(value = "党组织信息新增")
@ApiOperationSupport(order = 9)
@ApiOperationSupport(order = 7)
public AjaxResult savePartyOrganization(@RequestBody @Validated PartyOrganization partyOrganization) {
return partyOrganizationService.savePartyOrganization(partyOrganization);
}
// @PostMapping("/deletePartyOrganization")
// @ApiOperation(value = "党组织信息删除")
// @ApiOperationSupport(order = 10)
// public AjaxResult deletePartyOrganization(@RequestBody IdsRequest id) {
// return partyOrganizationService.deletePartyOrganization(id);
// }
}

View File

@ -6,6 +6,9 @@ import lombok.Data;
@Data
public class DirectorsSupervisorsDto {
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "姓名")
private String username;

View File

@ -1,5 +1,6 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil;
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.system.entity.Dept;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -32,17 +37,32 @@ import java.util.stream.Collectors;
@Service
public class AlterationServiceImpl extends BaseService<AlterationMapper, Alteration> implements IAlterationService {
@Resource
private UserMapper userMapper;
@Override
public AjaxResult alterationList(String id) {
List<Alteration> list = list(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id));
List<AlterationDto> alterationDtos = BeanUtil.copyToList(list, AlterationDto.class);
for (Alteration dto : list) {
UserMapper userMapper = SpringUtil.getBean(UserMapper.class);
User user = userMapper.selectById(dto.getCreatedId());
for (AlterationDto alterationDto : alterationDtos) {
alterationDto.setCreatedName(user.getUserName());
List<AlterationDto> alterationDtos = new ArrayList<>();
DeptMapper deptMapper = SpringUtil.getBean(DeptMapper.class);
for (Alteration alteration : list) {
AlterationDto dto = BeanUtil.copyProperties(alteration, AlterationDto.class);
User user = userMapper.selectById(alteration.getCreatedId());
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);
}

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
/**
@ -66,10 +67,11 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteFile(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
List<String> asList = Arrays.asList(id.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = attachmentMapper.deleteBatchIds(Arrays.asList(id.getIds()));
int i = attachmentMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}

View File

@ -1,5 +1,6 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult;
@ -44,6 +45,9 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
@Override
public AjaxResult selectCompanyNameById(String id) {
CompanyName companyName = companyNameMapper.selectById(id);
if (ObjectUtil.isNull(companyName)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
List<Recruitment> recruitments = recruitmentMapper.selectList(new LambdaQueryWrapper<Recruitment>().eq(Recruitment::getCompanyId, companyName.getId()));
CompanyNameRequest companyNameRequest = new CompanyNameRequest();
companyNameRequest.setRecruitments(recruitments);

View File

@ -2,6 +2,7 @@ package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -43,6 +45,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
public AjaxResult selectDirectorsSupervisorsList(Page<DirectorsSupervisors> page, DirectorsSupervisorsDto directorsSupervisorsDto) {
LambdaQueryWrapper<DirectorsSupervisors> directorsSupervisorsLambdaQueryWrapper = new LambdaQueryWrapper<>();
directorsSupervisorsLambdaQueryWrapper.exists(StrUtil.isNotBlank(directorsSupervisorsDto.getCompanyName()), "select t2.id from t_lc_company_name t2 where t_lc_directors_supervisors.organization_id = t2.id and t2.company_name like '%" + directorsSupervisorsDto.getCompanyName() + "%'");
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getUsername()), DirectorsSupervisors::getUsername, directorsSupervisorsDto.getUsername());
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getDirectorsType()), DirectorsSupervisors::getDirectorsType, directorsSupervisorsDto.getDirectorsType());
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getPersonnelType()), DirectorsSupervisors::getPersonnelType, directorsSupervisorsDto.getPersonnelType());
@ -60,7 +63,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
for (AttachmentDto attachment : attachmentList) {
list.add(attachment.getPath());
}
directorsSupervisors.setCorrelationFile(StringUtils.join(list,","));
directorsSupervisors.setCorrelationFile(StringUtils.join(list, ","));
int i = directorsSupervisorsMapper.insert(directorsSupervisors);
if (i > 0) {
List<AttachmentDto> attachmentDtoList = directorsSupervisors.getAttachmentDtoList();
@ -85,10 +88,11 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteDirectorsSupervisors(IdsRequest ids) {
if (CollectionUtil.isEmpty(Arrays.asList(ids.getIds()))) {
List<String> asList = Arrays.asList(ids.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = directorsSupervisorsMapper.deleteBatchIds(Arrays.asList(ids.getIds()));
int i = directorsSupervisorsMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@ -96,6 +100,9 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
public AjaxResult selectDirectorsSupervisorsById(String id) {
DirectorsSupervisors directorsSupervisors = directorsSupervisorsMapper.selectById(id);
if (ObjectUtil.isNull(directorsSupervisors)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, "directors"));
List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachmentList, AttachmentDto.class);
directorsSupervisors.setAttachmentDtoList(attachmentDtos);

View File

@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -51,7 +52,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
public AjaxResult selectOrganizationList(Page<Organization> page, String companyName) {
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(companyName), Organization::getCompanyName, companyName);
organizationLambdaQueryWrapper.exists(StrUtil.isNotBlank(companyName), "select t2.id from t_lc_company_name t2 where t_lc_organization.company_id = t2.id and t2.company_name like '%" + companyName + "%'");
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
for (Organization record : selectPage.getRecords()) {
record.setUpdatedName(userMapper.selectById(record.getUpdatedId()).getUserName());
@ -84,10 +85,11 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteOrganization(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
List<String> asList = Arrays.asList(id.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = organizationMapper.deleteBatchIds(Arrays.asList(id.getIds()));
int i = organizationMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}

View File

@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.List;
/**
* <p>

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 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()),',');
System.out.println("per = " + per);
if (per.getAuditState().equals(0)||per.getAuditState().equals(1)) {
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){
if (ObjectUtil.isNotNull(after)){
System.out.println("after = " + after);
if (!before.equals(after)){
Alteration alteration = new Alteration();
alteration.setDetails(details);
@ -286,6 +289,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
alterationMapper.insert(alteration);
}
}
}
public List<AttachmentDto> nameAndPath(String file,String id){
if (StrUtil.isNotBlank(file)){
List<String> cardFile = Arrays.asList(file.split(","));