Commit 4833ab19 authored by bunchaP's avatar bunchaP
Browse files

Merge branch 'dev' into feature/excel

Showing with 115 additions and 67 deletions
+115 -67
......@@ -16,7 +16,7 @@ import javax.persistence.*;
*/
@Entity
@Table(name = "ag_benefit", catalog = "", schema = "", uniqueConstraints = {
@UniqueConstraint(columnNames = { "recordid" }) })
@UniqueConstraint(columnNames = { "record_id" }) })
public class AgBenefit implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -58,9 +58,9 @@ public class AgBenefit implements Serializable {
private Date createddate;
@Column(name = "fyp")
private BigDecimal fyp;
@Basic(optional = false)
@Column(name = "recordid")
private String recordid;
// @Basic(optional = false)
// @Column(name = "recordid")
// private String recordid;
@Basic(optional = false)
@Column(name = "isdeleted")
private boolean isdeleted;
......@@ -116,12 +116,13 @@ public class AgBenefit implements Serializable {
}
public AgBenefit(String id, boolean agentProducingVisibility, boolean agentServicingVisibility, Date createddate,
String recordid, boolean isdeleted, Date lastmodifieddate, String name, Date systemmodstamp) {
// String recordid,
boolean isdeleted, Date lastmodifieddate, String name, Date systemmodstamp) {
this.id = id;
this.agentProducingVisibility = agentProducingVisibility;
this.agentServicingVisibility = agentServicingVisibility;
this.createddate = createddate;
this.recordid = recordid;
// this.recordid = recordid;
this.isdeleted = isdeleted;
this.lastmodifieddate = lastmodifieddate;
this.name = name;
......@@ -248,13 +249,13 @@ public class AgBenefit implements Serializable {
this.fyp = fyp;
}
public String getRecordid() {
return recordid;
}
// public String getRecordid() {
// return recordid;
// }
public void setRecordid(String recordid) {
this.recordid = recordid;
}
// public void setRecordid(String recordid) {
// this.recordid = recordid;
// }
public boolean getIsdeleted() {
return isdeleted;
......
......@@ -122,8 +122,8 @@ public class AgCustomer implements Serializable {
@Column(name = "systemmodstamp", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date systemmodstamp;
@Column(name = "customer_address__c", length = 512)
private String customerAddressC;
// @Column(name = "customer_address__c", length = 512)
// private String customerAddressC;
public AgCustomer() {
}
......@@ -429,13 +429,13 @@ public class AgCustomer implements Serializable {
this.systemmodstamp = systemmodstamp;
}
public String getCustomerAddressC() {
return customerAddressC;
}
// public String getCustomerAddressC() {
// return customerAddressC;
// }
public void setCustomerAddressC(String customerAddressC) {
this.customerAddressC = customerAddressC;
}
// public void setCustomerAddressC(String customerAddressC) {
// this.customerAddressC = customerAddressC;
// }
@Override
public int hashCode() {
......
......@@ -88,9 +88,9 @@ public class AgFinancialTransaction implements Serializable {
@Column(name = "lastmodifiedbyid", nullable = false, length = 18)
private String lastmodifiedbyid;
// @Basic(optional = false)
// @Column(name = "lastmodifieddate", nullable = false)
// @Temporal(TemporalType.TIMESTAMP)
// private Date lastmodifieddate;
@Column(name = "lastmodifieddate", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date lastmodifieddate;
// @Column(name = "lastreferenceddate")
// @Temporal(TemporalType.TIMESTAMP)
// private Date lastreferenceddate;
......@@ -356,13 +356,13 @@ public class AgFinancialTransaction implements Serializable {
this.lastmodifiedbyid = lastmodifiedbyid;
}
// public Date getLastmodifieddate() {
// return lastmodifieddate;
// }
public Date getLastmodifieddate() {
return lastmodifieddate;
}
// public void setLastmodifieddate(Date lastmodifieddate) {
// this.lastmodifieddate = lastmodifieddate;
// }
public void setLastmodifieddate(Date lastmodifieddate) {
this.lastmodifieddate = lastmodifieddate;
}
// public Date getLastreferenceddate() {
// return lastreferenceddate;
......
......@@ -58,7 +58,7 @@ public class AgBenefitDto {
private BigDecimal fyp;
@JsonProperty("Record_Id__c")
private String recordid;
private String recordId;
@JsonProperty("IsDeleted")
private boolean isdeleted;
......
......@@ -68,8 +68,8 @@ public class AgFinancialTransactionDto {
@JsonProperty("LastModifiedById")
private String lastmodifiedbyid;
// @JsonProperty("LastModifiedDate")
// private Date lastmodifieddate;
@JsonProperty("LastModifiedDate")
private Date lastmodifieddate;
// @JsonProperty("LastReferencedDate")
// private Date lastreferenceddate;
......
......@@ -47,9 +47,9 @@ public class DataInRestApi {
}
@PostMapping("upsert-account")
public ResponseEntity<Object> upsertAccount(@RequestBody List<SfdcObject<AccountDto>> datain) {
public ResponseEntity<DatainService.WebserviceRespone> upsertAccount(@RequestBody List<SfdcObject<AccountDto>> datain) {
log.info(datain);
DatainService.WebserviceRespone res = null;
List<Account> accountList = new ArrayList<>();
try {
int i = 0;
......@@ -60,17 +60,17 @@ public class DataInRestApi {
log.info(acc);
accountList.add(acc);
}
datainService.upsertAccount(accountList);
res = datainService.upsertAccount(accountList);
} catch (Exception ex) {
log.error(ex);
}
return ResponseEntity.ok().build();
return ResponseEntity.ok().body(res);
}
@PostMapping("upsert-customer")
public ResponseEntity<Object> upsertCustomer(@RequestBody List<SfdcObject<AgCustomerDto>> datain) {
public ResponseEntity<DatainService.WebserviceRespone> upsertCustomer(@RequestBody List<SfdcObject<AgCustomerDto>> datain) {
log.info(datain);
DatainService.WebserviceRespone res = null;
List<AgCustomer> customerList = new ArrayList<>();
try {
int i = 0;
......@@ -81,16 +81,16 @@ public class DataInRestApi {
log.info(customer);
customerList.add(customer);
}
datainService.upsertCustomer(customerList);
res = datainService.upsertCustomer(customerList);
} catch (Exception ex) {
log.error(ex);
}
return ResponseEntity.ok().build();
return ResponseEntity.ok().body(res);
}
@PostMapping("upsert-financial")
public ResponseEntity<Object> upsertFinancial(@RequestBody List<SfdcObject<AgFinancialTransactionDto>> datain) {
public ResponseEntity<DatainService.WebserviceRespone> upsertFinancial(@RequestBody List<SfdcObject<AgFinancialTransactionDto>> datain) {
log.info(datain);
DatainService.WebserviceRespone res = null;
List<AgFinancialTransaction> financialList = new ArrayList<>();
try {
int i = 0;
......@@ -102,16 +102,16 @@ public class DataInRestApi {
log.info(finance);
financialList.add(finance);
}
datainService.upsertFinancial(financialList);
res = datainService.upsertFinancial(financialList);
} catch (Exception ex) {
log.error(ex);
}
return ResponseEntity.ok().build();
return ResponseEntity.ok().body(res);
}
@PostMapping("upsert-policy")
public ResponseEntity<Object> upsertPolicy(@RequestBody List<SfdcObject<AgPolicyMasterDto>> datain) {
public ResponseEntity<DatainService.WebserviceRespone> upsertPolicy(@RequestBody List<SfdcObject<AgPolicyMasterDto>> datain) {
log.info(datain);
DatainService.WebserviceRespone res = null;
List<AgPolicyMaster> policyList = new ArrayList<>();
try {
int i = 0;
......@@ -122,16 +122,16 @@ public class DataInRestApi {
log.info(policy);
policyList.add(policy);
}
datainService.upsertPolicy(policyList);
res = datainService.upsertPolicy(policyList);
} catch (Exception ex) {
log.error(ex);
}
return ResponseEntity.ok().build();
return ResponseEntity.ok().body(res);
}
@PostMapping("upsert-benefit")
public ResponseEntity<Object> upsertBenefit(@RequestBody List<SfdcObject<AgBenefitDto>> datain) {
public ResponseEntity<DatainService.WebserviceRespone> upsertBenefit(@RequestBody List<SfdcObject<AgBenefitDto>> datain) {
log.info(datain);
DatainService.WebserviceRespone res = null;
List<AgBenefit> benefitList = new ArrayList<>();
try {
int i = 0;
......@@ -142,11 +142,11 @@ public class DataInRestApi {
log.info(benefit);
benefitList.add(benefit);
}
datainService.upsertBenefit(benefitList);
res = datainService.upsertBenefit(benefitList);
} catch (Exception ex) {
log.error(ex);
}
return ResponseEntity.ok().build();
return ResponseEntity.ok().body(res);
}
}
......@@ -4,6 +4,7 @@ import java.util.List;
import javax.transaction.Transactional;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
import com.b3.rbl.compensation.db.entity.Account;
......@@ -31,52 +32,98 @@ public class DatainService {
private AgPolicyMasterRepository policyMasterRepository;
@Transactional
public void upsertAccount(List<Account> accountList) {
public DatainService.WebserviceRespone upsertAccount(List<Account> accountList) {
Iterable<Account> res;
DatainService.WebserviceRespone respone = new DatainService.WebserviceRespone();
try {
accountRepository.saveAll(accountList);
res = accountRepository.saveAll(accountList);
log.info(res);
respone.message = "Process Success";
respone.status = "Success";
respone.data = res.toString();
} catch (Exception e) {
log.error(e);
respone.message = "Process Fail";
respone.status = "Fail";
}
return respone;
}
@Transactional
public void upsertBenefit(List<AgBenefit> benfitList) {
public DatainService.WebserviceRespone upsertBenefit(List<AgBenefit> benfitList) {
Iterable<AgBenefit> res;
DatainService.WebserviceRespone respone = new DatainService.WebserviceRespone();
try {
benefitRepository.saveAll(benfitList);
res = benefitRepository.saveAll(benfitList);
log.info(res);
respone.message = "Process Success";
respone.status = "Success";
respone.data = res.toString();
} catch (Exception e) {
log.error(e);
respone.message = "Process Fail";
respone.status = "Fail";
}
return respone;
}
@Transactional
public void upsertCustomer(List<AgCustomer> customers) {
public DatainService.WebserviceRespone upsertCustomer(List<AgCustomer> customers) {
Iterable<AgCustomer> res;
DatainService.WebserviceRespone respone = new DatainService.WebserviceRespone();
try {
customerRepository.saveAll(customers);
res = customerRepository.saveAll(customers);
log.info(res);
respone.message = "Process Success";
respone.status = "Success";
respone.data = res.toString();
} catch (Exception e) {
log.error(e);
respone.message = "Process Fail";
respone.status = "Fail";
}
return respone;
}
@Transactional
public void upsertFinancial(List<AgFinancialTransaction> financialTransactions) {
public DatainService.WebserviceRespone upsertFinancial(List<AgFinancialTransaction> financialTransactions) {
Iterable<AgFinancialTransaction> res;
DatainService.WebserviceRespone respone = new DatainService.WebserviceRespone();
try {
financialTransactionRepository.saveAll(financialTransactions);
res = financialTransactionRepository.saveAll(financialTransactions);
log.info(res);
respone.message = "Process Success";
respone.status = "Success";
respone.data = res.toString();
} catch (Exception e) {
log.error(e);
respone.message = "Process Fail";
respone.status = "Fail";
}
return respone;
}
@Transactional
public void upsertPolicy(List<AgPolicyMaster> policyMasters) {
public DatainService.WebserviceRespone upsertPolicy(List<AgPolicyMaster> policyMasters) {
Iterable<AgPolicyMaster> res;
DatainService.WebserviceRespone respone = new DatainService.WebserviceRespone();
try {
policyMasterRepository.saveAll(policyMasters);
res = policyMasterRepository.saveAll(policyMasters);
log.info(res);
respone.message = "Process Success";
respone.status = "Success";
respone.data = res.toString();
} catch (Exception e) {
log.error(e);
respone.message = "Process Fail";
respone.status = "Fail";
// respone.data = res.toString();
}
return respone;
}
public class WebserviceRespone{
public String status;
public String message;
public String data;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment