|
|
@@ -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){
|