Commit a46e17c8 authored by 侯彦文's avatar 侯彦文

借阅单创建

parent 622961f8
......@@ -44,7 +44,7 @@ public class ExtBorrowingFormController<V extends ExtBorrowingFormVO, S extends
return ApiResult.ok(extBorrowingFormService.borrowCount(searchVo));
}
@ApiOperation("借阅统计")
@ApiOperation("创建借阅单")
@PostMapping({"borrow"})
public ApiResult borrow(@RequestBody ExtBorrowingFormVO extBorrowingFormVO,@RequestParam("docId") Long docId) {
extBorrowingFormService.borrow(extBorrowingFormVO,docId);
......
......@@ -2,6 +2,7 @@ package com.inet.dcs.document.core.event;
import com.inet.dcs.document.common.vo.ExtBorrowingDocLinkVO;
import com.inet.dcs.document.common.vo.ExtBorrowingFormVO;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.constants.SignConstants;
import com.inet.dcs.document.core.service.ExtBorrowingDocLinkService;
......@@ -14,6 +15,10 @@ import com.inet.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.dao.events.BusinessEventType;
import com.yonde.dex.dao.events.DxEvent;
import com.yonde.dex.dao.events.DxEventListener;
import com.yonde.dex.dao.events.DxEventWrap;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
......@@ -33,6 +38,7 @@ import java.util.List;
*/
@Slf4j
@Component
@DxEvent
public class ExtBorrowingFormEvent {
@Autowired
......@@ -47,33 +53,35 @@ public class ExtBorrowingFormEvent {
@Autowired
private ExtDxDocumentService extDxDocumentService;
@Autowired
private ExtTransferDocLinkService extTransferDocLinkService;
public void postUpdate(ExtBorrowingFormVO extBorrowingFormVO) {
if (Constants.RETURNED.equals(extBorrowingFormVO.getState())) {
// 获取档案组流程审批人信息
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extBorrowingFormVO);
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
DxUserInfoVO dxHandlerUserInfo = extBorrowingFormService.getSignInfo(activities, SignConstants.SIGN_KEY_DAZGHQR);
if (ObjectUtils.isNotEmpty(dxHandlerUserInfo)) {
extBorrowingFormVO.setDxHandlerUserInfo(dxHandlerUserInfo);
extBorrowingFormVO.setDxHandlerUserInfoId(dxHandlerUserInfo.getUserId());
extBorrowingFormVO.setDxHandlerUserInfoIdType("DxUser");
}
// 实际归还时间
LocalDateTime actualReturnTime = extBorrowingFormService.getEndDate(activities, SignConstants.SIGN_KEY_DAZGHQR);
extBorrowingFormVO.setActualReturnTime(actualReturnTime);
extBorrowingFormVO.setOperator(OperatorType.MODIFY);
extBorrowingFormService.saveRecursion(extBorrowingFormVO);
@DxEventListener(value = ExtBorrowingFormVO.class, eventType = BusinessEventType.POST_LIFECYCLE_CHANGE_STATUS, order = 1)
public void postUpdate(List<DxEventWrap<ExtBorrowingFormVO>> eventWrapList ) {
for (DxEventWrap<ExtBorrowingFormVO> e : eventWrapList) {
ExtBorrowingFormVO extBorrowingFormVO = e.getTarget();
if (Constants.RETURNED.equals(extBorrowingFormVO.getState())) {
// 获取档案组流程审批人信息
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extBorrowingFormVO);
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
DxUserInfoVO dxHandlerUserInfo = extBorrowingFormService.getSignInfo(activities, SignConstants.SIGN_KEY_DAZGHQR);
if (ObjectUtils.isNotEmpty(dxHandlerUserInfo)) {
extBorrowingFormVO.setDxHandlerUserInfo(dxHandlerUserInfo);
extBorrowingFormVO.setDxHandlerUserInfoId(dxHandlerUserInfo.getUserId());
extBorrowingFormVO.setDxHandlerUserInfoIdType("DxUser");
}
// 实际归还时间
LocalDateTime actualReturnTime = extBorrowingFormService.getEndDate(activities, SignConstants.SIGN_KEY_DAZGHQR);
extBorrowingFormVO.setActualReturnTime(actualReturnTime);
extBorrowingFormVO.setOperator(OperatorType.MODIFY);
extBorrowingFormService.saveRecursion(extBorrowingFormVO);
// 更新文档状态为可借阅
Long id = extBorrowingFormVO.getId();
SearchQueryCondition queryCondition = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, id);
List<ExtBorrowingDocLinkVO> extBorrowingDocLinkVOList = extBorrowingDocLinkService.findRecursion(queryCondition).getContent();
Long sourceId = extBorrowingDocLinkVOList.get(0).getSourceId();
extDxDocumentService.updateBorrowingStatus(sourceId, ExtBorrowingFormServiceImpl.CAN_BE_BORROWED);
// 更新文档状态为可借阅
Long id = extBorrowingFormVO.getId();
SearchQueryCondition queryCondition = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, id);
List<ExtBorrowingDocLinkVO> extBorrowingDocLinkVOList = extBorrowingDocLinkService.findRecursion(queryCondition).getContent();
Long sourceId = extBorrowingDocLinkVOList.get(0).getSourceId();
extDxDocumentService.updateBorrowingStatus(sourceId, ExtBorrowingFormServiceImpl.CAN_BE_BORROWED);
}
}
}
}
......@@ -63,8 +63,6 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
@Resource
private EntityManager entityManager;
@Autowired
private ExtBorrowingFormEvent extBorrowingFormEvent;
@Autowired
private DxUserInfoFeign userService;
......@@ -72,12 +70,6 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
@Autowired
private ExtDxDocumentService extDxDocumentService;
@Override
public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
extBorrowingFormEvent.postUpdate(v);
}
}
@Override
public ExtBorrowingFormVO startWorkflow(Long id) {
ExtBorrowingFormVO extBorrowingFormVO = this.get(id);
......
......@@ -271,23 +271,19 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
public String categoryNumber(String categoryNumber,int zhNumber,int jjNumber,int sbNumber,int jsNumber,int countNumber){
if (categoryNumber.contains("ZH")){
categoryNumber = "综合";
zhNumber++;
countNumber= zhNumber;
countNumber= zhNumber + 1;
}
if (categoryNumber.contains("JJ")){
categoryNumber = "基建";
jjNumber++;
countNumber= jjNumber;
countNumber= jjNumber+1;
}
if (categoryNumber.contains("SB")){
categoryNumber = "设备";
sbNumber++;
countNumber= sbNumber;
countNumber= sbNumber+1;
}
if (categoryNumber.contains("JS")){
categoryNumber = "技术";
jsNumber++;
countNumber = jsNumber;
countNumber = jsNumber+1;
}
return categoryNumber;
}
......
......@@ -172,7 +172,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
// 更新文档借阅状态
dxDocumentVO.setBorrowingStatus(borrowingInProgress);
dxDocumentVO.setOperator(OperatorType.MODIFY);
this.save((V) dxDocumentVO);
this.saveRecursion((V) dxDocumentVO);
}
private String getProcessDefKey(String subTypeName) {
......
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