|
|
|
@ -1,23 +1,28 @@
|
|
|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.api.browser.bean.BrowserBean;
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
|
|
|
|
import com.engine.organization.entity.detach.po.ManagerDetachPO;
|
|
|
|
|
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
|
|
|
|
|
import com.engine.organization.mapper.detach.ManagerDetachMapper;
|
|
|
|
|
import com.engine.organization.mapper.employee.EmployeeMapper;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
|
|
|
|
import com.engine.organization.service.ManagerDetachService;
|
|
|
|
|
import com.engine.organization.util.HasRightUtil;
|
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
import com.engine.organization.util.db.DBType;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@ -40,6 +45,14 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EmployeeMapper getEmployeeMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(EmployeeMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SystemDataMapper getSystemDataMapper(){
|
|
|
|
|
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
@ -68,7 +81,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
|
|
|
|
|
selectOptions.add(moduleOption);
|
|
|
|
|
|
|
|
|
|
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "管理员", "1", "ecManager", "");
|
|
|
|
|
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "管理员", "1", "ecManager", "");
|
|
|
|
|
ecManager.setRules("required|string");
|
|
|
|
|
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "可维护机构", "194", "ecRolelevel", "");
|
|
|
|
|
ecRolelevel.setRules("required|string");
|
|
|
|
@ -77,7 +90,13 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
module.setDetailtype(2);
|
|
|
|
|
module.setHasBorder(true);
|
|
|
|
|
if (id != null) {
|
|
|
|
|
//todo
|
|
|
|
|
ManagerDetachPO detachById = getMangeDetachMapper().getDetachById(id);
|
|
|
|
|
BrowserBean manager = ecManager.getBrowserConditionParam();
|
|
|
|
|
manager.setReplaceDatas(getEmployeeMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcManager())).build().getIds()));
|
|
|
|
|
ecManager.setBrowserConditionParam(manager);
|
|
|
|
|
BrowserBean roleLevel = ecRolelevel.getBrowserConditionParam();
|
|
|
|
|
roleLevel.setReplaceDatas(getSystemDataMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcRolelevel())).build().getIds()));
|
|
|
|
|
ecRolelevel.setBrowserConditionParam(roleLevel);
|
|
|
|
|
}
|
|
|
|
|
selectItems.add(ecManager);
|
|
|
|
|
selectItems.add(ecRolelevel);
|
|
|
|
@ -97,7 +116,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
|
|
|
|
.managerType(0)
|
|
|
|
|
.ecManager(param.getEcManager())
|
|
|
|
|
.jclManager(String.valueOf(getHrmResourceMapper().getJclResourceId(param.getEcManager())))
|
|
|
|
|
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
|
|
|
|
.ecRolelevel(param.getEcRolelevel())
|
|
|
|
|
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()).getId()) : null)
|
|
|
|
|
.manageModule("组织管理")
|
|
|
|
@ -113,8 +132,9 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
@Override
|
|
|
|
|
public int updateDetach(ManagerDetachParam param) {
|
|
|
|
|
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
|
|
|
|
.id(param.getId())
|
|
|
|
|
.ecManager(param.getEcManager())
|
|
|
|
|
.jclManager(String.valueOf(getHrmResourceMapper().getJclResourceId(param.getEcManager())))
|
|
|
|
|
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
|
|
|
|
.ecRolelevel(param.getEcRolelevel())
|
|
|
|
|
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()).getId()) : null)
|
|
|
|
|
.build();
|
|
|
|
@ -122,16 +142,17 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String buildSqlWhere(Map<String, Object> params) {
|
|
|
|
|
String sqlWhere = " where 1 = 1";
|
|
|
|
|
DBType dbType = DBType.get(new RecordSet().getDBType());
|
|
|
|
|
String sqlWhere = " where delete_type = 0";
|
|
|
|
|
String lastName = (String) params.get("ecManager");
|
|
|
|
|
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
|
|
|
|
|
String ecManager = StringUtils.join(resourceIds,",");
|
|
|
|
|
if (StringUtils.isNotBlank(ecManager)) {
|
|
|
|
|
if (StringUtils.isNotBlank(lastName)) {
|
|
|
|
|
sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
|
|
|
|
}
|
|
|
|
|
String ecRolelevel = (String) params.get("ecRolelevel");
|
|
|
|
|
if (StringUtils.isNotBlank(ecRolelevel)) {
|
|
|
|
|
sqlWhere += " AND ec_rolelevel in ("+ecRolelevel+")";
|
|
|
|
|
sqlWhere += " AND ec_rolelevel " +dbType.like(ecRolelevel);
|
|
|
|
|
}
|
|
|
|
|
return sqlWhere;
|
|
|
|
|
}
|
|
|
|
|