ソースを参照

寰球案号/费用加字段

licailing 5 年 前
コミット
40201a86f8

+ 15 - 0
src/main/java/com/izouma/uwip/domain/Fee.java

@@ -42,6 +42,11 @@ public class Fee extends BaseEntity {
     @ApiModelProperty(value = "支付对象")
     private Long payPartnerId;
 
+    @ApiModelProperty(value = "账单图片")
+    private String billImg;
+
+    private String billRemark;
+
     private BigDecimal amount;
 
     @ApiModelProperty(value = "币种")
@@ -53,10 +58,20 @@ public class Fee extends BaseEntity {
     @ApiModelProperty(value = "支付日期")
     private LocalDate paymentDate;
 
+    @ApiModelProperty(value = "付款图片")
+    private String paymentImg;
+
+    private String paymentRemark;
+
     private String remark;
 
     @ApiModelProperty(value = "是否发票回传")
     private Boolean invoiceReturn;
 
+    @ApiModelProperty(value = "发票图片")
+    private String invoiceImg;
+
+    private String invoiceRemark;
+
     private Long userId;
 }

+ 4 - 0
src/main/java/com/izouma/uwip/domain/LogoPatent.java

@@ -10,6 +10,7 @@ import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import org.hibernate.annotations.Where;
 
 import javax.persistence.*;
 import java.time.LocalDate;
@@ -21,6 +22,7 @@ import java.util.List;
 @Builder
 @Entity
 @ApiModel(value = "商标专利申请")
+@Where(clause = "del = 0")
 public class LogoPatent extends BaseEntity {
     @ApiModelProperty(value = "创建申请人")
     private Long userId;
@@ -89,4 +91,6 @@ public class LogoPatent extends BaseEntity {
     @Convert(converter = HandleListConverter.class)
     private List<Handle> handle;
 
+    private int sort;
+
 }

+ 30 - 0
src/main/java/com/izouma/uwip/enums/CaseStage.java

@@ -0,0 +1,30 @@
+package com.izouma.uwip.enums;
+
+public enum CaseStage {
+    /*
+    国内
+     */
+    DOMESTIC(1),
+    /*
+    PCT国际
+     */
+    PCT(2),
+    /*
+    国家
+     */
+    COUNTRY(3),
+    /*
+    单一国
+     */
+    SINGLE(4);
+
+    private final int value;
+
+    public int getValue() {
+        return value;
+    }
+
+    CaseStage(int value) {
+        this.value = value;
+    }
+}

+ 39 - 0
src/main/java/com/izouma/uwip/enums/CaseType.java

@@ -0,0 +1,39 @@
+package com.izouma.uwip.enums;
+
+public enum CaseType {
+    /*
+    发明
+     */
+    INVENTION(1),
+    /*
+    实用新型
+     */
+    UTILITY_MODEL(2),
+    /*
+    外观设计
+     */
+    APPEARANCE_DESIGN(3),
+    /*
+    商标
+     */
+    LOGO(4),
+    /*
+    翻译
+     */
+    TRANSLATION(5),
+    /*
+    其他
+     */
+    OTHER(6)
+    ;
+
+
+    private final int value;
+
+    public int getValue() {
+        return value;
+    }
+    CaseType(int value){
+        this.value = value;
+    }
+}

+ 3 - 0
src/main/java/com/izouma/uwip/repo/LogoPatentRepo.java

@@ -13,4 +13,7 @@ public interface LogoPatentRepo extends JpaRepository<LogoPatent, Long>, JpaSpec
     @Modifying
     @Transactional
     void softDelete(Long id);
+
+    @Query("select max(t.sort)+1 from  LogoPatent t where t.del = true")
+    int findMax();
 }

+ 15 - 0
src/main/java/com/izouma/uwip/service/LogoPatentService.java

@@ -1,20 +1,35 @@
 package com.izouma.uwip.service;
 
 import com.izouma.uwip.domain.LogoPatent;
+import com.izouma.uwip.domain.Partner;
 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.PartnerRepo;
 import com.izouma.uwip.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+
 @Service
 @AllArgsConstructor
 public class LogoPatentService {
 
     private LogoPatentRepo logoPatentRepo;
+    private PartnerRepo    partnerRepo;
 
     public Page<LogoPatent> all(PageQuery 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());
+    }
 }

+ 7 - 1
src/main/java/com/izouma/uwip/web/LogoPatentController.java

@@ -1,5 +1,7 @@
 package com.izouma.uwip.web;
+
 import com.izouma.uwip.domain.LogoPatent;
+import com.izouma.uwip.domain.Partner;
 import com.izouma.uwip.service.LogoPatentService;
 import com.izouma.uwip.dto.PageQuery;
 import com.izouma.uwip.exception.BusinessException;
@@ -20,7 +22,7 @@ import java.util.List;
 @AllArgsConstructor
 public class LogoPatentController extends BaseController {
     private LogoPatentService logoPatentService;
-    private LogoPatentRepo logoPatentRepo;
+    private LogoPatentRepo    logoPatentRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -30,6 +32,10 @@ public class LogoPatentController extends BaseController {
             ObjUtils.merge(orig, record);
             return logoPatentRepo.save(orig);
         }
+        if (record.getSort() == 0) {
+            record.setSort(logoPatentRepo.findMax());
+        }
+        record.setUwNo(logoPatentService.getUwNo(record));
         return logoPatentRepo.save(record);
     }
 

+ 23 - 0
src/test/java/com/izouma/uwip/service/LogoPatentServiceTest.java

@@ -0,0 +1,23 @@
+package com.izouma.uwip.service;
+
+import com.izouma.uwip.ApplicationTests;
+import com.izouma.uwip.domain.LogoPatent;
+import com.izouma.uwip.exception.BusinessException;
+import com.izouma.uwip.repo.LogoPatentRepo;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class LogoPatentServiceTest extends ApplicationTests {
+
+    @Autowired
+    private LogoPatentRepo logoPatentRepo;
+    @Autowired
+    private LogoPatentService logoPatentService;
+
+    @Test
+    public void getUwNo() {
+        LogoPatent patent = logoPatentRepo.findById(44L).orElseThrow(new BusinessException("wu"));
+        System.out.println(logoPatentService.getUwNo(patent));
+    }
+}