Commit d19747a2 by 宋祥

Merge branch 'dev-sx' of http://git.pseer.com:8800/platform/hg-smart into dev

 Conflicts:
	src/main/java/com/baosight/hggp/hg/wd/domain/HGWD001.java
	src/main/java/com/baosight/hggp/hg/wd/sql/HGWD001.xml
	src/main/webapp/HG/SC/HGSC101.jsp
parents c3d1aa21 505308d1
...@@ -88,6 +88,10 @@ public class CommonConstant { ...@@ -88,6 +88,10 @@ public class CommonConstant {
public static final String PRODUCTTION_ORDER_NO = "productionOrderNo"; public static final String PRODUCTTION_ORDER_NO = "productionOrderNo";
// ROOT // ROOT
public static final String ROOT = "root"; public static final String ROOT = "root";
// ROOT2
public static final String ROOT2 = "$";
// NODE
public static final String NODE = "node";
// 项目档案ID // 项目档案ID
public static final String PROJ_ID = "projId"; public static final String PROJ_ID = "projId";
// 企业管理员 // 企业管理员
......
package com.baosight.hggp.core.api; package com.baosight.hggp.core.extapp.baidu;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
package com.baosight.hggp.core.extapp.decheng.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author:songx
* @date:2021/3/20,21:38
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface AliasNameAnon {
/**
* 名称
*
* @return
*/
String name() default "";
}
package com.baosight.hggp.core.extapp.decheng.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.extapp.decheng.model.DcChance;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.extapp.decheng.model.DcDeptList;
import com.baosight.hggp.core.extapp.decheng.model.DcUser;
import com.baosight.hggp.core.extapp.decheng.model.DcUserList;
import com.baosight.hggp.core.extapp.decheng.utils.DcApiUtils;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.util.HttpUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import java.io.IOException;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* 德诚开放平台
*
* @author:songx
* @date:2024/1/29,9:16
*/
@Slf4j
public class DcOpenApi {
/**
* 部门管理-列表
*
* @param pageIndex 当前页
*/
public static Pager<DcDeptList> deptList(int pageIndex) throws IOException, InstantiationException,
IllegalAccessException {
JSONObject paramJson = DcApiUtils.buildParamJson(pageIndex);
String result = HttpUtils.post(DeChengConst.DEPT_LIST, DcApiUtils.buildHeader(), JSON.toJSONString(paramJson),
HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取部门管理列表失败");
}
return DcApiUtils.handleResultV3(result, DcDeptList.class);
}
/**
* 用户管理-列表
*
* @param pageIndex 当前页
*/
public static Pager<DcUserList> userList(int pageIndex)
throws IOException, InstantiationException, IllegalAccessException {
JSONObject paramJson = DcApiUtils.buildParamJson(pageIndex);
String result = HttpUtils.post(DeChengConst.USER_LIST, DcApiUtils.buildHeader(), JSON.toJSONString(paramJson),
HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取用户管理列表失败");
}
return DcApiUtils.handleResultV3(result, DcUserList.class);
}
/**
* 用户管理-详情
*
* @param ord 单据ID
*/
public static DcUser userDetail(int ord) throws IOException {
JSONObject paramJson = new JSONObject();
paramJson.put("ord", ord);
String result = HttpUtils.post(DeChengConst.USER_DETAIL, DcApiUtils.buildHeader(true),
JSON.toJSONString(paramJson), HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取用户管理详情失败");
}
return DcApiUtils.handleResultDetailV3(result, DcUser.class);
}
/**
* 项目管理-列表
*
* @param startTime 开始日期 20240815
* @param endTime 结束日期 20240820
* @param pageIndex 当前页
*/
public static List<DcChance> chanceList(String startTime, String endTime, int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("a_date_0", startTime));
dataJsons.add(DcApiUtils.buildValueJson("a_date_1", endTime));
dataJsons.add(DcApiUtils.buildValueJson("pageindex", pageIndex));
dataJsons.add(DcApiUtils.buildValueJson("pagesize", 100));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons));
String result = HttpUtils.post(DeChengConst.CHANCE_LIST, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取项目管理列表失败");
}
return DcApiUtils.handleResult(result, DcChance.class);
}
/**
* 合同管理-列表
*
* @param pageIndex 当前页
*/
public static List<DcContractList> contactList(int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("pageindex", pageIndex));
dataJsons.add(DcApiUtils.buildValueJson("pagesize", 100));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons));
String result = HttpUtils.post(DeChengConst.CONTRACT_LIST, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取合同管理列表失败");
}
return DcApiUtils.handleResult(result, DcContractList.class);
}
/**
* 工作互动-添加
*
* @param title 主题
* @param content 内容
* @param ords 人员标识,多个逗号隔开
* @return
* @throws IOException
*/
public static List<DcContractList> interactionAdd(String title, String content, String ords) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("title", title));
dataJsons.add(DcApiUtils.buildValueJson("sort2", 451)); // 451:默认分类
dataJsons.add(DcApiUtils.buildValueJson("intro", content));
dataJsons.add(DcApiUtils.buildValueJson("member", 1));
dataJsons.add(DcApiUtils.buildValueJson("share", ords));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons, "__sys_dosave"));
String result = HttpUtils.post(DeChengConst.INTERACTION_ADD, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】添加工作互动失败");
}
return DcApiUtils.handleResult(result, DcContractList.class);
}
}
package com.baosight.hggp.core.api; package com.baosight.hggp.core.extapp.decheng.api;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.constant.ZhiBangConst; import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.model.zhiBang.Chance;
import com.baosight.hggp.util.HttpUtils; import com.baosight.hggp.util.HttpUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -22,7 +17,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -22,7 +17,7 @@ import lombok.extern.slf4j.Slf4j;
* @date:2024/1/29,9:16 * @date:2024/1/29,9:16
*/ */
@Slf4j @Slf4j
public class ZhiBangApi { public class DcTokenApi {
/** /**
* 获取TOKEN * 获取TOKEN
...@@ -30,7 +25,7 @@ public class ZhiBangApi { ...@@ -30,7 +25,7 @@ public class ZhiBangApi {
* @return * @return
*/ */
public static String getToken() { public static String getToken() {
String token = SingletonHolder.TOKEN; String token = SingletonHolder.getToken();
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
throw new PlatException("zhi bang token is null!"); throw new PlatException("zhi bang token is null!");
} }
...@@ -38,115 +33,29 @@ public class ZhiBangApi { ...@@ -38,115 +33,29 @@ public class ZhiBangApi {
} }
/** /**
* 刷新TOKEN * 获取TOKEN(缓存)
* *
* @return * @return
*/ */
public static void refreshToken() { public static String getTokenCache() {
SingletonHolder.refresh(); String token = SingletonHolder.TOKEN;
} if (StringUtils.isNotBlank(token)) {
return token;
/**
* 项目管理-列表
*
* @param startTime 开始日期
* @param endTime 结束日期
* @param pageIndex 当前页
*/
public static List<Chance> chanceList(String startTime, String endTime, int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(buildValueJson("a_date_0", startTime));
dataJsons.add(buildValueJson("a_date_1", endTime));
dataJsons.add(buildValueJson("pageindex", pageIndex));
dataJsons.add(buildValueJson("pagesize", 100));
String param = JSON.toJSONString(buildParamJson(dataJsons));
String result = HttpUtils.post(ZhiBangConst.CHANCE_LIST, param, HttpUtils.FORM_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【智邦】获取项目管理列表失败");
} }
return handleResult(result, Chance.class); if (refreshToken()) {
} return SingletonHolder.TOKEN;
} else {
/** throw new PlatException("zhi bang token is null!");
* 组装数据
*
* @return
*/
private static JSONObject buildParamJson(JSONArray dataJsons) {
JSONObject paramJson = new JSONObject();
paramJson.put("session", getToken());
paramJson.put("cmdkey", "refresh");
paramJson.put("datas", dataJsons);
return paramJson;
}
/**
* 组装值的json
*
* @param id
* @param val
* @return
*/
private static JSONObject buildValueJson(String id, Object val) {
JSONObject valueJson = new JSONObject();
valueJson.put("id", id);
valueJson.put("val", val);
return valueJson;
}
/**
* 构建返回结果对象
*
* @param result
* @return
*/
private static <T> List<T> handleResult(String result, Class<T> clazz) {
JSONObject resultJson = JSONObject.parseObject(result);
// 异常处理
handleMessage(resultJson);
// 构建结果数据集
return buildTableData(resultJson, clazz);
}
/**
* 处理返回消息
*
* @param resultJson
*/
private static void handleMessage(JSONObject resultJson) {
JSONObject headerJson = resultJson.getJSONObject("header");
String message = headerJson.getString("message");
String status = headerJson.getString("status");
// 会话非法
if (ZhiBangConst.ApiStatus.S_2.equals(status)) {
refreshToken();
throw new PlatException("【智邦】" + message);
} }
} }
/** /**
* 构建数据集 * 刷新TOKEN
* *
* @param resultJson
* @param clazz
* @param <T>
* @return * @return
*/ */
private static <T> List<T> buildTableData(JSONObject resultJson, Class<T> clazz) { public static boolean refreshToken() {
JSONObject bodyJson = resultJson.getJSONObject("body"); return SingletonHolder.refresh();
JSONObject sourceJson = bodyJson.getJSONObject("source");
JSONObject tableJson = sourceJson.getJSONObject("table");
JSONArray colJsons = tableJson.getJSONArray("cols");
JSONArray rowJsons = tableJson.getJSONArray("rows");
return rowJsons.stream().map(item -> {
JSONArray singleRowJsons = (JSONArray) item;
// rowJsons存储的是行数据的为二维数组,长度与colJson相同
JSONObject rowValueJson = new JSONObject();
for (int j = 0; j < colJsons.size(); j++) {
rowValueJson.put(colJsons.getJSONObject(j).getString("id"), singleRowJsons.get(j));
}
return rowValueJson.toJavaObject(clazz);
}).collect(Collectors.toList());
} }
/** /**
...@@ -167,8 +76,13 @@ public class ZhiBangApi { ...@@ -167,8 +76,13 @@ public class ZhiBangApi {
* *
* @return * @return
*/ */
public static void refresh() { public static boolean refresh() {
TOKEN = getToken(); String token = getToken();
if (StringUtils.isBlank(token)) {
return false;
}
TOKEN = token;
return true;
} }
/** /**
...@@ -176,10 +90,10 @@ public class ZhiBangApi { ...@@ -176,10 +90,10 @@ public class ZhiBangApi {
* *
* @return * @return
*/ */
private static String getToken() { public static String getToken() {
try { try {
String param = JSON.toJSONString(buildParamJson()); String param = JSON.toJSONString(buildParamJson());
String result = HttpUtils.post(ZhiBangConst.TOKEN_URL, param, HttpUtils.JSON_MEDIA_TYPE); String result = HttpUtils.post(DeChengConst.TOKEN_URL, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) { if (StringUtils.isBlank(result)) {
log.error("获取智邦API的TOKEN失败,接口返回null"); log.error("获取智邦API的TOKEN失败,接口返回null");
return null; return null;
...@@ -215,12 +129,25 @@ public class ZhiBangApi { ...@@ -215,12 +129,25 @@ public class ZhiBangApi {
*/ */
private static JSONArray buildDataJson() { private static JSONArray buildDataJson() {
JSONArray dataJsons = new JSONArray(); JSONArray dataJsons = new JSONArray();
dataJsons.add(buildValueJson("user", "txt:" + ZhiBangConst.API_KEY)); dataJsons.add(buildValueJson("user", "txt:" + DeChengConst.API_KEY));
dataJsons.add(buildValueJson("password", "txt:" + ZhiBangConst.SECRET_KEY)); dataJsons.add(buildValueJson("password", "txt:" + DeChengConst.SECRET_KEY));
dataJsons.add(buildValueJson("serialnum", "txt:qwert12345")); dataJsons.add(buildValueJson("serialnum", "txt:abcd1234"));
return dataJsons; return dataJsons;
} }
/**
* 组装值的json
*
* @param id
* @param val
* @return
*/
private static JSONObject buildValueJson(String id, Object val) {
JSONObject valueJson = new JSONObject();
valueJson.put("id", id);
valueJson.put("val", val);
return valueJson;
}
} }
} }
package com.baosight.hggp.core.constant; package com.baosight.hggp.core.extapp.decheng.constant;
/** /**
* @author:songx * @author:songx
* @date:2024/8/9,15:46 * @date:2024/8/9,15:46
*/ */
public class ZhiBangConst { public class DeChengConst {
/** /**
* Api Key * Api Key
...@@ -19,12 +19,42 @@ public class ZhiBangConst { ...@@ -19,12 +19,42 @@ public class ZhiBangConst {
/** /**
* 鉴权接口 * 鉴权接口
*/ */
public static final String TOKEN_URL = "http://1.202.243.190:32131/webapi/v3/ov1/login"; public static final String TOKEN_URL = "http://106.15.43.147:6099/webapi/v3/ov1/login";
/**
* 部门管理-列表
*/
public static final String DEPT_LIST = "http://106.15.43.147:6099/webapi/v3/orgs/dept/list";
/**
* 账号管理-列表
*/
public static final String USER_LIST = "http://106.15.43.147:6099/webapi/v3/orgs/user/list";
/**
* 账号管理-详情
*/
public static final String USER_DETAIL = "http://106.15.43.147:6099/webapi/v3/orgs/user/detail";
/** /**
* 项目管理-列表 * 项目管理-列表
*/ */
public static final String CHANCE_LIST = "http://1.202.243.190:32131/sysa/mobilephone/salesmanage/chance/list.asp"; public static final String CHANCE_LIST = "http://106.15.43.147:6099/sysa/mobilephone/salesmanage/chance/list.asp";
/**
* 合同管理-列表
*/
public static final String CONTRACT_LIST = "http://106.15.43.147:6099/sysa/mobilephone/salesmanage/contract/billlist.asp";
/**
* 合同详情
*/
public static final String CONTRACT_DETAIL = "http://106.15.43.147:6099/webapi/v3/sales/contract/detail";
/**
* 工作互动-添加
*/
public static final String INTERACTION_ADD = "http://106.15.43.147:6099/sysa/mobilephone/officemanage/interaction/add.asp";
/** /**
* API状态码 * API状态码
...@@ -35,9 +65,19 @@ public class ZhiBangConst { ...@@ -35,9 +65,19 @@ public class ZhiBangConst {
public static class ApiStatus { public static class ApiStatus {
/** /**
* 正常
*/
public static final String S200 = "200";
/**
* 会话非法 * 会话非法
*/ */
public static final String S_2 = "2"; public static final String S2 = "2";
/**
* token无效
*/
public static final String S400 = "400";
} }
......
package com.baosight.hggp.core.model.zhiBang; package com.baosight.hggp.core.extapp.decheng.model;
import lombok.Data; import lombok.Data;
/** /**
* 项目信息
*
* @author:songx * @author:songx
* @date:2024/8/9,16:41 * @date:2024/8/9,16:41
*/ */
@Data @Data
public class Chance { public class DcChance {
/**
* 项目标识
*/
private String ord;
/** /**
* 项目编号 * 项目编号
......
package com.baosight.hggp.core.extapp.decheng.model;
import lombok.Data;
/**
* 合同信息
*
* @author:songx
* @date:2024/8/9,16:41
*/
@Data
public class DcContractList {
/**
* 合同标识
*/
private String ord;
/**
* 合同编号
*/
private String htid;
/**
* 合同主题
*/
private String title;
}
package com.baosight.hggp.core.extapp.decheng.model;
import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon;
import lombok.Data;
/**
* @author:songx
* @date:2024/8/29,10:41
*/
@Data
public class DcDeptList {
/**
* 部门标识
*/
@AliasNameAnon(name = "部门标识")
private String nodeId;
/**
* 部门名称
*/
@AliasNameAnon(name = "部门名称")
private String nodeText;
/**
* 上级部门标识
*/
@AliasNameAnon(name = "上级部门标识")
private String parentId;
/**
* 是否停用
*/
@AliasNameAnon(name = "是否停用")
private String stoped;
/**
* 排序
*/
@AliasNameAnon(name = "排序")
private Integer fullSort;
/**
* 添加人员名称
*/
@AliasNameAnon(name = "添加人员")
private String addUname;
/**
* 添加时间
*/
@AliasNameAnon(name = "添加时间")
private String addTime;
}
package com.baosight.hggp.core.extapp.decheng.model;
import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon;
import lombok.Data;
/**
* @author:songx
* @date:2024/8/29,10:41
*/
@Data
public class DcUser {
/**
* 账号名称
*/
@AliasNameAnon(name = "账号名称")
private String Username;
/**
* 员工姓名
*/
@AliasNameAnon(name = "员工姓名")
private String Name;
/**
* 性别
*/
@AliasNameAnon(name = "性别")
private String Sex;
/**
* 部门id
*/
@AliasNameAnon(name = "部门id")
private String Orgsid;
/**
* 身份证号
*/
@AliasNameAnon(name = "身份证号")
private String Cardid;
/**
* 电子邮件
*/
@AliasNameAnon(name = "电子邮件")
private String Email;
/**
* 手机
*/
@AliasNameAnon(name = "手机")
private String Mobile;
}
package com.baosight.hggp.core.extapp.decheng.model;
import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon;
import lombok.Data;
/**
* @author:songx
* @date:2024/8/29,10:41
*/
@Data
public class DcUserList {
/**
* 账号ID
*/
@AliasNameAnon(name = "账号ID")
private Integer ord;
/**
* 账号名称
*/
@AliasNameAnon(name = "账号名称")
private String userName;
/**
* 员工编号(接口存在空值)
*/
@AliasNameAnon(name = "员工编号")
private String ygId;
/**
* 员工姓名
*/
@AliasNameAnon(name = "员工姓名")
private String name;
/**
* 员工状态
*/
@AliasNameAnon(name = "员工状态")
private String status;
/**
* 部门id
*/
@AliasNameAnon(name = "部门id")
private String orgSid;
/**
* 部门名称
*/
@AliasNameAnon(name = "部门名称")
private String partName;
}
package com.baosight.hggp.core.extapp.decheng.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon;
import com.baosight.hggp.core.extapp.decheng.api.DcTokenApi;
import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ClassFieldUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/8/30,10:08
*/
public class DcApiUtils {
/**
* 构建header
*
* @return
*/
public static Map buildHeader() {
return buildHeader(false);
}
/**
* 构建header
*
* @return
*/
public static Map buildHeader(boolean isCache) {
Map headerMap = new HashMap();
headerMap.put("ZBAPI-Token", isCache ? DcTokenApi.getTokenCache() : DcTokenApi.getToken());
return headerMap;
}
/**
* @param pageIndex
* @return
*/
public static JSONObject buildParamJson(int pageIndex) {
JSONObject paramJson = new JSONObject();
paramJson.put("page_index", pageIndex < 1 ? 1 : pageIndex);
paramJson.put("page_size", 100);
return paramJson;
}
/**
* 组装数据
*
* @return
*/
public static JSONObject buildParamJson(JSONArray dataJsons) {
return buildParamJson(dataJsons, null);
}
/**
* 组装数据
*
* @param dataJsons
* @param cmdkey
* @return
*/
public static JSONObject buildParamJson(JSONArray dataJsons, String cmdkey) {
JSONObject paramJson = new JSONObject();
paramJson.put("session", DcTokenApi.getToken());
paramJson.put("cmdkey", StringUtils.isBlank(cmdkey) ? "refresh" : cmdkey);
paramJson.put("datas", dataJsons);
return paramJson;
}
/**
* 组装值的json
*
* @param id
* @param val
* @return
*/
public static JSONObject buildValueJson(String id, Object val) {
JSONObject valueJson = new JSONObject();
valueJson.put("id", id);
valueJson.put("val", val);
return valueJson;
}
/**
* 构建返回结果对象
*
* @param result
* @return
*/
public static <T> T handleResultDetailV3(String result, Class<T> clazz) {
JSONObject resultJson = JSONObject.parseObject(result);
// 异常处理
handleMessageV3(resultJson);
// 构建结果数据集
JSONObject dataJson = resultJson.getJSONObject("Data");
return dataJson.toJavaObject(clazz);
}
/**
* 构建返回结果对象
*
* @param result
* @return
*/
public static <T> Pager<T> handleResultV3(String result, Class<T> clazz)
throws InstantiationException, IllegalAccessException {
JSONObject resultJson = JSONObject.parseObject(result);
// 异常处理
handleMessageV3(resultJson);
// 构建结果数据集
Pager pager = new Pager<T>();
pager.setData(buildTableDataV3(resultJson, clazz));
// 分页数据
JSONObject pageJson = resultJson.getJSONObject("Page");
pager.setPageIndex(pageJson.getInteger("PageIndex"));
pager.setPageSize(pageJson.getInteger("PageSize"));
pager.setTotalRows(pageJson.getInteger("RecordCount"));
pager.setTotalPages(pageJson.getInteger("PageCount"));
return pager;
}
/**
* 处理返回消息
*
* @param resultJson
*/
public static void handleMessageV3(JSONObject resultJson) {
String code = resultJson.getString("Code");
if (DeChengConst.ApiStatus.S200.equals(code)) {
return;
}
String msg = resultJson.getString("Msg");
if (DeChengConst.ApiStatus.S400.equals(code)) {
DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(code)) {
DcTokenApi.refreshToken();
}
throw new PlatException("【智邦】" + msg);
}
/**
* 构建数据集
*
* @param resultJson
* @param clazz
* @param <T>
* @return
*/
public static <T> List<T> buildTableDataV3(JSONObject resultJson, Class<T> clazz)
throws InstantiationException, IllegalAccessException {
JSONArray colJsons = resultJson.getJSONArray("Cols");
JSONArray rowJsons = resultJson.getJSONArray("Rows");
// 获取类所有属性
Field[] fields = clazz.getDeclaredFields();
List<T> results = new ArrayList<>();
for (Object item : rowJsons) {
JSONArray singleRowJsons = (JSONArray) item;
// rowJsons存储的是行数据的为二维数组,长度与colJson相同
T obj = clazz.newInstance();
for (Field f : fields) {
// 获取注解
AliasNameAnon aliasNameAnon = f.getAnnotation(AliasNameAnon.class);
if (aliasNameAnon == null) {
continue;
}
// 设置属性可访问
f.setAccessible(true);
// 获取单元格索引
int index = colJsons.indexOf(aliasNameAnon.name());
// 设置属性
ClassFieldUtils.setFieldValue(obj, f, singleRowJsons.get(index));
}
results.add(obj);
}
return results;
}
/**
* 构建返回结果对象
*
* @param result
* @return
*/
public static <T> List<T> handleResult(String result, Class<T> clazz) {
JSONObject resultJson = JSONObject.parseObject(result);
// 异常处理
handleMessage(resultJson);
// 构建结果数据集
return buildTableData(resultJson, clazz);
}
/**
* 处理返回消息
*
* @param resultJson
*/
public static void handleMessage(JSONObject resultJson) {
JSONObject headerJson = resultJson.getJSONObject("header");
String message = headerJson.getString("message");
String status = headerJson.getString("status");
// 会话非法
if (DeChengConst.ApiStatus.S400.equals(status)) {
DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(status)) {
DcTokenApi.refreshToken();
throw new PlatException("【智邦】" + message);
}
}
/**
* 构建数据集
*
* @param resultJson
* @param clazz
* @param <T>
* @return
*/
public static <T> List<T> buildTableData(JSONObject resultJson, Class<T> clazz) {
JSONObject bodyJson = resultJson.getJSONObject("body");
JSONObject sourceJson = bodyJson.getJSONObject("source");
JSONObject tableJson = sourceJson.getJSONObject("table");
JSONArray colJsons = tableJson.getJSONArray("cols");
JSONArray rowJsons = tableJson.getJSONArray("rows");
return rowJsons.stream().map(item -> {
JSONArray singleRowJsons = (JSONArray) item;
// rowJsons存储的是行数据的为二维数组,长度与colJson相同
JSONObject rowValueJson = new JSONObject();
for (int j = 0; j < colJsons.size(); j++) {
rowValueJson.put(colJsons.getJSONObject(j).getString("id"), singleRowJsons.get(j));
}
return rowValueJson.toJavaObject(clazz);
}).collect(Collectors.toList());
}
}
package com.baosight.hggp.core.model;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* 分页查询返回集合封装
*
* @author:songx
* @date:2020/8/19,10:58
*/
@Data
public class Pager<T> implements Serializable {
private static final long serialVersionUID = -1;
/**
* 当前页
*/
private int pageIndex = 1;
/**
* 每页显示多少条,默认20
*/
private int pageSize = 20;
/**
* 总记录数
*/
private long totalRows;
/**
* 总页数
*/
private long totalPages;
/**
* 本页的数据列表
*/
private List<T> data;
public Pager() {
}
public Pager(int pageIndex, int pageSize) {
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.totalRows = 0;
this.totalPages = 0;
}
public void setTotalRows(long totalRows) {
this.totalRows = totalRows;
this.totalPages = this.pageSize == 0 ? 0
: (totalRows / this.pageSize + (totalRows % this.pageSize == 0 ? 0 : 1));
}
}
package com.baosight.hggp.core.utils;
import com.baosight.hggp.util.ObjectUtils;
import java.lang.reflect.Field;
import java.math.BigDecimal;
/**
* @author:songx
* @date:2024/8/29,11:26
*/
public class ClassFieldUtils {
/**
* 绑定实体值
*
* @param obj Object
* @param f Field
* @param cellValue
* @return
* @throws RuntimeException
*/
public static void setFieldValue(Object obj, Field f, Object cellValue) throws IllegalAccessException {
if (ObjectUtils.isNullBlank(cellValue)) {
f.set(obj, f.getType() == String.class ? cellValue : null);
return;
}
String value = cellValue.toString();
if (f.getType() == byte.class || f.getType() == Byte.class) {
f.set(obj, Byte.parseByte(value));
} else if (f.getType() == int.class || f.getType() == Integer.class) {
f.set(obj, Integer.parseInt(value));
} else if (f.getType() == Double.class || f.getType() == double.class) {
f.set(obj, Double.parseDouble(value));
} else if (f.getType() == BigDecimal.class) {
f.set(obj, new BigDecimal(value));
} else {
f.set(obj, value);
}
}
}
package com.baosight.hggp.core.utils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 线程池工具类
*
* @author:songx
* @date:2021/7/5,14:50
*/
public class ThreadUtils {
/**
* 固定线程池,初始化3个线程
*/
public static ExecutorService FIXED_THREAD = Executors.newFixedThreadPool(8);
}
...@@ -654,7 +654,9 @@ public class HGSqlConstant { ...@@ -654,7 +654,9 @@ public class HGSqlConstant {
* @date:2024/1/20,16:45 * @date:2024/1/20,16:45
*/ */
public class HgXsOrg { public class HgXsOrg {
// 查询组织机构
public static final String GET = "HGXSOrg.get";
// 查询组织机构 // 查询组织机构
public static final String QUERY = "HGXSOrg.query"; public static final String QUERY = "HGXSOrg.query";
// 查询企业下所有的组织机构 // 查询企业下所有的组织机构
......
...@@ -16,11 +16,9 @@ import com.baosight.hggp.util.DateUtils; ...@@ -16,11 +16,9 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -350,7 +348,7 @@ public class HGKCUtils { ...@@ -350,7 +348,7 @@ public class HGKCUtils {
*/ */
private static void addInvData(HGKC010 newKc010) { private static void addInvData(HGKC010 newKc010) {
// 公司 // 公司
newKc010.setCompanyName(HGXSTools.XsOrg.get(newKc010.getCompanyCode()).getOrgCname()); newKc010.setCompanyName(HGXSTools.XsOrg.query(newKc010.getCompanyCode()).getOrgCname());
// 仓库 // 仓库
newKc010.setWhName(HGPZTools.HgPz007.get(newKc010.getWhCode()).getWhName()); newKc010.setWhName(HGPZTools.HgPz007.get(newKc010.getWhCode()).getWhName());
// 规格 // 规格
...@@ -540,7 +538,7 @@ public class HGKCUtils { ...@@ -540,7 +538,7 @@ public class HGKCUtils {
*/ */
private static void addInvData(HGKC011 newKc011) { private static void addInvData(HGKC011 newKc011) {
// 公司 // 公司
newKc011.setCompanyName(HGXSTools.XsOrg.get(newKc011.getCompanyCode()).getOrgCname()); newKc011.setCompanyName(HGXSTools.XsOrg.query(newKc011.getCompanyCode()).getOrgCname());
// 仓库 // 仓库
newKc011.setWhName(HGPZTools.HgPz007.get(newKc011.getWhCode()).getWhName()); newKc011.setWhName(HGPZTools.HgPz007.get(newKc011.getWhCode()).getWhName());
// 生产订单信息 // 生产订单信息
......
...@@ -139,7 +139,7 @@ public class ServiceHGPZ009 extends ServiceBase { ...@@ -139,7 +139,7 @@ public class ServiceHGPZ009 extends ServiceBase {
// 默认新增企业管理员账号 // 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000"; String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(), HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null); null, null, null);
// 关联企业管理员角色 // 关联企业管理员角色
this.insertGroupMember(fPz009, userId); this.insertGroupMember(fPz009, userId);
// 新增组织机构顶级 // 新增组织机构顶级
......
...@@ -16,5 +16,7 @@ public class HgScSqlConstant { ...@@ -16,5 +16,7 @@ public class HgScSqlConstant {
// 德诚修改 // 德诚修改
public static final String UPDATE_FOR_DC = "HGSC001.updateForDc"; public static final String UPDATE_FOR_DC = "HGSC001.updateForDc";
// 修改项目名称
public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName";
} }
} }
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.io.IOException;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/** /**
* 项目管理 * 项目管理
* *
* @author:songx * @author:songx
* @date:2022/7/11,11:08 * @date:2022/7/11,11:08
*/ */
@Slf4j
public class ServiceHGSC101 extends ServiceEPBase { public class ServiceHGSC101 extends ServiceEPBase {
/** /**
...@@ -74,4 +87,82 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -74,4 +87,82 @@ public class ServiceHGSC101 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 同步智邦合同信息
*
* @param inInfo
* @return
*/
public EiInfo syncDcContract(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "企业编码不能为空");
ThreadUtils.FIXED_THREAD.execute(() -> {
try {
syncDcContractData(accountCode);
} catch (Exception e) {
log.error("同步智邦合同信息失败:{}", e.getMessage(), e);
}
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步智邦合同信息成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步智邦合同信息失败");
}
return inInfo;
}
/**
* 同步智邦合同信息
*
* @param accountCode
*/
private void syncDcContractData(String accountCode) throws IOException {
int pageIndex = 1;
while (true) {
// 超过1000次不在执行
if (pageIndex > 1000) {
break;
}
List<DcContractList> zbContracts = DcOpenApi.contactList(pageIndex);
if (CollectionUtils.isEmpty(zbContracts)) {
break;
}
// 写入合同数据
saveContractData(accountCode, zbContracts);
pageIndex++;
}
}
/**
* 写入合同信息
*
* @param accountCode
* @param zbContracts
*/
private void saveContractData(String accountCode, List<DcContractList> zbContracts) {
// 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
String prefix = dbPz009.getLoginPrefix();
for (DcContractList zbContract : zbContracts) {
String projCode = prefix + zbContract.getOrd();
HGSC001 dbSc001 = HGSCTools.Hgsc001.queryByCode(projCode);
if (dbSc001 == null) {
dbSc001 = new HGSC001();
dbSc001.setAccountCode(accountCode);
dbSc001.setDepCode(accountCode);
dbSc001.setDepName(dbPz009.getAccountName());
dbSc001.setProjCode(projCode);
dbSc001.setProjName(zbContract.getTitle());
DaoUtils.insert(HGSC001.INSERT, dbSc001);
} else {
Map updateMap = new HashMap();
updateMap.put(HGSC001.FIELD_proj_code, projCode);
updateMap.put(HGSC001.FIELD_proj_name, zbContract.getTitle());
DaoUtils.insert(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, dbSc001);
}
}
}
} }
...@@ -90,6 +90,14 @@ ...@@ -90,6 +90,14 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="projCodes">
PROJ_CODE IN
<iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001"> <select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT SELECT
id as "id", id as "id",
...@@ -121,7 +129,7 @@ ...@@ -121,7 +129,7 @@
updated_name as "updatedName", <!-- 修改人名称 --> updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 --> updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC001 WHERE 1=1 FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="condition" /> <include refid="customCondition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -130,12 +138,11 @@ ...@@ -130,12 +138,11 @@
id desc id desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="condition"/> <include refid="customCondition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -301,4 +308,13 @@ ...@@ -301,4 +308,13 @@
WHERE PROJ_CODE = #projCode# WHERE PROJ_CODE = #projCode#
</update> </update>
<!-- 修改项目名称 -->
<update id="updateProjName">
UPDATE ${hggpSchema}.HGSC001
SET
PROJ_NAME = #projName#,
<include refid="SqlBase.updateRevise"/>
WHERE PROJ_CODE = #projCode#
</update>
</sqlMap> </sqlMap>
...@@ -188,8 +188,19 @@ public class HGSCTools { ...@@ -188,8 +188,19 @@ public class HGSCTools {
} }
} }
/**
* 项目信息
*
* @author:songx
* @date:2024/8/28,17:40
*/
public static class Hgsc001 { public static class Hgsc001 {
/**
*
* @param code
* @return
*/
public static HGSC001 queryByCode(String code) { public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!"); AssertUtils.isNull(code, "项目Code不能为空!");
List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String,Object>(){ List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String,Object>(){
...@@ -197,6 +208,17 @@ public class HGSCTools { ...@@ -197,6 +208,17 @@ public class HGSCTools {
}); });
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
/**
* @param projCodes
* @return
*/
public static List<HGSC001> queryByCode(List<String> projCodes) {
AssertUtils.isEmpty(projCodes, "项目Code不能为空!");
Map queryMap = new HashMap();
queryMap.put("projCodes", projCodes);
return DaoBase.getInstance().query(HGSC001.QUERY, queryMap);
}
} }
public static class Hgsc003 { public static class Hgsc003 {
......
package com.baosight.hggp.hg.wd.constant; package com.baosight.hggp.hg.wd.constant;
import javax.print.DocFlavor;
/** /**
* @author:songx * @author:songx
* @date:2024/8/16,15:51 * @date:2024/8/16,15:51
...@@ -20,4 +22,18 @@ public class HgWdConstant { ...@@ -20,4 +22,18 @@ public class HgWdConstant {
public static final Integer S_1 = 1; public static final Integer S_1 = 1;
} }
/**
* 树节点类型
*
* @author:songx
* @date:2024/8/28,16:27
*/
public static class LeafType {
// 项目
public static final String P = "P";
// 目录
public static final String C = "C";
}
} }
...@@ -13,7 +13,11 @@ public class HgWdSqlConstant { ...@@ -13,7 +13,11 @@ public class HgWdSqlConstant {
* @date:2024/2/22,13:57 * @date:2024/2/22,13:57
*/ */
public static class HgWd001 { public static class HgWd001 {
// 根据父节点统计
public static final String COUNT_BY_PARENT = "HGWD001.countByParent";
// 搜索树节点
public static final String SEARCH_TREE_NODE = "HGWD001.searchTreeNode";
} }
} }
...@@ -59,6 +59,8 @@ public class HGWD001 extends DaoEPBase { ...@@ -59,6 +59,8 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/ public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/ public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/ public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_PARENT_ID = "PARENT_ID"; /* 节点层级*/
public static final String COL_LEAF_LEVEL = "LEAF_LEVEL"; /* 父级ID*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/ public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String COL_FILE_TYPE = "FILE_TYPE"; /* 文件类型*/ public static final String COL_FILE_TYPE = "FILE_TYPE"; /* 文件类型*/
public static final String COL_FILE_NAME = "FILE_NAME"; /* 文件名称*/ public static final String COL_FILE_NAME = "FILE_NAME"; /* 文件名称*/
...@@ -66,14 +68,14 @@ public class HGWD001 extends DaoEPBase { ...@@ -66,14 +68,14 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_STATUS = "STATUS"; /* 状态*/ public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/ public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_RELEASE_DATE = "RELEASE_DATE"; /* 发布时间*/ public static final String COL_RELEASE_DATE = "RELEASE_DATE"; /* 发布时间*/
public static final String QUERY = "HGWD001.query"; public static final String QUERY = "HGWD001.query";
public static final String COUNT = "HGWD001.count"; public static final String COUNT = "HGWD001.count";
public static final String INSERT = "HGWD001.insert"; public static final String INSERT = "HGWD001.insert";
public static final String UPDATE = "HGWD001.update"; public static final String UPDATE = "HGWD001.update";
public static final String DELETE = "HGWD001.delete"; public static final String DELETE = "HGWD001.delete";
public static final String RELEASE_DATE = "HGWD001.updateReleaseDate"; public static final String RELEASE_DATE = "HGWD001.updateReleaseDate";
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
......
package com.baosight.hggp.hg.wd.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgwd003.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-08-19 14:34:38 create
*/
public class HGWD003 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 记录修改者*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 记录修改名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 0-未删除,1-已删除*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户姓名*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_ORG_ID = "orgId"; /* 部门编码*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 部门名称*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 记录修改者*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 记录修改名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 记录修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 0-未删除,1-已删除*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_USER_NAME = "USER_NAME"; /* 用户姓名*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_ORG_ID = "ORG_ID"; /* 部门编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 部门名称*/
public static final String QUERY = "HGWD003.query";
public static final String COUNT = "HGWD003.count";
public static final String INSERT = "HGWD003.insert";
public static final String UPDATE = "HGWD003.update";
public static final String DELETE = "HGWD003.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag = 0; /* 0-未删除,1-已删除*/
private String fileId = " "; /* 文件ID*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户姓名*/
private String remark = " "; /* 备注*/
private String orgId = " "; /* 部门编码*/
private String orgCname = " "; /* 部门名称*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("记录创建名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("记录创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("记录修改者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("记录修改名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("记录修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("0-未删除,1-已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_ID);
eiColumn.setDescName("文件ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_ID);
eiColumn.setDescName("用户ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_NAME);
eiColumn.setDescName("用户姓名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("部门名称");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGWD003() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 企业编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 企业编码.
*
* @param accountCode - 企业编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 记录创建者.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 记录创建者.
*
* @param createdBy - 记录创建者
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 记录创建名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 记录创建名称.
*
* @param createdName - 记录创建名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 记录创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 记录创建时间.
*
* @param createdTime - 记录创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 记录修改者.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 记录修改者.
*
* @param updatedBy - 记录修改者
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 记录修改名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 记录修改名称.
*
* @param updatedName - 记录修改名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 记录修改时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 记录修改时间.
*
* @param updatedTime - 记录修改时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0-未删除,1-已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0-未删除,1-已删除.
*
* @param deleteFlag - 0-未删除,1-已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the fileId - 文件ID.
* @return the fileId
*/
public String getFileId() {
return this.fileId;
}
/**
* set the fileId - 文件ID.
*
* @param fileId - 文件ID
*/
public void setFileId(String fileId) {
this.fileId = fileId;
}
/**
* get the userId - 用户ID.
* @return the userId
*/
public String getUserId() {
return this.userId;
}
/**
* set the userId - 用户ID.
*
* @param userId - 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getOrgCname() {
return orgCname;
}
public void setOrgCname(String orgCname) {
this.orgCname = orgCname;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
map.put(FIELD_USER_ID, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_USER_ID)));
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
return map;
}
}
package com.baosight.hggp.hg.wd.service; package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B; import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -19,7 +15,6 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -19,7 +15,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
...@@ -3,8 +3,6 @@ package com.baosight.hggp.hg.wd.service; ...@@ -3,8 +3,6 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD001C; import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
......
...@@ -2,34 +2,17 @@ package com.baosight.hggp.hg.wd.service; ...@@ -2,34 +2,17 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD003 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return inInfo;
}
inInfo = super.query(inInfo, HGWD003.QUERY, new HGWD003());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentLabel) {
List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>());
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), dbSc001.getProjName(), HgWdConstant.LeafType.P));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 查询叶子节点
*
* @param parentLabel
* @return
*/
public List queryChildNode(String parentLabel) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentLabel);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(parentLabel, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 搜索树节点
*
* @param inInfo
* @return
*/
public EiInfo searchNode(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HGWD001> dbWd001s = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.SEARCH_TREE_NODE, queryMap);
// 设置一级项目节点信息
List<Map> nodes = this.buildProjInfo(dbWd001s);
inInfo.addBlock(CommonConstant.Field.ROOT2).setRows(nodes);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "搜索节点失败");
}
return inInfo;
}
/**
* 设置一级项目节点信息
*
* @param dbWd001s
*/
private List<Map> buildProjInfo(List<HGWD001> dbWd001s) {
List<Map> results = new ArrayList();
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(dbWd001.getParentId(), dbWd001.getFileId(), dbWd001.getFileName(),
HgWdConstant.LeafType.C));
}
// 项目信息
List<String> projCodes = dbWd001s.stream().filter(item -> item.getLeafLevel() == 1)
.map(HGWD001::getParentId).collect(Collectors.toList());
List<HGSC001> dbSc001s = HGSCTools.Hgsc001.queryByCode(projCodes);
for (HGSC001 dbSc001 : dbSc001s) {
results.add(buildLeaf(CommonConstant.Field.ROOT2, dbSc001.getProjCode(), dbSc001.getProjName(),
HgWdConstant.LeafType.P));
}
return results;
}
/**
* 构建叶子节点
*
* @param parentLabel
* @param label
* @param text
*/
private HashMap buildLeaf(String parentLabel, String label, String text, String leafType) {
HashMap<String, String> leafMap = new HashMap();
leafMap.put("parent", parentLabel);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
return leafMap;
}
/**
* 删除用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo removeUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) {
fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.insert(HGWD003.DELETE, fWd003);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
*/
private void setTreeNodeLeaf(List<Map> nodes) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> resultMap = HGWDTools.HgWd001.countByParent(labels);
for (Map node : nodes) {
Integer cnt = resultMap == null ? null : resultMap.get(node.get("label"));
node.put("leaf", cnt == null || cnt == 0 ? 1 : 0);
}
}
}
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD003A extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new User().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, "HGWD003A.query", new User());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo authUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 获取FILE_ID
String fileId = MapUtils.getString(queryMap, HGWD003.FIELD_FILE_ID);
AssertUtils.isEmpty(fileId, "请选择目录");
List<HGWD003> fWd003s = MapUtils.toDaoEPBases(inInfo, HGWD003.class);
for (HGWD003 fWd003 : fWd003s) {
fWd003.setFileId(fileId);
DaoUtils.insert(HGWD003.INSERT, fWd003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据授权成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "授权失败");
}
return inInfo;
}
}
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
</sql> </sql>
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -56,9 +57,6 @@ ...@@ -56,9 +57,6 @@
<isNotEmpty prepend=" AND " property="updatedTime"> <isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime# UPDATED_TIME = #updatedTime#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -96,10 +94,16 @@ ...@@ -96,10 +94,16 @@
REMARK = #remark# REMARK = #remark#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="releaseDate"> <isNotEmpty prepend=" AND " property="releaseDate">
RELEASE_DATE = #releaseDate# RELEASE_DATE = #releaseDate#
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<sql id="orderBy"> <sql id="orderBy">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
...@@ -126,6 +130,42 @@ ...@@ -126,6 +130,42 @@
<include refid="condition"/> <include refid="condition"/>
</select> </select>
<!-- 更具父级节点统计 -->
<select id="countByParent" resultClass="java.util.HashMap">
SELECT PARENT_ID, COUNT(1) AS CNT
FROM ${hggpSchema}.HGWD001
WHERE 1=1
AND DELETE_FLAG = 0
AND PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
GROUP BY PARENT_ID
</select>
<!-- 搜索树节点 -->
<select id="searchTreeNode" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT DISTINCT
T3.FILE_ID as "fileId", T3.FILE_NAME as "fileName", T3.PARENT_ID as "parentId", T3.LEAF_LEVEL as "leafLevel"
FROM (
SELECT
@CODES as CODES,
(
SELECT @CODES:=GROUP_CONCAT(PARENT_ID) FROM ${hggpSchema}.HGWD001
WHERE FIND_IN_SET(FILE_ID, @CODES) AND ACCOUNT_CODE = #accountCode# AND DELETE_FLAG = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${hggpSchema}.HGWD001,
(
SELECT @CODES:=(SELECT GROUP_CONCAT(FILE_ID) FROM ${hggpSchema}.HGWD001
WHERE FILE_NAME LIKE CONCAT('%', #fileName#, '%')), @LEVEL:= 0
) T4
WHERE @CODES IS NOT NULL
) T2,
${hggpSchema}.HGWD001 T3
WHERE T3.DELETE_FLAG = 0
AND FIND_IN_SET(T3.FILE_ID, T2.CODES)
AND T3.ACCOUNT_CODE = #accountCode#
ORDER BY T3.FILE_ID
</select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGWD001 ( INSERT INTO ${hggpSchema}.HGWD001 (
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD003">
<sql id="column">
A.ID as "id",
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.CREATED_BY as "createdBy", <!-- 记录创建者 -->
A.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
A.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
A.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
A.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
A.FILE_ID as "fileId", <!-- 文件ID -->
A.USER_ID as "userId", <!-- 用户ID -->
A.REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="columnB">
B.USER_NAME as "userName"
</sql>
<sql id="columnD">
D.ORG_ID as "orgId",
D.ORG_CNAME as "orgCname"
</sql>
<sql id="condition">
AND A.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileId">
A.FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
</sql>
<sql id="conditionB">
<isNotEmpty prepend=" AND " property="userName">
B.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionD">
<isNotEmpty prepend=" AND " property="orgCname">
D.ORG_CNAME LIKE CONCAT('%', #orgCname#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD003">
SELECT
<include refid="column"/>,
<include refid="columnB"/>,
<include refid="columnD"/>
FROM ${hggpSchema}.HGWD003 A
INNER JOIN ${platSchema}.XS_USER B ON A.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionB"/>
<include refid="conditionD"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hggpSchema}.HGWD001 A
INNER JOIN ${platSchema}.XS_USER B ON A.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionB"/>
<include refid="conditionD"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGWD003 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
FILE_ID, <!-- 文件ID -->
USER_ID, <!-- 文件ID -->
REMARK <!-- 备注 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#fileId#, #userId#, #remark#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hggpSchema}.HGWD003 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD003A">
<sql id="column">
A.USER_ID as "userId", <!-- 用户id -->
A.USER_NAME as "userName", <!-- 用户名 -->
A.LOGIN_NAME as "loginName", <!-- 登录id -->
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
</sql>
<sql id="columnB">
C.ORG_ID as "depCode", <!-- 部门编码-->
C.ORG_CNAME as "depName" <!-- 部门名称-->
</sql>
<sql id="condition">
<!-- 过滤已经添加的用户 -->
AND NOT EXISTS (SELECT * FROM ${hggpSchema}.HGWD003 T WHERE A.LOGIN_NAME = T.USER_ID
AND T.DELETE_FLAG = 0 AND T.FILE_ID = #fileId#
)
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginName">
A.LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionC">
<isNotEmpty prepend=" AND " property="depName">
C.ORG_CNAME LIKE CONCAT('%', #depName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.REC_CREATE_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
<include refid="column"/>,
<include refid="columnB"/>
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
</sqlMap>
...@@ -7,11 +7,13 @@ import com.baosight.hggp.hg.wd.domain.HGWD001; ...@@ -7,11 +7,13 @@ import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A; import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -52,11 +54,41 @@ public class HGWDTools { ...@@ -52,11 +54,41 @@ public class HGWDTools {
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
/**
* 根据父节点统计
*
* @param parentIds
* @return
*/
public static Map<String, Integer> countByParent(List<String> parentIds) {
AssertUtils.isEmpty(parentIds, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentIds", parentIds);
List<Map> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.COUNT_BY_PARENT, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(item -> MapUtils.getString(item, HGWD001.COL_PARENT_ID),
item -> MapUtils.getInteger(item, "CNT")));
}
/**
* 搜索树节点
*
* @param fileName
* @return
*/
public static List<HGWD001> searchTreeNode(String fileName) {
Map queryMap = new HashMap();
queryMap.put("fileName", fileName);
return DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.SEARCH_TREE_NODE, queryMap);
}
public static void add(HGWD001A hgwd001a) { public static void add(HGWD001A hgwd001a) {
AssertUtils.isNull(hgwd001a, "文档对象不能为空"); AssertUtils.isNull(hgwd001a, "文档对象不能为空");
DaoUtils.insert(HGWD001A.INSERT, hgwd001a); DaoUtils.insert(HGWD001A.INSERT, hgwd001a);
} }
public static void updateStatus(HGWD001 hgwd001) { public static void updateStatus(HGWD001 hgwd001) {
AssertUtils.isNull(hgwd001, "文档对象不能为空"); AssertUtils.isNull(hgwd001, "文档对象不能为空");
DaoUtils.update("HGWD001.updateStatus", hgwd001); DaoUtils.update("HGWD001.updateStatus", hgwd001);
......
...@@ -7,6 +7,28 @@ package com.baosight.hggp.hg.xs.constant; ...@@ -7,6 +7,28 @@ package com.baosight.hggp.hg.xs.constant;
public class HgXsSqlConstant { public class HgXsSqlConstant {
/** /**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HgXsUser {
// 修改德诚用户
public static final String UPDATE_DC_USER = "HGXSUser.updateDcUser";
}
/**
* @author:songx
* @date:2024/8/29,15:54
*/
public static class HgXsOrg {
// 新增管理
public static final String ADD_RELATION = "HGXSOrg.addRelation";
// 修改组织名称
public static final String UPDATE_ORG_CNAME = "HGXSOrg.updateOrgCname";
}
/**
* 客户回访 * 客户回访
* *
* @author:songx * @author:songx
......
package com.baosight.hggp.hg.xs.domain; package com.baosight.hggp.hg.xs.domain;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/** /**
* @author:songx * Project: <br>
* @date:2024/1/15,14:50 * Title:Txsog01.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-08-29 16:15:02 create
*/ */
public class Org extends DaoEPBase { public class Org extends DaoEPBase {
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/ private static final long serialVersionUID = 1L;
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/ public static final String FIELD_ORG_ID = "orgId"; /* 组织ID*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/ public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织编码*/
public static final String FIELD_ORG_TYPE = "orgType"; /* 用户ID*/ public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织名称*/
public static final String FIELD_PARENT_ORG_ID = "parentOrgId"; /* 父级组织ID*/ public static final String FIELD_ORG_BRIEF_NAME = "orgBriefName"; /* 组织别名*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区代码*/ public static final String FIELD_ORG_TYPE = "orgType"; /* 组织类型*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/ public static final String FIELD_PARENT_ORG_ID = "parentOrgId"; /* 上级组织ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/ public static final String FIELD_ESTABLISH_DATE = "establishDate"; /* 成立日期*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_ORG_LEVEL = "orgLevel"; /* 组织级别*/
public static final String FIELD_LEVEL = "level"; /* 邮箱*/ public static final String FIELD_ORG_NODE_TYPE = "orgNodeType"; /* 结点类型(1-树结点|2-叶子结点)*/
public static final String FIELD_SORT_INDEX = "sortIndex"; /* 排序*/
private String accountCode = ""; /* 企业编码 */ public static final String FIELD_REC_CREATOR = "recCreator"; /* 记录创建责任者*/
private String orgId = ""; /* 组织ID */ public static final String FIELD_REC_CREATE_TIME = "recCreateTime"; /* 记录创建时刻*/
private String orgEname = ""; /* 组织英文名 */ public static final String FIELD_REC_REVISOR = "recRevisor"; /* 记录修改责任者*/
private String orgCname = ""; /* 组织中文名 */ public static final String FIELD_REC_REVISE_TIME = "recReviseTime"; /* 记录修改时刻*/
private String orgType = ""; /* 组织类型 */ public static final String FIELD_ARCHIVE_FLAG = "archiveFlag"; /* 归档标记*/
private String parentOrgId = ""; /* 父级组织ID */ public static final String FIELD_IS_DELETED = "isDeleted"; /* 逻辑删除(1-已删除|0-正常状态)*/
private String factoryCode = ""; /* 厂区编码 */ public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 帐套编码*/
private String factoryName = ""; /* 厂区名称 */ public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区代码*/
private String companyCode = ""; /* 公司编码 */ public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/
private String companyName = ""; /* 公司名称 */ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司代码*/
private String level = ""; /* 层级 */ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String COL_ORG_ID = "ORG_ID"; /* 组织ID*/
public static final String COL_ORG_ENAME = "ORG_ENAME"; /* 组织编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 组织名称*/
public static final String COL_ORG_BRIEF_NAME = "ORG_BRIEF_NAME"; /* 组织别名*/
public static final String COL_ORG_TYPE = "ORG_TYPE"; /* 组织类型*/
public static final String COL_PARENT_ORG_ID = "PARENT_ORG_ID"; /* 上级组织ID*/
public static final String COL_ESTABLISH_DATE = "ESTABLISH_DATE"; /* 成立日期*/
public static final String COL_ORG_LEVEL = "ORG_LEVEL"; /* 组织级别*/
public static final String COL_ORG_NODE_TYPE = "ORG_NODE_TYPE"; /* 结点类型(1-树结点|2-叶子结点)*/
public static final String COL_SORT_INDEX = "SORT_INDEX"; /* 排序*/
public static final String COL_REC_CREATOR = "REC_CREATOR"; /* 记录创建责任者*/
public static final String COL_REC_CREATE_TIME = "REC_CREATE_TIME"; /* 记录创建时刻*/
public static final String COL_REC_REVISOR = "REC_REVISOR"; /* 记录修改责任者*/
public static final String COL_REC_REVISE_TIME = "REC_REVISE_TIME"; /* 记录修改时刻*/
public static final String COL_ARCHIVE_FLAG = "ARCHIVE_FLAG"; /* 归档标记*/
public static final String COL_IS_DELETED = "IS_DELETED"; /* 逻辑删除(1-已删除|0-正常状态)*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 帐套编码*/
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 厂区代码*/
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 厂区名称*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 公司代码*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String QUERY = "txsog01.query";
public static final String COUNT = "txsog01.count";
public static final String INSERT = "txsog01.insert";
public static final String UPDATE = "txsog01.update";
public static final String DELETE = "txsog01.delete";
private String orgId = " "; /* 组织ID*/
private String orgEname = " "; /* 组织编码*/
private String orgCname = " "; /* 组织名称*/
private String orgBriefName = " "; /* 组织别名*/
private String orgType = " "; /* 组织类型*/
private String parentOrgId = " "; /* 上级组织ID*/
private String establishDate = " "; /* 成立日期*/
private String orgLevel = " "; /* 组织级别*/
private String orgNodeType = " "; /* 结点类型(1-树结点|2-叶子结点)*/
private Integer sortIndex = new Integer(0); /* 排序*/
private String recCreator = " "; /* 记录创建责任者*/
private String recCreateTime = " "; /* 记录创建时刻*/
private String recRevisor = " "; /* 记录修改责任者*/
private String recReviseTime = " "; /* 记录修改时刻*/
private String archiveFlag = " "; /* 归档标记*/
private String isDeleted = " "; /* 逻辑删除(1-已删除|0-正常状态)*/
private String accountCode = " "; /* 帐套编码*/
private String factoryCode = " "; /* 厂区代码*/
private String factoryName = " "; /* 厂区名称*/
private String companyCode = " "; /* 公司代码*/
private String companyName = " "; /* 公司名称*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -43,20 +99,21 @@ public class Org extends DaoEPBase { ...@@ -43,20 +99,21 @@ public class Org extends DaoEPBase {
public void initMetaData() { public void initMetaData() {
EiColumn eiColumn; EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID); eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("组织ID"); eiColumn.setDescName("组织ID");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ENAME); eiColumn = new EiColumn(FIELD_ORG_ENAME);
eiColumn.setDescName("组织英文名"); eiColumn.setDescName("组织编码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME); eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织中文名"); eiColumn.setDescName("组织名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_BRIEF_NAME);
eiColumn.setDescName("组织别名");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_TYPE); eiColumn = new EiColumn(FIELD_ORG_TYPE);
...@@ -64,11 +121,55 @@ public class Org extends DaoEPBase { ...@@ -64,11 +121,55 @@ public class Org extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_ORG_ID); eiColumn = new EiColumn(FIELD_PARENT_ORG_ID);
eiColumn.setDescName("父级组织ID"); eiColumn.setDescName("上级组织ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ESTABLISH_DATE);
eiColumn.setDescName("成立日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_LEVEL);
eiColumn.setDescName("组织级别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_NODE_TYPE);
eiColumn.setDescName("结点类型(1-树结点|2-叶子结点)");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SORT_INDEX);
eiColumn.setDescName("排序");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REC_CREATOR);
eiColumn.setDescName("记录创建责任者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REC_CREATE_TIME);
eiColumn.setDescName("记录创建时刻");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REC_REVISOR);
eiColumn.setDescName("记录修改责任者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REC_REVISE_TIME);
eiColumn.setDescName("记录修改时刻");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ARCHIVE_FLAG);
eiColumn.setDescName("归档标记");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_DELETED);
eiColumn.setDescName("逻辑删除(1-已删除|0-正常状态)");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("帐套编码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE); eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区码"); eiColumn.setDescName("厂区码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME); eiColumn = new EiColumn(FIELD_FACTORY_NAME);
...@@ -76,16 +177,13 @@ public class Org extends DaoEPBase { ...@@ -76,16 +177,13 @@ public class Org extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE); eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("公司码"); eiColumn.setDescName("公司码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME); eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("公司名称"); eiColumn.setDescName("公司名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LEVEL);
eiColumn.setDescName("层级");
eiMetadata.addMeta(eiColumn);
} }
...@@ -96,94 +194,347 @@ public class Org extends DaoEPBase { ...@@ -96,94 +194,347 @@ public class Org extends DaoEPBase {
initMetaData(); initMetaData();
} }
public String getAccountCode() { /**
return accountCode; * get the orgId - 组织ID.
} * @return the orgId
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
public String getOrgId() { public String getOrgId() {
return orgId; return this.orgId;
} }
/**
* set the orgId - 组织ID.
*
* @param orgId - 组织ID
*/
public void setOrgId(String orgId) { public void setOrgId(String orgId) {
this.orgId = orgId; this.orgId = orgId;
} }
/**
* get the orgEname - 组织编码.
* @return the orgEname
*/
public String getOrgEname() { public String getOrgEname() {
return orgEname; return this.orgEname;
} }
/**
* set the orgEname - 组织编码.
*
* @param orgEname - 组织编码
*/
public void setOrgEname(String orgEname) { public void setOrgEname(String orgEname) {
this.orgEname = orgEname; this.orgEname = orgEname;
} }
/**
* get the orgCname - 组织名称.
* @return the orgCname
*/
public String getOrgCname() { public String getOrgCname() {
return orgCname; return this.orgCname;
} }
/**
* set the orgCname - 组织名称.
*
* @param orgCname - 组织名称
*/
public void setOrgCname(String orgCname) { public void setOrgCname(String orgCname) {
this.orgCname = orgCname; this.orgCname = orgCname;
} }
/**
* get the orgBriefName - 组织别名.
* @return the orgBriefName
*/
public String getOrgBriefName() {
return this.orgBriefName;
}
/**
* set the orgBriefName - 组织别名.
*
* @param orgBriefName - 组织别名
*/
public void setOrgBriefName(String orgBriefName) {
this.orgBriefName = orgBriefName;
}
/**
* get the orgType - 组织类型.
* @return the orgType
*/
public String getOrgType() { public String getOrgType() {
return orgType; return this.orgType;
} }
/**
* set the orgType - 组织类型.
*
* @param orgType - 组织类型
*/
public void setOrgType(String orgType) { public void setOrgType(String orgType) {
this.orgType = orgType; this.orgType = orgType;
} }
/**
* get the parentOrgId - 上级组织ID.
* @return the parentOrgId
*/
public String getParentOrgId() { public String getParentOrgId() {
return parentOrgId; return this.parentOrgId;
} }
/**
* set the parentOrgId - 上级组织ID.
*
* @param parentOrgId - 上级组织ID
*/
public void setParentOrgId(String parentOrgId) { public void setParentOrgId(String parentOrgId) {
this.parentOrgId = parentOrgId; this.parentOrgId = parentOrgId;
} }
/**
* get the establishDate - 成立日期.
* @return the establishDate
*/
public String getEstablishDate() {
return this.establishDate;
}
/**
* set the establishDate - 成立日期.
*
* @param establishDate - 成立日期
*/
public void setEstablishDate(String establishDate) {
this.establishDate = establishDate;
}
/**
* get the orgLevel - 组织级别.
* @return the orgLevel
*/
public String getOrgLevel() {
return this.orgLevel;
}
/**
* set the orgLevel - 组织级别.
*
* @param orgLevel - 组织级别
*/
public void setOrgLevel(String orgLevel) {
this.orgLevel = orgLevel;
}
/**
* get the orgNodeType - 结点类型(1-树结点|2-叶子结点).
* @return the orgNodeType
*/
public String getOrgNodeType() {
return this.orgNodeType;
}
/**
* set the orgNodeType - 结点类型(1-树结点|2-叶子结点).
*
* @param orgNodeType - 结点类型(1-树结点|2-叶子结点)
*/
public void setOrgNodeType(String orgNodeType) {
this.orgNodeType = orgNodeType;
}
/**
* get the sortIndex - 排序.
* @return the sortIndex
*/
public Integer getSortIndex() {
return this.sortIndex;
}
/**
* set the sortIndex - 排序.
*
* @param sortIndex - 排序
*/
public void setSortIndex(Integer sortIndex) {
this.sortIndex = sortIndex;
}
/**
* get the recCreator - 记录创建责任者.
* @return the recCreator
*/
public String getRecCreator() {
return this.recCreator;
}
/**
* set the recCreator - 记录创建责任者.
*
* @param recCreator - 记录创建责任者
*/
@Override
public void setRecCreator(String recCreator) {
this.recCreator = recCreator;
}
/**
* get the recCreateTime - 记录创建时刻.
* @return the recCreateTime
*/
public String getRecCreateTime() {
return this.recCreateTime;
}
/**
* set the recCreateTime - 记录创建时刻.
*
* @param recCreateTime - 记录创建时刻
*/
@Override
public void setRecCreateTime(String recCreateTime) {
this.recCreateTime = recCreateTime;
}
/**
* get the recRevisor - 记录修改责任者.
* @return the recRevisor
*/
public String getRecRevisor() {
return this.recRevisor;
}
/**
* set the recRevisor - 记录修改责任者.
*
* @param recRevisor - 记录修改责任者
*/
@Override
public void setRecRevisor(String recRevisor) {
this.recRevisor = recRevisor;
}
/**
* get the recReviseTime - 记录修改时刻.
* @return the recReviseTime
*/
public String getRecReviseTime() {
return this.recReviseTime;
}
/**
* set the recReviseTime - 记录修改时刻.
*
* @param recReviseTime - 记录修改时刻
*/
@Override
public void setRecReviseTime(String recReviseTime) {
this.recReviseTime = recReviseTime;
}
/**
* get the archiveFlag - 归档标记.
* @return the archiveFlag
*/
public String getArchiveFlag() {
return this.archiveFlag;
}
/**
* set the archiveFlag - 归档标记.
*
* @param archiveFlag - 归档标记
*/
@Override
public void setArchiveFlag(String archiveFlag) {
this.archiveFlag = archiveFlag;
}
/**
* get the isDeleted - 逻辑删除(1-已删除|0-正常状态).
* @return the isDeleted
*/
public String getIsDeleted() {
return this.isDeleted;
}
/**
* set the isDeleted - 逻辑删除(1-已删除|0-正常状态).
*
* @param isDeleted - 逻辑删除(1-已删除|0-正常状态)
*/
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
}
/**
* get the accountCode - 帐套编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 帐套编码.
*
* @param accountCode - 帐套编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the factoryCode - 厂区代码.
* @return the factoryCode
*/
public String getFactoryCode() { public String getFactoryCode() {
return factoryCode; return this.factoryCode;
} }
/**
* set the factoryCode - 厂区代码.
*
* @param factoryCode - 厂区代码
*/
public void setFactoryCode(String factoryCode) { public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode; this.factoryCode = factoryCode;
} }
/**
* get the factoryName - 厂区名称.
* @return the factoryName
*/
public String getFactoryName() { public String getFactoryName() {
return factoryName; return this.factoryName;
} }
/**
* set the factoryName - 厂区名称.
*
* @param factoryName - 厂区名称
*/
public void setFactoryName(String factoryName) { public void setFactoryName(String factoryName) {
this.factoryName = factoryName; this.factoryName = factoryName;
} }
/**
* get the companyCode - 公司代码.
* @return the companyCode
*/
public String getCompanyCode() { public String getCompanyCode() {
return companyCode; return this.companyCode;
} }
/**
* set the companyCode - 公司代码.
*
* @param companyCode - 公司代码
*/
public void setCompanyCode(String companyCode) { public void setCompanyCode(String companyCode) {
this.companyCode = companyCode; this.companyCode = companyCode;
} }
/**
* get the companyName - 公司名称.
* @return the companyName
*/
public String getCompanyName() { public String getCompanyName() {
return companyName; return this.companyName;
} }
/**
* set the companyName - 公司名称.
*
* @param companyName - 公司名称
*/
public void setCompanyName(String companyName) { public void setCompanyName(String companyName) {
this.companyName = companyName; this.companyName = companyName;
} }
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -192,17 +543,27 @@ public class Org extends DaoEPBase { ...@@ -192,17 +543,27 @@ public class Org extends DaoEPBase {
@Override @Override
public void fromMap(Map map) { public void fromMap(Map map) {
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId)); setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname)); setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname)); setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setOrgBriefName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_BRIEF_NAME)), orgBriefName));
setOrgType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_TYPE)), orgType)); setOrgType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_TYPE)), orgType));
setParentOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ORG_ID)), parentOrgId)); setParentOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ORG_ID)), parentOrgId));
setEstablishDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ESTABLISH_DATE)), establishDate));
setOrgLevel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_LEVEL)), orgLevel));
setOrgNodeType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_NODE_TYPE)), orgNodeType));
setSortIndex(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SORT_INDEX)), sortIndex));
setRecCreator(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REC_CREATOR)), recCreator));
setRecCreateTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REC_CREATE_TIME)), recCreateTime));
setRecRevisor(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REC_REVISOR)), recRevisor));
setRecReviseTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REC_REVISE_TIME)), recReviseTime));
setArchiveFlag(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ARCHIVE_FLAG)), archiveFlag));
setIsDeleted(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_IS_DELETED)), isDeleted));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode)); setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName)); setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setLevel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEVEL)), level));
} }
/** /**
...@@ -212,17 +573,27 @@ public class Org extends DaoEPBase { ...@@ -212,17 +573,27 @@ public class Org extends DaoEPBase {
public Map toMap() { public Map toMap() {
Map map = new HashMap(); Map map = new HashMap();
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID))); map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME))); map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME))); map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
map.put(FIELD_ORG_BRIEF_NAME, StringUtils.toString(orgBriefName, eiMetadata.getMeta(FIELD_ORG_BRIEF_NAME)));
map.put(FIELD_ORG_TYPE, StringUtils.toString(orgType, eiMetadata.getMeta(FIELD_ORG_TYPE))); map.put(FIELD_ORG_TYPE, StringUtils.toString(orgType, eiMetadata.getMeta(FIELD_ORG_TYPE)));
map.put(FIELD_PARENT_ORG_ID, StringUtils.toString(parentOrgId, eiMetadata.getMeta(FIELD_PARENT_ORG_ID))); map.put(FIELD_PARENT_ORG_ID, StringUtils.toString(parentOrgId, eiMetadata.getMeta(FIELD_PARENT_ORG_ID)));
map.put(FIELD_ESTABLISH_DATE, StringUtils.toString(establishDate, eiMetadata.getMeta(FIELD_ESTABLISH_DATE)));
map.put(FIELD_ORG_LEVEL, StringUtils.toString(orgLevel, eiMetadata.getMeta(FIELD_ORG_LEVEL)));
map.put(FIELD_ORG_NODE_TYPE, StringUtils.toString(orgNodeType, eiMetadata.getMeta(FIELD_ORG_NODE_TYPE)));
map.put(FIELD_SORT_INDEX, StringUtils.toString(sortIndex, eiMetadata.getMeta(FIELD_SORT_INDEX)));
map.put(FIELD_REC_CREATOR, StringUtils.toString(recCreator, eiMetadata.getMeta(FIELD_REC_CREATOR)));
map.put(FIELD_REC_CREATE_TIME, StringUtils.toString(recCreateTime, eiMetadata.getMeta(FIELD_REC_CREATE_TIME)));
map.put(FIELD_REC_REVISOR, StringUtils.toString(recRevisor, eiMetadata.getMeta(FIELD_REC_REVISOR)));
map.put(FIELD_REC_REVISE_TIME, StringUtils.toString(recReviseTime, eiMetadata.getMeta(FIELD_REC_REVISE_TIME)));
map.put(FIELD_ARCHIVE_FLAG, StringUtils.toString(archiveFlag, eiMetadata.getMeta(FIELD_ARCHIVE_FLAG)));
map.put(FIELD_IS_DELETED, StringUtils.toString(isDeleted, eiMetadata.getMeta(FIELD_IS_DELETED)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE))); map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME))); map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME))); map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_LEVEL, StringUtils.toString(level, eiMetadata.getMeta(FIELD_LEVEL)));
return map; return map;
} }
......
...@@ -46,6 +46,7 @@ public class User extends DaoEPBase { ...@@ -46,6 +46,7 @@ public class User extends DaoEPBase {
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/ public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_DEP_NAME = "depName"; /* 部门名称*/ public static final String FIELD_DEP_NAME = "depName"; /* 部门名称*/
public static final String FIELD_ID_CODE = "idCode"; public static final String FIELD_ID_CODE = "idCode";
public static final String FIELD_ID_CARD = "idCard";
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/ public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_LOGIN_NAME = "LOGIN_NAME"; public static final String COL_LOGIN_NAME = "LOGIN_NAME";
...@@ -99,6 +100,7 @@ public class User extends DaoEPBase { ...@@ -99,6 +100,7 @@ public class User extends DaoEPBase {
private String depCode = ""; /* 部门编码*/ private String depCode = ""; /* 部门编码*/
private String depName = ""; /* 部门名称*/ private String depName = ""; /* 部门名称*/
private String idCode = ""; private String idCode = "";
private String idCard = "";
/** /**
* initialize the metadata. * initialize the metadata.
*/ */
...@@ -202,6 +204,9 @@ public class User extends DaoEPBase { ...@@ -202,6 +204,9 @@ public class User extends DaoEPBase {
eiColumn.setDescName("身份证号码"); eiColumn.setDescName("身份证号码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ID_CARD);
eiColumn.setDescName("身份证号码");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -576,6 +581,14 @@ public class User extends DaoEPBase { ...@@ -576,6 +581,14 @@ public class User extends DaoEPBase {
this.idCode = idCode; this.idCode = idCode;
} }
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -608,6 +621,7 @@ public class User extends DaoEPBase { ...@@ -608,6 +621,7 @@ public class User extends DaoEPBase {
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode)); setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_NAME)), depName)); setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_NAME)), depName));
setIdCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CODE)), idCode)); setIdCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CODE)), idCode));
setIdCard(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CARD)), idCard));
} }
/** /**
...@@ -641,6 +655,7 @@ public class User extends DaoEPBase { ...@@ -641,6 +655,7 @@ public class User extends DaoEPBase {
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE))); map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_DEP_NAME, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_DEP_NAME))); map.put(FIELD_DEP_NAME, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_DEP_NAME)));
map.put(FIELD_ID_CODE, StringUtils.toString(idCode, eiMetadata.getMeta(FIELD_ID_CODE))); map.put(FIELD_ID_CODE, StringUtils.toString(idCode, eiMetadata.getMeta(FIELD_ID_CODE)));
map.put(FIELD_ID_CARD, StringUtils.toString(idCard, eiMetadata.getMeta(FIELD_ID_CARD)));
return map; return map;
} }
......
...@@ -3,28 +3,44 @@ package com.baosight.hggp.hg.xs.service; ...@@ -3,28 +3,44 @@ package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcDeptList;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC098; import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/** /**
* @author:songx * @author:songx
* @date:2024/1/15,15:08 * @date:2024/1/15,15:08
*/ */
@Slf4j
public class ServiceHGXSOrg extends ServiceBase { public class ServiceHGXSOrg extends ServiceBase {
/** /**
...@@ -99,5 +115,101 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -99,5 +115,101 @@ public class ServiceHGXSOrg extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 同步智邦部门信息
*
* @param inInfo
* @return
*/
public EiInfo syncDcDept(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "企业编码不能为空");
ThreadUtils.FIXED_THREAD.execute(() -> {
try {
syncDcDeptData(accountCode);
} catch (Exception e) {
log.error("同步智邦部门信息失败:{}", e.getMessage(), e);
}
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步智邦部门信息成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步智邦部门信息失败");
}
return inInfo;
}
/**
* 同步智邦合同信息
*
* @param accountCode
*/
private void syncDcDeptData(String accountCode) throws IOException, InstantiationException, IllegalAccessException {
int pageIndex = 1;
Pager<DcDeptList> pager = DcOpenApi.deptList(pageIndex);
List<DcDeptList> zbDepts = pager.getData();
if (CollectionUtils.isEmpty(zbDepts)) {
return;
}
// 写入合同数据
syncDcDeptData(accountCode, zbDepts);
}
/**
* 写入部门信息
*
* @param accountCode
* @param zbDepts
*/
private void syncDcDeptData(String accountCode, List<DcDeptList> zbDepts) {
// 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
for (DcDeptList zbDept : zbDepts) {
String orgId = dbPz009.getLoginPrefix() + zbDept.getNodeId();
Org dbOrg = HGXSTools.XsOrg.get(orgId);
if (dbOrg == null) {
dbOrg = new Org();
dbOrg.setOrgId(orgId);
this.syncDcDeptAdd(accountCode, zbDept, dbOrg, dbPz009);
} else {
Map updateMap = new HashMap();
updateMap.put(Org.FIELD_ORG_ID, orgId);
updateMap.put(Org.FIELD_ORG_CNAME, zbDept.getNodeText());
updateMap.put(Org.FIELD_REC_REVISOR, "System");
updateMap.put(Org.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
updateMap.put(Org.FIELD_IS_DELETED, DeleteFlagEnum.UN_REMOVE.getCode().toString());
dao.update(HgXsSqlConstant.HgXsOrg.UPDATE_ORG_CNAME, updateMap);
}
}
}
/**
* 新增数据
*
* @param accountCode
* @param zbDept
* @param dbOrg
* @param dbPz009
*/
private void syncDcDeptAdd(String accountCode, DcDeptList zbDept, Org dbOrg, HGPZ009 dbPz009) {
String orgId = dbOrg.getOrgId();
dbOrg.setAccountCode(accountCode);
dbOrg.setOrgEname(orgId);
dbOrg.setOrgCname(zbDept.getNodeText());
dbOrg.setOrgType(OrgTypeEnum.DEPT.getCode());
dbOrg.setParentOrgId("-1".equals(zbDept.getParentId())
? accountCode : dbPz009.getLoginPrefix() + zbDept.getParentId());
dbOrg.setEstablishDate("20240101");
dbOrg.setSortIndex(zbDept.getFullSort());
dbOrg.setCompanyCode(accountCode);
dbOrg.setCompanyName(dbPz009.getAccountName());
dbOrg.setRecCreator("System");
dbOrg.setRecCreateTime(DateUtils.shortDateTime());
dbOrg.setIsDeleted(DeleteFlagEnum.UN_REMOVE.getCode().toString());
dao.insert("XSOG01.insert", dbOrg);
}
} }
...@@ -2,27 +2,46 @@ package com.baosight.hggp.hg.xs.service; ...@@ -2,27 +2,46 @@ package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcUser;
import com.baosight.hggp.core.extapp.decheng.model.DcUserList;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/** /**
* 当前类已屏蔽SQL自动补全企业参数,如需查询需要需自行添加企业编码参数 * 当前类已屏蔽SQL自动补全企业参数,如需查询需要需自行添加企业编码参数
* *
* @author:songx * @author:songx
* @date:2024/1/15,15:08 * @date:2024/1/15,15:08
*/ */
@Slf4j
public class ServiceHGXSUser extends ServiceBase { public class ServiceHGXSUser extends ServiceBase {
/** /**
...@@ -112,13 +131,13 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -112,13 +131,13 @@ public class ServiceHGXSUser extends ServiceBase {
}else { }else {
CommonMethod.initBlock(inInfo, list, queryMap, false); CommonMethod.initBlock(inInfo, list, queryMap, false);
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败"); LogUtils.setMsg(inInfo, e, "查询企业失败");
} }
return inInfo; return inInfo;
} }
/** /**
* 查询用户下拉框 * 查询用户下拉框
* *
...@@ -137,7 +156,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -137,7 +156,7 @@ public class ServiceHGXSUser extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 查询用户的企业下拉框 * 查询用户的企业下拉框
* *
...@@ -160,4 +179,153 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -160,4 +179,153 @@ public class ServiceHGXSUser extends ServiceBase {
return inInfo; return inInfo;
} }
/**
* 同步德诚用户信息
*
* @param inInfo
* @return
*/
public EiInfo syncDcSingleUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE));
Integer ord = MapUtils.getInteger(queryMap, "ord");
syncDcUserSingle(dbPz009, ord);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步德诚用户信息成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步德诚用户信息失败");
}
return inInfo;
}
/**
* 同步智邦用户信息
*
* @param inInfo
* @return
*/
public EiInfo syncDcUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "企业编码不能为空");
ThreadUtils.FIXED_THREAD.execute(() -> {
try {
syncDcUserData(accountCode);
} catch (Exception e) {
log.error("同步智邦用户信息失败:{}", e.getMessage(), e);
}
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步智邦用户信息成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步智邦用户信息失败");
}
return inInfo;
}
/**
* 同步智邦合同信息
*
* @param accountCode
*/
private void syncDcUserData(String accountCode) throws Exception {
int pageIndex = 1;
while (true) {
// 超过1000次不在执行
if (pageIndex > 1000) {
break;
}
Pager<DcUserList> pager = DcOpenApi.userList(pageIndex);
List<DcUserList> zbUsers = pager.getData();
if (CollectionUtils.isEmpty(zbUsers) || pageIndex > pager.getTotalPages()) {
break;
}
// 写入合同数据
syncDcUserData(accountCode, zbUsers);
pageIndex++;
}
}
/**
* 写入用户信息
*
* @param accountCode
* @param ZbUserLists
*/
private void syncDcUserData(String accountCode, List<DcUserList> ZbUserLists) {
// 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
for (DcUserList zbUserList : ZbUserLists) {
try {
syncDcUserSingle(dbPz009, zbUserList.getOrd());
} catch (Exception e) {
log.error("同步德诚用户失败:{}", e.getMessage(), e);
}
}
}
/**
* 同步单个用户
*
* @param dbPz009
* @param ord
* @throws IOException
*/
private void syncDcUserSingle(HGPZ009 dbPz009, Integer ord) throws Exception {
// 获取用户详情
DcUser zbUser = DcOpenApi.userDetail(ord);
if (zbUser == null) {
return;
}
String userId = dbPz009.getLoginPrefix() + ord;
// 判断用户是否存在
User dbUser = HGXSTools.XsUser.get(userId);
if (dbUser == null) {
this.syncDcSingleUserAdd(zbUser, dbPz009, userId);
} else {
this.syncDcSingleUserModify(zbUser, userId);
}
}
/**
* 新增用户
*
* @param zbUser
* @param dbPz009
* @param userId
* @throws Exception
*/
private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId)
throws Exception {
// 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, zbUser.getName(), zbUser.getSex(), zbUser.getEmail(),
zbUser.getCardid());
// 新增用户和组织机构关系
Map addMap = new HashMap();
addMap.put("orgId", dbPz009.getLoginPrefix() + zbUser.getOrgsid());
addMap.put("userId", userId);
addMap.put("recCreator", "System");
addMap.put("recCreateTime", DateUtils.shortDateTime());
dao.insert(HgXsSqlConstant.HgXsOrg.ADD_RELATION, addMap);
}
/**
* @param zbUser
* @param userId
*/
private void syncDcSingleUserModify(DcUser zbUser, String userId) {
Map updateMap = new HashMap();
updateMap.put(User.FIELD_LOGIN_NAME, userId);
updateMap.put(User.FIELD_USER_NAME, zbUser.getName());
updateMap.put(User.FIELD_GENDER, HGXSUtils.XsUser.convertGender(zbUser.getSex()));
updateMap.put(User.FIELD_EMAIL, zbUser.getEmail());
updateMap.put(User.FIELD_MOBILE, zbUser.getMobile());
updateMap.put(User.FIELD_ID_CARD, zbUser.getCardid() == null ? " " : zbUser.getCardid());
updateMap.put(User.FIELD_REC_REVISOR, "System");
updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap);
}
} }
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGXSOrg"> <sqlMap namespace="HGXSOrg">
<sql id="column">
ORG_ID as "orgId",
ORG_ENAME as "orgEname",
ORG_CNAME as "orgCname",
ORG_TYPE as "orgType",
PARENT_ORG_ID as "parentOrgId",
ACCOUNT_CODE AS "accountCode",
FACTORY_CODE AS "factoryCode",
COMPANY_CODE AS "companyCode"
</sql>
<sql id="condition"> <sql id="condition">
AND IS_DELETED = '0' AND IS_DELETED = '0'
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
...@@ -42,16 +53,18 @@ ...@@ -42,16 +53,18 @@
</sql> </sql>
<!-- 查询组织信息 --> <!-- 查询组织信息 -->
<select id="get" resultClass="com.baosight.hggp.hg.xs.domain.Org">
SELECT
<include refid="column"/>
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND ORG_ID = #orgId#
</select>
<!-- 查询组织信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.Org"> <select id="query" resultClass="com.baosight.hggp.hg.xs.domain.Org">
SELECT SELECT
ORG_ID as "orgId", <include refid="column"/>
ORG_ENAME as "orgEname",
ORG_CNAME as "orgCname",
ORG_TYPE as "orgType",
PARENT_ORG_ID as "parentOrgId",
ACCOUNT_CODE AS "accountCode",
FACTORY_CODE AS "factoryCode",
COMPANY_CODE AS "companyCode"
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
...@@ -242,4 +255,23 @@ ...@@ -242,4 +255,23 @@
AND C.LOGIN_NAME = #loginName# AND C.LOGIN_NAME = #loginName#
</select> </select>
<!-- 修改组织名称 -->
<update id="updateOrgCname">
UPDATE ${platSchema}.TXSOG01
SET
ORG_CNAME = #orgCname#,
REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#,
IS_DELETED = '0'
WHERE ORG_ID = #orgId#
</update>
<!-- 新增管理 -->
<insert id="addRelation">
INSERT INTO ${platSchema}.TXSOG02 (
ORG_ID, USER_ID, REC_CREATOR, REC_CREATE_TIME
) VALUES (
#orgId#, #userId#, #recCreator#, #recCreateTime#
)
</insert>
</sqlMap> </sqlMap>
...@@ -102,4 +102,18 @@ ...@@ -102,4 +102,18 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<!-- 修改德诚用户名称 -->
<update id="updateDcUser">
UPDATE ${platSchema}.XS_USER
SET
USER_NAME = #userName#,
GENDER = #gender#,
MOBILE = #mobile#,
EMAIL = #email#,
ID_CARD = #idCard#,
REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#
WHERE LOGIN_NAME = #loginName#
</update>
</sqlMap> </sqlMap>
...@@ -9,6 +9,7 @@ import com.baosight.hggp.hg.xs.domain.HGXS007; ...@@ -9,6 +9,7 @@ import com.baosight.hggp.hg.xs.domain.HGXS007;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.domain.UserGroup; import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
...@@ -206,8 +207,8 @@ public class HGXSTools { ...@@ -206,8 +207,8 @@ public class HGXSTools {
* @param gender * @param gender
* @param mobile * @param mobile
*/ */
public static void addUser(String accountCode, String userId, String userName, String gender, String mobile) public static void addUser(String accountCode, String userId, String userName, String gender, String mobile,
throws Exception { String idCard) throws Exception {
Map inInfoRowMap = new HashMap(); Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", userId); inInfoRowMap.put("userId", userId);
inInfoRowMap.put("loginName", userId); inInfoRowMap.put("loginName", userId);
...@@ -217,7 +218,8 @@ public class HGXSTools { ...@@ -217,7 +218,8 @@ public class HGXSTools {
inInfoRowMap.put("password", password); inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", password); inInfoRowMap.put("rePass", password);
inInfoRowMap.put("email", " "); inInfoRowMap.put("email", " ");
inInfoRowMap.put("gender", StringUtils.isBlank(gender) ? " " : gender); inInfoRowMap.put("idCard", StringUtils.isBlank(idCard) ? " " : idCard);
inInfoRowMap.put("gender", HGXSUtils.XsUser.convertGender(gender));
inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile); inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile);
inInfoRowMap.put("accountCode", accountCode); inInfoRowMap.put("accountCode", accountCode);
EiInfo inInfo = new EiInfo(); EiInfo inInfo = new EiInfo();
...@@ -315,7 +317,7 @@ public class HGXSTools { ...@@ -315,7 +317,7 @@ public class HGXSTools {
* *
* @return * @return
*/ */
public static Org get(String orgId) { public static Org query(String orgId) {
AssertUtils.isEmpty(orgId, "组织编码不能为空"); AssertUtils.isEmpty(orgId, "组织编码不能为空");
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("orgId", orgId); paramMap.put("orgId", orgId);
...@@ -327,6 +329,19 @@ public class HGXSTools { ...@@ -327,6 +329,19 @@ public class HGXSTools {
/** /**
* 查询组织机构 * 查询组织机构
* *
* @return
*/
public static Org get(String orgId) {
AssertUtils.isEmpty(orgId, "组织编码不能为空");
Map paramMap = new HashMap();
paramMap.put(Org.FIELD_ORG_ID, orgId);
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.GET, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询组织机构
*
* @param orgIds * @param orgIds
* @return * @return
*/ */
......
...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.xs.domain.UserGroup; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -22,6 +23,34 @@ import java.util.Map; ...@@ -22,6 +23,34 @@ import java.util.Map;
public class HGXSUtils { public class HGXSUtils {
/** /**
* @author:songx
* @date:2024/8/29,22:11
*/
public static class XsUser {
/**
* 性别转换
*
* @param gender
* @return
*/
public static String convertGender(String gender) {
if (StringUtils.isBlank(gender)) {
return " ";
} else if ("男".equals(gender)) {
return "1";
} else if ("女".equals(gender)) {
return "2";
} else if ("1".equals(gender) || "2".equals(gender)) {
return gender;
} else {
return " ";
}
}
}
/**
* 用户组 * 用户组
* *
* @author:songx * @author:songx
......
...@@ -41,7 +41,7 @@ public class ServiceXSOG0800 extends TreeService { ...@@ -41,7 +41,7 @@ public class ServiceXSOG0800 extends TreeService {
map.put("label", "root"); map.put("label", "root");
map.put("text", "组织机构"); map.put("text", "组织机构");
} else { } else {
Org org = HGXSTools.XsOrg.get(accountCode); Org org = HGXSTools.XsOrg.query(accountCode);
map.put("label", org == null ? "root" : org.getOrgId()); map.put("label", org == null ? "root" : org.getOrgId());
map.put("text", org == null ? "组织机构" : org.getOrgCname()); map.put("text", org == null ? "组织机构" : org.getOrgCname());
} }
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -353,7 +352,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -353,7 +352,7 @@ public class ServiceXSOG0801 extends ServiceBase {
deleteMap.put("orgId", orgId); deleteMap.put("orgId", orgId);
String userId = MapUtils.getString(deleteMap, "userId"); String userId = MapUtils.getString(deleteMap, "userId");
// 清空组织机构 // 清空组织机构
Org org = HGXSTools.XsOrg.get(orgId); Org org = HGXSTools.XsOrg.query(orgId);
clearHp013(orgId, org.getOrgType(), userId); clearHp013(orgId, org.getOrgType(), userId);
} }
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows()); call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
...@@ -489,7 +488,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -489,7 +488,7 @@ public class ServiceXSOG0801 extends ServiceBase {
row.put("recRevisor", UserSession.getLoginName()); row.put("recRevisor", UserSession.getLoginName());
String orgId = MapUtils.getString(row, "orgEname"); String orgId = MapUtils.getString(row, "orgEname");
// 清空组织机构下面人员的工人关系 // 清空组织机构下面人员的工人关系
Org org = HGXSTools.XsOrg.get(orgId); Org org = HGXSTools.XsOrg.query(orgId);
// 校验是否存在进行中的任务 // 校验是否存在进行中的任务
this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType()); this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
// 清除用工关系 // 清除用工关系
......
...@@ -52,7 +52,7 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -52,7 +52,7 @@ public class ServiceXSOG0801A extends ServiceEPBase {
OrgTypeEnum.DEPT.getCode()); OrgTypeEnum.DEPT.getCode());
} else { } else {
// 查询组织 // 查询组织
Org org = HGXSTools.XsOrg.get(parentOrgId); Org org = HGXSTools.XsOrg.query(parentOrgId);
if(CommonConstant.Field.ROOT.equals(org.getParentOrgId())) { if(CommonConstant.Field.ROOT.equals(org.getParentOrgId())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.COMPANY.getCode(), condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.COMPANY.getCode(),
OrgTypeEnum.FACTORY.getCode(), OrgTypeEnum.DEPT.getCode()); OrgTypeEnum.FACTORY.getCode(), OrgTypeEnum.DEPT.getCode());
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
import com.baosight.hggp.core.constant.CodesetConstant; import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.CodeValueTools; import com.baosight.hggp.core.tools.CodeValueTools;
...@@ -40,7 +39,7 @@ public class ServiceXSOG0801B extends ServiceEPBase { ...@@ -40,7 +39,7 @@ public class ServiceXSOG0801B extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
Org org = HGXSTools.XsOrg.get(MapUtils.getString(queryMap, "orgId")); Org org = HGXSTools.XsOrg.query(MapUtils.getString(queryMap, "orgId"));
// 回填父级ID // 回填父级ID
queryMap.put("parentOrgId", org.getParentOrgId()); queryMap.put("parentOrgId", org.getParentOrgId());
String condition; String condition;
......
...@@ -83,8 +83,9 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants { ...@@ -83,8 +83,9 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
return inInfo; return inInfo;
} }
// 企业账号无需校验身份证 added by songx at 20240819 // 企业账号无需校验身份证 added by songx at 20240819
if (loginName.lastIndexOf("0000") < 0) { if (!(loginName.lastIndexOf("0000") > -1 || " ".equals(idCard))) {
AssertUtils.isTrue(!HGSCUtil.isValidChineseID(idCard), "请填写正确的身份证号!"); AssertUtils.isEmpty(idCard, "请填写正确的身份证号");
// AssertUtils.isTrue(!HGSCUtil.isValidChineseID(idCard), "请填写正确的身份证号!");
} }
if (!rePass.equals(password)) { if (!rePass.equals(password)) {
inInfo.setStatus(-1); inInfo.setStatus(-1);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="10"> <Configuration status="WARN">
<Properties>
<Property name="PID">mylog</Property> <properties>
<property name="LOG_HOME">./logs</property>
<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property> <Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
<Property name="LOG_LEVEL_PATTERN">%5p</Property> <!--<Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread][%file:%line] - %msg%n</Property>--> <Property name="LOG_LEVEL_PATTERN">%5p</Property>
<!--参考文档 https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout --> <Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread] %logger{1.} - %msg%n</Property>
<Property name="LOG_PATTERN">%highlight{%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{1.} - %msg%n%}</Property> </properties>
<Property name="filename">iplat.$${date:yyyy-MM-dd}.log</Property>
</Properties> <Appenders>
<Appenders> <!--<Console name="Console" target="SYSTEM_OUT" follow="true">--> <!--<PatternLayout pattern="${LOG_PATTERN}"/>--> <!--</Console>--> <!-- 用来定义输出到控制台的配置 --> <!--*********************控制台日志***********************-->
<Console name="Console" target="SYSTEM_OUT"> <!-- 设置控制台只输出error及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)--> <Console name="Console" target="SYSTEM_OUT" follow="true">
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY" /> <PatternLayout charset="GBK" pattern="${LOG_PATTERN}"/>
<PatternLayout pattern="${LOG_PATTERN}" />
</Console> </Console>
<RollingRandomAccessFile name="MyFile" fileName="apps/logs/iplat.log" filePattern="apps/logs/iplat.%d{yyyy-MM-dd}-%i.log.gz"> <TextArea name="platLogAppender">
<PatternLayout pattern="%m%n"/>
</TextArea>
<!--*********************文件日志***********************-->
<!--info级别日志-->
<RollingFile name="InfoAppender" fileName="${LOG_HOME}/info.log"
filePattern="${LOG_HOME}/%d{yyyy-MM-dd}/info-%i.log.gz">
<!-- <Filters>-->
<!-- &lt;!&ndash;过滤掉warn及更高级别日志&ndash;&gt;-->
<!-- <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>-->
<!-- </Filters>-->
<!--设置日志格式-->
<PatternLayout> <PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{1.} - %msg%n%throwable{short}</Pattern> <pattern>${LOG_PATTERN}</pattern>
</PatternLayout> </PatternLayout>
<Policies> <Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" /> <!-- 设置日志文件切分参数 -->
<SizeBasedTriggeringPolicy size="1024 MB" /> <!--<OnStartupTriggeringPolicy/>-->
<!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
<SizeBasedTriggeringPolicy size="20MB"/>
<!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies> </Policies>
<DefaultRolloverStrategy max="50" /> <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
</RollingRandomAccessFile> <DefaultRolloverStrategy max="100"/>
<TextArea name="platLogAppender"> </RollingFile>
<PatternLayout pattern="%m%n" />
</TextArea> <!--warn级别日志-->
<RollingFile name="WarnAppender" fileName="${LOG_HOME}/warn.log"
filePattern="${LOG_HOME}/%d{yyyy-MM-dd}/warn-%i.log.gz">
<Filters>
<!--过滤掉error及更高级别日志-->
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
<!--设置日志格式-->
<PatternLayout>
<pattern>${LOG_PATTERN}</pattern>
</PatternLayout>
<Policies>
<!-- 设置日志文件切分参数 -->
<!--<OnStartupTriggeringPolicy/>-->
<!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
<SizeBasedTriggeringPolicy size="20MB"/>
<!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
<TimeBasedTriggeringPolicy/>
</Policies>
<!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
<DefaultRolloverStrategy max="100"/>
</RollingFile>
<!--error及更高级别日志-->
<RollingFile name="ErrorAppender" fileName="${LOG_HOME}/error.log"
filePattern="${LOG_HOME}/%d{yyyy-MM-dd}/error-%i.log.gz">
<!--设置日志格式-->
<PatternLayout>
<pattern>${LOG_PATTERN}</pattern>
</PatternLayout>
<Policies>
<!-- 设置日志文件切分参数 -->
<!--<OnStartupTriggeringPolicy/>-->
<!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
<SizeBasedTriggeringPolicy size="20MB"/>
<!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
<TimeBasedTriggeringPolicy/>
</Policies>
<!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
<DefaultRolloverStrategy max="100"/>
</RollingFile>
<Async name="Async">
<AppenderRef ref="InfoAppender" level="info"/>
<AppenderRef ref="WarnAppender" level="warn"/>
<AppenderRef ref="ErrorAppender" level="error"/>
</Async>
</Appenders> </Appenders>
<Loggers> <!--用来增加sql的日志,无论下面root logger级别是什么都输出sql log-->
<logger name="com.baosight.iplat4j.core.data.ibatis.dao.SqlMapDaoLogProxy" level="ERROR" /> <Loggers>
<AsyncLogger name="com.baosight.iplat4j" level="INFO" additivity="false"> <!-- 根日志设置 -->
<AppenderRef ref="Console" /> <Root level="info">
<AppenderRef ref="MyFile" /> <AppenderRef ref="Console"/>
<AppenderRef ref="platLogAppender" /> <AppenderRef ref="Async"/>
</AsyncLogger>
<logger name="org.springframework" level="ERROR" />
<logger name="org.thymeleaf" level="ERROR" />
<Root level="INFO">
<AppenderRef ref="Console" />
<AppenderRef ref="MyFile" />
<AppenderRef ref="platLogAppender" />
</Root> </Root>
<!--用来增加sql的日志,无论下面root logger级别是什么都输出sql log-->
<logger name="com.baosight.iplat4j.core.data.ibatis.dao.SqlMapDaoLogProxy" level="info"/>
<!--spring日志-->
<Logger name="org.springframework" level="error"/>
<!-- mybatis日志 -->
<Logger name="com.mybatis" level="warn"/>
<Logger name="org.hibernate" level="warn"/>
<Logger name="com.zaxxer.hikari" level="warn"/>
<Logger name="org.quartz" level="warn"/>
</Loggers> </Loggers>
</Configuration> </Configuration>
...@@ -97,5 +97,6 @@ ...@@ -97,5 +97,6 @@
<!-- 文档库 --> <!-- 文档库 -->
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD003.xml"/>
</sqlMapConfig> </sqlMapConfig>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-receiveId" cname="领料单id" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-receiveId" cname="领料单id" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货类型" blockId="inqu_status" ename="inventType" row="0" colWidth="3" <EF:EFSelect cname="存货类型" ename="inventType" blockId="inqu_status" row="0" colWidth="3"
optionLabel="全部" defultValue="" filter="contains"> optionLabel="全部" defultValue="" filter="contains">
<EF:EFOptions blockId="invent_type_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_type_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="left"/> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="220" align="left"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
......
$(function () {
IPLATUI.EFTree = {
"docTree": {
select: function (e) {
var nodeData = this.dataItem(e.node);
let value = nodeData.label;
let leafType = nodeData.leafType;
IPLATUI.EFTree.docTree.selectNode.treeId = value;
IPLATUI.EFTree.docTree.selectNode.leaf = nodeData.leaf;
IPLATUI.EFTree.docTree.selectNode.leafType = leafType;
// leafType=C:目录
if (leafType == 'C') {
$("#inqu_status-0-fileId").val(value);
$("#inqu_status-0-fileName").val(nodeData.text);
} else {
$("#inqu_status-0-fileId").val('');
$("#inqu_status-0-fileName").val('');
}
resultGrid.dataSource.page(1);
// 显示授权按钮
showAuthButton();
},
selectNode: {
treeId: '',
leaf: false,
leafType: ''
}
// ROOT: {label: "root", text: "系统菜单", leaf: true}
}
};
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
loadComplete: function (grid) {
}
}
}
// 树节点查询
$("#search").on("click", search);
// 查询
$("#QUERY").on("click", query);
// 授权
$("#AUTH").on("click", auth);
// 删除
$("#REMOVE_USER").on("click", removeUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
// 授权按钮是否可用
showAuthButton();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 树节点查询
*/
let search = function () {
let tree = $("#docTree").data("kendoTreeView");
let fileName = $("#searchText").val();
if (isBlank(fileName)) {
return;
}
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-fileName", fileName);
EiCommunicator.send("HGWD003", "searchNode", inInfo, {
onSuccess: function (res) {
if (-1 === res.getStatus()) {
message(res.msg);
return;
}
// 获取所有满足条件的子节点路径
var nodes = res.getBlock("$").getMappedRows();
expandTreeNode(tree, nodes);
},
onFail: function (res) {
message(res.msg);
}
});
}
/**
* 批量展开树节点
*
* @param tree
* @param nodeIdList
*/
function expandTreeNode(tree, nodes) {
if (nodes.length === 0 || tree == null) {
return;
}
const node = nodes[0];
let barDataItem = tree.dataSource.get(node);
if (barDataItem) {
tree.expandPath(nodes)
} else {
setTimeout(() => {
expandTreeNode(tree, nodes)
}, 100)
}
}
/**
* 授权
*/
let auth = function () {
let fileId = $("#inqu_status-0-fileId").val();
if (isBlank(fileId)) {
message("请选择需要授权的目录");
return;
}
let fileName = $("#inqu_status-0-fileName").val();
let params = {
"inqu_status-0-fileId": fileId
}
JSColorbox.open({
href: "HGWD003A",
title: "<div style='text-align: center;'>正在为:【" + fileName + "】授权用户</div>",
width: "70%",
height: "80%",
params: params,
callbackName: authCallback
});
}
/**
* 授权回调
*/
let authCallback = function (res) {
// 刷新页面
query();
}
/**
* 删除授权用户
*/
let removeUser = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD003", "removeUser",
false, function (res) {
message(res.msg);
if (res.status !== -1) {
query();
}
}
);
}
});
}
/**
* 显示授权按钮
*/
let showAuthButton = function () {
let leafType = IPLATUI.EFTree.docTree.selectNode.leafType;
// C:目录
if (leafType && leafType === 'C') {
$("#AUTH").attr("disabled", false);
$("#REMOVE_USER").attr("disabled", false);
} else {
$("#AUTH").attr("disabled", true);
$("#REMOVE_USER").attr("disabled", true);
}
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="文档权限管理">
<div class="row" style="margin: 0 -10px;">
<div class="col-md-4">
<EF:EFRegion title="文档目录树" id="tree" fitHeight="true">
<%-- <div class="row" style="display: block">--%>
<%-- <div class="col-md-12" style="display:flex;align-items: center">--%>
<%-- <EF:EFInput ename="searchText" colWidth="8" inline="true"/>--%>
<%-- <EF:EFButton ename="search" class="fa fa-search" layout="2"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HGWD003" methodName="queryTree">
</EF:EFTree>
</div>
</EF:EFRegion>
</div>
<div class="col-md-8">
<EF:EFRegion title="查询区" id="inqu">
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput cname="文件名称" ename="fileName" blockId="inqu_status" row="0" colWidth="3"
readonly="true"/>
<EF:EFInput cname="部门名称" ename="orgCname" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户账号" ename="userId" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户姓名" ename="userName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion title="已授权用户结果集" id="result">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</div>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 授权用户
$("#AUTH_USER").on("click", authUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 授权用户
*/
let authUser = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"授权\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD003A", "authUser",
true, function (res) {
message(res.msg);
if (res.status !== -1) {
parent.JSColorbox.setValueCallback(res);
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="文档授权用户">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="depName" cname="部门名称" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="loginName" cname="用户账号" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="userName" cname="用户姓名" blockId="inqu_status" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment