|
@@ -1,20 +1,35 @@
|
|
|
package com.izouma.uwip.service;
|
|
package com.izouma.uwip.service;
|
|
|
|
|
|
|
|
import com.izouma.uwip.domain.LogoPatent;
|
|
import com.izouma.uwip.domain.LogoPatent;
|
|
|
|
|
+import com.izouma.uwip.domain.Partner;
|
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
import com.izouma.uwip.dto.PageQuery;
|
|
|
|
|
+import com.izouma.uwip.enums.CaseStage;
|
|
|
|
|
+import com.izouma.uwip.enums.CaseType;
|
|
|
|
|
+import com.izouma.uwip.exception.BusinessException;
|
|
|
import com.izouma.uwip.repo.LogoPatentRepo;
|
|
import com.izouma.uwip.repo.LogoPatentRepo;
|
|
|
|
|
+import com.izouma.uwip.repo.PartnerRepo;
|
|
|
import com.izouma.uwip.utils.JpaUtils;
|
|
import com.izouma.uwip.utils.JpaUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
|
+
|
|
|
@Service
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
public class LogoPatentService {
|
|
public class LogoPatentService {
|
|
|
|
|
|
|
|
private LogoPatentRepo logoPatentRepo;
|
|
private LogoPatentRepo logoPatentRepo;
|
|
|
|
|
+ private PartnerRepo partnerRepo;
|
|
|
|
|
|
|
|
public Page<LogoPatent> all(PageQuery pageQuery) {
|
|
public Page<LogoPatent> all(PageQuery pageQuery) {
|
|
|
return logoPatentRepo.findAll(JpaUtils.toSpecification(pageQuery, LogoPatent.class), JpaUtils.toPageRequest(pageQuery));
|
|
return logoPatentRepo.findAll(JpaUtils.toSpecification(pageQuery, LogoPatent.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public String getUwNo(LogoPatent patent) {
|
|
|
|
|
+// 客户编码(由客户经理填写)+年份+案件类型+连接符+案件阶段[+国家]+序列号
|
|
|
|
|
+ Partner partner = partnerRepo.findById(patent.getClientPartnerId()).orElseThrow(new BusinessException("客户不存在"));
|
|
|
|
|
+ int y = LocalDate.now().getYear() - 2000;
|
|
|
|
|
+ return partner.getCode() + y + CaseType.LOGO.getValue() + "——" + CaseStage.DOMESTIC.getValue() + String.format("%03d", patent.getSort());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|