This commit is contained in:
zhuyy 2023-02-16 16:30:13 +08:00
parent 0373ee87f2
commit f51825a164
23 changed files with 57 additions and 550 deletions

View File

@ -1,35 +0,0 @@
package com.ydool.staff.controller;
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.service.IMechanismService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
// @RequestMapping(UrlConstant.MECHANISM)
// @Api(tags = "机构信息", value = "机构信息")
public class MechanismController extends BaseController {
// @Autowired
// IMechanismService mechanismService;
//
// @PostMapping("/saveMechanism")
// @ApiOperation(value = "新增机构信息")
// public AjaxResult saveMechanism(@RequestBody @Validated Mechanism mechanism) {
// return mechanismService.saveMechanism(mechanism);
// }
//
// @PostMapping("/deleteMechanism")
// @ApiOperation(value = "删除机构信息")
// public AjaxResult deleteMechanism(@RequestBody IdsRequest id) {
// return mechanismService.deleteMechanism(id);
// }
}

View File

@ -1,42 +0,0 @@
package com.ydool.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.staff.service.IPartyOrganizationService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
// @RequestMapping(UrlConstant.PARTY_ORGANIZATION)
// @Api(tags = "党组织信息", value = "党组织信息")
public class PartyOrganizationController extends BaseController {
// @Autowired
// IPartyOrganizationService partyOrganizationService;
//
// @GetMapping("/selectPartyOrganizationList")
// @ApiOperation(value = "党组织信息列表")
// public AjaxResult selectPartyOrganizationList() {
// return partyOrganizationService.selectPartyOrganizationList(new Page<PartyOrganization>(getPageNum(), getPageSize()));
// }
//
// @PostMapping("/savePartyOrganization")
// @ApiOperation(value = "新增党组织信息")
// public AjaxResult savePartyOrganization(@RequestBody @Validated PartyOrganization partyOrganization) {
// return partyOrganizationService.savePartyOrganization(partyOrganization);
// }
//
// @PostMapping("/deletePartyOrganization")
// @ApiOperation(value = "删除党组织信息")
// public AjaxResult deletePartyOrganization(@RequestBody IdsRequest id) {
// return partyOrganizationService.deletePartyOrganization(id);
// }
}

View File

@ -112,6 +112,9 @@ public class DirectorsSupervisors extends BaseEntity {
@ApiModelProperty(value = "终审意见")
private String lastInstance;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝\n")
private Integer auditState;
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<AttachmentDto> attachmentDtoList;

View File

@ -1,47 +0,0 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 内设机构信息
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_lc_mechanism")
@ApiModel(value="Mechanism对象", description="内设机构信息")
public class Mechanism extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "企业id")
@NotBlank(message = "企业Id不能为空")
private String organizationId;
@ApiModelProperty(value = "机构名称")
@NotBlank(message = "机构名称不能为空")
private String mechanismName;
@ApiModelProperty(value = "机构职能")
@NotBlank(message = "机构职能不能为空")
private String mechanismFunction;
@ApiModelProperty(value = "负责人")
private String responsiblePerson;
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -1,41 +0,0 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 党组织信息
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_lc_party_organization")
@ApiModel(value="PartyOrganization对象", description="党组织信息")
public class PartyOrganization extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "企业Id")
@NotBlank(message = "企业Id不能为空")
private String organizationId;
@ApiModelProperty(value = "姓名")
@NotBlank(message = "姓名不能为空")
private String username;
@ApiModelProperty(value = "职务")
@NotBlank(message = "职务不能为空")
private String job;
}

View File

