Browse Source

完成变更传入错误编号BUG修改

anderx 3 years ago
parent
commit
238efd3ef4

+ 4 - 4
src/main/java/com/goafanti/admin/service/DepartmentService.java

@@ -25,7 +25,7 @@ public interface DepartmentService {
 	 * 查询分管部门、查询管理部门
 	 * @return
 	 */
-	List<Department> selectMyDeps();
+	List<String> selectMyDeps();
 
 
 
@@ -37,9 +37,9 @@ public interface DepartmentService {
 	 * @param type	 0=包含本部门,1不包含本部门
 	 * @param myShiro 0=正常,1=只看我相关部门
 	 */
-	List<Department> selectSubDeps(String subId,Integer type,Integer myShiro);
-	List<Department> selectSubDeps(String subId,Integer type);
-	List<Department> selectSubDeps(String subId);
+	List<String> selectSubDeps(List<String>  deps,Integer type,Integer myShiro);
+	List<String> selectSubDeps(List<String>  deps,Integer type);
+	List<String> selectSubDeps(List<String>  deps);
 
 	List<Department> getLowerDep(String depIds);
 

+ 23 - 51
src/main/java/com/goafanti/admin/service/impl/DepartmentServiceImpl.java

@@ -66,46 +66,31 @@ public class DepartmentServiceImpl extends BaseMybatisDao<WorkingHoursMapper> im
 	}
 
 	@Override
-	public List<Department> selectMyDeps() {
-		if(TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
-			return departmentMapper.selectAllDeps();
-		else
-			return selectCurrentDep(TokenManager.getAdminId());
+	public List<String> selectMyDeps() {
+		return selectCurrentDep(TokenManager.getAdminId());
 	}
-	public List<Department> selectSubDeps(String subId) {
-		return selectSubDeps(subId,0);
+	public List<String> selectSubDeps(List<String> deps) {
+		return selectSubDeps(deps,0);
 	}
 
 	@Override
-	public List<Department> selectSubDeps(String subId,Integer type) {
-		return selectSubDeps(subId,type,0);
+	public List<String> selectSubDeps(List<String> deps,Integer type) {
+		return selectSubDeps(deps,type,0);
 	}
 
 	@Override
-	public List<Department> selectSubDeps(String subId,Integer type,Integer myShiro) {
-		List<Department>  list =departmentMapper.selectSubDeps(subId);
-		List<Department>  all=new ArrayList<>();
-		if (type==0)all.add(departmentMapper.selectByPrimaryKey(subId));
-		if (!list.isEmpty()){
-			all.addAll(list);
-			for (Department dep : list) {
-				List<Department> l2=selectSubDeps(dep.getId(),1);
-				if(!l2.isEmpty()){
-					all.addAll(l2);
-				}
-			}
-		}
+	public List<String> selectSubDeps(List<String>  deps,Integer type,Integer myShiro) {
+			List<String> myAll=new ArrayList<>();
 		if (myShiro==1){
-			List<Department>myAll=new ArrayList<>();
-			List<Department> my=selectMyDeps();
-			for (Department dep : all) {
-				for (Department department : my) {
-					if (dep.getId().equals(department.getId()))myAll.add(dep);
+			List<String> my=selectMyDeps();
+			for (String dep : deps) {
+				for (String dep2 : my) {
+					if (dep.equals(dep2))myAll.add(dep);
 				}
 			}
-			all=myAll;
+
 		}
-		return all;
+		return myAll;
 	}
 
 	@Override
@@ -119,33 +104,20 @@ public class DepartmentServiceImpl extends BaseMybatisDao<WorkingHoursMapper> im
 	}
 
 
-	private List<Department> selectCurrentDep(String managerId){
-		List<Department> allData = new ArrayList<Department>();
+	private List<String> selectCurrentDep(String managerId){
+		List<String> alldep = new ArrayList<>();
 		List<Department> superData = departmentMapper.selectCurrentDeps(managerId);
-		if(superData != null && superData.size()>0){
-			allData.addAll(superData);
-		}
-		selectSubDeps(allData,superData);
-		return allData;
+		if (!superData.isEmpty())iterationDep(alldep,superData);
+		return alldep;
 	}
 
-	private List<Department> selectSubDeps(List<Department> allData,List<Department> superData){
-		List<Department> subData = new ArrayList<>();
-		String superIds = "";
-		for(Department om : superData){
-			if(!om.getId().equals(om.getSuperId())){
-				superIds += om.getId() + ",";
-			}
-		}
-		if(StringUtils.isNotBlank(superIds)) subData = departmentMapper.selectSubDeps(superIds.substring(0, superIds.length()-1));
-		if(subData != null && subData.size()>0) {
-			allData.addAll(subData);
-			selectSubDeps(allData,subData);
+	private void iterationDep(List<String> alldep, List<Department> superData) {
+		for (Department dep : superData) {
+			alldep.add(dep.getId());
+			List<Department> deps2 = departmentMapper.selectSubDeps(dep.getId());
+			if (!deps2.isEmpty())iterationDep(alldep,deps2);
 		}
-		return allData;
 	}
 
 
-
-
 }

+ 10 - 1
src/main/java/com/goafanti/common/dao/DepartmentMapper.java

@@ -4,6 +4,7 @@ import com.goafanti.admin.bo.AdminCustomerBo;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.bo.depCountBo;
 import com.goafanti.common.model.Department;
+import com.goafanti.organization.bo.DepOut;
 import com.goafanti.organization.bo.OrganizationListOut;
 import org.apache.ibatis.annotations.Param;
 
@@ -22,7 +23,15 @@ public interface DepartmentMapper {
 
     int updateByPrimaryKey(Department record);
 
-    List<OrganizationListOut> selectSuperId(@Param("hideSign")Integer hideSign);
+
+    /**
+     *
+     * @param hideSign 0不显示 1显示
+     * @param lvl 层级
+     * @param id 上级编号
+     * @return
+     */
+    List<DepOut> selectSuperId(@Param("hideSign")Integer hideSign, @Param("lvl")Integer lvl, @Param("id")String id);
     /**
      * 根据组织名称查组织编号
      */

+ 16 - 11
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -300,15 +300,20 @@
       AND om.dep_no=#{depNo,jdbcType=VARCHAR}
     </if>
   </select>
-  <select id="selectSuperId"  resultType="com.goafanti.organization.bo.OrganizationListOut">
+  <select id="selectSuperId"  resultType="com.goafanti.organization.bo.DepOut">
     select
-    id,name,dep_no as depNo
+    id,name,dep_no as depNo,lvl
     from department
     where status ='0'
-    and lvl=3
+    <if test="lvl != null ">
+        and lvl= #{lvl}
+    </if>
       <if test="hideSign != null ">
     and hide_sign= #{hideSign}
       </if>
+    <if test="id != null ">
+      and super_id= #{id}
+    </if>
     order by depNo
   </select>
   <insert id="insert1" parameterType="com.goafanti.organization.bo.OrganizationListOut">
@@ -438,14 +443,14 @@
       department_id=#{id,jdbcType=VARCHAR}
   </select>
   <!-- 查询当前层级 -->
-  <select id="selectCurrentDeps" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select id,name,dep_no,super_id from department where manager_id = #{aid,jdbcType=VARCHAR}
-    union all
-    select id,name,dep_no,super_id from department where id = (select department_id from admin where id = #{aid,jdbcType=VARCHAR})
+  <select id="selectCurrentDeps" parameterType="java.lang.String" resultType="string">
+    select id from department where manager_id = #{aid,jdbcType=VARCHAR}
+    union
+    select id from department where id = (select department_id from admin where id = #{aid,jdbcType=VARCHAR})
   </select>
   <!-- 查询下一层级  -->
-  <select id="selectSubDeps"  parameterType="java.lang.String" resultMap="BaseResultMap">
-    select id,name,dep_no from department where super_id in (#{superIds,jdbcType=VARCHAR})
+  <select id="selectSubDeps"  parameterType="java.lang.String" resultType="string">
+    select id from department where super_id in (#{superIds,jdbcType=VARCHAR})
   </select>
 
   <select id="selectBysuperId"  resultType="com.goafanti.admin.bo.depCountBo">
@@ -459,8 +464,8 @@
   </select>
 
   <!-- 查询所有 -->
-  <select id="selectAllDeps" resultMap="BaseResultMap">
-    select id,name,dep_no from department
+  <select id="selectAllDeps" resultType="string">
+    select id from department
   </select>
   <select id="getMaxAbbreviation"  parameterType="java.lang.String" resultType="java.lang.String">
     select max(contract_no) as maxNo from t_order_new

+ 9 - 6
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -966,8 +966,8 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	<if test="specially == 1">
   	and a.process_status = 1  and a.order_status = 1
   	and a.order_dep in
-  	<foreach close=")" collection="deps" item="deps" open="(" separator=",">
-	 #{deps.id}
+  	<foreach close=")" collection="deps" item="depId" open="(" separator=",">
+	 #{depId}
   	</foreach>
   	</if>
   	<if test="specially == 2">
@@ -1126,8 +1126,8 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   	and a.process_status = 1  and a.order_status = 1
   	<!-- and c.department_id in (#{deps,jdbcType=VARCHAR}) -->
   	and a.order_dep in
-  	<foreach close=")" collection="deps" item="deps" open="(" separator=",">
-	 #{deps.id}
+  	<foreach close=")" collection="deps" item="depId" open="(" separator=",">
+	 #{depId}
   	</foreach>
   	</if>
   	<if test="specially == 2">
@@ -1779,8 +1779,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test=" startDate !=null and endDate != null">
       and a.create_time between #{startDate} and #{endDate}
     </if>
-    <if test=" depId !=null">
-      and a.order_dep= #{depId}
+    <if test=" deps !=null">
+      and a.order_dep in
+      <foreach close=")" collection="deps" item="depId" open="(" separator=",">
+        #{depId}
+      </foreach>
     </if>
     <if test=" province !=null">
       and b.province = #{province}

+ 9 - 2
src/main/java/com/goafanti/common/model/Department.java

@@ -5,7 +5,7 @@ import java.util.Date;
 
 /**
  * department
- * @author 
+ * @author
  */
 public class Department implements Serializable {
     /**
@@ -243,4 +243,11 @@ public class Department implements Serializable {
     public void setLvl(Integer lvl) {
         this.lvl = lvl;
     }
-}
+
+    public Department() {}
+    public Department(String id) {
+        this.id = id;
+    }
+
+
+}

+ 13 - 0
src/main/java/com/goafanti/order/bo/InputOrderSalesSource.java

@@ -1,5 +1,7 @@
 package com.goafanti.order.bo;
 
+import java.util.List;
+
 public class InputOrderSalesSource {
 
     private String startDate;
@@ -13,6 +15,17 @@ public class InputOrderSalesSource {
      */
     private Integer sort;
 
+
+    private List deps ;
+
+    public List getDeps() {
+        return deps;
+    }
+
+    public void setDeps(List deps) {
+        this.deps = deps;
+    }
+
     public String getDepName() {
         return depName;
     }

+ 2 - 2
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -324,10 +324,10 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value="/orderNewList", method = RequestMethod.GET)
 	public Result orderNewList(String aid,String name,String orderNo,String starTime,String endTime ,Integer specially ,Integer approval,
-			Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus,Integer amountStatus,
+			Integer distribution,List<String> deps,String contractNo,Integer outsource,Integer liquidationStatus,Integer amountStatus,
 							   String contractStart,String contractEnd,String uid,Integer projectType,Integer processStatus,Integer pageNo,Integer pageSize){
 		Result res=new Result();
-		res.data(orderNewService.orderNewList(aid,name, orderNo, starTime, endTime, specially ,approval, distribution,depId,
+		res.data(orderNewService.orderNewList(aid,name, orderNo, starTime, endTime, specially ,approval, distribution,deps,
 				contractNo,outsource, liquidationStatus,amountStatus,contractStart, contractEnd,uid, projectType,processStatus,pageNo, pageSize));
 		return res;
 	}

+ 1 - 1
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -71,7 +71,7 @@ public interface OrderNewService {
 	 * @param amountStatus
 	 */
 	Pagination<TOrderNewBo> orderNewList(String aid,String name, String orderNo, String starTime, String endTime,Integer specially ,
-										 Integer approval,Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,
+										 Integer approval,Integer distribution,List<String> deps,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,
 										 String contractStart, String contractEnd,String uid,Integer projectType,Integer processStatus, Integer pageNo, Integer pageSize);
 	/**
 	 * 订单审核

+ 5 - 9
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -601,7 +601,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<TOrderNewBo> orderNewList(String aid,String name, String orderNo, String starTime, String endTime,Integer specially,Integer approval,
-			Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,
+			Integer distribution,List<String> deps,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,
 												String contractStart, String contractEnd,String uid,Integer projectType,Integer processStatus,  Integer pageNo, Integer pageSize) {
 		Map<String, Object> params = new HashMap<>();
 		if (specially!=null&&(specially==0||specially==1||specially==2||specially==4||specially==5||specially==7)) {
@@ -632,16 +632,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			params.put("name", name);
 		}
 		// 计算出所有本部门及所属部门的ID
-		List<Department> deps = new ArrayList<>();
+		List<String> departmentList = new ArrayList<>();
 		if(specially==1||specially==5) {
-			if (depId!=null){
-				deps=departmentService.selectSubDeps(depId,0,1);
+			if (deps!=null){
+				departmentList=departmentService.selectSubDeps(deps,0,1);
 			}else {
-				deps=departmentService.selectMyDeps();
-			}
-		}else {
-			if (StringUtils.isNotBlank(depId)) {
-				deps=departmentService.getLowerDep(depId);
+				departmentList=departmentService.selectMyDeps();
 			}
 		}
 		if (!deps.isEmpty())params.put("deps",deps);

+ 56 - 0
src/main/java/com/goafanti/organization/bo/DepOut.java

@@ -0,0 +1,56 @@
+package com.goafanti.organization.bo;
+
+import java.util.List;
+
+public class DepOut {
+
+    private String id;
+
+    private String name;
+
+    private String depNo;
+
+    private Integer lvl;
+
+    private List<DepOut> list;
+
+    public String getDepNo() {
+        return depNo;
+    }
+
+    public void setDepNo(String depNo) {
+        this.depNo = depNo;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getLvl() {
+        return lvl;
+    }
+
+    public void setLvl(Integer lvl) {
+        this.lvl = lvl;
+    }
+
+    public List<DepOut> getList() {
+        return list;
+    }
+
+    public void setList(List<DepOut> list) {
+        this.list = list;
+    }
+}

+ 11 - 0
src/main/java/com/goafanti/organization/bo/OrganizationListOut.java

@@ -1,5 +1,7 @@
 package com.goafanti.organization.bo;
 
+import java.util.List;
+
 public class OrganizationListOut {
 	/**登录用户ID**/
 	private String uid;
@@ -43,6 +45,15 @@ public class OrganizationListOut {
 	private Integer workingHoursType;
 	private String workingHoursName;
 	private Integer lvl;
+	private List<OrganizationListOut> list;
+
+	public List<OrganizationListOut> getList() {
+		return list;
+	}
+
+	public void setList(List<OrganizationListOut> list) {
+		this.list = list;
+	}
 
 	public Integer getLvl() {
 		return lvl;

+ 16 - 8
src/main/java/com/goafanti/organization/controller/AdminOrganizationController.java

@@ -47,10 +47,10 @@ public class AdminOrganizationController extends BaseApiController{
 	/**部门组织管理新增**/
 	@RequestMapping(value = "/addOrganization" , method = RequestMethod.POST)
 	public Result addOrganization(String name, String managerId, String type, String superId, String remarks,
-								  Integer workingHoursType,Integer hideSign) {
+								  Integer workingHoursType,Integer hideSign,String depNo) {
 		Result res = new Result();
-		if(StringUtils.isBlank(name) || StringUtils.isBlank(type) || StringUtils.isBlank(superId)){
-			res.getError().add(buildError("","组织名称、组织类型、上级组织不能为空"));
+		if(StringUtils.isBlank(name) || StringUtils.isBlank(type) || StringUtils.isBlank(superId)||StringUtils.isBlank(depNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"",""));
 			return res;
 		}
 		String olo=departmentMapper.selectDepNoByName(name);
@@ -58,7 +58,11 @@ public class AdminOrganizationController extends BaseApiController{
 			res.getError().add(buildError("","部门已存在"));
 			return res;
 		}
-		organizationService.addOrganization(name, managerId, type, superId, remarks,workingHoursType,hideSign);
+		if (organizationService.checkDepNo(depNo,0)){
+			res.getError().add(buildError("","部门编号已存在"));
+			return res;
+		}
+		organizationService.addOrganization(name, managerId, type, superId, remarks,workingHoursType,hideSign,depNo);
 
 		return res;
 	}
@@ -79,20 +83,24 @@ public class AdminOrganizationController extends BaseApiController{
 	/**修改信息**/
 	@RequestMapping(value = "/updateOrganization" , method = RequestMethod.POST)
 	public Result updateOrganization(String name, String type, String managerId, String superId, String status,Integer province,
-			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign){
+			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign,String depNo){
 		Result res = new Result();
 		if(StringUtils.isBlank(name) || StringUtils.isBlank(type)
 				|| StringUtils.isBlank(managerId)|| StringUtils.isBlank(superId)
-				|| StringUtils.isBlank(status)|| StringUtils.isBlank(remarks)){
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
+				|| StringUtils.isBlank(status)|| StringUtils.isBlank(remarks)|| StringUtils.isBlank(depNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"",""));
 			return res;
 		}
 		if (id ==superId){
 			res.getError().add(buildError("不能设置自己为上级"));
 			return res;
 		}
+		if (organizationService.checkDepNo(depNo,1)){
+			res.getError().add(buildError("","部门编号已存在"));
+			return res;
+		}
 		int i=organizationService.updateOrganization(name, type, managerId, superId, status, province,remarks,id,
-				abbreviation,financeId,workingHoursType,hideSign);
+				abbreviation,financeId,workingHoursType,hideSign,depNo);
 		return res.data(i);
 	}
 

+ 5 - 3
src/main/java/com/goafanti/organization/service/OrganizationService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.organization.bo.DepOut;
 import com.goafanti.organization.bo.OrganizationListOut;
 
 public interface OrganizationService {
@@ -17,7 +18,7 @@ public interface OrganizationService {
 	Pagination<OrganizationListOut>
 	listOrganizationManagement(OrganizationListOut olo,Integer pageNo, Integer pageSize);
 	/**组织名称查上级组织*/
-	List<OrganizationListOut> selectSuperId(Integer hideSign);
+	List<DepOut> selectSuperId(Integer hideSign);
 	/**
 	 *
 	 * @param name 组织名称
@@ -28,7 +29,7 @@ public interface OrganizationService {
 	 * @return
 	 */
 	int addOrganization(String name,String managerId,String type,String superId,String desc,
-						Integer workingHoursType,Integer hideSign);
+						Integer workingHoursType,Integer hideSign,String depNo);
 	/**
 	 * 模糊查询负责人名称
 	 * @param name
@@ -41,6 +42,7 @@ public interface OrganizationService {
 	int deleteById(String id);
 
 	int updateOrganization(String name,String type,String managerId,String superId,String status,Integer province,
-			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign);
+			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign,String depNo);
 
+	boolean checkDepNo(String depNo,Integer type);
 }

+ 46 - 23
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.UUID;
 
 import com.goafanti.common.dao.DepartmentMapper;
 import com.goafanti.common.model.Department;
+import com.goafanti.organization.bo.DepOut;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -52,7 +53,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		return params;
 	}
 	@Override
-	public List<OrganizationListOut> selectSuperId(Integer hideSign) {
+	public List<DepOut> selectSuperId(Integer hideSign) {
 		if(hideSign==null){
 			hideSign=1;
 		}
@@ -60,9 +61,29 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		if (hideSign>1){
 			hideSign=null;
 		}
-		List<OrganizationListOut> depList=departmentMapper.selectSuperId(hideSign);
+		List<DepOut> depList=departmentMapper.selectSuperId(hideSign,3,null);
+		depList.forEach(e ->{
+			List<DepOut> list=getSubordinateDep(1,e.getId());
+			if (!list.isEmpty()){
+				e.setList(list);
+			}
+		});
+		return depList;
+	}
+	/**
+	 *
+	 */
+	public List<DepOut> getSubordinateDep(Integer hideSign,String id){
+		List<DepOut> depList=departmentMapper.selectSuperId(hideSign,null,id);
+		depList.forEach(e ->{
+			List<DepOut> list=getSubordinateDep(1,e.getId());
+			if (!list.isEmpty()){
+				e.setList(list);
+			}
+		});
 		return depList;
 	}
+
 	/**
 	 *   XXIn form 提交 ,bo包中
 	 *   xxOut 输出 bo包中
@@ -70,7 +91,8 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 	 *
 	 */
 	@Override
-	public int addOrganization( String name, String managerId, String type, String superId, String remarks,Integer workingHoursType,Integer hideSign) {
+	public int addOrganization( String name, String managerId, String type, String superId, String remarks,
+								Integer workingHoursType,Integer hideSign,String depNo) {
 		Department superDep=departmentMapper.selectByPrimaryKey(superId);
 		String id = UUID.randomUUID().toString();
 		Date now = new Date();
@@ -85,7 +107,6 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setLvl(superDep.getLvl()+1);
 		dep.setType(type);
 		dep.setManagerId(managerId);
-		String depNo = getMaxDep(superDep);
 		dep.setDepNo(depNo);
 	//	superId=departmentMapper.selectIdByName(superId);
 		dep.setSuperId(superId);
@@ -135,28 +156,12 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 	}
 	@Override
 	public int updateOrganization(String name, String type, String managerId, String superId, String status,Integer province,
-			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign) {
+			String remarks,String id,String abbreviation,String financeId,Integer workingHoursType,Integer hideSign,String depNo) {
 		//获取上级编号
 		Department superDep=departmentMapper.selectByPrimaryKey(superId);
-		Department use =departmentMapper.selectByPrimaryKey(id);
+
 		Date now=new Date();
 		Department dep=new Department();
-		String deps ="";
-		//如果是修改顶级则不触发下级修改
-		boolean flag=true;
-		if (name.contains("平台超管中心"))flag=false;
-		if (!use.getSuperId().equals(superId)){
-			if(!name.equals("平台超管中心")){
-				deps=getMaxDep(superDep);
-			}else {
-				deps="DP";
-			}
-			dep.setDepNo(deps);
-			dep.setSuperId(superId);
-		}else {
-			flag=false;
-		}
-
 		dep.setLvl(superDep.getLvl()+1);
 		dep.setName(name);
 		dep.setType(type);
@@ -165,6 +170,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setStatus(status);
 		dep.setRemarks(remarks);
 		dep.setId(id);
+		dep.setDepNo(depNo);
 		dep.setAbbreviation(abbreviation);
 		dep.setFinanceId(financeId);
 		dep.setProvince(province);
@@ -172,10 +178,27 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setWorkingHoursType(workingHoursType);
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
-		if(flag)updateLowerLevelNo(dep.getId(),dep.getDepNo(),dep.getLvl());
 		return x;
 	}
 
+	@Override
+	public boolean checkDepNo(String depNo,Integer type) {
+		String useDepNo=departmentMapper.selectIdByDepNo(depNo);
+		if (StringUtils.isNotBlank(useDepNo)){
+			if (type==1){
+				if (depNo.equals(useDepNo)){
+					return false;
+				}else {
+					return true;
+				}
+			}else {
+				return true;
+			}
+
+		}
+		return false;
+	}
+
 	private String countDepNo(String sdepNo, Integer count) {
 		String dep=null;
 		if(count<10){