分组删除 新增自定义字段
This commit is contained in:
parent
a3c4fd5c21
commit
7c02e9bc61
|
|
@ -22,7 +22,7 @@ public class ExtendGroupBO {
|
|||
|
||||
public static List<TypeTreeVO> buildTypeTree(List<ExtendGroupPO> extendGroupPOS) {
|
||||
|
||||
if(CollectionUtils.isEmpty(extendGroupPOS)){
|
||||
if (CollectionUtils.isEmpty(extendGroupPOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
|
@ -40,9 +40,12 @@ public class ExtendGroupBO {
|
|||
.build()).collect(Collectors.toList());
|
||||
|
||||
//获取非一级
|
||||
Map<Long, List<TypeTreeVO>> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO :: getPid));
|
||||
Map<Long, List<TypeTreeVO>> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO::getPid));
|
||||
|
||||
return typeTreeVOS.stream().peek(e -> {e.setChilds(collects.get(e.getKey())); e.setHaschild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);}).filter(item -> item.getPid() == null).collect(Collectors.toList());
|
||||
return typeTreeVOS.stream().peek(e -> {
|
||||
e.setChilds(collects.get(e.getKey()));
|
||||
e.setHaschild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);
|
||||
}).filter(item -> item.getPid() == null).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -50,4 +53,36 @@ public class ExtendGroupBO {
|
|||
List<ExtendTitlePO> titlesByGroupID = MapperProxyFactory.getProxy(ExtendTitleMapper.class).getTitlesByGroupID(id);
|
||||
return titlesByGroupID.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应表名
|
||||
*
|
||||
* @param extendGroupPO
|
||||
* @return
|
||||
*/
|
||||
public static String getTableNameByGroupPO(ExtendGroupPO extendGroupPO) {
|
||||
String tableName = "";
|
||||
switch (extendGroupPO.getExtendType()) {
|
||||
case -1:
|
||||
tableName = "JCL_ORG_COMP";
|
||||
break;
|
||||
case -2:
|
||||
tableName = "JCL_ORG_DEPT";
|
||||
break;
|
||||
case -3:
|
||||
tableName = "JCL_ORG_JOB";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (extendGroupPO.getId() < 0) {
|
||||
|
||||
} else if (null == extendGroupPO.getPid()) {
|
||||
tableName += "EXT";
|
||||
} else {
|
||||
tableName += "EXT_DT1";
|
||||
}
|
||||
return tableName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.api.hrm.util.FieldType;
|
|||
import com.api.hrm.util.ServiceUtil;
|
||||
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
|
||||
import com.engine.organization.entity.SelectOptionParam;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoFieldParam;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.sensitive.biz.SensitiveWordTypeComInfo;
|
||||
|
|
@ -65,6 +66,15 @@ public class ExtendInfoBO {
|
|||
|
||||
}
|
||||
|
||||
public static ExtendInfoPO convertFieldParam2ExtendInfo(ExtendInfoFieldParam infoFieldParam) {
|
||||
if (null == infoFieldParam) {
|
||||
return null;
|
||||
}
|
||||
return ExtendInfoPO
|
||||
.builder()
|
||||
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细表字段
|
||||
|
|
@ -311,7 +321,7 @@ public class ExtendInfoBO {
|
|||
detailtype = "1";
|
||||
}
|
||||
searchConditionItem.setKey(Util.null2String(fieldvalue));
|
||||
searchConditionItem.setValue(fieldvalue+"");
|
||||
searchConditionItem.setValue(fieldvalue + "");
|
||||
searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3));
|
||||
} else if (fieldhtmltype.equals("6")) {//附件
|
||||
if (fieldname.equals("resourceimageid")) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
package com.engine.organization.entity.extend.param;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import weaver.general.Util;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ExtendInfoFieldParam {
|
||||
private String id;
|
||||
// field_name
|
||||
private String fieldname;
|
||||
// field_name_desc
|
||||
private String fieldlabel;
|
||||
|
||||
private Object fieldType;
|
||||
|
||||
private ExtendInfoTypeParam infoTypeParam;
|
||||
|
||||
private String enable;
|
||||
|
||||
private String required;
|
||||
|
||||
private String isModify;
|
||||
|
||||
private String key;
|
||||
|
||||
public String getControlType() {
|
||||
JSONArray fieldType = (JSONArray) this.getFieldType();
|
||||
ExtendInfoTypeParam infoTypeParam = new ExtendInfoTypeParam();
|
||||
String fieldHtmlType = Util.null2String(fieldType.get(0));
|
||||
if (fieldHtmlType.equals("input")) {
|
||||
fieldHtmlType = "1";
|
||||
} else if (fieldHtmlType.equals("textarea")) {
|
||||
fieldHtmlType = "2";
|
||||
} else if (fieldHtmlType.equals("browser")) {
|
||||
fieldHtmlType = "3";
|
||||
} else if (fieldHtmlType.equals("check")) {
|
||||
fieldHtmlType = "4";
|
||||
} else if (fieldHtmlType.equals("select")) {
|
||||
fieldHtmlType = "5";
|
||||
} else if (fieldHtmlType.equals("upload")) {
|
||||
fieldHtmlType = "6";
|
||||
}
|
||||
return fieldHtmlType;
|
||||
}
|
||||
|
||||
public String getBrowserType(String controlType) {
|
||||
String browserType = "1";
|
||||
JSONArray fieldType = (JSONArray) this.getFieldType();
|
||||
if (fieldType.size() > 1) {
|
||||
browserType = Util.null2String(fieldType.get(1));
|
||||
}
|
||||
if (controlType.equals("1")) {
|
||||
if (browserType.equals("text")) {
|
||||
browserType = "1";
|
||||
} else if (browserType.equals("int")) {
|
||||
browserType = "2";
|
||||
} else if (browserType.equals("float")) {
|
||||
browserType = "3";
|
||||
} else if (browserType.equals("file")) {
|
||||
browserType = "1";
|
||||
}
|
||||
}
|
||||
if (controlType.equals("2")) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("3")) {
|
||||
browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value"));
|
||||
} else if (controlType.equals("4")) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("5")) {
|
||||
browserType = "1";
|
||||
} else if (controlType.equals("6")) {
|
||||
if (browserType.equals("file")) {
|
||||
browserType = "1";
|
||||
}
|
||||
}
|
||||
return browserType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.engine.organization.entity.extend.param;
|
||||
|
||||
import com.engine.hrm.entity.FieldSelectOptionBean;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ExtendInfoTypeParam {
|
||||
private String fieldHtmlType;
|
||||
private String fieldType;
|
||||
private Object otherParam;
|
||||
private List<FieldSelectOptionBean> lsSelectOption;
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
|
|||
public class ExtendTitleSaveParam {
|
||||
private String data;
|
||||
private Long groupType;
|
||||
|
||||
private Long id;
|
||||
private String groupName;
|
||||
private String isShow;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public interface ExtendGroupMapper {
|
|||
*/
|
||||
List<ExtendGroupPO> listGroupByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
ExtendGroupPO getGroupById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据ID 查询数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@
|
|||
WHERE t.delete_type = 0 and t.is_show = 1
|
||||
and t.pid= #{pid}
|
||||
</select>
|
||||
<select id="getGroupById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_field_extendgroup t
|
||||
WHERE t.delete_type = 0 and t.is_show = 1
|
||||
and t.id= #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -20,6 +20,7 @@ public interface FieldDefinedService {
|
|||
|
||||
/**
|
||||
* 获取左侧树
|
||||
*
|
||||
* @param moduleTypeEnum
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -60,10 +61,27 @@ public interface FieldDefinedService {
|
|||
|
||||
/**
|
||||
* 新增类型树
|
||||
*
|
||||
* @param moduleTypeEnum
|
||||
* @param fieldTypeTreeParam
|
||||
* @return
|
||||
*/
|
||||
void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam);
|
||||
|
||||
/**
|
||||
* 删除标题信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int deleteTitle(ExtendTitleSaveParam param);
|
||||
|
||||
/**
|
||||
* 获取自定义字段列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getFieldDefinedInfo(ExtendTitleSaveParam param);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.extend.bo.ExtendGroupBO;
|
||||
import com.engine.organization.entity.extend.param.ExtendTitleSaveParam;
|
||||
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||
|
|
@ -19,7 +20,6 @@ import com.engine.organization.util.OrganizationAssert;
|
|||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -32,6 +32,10 @@ import java.util.stream.Collectors;
|
|||
**/
|
||||
public class FieldDefinedServiceImpl extends Service implements FieldDefinedService {
|
||||
|
||||
private ExtendGroupMapper getExtendGroupMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
|
||||
}
|
||||
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
|
@ -62,7 +66,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
tab.put("isShow", extendTitle.getIsShow());
|
||||
tab.put("groupid", extendTitle.getGroupId());
|
||||
tab.put("viewAttr", extendTitle.getGroupId() < 0 ? 1 : 2);
|
||||
tab.put("editable", getExtendInfoMapper().countFieldsByGroupId(extendTitle.getId()) > 0);
|
||||
tab.put("editable", !(getExtendInfoMapper().countFieldsByGroupId(extendTitle.getId()) > 0));
|
||||
tabs.add(tab);
|
||||
}
|
||||
datas.put("status", "1");
|
||||
|
|
@ -76,8 +80,19 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
return 0;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(data);
|
||||
String groupType = Util.null2String(jsonObject.getString("groupType"));
|
||||
String groupId = Util.null2String(jsonObject.getString("groupId"));
|
||||
// extend_group主键
|
||||
Long groupType = jsonObject.getLong("groupType");
|
||||
ExtendGroupPO extendGroup = getExtendGroupMapper().getGroupById(groupType);
|
||||
Integer extendType = extendGroup.getExtendType();
|
||||
String tableName = ExtendGroupBO.getTableNameByGroupPO(extendGroup);
|
||||
|
||||
// 主表、主表拓展表为extend_title主键;明细表为extend_group主键
|
||||
Long extendGroupId = jsonObject.getLong("groupId");
|
||||
|
||||
JSONArray records = (JSONArray) jsonObject.get("records");
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +155,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
extendTitle.setCreateTime(new Date());
|
||||
extendTitle.setDeleteType(0);
|
||||
getExtendTitleMapper().insertIgnoreNull(extendTitle);
|
||||
|
||||
ids.add(extendTitle.getId());
|
||||
|
||||
datas.put("groupid", StringUtils.join(ids, ","));
|
||||
|
|
@ -147,16 +163,26 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
buildExtentGroup(moduleTypeEnum,fieldTypeTreeParam);
|
||||
buildExtentGroup(moduleTypeEnum, fieldTypeTreeParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteTitle(ExtendTitleSaveParam param) {
|
||||
int countFields = getExtendInfoMapper().countFieldsByGroupId(param.getGroupType());
|
||||
OrganizationAssert.isTrue(countFields == 0, "当前分组下仍有字段信息,请删除字段信息后删除分组");
|
||||
return getExtendTitleMapper().deleteExtendTitleByIds(DeleteParam.builder().ids(param.getId().toString()).build().getIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getFieldDefinedInfo(ExtendTitleSaveParam param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void buildExtentGroup(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class FieldDefinedController {
|
|||
@Path("/{moduleTypeEnum}/getTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTree(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum) {
|
||||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return getFieldDefinedWrapper(user).getTree(moduleTypeEnum);
|
||||
|
|
@ -63,7 +63,7 @@ public class FieldDefinedController {
|
|||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum, @RequestBody FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return getFieldDefinedWrapper(user).addTree(moduleTypeEnum,fieldTypeTreeParam);
|
||||
return getFieldDefinedWrapper(user).addTree(moduleTypeEnum, fieldTypeTreeParam);
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
|
|
@ -135,4 +135,16 @@ public class FieldDefinedController {
|
|||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/deleteTitle")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult deleteTitle(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ExtendTitleSaveParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getFieldDefinedWrapper(user).deleteTitle(param));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class FieldDefinedWrapper extends Service {
|
|||
|
||||
/**
|
||||
* 获取标题分组
|
||||
*
|
||||
* @param groupType
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -53,6 +54,7 @@ public class FieldDefinedWrapper extends Service {
|
|||
|
||||
/**
|
||||
* 新建分组
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -62,7 +64,11 @@ public class FieldDefinedWrapper extends Service {
|
|||
|
||||
|
||||
public ReturnResult addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
getFieldDefinedService(user).addTree(moduleTypeEnum,fieldTypeTreeParam);
|
||||
getFieldDefinedService(user).addTree(moduleTypeEnum, fieldTypeTreeParam);
|
||||
return ReturnResult.successed();
|
||||
}
|
||||
|
||||
public int deleteTitle(ExtendTitleSaveParam param) {
|
||||
return getFieldDefinedService(user).deleteTitle(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue