|
@@ -1,17 +1,29 @@
|
|
|
package com.jeeplus.test.program.configuration.projectList.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
+import com.jeeplus.test.mould.service.SerialnumTplService;
|
|
|
+import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
+import com.jeeplus.test.oss.mapper.OssServiceMapper;
|
|
|
import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo;
|
|
|
import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListLink;
|
|
|
import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListMember;
|
|
|
import com.jeeplus.test.program.configuration.projectList.mapper.ProjectLinkMapper;
|
|
|
import com.jeeplus.test.program.configuration.projectList.mapper.ProjectListMapper;
|
|
|
import com.jeeplus.test.program.configuration.projectList.mapper.ProjectMemberMapper;
|
|
|
+import com.jeeplus.test.program.configuration.projectList.service.dto.ContractDto;
|
|
|
import com.jeeplus.test.program.configuration.projectList.service.dto.ProjectListDto;
|
|
|
+import com.jeeplus.test.workContract.domain.WorkContractInfo;
|
|
|
+import com.jeeplus.test.workContract.mapper.WorkContractInfoMapper;
|
|
|
+import com.jeeplus.test.workContract.service.WorkContractService;
|
|
|
+import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -29,22 +41,34 @@ public class ProjectListService {
|
|
|
private ProjectLinkMapper projectLinkMapper;
|
|
|
@Resource
|
|
|
private ProjectMemberMapper projectMemberMapper;
|
|
|
+ @Resource
|
|
|
+ private WorkContractInfoMapper workContractInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private OssServiceMapper ossServiceMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SerialnumTplService serialnumTplService;
|
|
|
+ @Resource
|
|
|
+ private WorkContractService workContractService;
|
|
|
|
|
|
- public String save(ProjectListDto dto){
|
|
|
+ public String save(ProjectListDto dto) throws Exception{
|
|
|
if (StringUtils.isNotEmpty(dto.getId())) {
|
|
|
return update(dto);
|
|
|
}
|
|
|
return add(dto);
|
|
|
}
|
|
|
|
|
|
- public String add(ProjectListDto dto) {
|
|
|
+ public String add(ProjectListDto dto) throws Exception{
|
|
|
ProgramProjectListInfo info = new ProgramProjectListInfo();
|
|
|
//获取当前登录人信息
|
|
|
UserDTO userDTO = UserUtils.getCurrentUserDTO();
|
|
|
// 保存项目管理列表主表信息
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
|
String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ //合同编号生成
|
|
|
+ String no = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), ProjectListDto.BIZ_CODE);
|
|
|
info.setId(id);
|
|
|
+ info.setNo(no);
|
|
|
info.setCreateBy(userDTO.getId());
|
|
|
info.setCreateDate(new Date());
|
|
|
info.setUpdateBy(userDTO.getId());
|
|
@@ -77,7 +101,11 @@ public class ProjectListService {
|
|
|
projectMemberMapper.insert(member);
|
|
|
}
|
|
|
}
|
|
|
- return "操作成功";
|
|
|
+ // 保存附件信息
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
+ workContractService.saveFiles(dto.getFiles(), userDTO, id);
|
|
|
+ }
|
|
|
+ return id;
|
|
|
}
|
|
|
|
|
|
public String update(ProjectListDto dto) {
|
|
@@ -118,7 +146,11 @@ public class ProjectListService {
|
|
|
projectMemberMapper.insert(member);
|
|
|
}
|
|
|
}
|
|
|
- return "操作成功";
|
|
|
+ // 修改附件信息
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
+ workContractService.updateFiles(dto.getFiles(), userDTO, dto.getId());
|
|
|
+ }
|
|
|
+ return dto.getId();
|
|
|
}
|
|
|
|
|
|
public ProjectListDto findById(String id) {
|
|
@@ -142,6 +174,15 @@ public class ProjectListService {
|
|
|
if (CollectionUtils.isNotEmpty(members)) {
|
|
|
dto.setMembers(members);
|
|
|
}
|
|
|
+ // 查询附件信息
|
|
|
+ // 查询附件信息
|
|
|
+ List<WorkAttachmentDto> files = workContractInfoMapper.findDtos(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(files)) {
|
|
|
+ for (WorkAttachmentDto i : files) {
|
|
|
+ i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
+ }
|
|
|
+ dto.setFiles(files);
|
|
|
+ }
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
@@ -149,6 +190,29 @@ public class ProjectListService {
|
|
|
projectListMapper.deleteById(id);
|
|
|
projectLinkMapper.deleteByInfoId(id);
|
|
|
projectMemberMapper.deleteByInfoId(id);
|
|
|
+ // 附件删除
|
|
|
+ LambdaQueryWrapper<WorkAttachment> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(WorkAttachment::getAttachmentId, id);
|
|
|
+ ossServiceMapper.delete(wrapper);
|
|
|
return "操作成功";
|
|
|
}
|
|
|
+
|
|
|
+ public IPage<WorkContractInfo> findContractPageList(ContractDto dto, Page<WorkContractInfo> page) {
|
|
|
+ return projectListMapper.findContractPageList(page, dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String updateStatusById(ProjectListDto dto) {
|
|
|
+ projectListMapper.updateStatusById(dto.getId(), dto.getStatus());
|
|
|
+ return "操作成功";
|
|
|
+ }
|
|
|
+
|
|
|
+ public IPage<ProgramProjectListInfo> list(Page<ProgramProjectListInfo> page, ProgramProjectListInfo info) throws Exception{
|
|
|
+ QueryWrapper<ProgramProjectListInfo> wrapper = QueryWrapperGenerator.buildQueryCondition(info, ProgramProjectListInfo.class);
|
|
|
+ wrapper.eq("a.del_flag", "0");
|
|
|
+ if (info.getCreateDates() != null) {
|
|
|
+ wrapper.between("a.create_date", info.getCreateDates()[0], info.getCreateDates()[1]);
|
|
|
+ }
|
|
|
+ IPage<ProgramProjectListInfo> pageList = projectListMapper.findPageList(page, wrapper);
|
|
|
+ return pageList;
|
|
|
+ }
|
|
|
}
|