0022564: Comporte - GLPI 37636 - Problema de criar horários em feriados cadastrados
bug#22564 dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@107217 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b95bbb5f67
commit
46864a96b8
|
@ -13,6 +13,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
|||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.Feriado;
|
||||
import com.rjconsultores.ventaboletos.service.FeriadoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.FeriadoCache;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("feriadoService")
|
||||
|
@ -21,6 +22,9 @@ public class FeriadoServiceImpl implements FeriadoService {
|
|||
@Autowired
|
||||
private FeriadoDAO feriadoDAO;
|
||||
|
||||
@Autowired
|
||||
private FeriadoCache feriadoCache;
|
||||
|
||||
public List<Feriado> obtenerTodos() {
|
||||
return feriadoDAO.obtenerTodos();
|
||||
}
|
||||
|
@ -35,6 +39,8 @@ public class FeriadoServiceImpl implements FeriadoService {
|
|||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId());
|
||||
|
||||
return feriadoDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
|
@ -44,6 +50,8 @@ public class FeriadoServiceImpl implements FeriadoService {
|
|||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId());
|
||||
|
||||
return feriadoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
@ -53,6 +61,8 @@ public class FeriadoServiceImpl implements FeriadoService {
|
|||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId());
|
||||
|
||||
feriadoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,21 @@ public class FeriadoCache {
|
|||
mapFeriado.clear();
|
||||
}
|
||||
|
||||
public void limparData(Date dataFeriado, Integer empresaId, Integer estadoId) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
String strDataFeriado = sdf.format(dataFeriado);
|
||||
|
||||
log.info(String.format("Removendo feriado, data: "+ strDataFeriado +", empresaId: "+ empresaId+", estadoId: " + estadoId));
|
||||
|
||||
KeyFeriadoMap key = new KeyFeriadoMap(strDataFeriado, empresaId, estadoId);
|
||||
|
||||
mapFeriado.remove(key);
|
||||
} catch (Exception e) {
|
||||
log.error("Erro ao remover Deriado de cache: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
class KeyFeriadoMap {
|
||||
private String dataFeriado;
|
||||
private Integer empresaId;
|
||||
|
|
Loading…
Reference in New Issue