Commit 98c212b6 authored by 徐俊's avatar 徐俊

xujun

parent 42ed1295
......@@ -39,5 +39,8 @@ public class ComFile extends BaseEntity {
/** 必须上传的附件 */
@ApiModelProperty(value = "必须上传的附件", position = 8)
private Boolean isRequired;
/** 是否为标题 */
@ApiModelProperty(value = "是否为标题", position = 8)
private Boolean isTitle;
}
\ No newline at end of file
......@@ -44,4 +44,7 @@ public class ComFileDTO extends BaseDTO {
/** 必须上传的附件 */
@ApiModelProperty(value = "必须上传的附件", position = 8)
private Boolean isRequired;
/** 是否为标题 */
@ApiModelProperty(value = "是否为标题", position = 8)
private Boolean isTitle;
}
\ No newline at end of file
......@@ -19,8 +19,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
......@@ -128,12 +131,83 @@ public class ComTalentApplyServiceImpl extends BaseServiceImpl<ComTalentApplyDAO
return comTalentApplyDAO.getCount(criteria);
}
private ComFileDTO configureFile(String FileExplain, int showIndex, Boolean isRequired, Boolean isTitle) {
ComFileDTO file = new ComFileDTO();
file.setFileType(CommonEnum.fileType.talentApply.getCode());
file.setFileExplain(FileExplain);
file.setShowIndex(showIndex);
file.setRequired(true);
file.setIsTitle(isTitle);
if (!isRequired.equals(null))
file.setIsRequired(isRequired);
else
file.setIsRequired(false);
return file;
}
private List<ComFileDTO> configureFileList() {
List<SystemParameter> parameterList = systemParameterService.getListByType(22);
List<ComFileDTO> fileList = new ArrayList<>();
parameterList.forEach(e -> {
Boolean isTitle = false;
if (e.getCode().equals("0"))
isTitle = true;
fileList.add(configureFile(e.getName(), e.getDisplayOrder(), e.getIsRequired(), isTitle));
});
return fileList;
}
public List<ComFileDTO> checkNecessaryAttachmentFile(List<ComFileDTO> fileList) {
List<SystemParameter> parameterList = systemParameterService.getListByType(22);
AtomicInteger allCount = new AtomicInteger(parameterList.size() + 1);
fileList.forEach(e -> {
AtomicInteger num = new AtomicInteger(1);
int i = num.get();
parameterList.forEach(p -> {
if (null != e.getFileExplain() && e.getFileExplain().equals(p.getName())) {
e.setShowIndex(p.getDisplayOrder());
e.setRequired(p.getIsRequired());
if (p.getCode().equals("0"))
e.setIsTitle(true);
else
e.setIsTitle(false);
num.incrementAndGet();
}
});
if (i == num.get()) {
e.setShowIndex(allCount.get());
e.setRequired(false);
allCount.incrementAndGet();
}
});
parameterList.forEach(p -> {
List<ComFileDTO> findList = fileList.stream().filter(e -> null != e.getFileExplain() && e.getFileExplain().equals(p.getName())).collect(Collectors.toList());
if (findList.size() == 0) {
Boolean isTitle = false;
if (p.getCode().equals("0"))
isTitle = true;
ComFileDTO fileDTO = configureFile(p.getName(), p.getDisplayOrder(), p.getIsRequired(), isTitle);
fileList.add(fileDTO);
}
});
fileList.sort(Comparator.comparingInt(ComFileDTO::getShowIndex));
return fileList;
}
public ComTalentApplyDTO getNewTalentApply() {
ComTalentApplyDTO dto = new ComTalentApplyDTO();
List<ComTalentBudgetDTO> bugetList = comTalentBudgetService.getList();
dto.setBudgetList(bugetList);
// 附件
List<ComFileDTO> fileList = configureFileList();
dto.setFileList(fileList);
dto.setApplyFund(new BigDecimal(0.00));
dto.setOtherFund(new BigDecimal(0.00));
dto.setTotalFund(new BigDecimal(0.00));
......@@ -174,6 +248,14 @@ public class ComTalentApplyServiceImpl extends BaseServiceImpl<ComTalentApplyDAO
List<ComPersonScientificGainDTO> scientificList = comPersonScientificGainService.getListByTalentId(dto.getId());
dto.setScientificList(scientificList);
//附件列表
List<ComFileDTO> fileList = comFileService.getListByObjectId(dto.getId(), CommonEnum.fileType.talentApply.getCode());
if (null == fileList || fileList.size() == 0)
fileList = configureFileList();
else
fileList = checkNecessaryAttachmentFile(fileList);
dto.setFileList(fileList);
if (Objects.isNull(dto.getApplyFund()))
dto.setApplyFund(new BigDecimal(0.00));
if (Objects.isNull(dto.getOtherFund()))
......@@ -284,6 +366,8 @@ public class ComTalentApplyServiceImpl extends BaseServiceImpl<ComTalentApplyDAO
@Transactional
public String talentSaveStep3(ComTalentApplyDTO dto) {
ComTalentApply comTalentApply = convert2Entity(dto);
this.update(comTalentApply);
List<ComTalentMembersDTO> MemberList = dto.getMembersList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment