标准组件代码示例
parent
62d0ed3621
commit
d2578701cb
@ -0,0 +1,22 @@
|
||||
package com.engine.attendance.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:38 PM
|
||||
* @param:
|
||||
* @return:
|
||||
*/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface CheckboxPopedom {
|
||||
|
||||
String id() default "";
|
||||
|
||||
String showmethod() default "";
|
||||
|
||||
String popedompara() default "";
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.engine.attendance.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:36 PM
|
||||
* @param:
|
||||
* @return:
|
||||
*/
|
||||
@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.attendance.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,22 @@
|
||||
package com.engine.attendance.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
@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.attendance.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.attendance.component;
|
||||
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.*;
|
||||
import com.engine.attendance.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,74 @@
|
||||
package com.engine.attendance.entity.scheme.vo;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.attendance.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "98e9c62f-cd12-11ec-a15f-00ffcbed7508",
|
||||
fields = "t.id," +
|
||||
"t.scheme_no," +
|
||||
"t.scheme_name," +
|
||||
"t.scheme_description," +
|
||||
"t.forbidden_tag," +
|
||||
"t.subcompanyid," +
|
||||
"t.is_used," +
|
||||
"t.creator," +
|
||||
"t.delete_type," +
|
||||
"t.create_time," +
|
||||
"t.update_time",
|
||||
fromSql = "FROM jcl_org_scheme t ",
|
||||
orderby = "scheme_no",
|
||||
sortway = "asc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(index = "0", text = "编辑"),
|
||||
@OrganizationTableOperate(index = "1", text = "删除")
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
public class SchemeTableVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
/**
|
||||
* 是否被引用
|
||||
*/
|
||||
@OrganizationTableColumn(column = "isUsed", display = false)
|
||||
private Integer isUsed;
|
||||
|
||||
/**
|
||||
* 方案编号
|
||||
*/
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "scheme_no", orderkey = "scheme_no")
|
||||
private String schemeNo;
|
||||
/**
|
||||
* 方案名称
|
||||
*/
|
||||
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "scheme_name")
|
||||
private String schemeName;
|
||||
|
||||
@OrganizationTableColumn(text = "所属分部", width = "25%", column = "subcompanyid",transmethod = "com.engine.organization.transmethod.CompTransMethod.getSpanById")
|
||||
private String subCompanyName;
|
||||
|
||||
/**
|
||||
* 方案描述
|
||||
*/
|
||||
@OrganizationTableColumn(text = "方案说明", width = "40%", column = "scheme_description")
|
||||
private String schemeDescription;
|
||||
|
||||
/**
|
||||
* 禁用标识
|
||||
*/
|
||||
@OrganizationTableColumn(text = "是否启用", width = "10%", column = "forbidden_tag")
|
||||
private Integer forbiddenTag;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.engine.jclattendance.exception;
|
||||
package com.engine.attendance.exception;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
@ -1,4 +1,4 @@
|
||||
package com.engine.jclattendance.util;
|
||||
package com.engine.attendance.util;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
@ -0,0 +1,341 @@
|
||||
package com.engine.attendance.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
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 com.engine.organization.entity.browser.po.CustomBrowserBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:48 PM
|
||||
* @param:
|
||||
* @return:
|
||||
*/
|
||||
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);
|
||||
if ("161".equals(type) || "162".equals(type)) {
|
||||
fieldDbType = "browser." + fieldDbType;
|
||||
BrowserBean browserBean = new BrowserBean();
|
||||
// completeParams
|
||||
Map<String, Object> completeMap = new HashMap<>();
|
||||
completeMap.put("f_weaver_belongto_usertype", 0);
|
||||
completeMap.put("type", type);
|
||||
completeMap.put("fielddbtype", fieldDbType);
|
||||
browserBean.setCompleteParams(completeMap);
|
||||
// conditionDataParams
|
||||
Map<String, Object> conditionDataMap = new HashMap<>();
|
||||
conditionDataMap.put("f_weaver_belongto_usertype", 0);
|
||||
conditionDataMap.put("type", fieldDbType);
|
||||
conditionDataMap.put("fielddbtype", fieldDbType);
|
||||
browserBean.setConditionDataParams(conditionDataMap);
|
||||
// dataParams
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("f_weaver_belongto_usertype", 0);
|
||||
dataMap.put("type", fieldDbType);
|
||||
browserBean.setDataParams(dataMap);
|
||||
// destDataParams
|
||||
Map<String, Object> destDataMap = new HashMap<>();
|
||||
destDataMap.put("f_weaver_belongto_usertype", 0);
|
||||
destDataMap.put("type", fieldDbType);
|
||||
browserBean.setDestDataParams(destDataMap);
|
||||
|
||||
browserBean.setLinkUrl("");
|
||||
browserBean.setMobileLinkUrl("");
|
||||
browserBean.setPageSize(10);
|
||||
browserBean.setScrollx(true);
|
||||
browserBean.setTitle(label);
|
||||
browserBean.setType(type);
|
||||
|
||||
browser.setBrowserConditionParam(browserBean);
|
||||
if ("162".equals(type)) {
|
||||
HashMap<String, Object> otherMap = new HashMap<>();
|
||||
otherMap.put("isMultCheckbox", "true");
|
||||
otherMap.put("icon", "icon-coms-integration");
|
||||
browser.setOtherParams(otherMap);
|
||||
}
|
||||
}
|
||||
if ("666".equals(type)) {
|
||||
BrowserBean browserBean = browser.getBrowserConditionParam();
|
||||
String s = JSONObject.toJSONString(browserBean);
|
||||
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
|
||||
customBrowserBean.setHasLeftTree(true);
|
||||
customBrowserBean.setLeftToSearchKey("treeKey");
|
||||
browser.setBrowserConditionParam(customBrowserBean);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package com.engine.jclattendance.util;
|
||||
package com.engine.attendance.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.jclattendance.exception.CustomizeRunTimeException;
|
||||
import com.engine.attendance.exception.CustomizeRunTimeException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
@ -0,0 +1,85 @@
|
||||
package com.engine.attendance.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.attendance.service.WorkRulesService;
|
||||
import com.engine.attendance.service.impl.WorkRulesServiceImpl;
|
||||
import com.engine.attendance.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/12/26 6:52 PM
|
||||
* @Description: 标准组件示例代码
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class WorkRulesController {
|
||||
|
||||
private WorkRulesService getReportCollectService(User user) {
|
||||
return ServiceUtil.getService(WorkRulesServiceImpl.class,user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 方案一 Table
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:25 PM
|
||||
* @param: [request, response, resourceIds]
|
||||
* @return: java.lang.String
|
||||
*/
|
||||
@GET
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getWorkRulesList(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("resourceIds") String resourceIds) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, Object>>(user).run(getReportCollectService(user) :: getWorkRulesList,resourceIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 方案二 Table 注解形式
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:27 PM
|
||||
* @param: [request, response]
|
||||
* @return: com.engine.organization.util.response.ReturnResult
|
||||
*/
|
||||
@GET
|
||||
@Path("/getTable")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listScheme(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getReportCollectService(user) :: getWorkRulesList1,map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 高级搜索 表单等标准组件返回格式
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/1/15 4:44 PM
|
||||
* @param: [request, response]
|
||||
* @return: java.lang.String
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSchemeForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSchemeForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getReportCollectService(user) :: getSchemeForm,map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package com.engine.jclattendance.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.jclattendance.service.WorkRulesService;
|
||||
import com.engine.jclattendance.service.impl.WorkRulesServiceImpl;
|
||||
import com.engine.jclattendance.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/12/26 6:52 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class WorkRulesController {
|
||||
|
||||
private WorkRulesService getReportCollectService(User user) {
|
||||
return ServiceUtil.getService(WorkRulesServiceImpl.class,user);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getWorkRulesList(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("resourceIds") String resourceIds) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, Object>>(user).run(getReportCollectService(user) :: getWorkRulesList,resourceIds);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue