This commit is contained in:
zhuyy 2023-02-09 09:19:44 +08:00
parent a04528b33c
commit 2a2fcf3305
23 changed files with 397 additions and 93 deletions

View File

@ -20,20 +20,20 @@ import org.springframework.web.bind.annotation.RestController;
@ApiSupport(order = 1)
public class CompanyNameController extends BaseController {
// @Autowired
// ICompanyNameService companyNameService;
@Autowired
ICompanyNameService companyNameService;
// @GetMapping("/companyList")
// @ApiOperation(value = "企业名称列表")
// public AjaxResult companyList() {
// return companyNameService.companyList();
// }
@GetMapping("/companyList")
@ApiOperation(value = "企业名称列表")
public AjaxResult companyList() {
return companyNameService.companyList();
}
// @GetMapping("/companyName")
// @ApiOperation(value = "根据企业名称查企业信息")
// @ApiImplicitParam(value = "企业名称", name = "companyName", required = true)
// public AjaxResult companyName(String companyName) {
// return companyNameService.companyName(companyName);
// }
@GetMapping("/companyName")
@ApiOperation(value = "根据企业Id查企业信息")
@ApiImplicitParam(value = "企业Id", name = "id", required = true)
public AjaxResult companyName(String id) {
return companyNameService.companyName(id);
}
}

View File

@ -31,6 +31,13 @@ public class DirectorsSupervisorsController extends BaseController {
return directorsSupervisorsService.selectDirectorsSupervisorsList(new Page<>(getPageNum(), getPageSize()), directorsSupervisorsDto);
}
@GetMapping("/selectDirectorsSupervisorsById")
@ApiOperation(value = "董监任免申报详情")
@ApiImplicitParam(name = "id", value = "董监任免id", dataType = "String", required = true)
public AjaxResult selectDirectorsSupervisorsById(String id) {
return directorsSupervisorsService.selectDirectorsSupervisorsById(id);
}
@PostMapping("/saveDirectorsSupervisors")
@ApiOperation(value = "新增董监任免申报")
public AjaxResult saveDirectorsSupervisors(@RequestBody @Validated DirectorsSupervisors directorsSupervisors) {

View File

@ -13,23 +13,23 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(UrlConstant.MECHANISM)
@Api(tags = "机构信息", value = "机构信息")
// @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);
}
// @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,16 +1,22 @@
package com.ydool.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.service.IOrganizationService;
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;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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
@ -18,39 +24,110 @@ import org.springframework.web.bind.annotation.*;
@Api(tags = "内设机构登记", value = "内设机构登记")
public class OrganizationController extends BaseController {
@Autowired
ICompanyNameService companyNameService;
@Autowired
IOrganizationService organizationService;
@Autowired
IPartyOrganizationService partyOrganizationService;
@Autowired
IMechanismService mechanismService;
@Autowired
IAttachmentService attachmentService;
@GetMapping("/selectOrganization")
@ApiOperation(value = "企业名称列表")
public AjaxResult selectOrganization() {
return organizationService.selectOrganization();
}
// @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);
// }
@GetMapping("/selectOrganizationByName")
@ApiOperation(value = "企业名称查企业信息")
@ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称", required = true)})
public AjaxResult selectOrganizationByName(String companyName) {
return organizationService.selectOrganizationByName(companyName);
}
/**
* =======================内设机构登记===========================
* @return
*/
@GetMapping("/selectOrganizationList")
@ApiOperation(value = "内设机构登记列表")
@ApiOperationSupport(order = 1)
@ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称"), @ApiImplicitParam(name = "current", value = "当前页", dataType = "Integer"), @ApiImplicitParam(name = "size", value = "每页条数", dataType = "Integer"),})
public AjaxResult selectOrganizationList(String companyName) {
return organizationService.selectOrganizationList(new Page<>(getPageNum(), getPageSize()), companyName);
}
@GetMapping("/selectOrganizationFileList")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "内设机构附件列表")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "企业Id")})
public AjaxResult selectOrganizationFileList(String id){
return attachmentService.selectOrganizationFileList(id);
}
@GetMapping("/selectOrganizationByMechanism")
@ApiOperation(value = "内设机构登记详情")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "企业Id")})
@ApiOperationSupport(order = 4)
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "内设机构Id")})
public AjaxResult selectOrganizationByMechanism(String id) {
return organizationService.selectOrganizationByMechanism(id);
}
@PostMapping("/deleteOrganization")
@ApiOperation(value = "删除内设机构")
@ApiOperation(value = "内设机构删除")
@ApiOperationSupport(order = 5)
public AjaxResult deleteOrganization(@RequestBody IdsRequest id) {
return organizationService.deleteOrganization(id);
}
/**
* =======================机构信息=========================
* @return
*/
@PostMapping("/saveMechanism")
@ApiOperation(value = "机构信息新增")
@ApiOperationSupport(order = 6)
public AjaxResult saveMechanism(@RequestBody @Validated MechanismRequest mechanismRequest) {
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)
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

@ -14,29 +14,29 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(UrlConstant.PARTY_ORGANIZATION)
@Api(tags = "党组织信息", value = "党组织信息")
// @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);
}
// @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

@ -15,6 +15,7 @@ import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -89,4 +90,11 @@ public class PersonnelController extends BaseController {
public AjaxResult fileList(String id) {
return attachmentService.fileList(new Page<Attachment>(getPageNum(), getPageSize()), id);
}
@PostMapping("/deleteFile")
@ApiOperation(value = "删除附件")
public AjaxResult deleteFile(@RequestBody IdsRequest ids){
return attachmentService.deleteFile(ids);
}
}

View File

@ -10,6 +10,7 @@ import lombok.Data;
*/
@Data
public class AttachmentDto {
@ApiModelProperty(value = "名称")
private String name;
@ -18,4 +19,7 @@ public class AttachmentDto {
@ApiModelProperty(value = "大小")
private String size;
@ApiModelProperty(value = "后缀")
private String suffix;
}

View File

@ -41,7 +41,6 @@ public class Attachment extends BaseEntity{
private String size;
@ApiModelProperty(value = "文件后缀")
@TableField(exist = false)
private String suffix;
@ApiModelProperty(value = "附件状态0暂存 1已存")

View File

@ -1,10 +1,13 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import java.util.Date;
import java.util.List;
import com.ydool.staff.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -95,9 +98,12 @@ public class DirectorsSupervisors extends BaseEntity {
private String remark;
@ApiModelProperty(value = "相关附件")
@NotBlank(message = "相关附件不能为空")
private String correlationFile;
@ApiModelProperty(value = "单据状态")
private String documentStatus;
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private List<AttachmentDto> attachmentDtoList;
}

View File

@ -1,11 +1,16 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import com.ydool.staff.request.AttachmentRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* <p>
* 内设机构登记
@ -23,8 +28,8 @@ public class Organization extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "企业Id")
private String companyId;
@ApiModelProperty(value = "信用代码")
private String creditCode;
@ -35,4 +40,16 @@ public class Organization extends BaseEntity{
@ApiModelProperty(value = "相关附件")
private String attachment;
// @ApiModelProperty(value = "附件列表")
// @TableField(exist = false)
// private List<Attachment> attachments;
@ApiModelProperty(value = "企业名称")
@TableField(exist = false)
private String companyName;
@ApiModelProperty(value = "修改人")
@TableField(exist = false)
private String updatedName;
}

View File

@ -26,9 +26,9 @@ public class PartyOrganization extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "企业Id")
@NotBlank(message = "企业Id不能为空")
private String organizationId;
// @ApiModelProperty(value = "企业Id")
// @NotBlank(message = "企业Id不能为空")
// private String organizationId;
@ApiModelProperty(value = "姓名")
@NotBlank(message = "姓名不能为空")

View File

@ -0,0 +1,32 @@
package com.ydool.staff.request;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Mechanism;
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 = "企业名称")
@NotBlank(message = "企业名称不能为空")
private String companyName;
@ApiModelProperty(value = "信用代码")
private String creditCode;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "附件列表")
private List<Attachment> attachments;
@ApiModelProperty(value = "机构信息")
@NotEmpty(message = "机构信息不能为空")
private List<Mechanism> mechments;
}

View File

@ -1,19 +1,40 @@
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.Organization;
import com.ydool.staff.entity.PartyOrganization;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@Data
public class OrganizationRequest implements Serializable {
@ApiModelProperty(value = "机构")
private Organization organization;
// @ApiModelProperty(value = "机构")
// private Organization organization;
@ApiModelProperty(value = "企业Id")
private String companyId;
@ApiModelProperty(value = "信用代码")
private String creditCode;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "附件列表")
private List<AttachmentDto> attachments;
@ApiModelProperty(value = "机构信息")
private List<Mechanism> mechanismList;
@ApiModelProperty(value = "党组织信息")
List<PartyOrganization> partyList;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.request.AttachmentRequest;
import com.ydool.system.request.IdsRequest;
/**
* <p>
@ -22,5 +23,9 @@ public interface IAttachmentService {
Attachment selectByIdAndPath(String id,String path);
AjaxResult fileList(Page<Attachment> page, String id);
AjaxResult deleteFile(IdsRequest ids);
AjaxResult selectOrganizationFileList(String id);
}

View File

@ -23,5 +23,7 @@ public interface IDirectorsSupervisorsService {
AjaxResult editDirectorsSupervisors(DirectorsSupervisors directorsSupervisors);
AjaxResult deleteDirectorsSupervisors(IdsRequest ids);
AjaxResult selectDirectorsSupervisorsById(String id);
}

View File

@ -2,6 +2,8 @@ package com.ydool.staff.service;
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;
/**
@ -27,5 +29,7 @@ public interface IMechanismService {
* @return
*/
AjaxResult deleteMechanism(IdsRequest id);
AjaxResult saveOrganizationMechanism(MechanismRequest mechanismRequest);
}

View File

