Update MapProdukKelompokKerjaService
Penambahan informasi unit kerja KSM di menu mapping produk - kelompok kerja
This commit is contained in:
parent
c17c229e57
commit
456d2a8c82
@ -72,8 +72,10 @@ public interface SubUnitKerjaDao extends PagingAndSortingRepository<SubUnitKerja
|
|||||||
+ "and subunit.unitKerjaId = :idUnitKerja " + "order by subunit.name")
|
+ "and subunit.unitKerjaId = :idUnitKerja " + "order by subunit.name")
|
||||||
List<Map<String, Object>> getSubUnitKerjaCustomByUnitKerja(@Param("idUnitKerja") Integer idUnitKerja);
|
List<Map<String, Object>> getSubUnitKerjaCustomByUnitKerja(@Param("idUnitKerja") Integer idUnitKerja);
|
||||||
|
|
||||||
@Query("select new Map(skj.id as id,skj.name as subunitKerja) " + "from SubUnitKerjaPegawai skj "
|
@Query("select new Map(ukj.id as unitKerjaId,ukj.name as unitKerja,"
|
||||||
+ "where skj.statusEnabled is true " + "and lower(skj.name) like 'kk%' " + "order by skj.id")
|
+ "skj.id as subunitKerjaId,skj.name as subunitKerja) " + "from SubUnitKerjaPegawai skj "
|
||||||
|
+ "inner join skj.unitKerja ukj " + "where skj.statusEnabled is true " + "and lower(skj.name) like 'kk%' "
|
||||||
|
+ "order by skj.id")
|
||||||
List<Map<String, Object>> findAllKelompokKerjaMedis();
|
List<Map<String, Object>> findAllKelompokKerjaMedis();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.orm.jpa.JpaSystemException;
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
@ -184,10 +185,8 @@ public class MapProdukKelompokKerjaServiceImpl extends BaseVoServiceImpl impleme
|
|||||||
List<Map<String, Object>> mapping = mapProdukKelompokKerjaDao.findMappingByProduk(idProduk);
|
List<Map<String, Object>> mapping = mapProdukKelompokKerjaDao.findMappingByProduk(idProduk);
|
||||||
|
|
||||||
for (Map<String, Object> mapRs : kelompokKerja) {
|
for (Map<String, Object> mapRs : kelompokKerja) {
|
||||||
mapRs.put("noRec", null);
|
|
||||||
mapRs.put("statusMapping", false);
|
|
||||||
for (Map<String, Object> map : mapping) {
|
for (Map<String, Object> map : mapping) {
|
||||||
if (mapRs.get("id").equals(map.get("kelompokKerjaId"))
|
if (mapRs.get("subunitKerjaId").equals(map.get("kelompokKerjaId"))
|
||||||
&& CommonUtil.isNotNullOrEmpty(map.get("noRec"))) {
|
&& CommonUtil.isNotNullOrEmpty(map.get("noRec"))) {
|
||||||
mapRs.put("noRec", map.get("noRec").toString());
|
mapRs.put("noRec", map.get("noRec").toString());
|
||||||
mapRs.put("statusMapping", true);
|
mapRs.put("statusMapping", true);
|
||||||
@ -196,7 +195,8 @@ public class MapProdukKelompokKerjaServiceImpl extends BaseVoServiceImpl impleme
|
|||||||
result.add(mapRs);
|
result.add(mapRs);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.sort(Comparator.comparing(m -> (String) m.get("subunitKerja")));
|
result = result.stream().sorted(Comparator.comparing(o1 -> o1.get("subunitKerja").toString()))
|
||||||
|
.sorted(Comparator.comparing(o2 -> o2.get("unitKerja").toString())).collect(Collectors.toList());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user