提交 1a8ae672 作者: luyincheng

辅材申请审批问题

父级 2d9846e8
......@@ -169,25 +169,10 @@ public class TauxiliarymaterialsController {
public BaseResponse<Boolean> checkApply(@RequestBody TauxiliarymaterialsCheckDto tauxiliarymaterialsCheckDto){
SessionInfo sessionInfo = tokenService.getUser();
tauxiliarymaterialsCheckDto.getTauxiliarymaterialsCheckVoList().stream()
.filter(dto->{
Tauxiliarymaterials exist=null;
if(dto.getId()!=null&&dto.getId()>0){
exist=this.tauxiliarymaterialsMapper.selectByPrimaryKey(dto.getId());
}else if(StringUtils.hasLength(dto.getApplyOrder())){
exist=this.tauxiliarymaterialsMapper.selectByApplyOrder(dto.getApplyOrder()); }
if(exist==null){
return false;
}else{
//已审批
if(TauxiliarymaterialStatusEnum.getEnumByName(0,exist.getApplyStatus()).getValue()>1){
return false;
}
}
return true;
})
.map(dto->{
var ta=new Tauxiliarymaterials();
ta.setId(dto.getId());
ta.setApplyOrder(dto.getApplyOrder());
ta.setApprovedQuantity(dto.getApprovedQuantity());
ta.setApplyStatus(tauxiliarymaterialsCheckDto.getApplyStatus());
ta.setCheckSuggestion(tauxiliarymaterialsCheckDto.getCheckSuggestion());
......@@ -195,8 +180,30 @@ public class TauxiliarymaterialsController {
ta.setCheckUserName(sessionInfo.getUserName());
ta.setCheckTime(LocalDateTime.now());
UpdateColumns(ta);
Tauxiliarymaterials exist=null;
if(dto.getId()!=null&&dto.getId()>0){
exist=this.tauxiliarymaterialsMapper.selectByPrimaryKey(dto.getId());
}else if(StringUtils.hasLength(dto.getApplyOrder())){
exist=this.tauxiliarymaterialsMapper.selectByApplyOrder(dto.getApplyOrder());
}
if(exist==null){
throw new ServiceException(400,"找不到辅材申请单");
}else if(TauxiliarymaterialStatusEnum.getEnumByName(0,exist.getApplyStatus()).getValue()!=1){
throw new ServiceException(400,"辅材申请单:"+exist.getApplyOrder()+" 状态必须是已申请");
}else{
ta.setId(exist.getId());
}
return ta;
}).forEach(ta->{
})
.filter(ta->{
if(ta.getId()==null||ta.getId()<=0){
return false;
}else{
return true;
}
})
.forEach(ta->{
this.tauxiliarymaterialsMapper.updateByPrimaryKeySelective(ta);
});
return new BaseResponse(true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论