|
@@ -4,6 +4,8 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.example.nngkxxdp.dao.HlwInterfaceDao;
|
|
|
+import com.example.nngkxxdp.entity.Department;
|
|
|
+import com.example.nngkxxdp.util.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -13,14 +15,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.example.nngkxxdp.dao.TjDao;
|
|
|
import com.example.nngkxxdp.dao.UserDao;
|
|
|
import com.example.nngkxxdp.service.TjService;
|
|
|
-import com.example.nngkxxdp.util.Blank;
|
|
|
-import com.example.nngkxxdp.util.DateUtil;
|
|
|
-import com.example.nngkxxdp.util.NewDeptTaskUtil;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@@ -31,6 +31,7 @@ import javax.annotation.Resource;
|
|
|
* @Description
|
|
|
*/
|
|
|
@Service
|
|
|
+@Transactional
|
|
|
public class TjServiceImpl implements TjService {
|
|
|
|
|
|
@Autowired
|
|
@@ -1406,6 +1407,57 @@ public class TjServiceImpl implements TjService {
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过page,limit分页查询部门的信息
|
|
|
+ *
|
|
|
+ * @param page 必须大于0
|
|
|
+ * @param limit 必须大于0
|
|
|
+ * @param deptName 部门名称,可以可不填
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getDeptPage(Integer page, Integer limit, String deptName) {
|
|
|
+ int startRows = (page - 1) * limit;
|
|
|
+ int count = tjDao.getDeptCount(deptName, ConstStr.NOT_DELETED);
|
|
|
+ if (count > 0) {
|
|
|
+ return SendUtil.layuiTable(count, tjDao.getDeptPage(startRows, limit, deptName, ConstStr.NOT_DELETED));
|
|
|
+ }
|
|
|
+ return SendUtil.layuiTable(0, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getChnlidListByDeptid(Integer page, Integer limit, Integer deptid) {
|
|
|
+ int startRows = (page - 1) * limit;
|
|
|
+ int count = tjDao.getChnlidCount(deptid, ConstStr.NOT_DELETED);
|
|
|
+ if (count > 0) {
|
|
|
+ return SendUtil.layuiTable(count, tjDao.getChnlidListByDeptid(startRows, limit, deptid, ConstStr.NOT_DELETED));
|
|
|
+ }
|
|
|
+ return SendUtil.layuiTable(0, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> saveDept(Department department) {
|
|
|
+ if(Blank.isEmpty(department.getDeptname())){
|
|
|
+ return SendUtil.send(true, ConstStr.ADD_FAILED, "部门名称不能为空");
|
|
|
+ }
|
|
|
+ if(Blank.isEmpty(department.getSortid())){
|
|
|
+ return SendUtil.send(true, ConstStr.ADD_FAILED, "部门分类不能为空");
|
|
|
+ }
|
|
|
+ Department oldDepartment = tjDao.getDepartmentByName(department.getDeptname());
|
|
|
+ if (Blank.isEmpty(oldDepartment)) {
|
|
|
+ if (tjDao.saveDept(department) <= 0) {
|
|
|
+ return SendUtil.send(true, ConstStr.ADD_FAILED, "");
|
|
|
+ }
|
|
|
+ return SendUtil.send(true, ConstStr.ADD_SUCCESS, "");
|
|
|
+ }
|
|
|
+ return SendUtil.send(true, ConstStr.ADD_FAILED, "存在相同的部门名称");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getDeptById(Integer deptid) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private int getArrayIndex(List<String> arr, String obj) {
|
|
|
for (int j = 0; j < arr.size(); j++) {
|
|
|
if (obj.equals(arr.get(j))) {
|