|
|
@@ -2,13 +2,16 @@ package com.izouma.uwip.service;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import com.izouma.uwip.domain.CountryPatent;
|
|
|
import com.izouma.uwip.domain.Handle;
|
|
|
+import com.izouma.uwip.domain.InternationalPatent;
|
|
|
import com.izouma.uwip.domain.Patent;
|
|
|
import com.izouma.uwip.dto.CountryPatentDTO;
|
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
|
-import com.izouma.uwip.enums.*;
|
|
|
+import com.izouma.uwip.enums.ApplyStatus;
|
|
|
+import com.izouma.uwip.enums.CaseStage;
|
|
|
+import com.izouma.uwip.enums.CaseType;
|
|
|
+import com.izouma.uwip.enums.CountryWorkflow;
|
|
|
import com.izouma.uwip.exception.BusinessException;
|
|
|
import com.izouma.uwip.repo.CountryPatentRepo;
|
|
|
import com.izouma.uwip.repo.PatentRepo;
|
|
|
@@ -19,12 +22,9 @@ import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.persistence.criteria.Path;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
@@ -34,6 +34,7 @@ public class CountryPatentService {
|
|
|
private final PatentRepo patentRepo;
|
|
|
private final PartnerService partnerService;
|
|
|
private final AttachmentService attachmentService;
|
|
|
+ private final PatentService patentService;
|
|
|
|
|
|
|
|
|
public Page<CountryPatent> all(PageQuery pageQuery) {
|
|
|
@@ -52,16 +53,14 @@ public class CountryPatentService {
|
|
|
Patent patent = new Patent();
|
|
|
BeanUtil.copyProperties(record, patent);
|
|
|
ObjUtils.mergePatent(orig1, patent);
|
|
|
+ // 流程
|
|
|
List<Handle> handleList = orig1.getHandle();
|
|
|
if (handleList == null) {
|
|
|
handleList = new ArrayList<>();
|
|
|
}
|
|
|
- handleList.add(Handle.builder()
|
|
|
- .workflow(record.getWorkflow().toString())
|
|
|
- .userId(userId)
|
|
|
- .checkAt(LocalDateTime.now())
|
|
|
- .build());
|
|
|
+ patentService.saveHandle(record.getWorkflow().toString(), userId, handleList);
|
|
|
orig1.setHandle(handleList);
|
|
|
+
|
|
|
if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
|
|
|
orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
|
|
|
}
|
|
|
@@ -124,28 +123,8 @@ public class CountryPatentService {
|
|
|
|
|
|
public Page<CountryPatent> allDTO(PageQuery pageQuery) {
|
|
|
return countryPatentRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
- List<Predicate> and = new ArrayList<>();
|
|
|
- Path<Object> patent = root.get("patent");
|
|
|
- if (StrUtil.isNotBlank(pageQuery.getSearch())) {
|
|
|
- List<Predicate> or = new ArrayList<>();
|
|
|
- or.add(criteriaBuilder.like(patent.get("name"), "%" + pageQuery.getSearch() + "%"));
|
|
|
- or.add(criteriaBuilder.like(patent.get("uwNo"), "%" + pageQuery.getSearch() + "%"));
|
|
|
- and.add(criteriaBuilder.or(or.toArray(new Predicate[0])));
|
|
|
- }
|
|
|
- Map<String, Object> query = pageQuery.getQuery();
|
|
|
- query.keySet().forEach(key -> {
|
|
|
- if (JpaUtils.isExistField(key, CountryPatent.class)) {
|
|
|
- Predicate predicate = JpaUtils.getPredicate(key, query.get(key), CountryPatent.class, root, criteriaBuilder, false);
|
|
|
- if (ObjectUtil.isNotNull(predicate)) {
|
|
|
- and.add(predicate);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Predicate predicate = JpaUtils.getPredicate(key, query.get(key), Patent.class, root, criteriaBuilder, true);
|
|
|
- if (ObjectUtil.isNotNull(predicate)) {
|
|
|
- and.add(predicate);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ List<Predicate> and = patentService.getPredicate(pageQuery, InternationalPatent.class, root, criteriaBuilder);
|
|
|
+
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
}), JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|