更新申请部门

master
Harry Yang 2023-01-03 20:34:05 +08:00
parent c1fe70180f
commit 96051bb89c
1 changed files with 12 additions and 4 deletions
src/main/java/cn/palmte/work/controller/backend

View File

@ -482,11 +482,14 @@ public class ProcessController {
entity.setTaxRate(form.getTaxRate());
entity.setContractNo(form.getContractNo());
entity.setContractName(form.getContractName());
entity.setApplyDept(form.getApplyDept());
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
entity.setAttachmentUri(JSON.toJSONString(form.getAttachments()));
entity.setApplyDept(form.getApplyDept());
entity.setApplyDeptId(form.getApplyDeptId());
entity.setApplyDeptLeaderId(form.getApplyDeptLeaderId());
entity.setApplyDeptLeaderName(form.getApplyDeptLeaderName());
entityManager.merge(entity);
if (processType == ProcessType.sale_contract) {
@ -585,7 +588,8 @@ public class ProcessController {
@ResponseBody
@PostMapping("/query")
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable) {
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable,
@RequestParam(defaultValue = "false") boolean forAudit) {
// 从 0 开始
PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(),
new Sort(Sort.Direction.DESC, "lastUpdateAt", "createAt"));
@ -606,6 +610,10 @@ public class ProcessController {
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
}
private boolean isAdministrator(Admin admin) {
return admin != null && "admin".equals(admin.getUserName());
}
// 审核
@Data
static class AuditForm {
@ -646,7 +654,7 @@ public class ProcessController {
if (admin == null) {
throw ErrorMessageException.failed("权限不足");
}
if (Objects.equals("admin", admin.getUserName())) {
if (isAdministrator(admin)) {
processService.revoke(id);
}
else {