透视图分权、部门负责人展示

jcgj
dxfeng 2 years ago
parent b2fbe17b6d
commit cf9d05beee

@ -1,13 +0,0 @@
package com.api.jygf.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/9
* @Version V1.0
**/
@Path("/mobile/permission")
public class MobilePermissionsAction extends com.engine.jygf.web.MobilePermissionsAction {
}

@ -1,21 +0,0 @@
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 "";
}

@ -1,25 +0,0 @@
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 "";
}

@ -1,81 +0,0 @@
package com.engine.junchuang.annotation;
import com.cloudstore.eccom.pc.table.WeaTableType;
import java.lang.annotation.*;
/**
* @Author dxfeng
* @Description:
* @Date 2022/5/9
* @Version V1.0
**/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface OrganizationTable {
String pageId() default "";
/**
* ',',:"id, name, description"
*/
String fields() default "";
/**
* ,:"FROM hrsa_tax_agent"
*/
String fromSql() default "";
/**
*
*/
String where() default "";
/**
*
*/
String groupby() default "";
/**
*
*/
String orderby() default "";
/**
*
*/
String primarykey() default "";
/**
*
*/
boolean distinct() default false;
/**
*
* @return
*/
String sortway() default "desc";
/**
*
*/
OrganizationTableOperate[] operates() default {};
/**
*
* @return
*/
OperatePopedom operatePopedom() default @OperatePopedom;
/**
*
*/
WeaTableType tableType() default WeaTableType.NONE;
CheckboxPopedom checkboxPopedom() default @CheckboxPopedom;
}

@ -1,32 +0,0 @@
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 "";
}

@ -1,27 +0,0 @@
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";
}

@ -1,16 +0,0 @@
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;
}

@ -1,129 +0,0 @@
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);
}
}
}
}

@ -1,59 +0,0 @@
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;
}

@ -35,16 +35,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
String sql = "select id, fnumber, fname, ftype from junc_org_map where ftype in (0, 1) ";
// 分部分权过滤
//DetachUtil detachUtil = new DetachUtil(user.getUID());
//if (detachUtil.isDETACH()) {
// String jclRoleLevels = detachUtil.getJclRoleLevels();
// if (StringUtils.isNotBlank(jclRoleLevels)) {
// sql = "select id, fnumber, fname, ftype from junc_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) ";
// } else {
// sql = "select id, fnumber, fname, ftype from junc_org_map where ftype = 0 ";
// }
//}
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
@ -149,9 +139,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
String whereSql = userWhereSql(request2Map);
String bmfzr = "";
if (id.contains("_")) {
whereSql += " and ftype = 3 ";
} else if (Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) {
if (!id.contains("_") && Integer.parseInt(id) > 100000000 && Integer.parseInt(id) < 200000000) {
rs.executeQuery("select bmfzr from hrmdepartmentdefined where deptid =? ", Integer.parseInt(id) - 100000000);
if (rs.next()) {
bmfzr = rs.getString("bmfzr");
@ -165,18 +153,18 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype = 2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
whereSql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' ";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
//whereSql += " and t.fparentid = " + id.split("_")[0];
whereSql += " and t.fparentid = " + id.split("_")[0] + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
}
}
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//whereSql += " and ((t.fparentid = " + id.split("_")[0] + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
whereSql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' ";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
whereSql += " and t.fparentid = " + id.split("_")[0];
@ -450,7 +438,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
if ("3".equals(type)) {
manageDeptId = id;
id = id.split("_")[0];
sql += " and ftype = 3 ";
//sql += " and ftype = 3 ";
}
@ -461,7 +449,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
sql += " and ((t.fparentid = " + id + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//sql += " and ((t.fparentid = " + id + " and t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
sql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' ";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
sql += " and t.fparentid = " + id + " and ((t.ftype =2 and t.fobjid in(" + detachUtil.getDepartmentIds() + ")) or (t.ftype = 3 ))";
@ -470,7 +459,8 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} else {
if (StringUtils.isNotBlank(bmfzr)) {
bmfzr = bmfzr.split(",")[0];
sql += " and ((t.fparentid = " + id + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
//sql += " and ((t.fparentid = " + id + " and t.ftype =2 ) or (t.ftype = 3 and fobjid = '" + bmfzr + "'))";
sql += " and t.ftype = 3 and fobjid = '" + bmfzr + "' ";
bmfzr = String.valueOf(200000000 + Integer.parseInt(bmfzr));
} else {
sql += " and t.fparentid = " + id;
@ -506,7 +496,6 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fisvitual", rs.getString("fisvitual"));
if (bmfzr.equals(item.get("id"))) {
// TODO
item.put("id", id + "_" + bmfzr);
item.put("parentId", id);
item.put("hasChildren", hasChildren(id, false));

@ -1,40 +0,0 @@
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 "";
}
}

@ -1,29 +0,0 @@
package com.engine.junchuang.util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
/**
* @description:
* @author:dxfeng
* @createTime: 2022/06/07
* @version: 1.0
*/
public class HasRightUtil {
/**
*
*
* @param user
* @param rightName
* @param isReturnFalse
* @return
*/
public static boolean hasRight(User user, String rightName, boolean isReturnFalse) {
boolean hasRight = HrmUserVarify.checkUserRight(rightName, user);
if (!isReturnFalse) {
OrganizationAssert.isTrue(hasRight, "暂无权限访问");
}
return hasRight;
}
}

@ -1,162 +0,0 @@
package com.engine.junchuang.util;
import com.engine.junchuang.exception.OrganizationRunTimeException;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.Collection;
import java.util.Map;
/**
* @Author weaver_cl
* @description:
* @Date 2022/4/26
* @Version V1.0
**/
public abstract class OrganizationAssert {
/**
* null
*
* @param object
* @param message
*/
public static void notNull(Object object, String message) {
if (object == null) {
throw new OrganizationRunTimeException(message);
}
}
/**
* null
*
* @param message
* @param objects
*/
public static void notNull(String message, Object... objects) {
for (Object obj : objects) {
if (obj == null) {
throw new OrganizationRunTimeException(message);
}
}
}
/**
* null
*
* @param object
* @param message
*/
public static void isNull(Object object, String message) {
if (object != null) {
throw new OrganizationRunTimeException(message);
}
}
/**
*
*
* @param collection
* @param message
*/
public static void isEmpty(Collection<?> collection, String message) {
if (!CollectionUtils.isEmpty(collection)) {
throw new OrganizationRunTimeException(message);
}
}
/**
*
*
* @param collection
* @param message
*/
public static void notEmpty(Collection<?> collection, String message) {
if (CollectionUtils.isEmpty(collection)) {
throw new OrganizationRunTimeException(message);
}
}
/**
*
*
* @param arr
* @param message
*/
public static void notEmpty(Object[] arr, String message) {
if (ObjectUtils.isEmpty(arr)) {
throw new OrganizationRunTimeException(message);
}
}
/**
* map
*
* @param map
* @param message
*/
public static void notEmpty(Map<?, ?> map, String message) {
if (CollectionUtils.isEmpty(map)) {
throw new OrganizationRunTimeException(message);
}
}
/**
*
*
* @param arr
* @param message
*/
public static void notNullElement(Object[] arr, String message) {
if (arr != null) {
for (Object obj : arr) {
if (obj == null) {
throw new OrganizationRunTimeException(message);
}
}
}
}
/**
* boolean
*
* @param expression
* @param message
*/
public static void isTrue(boolean expression, String message) {
if (!expression) {
throw new OrganizationRunTimeException(message);
}
}
public static void isFalse(boolean expression, String message) {
if (expression) {
throw new OrganizationRunTimeException(message);
}
}
public static void isBlank(CharSequence cs, String message) {
int strLen;
if (cs != null && (strLen = cs.length()) != 0) {
for (int i = 0; i < strLen; ++i) {
if (!Character.isWhitespace(cs.charAt(i))) {
throw new OrganizationRunTimeException(message);
}
}
}
}
public static void notBlank(CharSequence cs, String message) {
int strLen;
if (cs != null && (strLen = cs.length()) != 0) {
for (int i = 0; i < strLen; ++i) {
if (Character.isWhitespace(cs.charAt(i))) {
throw new OrganizationRunTimeException(message);
}
}
}
if (cs == null || cs.length() == 0) {
throw new OrganizationRunTimeException(message);
}
}
}

@ -1,286 +0,0 @@
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;
}
}
}

@ -1,74 +0,0 @@
/**
*
*/
package com.engine.junchuang.util.db;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
public class MapperProxyFactory implements InvocationHandler {
private Class clazz;
private boolean enableTransactions = false;
private SqlSession session;
public MapperProxyFactory(Class clazz) {
this.clazz = clazz;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
if (this.session == null) {
this.session = MyBatisFactory.sqlSessionFactory.openSession();
}
try {
Object target = session.getMapper(clazz);
return method.invoke(target, args);
} finally {
if (!enableTransactions) {
session.commit();
session.close();
}
}
}
public Object getProxy() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class<?>[] interfaces = new Class<?>[1];
interfaces[0] = this.clazz;
return Proxy.newProxyInstance(loader, interfaces, this);
}
public Object getProxy(boolean enableTransactions) {
this.enableTransactions = enableTransactions;
return this.getProxy();
}
public void commit() {
if (this.session != null) {
this.session.commit();
this.session.close();
}
}
public void rollback() {
if (this.session != null) {
this.session.rollback();
this.session.close();
}
}
public static <T> T getProxy(Class<T> clazz) {
MapperProxyFactory handle = new MapperProxyFactory(clazz);
return (T) handle.getProxy();
}
public static <T> T getProxy(Class<T> clazz, boolean enableTransactions) {
MapperProxyFactory handle = new MapperProxyFactory(clazz);
return (T) handle.getProxy(enableTransactions);
}
}

@ -35,6 +35,9 @@ public class DetachUtil {
List<String> ids = Arrays.asList(allSupDepartment.split(","));
departmentIds.addAll(ids);
}
ArrayList<String> childDeptIds = new ArrayList<>();
new DepartmentComInfo().getAllChildDeptByDepId(childDeptIds, departmentId);
departmentIds.addAll(childDeptIds);
departmentIds.add(departmentId);
String subCompanyId = rs.getString("subcompanyid1");
String allSupCompany = new SubCompanyComInfo().getAllSupCompany(subCompanyId);

@ -1,68 +0,0 @@
package com.engine.jygf.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
import java.util.*;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/9
* @Version V1.0
**/
public class MobilePermissionsCmd extends AbstractCommonCommand<Map<String, Object>> {
private static final String FIELDID = "field100026"; //移动电话自定义字段
private static final String SCOPE = "HrmCustomFieldByInfoType";
private static final String SCOPEID = "-1";
public MobilePermissionsCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> data = new HashMap<>();
String uid = Utils.null2String(user.getUID());
RecordSet rs = new RecordSet();
HashSet<String> ids = new HashSet<>();
ids.add(uid);
rs.executeQuery("select ckr,bckr from uf_yddhqx_dt1");
while (rs.next()) {
String ckr = Utils.null2String(rs.getString("ckr"));
String bckr = Utils.null2String(rs.getString("bckr"));
if (Arrays.asList(ckr.split(",")).contains(uid)) {
ids.addAll(Arrays.asList(bckr.split(",")));
}
}
Map<String,String> mobileInfo = new HashMap<>();
String value = StringUtils.join(ids,",");
rs.executeQuery("select id,"+FIELDID+" from cus_fielddata where scope = ? and scopeid = ?" +
" and id in ("+value+")",SCOPE,SCOPEID);
while (rs.next()){
mobileInfo.put(Utils.null2String(rs.getString("id")),rs.getString(FIELDID));
}
data.put("ids",ids);
data.put("mobileInfo",mobileInfo);
return data;
}
}

@ -1,16 +0,0 @@
package com.engine.jygf.service;
import weaver.hrm.User;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/9
* @Version V1.0
**/
public interface MobilePermissionsService {
Map<String, Object> getPermissionInfo(Map<String, Object> params, User user);
}

@ -1,24 +0,0 @@
package com.engine.jygf.service.impl;
import com.engine.core.impl.Service;
import com.engine.jygf.cmd.MobilePermissionsCmd;
import com.engine.jygf.service.MobilePermissionsService;
import weaver.hrm.User;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/9
* @Version V1.0
**/
public class MobilePermissionsServiceImpl extends Service implements MobilePermissionsService {
@Override
public Map<String, Object> getPermissionInfo(Map<String, Object> params, User user) {
return commandExecutor.execute(new MobilePermissionsCmd(params,user));
}
}

@ -1,57 +0,0 @@
package com.engine.jygf.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.jygf.service.MobilePermissionsService;
import com.engine.jygf.service.impl.MobilePermissionsServiceImpl;
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.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/9
* @Version V1.0
**/
public class MobilePermissionsAction {
public MobilePermissionsService getMobilePermissionsService(User user) {
return ServiceUtil.getService(MobilePermissionsServiceImpl.class,user);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/controller")
@Produces(MediaType.APPLICATION_JSON)
public String getPermissionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<>();
try {
User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理
apidatas = getMobilePermissionsService(user).getPermissionInfo(ParamUtil.request2Map(request), user);
} catch (Exception e) {
//异常处理
apidatas.put("api_status", false);
}
return JSONObject.toJSONString(apidatas);
}
}
Loading…
Cancel
Save