37 lines
1.2 KiB
Plaintext
Executable File
37 lines
1.2 KiB
Plaintext
Executable File
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.fp.person.rules.query.code;
|
|
|
|
import com.fp.dto.Response;
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
import com.fp.persistence.commondb.PersistenceHelper;
|
|
import com.fp.persistence.pcustomer.company.TcustCompanyManagers;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Clase que devuelve porcentaje de participacion de participacion de accionistas
|
|
* @author hinga
|
|
*/
|
|
|
|
public class PercentageStockholder extends QueryRule {
|
|
|
|
@Override
|
|
public QueryRequest process(QueryRequest pQueryRequest) throws Exception {
|
|
Response response= pQueryRequest.getResponse();
|
|
Integer codPerson=(Integer) pQueryRequest.get("PERSONCODE");
|
|
List<TcustCompanyManagers> tcustCompanyManagers= TcustCompanyManagers.find(PersistenceHelper.getEntityManager(), codPerson);
|
|
BigDecimal perc=new BigDecimal(0);
|
|
for(TcustCompanyManagers obj:tcustCompanyManagers){
|
|
if(obj.getParticipation()!=null)
|
|
perc= perc.add(obj.getParticipation());
|
|
}
|
|
response.put("PERCENTAGE", perc);
|
|
return pQueryRequest;
|
|
}
|
|
}
|