From 78c1f87d61d1411356a422ab841afde67342d228 Mon Sep 17 00:00:00 2001
From: wangwh <2397901735@qq.com>
Date: Wed, 04 Sep 2024 20:52:15 +0800
Subject: [PATCH] 1、事项登记、详情查询接口 2、ocr识别文字接口 3、办理流转-查询下属人员、选择经办人、获取工作人员信息、添加办理反馈、获取办理反馈信息、修改办理反馈信息 4、督办-添加督办、回复督办、查询督办列表 5、查询评价
---
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java
index 87c61b5..c0f3ee0 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java
@@ -1,9 +1,13 @@
package cn.huge.module.ctuser.controller.web;
+import cn.huge.base.common.utils.IdUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
+import cn.huge.base.config.CurrentUser;
import cn.huge.module.ctuser.domain.po.CtDept;
+import cn.huge.module.ctuser.domain.po.CtUser;
import cn.huge.module.ctuser.service.CtDeptService;
+import cn.huge.module.ctuser.service.CtUserService;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -14,6 +18,7 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
+import java.util.List;
import java.util.Map;
/**
@@ -34,6 +39,9 @@
@Autowired
private CtDeptService service;
+
+ @Autowired
+ private CtUserService ctUserService;
/**
* 获取请求URL参数
@@ -185,19 +193,47 @@
}
/**
- * 新增或更新对象
- * @url {ctx}/api/web/ctDept/saveCtDept
- * @param ctDept 实体对象
- * @return Object
- */
+ * 新增部门或更新部门
+ * @url {ctx}/api/web/ctDept/saveCtDept
+ * @param ctDept 实体对象
+ * @return Object
+ */
@PostMapping("/saveCtDept")
- public Object saveCtDept(@RequestBody CtDept ctDept) {
+ public Object saveCtDept(@RequestBody CtDept ctDept, @CurrentUser String userId) {
try {
- service.saveCtDept(ctDept);
- return ReturnSucUtils.getRepInfo();
+ //判断name是否存在
+ if (IdUtils.checkNewId(ctDept.getId())) {
+ Map<String, Object> terms = getParameter();
+ terms.put("name", ctDept.getName());
+ terms.put("unitId", ctDept.getUnitId());
+ long ctDeptCount = service.countTerms(terms);
+ if (ctDeptCount > 0) {
+ return ReturnFailUtils.getRepInfo("名称已存在,请重新设定");
+ }
+ }
+ service.saveCtDept(ctDept, userId);
+ return ReturnSucUtils.getRepInfo("保存成功", null);
} catch (Exception e) {
- return ReturnFailUtils.getRepInfo();
+ log.error("Controller接口[CtDeptController.saveCtDept]请求异常:"+e, e);
+ return ReturnFailUtils.getRepInfo("保存失败", null);
}
}
+ /**
+ * 根据主键编号删除部门
+ * @url {ctx}/api/web/ctDept/removeByIds
+ * @param ids 主键编号
+ * @return Object
+ * @throws Exception
+ */
+ @GetMapping("/removeByIds")
+ public Object removeByIds(@RequestParam(value = "ids") String ids) {
+ try {
+ service.removeById(ids);
+ return ReturnSucUtils.getRepInfo();
+ } catch (Exception e) {
+ log.error("Controller接口[CtDeptController.removeByIds]请求异常:"+e, e);
+ return ReturnFailUtils.getRepInfo();
+ }
+ }
}
--
Gitblit v1.8.0