君创融资二开
parent
f77cb425c5
commit
9435a21446
@ -0,0 +1,21 @@
|
||||
package com.engine.junchuang.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/5/30
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface CheckboxPopedom {
|
||||
|
||||
String id() default "";
|
||||
|
||||
String showmethod() default "";
|
||||
|
||||
String popedompara() default "";
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.engine.junchuang.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/5/30
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface OperatePopedom {
|
||||
|
||||
boolean async() default true;
|
||||
|
||||
String transmethod() default "";
|
||||
|
||||
String otherpara() default "";
|
||||
|
||||
String otherpara2() default "";
|
||||
|
||||
String column() default "";
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.engine.junchuang.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description:
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface OrganizationTableColumn {
|
||||
|
||||
String text() default "";
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String width() default "";
|
||||
|
||||
String column() default "";
|
||||
|
||||
boolean display() default true;
|
||||
|
||||
String orderkey() default "";
|
||||
|
||||
String transmethod() default "";
|
||||
|
||||
// 额外参数
|
||||
String otherPara() default "";
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.engine.junchuang.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description:
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface OrganizationTableOperate {
|
||||
|
||||
String text() default "";
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String href() default "";
|
||||
|
||||
String index() default "0";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.engine.junchuang.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TableTitle {
|
||||
String title();
|
||||
String dataIndex();
|
||||
String key();
|
||||
boolean display() default true;
|
||||
String width() default "";
|
||||
boolean sorter() default false;
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.engine.junchuang.component;
|
||||
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.*;
|
||||
import com.engine.junchuang.annotation.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class OrganizationWeaTable<T> extends WeaTable {
|
||||
|
||||
public OrganizationWeaTable(User user, Class clazz) {
|
||||
|
||||
boolean isAnno = clazz.isAnnotationPresent(OrganizationTable.class);
|
||||
if (isAnno) {
|
||||
OrganizationTable table = (OrganizationTable) clazz.getAnnotation(OrganizationTable.class);
|
||||
String pageId = table.pageId();
|
||||
super.setPageID(pageId);
|
||||
String pageUid = pageId + "_" + user.getUID();
|
||||
super.setPageUID(pageUid);
|
||||
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
||||
super.setPagesize(pageSize);
|
||||
String backfields = table.fields();
|
||||
super.setBackfields(backfields);
|
||||
String sql = table.fromSql();
|
||||
super.setSqlform(sql);
|
||||
String where = table.where();
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
super.setSqlwhere(where);
|
||||
}
|
||||
String orderby = table.orderby();
|
||||
if (StringUtils.isNotBlank(orderby)) {
|
||||
super.setSqlorderby(orderby);
|
||||
}
|
||||
String sortway = table.sortway();
|
||||
if (StringUtils.isNotBlank(sortway)) {
|
||||
super.setSqlsortway(sortway);
|
||||
}
|
||||
String groupby = table.groupby();
|
||||
if (StringUtils.isNotBlank(groupby)) {
|
||||
super.setSqlgroupby(groupby);
|
||||
}
|
||||
boolean distinct = table.distinct();
|
||||
super.setSqlisdistinct(String.valueOf(distinct));
|
||||
String primarykey = table.primarykey();
|
||||
if (StringUtils.isNotBlank(primarykey)) {
|
||||
super.setSqlprimarykey(primarykey);
|
||||
}
|
||||
OrganizationTableOperate[] operates = table.operates();
|
||||
if (operates != null && operates.length > 0) {
|
||||
List<WeaTableOperate> operateList = new ArrayList<>();
|
||||
Arrays.stream(operates).forEach(o -> {
|
||||
String text = o.text();
|
||||
int labelId = o.labelId();
|
||||
String htmlLabelName = SystemEnv.getHtmlLabelName(labelId, user.getLanguage());
|
||||
if (StringUtils.isNotBlank(htmlLabelName)) {
|
||||
text = htmlLabelName;
|
||||
}
|
||||
WeaTableOperate weaTableOperate = new WeaTableOperate(text, o.href(), o.index());
|
||||
operateList.add(weaTableOperate);
|
||||
});
|
||||
WeaTableOperates weaTableOperates = new WeaTableOperates();
|
||||
OperatePopedom popedoms = table.operatePopedom();
|
||||
WeaTablePopedom popedom = new WeaTablePopedom();
|
||||
if (popedoms != null && !"".equals(popedoms.transmethod())) {
|
||||
popedom.setTransmethod(popedoms.transmethod());
|
||||
popedom.setOtherpara(popedoms.otherpara());
|
||||
weaTableOperates.setPopedom(popedom);
|
||||
}
|
||||
weaTableOperates.setOperate(operateList);
|
||||
super.setOperates(weaTableOperates);
|
||||
}
|
||||
|
||||
WeaTableType weaTableTypeEnum = table.tableType();
|
||||
//设置check是否可用
|
||||
if (weaTableTypeEnum == WeaTableType.CHECKBOX) {
|
||||
super.setTableType(weaTableTypeEnum);
|
||||
CheckboxPopedom checkPopedom = table.checkboxPopedom();
|
||||
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
|
||||
if (checkPopedom != null && !"".equals(checkPopedom.showmethod())){
|
||||
checkboxpopedom.setShowmethod(checkPopedom.showmethod());
|
||||
checkboxpopedom.setPopedompara(checkPopedom.popedompara());
|
||||
}
|
||||
super.setCheckboxpopedom(checkboxpopedom);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
boolean isanno = f.isAnnotationPresent(OrganizationTableColumn.class);
|
||||
if (isanno) {
|
||||
OrganizationTableColumn columnAnn = f.getAnnotation(OrganizationTableColumn.class);
|
||||
String text = columnAnn.text();
|
||||
int labelId = columnAnn.labelId();
|
||||
String htmlLabelName = SystemEnv.getHtmlLabelName(labelId, user.getLanguage());
|
||||
if (StringUtils.isNotBlank(htmlLabelName)) {
|
||||
text = htmlLabelName;
|
||||
}
|
||||
String width = columnAnn.width();
|
||||
String column = columnAnn.column();
|
||||
String orderkey = columnAnn.orderkey();
|
||||
boolean display = columnAnn.display();
|
||||
WeaTableColumn weaTableColumn = new WeaTableColumn(width, text, column, orderkey);
|
||||
String transmethod = columnAnn.transmethod();
|
||||
|
||||
if (StringUtils.isNotBlank(transmethod)) {
|
||||
weaTableColumn.setTransmethod(transmethod);
|
||||
}
|
||||
String otherPara = columnAnn.otherPara();
|
||||
if(StringUtils.isNotBlank(otherPara)) {
|
||||
weaTableColumn.setOtherpara(otherPara);
|
||||
}
|
||||
if (!display) {
|
||||
weaTableColumn.setDisplay(WeaBoolAttr.FALSE);
|
||||
}
|
||||
super.getColumns().add(weaTableColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.engine.junchuang.entity.detach.vo;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.junchuang.annotation.OrganizationTable;
|
||||
import com.engine.junchuang.annotation.OrganizationTableColumn;
|
||||
import com.engine.junchuang.annotation.OrganizationTableOperate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "e561e1ba-efad-11ed-8409-00e04c680716",
|
||||
fields = "t.id," +
|
||||
"t.ec_manager," +
|
||||
"t.ec_rolelevel," +
|
||||
"t.manage_module," +
|
||||
"t.creator," +
|
||||
"t.delete_type," +
|
||||
"t.create_time," +
|
||||
"t.update_time",
|
||||
fromSql = "FROM jc_org_detach t ",
|
||||
orderby = "id",
|
||||
sortway = "asc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(index = "0", text = "编辑"),
|
||||
@OrganizationTableOperate(index = "1", text = "删除")
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
public class ManagerDetachVO {
|
||||
|
||||
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@OrganizationTableColumn(text = "管理员", width = "20%", column = "ec_manager", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getManagerName")
|
||||
private Integer ecManager;
|
||||
|
||||
@OrganizationTableColumn(text = "可管理组织机构", width = "40%", column = "ec_rolelevel",transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")
|
||||
private String ecRolelevel;
|
||||
|
||||
|
||||
@OrganizationTableColumn(text = "可管理模块", width = "40%", column = "manage_module")
|
||||
private String manageModule;
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
//package com.engine.junchuang.service;
|
||||
//
|
||||
//
|
||||
//import java.util.Collection;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @Author weaver_cl
|
||||
// * @Description:
|
||||
// * @Date 2022/10/21
|
||||
// * @Version V1.0
|
||||
// **/
|
||||
//public interface ManagerDetachService {
|
||||
//
|
||||
// /**
|
||||
// * 获取table列表
|
||||
// * @param params
|
||||
// * @return
|
||||
// */
|
||||
// Map<String, Object> listPage(Map<String, Object> params);
|
||||
//
|
||||
// /**
|
||||
// * 新建编辑表单
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// Map<String, Object> getForm(Integer id);
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// int deleteByIds(Collection<Long> ids);
|
||||
//
|
||||
// /**
|
||||
// * 新增
|
||||
// * @param param
|
||||
// * @return
|
||||
// */
|
||||
// int save(ManagerDetachParam param);
|
||||
//
|
||||
// /**
|
||||
// * 更新
|
||||
// * @param param
|
||||
// * @return
|
||||
// */
|
||||
// int updateDetach(ManagerDetachParam param);
|
||||
//
|
||||
// /**
|
||||
// * 分权开关
|
||||
// * @param isDetach
|
||||
// */
|
||||
// String doDetach(String isDetach);
|
||||
//}
|
@ -0,0 +1,147 @@
|
||||
//package com.engine.junchuang.service.impl;
|
||||
//
|
||||
//import com.api.browser.bean.SearchConditionGroup;
|
||||
//import com.api.browser.bean.SearchConditionItem;
|
||||
//import com.api.browser.bean.SearchConditionOption;
|
||||
//import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
//import com.engine.core.impl.Service;
|
||||
//import com.engine.junchuang.component.OrganizationWeaTable;
|
||||
//import com.engine.junchuang.entity.detach.vo.ManagerDetachVO;
|
||||
//import com.engine.junchuang.service.ManagerDetachService;
|
||||
//import com.engine.junchuang.util.OrganizationFormItemUtil;
|
||||
//import com.weaver.file.ConfigOperator;
|
||||
//import com.weaver.general.BaseBean;
|
||||
//import org.apache.commons.collections.CollectionUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import weaver.conn.RecordSet;
|
||||
//
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
///**
|
||||
// * @Author weaver_cl
|
||||
// * @Description:
|
||||
// * @Date 2022/10/21
|
||||
// * @Version V1.0
|
||||
// **/
|
||||
//public class ManagerDetachServiceImpl extends Service implements ManagerDetachService {
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
// Map<String, Object> resultMap = new HashMap<>();
|
||||
// //boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
||||
// resultMap.put("hasRight", true);
|
||||
// //if (!hasRight) {
|
||||
// // return resultMap;
|
||||
// //}
|
||||
// OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.class);
|
||||
// String sqlWhere = buildSqlWhere(params);
|
||||
// table.setSqlwhere(sqlWhere);
|
||||
// WeaResultMsg result = new WeaResultMsg(false);
|
||||
// result.putAll(table.makeDataResult());
|
||||
// result.success();
|
||||
// resultMap.putAll(result.getResultMap());
|
||||
//
|
||||
// return resultMap;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, Object> getForm(Integer id) {
|
||||
// Map<String, Object> apiDatas = new HashMap<>();
|
||||
// List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||
// List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
// List<SearchConditionOption> selectOptions = new ArrayList<>();
|
||||
// SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
|
||||
// selectOptions.add(moduleOption);
|
||||
//
|
||||
// SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "管理员", "1", "ecManager", "");
|
||||
// ecManager.setRules("required|string");
|
||||
// SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "分管部门", "194", "ecRolelevel", "");
|
||||
// ecRolelevel.setRules("required|string");
|
||||
// addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
||||
// apiDatas.put("condition", addGroups);
|
||||
// return apiDatas;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int deleteByIds(Collection<Long> ids) {
|
||||
// // return getMangeDetachMapper().deleteByIds(ids);
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int save(ManagerDetachParam param) {
|
||||
// ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
// .managerType(0)
|
||||
// .ecManager(param.getEcManager())
|
||||
// .jclManager(param.getEcManager())
|
||||
// .ecRolelevel(param.getEcRolelevel())
|
||||
// .jclRolelevel(param.getEcRolelevel())
|
||||
// .manageModule("组织管理")
|
||||
// .creator((long)user.getUID())
|
||||
// .deleteType(0)
|
||||
// .createTime(new Date())
|
||||
// .updateTime(new Date())
|
||||
// .build();
|
||||
//
|
||||
// // return getMangeDetachMapper().insertIgnoreNull(managerDetachPO);
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int updateDetach(ManagerDetachParam param) {
|
||||
// ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
// .id(param.getId())
|
||||
// .ecManager(param.getEcManager())
|
||||
// .ecRolelevel(param.getEcRolelevel())
|
||||
// .jclManager(param.getEcManager())
|
||||
// .jclRolelevel(param.getEcRolelevel())
|
||||
// .build();
|
||||
// return getMangeDetachMapper().updateDetach(managerDetachPO);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String doDetach(String isDetach) {
|
||||
// ConfigOperator ConfigOperator = new ConfigOperator();
|
||||
// ConfigOperator.setProp("hrmOrganization.properties", "detach", isDetach);
|
||||
// return new BaseBean().getPropValue("hrmOrganization", "detach");
|
||||
// }
|
||||
//
|
||||
// private String buildSqlWhere(Map<String, Object> params) {
|
||||
// DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
// String sqlWhere = " where delete_type = 0";
|
||||
// String lastName = (String) params.get("ecManager");
|
||||
// List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
|
||||
// String ecManager = StringUtils.join(resourceIds,",");
|
||||
// if (StringUtils.isNotBlank(lastName)) {
|
||||
// sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
||||
// }
|
||||
// String ecRolelevel = (String) params.get("ecRolelevel");
|
||||
// if (StringUtils.isNotBlank(ecRolelevel)) {
|
||||
// sqlWhere += " AND " + dbType.concat("ec_rolelevel") + dbType.like(ecRolelevel);
|
||||
// }
|
||||
// return sqlWhere;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 查询当前人员所辖分部JCL_ID
|
||||
// * @param uId
|
||||
// * @return
|
||||
// */
|
||||
// public static List<Integer> getJclRoleLevels(Integer uId) {
|
||||
// List<Integer> ecRoleLevels = new ArrayList<>();
|
||||
// ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
|
||||
// List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
|
||||
// for (ManagerDetachPO managerDetachPO : detachListById) {
|
||||
// List<Integer> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(ids)) {
|
||||
// ecRoleLevels.addAll(ids);
|
||||
// }
|
||||
// }
|
||||
// return ecRoleLevels;
|
||||
// }
|
||||
//}
|
@ -1,8 +1,9 @@
|
||||
package com.engine.junchuang.service;
|
||||
package com.engine.junchuang.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.junchuang.service.OrgChartService;
|
||||
import com.engine.junchuang.util.OrganizationDateUtil;
|
||||
import com.engine.junchuang.util.db.DBType;
|
||||
import com.engine.junchuang.util.detach.DetachUtil;
|
@ -0,0 +1,40 @@
|
||||
package com.engine.junchuang.transmethod;
|
||||
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/26
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ManagerDetachTransMethod {
|
||||
|
||||
public static String getManagerName(String ecManager) {
|
||||
if (StringUtils.isBlank(ecManager)) {
|
||||
return "";
|
||||
}
|
||||
List<Long> collect = Arrays.stream(ecManager.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
return "";
|
||||
}
|
||||
//Record
|
||||
//List<String> employeeNameById = MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(collect);
|
||||
//return StringUtils.join(employeeNameById, ",");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static String getRoleLevel(String ecRolelevel) {
|
||||
//List<Map<String, Object>> maps = MapperProxyFactory.getProxy(SystemDataMapper.class).getBrowserDatas(DeleteParam.builder().ids(ecRolelevel).build().getIds());
|
||||
//String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
||||
//return names;
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,286 @@
|
||||
package com.engine.junchuang.util;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @description:
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class OrganizationFormItemUtil {
|
||||
|
||||
/**
|
||||
* 下拉框
|
||||
*
|
||||
* @param user
|
||||
* @param selectOptions
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param labelcol
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem selectItem(User user, List<SearchConditionOption> selectOptions, int colSpan, int fieldcol,
|
||||
int labelcol, boolean isQuickSearch, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem select = conditionFactory.createCondition(ConditionType.SELECT, 502327, name);
|
||||
select.setOptions(selectOptions);
|
||||
select.setColSpan(colSpan);
|
||||
select.setFieldcol(fieldcol);
|
||||
select.setLabelcol(labelcol);
|
||||
select.setIsQuickSearch(isQuickSearch);
|
||||
select.setLabel(label);
|
||||
return select;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checkbox
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem checkboxItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, boolean isQuickSearch, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX, 502327, name);
|
||||
checkbox.setColSpan(colSpan);
|
||||
checkbox.setFieldcol(fieldcol);
|
||||
checkbox.setViewAttr(viewAttr);
|
||||
checkbox.setIsQuickSearch(isQuickSearch);
|
||||
checkbox.setLabel(label);
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输入框数字
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem inputNumberItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem inputnumber = conditionFactory.createCondition(ConditionType.INPUTNUMBER, 502327, name);
|
||||
inputnumber.setColSpan(colSpan);
|
||||
inputnumber.setFieldcol(fieldcol);
|
||||
inputnumber.setViewAttr(viewAttr);
|
||||
inputnumber.setLabel(label);
|
||||
return inputnumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输入框文本
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param length
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem inputItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, int length, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem input = conditionFactory.createCondition(ConditionType.INPUT, 25034, name);
|
||||
input.setColSpan(colSpan);
|
||||
input.setFieldcol(fieldcol);
|
||||
input.setViewAttr(viewAttr);
|
||||
input.setLength(length);
|
||||
input.setLabel(label);
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 浏览按钮
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @param type
|
||||
* @param name
|
||||
* @param fieldDbType 数据展现集成标识
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem browserItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, boolean isQuickSearch, String label, String type, String name, String fieldDbType) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem browser = conditionFactory.createCondition(ConditionType.BROWSER, 502327, name, type);
|
||||
browser.setColSpan(colSpan);
|
||||
browser.setFieldcol(fieldcol);
|
||||
browser.setViewAttr(viewAttr);
|
||||
browser.setIsQuickSearch(isQuickSearch);
|
||||
browser.setLabel(label);
|
||||
return browser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期区间
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem rangeDateItem(User user, int colSpan, int fieldcol, int viewAttr
|
||||
, String label, String name1, String name2) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem rangeDate = conditionFactory.createCondition(ConditionType.TIMEPICKER, 502327, new String[]{name1, name2});
|
||||
rangeDate.setColSpan(colSpan);
|
||||
rangeDate.setFieldcol(fieldcol);
|
||||
rangeDate.setViewAttr(viewAttr);
|
||||
rangeDate.setLabel(label);
|
||||
return rangeDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多行文本框
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param isQuickSearch
|
||||
* @param viewAttr
|
||||
* @param length
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem textareaItem(User user, int colSpan, int fieldcol, boolean isQuickSearch,
|
||||
int viewAttr, int length, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem textarea = conditionFactory.createCondition(ConditionType.TEXTAREA, 502227, name);
|
||||
textarea.setColSpan(colSpan);
|
||||
textarea.setFieldcol(fieldcol);
|
||||
textarea.setIsQuickSearch(isQuickSearch);
|
||||
textarea.setViewAttr(viewAttr);
|
||||
textarea.setLength(length);
|
||||
textarea.setLabel(label);
|
||||
|
||||
return textarea;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期组合
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param isQuickSearch
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem dateItem(User user, int colSpan, int fieldcol, boolean isQuickSearch,
|
||||
int viewAttr, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem date = conditionFactory.createCondition(ConditionType.DATE, 502227, name);
|
||||
date.setColSpan(colSpan);
|
||||
date.setFieldcol(fieldcol);
|
||||
date.setIsQuickSearch(isQuickSearch);
|
||||
date.setViewAttr(viewAttr);
|
||||
date.setLabel(label);
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param isQuickSearch
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem datePickerItem(User user, int colSpan, int fieldcol, boolean isQuickSearch,
|
||||
int viewAttr, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem datePicker = conditionFactory.createCondition(ConditionType.DATEPICKER, 502227, name);
|
||||
datePicker.setColSpan(colSpan);
|
||||
datePicker.setFieldcol(fieldcol);
|
||||
datePicker.setIsQuickSearch(isQuickSearch);
|
||||
datePicker.setViewAttr(viewAttr);
|
||||
datePicker.setLabel(label);
|
||||
return datePicker;
|
||||
}
|
||||
|
||||
|
||||
public static SearchConditionItem dateGroupItem(User user, int colSpan, int fieldcol, boolean isQuickSearch,
|
||||
int viewAttr, String label, String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem dateGroup = conditionFactory.createCondition(ConditionType.DATEGROUP, 502227, name);
|
||||
dateGroup.setColSpan(colSpan);
|
||||
dateGroup.setFieldcol(fieldcol);
|
||||
dateGroup.setIsQuickSearch(isQuickSearch);
|
||||
dateGroup.setViewAttr(viewAttr);
|
||||
dateGroup.setLabel(label);
|
||||
List<Object> datas = new ArrayList<>();
|
||||
datas.add(new DateGroupData("全部","0"));
|
||||
datas.add(new DateGroupData("今天","1"));
|
||||
datas.add(new DateGroupData("本周","2"));
|
||||
datas.add(new DateGroupData("本月","3"));
|
||||
datas.add(new DateGroupData("本季","4"));
|
||||
datas.add(new DateGroupData("本年","5"));
|
||||
datas.add(new DateGroupData("上个月","7"));
|
||||
datas.add(new DateGroupData("上一年","8"));
|
||||
datas.add(new DateGroupData("指定日期范围","6"));
|
||||
dateGroup.setDatas(datas);
|
||||
dateGroup.setValue(new ArrayList<>());
|
||||
dateGroup.setDateGroup(true);
|
||||
return dateGroup;
|
||||
}
|
||||
|
||||
static class DateGroupData{
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public DateGroupData(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue