From ed9dee7a0d9b248f4891fb9f182d938ace98d53d Mon Sep 17 00:00:00 2001 From: zhuyy Date: Thu, 9 Feb 2023 15:26:39 +0800 Subject: [PATCH 1/2] update --- .../controller/OrganizationController.java | 47 ++----------------- .../staff/dto/DirectorsSupervisorsDto.java | 3 ++ .../service/impl/AttachmentServiceImpl.java | 6 ++- .../service/impl/CompanyNameServiceImpl.java | 4 ++ .../impl/DirectorsSupervisorsServiceImpl.java | 13 +++-- .../service/impl/OrganizationServiceImpl.java | 8 ++-- .../impl/PartyOrganizationServiceImpl.java | 2 + 7 files changed, 33 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/ydool/staff/controller/OrganizationController.java b/src/main/java/com/ydool/staff/controller/OrganizationController.java index d25fad9..40b3277 100644 --- a/src/main/java/com/ydool/staff/controller/OrganizationController.java +++ b/src/main/java/com/ydool/staff/controller/OrganizationController.java @@ -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(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); - // } } diff --git a/src/main/java/com/ydool/staff/dto/DirectorsSupervisorsDto.java b/src/main/java/com/ydool/staff/dto/DirectorsSupervisorsDto.java index 7f96e86..963d92e 100644 --- a/src/main/java/com/ydool/staff/dto/DirectorsSupervisorsDto.java +++ b/src/main/java/com/ydool/staff/dto/DirectorsSupervisorsDto.java @@ -6,6 +6,9 @@ import lombok.Data; @Data public class DirectorsSupervisorsDto { + @ApiModelProperty(value = "企业名称") + private String companyName; + @ApiModelProperty(value = "姓名") private String username; diff --git a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java index 72c891f..a7380c9 100644 --- a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java @@ -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 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("删除失败!"); } } diff --git a/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java index 26f588f..17ef4eb 100644 --- a/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java @@ -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 recruitments = recruitmentMapper.selectList(new LambdaQueryWrapper().eq(Recruitment::getCompanyId, companyName.getId())); CompanyNameRequest companyNameRequest = new CompanyNameRequest(); companyNameRequest.setRecruitments(recruitments); diff --git a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java index 39d7afa..15cbc23 100644 --- a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java @@ -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 page, DirectorsSupervisorsDto directorsSupervisorsDto) { LambdaQueryWrapper 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 0) { List attachmentDtoList = directorsSupervisors.getAttachmentDtoList(); @@ -85,10 +88,11 @@ public class DirectorsSupervisorsServiceImpl extends BaseService 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 attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, "directors")); List attachmentDtos = BeanUtil.copyToList(attachmentList, AttachmentDto.class); directorsSupervisors.setAttachmentDtoList(attachmentDtos); diff --git a/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java index 3684dbc..808ca42 100644 --- a/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java @@ -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 page, String companyName) { LambdaQueryWrapper 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 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 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("删除失败!"); } } diff --git a/src/main/java/com/ydool/staff/service/impl/PartyOrganizationServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PartyOrganizationServiceImpl.java index 5e00243..d438a52 100644 --- a/src/main/java/com/ydool/staff/service/impl/PartyOrganizationServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PartyOrganizationServiceImpl.java @@ -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; /** *

From 9642903945358a8d7cb9052b71e7f5b987c78b30 Mon Sep 17 00:00:00 2001 From: mash Date: Thu, 9 Feb 2023 16:32:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?update=20=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AlterationServiceImpl.java | 34 +++++++++++++++---- .../service/impl/PersonnelServiceImpl.java | 29 +++++++++------- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/ydool/staff/service/impl/AlterationServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AlterationServiceImpl.java index 6779390..b14f090 100644 --- a/src/main/java/com/ydool/staff/service/impl/AlterationServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AlterationServiceImpl.java @@ -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 implements IAlterationService { + @Resource + private UserMapper userMapper; + @Override public AjaxResult alterationList(String id) { List list = list(new LambdaQueryWrapper().eq(Alteration::getRelevancyId, id)); - List 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 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); } diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index da5792a..56336bf 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -160,6 +160,7 @@ public class PersonnelServiceImpl extends BaseService nameAndPath(String file,String id){ if (StrUtil.isNotBlank(file)){