@ -1,6 +1,7 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -10,8 +11,12 @@ import com.ydool.staff.entity.Attachment;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.system.mapper.UserMapper;
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 java.util.Arrays;
/**
@ -37,8 +42,8 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
}
@Override
public boolean deleteById(String targetType,String id) {
return remove(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetType,targetType).eq(Attachment::getTargetId,id));
public boolean deleteById(String targetType, String id) {
return remove(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetType, targetType).eq(Attachment::getTargetId, id));
}
@Override
@ -57,5 +62,25 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
}
return AjaxResult.ok().data(attachmentPage);
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteFile(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = attachmentMapper.deleteBatchIds(Arrays.asList(id.getIds()));
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@Override
public AjaxResult selectOrganizationFileList(String id) {
LambdaQueryWrapper<Attachment> attachmentLambdaQueryWrapper = new LambdaQueryWrapper<>();
attachmentLambdaQueryWrapper.eq(Attachment::getTargetId, id);
attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, "organization");
Page<Attachment> attachmentPage = attachmentMapper.selectPage(new Page<>(), attachmentLambdaQueryWrapper);
return AjaxResult.ok().data(attachmentPage);
}
}

View File

@ -37,10 +37,8 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
}
@Override
public AjaxResult companyName(String companyName) {
LambdaQueryWrapper<CompanyName> companyNameLambdaQueryWrapper = new LambdaQueryWrapper<>();
companyNameLambdaQueryWrapper.eq(CompanyName::getCompanyName, companyName);
return AjaxResult.ok().data(companyNameMapper.selectOne(companyNameLambdaQueryWrapper));
public AjaxResult companyName(String id) {
return AjaxResult.ok().data(companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, id)));
}
@Override

View File

@ -1,21 +1,28 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
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.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.DirectorsSupervisorsDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.DirectorsSupervisors;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.DirectorsSupervisorsMapper;
import com.ydool.staff.service.IDirectorsSupervisorsService;
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>
@ -30,6 +37,8 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Autowired
DirectorsSupervisorsMapper directorsSupervisorsMapper;
@Autowired
AttachmentMapper attachmentMapper;
@Override
public AjaxResult selectDirectorsSupervisorsList(Page<DirectorsSupervisors> page, DirectorsSupervisorsDto directorsSupervisorsDto) {
@ -46,8 +55,24 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveDirectorsSupervisors(DirectorsSupervisors directorsSupervisors) {
List<String> list = new ArrayList<>();
List<AttachmentDto> attachmentList = directorsSupervisors.getAttachmentDtoList();
for (AttachmentDto attachment : attachmentList) {
list.add(attachment.getPath());
}
directorsSupervisors.setCorrelationFile(StringUtils.join(list,","));
int i = directorsSupervisorsMapper.insert(directorsSupervisors);
return i > 0 ? AjaxResult.ok().msg("新增成功!") : AjaxResult.fail().msg("新增失败!");
if (i > 0) {
List<AttachmentDto> attachmentDtoList = directorsSupervisors.getAttachmentDtoList();
List<Attachment> attachments = BeanUtil.copyToList(attachmentDtoList, Attachment.class);
for (Attachment attachment : attachments) {
attachment.setTargetId(directorsSupervisors.getId());
attachment.setTargetType("directors");
attachmentMapper.insert(attachment);
}
return AjaxResult.ok().msg("新增成功!");
}
return AjaxResult.fail().msg("新增失败!");
}
@Override
@ -67,5 +92,14 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@Override
public AjaxResult selectDirectorsSupervisorsById(String id) {
DirectorsSupervisors directorsSupervisors = directorsSupervisorsMapper.selectById(id);
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);
return AjaxResult.ok().data(directorsSupervisors);
}
}

View File

@ -65,7 +65,7 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
User user = userMapper.selectById((String)StpUtil.getLoginId());
dto.setUserName(personnel.getUserName());
dto.setOriginalCompanyName(personnel.getCompanyName());
dto.setWillCompanyName(organization.getCompanyName());
// dto.setWillCompanyName(organization.getCompanyName());
dto.setCardId(personnel.getNumberId());
dto.setNowDept(personnel.getPresentDept());
dto.setNowPosition(personnel.getPosition());

View File

@ -1,18 +1,29 @@
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 com.ydool.common.data.dto.AjaxResult;
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.mapper.AttachmentMapper;
import com.ydool.staff.mapper.MechanismMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.request.AttachmentRequest;
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>
@ -27,6 +38,10 @@ public class MechanismServiceImpl extends BaseService<MechanismMapper, Mechanism
@Autowired
MechanismMapper mechanismMapper;
@Autowired
OrganizationMapper organizationMapper;
@Autowired
AttachmentMapper attachmentMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@ -45,5 +60,38 @@ public class MechanismServiceImpl extends BaseService<MechanismMapper, Mechanism
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveOrganizationMechanism(MechanismRequest mechanismRequest) {
Organization organization = new Organization();
List<String> list = new ArrayList<>();
List<Attachment> attachmentList = mechanismRequest.getAttachments();
for (Attachment attachment : attachmentList) {
list.add(attachment.getPath());
}
organization.setAttachment(StringUtils.join(list,","));
organization.setCreditCode(mechanismRequest.getCreditCode());
organization.setCompanyId(mechanismRequest.getCompanyName());
organization.setRemark(mechanismRequest.getRemark());
int i = organizationMapper.insert(organization);
if (i > 0) {
List<Attachment> attachments = mechanismRequest.getAttachments();
for (Attachment attachment : attachments) {
attachment.setTargetId(organization.getId());
attachment.setTargetType("organization");
attachment.setSize(attachment.getSize());
attachment.setSuffix(attachment.getSuffix());
attachmentMapper.insert(attachment);
}
List<Mechanism> mechments = mechanismRequest.getMechments();
for (Mechanism mechment : mechments) {
mechment.setOrganizationId(organization.getId());
}
boolean batch = saveBatch(mechments);
return batch ? AjaxResult.ok().msg("新增成功!") : AjaxResult.fail().msg("新增失败!");
}
return AjaxResult.fail().msg("新增失败!");
}
}

View File

@ -1,16 +1,16 @@
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.data.dto.AjaxResult;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.entity.*;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.MechanismMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.service.IOrganizationService;
import com.ydool.system.mapper.UserMapper;
@ -18,7 +18,9 @@ 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;
@ -36,18 +38,25 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Autowired
OrganizationMapper organizationMapper;
@Autowired
PartyOrganizationMapper partyOrganizationMapper;
@Autowired
MechanismMapper mechanismMapper;
@Autowired
CompanyNameMapper companyNameMapper;
@Autowired
UserMapper userMapper;
@Autowired
AttachmentMapper attachmentMapper;
@Override
public AjaxResult selectOrganizationList(Page<Organization> page, String companyName) {
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(companyName), Organization::getCompanyName, companyName);
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
// for (Organization record : selectPage.getRecords()) {
// record.setUpdatedId(userMapper.selectById(record.getUpdatedId()).getUserName());
// }
for (Organization record : selectPage.getRecords()) {
record.setUpdatedName(userMapper.selectById(record.getUpdatedId()).getUserName());
record.setCompanyName(companyNameMapper.selectById(record.getCompanyId()).getCompanyName());
}
return AjaxResult.ok().data(selectPage);
}
@ -58,8 +67,15 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
return AjaxResult.fail().msg("未找到相关信息!");
} else {
List<Mechanism> mechanismList = mechanismMapper.selectList(new LambdaQueryWrapper<Mechanism>().eq(Mechanism::getOrganizationId, organization.getId()));
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, organization.getId()).eq(Attachment::getTargetType, "organization"));
List<PartyOrganization> partyOrganizationList = partyOrganizationMapper.selectList(new LambdaQueryWrapper<PartyOrganization>());
List<AttachmentDto> toList = BeanUtil.copyToList(attachmentList, AttachmentDto.class);
OrganizationRequest organizationRequest = new OrganizationRequest();
organizationRequest.setOrganization(organization);
organizationRequest.setRemark(organization.getRemark());
organizationRequest.setCreditCode(organization.getCreditCode());
organizationRequest.setCompanyId(companyNameMapper.selectById(organization.getCompanyId()).getCompanyName());
organizationRequest.setAttachments(toList);
organizationRequest.setPartyList(partyOrganizationList);
organizationRequest.setMechanismList(mechanismList);
return AjaxResult.ok().data(organizationRequest);
}
@ -78,7 +94,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
public AjaxResult selectOrganizationByName(String companyName) {
return AjaxResult.ok().data(organizationMapper.selectOne(new LambdaQueryWrapper<Organization>().eq(Organization::getCompanyName, companyName)));
return AjaxResult.ok().data(companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, companyName)));
}
@Override

View File

@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
@RestController
@RequestMapping(value = UrlConstant.ATTACHMENT)
@Api(tags = "文件上传", value = "文件上传")
@ -36,7 +37,7 @@ public class UploadController {
return AjaxResult.fail("不能上传后缀为" + suffix + "的文件");
}
String path = UploadUtils.uploadFile(file);
Dict data = Dict.create().set("path", path).set("name", file.getOriginalFilename());
Dict data = Dict.create().set("path", path).set("name", file.getOriginalFilename()).set("size", file.getSize()).set("suffix", FileUtil.getSuffix(file.getOriginalFilename()).toUpperCase());
return AjaxResult.ok().data(data);
}
@ -52,7 +53,7 @@ public class UploadController {
return AjaxResult.fail("不能上传后缀为" + suffix + "的文件");
}
String path = UploadUtils.uploadFile(file);
list.add(Dict.create().set("path", path).set("name", file.getOriginalFilename()));
list.add(Dict.create().set("path", path).set("name", file.getOriginalFilename()).set("size", file.getSize()).set("suffix", FileUtil.getSuffix(file.getOriginalFilename()).toUpperCase()));
}
return CollectionUtil.isNotEmpty(list) ? AjaxResult.ok("data", list) : AjaxResult.fail().msg("上传失败!!!");
}