Commit 2e3766de by 翁国栋

草稿箱审批人详情

parent 70177008
......@@ -758,6 +758,19 @@ public class SpmkController {
}
/**
* 审批详情
*/
@GetMapping(value = "/select_drafts_detail/{id}")
@ApiOperation(value = "草稿箱审批详情", httpMethod = "GET", notes = "审批详情")
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectdd(@CurrentUser UserBean userBean,@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectDraftsDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
}
//TODO 审批人审批
/**
* 审批人审批
......@@ -1190,116 +1203,4 @@ public class SpmkController {
return ResultUtil.data(JSON.toJSONString(detailSummary));
}
@PostMapping(value = "/save_drafts")
@ApiOperation(value = "存入草稿箱", httpMethod = "POST", notes = "存入草稿箱")
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-存入草稿箱", businessType = BusinessType.INSERT)
public Result<Object> saveDrafts(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
try {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
);
if (ygglMainEmp == null)
return ResultUtil.error("发起人不存在!");
// List<SpmkApprovalG> saG = spmkService.selectListAg(userBean);
Router router = spmkApproveSummaryDto.getRouter();
// routers = RouterUtils.clearRouters(routers);
/*TODO 验证是否拥有添加审核人的权限 只用于华颐*/
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId,userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId,"/Approvalspbutonspbuton020101"));
/*如果没有该权限*/
if(zzglAuth==null){
SpmkCustomApproval ca = SpmkCustomApproval.builder().build().selectOne(new QueryWrapper<SpmkCustomApproval>().lambda()
.eq(SpmkCustomApproval::getName,spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode,userBean.getOrgCode()));
Router oldRouter=ObjectUtil.deserialize(ca.getRouter());
if(isTrue(router.getChildren(),oldRouter.getChildren())){
return ResultUtil.error("您没有新增审批人的权限");
}
}
}
}
List<Router> listRouter = new ArrayList<Router>();
listRouter.add(router);
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData()
.set("orgCode", userBean.getOrgCode())
.set("initiator", ygglMainEmp.getName())
.set("headUrl", ygglMainEmp.getHeadUrl())
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
String currentApprover = jSONObject.getStr("current_approver");
SpmkApproveDrafts as = SpmkApproveDrafts
.builder()
.orgCode(userBean.getOrgCode())
.empNum(userBean.getEmpNum())
.title(spmkApproveSummaryDto.getTitle())
.initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName())
.assoType(spmkApproveSummaryDto.getAssoType())
.sts(ApproveSummarySts.IN.ordinal())
.currentApprover(currentApprover).isUrgent(spmkApproveSummaryDto.getIsUrgent())
.build();
if(spmkApproveSummaryDto.getId()!=null){
as.setId(spmkApproveSummaryDto.getId());
as.setUpdateTime(new Date());
}
if (!as.insertOrUpdate()) {
throw new CustomException("审批草稿汇总-新增异常");
}
// 草稿不插入执审批流程
// RouterUtils.insertogExecuteRecord(listFlowChildren, as.getId());
// 封装 审批详情
SpmkApproveDetailDrafts adm = SpmkApproveDetailDrafts.builder().build();
adm.setApproveSummaryId(as.getId());
adm.setName(spmkApproveSummaryDto.getTitle());
adm.setRequestData(spmkApproveSummaryDto.getRequestData().toString());
adm.setFroms(spmkApproveSummaryDto.getFroms().toString());
adm.setRouter(listRouter.get(0).toJSONString());
adm.setFlowChildren(JSONArray.fromObject(listFlowChildren).toString());
if(spmkApproveSummaryDto.getId()!=null){
SpmkApproveDetailDrafts sp = SpmkApproveDetailDrafts.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId,spmkApproveSummaryDto.getId()));
adm.setId(sp.getId());
spmkApproveDetailDraftsMapper.updateById(adm);
}else {
spmkApproveDetailDraftsMapper.insert(adm);
}
return ResultUtil.data(as.getId());
}catch (Exception e){
// throw new CustomException("审批草稿详情-新增异常");
e.printStackTrace();
}
return ResultUtil.error("审批草稿详情-新增异常");
};
@PostMapping(value = "/my_drafts")
@ApiOperation(value = "我的草稿箱", httpMethod = "POST", notes = "我的草稿箱")
@Log(title = "审批-我的草稿箱", businessType = BusinessType.OTHER)
public Result<Object> myDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto){
IPage<SpmkApproveDrafts> page = new Page<SpmkApproveDrafts>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if(mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0);
}
IPage<SpmkApproveDrafts> pageAs = spmkApproveDraftsMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveDrafts> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs,listAs);
}
}
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