commit
7750d996c5
|
|
@ -23,9 +23,9 @@ import lombok.NoArgsConstructor;
|
|||
"t.company_id," +
|
||||
"t.mobile," +
|
||||
"t.telephone," +
|
||||
"t.manager_id,",
|
||||
"t.manager_id ",
|
||||
fromSql = "FROM jcl_org_hrmresource t ",
|
||||
orderby = "id desc",
|
||||
orderby = " id ",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(index = "0", text = "发消息"),
|
||||
|
|
|
|||
|
|
@ -27,4 +27,35 @@ public interface HrmResourceService {
|
|||
* @return
|
||||
*/
|
||||
Map<String, Object> listPage(HrmResourceSearchParam params);
|
||||
|
||||
/**
|
||||
* 获取新增表单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getSaveForm();
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int saveBaseForm(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取基本信息表单
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getBaseForm(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
int updateForm(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|||
item.setViewAttr(3);
|
||||
item.setRules("required");
|
||||
}
|
||||
if (extendInfoPO.getFieldName().equals(autoNoField)) {
|
||||
if (null != autoNoField && extendInfoPO.getFieldName().equals(autoNoField)) {
|
||||
// 判断是否开启自动编号
|
||||
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(serialType);
|
||||
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
|
||||
|
|
@ -186,26 +186,28 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|||
@Override
|
||||
public int updateExtForm(User user, String extendType, String tableName, Map<String, Object> params, String groupId, Long id) {
|
||||
int updateBaseComp;
|
||||
List<ExtendInfoPO> extInfoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName, ExtendInfoOperateType.EDIT.getValue());
|
||||
List<ExtendInfoPO> extInfoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName, "");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 遍历Map
|
||||
Map<String, ExtendInfoPO> collect = extInfoPOList.stream().collect(Collectors.toMap(ExtendInfoPO::getFieldName, item -> item));
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (null != value && StringUtils.isBlank(value.toString())) {
|
||||
value = null;
|
||||
}
|
||||
if (null == value) {
|
||||
if ("int".equals(collect.get(key).getFieldType())) {
|
||||
if (collect.containsKey(key)) {
|
||||
Object value = entry.getValue();
|
||||
if (null != value && StringUtils.isBlank(value.toString())) {
|
||||
value = null;
|
||||
}
|
||||
// 兼容sqlServer数据库text字段类型
|
||||
if ("text".equals(collect.get(key).getFieldType())) {
|
||||
value = "";
|
||||
if (null == value) {
|
||||
if ("int".equals(collect.get(key).getFieldType())) {
|
||||
value = null;
|
||||
}
|
||||
// 兼容sqlServer数据库text字段类型
|
||||
if ("text".equals(collect.get(key).getFieldType())) {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
if (null != id) {
|
||||
|
|
@ -223,7 +225,9 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|||
updateBaseComp = getExtMapper().insertExt(tableName, map);
|
||||
}
|
||||
} else {
|
||||
map.put("forbidden_tag", 0);
|
||||
if (!tableName.equals("JCL_ORG_HRMRESOURCE")) {
|
||||
map.put("forbidden_tag", 0);
|
||||
}
|
||||
map.put("creator", user.getUID());
|
||||
map.put("delete_type", 0);
|
||||
map.put("create_time", new Date());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
|
|
@ -8,6 +10,7 @@ import com.engine.organization.entity.company.bo.CompBO;
|
|||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
|
|
@ -16,8 +19,11 @@ import com.engine.organization.entity.searchtree.SearchTree;
|
|||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.service.HrmResourceService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.tree.SearchTreeUtil;
|
||||
|
|
@ -26,6 +32,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -48,6 +55,30 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
private static final String TYPE_DEPT = "2";
|
||||
private static final String TYPE_JOB = "3";
|
||||
|
||||
private static final Long GROUP_ID = 4L;
|
||||
|
||||
/**
|
||||
* 分组类型
|
||||
* 1:分部
|
||||
* 2:部门
|
||||
* 3:岗位
|
||||
* 4:人员
|
||||
*/
|
||||
private static final String EXTEND_TYPE = "4";
|
||||
|
||||
/**
|
||||
* 主表表名
|
||||
*/
|
||||
private static final String JCL_ORG_HRM = "JCL_ORG_HRMRESOURCE";
|
||||
/**
|
||||
* 主表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_HRMEXT = "JCL_ORG_HRMRESOURCEEXT";
|
||||
/**
|
||||
* 明细表拓展表
|
||||
*/
|
||||
private static final String JCL_ORG_HRMEXT_DT1 = "JCL_ORG_HRMRESOURCEEXT_DT1";
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
|
@ -60,6 +91,14 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private ExtService getExtService(User user) {
|
||||
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
||||
String keyword = params.getKeyword();
|
||||
|
|
@ -82,6 +121,82 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSaveForm() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID);
|
||||
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_HRM, 2, extendTitle.getId() + "", null, null)));
|
||||
}
|
||||
}
|
||||
apiDatas.put("condition", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveBaseForm(Map<String, Object> params) {
|
||||
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBaseForm(Map<String, Object> params) {
|
||||
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
||||
// 2编辑 1查看
|
||||
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
|
||||
long id = Long.parseLong((String) params.get("id"));
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
|
||||
HashMap<String, Object> buttonsMap = new HashMap<>();
|
||||
buttonsMap.put("hasEdit", true);
|
||||
buttonsMap.put("hasSave", true);
|
||||
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
if ("0".equals(groupId)) {
|
||||
groupId = GROUP_ID.toString();
|
||||
}
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
||||
for (ExtendTitlePO extendTitle : extendTitles) {
|
||||
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_HRM : JCL_ORG_HRMEXT, viewAttr, id, extendTitle.getId() + "", "")));
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("buttons", buttonsMap);
|
||||
resultMap.put("conditions", addGroups);
|
||||
resultMap.put("id", id);
|
||||
// 拓展页面分组
|
||||
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_HRMEXT));
|
||||
// 处理明细表
|
||||
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_HRMEXT_DT1, id, viewAttr, false));
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
||||
apiDatas.put("result", resultMap);
|
||||
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateForm(Map<String, Object> params) {
|
||||
Long id = Long.parseLong((String) params.get("id"));
|
||||
String groupId = (String) params.get("viewCondition");
|
||||
if ("0".equals(groupId)) {
|
||||
groupId = GROUP_ID.toString();
|
||||
}
|
||||
int updateCount = 0;
|
||||
// 更新主表数据
|
||||
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id);
|
||||
// 更新主表拓展表
|
||||
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRMEXT, params, groupId, id);
|
||||
//更新明细表
|
||||
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_HRMEXT_DT1, params, id);
|
||||
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@ import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
|
|||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.HrmResourceWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
|
@ -68,4 +70,82 @@ public class HrmResourceController {
|
|||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新增表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSaveForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSaveForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getSaveForm());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveBaseForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).saveBaseForm(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getBaseForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getBaseForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getBaseForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新表单
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/updateForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).updateForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,20 @@ public class HrmResourceWrapper extends Service {
|
|||
public Map<String, Object> listPage(HrmResourceSearchParam params) {
|
||||
return getHrmResourceService(user).listPage(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSaveForm() {
|
||||
return getHrmResourceService(user).getSaveForm();
|
||||
}
|
||||
|
||||
public int saveBaseForm(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).saveBaseForm(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getBaseForm(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getBaseForm(params);
|
||||
}
|
||||
|
||||
public int updateForm(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).updateForm(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue