feat: 发票添加
parent
1437bf936e
commit
60e33434d3
5
pom.xml
5
pom.xml
|
|
@ -94,6 +94,11 @@
|
||||||
<artifactId>scfs-api-service-cat</artifactId>
|
<artifactId>scfs-api-service-cat</artifactId>
|
||||||
<version>2.0.4-snapshot</version>
|
<version>2.0.4-snapshot</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.czcb.scfs</groupId>
|
||||||
|
<artifactId>scfs-api-service-equity</artifactId>
|
||||||
|
<version>2.0.4-snapshot</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.czcb.scfs</groupId>
|
<groupId>com.czcb.scfs</groupId>
|
||||||
<artifactId>scfs-api-sm</artifactId>
|
<artifactId>scfs-api-sm</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.czcb.scfs.api.core.validation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CharSequence
|
||||||
|
*
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/9
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface NotBlank {
|
||||||
|
|
||||||
|
String message() default "字段值不能为空";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.czcb.scfs.api.core.validation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CharSequence、Collection、Map、Array
|
||||||
|
*
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/9
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface NotEmpty {
|
||||||
|
|
||||||
|
String message() default "字段值不能为空";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.czcb.scfs.api.core.validation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/9
|
||||||
|
*/
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface NotNull {
|
||||||
|
|
||||||
|
String message() default "字段值不能为NULL";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.czcb.scfs.api.core.validation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/9
|
||||||
|
*/
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Size {
|
||||||
|
String message() default "";
|
||||||
|
|
||||||
|
int min() default 0;
|
||||||
|
|
||||||
|
int max() default 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package com.czcb.scfs.service.equity.configuration;
|
package com.czcb.scfs.service.equity.configuration;
|
||||||
|
|
||||||
|
import com.czcb.scfs.api.core.ApiClient;
|
||||||
|
import com.czcb.scfs.service.equity.invoice.InvoiceService;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
@ -10,4 +14,10 @@ import org.springframework.context.annotation.Configuration;
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan("com.czcb.scfs.service.equity")
|
@ComponentScan("com.czcb.scfs.service.equity")
|
||||||
public class ScfsApiServiceEquityAutoConfiguration {
|
public class ScfsApiServiceEquityAutoConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public InvoiceService invoiceService(ApiClient apiClient) {
|
||||||
|
return new InvoiceService(apiClient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ package com.czcb.scfs.service.equity.invoice;
|
||||||
import com.czcb.scfs.api.core.ApiClient;
|
import com.czcb.scfs.api.core.ApiClient;
|
||||||
import com.czcb.scfs.api.core.http.HttpHeaders;
|
import com.czcb.scfs.api.core.http.HttpHeaders;
|
||||||
import com.czcb.scfs.api.core.http.HttpResponse;
|
import com.czcb.scfs.api.core.http.HttpResponse;
|
||||||
import com.czcb.scfs.service.equity.invoice.model.InvoiceAddRequest;
|
import com.czcb.scfs.service.equity.invoice.model.*;
|
||||||
import com.czcb.scfs.service.equity.invoice.model.InvoiceAddResponse;
|
|
||||||
import com.czcb.scfs.service.equity.invoice.model.InvoiceQueryRequest;
|
|
||||||
import com.czcb.scfs.service.equity.invoice.model.InvoiceQueryResponse;
|
|
||||||
|
|
||||||
import static com.czcb.scfs.api.core.Constants.API_VERSION;
|
import static com.czcb.scfs.api.core.Constants.API_VERSION;
|
||||||
import static com.czcb.scfs.api.core.Constants.V_2;
|
import static com.czcb.scfs.api.core.Constants.V_2;
|
||||||
|
|
@ -36,11 +33,11 @@ public class InvoiceService {
|
||||||
/**
|
/**
|
||||||
* 删除发票
|
* 删除发票
|
||||||
*/
|
*/
|
||||||
public InvoiceAddResponse delete(InvoiceAddRequest request) {
|
public InvoiceDelResponse del(InvoiceDelRequest request) {
|
||||||
String url = "/invoice/delete";
|
String url = "/invoice/del";
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.addHeader(API_VERSION, V_2);
|
headers.addHeader(API_VERSION, V_2);
|
||||||
HttpResponse<InvoiceAddResponse> httpResponse = apiClient.post(url, headers, request.toJsonRequest(), InvoiceAddResponse.class);
|
HttpResponse<InvoiceDelResponse> httpResponse = apiClient.post(url, headers, request.toJsonRequest(), InvoiceDelResponse.class);
|
||||||
return httpResponse.getServiceResponse();
|
return httpResponse.getServiceResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.czcb.scfs.service.equity.invoice.model;
|
||||||
|
|
||||||
|
import com.czcb.scfs.api.core.ApiRequest;
|
||||||
|
import com.czcb.scfs.api.core.util.DateTimes;
|
||||||
|
import com.czcb.scfs.api.core.validation.Size;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/8
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class InvoiceDelRequest implements ApiRequest {
|
||||||
|
/**
|
||||||
|
* 渠道编号
|
||||||
|
*/
|
||||||
|
@SerializedName("channel_no")
|
||||||
|
private String channelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用编号
|
||||||
|
*/
|
||||||
|
@SerializedName("app_no")
|
||||||
|
private String appNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水号
|
||||||
|
*/
|
||||||
|
@SerializedName("serial_no")
|
||||||
|
private String serialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日期
|
||||||
|
*/
|
||||||
|
@SerializedName("trans_date")
|
||||||
|
private String transDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
@SerializedName("trans_tradetime")
|
||||||
|
private String transTradeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票编号
|
||||||
|
*/
|
||||||
|
@Size(min = 1, max = 50, message = "数据条数1-50")
|
||||||
|
@SerializedName("invoice_nos")
|
||||||
|
private List<String> invoiceNos;
|
||||||
|
|
||||||
|
public static InvoiceDelRequest of(String channelNo, String appNo, String serialNo, String... invoiceNos) {
|
||||||
|
InvoiceDelRequest request = new InvoiceDelRequest();
|
||||||
|
request.setChannelNo(channelNo);
|
||||||
|
request.setAppNo(appNo);
|
||||||
|
request.setSerialNo(serialNo);
|
||||||
|
request.setTransDate(DateTimes.ofNowDate());
|
||||||
|
request.setTransTradeTime(DateTimes.ofNow());
|
||||||
|
request.setInvoiceNos(Arrays.asList(invoiceNos));
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.czcb.scfs.service.equity.invoice.model;
|
||||||
|
|
||||||
|
import com.czcb.scfs.api.core.PageApiResponse;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangwei
|
||||||
|
* @since 2024/7/8
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class InvoiceDelResponse implements PageApiResponse {
|
||||||
|
/**
|
||||||
|
* 000000:表示成功
|
||||||
|
*/
|
||||||
|
@SerializedName("recode")
|
||||||
|
private String recode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果信息
|
||||||
|
*/
|
||||||
|
@SerializedName("recode_info")
|
||||||
|
private String recodeInfo;
|
||||||
|
/**
|
||||||
|
* 系统流水号
|
||||||
|
*/
|
||||||
|
@SerializedName("sys_serial_no")
|
||||||
|
private String sysSerialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统日期(YYYY-MM-DD)
|
||||||
|
*/
|
||||||
|
@SerializedName("sys_date")
|
||||||
|
private String sysDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统时间(YYYY-MM-DD hh:mm:ss)
|
||||||
|
*/
|
||||||
|
@SerializedName("sys_time")
|
||||||
|
private String sysTime;
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,11 @@
|
||||||
<artifactId>scfs-api-service-cat</artifactId>
|
<artifactId>scfs-api-service-cat</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.czcb.scfs</groupId>
|
||||||
|
<artifactId>scfs-api-service-equity</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.czcb.scfs.api.test.equity.invoice;
|
||||||
|
|
||||||
|
import com.czcb.scfs.api.core.util.DateTimes;
|
||||||
|
import com.czcb.scfs.api.core.util.Nonce;
|
||||||
|
import com.czcb.scfs.service.equity.invoice.InvoiceService;
|
||||||
|
import com.czcb.scfs.service.equity.invoice.model.InvoiceDelRequest;
|
||||||
|
import com.czcb.scfs.service.equity.invoice.model.InvoiceDelResponse;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class InvoiceServiceTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvoiceService invoiceService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void del() {
|
||||||
|
InvoiceDelRequest request = new InvoiceDelRequest();
|
||||||
|
request.setChannelNo("0000");
|
||||||
|
request.setAppNo("1000");
|
||||||
|
request.setSerialNo(Nonce.ofNonce());
|
||||||
|
request.setTransDate(DateTimes.ofNowDate());
|
||||||
|
request.setTransTradeTime(DateTimes.ofNow());
|
||||||
|
// request.setInvoiceNos(Arrays.asList("2200000909090990"));
|
||||||
|
|
||||||
|
InvoiceDelResponse response = invoiceService.del(request);
|
||||||
|
if ("000000".equals(response.getRecode())) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue