|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.order.entity.api.yangguang.request;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.alibaba.fastjson.annotation.JSONField;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
@@ -13,6 +14,7 @@ import lombok.NoArgsConstructor;
|
|
|
import java.io.Serializable;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -115,7 +117,7 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
|
|
|
* 团车专票信息
|
|
|
*/
|
|
|
@JSONField(name = "customerList")
|
|
|
- private CustomerList customerList;
|
|
|
+ private List<CustomerList> customerList;
|
|
|
/**
|
|
|
* 关系人信息
|
|
|
*/
|
|
|
@@ -128,6 +130,11 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
|
|
|
private List<NonVehicleProductInformationList> NonVehicleProductInformationList;
|
|
|
|
|
|
public YangGuangSubmitRequest(InsOrders insOrders, InsAreaCompany insAreaCompany,String productId, YangGuangConfigureParameters ygConfigureParameters) {
|
|
|
+ //判断是否是企业车 1个人 2企业 3机关
|
|
|
+ String isProperty = insOrders.getCarinfo().getString("property");
|
|
|
+ if (isProperty.equals("2") || isProperty.equals("3")) {
|
|
|
+ this.customerList = YangGuangSubmitRequest.CustomerList.toCustomerList(insOrders);
|
|
|
+ }
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
this.RequestNo = "submit";
|
|
|
this.ComCode = ygConfigureParameters.getComCode();
|
|
|
@@ -142,7 +149,7 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
|
|
|
this.PolicyType = "3";
|
|
|
}
|
|
|
if (insAreaCompany.getAccidentInfo() != null) {
|
|
|
- this.NonVehicleProductInformationList =JSONArray.parseObject(insAreaCompany.getAccidentInfo().toJSONString(), new TypeReference<List<NonVehicleProductInformationList>>(){});
|
|
|
+ this.NonVehicleProductInformationList = JSONArray.parseObject(insAreaCompany.getAccidentInfo().toJSONString(), new TypeReference<List<NonVehicleProductInformationList>>(){});
|
|
|
this.CasualtyFlag = "1";
|
|
|
} else {
|
|
|
this.CasualtyFlag = "0";
|
|
|
@@ -210,14 +217,14 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
|
|
|
private String InsuredFlag;
|
|
|
|
|
|
/**
|
|
|
- * 纳税人类型
|
|
|
+ * 纳税人类型 1. 小规模纳税人 2. 一般纳税人 3. 其他类型
|
|
|
*/
|
|
|
@JSONField(name = "Taxpayertype")
|
|
|
private String Taxpayertype;
|
|
|
|
|
|
/**
|
|
|
* 是否开增值税发票
|
|
|
- * 0否1是
|
|
|
+ * 0否 1是
|
|
|
*/
|
|
|
@JSONField(name = "Vatinvoiceflag")
|
|
|
private String Vatinvoiceflag;
|
|
|
@@ -232,6 +239,43 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
|
|
|
*/
|
|
|
@JSONField(name = "Revenueaddress")
|
|
|
private String Revenueaddress;
|
|
|
+
|
|
|
+ public CustomerList(InsOrders insOrders,boolean flag) {
|
|
|
+ String addrapply= insOrders.getApplyinfo().getString("addr");
|
|
|
+ String addrinsurer = insOrders.getInsureinfo().getString("addr");
|
|
|
+ if (flag) {
|
|
|
+ this.customerFlag = "1";
|
|
|
+ this.Taxpayertype = "2";
|
|
|
+ this.Vatinvoiceflag = "0";
|
|
|
+ this.Revenueaddress = addrapply;
|
|
|
+ this.InsuredFlag = "2";
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ this.customerFlag = "0";
|
|
|
+ this.Taxpayertype = "2";
|
|
|
+ this.Vatinvoiceflag = "0";
|
|
|
+ this.Revenueaddress = addrinsurer;
|
|
|
+ this.InsuredFlag = "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static List<YangGuangSubmitRequest.CustomerList> toCustomerList(InsOrders insOrders) {
|
|
|
+ List<YangGuangSubmitRequest.CustomerList> customerLists = new ArrayList<>();
|
|
|
+ YangGuangSubmitRequest.CustomerList customer;
|
|
|
+ String applyinfo = insOrders.getApplyinfo().getString("insuranceHolder");
|
|
|
+ String insurerinfo = insOrders.getInsureinfo().getString("insuranceHolder");
|
|
|
+ // 投被保人一致
|
|
|
+ if (applyinfo != null && applyinfo.equals(insurerinfo)) {
|
|
|
+ customer = new YangGuangSubmitRequest.CustomerList(insOrders,true);
|
|
|
+ customerLists.add(customer);
|
|
|
+ } else {
|
|
|
+ // 投被保人不一致
|
|
|
+ YangGuangSubmitRequest.CustomerList policyHolder = new YangGuangSubmitRequest.CustomerList(insOrders,true);
|
|
|
+ YangGuangSubmitRequest.CustomerList insuredPerson = new YangGuangSubmitRequest.CustomerList(insOrders,false);
|
|
|
+ customerLists.add(policyHolder);
|
|
|
+ customerLists.add(insuredPerson);
|
|
|
+ }
|
|
|
+ return customerLists;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Data
|