办公用品草稿内容
This commit is contained in:
parent
2ba324669d
commit
f8e05a22f4
@ -94,4 +94,18 @@ public class BgypController {
|
||||
BeanUtils.toBean(list, BgypRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/saveDraft")
|
||||
@Operation(summary = "创建请假为草稿")
|
||||
@PreAuthorize("@ss.hasPermission('home:bgyp:create')")
|
||||
public CommonResult<Long> saveDraft(@Valid @RequestBody BgypSaveReqVO createReqVO) {
|
||||
return success(bgypService.saveDraft(getLoginUserId(),createReqVO));
|
||||
}
|
||||
@GetMapping("/draft")
|
||||
@Operation(summary = "获得请假草稿分页")
|
||||
@PreAuthorize("@ss.hasPermission('home:bgyp:query')")
|
||||
public CommonResult<PageResult<BgypRespVO>> getDraft(@Valid BgypPageReqVO pageReqVO) {
|
||||
PageResult<BgypDO> pageResult = bgypService.getDraft(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BgypRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,25 @@ public interface BgypMapper extends BaseMapperX<BgypDO> {
|
||||
.eqIfPresent(BgypDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(BgypDO::getUserId, reqVO.getUserId())
|
||||
.betweenIfPresent(BgypDO::getCreateTime, reqVO.getCreateTime())
|
||||
.ne(BgypDO::getStatus, 100) // 排除 status = 100
|
||||
.orderByDesc(BgypDO::getId));
|
||||
}
|
||||
default PageResult<BgypDO> selectPageDraft(BgypPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BgypDO>()
|
||||
.eqIfPresent(BgypDO::getTitle, reqVO.getTitle())
|
||||
.likeIfPresent(BgypDO::getUserName, reqVO.getUserName())
|
||||
.likeIfPresent(BgypDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(BgypDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(BgypDO::getUsageName, reqVO.getUsageName())
|
||||
.eqIfPresent(BgypDO::getUsageId, reqVO.getUsageId())
|
||||
.eqIfPresent(BgypDO::getUsageQuantity, reqVO.getUsageQuantity())
|
||||
.eqIfPresent(BgypDO::getUnit, reqVO.getUnit())
|
||||
.eqIfPresent(BgypDO::getUsagePurpose, reqVO.getUsagePurpose())
|
||||
.betweenIfPresent(BgypDO::getUsageDate, reqVO.getUsageDate())
|
||||
.eqIfPresent(BgypDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(BgypDO::getUserId, reqVO.getUserId())
|
||||
.betweenIfPresent(BgypDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eq(BgypDO::getStatus, 100) // 强制过滤 status = 100
|
||||
.orderByDesc(BgypDO::getId));
|
||||
}
|
||||
|
||||
|
@ -61,5 +61,13 @@ public interface BgypService {
|
||||
* @param status 结果
|
||||
*/
|
||||
void updateBgypStatus(Long id, Integer status);
|
||||
/**
|
||||
* 草稿
|
||||
* @param userId
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
Long saveDraft(Long userId, BgypSaveReqVO createReqVO);
|
||||
PageResult<BgypDO> getDraft(BgypPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,12 @@ public class BgypServiceImpl implements BgypService {
|
||||
// 插入
|
||||
BgypDO bgyp = BeanUtils.toBean(createReqVO, BgypDO.class)
|
||||
.setUserId(userId).setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
if (createReqVO.getCurfullpath().contains("?") ) {
|
||||
bgypMapper.updateById(bgyp);
|
||||
createReqVO.setCurfullpath( createReqVO.getCurfullpath().replaceAll("\\?id=\\d+", ""));
|
||||
} else {
|
||||
bgypMapper.insert(bgyp);
|
||||
}
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
@ -126,5 +131,15 @@ public class BgypServiceImpl implements BgypService {
|
||||
throw exception(KNOWLEDGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Long saveDraft(Long userId, BgypSaveReqVO createReqVO) {
|
||||
BgypDO bgyp = BeanUtils.toBean(createReqVO, BgypDO.class).setUserId(userId).setStatus(100);
|
||||
bgypMapper.insert(bgyp);
|
||||
return bgyp.getId();
|
||||
}
|
||||
@Override
|
||||
public PageResult<BgypDO> getDraft(BgypPageReqVO pageReqVO) {
|
||||
return bgypMapper.selectPageDraft(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user