Commit 1b0183b5 authored by 廖旭伟's avatar 廖旭伟

测试bug修改

parent 4aa851e7
...@@ -44,6 +44,7 @@ import com.mortals.framework.model.Context; ...@@ -44,6 +44,7 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.record.dao.ApplyLogDao; import com.mortals.xhx.module.record.dao.ApplyLogDao;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
import com.mortals.xhx.module.record.service.ApplyLogService; import com.mortals.xhx.module.record.service.ApplyLogService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -95,6 +96,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -95,6 +96,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
orConditionList.add(condition2); orConditionList.add(condition2);
query.setOrConditionList(orConditionList); query.setOrConditionList(orConditionList);
} }
query.setRecordStatus(YesNoEnum.NO.getValue());
return query; return query;
} }
...@@ -151,20 +153,21 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -151,20 +153,21 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void generateOriginal(ApplyLogEntity applyLogEntity, Context context) throws AppException { public void generateOriginal(ApplyLogEntity applyLogEntity, Context context) throws AppException {
validData(applyLogEntity,context); validData(applyLogEntity,context);
Long oldId = null; Long oldId = null;
boolean delete = false; boolean is_record = false;
CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId()); CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId());
applyLogEntity.setCatalogCode(catalog.getCatalogCode()); applyLogEntity.setCatalogCode(catalog.getCatalogCode());
applyLogEntity.setCatalogName(catalog.getCatalogName()); applyLogEntity.setCatalogName(catalog.getCatalogName());
applyLogEntity.setFormTemplate(catalog.getFormContent());
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getTemplateUrl(),applyLogEntity.getFormContent()); DocTemplateVO docTemplate = new DocTemplateVO(catalog.getTemplateUrl(),applyLogEntity.getFormContent());
String paths = preview(docTemplate, context); String paths = preview(docTemplate, context);
String[] vals = paths.split(";"); String[] vals = paths.split(";");
applyLogEntity.setCertificateUrl(vals[0]); applyLogEntity.setCertificateUrl(vals[0]);
applyLogEntity.setPreviewUrl(vals[1]); applyLogEntity.setPreviewUrl(vals[1]);
applyLogEntity.setCreateTime(new Date()); applyLogEntity.setCreateTime(new Date());
applyLogEntity.setRecordStatus(YesNoEnum.NO.getValue());
if(context!=null && context.getUser()!=null) { if(context!=null && context.getUser()!=null) {
applyLogEntity.setCreateUserId(context.getUser().getId()); applyLogEntity.setCreateUserId(context.getUser().getId());
} }
...@@ -172,7 +175,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -172,7 +175,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if(applyLogEntity.getId()!=null && applyLogEntity.getRecordId()!=null){ if(applyLogEntity.getId()!=null && applyLogEntity.getRecordId()!=null){
applyLogEntity.setOperType(OperTypeEnum.UPDATE.getValue()); applyLogEntity.setOperType(OperTypeEnum.UPDATE.getValue());
oldId = applyLogEntity.getId(); oldId = applyLogEntity.getId();
delete = true; is_record = true;
RecordEntity recordEntity = new RecordEntity(); RecordEntity recordEntity = new RecordEntity();
recordEntity.setId(applyLogEntity.getRecordId()); recordEntity.setId(applyLogEntity.getRecordId());
recordEntity.setUpdateUserId(applyLogEntity.getCreateUserId()); recordEntity.setUpdateUserId(applyLogEntity.getCreateUserId());
...@@ -191,8 +194,12 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -191,8 +194,12 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity.setRecordId(recordEntity.getId()); applyLogEntity.setRecordId(recordEntity.getId());
} }
dao.insert(applyLogEntity); dao.insert(applyLogEntity);
if(delete){ if(is_record){
dao.delete(oldId); ApplyLogEntity updata = new ApplyLogEntity();
updata.setId(oldId);
updata.setRecordStatus(YesNoEnum.YES.getValue());
updata.setUpdateTime(new Date());
dao.update(updata);
} }
printWaitQueueService.creatWaitQueueByApply(applyLogEntity, GenerateStatus.ORIGINAL.getValue(),context); printWaitQueueService.creatWaitQueueByApply(applyLogEntity, GenerateStatus.ORIGINAL.getValue(),context);
} }
......
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