@ -38,10 +38,10 @@ public class PersonnelIndicators extends BaseEntity {
private String indexExplain;
@ApiModelProperty(value = "标准指标人数")
private Long standardNumber;
private String standardNumber;
@ApiModelProperty(value = "增加指标人数")
private Long addNumber;
private String addNumber;
@ApiModelProperty(value = "初审意见")
private String firstTrial;
@ -54,4 +54,7 @@ public class PersonnelIndicators extends BaseEntity {
@ApiModelProperty(value = "单据状态")
private String documentStatus;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝")
private Integer auditState;
}

View File

@ -39,13 +39,13 @@ public class Recruitment extends BaseEntity {
private String position;
@ApiModelProperty(value = "名额")
private Long places;
private String places;
@ApiModelProperty(value = "条件要求")
private String requirements;
@ApiModelProperty(value = "审批")
private Long approval;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝\n")
private Integer auditState;
@ApiModelProperty(value = "初审意见")
private String firstTrial;

View File

@ -1,18 +0,0 @@
package com.ydool.staff.mapper;
import com.ydool.staff.entity.Mechanism;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 内设机构信息 Mapper 接口
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Mapper
public interface MechanismMapper extends MPJBaseMapper<Mechanism> {
}

View File

@ -1,18 +0,0 @@
package com.ydool.staff.mapper;
import com.ydool.staff.entity.PartyOrganization;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 党组织信息 Mapper 接口
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Mapper
public interface PartyOrganizationMapper extends MPJBaseMapper<PartyOrganization> {
}

View File

@ -1,26 +0,0 @@
package com.ydool.staff.request;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.entity.PartyOrganization;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author Zhuyy
* @ClassName MechanismPartyOrganization
* @Description TODO
* @date 2023/2/10 15:35
* @Version 1.0
*/
@Data
public class MechanismPartyOrganization implements Serializable {
@ApiModelProperty(value = "内设机构信息")
private List<Mechanism> mechanisms;
@ApiModelProperty(value = "党组织信息")
private List<PartyOrganization> partyOrganizations;
}

View File

@ -1,38 +0,0 @@
package com.ydool.staff.request;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.entity.PartyOrganization;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@Data
public class MechanismRequest implements Serializable {
@ApiModelProperty(value = "企业id")
@NotBlank(message = "企业id不能为空")
private String companyId;
@ApiModelProperty(value = "信用代码")
private String creditCode;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "附件列表")
private List<AttachmentDto> attachmentsDto;
@ApiModelProperty(value = "机构信息")
@NotEmpty(message = "机构信息不能为空")
private List<Mechanism> mechanism;
@ApiModelProperty(value = "党组织信息")
@NotEmpty(message = "党组织信息不能为空")
private List<PartyOrganization> partyOrganizations;
}

View File

@ -3,6 +3,7 @@ package com.ydool.staff.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
@ -29,9 +30,14 @@ public class OrganizationRequest implements Serializable {
@ApiModelProperty(value = "剩余指标人数")
private Long residualNumber;
@ApiModelProperty(value = "类型")
@ApiModelProperty(value = "类型 登记organization 申报personnel_indicators")
@NotBlank(message = "类型不能为空")
private String type;
@ApiModelProperty(value = "单据状态 默认国资审核,送审")
@NotBlank(message = "单据状态不能为空")
private String documentStatus;
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author Zhuyy
@ -14,7 +15,7 @@ import javax.validation.constraints.NotBlank;
*/
@Data
public class OrganizationSearch {
public class OrganizationSearch implements Serializable {
@ApiModelProperty(value = "企业名称")
private String companyName;
@ -22,6 +23,15 @@ public class OrganizationSearch {
@ApiModelProperty(value = "审批单号")
private String approvalNumber;
@ApiModelProperty(value = "单据状态")
private String documentStatus;
@ApiModelProperty(value = "填报开始时间")
private String createdAt;
@ApiModelProperty(value = "填报结束时间")
private String updatedAt;
@ApiModelProperty(value = "类型")
@NotBlank(message = "类型不能为空")
private String type;

View File

@ -4,6 +4,7 @@ import com.ydool.staff.entity.PersonnelIndicators;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
@ -18,6 +19,7 @@ import java.util.List;
public class PersonnelIndicatorsRequest implements Serializable {
@ApiModelProperty(value = "人员指标")
@Valid
private OrganizationRequest organizationRequest;
@ApiModelProperty(value = "人员指标申报")

View File

@ -4,6 +4,7 @@ import com.ydool.staff.entity.Recruitment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
@ -11,6 +12,7 @@ import java.util.List;
public class RecruitmentRequest implements Serializable {
@ApiModelProperty(value = "招聘登记")
@Valid
private OrganizationRequest organizationRequest;
@ApiModelProperty(value = "人员招聘登记")

View File

@ -1,38 +0,0 @@
package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.request.MechanismRequest;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.system.request.IdsRequest;
/**
* <p>
* 内设机构信息 服务类
* </p>
*
* @author msf
* @since 2023-02-02
*/
public interface IMechanismService {
/**
* 新增机构
* @param mechanism
* @return
*/
AjaxResult saveMechanism(Mechanism mechanism);
/**
* 删除机构
* @param id
* @return
*/
AjaxResult deleteMechanism(IdsRequest id);
AjaxResult saveMechanismPartyOrganization(MechanismRequest mechanismRequest);
AjaxResult selectCompanyNameByIdMechanismPartyOrganization(String id);
}

View File

@ -1,24 +0,0 @@
package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.system.request.IdsRequest;
/**
* <p>
* 党组织信息 服务类
* </p>
*
* @author msf
* @since 2023-02-02
*/
public interface IPartyOrganizationService {
AjaxResult savePartyOrganization(PartyOrganization partyOrganization);
AjaxResult deletePartyOrganization(IdsRequest id);
AjaxResult selectPartyOrganizationList(Page<PartyOrganization> partyOrganizationPage);
}

View File

@ -44,7 +44,7 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
@Override
public AjaxResult companyName(String id) {
CompanyName companyName = companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, id));
companyName.setActiveStaff(Long.valueOf(personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职").eq(Personnel::getCompanyName, id))));
companyName.setActiveStaff(Long.valueOf(personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职").eq(Personnel::getPersonnelType,"指标内").eq(Personnel::getCompanyName, id))));
return AjaxResult.ok().data(companyName);
}

View File

@ -1,136 +0,0 @@
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;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Mechanism;
import com.ydool.common.base.BaseService;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.MechanismMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PartyOrganizationMapper;
import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.MechanismPartyOrganization;
import com.ydool.staff.request.MechanismRequest;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.service.IMechanismService;
import com.ydool.system.request.IdsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* <p>
* 内设机构信息 服务类
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Service
public class MechanismServiceImpl extends BaseService<MechanismMapper, Mechanism> implements IMechanismService {
@Autowired
MechanismMapper mechanismMapper;
@Autowired
OrganizationMapper organizationMapper;
@Autowired
AttachmentMapper attachmentMapper;
@Autowired
PartyOrganizationMapper partyOrganizationMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveMechanism(Mechanism mechanism) {
int i = mechanismMapper.insert(mechanism);
return i > 0 ? AjaxResult.ok().msg("新增成功!") : AjaxResult.fail().msg("新增失败!");
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteMechanism(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = mechanismMapper.deleteBatchIds(Arrays.asList(id.getIds()));
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveMechanismPartyOrganization(MechanismRequest mechanismRequest) {
Organization organization = new Organization();
List<String> list = new ArrayList<>();
List<AttachmentDto> attachmentList = mechanismRequest.getAttachmentsDto();
for (AttachmentDto attachment : attachmentList) {
list.add(attachment.getPath());
}
organization.setAttachment(StringUtils.join(list, ","));
organization.setCreditCode(mechanismRequest.getCreditCode());
organization.setCompanyId(mechanismRequest.getCompanyId());
organization.setRemark(mechanismRequest.getRemark());
int i = organizationMapper.insert(organization);
if (i > 0) {
List<AttachmentDto> attachments = mechanismRequest.getAttachmentsDto();
List<Attachment> copyToList = BeanUtil.copyToList(attachments, Attachment.class);
for (Attachment attachment : copyToList) {
attachment.setTargetId(organization.getId());
attachment.setTargetType(ArgsConst.ORGANIZATION);
attachmentMapper.insert(attachment);
}
// 机构信息
List<Mechanism> mechments = mechanismRequest.getMechanism();
for (Mechanism mechment : mechments) {
int mechanism = mechanismMapper.selectCount(new LambdaQueryWrapper<Mechanism>().eq(Mechanism::getOrganizationId, organization.getId()).eq(Mechanism::getId, mechment.getId()));
if (mechanism == 0) {
mechment.setOrganizationId(organization.getId());
mechanismMapper.insert(mechment);
} else {
mechanismMapper.delete(new LambdaQueryWrapper<Mechanism>().eq(Mechanism::getOrganizationId, organization.getId()));
}
}
// 党组织信息
List<PartyOrganization> partyOrganizations = mechanismRequest.getPartyOrganizations();
for (PartyOrganization partyOrganization : partyOrganizations) {
int party = partyOrganizationMapper.selectCount(new LambdaQueryWrapper<PartyOrganization>().eq(PartyOrganization::getOrganizationId, organization.getId()).eq(PartyOrganization::getId, partyOrganization.getId()));
if (party == 0) {
partyOrganization.setOrganizationId(organization.getId());
partyOrganizationMapper.insert(partyOrganization);
} else {
partyOrganizationMapper.delete(new LambdaQueryWrapper<PartyOrganization>().eq(PartyOrganization::getOrganizationId, organization.getId()));
}
}
return AjaxResult.ok().msg("新增成功!");
}
return AjaxResult.fail().msg("新增失败!");
}
@Override
public AjaxResult selectCompanyNameByIdMechanismPartyOrganization(String id) {
if (StrUtil.isBlank(id)) {
return AjaxResult.fail().msg("企业id不能为空");
}
MechanismPartyOrganization mechanismPartyOrganization = new MechanismPartyOrganization();
List<Mechanism> mechanism = mechanismMapper.selectList(new LambdaQueryWrapper<Mechanism>().eq(Mechanism::getOrganizationId, id));
List<PartyOrganization> partyOrganizations = partyOrganizationMapper.selectList(new LambdaQueryWrapper<PartyOrganization>().eq(PartyOrganization::getOrganizationId, id));
mechanismPartyOrganization.setMechanisms(mechanism);
mechanismPartyOrganization.setPartyOrganizations(partyOrganizations);
return AjaxResult.ok().data(mechanismPartyOrganization);
}
}

View File

@ -10,7 +10,6 @@ import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.OrganizationSearch;
import com.ydool.staff.service.IOrganizationService;
import com.ydool.system.mapper.UserMapper;
import com.ydool.system.request.IdsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -33,8 +32,6 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Autowired
OrganizationMapper organizationMapper;
@Autowired
UserMapper userMapper;
@Autowired
CompanyNameMapper companyNameMapper;
@Autowired
PersonnelIndicatorsMapper personnelIndicatorsMapper;
@ -46,6 +43,9 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
organizationLambdaQueryWrapper.exists(StrUtil.isNotBlank(organizationSearch.getCompanyName()), "select t2.id from t_lc_company_name t2 where t_lc_organization.company_id = t2.id and t2.company_name like '%" + organizationSearch.getCompanyName() + "%'");
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(organizationSearch.getApprovalNumber()), Organization::getApprovalNumber, organizationSearch.getApprovalNumber());
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(organizationSearch.getDocumentStatus()), Organization::getDocumentStatus, organizationSearch.getDocumentStatus());
organizationLambdaQueryWrapper.ge(StrUtil.isNotBlank(organizationSearch.getCreatedAt()), Organization::getCreatedAt, organizationSearch.getCreatedAt());
organizationLambdaQueryWrapper.le(StrUtil.isNotBlank(organizationSearch.getUpdatedAt()), Organization::getUpdatedAt, organizationSearch.getUpdatedAt());
organizationLambdaQueryWrapper.eq(Organization::getType, organizationSearch.getType());
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
for (Organization record : selectPage.getRecords()) {

View File

@ -1,56 +0,0 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.PartyOrganizationMapper;
import com.ydool.staff.service.IPartyOrganizationService;
import com.ydool.system.request.IdsRequest;
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>
* 党组织信息 服务类
* </p>
*
* @author msf
* @since 2023-02-02
*/
@Service
public class PartyOrganizationServiceImpl extends BaseService<PartyOrganizationMapper, PartyOrganization> implements IPartyOrganizationService {
@Autowired
PartyOrganizationMapper partyOrganizationMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult savePartyOrganization(PartyOrganization partyOrganization) {
int i = partyOrganizationMapper.insert(partyOrganization);
return i > 0 ? AjaxResult.ok().msg("新增成功!") : AjaxResult.fail().msg("新增失败!");
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deletePartyOrganization(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = partyOrganizationMapper.deleteBatchIds(Arrays.asList(id.getIds()));
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@Override
public AjaxResult selectPartyOrganizationList(Page<PartyOrganization> partyOrganizationPage) {
return AjaxResult.ok().data(partyOrganizationMapper.selectPage(partyOrganizationPage, null));
}
}

View File

@ -1,6 +1,8 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.data.dto.AjaxResult;
@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -41,15 +44,20 @@ public class PersonnelIndicatorsServiceImpl extends BaseService<PersonnelIndicat
public AjaxResult savePersonnelIndicators(PersonnelIndicatorsRequest personnelIndicatorsRequest) {
OrganizationRequest organizationRequest = personnelIndicatorsRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
organization.setType("personnel_indicators");
// organization.setType("personnel_indicators");
// organization.setDocumentStatus("国资审核");
int i = organizationMapper.insert(organization);
if (i > 0) {
List<PersonnelIndicators> personnelIndicators = personnelIndicatorsRequest.getPersonnelIndicators();
List<String> list = personnelIndicators.stream().map(PersonnelIndicators::getAddNumber).collect(Collectors.toList());
for (PersonnelIndicators personnelIndicator : personnelIndicators) {
personnelIndicator.setOrganizationId(organization.getId());
if (!NumberUtil.isNumber(personnelIndicator.getAddNumber()) || !NumberUtil.isNumber(personnelIndicator.getStandardNumber())){
return AjaxResult.fail().msg("指标人数输入不合法!");
}
personnelIndicator.setOrganizationId(organization.getId());
personnelIndicatorsMapper.insert(personnelIndicator);
return AjaxResult.ok().msg("添加成功!");
}
boolean batch = saveBatch(personnelIndicators);
return batch ? AjaxResult.ok().msg("添加成功!") : AjaxResult.fail().msg("添加失败!");
}
return AjaxResult.fail().msg("添加失败!");
}
@ -62,16 +70,10 @@ public class PersonnelIndicatorsServiceImpl extends BaseService<PersonnelIndicat
}
List<PersonnelIndicators> personnelIndicators = personnelIndicatorsMapper.selectList(new LambdaQueryWrapper<PersonnelIndicators>().eq(PersonnelIndicators::getOrganizationId, organization.getId()));
PersonnelIndicatorsDto recruitmentRequest = new PersonnelIndicatorsDto();
organization.setActiveStaff((getPersonnelCount()));
recruitmentRequest.setOrganization(organization);
recruitmentRequest.setPersonnelIndicators(personnelIndicators);
return AjaxResult.ok().data(recruitmentRequest);
}
private Long getPersonnelCount() {
return Long.valueOf(personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职")));
}
}

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.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.data.dto.AjaxResult;
@ -10,7 +11,6 @@ import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.Recruitment;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.mapper.RecruitmentMapper;
@ -54,19 +54,22 @@ public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recru
public AjaxResult saveRecruitment(RecruitmentRequest recruitmentRequest) {
OrganizationRequest organizationRequest = recruitmentRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
organization.setType("organization");
// organization.setType("organization");
// organization.setDocumentStatus("国资审核");
int i = organizationMapper.insert(organization);
if (i > 0) {
List<Recruitment> recruitments = recruitmentRequest.getRecruitments();
for (Recruitment recruitment : recruitments) {
if (!NumberUtil.isNumber(recruitment.getPlaces())){
return AjaxResult.fail().msg("名额输入不合法!");
}
recruitment.setCompanyId(organization.getId());
recruitmentMapper.insert(recruitment);
return AjaxResult.ok().msg("添加成功!");
}
}
boolean batch = saveBatch(recruitments);
return batch ? AjaxResult.ok().msg("添加成功!") : AjaxResult.fail().msg("添加失败!");
} else {
return AjaxResult.fail().msg("添加失败!");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -88,15 +91,10 @@ public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recru
}
List<Recruitment> recruitments = recruitmentMapper.selectList(new LambdaQueryWrapper<Recruitment>().eq(Recruitment::getCompanyId, organization.getId()));
RecruitmentDto recruitmentRequest = new RecruitmentDto();
organization.setActiveStaff(getPersonnelCount());
recruitmentRequest.setOrganization(organization);
recruitmentRequest.setRecruitments(recruitments);
return AjaxResult.ok().data(recruitmentRequest);
}
private Long getPersonnelCount() {
return Long.valueOf(personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职")));
}
}