维护养护计划-逻辑修改
parent
190b2faeef
commit
67f5573d16
|
|
@ -62,7 +62,15 @@ public class MentencePlanController extends AbstractCommonFileController {
|
||||||
|
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public R<MentencePlan> update(@Validated(Update.class) @RequestBody MentencePlan dto) {
|
public R<MentencePlan> update(@Validated(Update.class) @RequestBody MentencePlan dto,HttpServletRequest request) {
|
||||||
|
SessionUser sessionUser = checkLogin(request);
|
||||||
|
if(sessionUser == null){
|
||||||
|
throw new IllegalArgumentException("未登录");
|
||||||
|
}
|
||||||
|
Long userId = sessionUser.getUserId();
|
||||||
|
if(!userId.equals(dto.getCreateId())){
|
||||||
|
throw new IllegalArgumentException("对不起,您没有编辑的权限");
|
||||||
|
}
|
||||||
boolean flag = mentencePlanService.update(dto);
|
boolean flag = mentencePlanService.update(dto);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
||||||
|
|
@ -72,13 +80,22 @@ public class MentencePlanController extends AbstractCommonFileController {
|
||||||
|
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@GetMapping("/del/{id}")
|
@GetMapping("/del/{id}")
|
||||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id,HttpServletRequest request) {
|
||||||
|
|
||||||
LambdaQueryWrapper<MentencePlan> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MentencePlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(MentencePlan::getId, id);
|
queryWrapper.eq(MentencePlan::getId, id);
|
||||||
MentencePlan one = mentencePlanService.getOne(queryWrapper);
|
MentencePlan one = mentencePlanService.getOne(queryWrapper);
|
||||||
if(Objects.isNull(one)){
|
if(Objects.isNull(one)){
|
||||||
throw new RuntimeException("该计划不存在");
|
throw new RuntimeException("该计划不存在");
|
||||||
}
|
}
|
||||||
|
SessionUser sessionUser = checkLogin(request);
|
||||||
|
if(sessionUser == null){
|
||||||
|
throw new IllegalArgumentException("未登录");
|
||||||
|
}
|
||||||
|
Long userId = sessionUser.getUserId();
|
||||||
|
if(!userId.equals(one.getCreateId())){
|
||||||
|
throw new IllegalArgumentException("对不起,您没有编辑的权限");
|
||||||
|
}
|
||||||
LambdaQueryWrapper<MentencePlanDetail> queryWrapperDetail = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MentencePlanDetail> queryWrapperDetail = new LambdaQueryWrapper<>();
|
||||||
queryWrapperDetail.eq(MentencePlanDetail::getMentencePlanId, id);
|
queryWrapperDetail.eq(MentencePlanDetail::getMentencePlanId, id);
|
||||||
//先删细节
|
//先删细节
|
||||||
|
|
@ -92,7 +109,15 @@ public class MentencePlanController extends AbstractCommonFileController {
|
||||||
|
|
||||||
@Operation(summary = "审批")
|
@Operation(summary = "审批")
|
||||||
@PostMapping("/approving")
|
@PostMapping("/approving")
|
||||||
public R<Boolean> approve(@Validated @RequestBody MentencePlan dto){
|
public R<Boolean> approve(@Validated @RequestBody MentencePlan dto,HttpServletRequest request){
|
||||||
|
SessionUser sessionUser = checkLogin(request);
|
||||||
|
if(sessionUser == null){
|
||||||
|
throw new IllegalArgumentException("未登录");
|
||||||
|
}
|
||||||
|
Long userId = sessionUser.getUserId();
|
||||||
|
if(!userId.toString().equals(dto.getApprovePersonId())){
|
||||||
|
throw new IllegalArgumentException("对不起,您没有审批的权限");
|
||||||
|
}
|
||||||
LambdaQueryWrapper<MentencePlan> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MentencePlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(MentencePlan::getId, dto.getId());
|
queryWrapper.eq(MentencePlan::getId, dto.getId());
|
||||||
MentencePlan one = mentencePlanService.getOne(queryWrapper);
|
MentencePlan one = mentencePlanService.getOne(queryWrapper);
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ public class MentencePlanService extends ServiceImpl<MentencePlanMapper, Menten
|
||||||
if(Objects.nonNull(pageSo.getStatus())){
|
if(Objects.nonNull(pageSo.getStatus())){
|
||||||
queryWrapper.eq(MentencePlan::getPlanStatus,pageSo.getStatus());
|
queryWrapper.eq(MentencePlan::getPlanStatus,pageSo.getStatus());
|
||||||
}
|
}
|
||||||
|
queryWrapper.orderByAsc(MentencePlan::getCreateDate);
|
||||||
Page<MentencePlan> mentencePlanPage = baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
Page<MentencePlan> mentencePlanPage = baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||||
List<MentencePlan> records = mentencePlanPage.getRecords();
|
List<MentencePlan> records = mentencePlanPage.getRecords();
|
||||||
for (MentencePlan record : records) {
|
for (MentencePlan record : records) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue