weaver-hrm-organization/src/com/engine/organization/wrapper/CompWrapper.java

181 lines
5.9 KiB
Java
Raw Normal View History

2022-05-17 13:34:00 +08:00
package com.engine.organization.wrapper;
2022-07-05 15:15:00 +08:00
import com.alibaba.fastjson.JSON;
2022-06-24 16:14:13 +08:00
import com.api.browser.bean.SearchConditionGroup;
2022-05-17 13:34:00 +08:00
import com.engine.common.util.ServiceUtil;
2022-07-05 15:15:00 +08:00
import com.engine.organization.annotation.Log;
2022-05-30 18:40:25 +08:00
import com.engine.organization.entity.company.param.CompSearchParam;
2022-07-07 14:19:56 +08:00
import com.engine.organization.entity.company.po.CompPO;
2022-06-24 14:22:10 +08:00
import com.engine.organization.entity.department.param.DepartmentMoveParam;
2022-07-05 15:15:00 +08:00
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
2022-07-07 14:19:56 +08:00
import com.engine.organization.mapper.comp.CompMapper;
2022-05-17 13:34:00 +08:00
import com.engine.organization.service.CompService;
import com.engine.organization.service.impl.CompServiceImpl;
2022-08-31 14:24:00 +08:00
import com.engine.organization.thread.CompanyTriggerRunnable;
2022-07-05 15:15:00 +08:00
import com.engine.organization.util.OrganizationWrapper;
2022-07-07 14:19:56 +08:00
import com.engine.organization.util.db.MapperProxyFactory;
2022-05-17 13:34:00 +08:00
import weaver.hrm.User;
import java.util.Collection;
2022-06-24 16:14:13 +08:00
import java.util.List;
2022-05-17 13:34:00 +08:00
import java.util.Map;
/**
2022-06-14 11:07:48 +08:00
* @description:
2022-05-17 13:34:00 +08:00
* @author:dxfeng
* @createTime: 2022/05/16
* @version: 1.0
*/
2022-07-05 15:15:00 +08:00
public class CompWrapper extends OrganizationWrapper {
2022-05-17 13:34:00 +08:00
private CompService getCompService(User user) {
return ServiceUtil.getService(CompServiceImpl.class, user);
}
2022-07-07 14:19:56 +08:00
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
2022-05-17 13:34:00 +08:00
/**
* 列表
*
* @param params
* @return
*/
2022-05-17 16:36:53 +08:00
public Map<String, Object> listPage(CompSearchParam params) {
2022-05-17 13:34:00 +08:00
return getCompService(user).listPage(params);
}
/**
* 保存公司/分部基础信息
*
* @param params
* @return
*/
2022-07-05 15:15:00 +08:00
@Log(operateType = OperateTypeEnum.ADD, operateDesc = "新增分部", operateModule = LogModuleNameEnum.COMPANY)
2022-06-23 16:55:26 +08:00
public Long saveBaseComp(Map<String, Object> params) {
2022-07-05 15:15:00 +08:00
Long companyId = getCompService(user).saveBaseComp(params);
writeOperateLog(new Object() {
2022-07-07 14:19:56 +08:00
}.getClass(), params.get("comp_name").toString(), JSON.toJSONString(params), "新增分部");
2022-08-31 14:24:00 +08:00
new Thread(new CompanyTriggerRunnable(companyId)).start();
2022-07-05 15:15:00 +08:00
return companyId;
}
/**
* 更新禁用标记
*
* @param params
*/
2022-07-05 15:15:00 +08:00
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部禁用标识", operateModule = LogModuleNameEnum.COMPANY)
public int updateForbiddenTagById(CompSearchParam params) {
2022-07-07 14:19:56 +08:00
CompPO compPO = getCompMapper().listById(params.getId());
2022-07-05 15:15:00 +08:00
int updateForbiddenTagById = getCompService(user).updateForbiddenTagById(params);
2022-08-31 14:24:00 +08:00
CompPO newCompPO = getCompMapper().listById(params.getId());
2022-07-05 15:15:00 +08:00
writeOperateLog(new Object() {
2022-08-31 14:24:00 +08:00
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
2022-07-05 15:15:00 +08:00
return updateForbiddenTagById;
}
/**
* 更新分部主表拓展表明细表
*
* @param params
* @return
*/
2022-07-05 15:15:00 +08:00
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新分部信息", operateModule = LogModuleNameEnum.COMPANY)
2022-06-23 16:55:26 +08:00
public Long updateComp(Map<String, Object> params) {
2022-07-07 14:19:56 +08:00
long id = Long.parseLong(params.get("id").toString());
CompPO compPO = getCompMapper().listById(id);
2022-07-05 15:15:00 +08:00
Long companyId = getCompService(user).updateComp(params);
2022-08-31 14:24:00 +08:00
CompPO newCompPO = getCompMapper().listById(id);
2022-07-05 15:15:00 +08:00
writeOperateLog(new Object() {
2022-08-31 14:24:00 +08:00
}.getClass(), compPO.getCompName(), JSON.toJSONString(params), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
2022-07-05 15:15:00 +08:00
return companyId;
}
/**
* 根据ID批量删除
*
* @param ids
*/
2022-07-05 15:15:00 +08:00
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除分部信息", operateModule = LogModuleNameEnum.COMPANY)
public int deleteByIds(Collection<Long> ids) {
2022-07-07 14:19:56 +08:00
List<CompPO> compsByIds = getCompMapper().getCompsByIds(ids);
2022-07-05 15:15:00 +08:00
int deleteByIds = getCompService(user).deleteByIds(ids);
2022-07-07 14:19:56 +08:00
for (CompPO compsById : compsByIds) {
writeOperateLog(new Object() {
}.getClass(), compsById.getCompName(), JSON.toJSONString(ids), "删除分部信息");
2022-08-31 14:24:00 +08:00
new Thread(new CompanyTriggerRunnable(compsById)).start();
2022-07-07 14:19:56 +08:00
}
2022-07-05 15:15:00 +08:00
return deleteByIds;
}
/**
* 转移分部
*
* @param moveParam
* @return
*/
2022-07-07 14:19:56 +08:00
@Log(operateType = OperateTypeEnum.MOVE, operateDesc = "转移分部", operateModule = LogModuleNameEnum.COMPANY)
2022-07-05 15:15:00 +08:00
public int moveCompany(DepartmentMoveParam moveParam) {
2022-07-07 14:19:56 +08:00
CompPO compPO = getCompMapper().listById(moveParam.getId());
2022-07-05 15:15:00 +08:00
int moveCompany = getCompService(user).moveCompany(moveParam);
2022-08-31 14:24:00 +08:00
CompPO newCompPO = getCompMapper().listById(moveParam.getId());
2022-07-05 15:15:00 +08:00
writeOperateLog(new Object() {
2022-08-31 14:24:00 +08:00
}.getClass(), compPO.getCompName(), JSON.toJSONString(moveParam), compPO, newCompPO);
new Thread(new CompanyTriggerRunnable(compPO, newCompPO)).start();
2022-07-05 15:15:00 +08:00
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();
}
2022-05-18 18:06:01 +08:00
/**
* 获取基本信息表单
*
* @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();
}
2022-06-24 14:22:10 +08:00
/**
2022-07-05 15:15:00 +08:00
* 获取转移表单
2022-06-24 14:22:10 +08:00
*
* @return
*/
2022-06-24 16:14:13 +08:00
public List<SearchConditionGroup> getMoveForm() {
return getCompService(user).getMoveForm();
}
2022-05-17 13:34:00 +08:00
}