Commit bc186c88 authored by 廖旭伟's avatar 廖旭伟

测试bug修改

parent 28b7a1fb
...@@ -139,9 +139,50 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -139,9 +139,50 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
} }
@Override @Override
protected void saveBefore(ApplyLogEntity entity, Context context) throws AppException { @Transactional(rollbackFor = Exception.class)
entity.setGenerateStatus(GenerateStatus.NOT.getValue()); public ApplyLogEntity save(ApplyLogEntity applyLogEntity, Context context) throws AppException {
entity.setOperType(OperTypeEnum.SAVE.getValue()); validData(applyLogEntity,context);
Long oldId = null;
boolean is_record = false;
CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId());
applyLogEntity.setCatalogCode(catalog.getCatalogCode());
applyLogEntity.setCatalogName(catalog.getCatalogName());
applyLogEntity.setCreateTime(new Date());
applyLogEntity.setRecordStatus(YesNoEnum.NO.getValue());
if(context!=null && context.getUser()!=null) {
applyLogEntity.setCreateUserId(context.getUser().getId());
}
applyLogEntity.setGenerateStatus(GenerateStatus.NOT.getValue());
if(applyLogEntity.getId()!=null && applyLogEntity.getRecordId()!=null){
applyLogEntity.setOperType(OperTypeEnum.UPDATE.getValue());
oldId = applyLogEntity.getId();
is_record = true;
RecordEntity recordEntity = new RecordEntity();
recordEntity.setId(applyLogEntity.getRecordId());
recordEntity.setUpdateUserId(applyLogEntity.getCreateUserId());
recordEntity.setUpdateTime(applyLogEntity.getCreateTime());
recordDao.update(recordEntity);
}else {
applyLogEntity.setOperType(OperTypeEnum.SAVE.getValue());
RecordEntity recordEntity = new RecordEntity();
recordEntity.setCatalogId(catalog.getId());
recordEntity.setCatalogCode(catalog.getCatalogCode());
recordEntity.setCatalogName(catalog.getCatalogName());
recordEntity.setRecordStatus(YesNoEnum.YES.getValue());
recordEntity.setCreateUserId(applyLogEntity.getCreateUserId());
recordEntity.setCreateTime(applyLogEntity.getCreateTime());
recordDao.insert(recordEntity);
applyLogEntity.setRecordId(recordEntity.getId());
}
dao.insert(applyLogEntity);
if(is_record){
ApplyLogEntity updata = new ApplyLogEntity();
updata.setId(oldId);
updata.setRecordStatus(YesNoEnum.YES.getValue());
updata.setUpdateTime(new Date());
dao.update(updata);
}
return applyLogEntity;
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment