fixes bug#11299
dev:gleimar qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@82473 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
09add2e479
commit
48c7f69b1f
|
@ -213,8 +213,9 @@ public class ComissaoHibernateDAO extends GenericHibernateDAO<Comissao, Integer>
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PuntoVenta> buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId) {
|
||||
StringBuilder sQuery = new StringBuilder("SELECT pv.puntoventaId FROM PtovtaComissao c ");
|
||||
StringBuilder sQuery = new StringBuilder("SELECT NEW com.rjconsultores.ventaboletos.entidad.PuntoVenta(pv.puntoventaId, pv.nombpuntoventa) FROM PtovtaComissao c ");
|
||||
sQuery.append("JOIN c.puntoventaId pv ")
|
||||
.append("JOIN c.empresaId e ")
|
||||
.append("WHERE pv.activo = 1 ")
|
||||
|
@ -224,15 +225,7 @@ public class ComissaoHibernateDAO extends GenericHibernateDAO<Comissao, Integer>
|
|||
Query qr = getSession().createQuery(sQuery.toString());
|
||||
qr.setParameter("empresaId", empresaId);
|
||||
|
||||
List<PuntoVenta> list = new ArrayList<PuntoVenta>();
|
||||
List<Integer> ids = (List<Integer>) qr.list();
|
||||
for (Integer id : ids) {
|
||||
PuntoVenta pv = new PuntoVenta();
|
||||
pv.setPuntoventaId(id);
|
||||
list.add(pv);
|
||||
}
|
||||
|
||||
return list;
|
||||
return qr.list();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,13 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Comissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao;
|
||||
|
||||
public interface ComissaoService extends GenericService<Comissao, Integer> {
|
||||
|
||||
public List<HistoricoComissao> buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim);
|
||||
|
||||
public List<PuntoVenta> buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId);
|
||||
|
||||
}
|
||||
|
|
|
@ -990,19 +990,10 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
@Transactional
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date dataInicial, Date dataFinal, Integer usuarioId) throws ComissaoException, BusinessException {
|
||||
try {
|
||||
List<PuntoVenta> puntoventas = null;
|
||||
if(puntoVenta == null || puntoVenta.getPuntoventaId() == -1) {
|
||||
puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresa.getEmpresaId());
|
||||
} else {
|
||||
puntoventas = Arrays.asList(new PuntoVenta[] {puntoVenta});
|
||||
}
|
||||
|
||||
Calendar cDataAtual = Calendar.getInstance();
|
||||
cDataAtual.setTime(dataInicial);
|
||||
while(DateUtil.compareOnlyDate(cDataAtual.getTime(), dataFinal) <= 0) {
|
||||
for (PuntoVenta pv : puntoventas) {
|
||||
realizarCalculoComissao(pv.getPuntoventaId(), empresa.getEmpresaId(), cDataAtual.getTime(), true, usuarioId, true);
|
||||
}
|
||||
realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), cDataAtual.getTime(), true, usuarioId, true);
|
||||
cDataAtual.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
} catch (ComissaoException e) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.ComissaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Comissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.ComissaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao;
|
||||
|
@ -64,4 +65,9 @@ public class ComissaoServiceImpl implements ComissaoService {
|
|||
return comissaoDAO.buscaHistoricoComissao(puntoVentaId, empresaId, periodoInicio, periodoFim);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PuntoVenta> buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId) {
|
||||
return comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue