Merge branch 'develop' of https://gitee.com/jmlcl/weaver-hrm-organization into feature/dxf
Conflicts: src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java src/com/engine/organization/service/FieldDefinedService.java src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java src/com/engine/organization/web/FieldDefinedController.java src/com/engine/organization/wrapper/FieldDefinedWrapper.java
This commit is contained in:
commit
3f151d55e6
|
|
@ -22,13 +22,12 @@ public class ExtendGroupBO {
|
|||
|
||||
public static List<TypeTreeVO> buildTypeTree(List<ExtendGroupPO> extendGroupPOS) {
|
||||
|
||||
if (CollectionUtils.isEmpty(extendGroupPOS)) {
|
||||
if(CollectionUtils.isEmpty(extendGroupPOS)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<TypeTreeVO> typeTreeVOS = extendGroupPOS.stream().map(e ->
|
||||
TypeTreeVO.builder()
|
||||
.addChild(e.getId() >= 0)
|
||||
.canClick(true)
|
||||
.domid(String.valueOf(e.getId()))
|
||||
.hasGroup(isHasGroup(e.getId()))
|
||||
|
|
@ -40,12 +39,10 @@ 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);
|
||||
e.setAddChild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);}).filter(item -> item.getPid() == null).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ExtendTitlePO {
|
|||
private String isShow;
|
||||
|
||||
|
||||
private Integer creator;
|
||||
private Long creator;
|
||||
private Integer deleteType;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.mapper.extend;
|
||||
|
||||
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -46,4 +47,11 @@ public interface ExtendGroupMapper {
|
|||
* @return
|
||||
*/
|
||||
String getGroupNameById(@Param("id") String id);
|
||||
|
||||
|
||||
|
||||
void insertIgnoreNull(ExtendGroupPO extendGroupPO);
|
||||
|
||||
|
||||
void update(@Param("id")Long id, @Param("name")String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,5 +67,71 @@
|
|||
and t.id= #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.extend.po.ExtendGroupPO"
|
||||
keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_field_extendgroup
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
|
||||
<if test="extendType != null ">
|
||||
extend_type,
|
||||
</if>
|
||||
<if test="groupName != null ">
|
||||
group_name,
|
||||
</if>
|
||||
<if test="pid != null ">
|
||||
pid,
|
||||
</if>
|
||||
<if test="isShow != null ">
|
||||
is_show,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="extendType != null ">
|
||||
#{extendType},
|
||||
</if>
|
||||
<if test="groupName != null ">
|
||||
#{groupName},
|
||||
</if>
|
||||
<if test="pid != null ">
|
||||
#{pid},
|
||||
</if>
|
||||
<if test="isShow != null ">
|
||||
#{isShow},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update" >
|
||||
update jcl_field_extendgroup
|
||||
<set>
|
||||
group_name=#{name},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.mapper.extend;
|
||||
|
||||
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -12,15 +13,10 @@ import java.util.List;
|
|||
* @version: 1.0
|
||||
*/
|
||||
public interface ExtendInfoMapper {
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param extendType
|
||||
* @param extendGroupId
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
|
||||
List<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType);
|
||||
|
||||
int countFieldsByGroupId(@Param("groupId") Long groupId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ public interface FieldDefinedService {
|
|||
|
||||
/**
|
||||
* 获取左侧树
|
||||
*
|
||||
* @param moduleTypeEnum
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -60,28 +59,12 @@ public interface FieldDefinedService {
|
|||
|
||||
|
||||
/**
|
||||
* 新增类型树
|
||||
*
|
||||
* 新增或编辑类型树
|
||||
* @param moduleTypeEnum
|
||||
* @param fieldTypeTreeParam
|
||||
* @return
|
||||
*/
|
||||
void addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam);
|
||||
void changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam);
|
||||
|
||||
/**
|
||||
* 删除标题信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int deleteTitle(ExtendTitleSaveParam param);
|
||||
|
||||
/**
|
||||
* 获取自定义字段列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getFieldDefinedInfo(ExtendTitleSaveParam param);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
@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) {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -57,30 +57,19 @@ public class FieldDefinedController {
|
|||
}
|
||||
|
||||
@POST
|
||||
@Path("/{moduleTypeEnum}/addTree")
|
||||
@Path("/{moduleTypeEnum}/changeTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult addTree(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
public ReturnResult changeTree(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum, @RequestBody FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return getFieldDefinedWrapper(user).addTree(moduleTypeEnum, fieldTypeTreeParam);
|
||||
return getFieldDefinedWrapper(user).changeTree(moduleTypeEnum,fieldTypeTreeParam);
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{moduleTypeEnum}/editTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult editTree(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@PathParam("moduleTypeEnum") ModuleTypeEnum moduleTypeEnum,@RequestBody FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return getFieldDefinedWrapper(user).getTree(moduleTypeEnum);
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getTabInfo")
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ public class FieldDefinedWrapper extends Service {
|
|||
|
||||
/**
|
||||
* 获取标题分组
|
||||
*
|
||||
* @param groupType
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -54,7 +53,6 @@ public class FieldDefinedWrapper extends Service {
|
|||
|
||||
/**
|
||||
* 新建分组
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -63,11 +61,13 @@ public class FieldDefinedWrapper extends Service {
|
|||
}
|
||||
|
||||
|
||||
public ReturnResult addTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
getFieldDefinedService(user).addTree(moduleTypeEnum, fieldTypeTreeParam);
|
||||
public ReturnResult changeTree(ModuleTypeEnum moduleTypeEnum, FieldTypeTreeParam fieldTypeTreeParam) {
|
||||
getFieldDefinedService(user).changeTree(moduleTypeEnum,fieldTypeTreeParam);
|
||||
return ReturnResult.successed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int deleteTitle(ExtendTitleSaveParam param) {
|
||||
return getFieldDefinedService(user).deleteTitle(param);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue