|
|
|
@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* (采购目录)服务实现类 |
|
|
|
@ -184,11 +185,18 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
@Transactional |
|
|
|
|
public PurchaseCatalogue commitById(List<PurchaseCatalogueDTO> purchaseCatalogueDTOList, DLPUser dlpUser) { |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogueDTOList.get(0).getPurchaseCatalogueId() == null) { |
|
|
|
|
Set<String> permissions = dlpUser.getPermissions(); |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogueDTOList.get(0).getPurchaseCatalogueId().equals("") | purchaseCatalogueDTOList.get(0).getPurchaseCatalogueId() == null) { |
|
|
|
|
|
|
|
|
|
PurchaseCatalogue purchaseCatalogue = purchaseCatalogueService.addCatalogue(dlpUser, purchaseCatalogueDTOList); |
|
|
|
|
|
|
|
|
|
if (permissions.contains("reagent_purchase_catalogue_primary")) { |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setStatus(2); |
|
|
|
|
} else { |
|
|
|
|
purchaseCatalogue.setStatus(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setCommitTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
|
@ -200,56 +208,35 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
PurchaseCatalogue purchaseCatalogue = purchaseCatalogueService.getById(purchaseCatalogueDTOList.get(0).getPurchaseCatalogueId() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setStatus(1); |
|
|
|
|
purchaseCatalogue.setCommitTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogueService.updateById(purchaseCatalogue)) { |
|
|
|
|
return purchaseCatalogue; |
|
|
|
|
} else return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override//一级审核
|
|
|
|
|
public PurchaseCatalogue primaryAuditCatalogue(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { |
|
|
|
|
|
|
|
|
|
PurchaseCatalogue purchaseCatalogue = purchaseCatalogueService.getById(auditAndApproveDto.getUuId()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setPrimaryAuditorId(dlpUser.getId()); |
|
|
|
|
if (permissions.contains("reagent_purchase_catalogue_primary")) { |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditTimeOfPrimary(LocalDateTime.now()); |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogue.getAuditResultOfPrimary() == true) { |
|
|
|
|
purchaseCatalogue.setStatus(2); |
|
|
|
|
} else { |
|
|
|
|
purchaseCatalogue.setStatus(-2); |
|
|
|
|
purchaseCatalogue.setStatus(1); |
|
|
|
|
} |
|
|
|
|
purchaseCatalogue.setCommitTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogueService.updateById(purchaseCatalogue)) { |
|
|
|
|
return purchaseCatalogue; |
|
|
|
|
} else return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override//审核
|
|
|
|
|
@Transactional |
|
|
|
|
@Override//二级审核
|
|
|
|
|
public PurchaseCatalogue secondaryAuditCatalogue(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { |
|
|
|
|
public PurchaseCatalogue primaryAuditCatalogue(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { |
|
|
|
|
|
|
|
|
|
PurchaseCatalogue purchaseCatalogue = purchaseCatalogueService.getById(auditAndApproveDto.getUuId()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditOpinionOfSecondary(auditAndApproveDto.getAuditOpinion()); |
|
|
|
|
purchaseCatalogue.setAuditOpinion(auditAndApproveDto.getAuditOpinion()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditResultOfSecondary(auditAndApproveDto.getAuditResult()); |
|
|
|
|
purchaseCatalogue.setAuditResult(auditAndApproveDto.getAuditResult()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setSecondaryAuditorId(dlpUser.getId()); |
|
|
|
|
purchaseCatalogue.setAuditorId(dlpUser.getId()); |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setAuditTimeOfSecondary(LocalDateTime.now()); |
|
|
|
|
purchaseCatalogue.setAuditTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
|
|
if (purchaseCatalogue.getAuditResultOfSecondary() == true) { |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setStatus(3); |
|
|
|
|
if (purchaseCatalogue.getAuditResult() == true) { |
|
|
|
|
|
|
|
|
|
//审核通过后,将采购目录添加的试剂耗材,录入至试剂耗材类
|
|
|
|
|
LambdaQueryWrapper<CatalogueDetails> catalogueDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -261,24 +248,25 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
//目录中的试剂耗材是否存在试剂耗材类中,有则不管,无则添加
|
|
|
|
|
for (CatalogueDetails catalogueDetails : list) { |
|
|
|
|
|
|
|
|
|
if (catalogueDetails.getReagentConsumableId() == null) { |
|
|
|
|
catalogueDetails.setReagentConsumableId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
catalogueDetailsService.updateById(catalogueDetails); |
|
|
|
|
ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(catalogueDetails); |
|
|
|
|
} else { |
|
|
|
|
ReagentConsumables byId = reagentConsumablesService.getById(catalogueDetails.getReagentConsumableId()); |
|
|
|
|
if (byId == null) { |
|
|
|
|
ReagentConsumables one = reagentConsumablesService.getOne(Wrappers.<ReagentConsumables>query() |
|
|
|
|
.eq("reagent_consumable_name", catalogueDetails.getReagentConsumableName()) |
|
|
|
|
.eq("cas_number", catalogueDetails.getCasNumber()) |
|
|
|
|
.eq("brand", catalogueDetails.getBrand()) |
|
|
|
|
.eq("category", catalogueDetails.getCategory()) |
|
|
|
|
.eq("specification_and_model", catalogueDetails.getSpecificationAndModel()) |
|
|
|
|
.eq("standard_value_or_purity", catalogueDetails.getStandardValueOrPurity())); |
|
|
|
|
.eq("standard_value_or_purity", catalogueDetails.getStandardValueOrPurity()) |
|
|
|
|
.eq("cas_number", catalogueDetails.getCasNumber())); |
|
|
|
|
|
|
|
|
|
if (one == null) { |
|
|
|
|
ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(catalogueDetails); |
|
|
|
|
catalogueDetails.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
|
catalogueDetailsService.updateById(catalogueDetails); |
|
|
|
|
}else { |
|
|
|
|
catalogueDetails.setReagentConsumableId(one.getReagentConsumableId()); |
|
|
|
|
catalogueDetailsService.updateById(catalogueDetails); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
purchaseCatalogue.setStatus(3); |
|
|
|
|
} else { |
|
|
|
|
purchaseCatalogue.setStatus(-3); |
|
|
|
|
} |
|
|
|
@ -288,6 +276,7 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
} else return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PurchaseCatalogue releaseCatalogue(String purchaseCatalogueId) { |
|
|
|
|
|
|
|
|
@ -307,7 +296,7 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
|
|
|
|
|
queryWrapper.eq("status", 4); |
|
|
|
|
|
|
|
|
|
QueryWrapper<PurchaseCatalogue> queryWrapper1 = queryWrapper.orderByDesc("create_time"); |
|
|
|
|
QueryWrapper<PurchaseCatalogue> queryWrapper1 = queryWrapper.orderByDesc("update_time"); |
|
|
|
|
|
|
|
|
|
List<PurchaseCatalogue> list = purchaseCatalogueService.list(queryWrapper1); |
|
|
|
|
|
|
|
|
@ -352,7 +341,6 @@ public class PurchaseCatalogueServiceImpl extends ServiceImpl<PurchaseCatalogueM |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getReagentConsumableName()) & |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getSpecies()) & |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getSpecificationAndModel()) & |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getStandardValueOrPurity()) & |
|
|
|
|
purchaseCatalogueDTO.getUnitPrice() != 0 & |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getAlias()) & |
|
|
|
|
StrUtil.isNotBlank(purchaseCatalogueDTO.getStorageCondition()) & |
|
|
|
|