更新申请部门

master
Harry Yang 2023-01-03 20:34:05 +08:00
parent c1fe70180f
commit 96051bb89c
1 changed files with 12 additions and 4 deletions

View File

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