commit
d33f907052
|
|
@ -50,4 +50,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,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>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.extend.po.ExtendGroupPO"
|
||||
keyProperty="id"
|
||||
|
|
|
|||
|
|
@ -65,6 +65,20 @@ public interface FieldDefinedService {
|
|||
* @return
|
||||
*/
|
||||
void changeTree(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;
|
||||
|
|
@ -20,7 +21,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;
|
||||
|
|
@ -33,6 +33,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);
|
||||
}
|
||||
|
|
@ -63,7 +67,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");
|
||||
|
|
@ -77,8 +81,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;
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +163,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
if (fieldTypeTreeParam.getId() == null) {
|
||||
ExtendGroupPO extendGroupPO = buildExtendGroupType(moduleTypeEnum, fieldTypeTreeParam);
|
||||
|
|
@ -160,6 +176,17 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
}
|
||||
|
||||
}
|
||||
@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 ExtendTitlePO buildExtendTitleType(ExtendGroupPO extendGroupPO) {
|
||||
return ExtendTitlePO.builder()
|
||||
|
|
|
|||
|
|
@ -124,4 +124,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,8 @@ public class FieldDefinedWrapper extends Service {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public int deleteTitle(ExtendTitleSaveParam param) {
|
||||
return getFieldDefinedService(user).deleteTitle(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue