- pembuatan service pengajuan indikator kinerja
- pembuatan service daftar pengajuan indikator kinerja
This commit is contained in:
parent
c2b171e178
commit
b42ed43db0
@ -1,6 +1,11 @@
|
||||
package com.jasamedika.medifirst2000.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.LogbookKinerja;
|
||||
@ -8,4 +13,15 @@ import com.jasamedika.medifirst2000.entities.LogbookKinerja;
|
||||
@Repository("logbookKinerjaDao")
|
||||
public interface LogbookKinerjaDao extends PagingAndSortingRepository<LogbookKinerja, String> {
|
||||
|
||||
@Query("select new Map(lk.noRec as noRec," + "pg.id as pegawaiId,pg.namaLengkap as namaPegawai,"
|
||||
+ "jb.id as jabatanId,jb.namaJabatan as namaJabatan,"
|
||||
+ "ik.id as indikatorId,ik.namaIndikator as namaIndikator,"
|
||||
+ "lk.target as target,lk.bobot as bobot,lk.bulan as bulan) " + "from LogbookKinerja lk "
|
||||
+ "inner join lk.indikatorKinerja ik " + "inner join lk.pegawai pg " + "inner join lk.jabatan jb "
|
||||
+ "where lk.statusEnabled is true " + "and ik.statusEnabled is true " + "and pg.statusEnabled is true "
|
||||
+ "and lk.statusVerifikasi is false " + "and ik.statusVerifikasi is false " + "and pg.id = :pegawaiId "
|
||||
+ "and jb.id = :jabatanId")
|
||||
List<Map<String, Object>> findPengajuanIndikatorByPegawaiJabatan(@Param("pegawaiId") Integer pegawaiId,
|
||||
@Param("jabatanId") Integer jabatanId);
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,18 @@
|
||||
package com.jasamedika.medifirst2000.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.LogbookKinerja;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.vo.LogbookKinerjaVO;
|
||||
|
||||
public interface LogbookKinerjaService extends BaseVoService<LogbookKinerja, LogbookKinerjaVO, String> {
|
||||
|
||||
LogbookKinerjaVO addPengajuanIndikator(LogbookKinerjaVO vo) throws JpaSystemException, ServiceVOException;
|
||||
|
||||
List<Map<String, Object>> findPengajuanIndikatorByPegawaiJabatan(Integer idPegawai, Integer idJabatan);
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.LogbookKinerjaDetailService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.vo.LogbookKinerjaDetailVO;
|
||||
import com.jasamedika.medifirst2000.vo.LogbookKinerjaVO;
|
||||
|
||||
@Service("LogbookKinerjaDetailService")
|
||||
public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implements LogbookKinerjaDetailService {
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
|
||||
import com.jasamedika.medifirst2000.dao.IndikatorKinerjaDao;
|
||||
import com.jasamedika.medifirst2000.dao.LogbookKinerjaDao;
|
||||
import com.jasamedika.medifirst2000.entities.IndikatorKinerja;
|
||||
import com.jasamedika.medifirst2000.entities.Jabatan;
|
||||
@ -40,6 +41,9 @@ public class LogbookKinerjaServiceImpl extends BaseVoServiceImpl implements Logb
|
||||
@Autowired
|
||||
private LogbookKinerjaDao logbookKinerjaDao;
|
||||
|
||||
@Autowired
|
||||
private IndikatorKinerjaDao indikatorKinerjaDao;
|
||||
|
||||
@Override
|
||||
public LogbookKinerjaVO add(LogbookKinerjaVO vo) throws JpaSystemException, ServiceVOException {
|
||||
Pegawai pegawai = pegawaiConverter.transferVOToModel(vo.getPegawai(), new Pegawai());
|
||||
@ -121,4 +125,33 @@ public class LogbookKinerjaServiceImpl extends BaseVoServiceImpl implements Logb
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogbookKinerjaVO addPengajuanIndikator(LogbookKinerjaVO vo) throws JpaSystemException, ServiceVOException {
|
||||
Pegawai pegawai = pegawaiConverter.transferVOToModel(vo.getPegawai(), new Pegawai());
|
||||
Jabatan jabatan = jabatanConverter.transferVOToModel(vo.getJabatan(), new Jabatan());
|
||||
IndikatorKinerja indikatorKinerja = indikatorKinerjaConverter.transferVOToModel(vo.getIndikatorKinerja(),
|
||||
new IndikatorKinerja());
|
||||
LogbookKinerja logbookKinerja = logbookKinerjaConverter.transferVOToModel(vo, new LogbookKinerja());
|
||||
|
||||
logbookKinerja.setPegawai(pegawai);
|
||||
logbookKinerja.setJabatan(jabatan);
|
||||
logbookKinerja.setIndikatorKinerja(indikatorKinerja);
|
||||
logbookKinerja.setCapaian(0.0);
|
||||
indikatorKinerjaDao.save(indikatorKinerja);
|
||||
LogbookKinerja resultModel = logbookKinerjaDao.save(logbookKinerja);
|
||||
|
||||
LogbookKinerjaVO resultVO = new LogbookKinerjaVO();
|
||||
resultVO = logbookKinerjaConverter.transferModelToVO(resultModel, resultVO);
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findPengajuanIndikatorByPegawaiJabatan(Integer idPegawai, Integer idJabatan) {
|
||||
List<Map<String, Object>> result = logbookKinerjaDao.findPengajuanIndikatorByPegawaiJabatan(idPegawai,
|
||||
idJabatan);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -408,6 +408,52 @@ public class IkiDanRemunerasiController extends LocaleController<IkiDanRemuneras
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-daftar-pengajuan-indikator", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<Map<String, Object>>> getDaftarPengajuanIndikator(HttpServletRequest request,
|
||||
@RequestParam(value = "pegawaiId", required = true) Integer idPegawai,
|
||||
@RequestParam(value = "jabatanId", required = true) Integer idJabatan) throws ParseException {
|
||||
try {
|
||||
List<Map<String, Object>> result = logbookKinerjaService.findPengajuanIndikatorByPegawaiJabatan(idPegawai,
|
||||
idJabatan);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException sve) {
|
||||
LOGGER.error("Got exception {} when get daftar pengajuan indikator", sve.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get daftar pengajuan indikator", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pengajuan-indikator-kinerja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePengajuanIndikatorKinerja(HttpServletRequest request,
|
||||
@Valid @RequestBody LogbookKinerjaVO vo) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
LogbookKinerjaVO resultVo = logbookKinerjaService.addPengajuanIndikator(vo);
|
||||
result.put("data", resultVo);
|
||||
if (CommonUtil.isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
} catch (ServiceVOException sve) {
|
||||
LOGGER.error("Got exception {} when pengajuan indikator kinerja", sve.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when pengajuan indikator kinerja", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-working-record", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveWorkingRecord(HttpServletRequest request,
|
||||
@Valid @RequestBody LogbookKinerjaDetailVO vo) {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>spring.profiles.default</param-name>
|
||||
<param-value>sdm</param-value>
|
||||
<param-value>development</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user