You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
5.4 KiB
Java
172 lines
5.4 KiB
Java
package com.engine.organization.wrapper;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
import com.engine.common.util.ServiceUtil;
|
|
import com.engine.organization.annotation.Log;
|
|
import com.engine.organization.entity.company.param.CompSearchParam;
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
import com.engine.organization.service.CompService;
|
|
import com.engine.organization.service.impl.CompServiceImpl;
|
|
import com.engine.organization.util.OrganizationWrapper;
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
import weaver.hrm.User;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @description:
|
|
* @author:dxfeng
|
|
* @createTime: 2022/05/16
|
|
* @version: 1.0
|
|
*/
|
|
public class CompWrapper extends OrganizationWrapper {
|
|
private CompService getCompService(User user) {
|
|
return ServiceUtil.getService(CompServiceImpl.class, user);
|
|
}
|
|
|
|
private CompMapper getCompMapper() {
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
}
|
|
|
|
/**
|
|
* 列表
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
public Map<String, Object> listPage(CompSearchParam params) {
|
|
return getCompService(user).listPage(params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 保存公司/分部基础信息
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY)
|
|
public Long saveBaseComp(Map<String, Object> params) {
|
|
Long companyId = getCompService(user).saveBaseComp(params);
|
|
writeOperateLog(new Object() {
|
|
}.getClass(), params.get("comp_name").toString(), JSON.toJSONString(params), "新增分部");
|
|
return companyId;
|
|
}
|
|
|
|
/**
|
|
* 更新禁用标记
|
|
*
|
|
* @param params
|
|
*/
|
|
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY)
|
|
public int updateForbiddenTagById(CompSearchParam params) {
|
|
CompPO compPO = getCompMapper().listById(params.getId());
|
|
int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params);
|
|
writeOperateLog(new Object() {
|
|
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, getCompMapper().listById(params.getId()));
|
|
return updateForbiddenTagById;
|
|
}
|
|
|
|
/**
|
|
* 更新分部主表、拓展表、明细表
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY)
|
|
public Long updateComp(Map<String, Object> params) {
|
|
long id = Long.parseLong(params.get("id").toString());
|
|
CompPO compPO = getCompMapper().listById(id);
|
|
Long companyId = getCompService(user).updateComp(params);
|
|
writeOperateLog(new Object() {
|
|
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, getCompMapper().listById(id));
|
|
return companyId;
|
|
}
|
|
|
|
/**
|
|
* 根据ID批量删除
|
|
*
|
|
* @param ids
|
|
*/
|
|
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY)
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
List<CompPO> compsByIds = getCompMapper().getCompsByIds(ids);
|
|
int deleteByIds = getCompService(user).deleteByIds(ids);
|
|
for (CompPO compsById : compsByIds) {
|
|
writeOperateLog(new Object() {
|
|
}.getClass(), compsById.getCompName(), JSON.toJSONString(ids), "删除分部信息");
|
|
}
|
|
return deleteByIds;
|
|
}
|
|
|
|
/**
|
|
* 转移分部
|
|
*
|
|
* @param moveParam
|
|
* @return
|
|
*/
|
|
@Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY)
|
|
public int moveCompany(DepartmentMoveParam moveParam) {
|
|
CompPO compPO = getCompMapper().listById(moveParam.getId());
|
|
int moveCompany = getCompService(user).moveCompany(moveParam);
|
|
writeOperateLog(new Object() {
|
|
}.getClass(), compPO.getCompName(), JSON.toJSONString(moveParam), compPO, getCompMapper().listById(moveParam.getId()));
|
|
return moveCompany;
|
|
}
|
|
|
|
/**
|
|
* 获取搜索条件
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
return getCompService(user).getSearchCondition(params);
|
|
}
|
|
|
|
/**
|
|
* 获取列表页面按钮信息
|
|
*
|
|
* @return
|
|
*/
|
|
public Map<String, Object> getHasRight() {
|
|
return getCompService(user).getHasRight();
|
|
}
|
|
|
|
/**
|
|
* 获取基本信息表单
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
|
|
return getCompService(user).getCompBaseForm(params);
|
|
}
|
|
|
|
/**
|
|
* 新增表单
|
|
*
|
|
* @return
|
|
*/
|
|
public Map<String, Object> getCompSaveForm() {
|
|
return getCompService(user).getCompSaveForm();
|
|
}
|
|
|
|
/**
|
|
* 获取转移表单
|
|
*
|
|
* @return
|
|
*/
|
|
public List<SearchConditionGroup> getMoveForm() {
|
|
return getCompService(user).getMoveForm();
|
|
}
|
|
|
|
}
|