|
@@ -429,17 +429,20 @@ public class KwsEnterpriseService {
|
|
|
List<KwsEntCertificate> kwsEntCertificates = new ArrayList<>();
|
|
List<KwsEntCertificate> kwsEntCertificates = new ArrayList<>();
|
|
|
for (KwsEntCertificate kwsEntCertificate : kwsEntCertificateList) {
|
|
for (KwsEntCertificate kwsEntCertificate : kwsEntCertificateList) {
|
|
|
//先把旧的作废
|
|
//先把旧的作废
|
|
|
- List<KwsEntCertificate> previous = kwsEntCertificateDao.findByEntType(kwsEntCertificate.getEntId(), kwsEntCertificate.getType());
|
|
|
|
|
- previous = previous.stream().filter(item -> !item.getId().equals(kwsEntCertificate.getId())).toList();
|
|
|
|
|
- if (!CollectionUtils.isEmpty(previous)) {
|
|
|
|
|
- for (KwsEntCertificate kwsEntCertificate1 : previous) {
|
|
|
|
|
- kwsEntCertificate1.setDelFlag(Global.YES);
|
|
|
|
|
- kwsEntCertificateDao.update(kwsEntCertificate1);
|
|
|
|
|
|
|
+ if (status.equals(ApprovalEnum.OK.getCode())) {
|
|
|
|
|
+ List<KwsEntCertificate> previous = kwsEntCertificateDao.findPrevious(kwsEntCertificate.getEntId(), kwsEntCertificate.getType());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(previous)) {
|
|
|
|
|
+ for (KwsEntCertificate kwsEntCertificate1 : previous) {
|
|
|
|
|
+ kwsEntCertificate1.setDelFlag(Global.YES);
|
|
|
|
|
+ kwsEntCertificateDao.update(kwsEntCertificate1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- kwsEntCertificate.setStatus(ApprovalEnum.OK.getCode() == status ? Global.NO : Global.YES);
|
|
|
|
|
- kwsEntCertificateDao.update(kwsEntCertificate);
|
|
|
|
|
|
|
+ if (kwsEntCertificate.getStatus().equals(ApprovalEnum.PROCESS.getCode())) {
|
|
|
|
|
+ kwsEntCertificate.setStatus(status.equals(ApprovalEnum.OK.getCode()) ? Global.NO : Global.YES);
|
|
|
|
|
+ kwsEntCertificateDao.update(kwsEntCertificate);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
entId = kwsEntCertificate.getEntId();
|
|
entId = kwsEntCertificate.getEntId();
|
|
|
kwsEntCertificates.add(kwsEntCertificate);
|
|
kwsEntCertificates.add(kwsEntCertificate);
|
|
@@ -458,6 +461,7 @@ public class KwsEnterpriseService {
|
|
|
KwsEntCheckTrack kwsEntCheckTrack = new KwsEntCheckTrack();
|
|
KwsEntCheckTrack kwsEntCheckTrack = new KwsEntCheckTrack();
|
|
|
kwsEntCheckTrack.setEntId(entId);
|
|
kwsEntCheckTrack.setEntId(entId);
|
|
|
kwsEntCheckTrack.setRemark(reqVo.getRemark());
|
|
kwsEntCheckTrack.setRemark(reqVo.getRemark());
|
|
|
|
|
+ kwsEntCheckTrack.setStatus(status.equals(ApprovalEnum.OK.getCode()) ? Global.NO : Global.YES);
|
|
|
if (kwsEntCheckTrackDao.insert(kwsEntCheckTrack) <= 0) {
|
|
if (kwsEntCheckTrackDao.insert(kwsEntCheckTrack) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
|
}
|
|
}
|
|
@@ -560,13 +564,45 @@ public class KwsEnterpriseService {
|
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- kwsEntCertificates = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(Global.NO)).toList();
|
|
|
|
|
- if (CollectionUtils.isEmpty(kwsEntCertificates)) {
|
|
|
|
|
- throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
|
|
|
|
|
|
|
+ KwsEnterprise kwsEnterprise = kwsEnterpriseDao.selectByKey(entId);
|
|
|
|
|
+ List<KwsEntCertificate> finalList = new ArrayList<>();
|
|
|
|
|
+ if (kwsEnterprise.getApproval().equals(ApprovalEnum.PROCESS.getCode()) || kwsEnterprise.getApproval().equals(ApprovalEnum.REFRESH.getCode())) {
|
|
|
|
|
+ finalList = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(ApprovalEnum.PROCESS.getCode())).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (kwsEnterprise.getApproval().equals(ApprovalEnum.OK.getCode())) {
|
|
|
|
|
+ finalList = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(Global.NO)).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (kwsEnterprise.getApproval().equals(ApprovalEnum.PASS.getCode())) {
|
|
|
|
|
+ List<KwsEntCheckTrack> list = kwsEntCheckTrackDao.findList(entId);
|
|
|
|
|
+ if (list.stream().anyMatch(item -> item.getStatus().equals(Global.NO))) {
|
|
|
|
|
+ //通过了一次
|
|
|
|
|
+ finalList = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(Global.NO)).toList();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //未通过过,按时间倒序取最后一次驳回
|
|
|
|
|
+ finalList = kwsEntCertificates.stream().filter(item -> item.getStatus().equals(Global.YES)).collect(Collectors.toList());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(finalList)) {
|
|
|
|
|
+ Map<Integer, List<KwsEntCertificate>> collect = finalList.stream().collect(Collectors.groupingBy(KwsEntCertificate::getType));
|
|
|
|
|
+ for (Integer type : collect.keySet()) {
|
|
|
|
|
+ List<KwsEntCertificate> kwsEntCertificates1 = collect.get(type);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(kwsEntCertificates1)) {
|
|
|
|
|
+ List<KwsEntCertificate> collect1 = kwsEntCertificates1.stream().sorted(Comparator.comparing(KwsEntCertificate::getUpdateTime).reversed()).collect(Collectors.toList());
|
|
|
|
|
+ finalList.add(collect1.get(0));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtils.isEmpty(finalList)) {
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/*拼装返参*/
|
|
/*拼装返参*/
|
|
|
List<CertificateResVo> list = new ArrayList<>();
|
|
List<CertificateResVo> list = new ArrayList<>();
|
|
|
- kwsEntCertificates.forEach(item -> {
|
|
|
|
|
|
|
+ finalList.forEach(item -> {
|
|
|
CertificateResVo certificateResVo = new CertificateResVo();
|
|
CertificateResVo certificateResVo = new CertificateResVo();
|
|
|
certificateResVo.setTypeName(Objects.requireNonNull(CertificateTypeEnum.getName(item.getType())).getName());
|
|
certificateResVo.setTypeName(Objects.requireNonNull(CertificateTypeEnum.getName(item.getType())).getName());
|
|
|
BeanUtils.copyProperties(item, certificateResVo);
|
|
BeanUtils.copyProperties(item, certificateResVo);
|
|
@@ -810,6 +846,13 @@ public class KwsEnterpriseService {
|
|
|
if (CollectionUtils.isNotEmpty(listByEntIds)) {
|
|
if (CollectionUtils.isNotEmpty(listByEntIds)) {
|
|
|
entDetailResVo.setEntTypes(String.join(Global.COMMA, listByEntIds.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()));
|
|
entDetailResVo.setEntTypes(String.join(Global.COMMA, listByEntIds.stream().map(KwsEntType::getType).map(String::valueOf).distinct().toList()));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ List<KwsEntCheckTrack> list = kwsEntCheckTrackDao.findList(id);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
+ entDetailResVo.setValid(list.stream().anyMatch(item -> item.getStatus().equals(Global.NO)));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ entDetailResVo.setValid(false);
|
|
|
|
|
+ }
|
|
|
return entDetailResVo;
|
|
return entDetailResVo;
|
|
|
}
|
|
}
|
|
|
|
|
|