|
|
|
@ -11,6 +11,7 @@ import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
|
import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam;
|
|
|
|
|
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
|
|
|
|
import com.engine.organization.enums.DeleteTypeEnum;
|
|
|
|
|
import com.engine.organization.enums.ModuleTypeEnum;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendGroupMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
|
|
|
@ -20,6 +21,7 @@ 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;
|
|
|
|
@ -121,7 +123,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null == extendTitle.getId()) {
|
|
|
|
|
extendTitle.setCreator(user.getUID());
|
|
|
|
|
extendTitle.setCreator((long)user.getUID());
|
|
|
|
|
extendTitle.setCreateTime(new Date());
|
|
|
|
|
extendTitle.setDeleteType(0);
|
|
|
|
|
getExtendTitleMapper().insertIgnoreNull(extendTitle);
|
|
|
|
@ -151,11 +153,10 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
extendTitle.setIsShow(param.getIsShow());
|
|
|
|
|
extendTitle.setTitle(param.getGroupName());
|
|
|
|
|
extendTitle.setShowOrder(null == extendTitlePO ? 0 : extendTitlePO.getShowOrder() + 1);
|
|
|
|
|
extendTitle.setCreator(user.getUID());
|
|
|
|
|
extendTitle.setCreator((long)user.getUID());
|
|
|
|
|
extendTitle.setCreateTime(new Date());
|
|
|
|
|
extendTitle.setDeleteType(0);
|
|
|
|
|
getExtendTitleMapper().insertIgnoreNull(extendTitle);
|
|
|
|
|
|
|
|
|
|
ids.add(extendTitle.getId());
|
|
|
|
|
|
|
|
|
|
datas.put("groupid", StringUtils.join(ids, ","));
|
|
|
|
@ -163,26 +164,46 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
buildExtentGroup(moduleTypeEnum, fieldTypeTreeParam);
|
|
|
|
|
}
|
|
|
|
|
public void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
if (fieldTypeTreeParam.getId() == null) {
|
|
|
|
|
ExtendGroupPO extendGroupPO = buildExtendGroupType(moduleTypeEnum, fieldTypeTreeParam);
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendGroupMapper.class).insertIgnoreNull(extendGroupPO);
|
|
|
|
|
//默认新增title
|
|
|
|
|
ExtendTitlePO extendTitlePO = buildExtendTitleType(extendGroupPO);
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendTitleMapper.class).insertIgnoreNull(extendTitlePO);
|
|
|
|
|
}else {
|
|
|
|
|
MapperProxyFactory.getProxy(ExtendGroupMapper.class).update(fieldTypeTreeParam.getId(),fieldTypeTreeParam.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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()
|
|
|
|
|
.groupId(extendGroupPO.getId())
|
|
|
|
|
.title(extendGroupPO.getGroupName())
|
|
|
|
|
.showOrder(1)
|
|
|
|
|
.isShow("1")
|
|
|
|
|
.creator((long) user.getUID())
|
|
|
|
|
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.updateTime(new Date()).build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buildExtentGroup(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
|
|
|
|
|
private ExtendGroupPO buildExtendGroupType(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
|
|
|
|
return ExtendGroupPO.builder()
|
|
|
|
|
.extendType(moduleTypeEnum.getValue())
|
|
|
|
|
.groupName(fieldTypeTreeParam.getName())
|
|
|
|
|
.creator((long) user.getUID())
|
|
|
|
|
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.pid(fieldTypeTreeParam.getParentid())
|
|
|
|
|
.isShow(fieldTypeTreeParam.getIsShow() == null ? "1" : fieldTypeTreeParam.getIsShow()).build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|