Commit 42e16fde by yukang

Merge remote-tracking branch 'origin/dev' into dev

parents 05d67ea0 02a23e9c
......@@ -27,98 +27,104 @@ import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* 切面处理类,操作日志异常日志记录处理
*/
@Slf4j
@Aspect //记录日志实现性能跟踪以及用户行为分析
@Component
public class OperationLogAspect {
private static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* 设置操作日志切入点 记录操作日志 在注解的位置切入代码
*/
@Pointcut("@annotation(com.baosight.hpjx.aspect.annotation.OperationLogAnnotation)")
public void operLogPointCut() {
}
/**
* 设置操作异常切入点记录异常日志 扫描所有dc包下操作
*/
@Pointcut("execution(* com.baosight.hpjx.hp.*.service..*.*(..))")
public void operExceptionLogPointCut() {
}
/**
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
*
* @param joinPoint 切入点
* @param keys 返回结果
*/
@AfterReturning(value = "operLogPointCut()", returning = "keys")
public void saveOperLog(JoinPoint joinPoint, Object keys) {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
if (opLog != null) {
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
String userId = UserSession.getLoginName();
String loginName = UserSession.getLoginCName();
String operModul = opLog.operModul();
String operType = opLog.operType();
String operDesc = opLog.operDesc();
boolean saveContet = opLog.saveContent();
String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection().prepareStatement(sql);
ps.setString(1,operModul);
ps.setString(2,operType);
ps.setString(3,operDesc);
if(saveContet && joinPoint.getArgs() != null) {
String strBlock = EiConstant.resultBlock;
EiInfo result = ((EiInfo) joinPoint.getArgs()[0]);
ps.setString(4, JSONObject.toJSONString(((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
}else {
ps.setString(4, "");
}
ps.setString(5,companyCode);
ps.setString(6,userId);
ps.setString(7,loginName);
ps.setString(8,DateUtils.shortDateTime());
ps.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*
* @param joinPoint 切入点
* @param e 异常信息
*/
@AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e")
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
// 获取RequestAttributes
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
// 从获取RequestAttributes中获取HttpServletRequest的信息
HttpServletRequest request = (HttpServletRequest) requestAttributes
.resolveReference(RequestAttributes.REFERENCE_REQUEST);
try {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
private static final Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* 设置操作日志切入点 记录操作日志 在注解的位置切入代码
*/
@Pointcut("@annotation(com.baosight.hpjx.aspect.annotation.OperationLogAnnotation)")
public void operLogPointCut() {
}
/**
* 设置操作异常切入点记录异常日志 扫描所有dc包下操作
*/
@Pointcut("execution(* com.baosight.hpjx.hp.*.service..*.*(..))")
public void operExceptionLogPointCut() {
}
/**
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
*
* @param joinPoint 切入点
* @param keys 返回结果
*/
@AfterReturning(value = "operLogPointCut()", returning = "keys")
public void saveOperLog(JoinPoint joinPoint, Object keys) {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
if (opLog != null) {
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
String userId = UserSession.getLoginName();
String loginName = UserSession.getLoginCName();
String operModul = opLog.operModul();
String operType = opLog.operType();
String operDesc = opLog.operDesc();
boolean saveContet = opLog.saveContent();
String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection()
.prepareStatement(sql);
ps.setString(1, operModul);
ps.setString(2, operType);
ps.setString(3, operDesc);
if (saveContet && joinPoint.getArgs() != null) {
String strBlock = EiConstant.resultBlock;
EiInfo result = ((EiInfo) joinPoint.getArgs()[0]);
ps.setString(4, JSONObject.toJSONString(
((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
} else {
ps.setString(4, "");
}
ps.setString(5, companyCode);
ps.setString(6, userId);
ps.setString(7, loginName);
ps.setString(8, DateUtils.shortDateTime());
ps.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*
* @param joinPoint 切入点
* @param e 异常信息
*/
@AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e")
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
// 获取RequestAttributes
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
// 从获取RequestAttributes中获取HttpServletRequest的信息
HttpServletRequest request = (HttpServletRequest) requestAttributes
.resolveReference(RequestAttributes.REFERENCE_REQUEST);
try {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
// 获取请求的类名
String className = joinPoint.getTarget().getClass().getName();
// 获取请求的方法名
......@@ -166,4 +172,4 @@ public class OperationLogAspect {
String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString();
return message;
}
}
\ No newline at end of file
}
package com.baosight.hpjx.aspect;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.util.EiInfoUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
/**
* 切面处理类,请求拦截
*/
@Slf4j
@Aspect
@Component
public class RequestControllerAspect {
/**
* 设置web请求切入点
*/
@Pointcut("execution(* com.baosight.iplat4j.core.web.controller.WebDispatchController.handleRequest(..))")
public void webDispatchPointCut() {
}
/**
* 设置service请求切入点
*/
@Pointcut("execution(* com.baosight.iplat4j.core.web.controller.ServiceDispatchController.dispatchService(..))")
public void serviceDispatchPointCut() {
}
/**
* web 请求切入点
*
* @param joinPoint
*/
@Before("webDispatchPointCut()")
public void webDispatchPageInfo(JoinPoint joinPoint) {
try {
Object[] objects = joinPoint.getArgs();
if (objects == null || objects.length == 0) {
return;
}
// 先取requert参数
HttpServletRequest request = (HttpServletRequest) objects[1];
String efParentFormEname = request.getParameter("efParentFormEname");
String formEname = StringUtils.isNotBlank(efParentFormEname) ? efParentFormEname
: ObjectUtils.toString(objects[0]);
if (StringUtils.isBlank(formEname)) {
log.warn("the web formEname is null");
ThreadLocalTools.FORM_ENAME.set("");
return;
}
// 非HP开头的页面不是业务模块的页面,无需校验数据权限
if (!formEname.startsWith("HP")) {
ThreadLocalTools.FORM_ENAME.set("");
return;
}
ThreadLocalTools.FORM_ENAME.set(formEname);
} catch (Exception e) {
log.error("webDispatchPageInfo设置切入点失败:{}", e.getMessage(), e);
}
}
/**
* service请求切入点
*
* @param joinPoint
*/
@Before("serviceDispatchPointCut()")
public void serviceDispatchPageInfo(JoinPoint joinPoint) {
try {
Object[] objects = joinPoint.getArgs();
if (objects == null || objects.length == 0) {
ThreadLocalTools.FORM_ENAME.set("");
return;
}
Object eiInfoStr = objects.length == 4 ? objects[3] : objects[2];
if (ObjectUtils.isEmpty(eiInfoStr)) {
log.warn("{}.{} the param is not EiInfo。param -> {}", objects[0], objects[1], eiInfoStr);
ThreadLocalTools.FORM_ENAME.set("");
return;
}
EiInfo inInfo = EiInfoUtil.json2EiInfo(eiInfoStr.toString());
// 如果存在父级页面号,说明是二级页面发送的请求;如果不存在就取当前请求的页面号
String efParentFormEname = inInfo.getString("efParentFormEname");
String pageEname = StringUtils.isNotBlank(efParentFormEname) ? efParentFormEname
: inInfo.getString("efCurFormEname");
// 非HP开头的页面不是业务模块的页面,无需校验数据权限
if (StringUtils.isBlank(pageEname) || !pageEname.startsWith("HP")) {
ThreadLocalTools.FORM_ENAME.set("");
return;
}
ThreadLocalTools.FORM_ENAME.set(pageEname);
} catch (Exception e) {
log.error("serviceDispatchPageInfo设置切入点失败:{}", e.getMessage(), e);
}
}
}
package com.baosight.hpjx.common;
/**
* 数据权限类型
*
* @author:songx
* @date:2024/3/21,9:58
*/
public enum AuthTypeEnum {
ALL("all", "全部"),
NO_AUTH("noAuth", "不可查看"),
ONLY_COMPANY("onlyCompany", "本企业"),
ONLY_FACTORY("onlyFactory", "本厂"),
ONLY_DEPT("onlyDept", "本部门");
/**
* 编码
*/
private String code;
/**
* 中文名称
*/
private String name;
AuthTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
/**
* 根据编码获取
*
* @param code
* @return
*/
public static AuthTypeEnum getByCode(String code) {
for (AuthTypeEnum item : AuthTypeEnum.values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -199,7 +199,7 @@ public enum DdynamicEnum {
* 用途:项目档案下拉框
* 编写:wwl
*/
ORG_RECORD_BLOCK_ID("org_record_block_id","orgId","orgCname","HPXSOrg.queryComboBox"),
ORG_RECORD_BLOCK_ID("org_record_block_id","orgId","orgCname","HPXSOrg.queryAll"),
/**
* 模块:用户企业
......
package com.baosight.hpjx.controller;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
......@@ -9,7 +11,6 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import com.baosight.hpjx.util.FileUtils;
import com.google.common.base.Joiner;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
......@@ -137,4 +138,25 @@ public class FileDownloadController {
}
return strBuilder.toString();
}
/**
* 数据权限临时使用
*
* @param value
* @param request
* @param response
* @throws IOException
*/
@RequestMapping({"/dataAuth/{value}"})
public String dataAuth(@PathVariable String value, HttpServletRequest request, HttpServletResponse response)
throws IOException {
try {
ThreadLocalTools.DATA_AUTH.set("0".equals(value) ? false : true);
} catch (Exception e) {
response.getWriter().write("数据接口异常");
return "操作失败";
}
return "操作成功";
}
}
package com.baosight.hpjx.core.configuration;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3;
import com.baosight.iplat4j.eu.dm.util.PlatFileUploader;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import lombok.extern.slf4j.Slf4j;
/**
* 初始化注入bean
*
* @author:songx
* @date:2024/3/13,15:03
*/
@Slf4j
@Configuration
@ConditionalOnProperty(
name = {"iplat4j.admin.objectStorage.s3.switch"},
havingValue = "on"
)
public class ConfigurationBean {
@Bean(name = "platFileUploader")
public PlatFileUploader newPlatFileUploader() {
return new PlatFileUploader();
}
@Bean(name = "fileUpLoadManager")
public PlatFileUploadManagerByAmazonS3 newPlatFileUploadManagerByAmazonS3() {
return new PlatFileUploadManagerByAmazonS3();
}
}
......@@ -106,22 +106,20 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
// 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "depCode", HPXSTools.getOrgId());
BeanUtils.setProperty(bean, "depCode", orgIds.get(0));
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
log.warn("写入创建人部门编码失败", e);
}
// 创建时刻
try {
......@@ -175,7 +173,7 @@ public class DaoUtils {
}
// 创建人部门编码
try {
map.put("depCode", HPXSTools.getOrgId());
map.put("depCode", HPXSTools.XsOrg.getOrgId());
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......
package com.baosight.hpjx.core.security;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -7,11 +8,14 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -20,8 +24,6 @@ import java.util.concurrent.ConcurrentMap;
public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap depMap = new ConcurrentHashMap();
private static ConcurrentMap userAdminMap = new ConcurrentHashMap();
/**
* 获取用户信息
......@@ -70,40 +72,30 @@ public class UserSessionUtils extends UserSession {
}
/**
* 获取登录用户的部门编码
* 获取登录用户的组织机构
*
* @return
*/
public static String getDepCode() {
String loginName = getLoginName();
if (loginName == null) {
return null;
}
String depCode = MapUtils.getString(depMap, loginName);
if (depCode == null) {
depCode = HPXSTools.getOrgId();
depCode = depCode == null ? "" : depCode.trim();
depMap.put(loginName, depCode);
}
return depCode;
public static List<String> getOrgId() {
return HPXSTools.XsOrg.getOrgId();
}
/**
* 获取登录用户是否超级管理员
* 获取登录用户的厂区编码
*
* @return
*/
public static boolean isUserAdmin() {
String loginName = getLoginName();
if (loginName == null) {
return false;
public static List<String> getFactoryCode() {
List<String> orgIds = getOrgId();
if (CollectionUtils.isEmpty(orgIds)) {
return null;
}
Boolean isUserAdmin = MapUtils.getBoolean(userAdminMap, loginName);
if (isUserAdmin == null) {
isUserAdmin = LoginUserDetails.isUserAdmin(loginName);
userAdminMap.put(loginName, isUserAdmin);
List<String> factoryCodes = new ArrayList<>();
for (String orgId : orgIds) {
Org org = HPXSTools.XsOrg.queryFactory(orgId);
factoryCodes.add(org.getOrgId());
}
return isUserAdmin;
return factoryCodes;
}
}
package com.baosight.hpjx.core.tools;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author:songx
* @date:2024/3/22,9:05
*/
public class ThreadLocalTools {
/**
* 请求页面号
*/
public static ThreadLocal<String> FORM_ENAME = new ThreadLocal<>();
/**
* 数据权限临时用,true-启用
*/
public static AtomicBoolean DATA_AUTH = new AtomicBoolean(true);
}
package com.baosight.hpjx.hp.constant;
import com.jcraft.jsch.UserAuth;
/**
* @author:songx
* @date:2024/1/18,17:16
......@@ -250,12 +252,16 @@ public class HPSqlConstant {
* @author:songx
* @date:2024/1/18,17:17
*/
public class HPPZ010 {
public class HpPz010 {
// 新增
public static final String INSERT = "HPPZ010.insert";
// 查询
public static final String QUERY = "HPPZ010.query";
// 查询菜单树
public static final String QUERY_PAGE_TREE = "HPPZ010.queryPageTree";
// 查询组织树
public static final String QUERY_ORG_TREE = "HPPZ010.queryOrgTree";
// 查询用户数据权限
public static final String QUERY_USER_AUTH = "HPPZ010.queryUserAuth";
}
/**
......@@ -386,7 +392,23 @@ public class HPSqlConstant {
// 已处理
public static final String DO_PROCESS2 = "HPZL001.doProcess2";
}
/**
* HPXSOrg SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HpXsOrg {
// 查询组织机构
public static final String QUERY = "HPXSOrg.query";
// 查询企业下所有的组织机构
public static final String QUERY_ALL = "HPXSOrg.queryAll";
// 查询父级信息,含自己(递归)
public static final String QUERY_PARENT = "HPXSOrg.queryParent";
// 查询用户组织机构
public static final String QUERY_ORG_ID = "HPXSUser.queryOrgId";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-03-04 15:58:48
Version : 1.0
schema : hpjx
tableName : SYS_OPERATION_LOG
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
OPER_MODUL VARCHAR,
OPER_TYPE VARCHAR,
OPER_DESC VARCHAR,
OPER_CONTENT VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPDS001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -4,25 +4,38 @@
Version : 1.0
schema : hpjx
tableName : TEUDM_TEMP
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
REAL_PATH VARCHAR
-->
<sqlMap namespace="HPDS002">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -106,7 +119,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
COMPANY_CODE asc,
COMPANY_CODE asc,
DOC_ID asc
</isEmpty>
</dynamic>
......
......@@ -30,16 +30,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -33,7 +33,20 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -43,13 +43,20 @@
FACTORY_CODE as "factoryCode" <!-- 厂区编码 -->
</sql>
<sql id="condition">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -38,16 +38,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -35,13 +35,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -36,16 +36,23 @@
A.FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
A.RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -31,16 +31,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -23,16 +23,23 @@
UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateMonth">
DATE_MONTH = #dateMonth#
</isNotEmpty>
......
......@@ -44,16 +44,23 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateType">
DATE_TYPE = #dateType#
</isNotEmpty>
......
......@@ -34,16 +34,23 @@
END_WEIGHT as "endWeight" <!-- 期末重量 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -26,16 +26,26 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
......
......@@ -25,16 +25,23 @@
VERSION as "version" <!-- 版本号 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
......
......@@ -34,13 +34,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
......
......@@ -32,16 +32,23 @@
VERSION as "version" <!-- 版本号 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
......
......@@ -25,13 +25,23 @@
C.PRINC as "princ" <!-- 负责人 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="inventRecordId">
A.INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode#
</isNotEmpty>
......
package com.baosight.hpjx.hp.mt.service;
import cn.hutool.core.util.PageUtil;
import cn.hutool.core.util.StrUtil;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile;
import com.baosight.hpjx.hp.mt.untils.Base64Utils;
import com.baosight.hpjx.hp.mt.untils.UploadUtils;
import com.baosight.hpjx.hp.mt.untils.UploadUtils2;
import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.domain.HPZL001A;
......@@ -28,12 +22,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import net.sf.json.JSONObject;
import org.apache.commons.collections.MapUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.imageio.ImageIO;
......@@ -66,32 +55,34 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmProject(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmProject(EiInfo inInfo) {
String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
List<Map> count = this.dao.query("HPMT002.pmProjectCount", sqlMap);
offset=(offset-1)*pageSize;
List count = this.dao.query("HPMT002.pmProjectCount", sqlMap);
offset=(offset-1)*pageSize;
sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmProject", sqlMap);
List<Map> maps = new ArrayList<>();
resultMap.put("result",rows);
resultMap.put("count",count.size());
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
for (Map row : rows) {
if (!row.get("actualCompletionNum").equals(row.get("num"))){
maps.add(row);
}
}
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(maps);
outInfo.setBlock(eiBlock);
outInfo.set("count",count.get(0));
return outInfo;
}
/**
......@@ -100,24 +91,18 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmProjectCount(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmProjectCount(EiInfo inInfo) {
String projName = inInfo.getString("projName");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
int count = this.dao.count("HPMT002.pmProjectCount", sqlMap);
resultMap.put("count",count);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
inInfo.set("count", count);
return inInfo;
}
/**
......@@ -126,24 +111,20 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmQuality(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmQuality(EiInfo inInfo) {
String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("queryMonth", queryMonth);
List<Map> rows = this.dao.query("HPMT002.pmQuality", sqlMap);
resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
return outInfo;
}
/**
......@@ -152,14 +133,15 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmQualityList(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmQualityList(EiInfo inInfo) {
String status = inInfo.getString("status");
String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
......@@ -169,16 +151,12 @@ public class ServiceHPMT002 extends ServiceBase {
sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmQualityList", sqlMap);
resultMap.put("result",rows);
resultMap.put("count",count.get(0));
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
outInfo.set("count", count.get(0));
return outInfo;
}
......@@ -188,47 +166,60 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmQualityDetail(EiInfo inInfo) {
Map resultMap = new HashMap();
public EiInfo pmQualityDetail(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
String id = inInfo.getString("id");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
outInfo.setMsg("账号异常");
}
Map Map = new HashMap();
Map.put("checkId", id);
Map.put("docType",1);
List<HPZL001A> docIdlist = this.dao.query("HPZL001A.queryRun", Map);
List<HPZL001A> docIdlist = this.dao.query("HPZL001A.queryDev", Map);
List<String> imgList = new ArrayList<>();
for (int i = 0; i < docIdlist.size(); i++) {
Map dirId = new HashMap();
HPZL001A hpzl001A = docIdlist.get(i);
String docId = hpzl001A.getDocId();
imgList.add(docId);
dirId.put("docId", docId);
List<Map> query = this.dao.query("HPMT002.queryFile", dirId);
File file = new File(UploadUtils.ROOT_PATH + "/A/" + query.get(0).get("CHG_NAME"));
BufferedImage bf = ImageIO.read(file);
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList.add(imgBase64);
}
//处理的文件
Map Map2 = new HashMap();
Map2.put("checkId", id);
Map2.put("docType",2);
List<HPZL001A> docIdlist2 = this.dao.query("HPZL001A.queryRun", Map2);
List<HPZL001A> docIdlist2 = this.dao.query("HPZL001A.queryDev", Map2);
List<String> imgList2 = new ArrayList<>();
for (int i = 0; i < docIdlist2.size(); i++) {
Map dirId = new HashMap();
HPZL001A hpzl001A = docIdlist2.get(i);
String docId = hpzl001A.getDocId();
imgList2.add(docId);
dirId.put("docId", docId);
List<Map> query = this.dao.query("HPMT002.queryFile", dirId);
File file = new File(UploadUtils.ROOT_PATH + "/A/" + query.get(0).get("CHG_NAME"));
BufferedImage bf = ImageIO.read(file);
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList2.add(imgBase64);
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("id", id);
List<Map> rows = this.dao.query("HPMT002.pmQualityDetail", sqlMap);
resultMap.put("result",rows);
resultMap.put("img",imgList);
resultMap.put("img2",imgList2);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
outInfo.set("img",imgList);
outInfo.set("img2",imgList2);
} catch (Exception e){
outInfo.setMsg("账号异常");
}
return outInfo;
}
/**
......@@ -237,15 +228,16 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmQualityXl(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmQualityXl(EiInfo inInfo) {
String factoryId= inInfo.getString("factoryId");//工厂id
String prodCode = inInfo.getString("projCode");//项目id
String orgNo = inInfo.getString("orgNo");//生产组id
String inventCode = inInfo.getString("inventCode");//部件id
String subInventCode = inInfo.getString("subInventCode");//零件id
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("factoryCode", factoryId);
......@@ -255,30 +247,16 @@ public class ServiceHPMT002 extends ServiceBase {
sqlMap.put("subInventCode", subInventCode);
EiInfo outInfo = new EiInfo();
TEDCM01 tedcm01 = new TEDCM01();
List<Map> queryFactory = this.dao.query("HPMT002.queryFactory", sqlMap);
List<Map> queryProjCode = this.dao.query("HPMT002.queryProjCode", sqlMap);
List<Map> queryPrdtCode = this.dao.query("HPMT002.queryPrdtCode", sqlMap);
List<Map> queryOrgNo = this.dao.query("HPMT002.queryOrgNo", sqlMap);
List<Map> queryPartCode = this.dao.query("HPMT002.queryPartCode", sqlMap);
List<Map> queryTedcm01 = this.dao.query("HPXSOrg.queryTedcm01",tedcm01);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_FACTORY), null, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PROJCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRDTCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_ORG_NO), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PARTCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.POOR_TYPE_BLOCK_ID), null, false);
if(subInventCode!=null&&!subInventCode.equals("")){
List<Map> queryProdTaskNo = this.dao.query("HPMT002.queryProdTaskNo",sqlMap);
resultMap.put("ProdTaskNo",queryProdTaskNo);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRODTASKNO), sqlMap, false);
}
resultMap.put("Factory",queryFactory);
resultMap.put("ProjCode",queryProjCode);
resultMap.put("PrdtCode",queryPrdtCode);
resultMap.put("OrgNo",queryOrgNo);
resultMap.put("PartCode",queryPartCode);
resultMap.put("Tedcm01",queryTedcm01);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
return outInfo;
}
/**
......@@ -287,57 +265,56 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmInsertQuality(EiInfo inInfo) {
Map resultMap = new HashMap();
public EiInfo pmInsertQuality(EiInfo inInfo) {
String docId = inInfo.getString("docId");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try {
String docId = inInfo.getString("docId");
String companyCode = UserSessionUtils.getCompanyCode();
HPZL001 fZl001 = new HPZL001();
Map attr = inInfo.getAttr();
fZl001.fromMap(attr);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fZl001.setCreatedTime(sdf.format(new Date()));
fZl001.setReceiptDate(DateUtils.shortDate());
fZl001.setCompanyCode(companyCode);
User user = UserSessionUtils.getUser();
fZl001.setCheckUser(user.getUserName());
fZl001.setCheckNo(user.getUserId());
// 生成单据号
fZl001.setCheckNo(SequenceGenerator.getNextSequence(
HPConstant.SequenceId.HPZL001_NUMBER));
fZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
fZl001.setStatus(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPZL001.INSERT, fZl001);
//处理文件
if (!docId.equals("")) {
Map fZl0012 = new HashMap();
fZl0012.put("checkNo", fZl001.getCheckNo());
List<HPZL001> HPZL001 = dao.query("HPZL001.query", fZl0012);
//绑定文件
String[] docIds = docId.split(",");
int num = 0;
while (num < docIds.length) {
HPZL001A HPZL001A = new HPZL001A();
HPZL001A.setDeptCode(CommonConstant.YesNo.YES);
HPZL001A.setDocType(CommonConstant.YesNo.YES_1);
HPZL001A.setBizType("XJ_WC");
HPZL001A.setDocId(docIds[num]);
HPZL001A.setCheckId(HPZL001.get(0).getId());
HPZL001A.setCompanyCode(companyCode);
DaoUtils.insert(HPZL001A.INSERT, HPZL001A);
num++;
}
}
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
HPZL001 fZl001 = new HPZL001();
Map attr = inInfo.getAttr();
fZl001.fromMap(attr);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fZl001.setCreatedTime(sdf.format(new Date()));
fZl001.setReceiptDate(DateUtils.shortDate());
fZl001.setCompanyCode(companyCode);
User user = UserSessionUtils.getUser();
fZl001.setCheckUser(user.getUserName());
fZl001.setCheckNo(user.getUserId());
// 生成单据号
fZl001.setCheckNo(SequenceGenerator.getNextSequence(
HPConstant.SequenceId.HPZL001_NUMBER));
fZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
fZl001.setStatus(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPZL001.INSERT, fZl001);
//处理文件
if(!docId.equals("")) {
Map fZl0012 = new HashMap();
fZl0012.put("checkNo", fZl001.getCheckNo());
List<HPZL001> HPZL001 =dao.query("HPZL001.query", fZl0012);
//绑定文件
String[] docIds = docId.split(",");
int num = 0;
while (num < docIds.length) {
HPZL001A HPZL001A = new HPZL001A();
HPZL001A.setDeptCode(CommonConstant.YesNo.YES);
HPZL001A.setDocType(CommonConstant.YesNo.YES_1);
HPZL001A.setBizType("XJ_WC");
HPZL001A.setDocId(docIds[num]);
HPZL001A.setCheckId(HPZL001.get(0).getId());
HPZL001A.setCompanyCode(companyCode);
DaoUtils.insert(HPZL001A.INSERT, HPZL001A);
num++;
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
......@@ -346,11 +323,13 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmModifyQuality(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmModifyQuality(EiInfo inInfo) {
String docId = inInfo.getString("docId");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try {
HPZL001 fZl001 = new HPZL001();
Map attr = inInfo.getAttr();
fZl001.fromMap(attr);
......@@ -378,14 +357,11 @@ public class ServiceHPMT002 extends ServiceBase {
num++;
}
}
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
inInfo.setMsg("处理成功!");
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
LogUtils.setDetailMsg(inInfo, e, "处理失败");
}
return inInfo;
}
......@@ -395,22 +371,23 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo
* @return
*/
public Map pmUploadFile(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
public EiInfo pmUploadFile(EiInfo inInfo) {
String files = inInfo.getString("files");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try {
CommonsMultipartFile multipartFile = Base64ToMultipartFile.base64toMultipartFile(files);
System.out.println("--------------------------------转换Base64成功");
JSONObject upload = UploadUtils2.upload(multipartFile);
resultMap.put("id",upload.getString("docId"));
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
JSONObject upload = UploadUtils.upload(multipartFile);
inInfo.set("id",upload.getString("docId"));
inInfo.setMsg("上传成功!");
}
catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
}
......@@ -15,109 +15,143 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-18 17:09:53 create
* @history 2024-03-27 18:22:41 create
*/
public class HPPZ010 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_SUBJECT_ID = "subjectId"; /* 授权主体ID*/
public static final String FIELD_SUBJECT_TYPE = "subjectType"; /* 授权主体类别*/
public static final String FIELD_OBJECT_ID = "objectId"; /* 授权客体ID*/
public static final String FIELD_OBJECT_TYPE = "objectType"; /* 授权客体类别*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
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_PAGE_ENAME = "pageEname"; /* 页面英文名*/
public static final String FIELD_PAGE_CNAME = "pageCname"; /* 页面中文名*/
public static final String FIELD_AUTH_DEP_CODE = "authDepCode"; /* 权限部门编码*/
public static final String FIELD_AUTH_DEP_NAME = "authDepName"; /* 权限部门名称*/
public static final String FIELD_AUTH_TYPE = "authType"; /* 权限类型*/
public static final String FIELD_LINKAGE_FLAG = "linkageFlag"; /* 0-不联动,1-联动*/
public static final String COL_ID = "ID";
public static final String COL_SUBJECT_ID = "SUBJECT_ID"; /* 授权主体ID*/
public static final String COL_SUBJECT_TYPE = "SUBJECT_TYPE"; /* 授权主体类别*/
public static final String COL_OBJECT_ID = "OBJECT_ID"; /* 授权客体ID*/
public static final String COL_OBJECT_TYPE = "OBJECT_TYPE"; /* 授权客体类别*/
public static final String COL_COMPANY_CODE = "COMPANY_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"; /* 更新时间*/
private Long id = null;
private String subjectId = " "; /* 授权主体ID*/
private String subjectType = " "; /* 授权主体类别*/
private String objectId = " "; /* 授权客体ID*/
private String objectType = " "; /* 授权客体类别*/
public static final String COL_PAGE_ENAME = "PAGE_ENAME"; /* 页面英文名*/
public static final String COL_PAGE_CNAME = "PAGE_CNAME"; /* 页面中文名*/
public static final String COL_AUTH_DEP_CODE = "AUTH_DEP_CODE"; /* 权限部门编码*/
public static final String COL_AUTH_DEP_NAME = "AUTH_DEP_NAME"; /* 权限部门名称*/
public static final String COL_AUTH_TYPE = "AUTH_TYPE"; /* 权限类型*/
public static final String COL_LINKAGE_FLAG = "LINKAGE_FLAG"; /* 0-不联动,1-联动*/
public static final String QUERY = "HPPZ010.query";
public static final String COUNT = "HPPZ010.count";
public static final String INSERT = "HPPZ010.insert";
public static final String UPDATE = "HPPZ010.update";
public static final String DELETE = "HPPZ010.delete";
private Long id = new Long(0);
private String companyCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private String pageEname = " "; /* 页面英文名*/
private String pageCname = " "; /* 页面中文名*/
private String authDepCode = " "; /* 权限部门编码*/
private String authDepName = " "; /* 权限部门名称*/
private String authType = " "; /* 权限类型*/
private Integer linkageFlag; /* 0-不联动,1-联动*/
/**
* 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_SUBJECT_ID);
eiColumn.setDescName("授权主体ID");
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUBJECT_TYPE);
eiColumn.setDescName("授权主体类别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OBJECT_ID);
eiColumn.setDescName("授权客体ID");
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OBJECT_TYPE);
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_PAGE_ENAME);
eiColumn.setDescName("页面英文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PAGE_CNAME);
eiColumn.setDescName("页面中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_CODE);
eiColumn.setDescName("权限部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_NAME);
eiColumn.setDescName("权限部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_TYPE);
eiColumn.setDescName("权限类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LINKAGE_FLAG);
eiColumn.setDescName("0-不联动,1-联动");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ010() {
initMetaData();
}
/**
* get the id .
* @return the id
......@@ -125,7 +159,7 @@ public class HPPZ010 extends DaoEPBase {
public Long getId() {
return this.id;
}
/**
* set the id .
*
......@@ -135,68 +169,36 @@ public class HPPZ010 extends DaoEPBase {
this.id = id;
}
/**
* get the subjectId - 授权主体ID.
* @return the subjectId
* get the companyCode - 企业编码.
* @return the companyCode
*/
public String getSubjectId() {
return this.subjectId;
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the subjectId - 授权主体ID.
* set the companyCode - 企业编码.
*
* @param subjectId - 授权主体ID
* @param companyCode - 企业编码
*/
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the subjectType - 授权主体类别.
* @return the subjectType
* get the depCode - 部门编码.
* @return the depCode
*/
public String getSubjectType() {
return this.subjectType;
public String getDepCode() {
return this.depCode;
}
/**
* set the subjectType - 授权主体类别.
* set the depCode - 部门编码.
*
* @param subjectType - 授权主体类别
* @param depCode - 部门编码
*/
public void setSubjectType(String subjectType) {
this.subjectType = subjectType;
}
/**
* get the objectId - 授权客体ID.
* @return the objectId
*/
public String getObjectId() {
return this.objectId;
}
/**
* set the objectId - 授权客体ID.
*
* @param objectId - 授权客体ID
*/
public void setObjectId(String objectId) {
this.objectId = objectId;
}
/**
* get the objectType - 授权客体类别.
* @return the objectType
*/
public String getObjectType() {
return this.objectType;
}
/**
* set the objectType - 授权客体类别.
*
* @param objectType - 授权客体类别
*/
public void setObjectType(String objectType) {
this.objectType = objectType;
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 创建人.
......@@ -205,7 +207,7 @@ public class HPPZ010 extends DaoEPBase {
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
......@@ -221,7 +223,7 @@ public class HPPZ010 extends DaoEPBase {
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
......@@ -237,7 +239,7 @@ public class HPPZ010 extends DaoEPBase {
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
......@@ -253,7 +255,7 @@ public class HPPZ010 extends DaoEPBase {
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
......@@ -269,7 +271,7 @@ public class HPPZ010 extends DaoEPBase {
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 更新人名称.
*
......@@ -285,7 +287,7 @@ public class HPPZ010 extends DaoEPBase {
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
......@@ -295,45 +297,149 @@ public class HPPZ010 extends DaoEPBase {
this.updatedTime = updatedTime;
}
/**
* get the pageEname - 页面英文名.
* @return the pageEname
*/
public String getPageEname() {
return this.pageEname;
}
/**
* set the pageEname - 页面英文名.
*
* @param pageEname - 页面英文名
*/
public void setPageEname(String pageEname) {
this.pageEname = pageEname;
}
/**
* get the pageCname - 页面中文名.
* @return the pageCname
*/
public String getPageCname() {
return this.pageCname;
}
/**
* set the pageCname - 页面中文名.
*
* @param pageCname - 页面中文名
*/
public void setPageCname(String pageCname) {
this.pageCname = pageCname;
}
/**
* get the authDepCode - 权限部门编码.
* @return the authDepCode
*/
public String getAuthDepCode() {
return this.authDepCode;
}
/**
* set the authDepCode - 权限部门编码.
*
* @param authDepCode - 权限部门编码
*/
public void setAuthDepCode(String authDepCode) {
this.authDepCode = authDepCode;
}
/**
* get the authDepName - 权限部门名称.
* @return the authDepName
*/
public String getAuthDepName() {
return this.authDepName;
}
/**
* set the authDepName - 权限部门名称.
*
* @param authDepName - 权限部门名称
*/
public void setAuthDepName(String authDepName) {
this.authDepName = authDepName;
}
/**
* get the authType - 权限类型.
* @return the authType
*/
public String getAuthType() {
return this.authType;
}
/**
* set the authType - 权限类型.
*
* @param authType - 权限类型
*/
public void setAuthType(String authType) {
this.authType = authType;
}
/**
* get the linkageFlag - 0-不联动,1-联动.
* @return the linkageFlag
*/
public Integer getLinkageFlag() {
return this.linkageFlag;
}
/**
* set the linkageFlag - 0-不联动,1-联动.
*
* @param linkageFlag - 0-不联动,1-联动
*/
public void setLinkageFlag(Integer linkageFlag) {
this.linkageFlag = linkageFlag;
}
/**
* 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));
setSubjectId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUBJECT_ID)), subjectId));
setSubjectType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUBJECT_TYPE)), subjectType));
setObjectId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OBJECT_ID)), objectId));
setObjectType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OBJECT_TYPE)), objectType));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
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));
setPageEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_ENAME)), pageEname));
setPageCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_CNAME)), pageCname));
setAuthDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_CODE)), authDepCode));
setAuthDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_NAME)), authDepName));
setAuthType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_TYPE)), authType));
setLinkageFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LINKAGE_FLAG)), linkageFlag));
}
/**
* 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_SUBJECT_ID, StringUtils.toString(subjectId, eiMetadata.getMeta(FIELD_SUBJECT_ID)));
map.put(FIELD_SUBJECT_TYPE, StringUtils.toString(subjectType, eiMetadata.getMeta(FIELD_SUBJECT_TYPE)));
map.put(FIELD_OBJECT_ID, StringUtils.toString(objectId, eiMetadata.getMeta(FIELD_OBJECT_ID)));
map.put(FIELD_OBJECT_TYPE, StringUtils.toString(objectType, eiMetadata.getMeta(FIELD_OBJECT_TYPE)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_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_PAGE_ENAME, StringUtils.toString(pageEname, eiMetadata.getMeta(FIELD_PAGE_ENAME)));
map.put(FIELD_PAGE_CNAME, StringUtils.toString(pageCname, eiMetadata.getMeta(FIELD_PAGE_CNAME)));
map.put(FIELD_AUTH_DEP_CODE, StringUtils.toString(authDepCode, eiMetadata.getMeta(FIELD_AUTH_DEP_CODE)));
map.put(FIELD_AUTH_DEP_NAME, StringUtils.toString(authDepName, eiMetadata.getMeta(FIELD_AUTH_DEP_NAME)));
map.put(FIELD_AUTH_TYPE, StringUtils.toString(authType, eiMetadata.getMeta(FIELD_AUTH_TYPE)));
map.put(FIELD_LINKAGE_FLAG, StringUtils.toString(linkageFlag, eiMetadata.getMeta(FIELD_LINKAGE_FLAG)));
return map;
}
}
package com.baosight.hpjx.hp.pz.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:THppz010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-21 10:15:34 create
*/
public class HPPZ010A extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户中文名*/
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
public static final String FIELD_PAGE_ENAME = "pageEname"; /* 页面英文名*/
public static final String FIELD_PAGE_CNAME = "pageCname"; /* 页面中文名*/
public static final String FIELD_AUTH_DEP_CODE = "authDepCode"; /* 权限部门编码*/
public static final String FIELD_AUTH_DEP_NAME = "authDepName"; /* 权限部门名称*/
public static final String FIELD_AUTH_TYPE = "authType"; /* 权限类型*/
public static final String FIELD_LINKAGE_FLAG = "linkageFlag"; /* 0-不联动,1-联动*/
private String companyCode = " "; /* 企业编码*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户中文名*/
private String gender = " "; /* 性别*/
private String mobile = " "; /* 手机号*/
private String email = " "; /* 邮箱*/
private String orgId = " "; /* 组织机构ID*/
private String orgCname = " "; /* 组织机构名称*/
private String pageEname = " "; /* 页面英文名*/
private String pageCname = " "; /* 页面中文名*/
private String authDepCode = " "; /* 权限部门编码*/
private String authDepName = " "; /* 权限部门名称*/
private String authType = " "; /* 权限类型*/
private Integer linkageFlag; /* 0-不联动,1-联动*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码");
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_GENDER);
eiColumn.setDescName("性别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MOBILE);
eiColumn.setDescName("手机号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EMAIL);
eiColumn.setDescName("邮箱");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("组织机构ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织机构名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PAGE_ENAME);
eiColumn.setDescName("页面英文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PAGE_CNAME);
eiColumn.setDescName("页面中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_CODE);
eiColumn.setDescName("权限部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_NAME);
eiColumn.setDescName("权限部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_TYPE);
eiColumn.setDescName("权限类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LINKAGE_FLAG);
eiColumn.setDescName("0-不联动,1-联动");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ010A() {
initMetaData();
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
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;
}
public String getPageEname() {
return pageEname;
}
public void setPageEname(String pageEname) {
this.pageEname = pageEname;
}
public String getPageCname() {
return pageCname;
}
public void setPageCname(String pageCname) {
this.pageCname = pageCname;
}
public String getAuthDepCode() {
return authDepCode;
}
public void setAuthDepCode(String authDepCode) {
this.authDepCode = authDepCode;
}
public String getAuthDepName() {
return authDepName;
}
public void setAuthDepName(String authDepName) {
this.authDepName = authDepName;
}
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public Integer getLinkageFlag() {
return linkageFlag;
}
public void setLinkageFlag(Integer linkageFlag) {
this.linkageFlag = linkageFlag;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setGender(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GENDER)), gender));
setMobile(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MOBILE)), mobile));
setEmail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EMAIL)), email));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setPageEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_ENAME)), pageEname));
setPageCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_CNAME)), pageCname));
setAuthDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_CODE)), authDepCode));
setAuthDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_NAME)), authDepName));
setAuthType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_TYPE)), authType));
setLinkageFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LINKAGE_FLAG)), linkageFlag));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
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_GENDER, StringUtils.toString(gender, eiMetadata.getMeta(FIELD_GENDER)));
map.put(FIELD_MOBILE, StringUtils.toString(mobile, eiMetadata.getMeta(FIELD_MOBILE)));
map.put(FIELD_EMAIL, StringUtils.toString(email, eiMetadata.getMeta(FIELD_EMAIL)));
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)));
map.put(FIELD_PAGE_ENAME, StringUtils.toString(pageEname, eiMetadata.getMeta(FIELD_PAGE_ENAME)));
map.put(FIELD_PAGE_CNAME, StringUtils.toString(pageCname, eiMetadata.getMeta(FIELD_PAGE_CNAME)));
map.put(FIELD_AUTH_DEP_CODE, StringUtils.toString(authDepCode, eiMetadata.getMeta(FIELD_AUTH_DEP_CODE)));
map.put(FIELD_AUTH_DEP_NAME, StringUtils.toString(authDepName, eiMetadata.getMeta(FIELD_AUTH_DEP_NAME)));
map.put(FIELD_AUTH_TYPE, StringUtils.toString(authType, eiMetadata.getMeta(FIELD_AUTH_TYPE)));
map.put(FIELD_LINKAGE_FLAG, StringUtils.toString(linkageFlag, eiMetadata.getMeta(FIELD_LINKAGE_FLAG)));
return map;
}
}
......@@ -238,10 +238,9 @@ public class ServiceHPPZ009 extends ServiceBase {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HPXSTools.countByCompany(fPz009.getCompanyCode());
int count = HPXSTools.XsUser.countByCompany(fPz009.getCompanyCode());
if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户",
fPz009.getCompanyName()));
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getCompanyName()));
}
DaoUtils.update(HPPZ009.DELETE, fPz009);
}
......
......@@ -3,20 +3,23 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.List;
......@@ -36,7 +39,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "初始化")
@OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ010().eiMetadata);
......@@ -52,11 +55,11 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "查询数据列表")
@Override
@OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "查询数据列表")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPSqlConstant.HPPZ010.QUERY, new HPPZ010());
inInfo = super.query(inInfo, HPSqlConstant.HpPz010.QUERY, new HPPZ010());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -64,211 +67,131 @@ public class ServiceHPPZ010 extends ServiceBase {
}
/**
* 保存操作.
* 查询树节点
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
public EiInfo queryPageTree(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
if (fPz009.getId() == null || fPz009.getId() == 0) {
this.add(fPz009);
} else {
this.modify(fPz009);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, "node");
String parentNode = StringUtils.isEmpty(node) || "$".equals(node) ? "root" : node;
Map params = new HashMap();
String loginName = UserSession.getUser().getUsername();
params.put("node", parentNode);
params.put("loginName", loginName);
// 管理员查所有
params.put("isUserAdmin", LoginUserDetails.isUserAdmin(loginName) ? CommonConstant.YesNo.YES
: CommonConstant.YesNo.NO);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_PAGE_TREE, params);
inInfo.addBlock(node).addRows(results);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 校验保存的数据
* 查询树节点
*
* @param resultRows
* @param inInfo
* @return
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
AssertUtils.isEmpty(hppz009.getCompanyName(), "企业名称不能为空");
AssertUtils.isNull(hppz009.getValidFlag(), "是否启用不能为空");
public EiInfo queryOrgTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, "node");
String parentNode = StringUtils.isEmpty(node) || "$".equals(node) ? "root" : node;
Map params = new HashMap();
params.put("node", parentNode);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_ORG_TREE, params);
inInfo.addBlock(node).addRows(results);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增企业信息
*
* @param fPz009
* @throws Exception
*/
private void add(HPPZ009 fPz009) throws Exception {
// 生成企业编码
fPz009.setCompanyCode(SequenceGenerator.getNextSequence("COMPANY_CODE"));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert("HPPZ009.insert", fPz009);
// 默认新增企业管理员账号
this.initUser(fPz009);
// 关联企业管理员角色
this.insertGroupMember(fPz009);
}
/**
* 修改数据
*
* @param fPz009
*/
private void modify(HPPZ009 fPz009) {
DaoUtils.update("HPPZ009.update", fPz009);
}
/**
* 新增操作.
* 查询页面的权限
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
@OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "查询页面的权限")
public EiInfo getByPage(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
this.add(fPz009);
EiBlock resultBlock = inInfo.addBlock(EiConstant.resultBlock);
resultBlock.addBlockMeta(new HPPZ010().eiMetadata);
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HPPZ010> dbPz010s = dao.query(HPPZ010.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbPz010s)) {
return inInfo;
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
resultBlock.addRows(dbPz010s);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 初始化用户
*
* @param hppz009
*/
private void initUser(HPPZ009 hppz009) throws Exception {
String companyCode = hppz009.getCompanyCode();
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", companyCode);
inInfoRowMap.put("loginName", companyCode);
inInfoRowMap.put("userName", hppz009.getCompanyName());
// 使用公钥加密密码
String password = RsaUtils.encryptByPublicKey(LoginConstants.rsaPublicKey, companyCode);
inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", password);
inInfoRowMap.put("email", " ");
inInfoRowMap.put("mobile", " ");
inInfoRowMap.put("companyCode", hppz009.getCompanyCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS0102");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 用户关联角色
*
* @param hppz009
*/
private void insertGroupMember(HPPZ009 hppz009) {
String companyCode = hppz009.getCompanyCode();
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("memberId", companyCode);
inInfoRowMap.put("memberName", hppz009.getCompanyName());
// TODO 该用户组固定不能修改,代码中其他地方有写死的地方
inInfoRowMap.put("parentId", "companyManage");
inInfoRowMap.put("parentName", "企业管理员");
inInfoRowMap.put("memberType", "USER");
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS03");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 修改操作
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "修改",operDesc = "修改操作")
public EiInfo update(EiInfo inInfo) {
@OperationLogAnnotation(operModul = "数据权限管理", operType = "新增", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update("HPPZ009.update", hppz009);
}
inInfo = this.query(inInfo);
// 写入数据
this.saveData(resultRows);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
LogUtils.setMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 删除操作
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
AssertUtils.isEmpty(UserSessionUtils.getCompanyCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
for (Map resultRow : resultRows) {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
AssertUtils.isEmpty(fPz010.getPageEname(), "请选择菜单");
AssertUtils.isEmpty(fPz010.getAuthDepCode(), "请选择部门");
}
}
/**
* 保存数据
*
* @param inInfo
* @return
* @param resultRows
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "删除",operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HPXSTools.countByCompany(fPz009.getCompanyCode());
if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户",
fPz009.getCompanyName()));
}
DaoUtils.update("HPPZ009.delete", fPz009);
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
// 当前企业是否已经设置过权限
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname(), fPz010.getAuthDepCode());
if (dbPz010 == null) {
DaoUtils.insert(HPPZ010.INSERT, fPz010);
} else {
dbPz010.setAuthType(fPz010.getAuthType());
DaoUtils.update(HPPZ010.UPDATE, dbPz010);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ010A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.Map;
/**
* 用户数据授权
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ010A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "用户数据权限查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ORG_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ010A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "用户数据权限查询", operType = "查询", operDesc = "查询数据列表")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPSqlConstant.HpPz010.QUERY_USER_AUTH, new HPPZ010A());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -4,15 +4,10 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.UserStatusEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ01301;
import com.baosight.hpjx.hp.pz.domain.HPPZ014;
import com.baosight.hpjx.hp.pz.domain.HPPZ01401;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
......@@ -23,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
......
......@@ -3,6 +3,18 @@
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.Thppz001">
SELECT
......@@ -18,6 +30,7 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz001
WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="custType">
CUST_TYPE LIKE CONCAT('%',CONCAT( #custType#,'%'))
</isNotEmpty>
......@@ -37,6 +50,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -114,4 +128,4 @@
ID = #id#
</update>
</sqlMap>
\ No newline at end of file
</sqlMap>
......@@ -22,8 +22,21 @@
PHONE_NAME as "phoneName" <!--负责人联系方式-->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -23,8 +23,21 @@
PUT_ADDRESS as "putAddress" <!--收货地址-->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -19,8 +19,21 @@
DELETE_FLAG as "deleteFlag" <!-- 更新时间 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -25,17 +25,24 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
......
......@@ -21,17 +21,24 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whType">
WH_TYPE = #whType#
</isNotEmpty>
......
......@@ -23,6 +23,18 @@
-->
<sqlMap namespace="HPPZ008">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.iplat4j.hp.pz.domain.Thppz008">
SELECT
......@@ -43,6 +55,7 @@
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -63,6 +76,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -167,4 +181,4 @@
ID = #id#
</update>
</sqlMap>
\ No newline at end of file
</sqlMap>
......@@ -22,6 +22,9 @@
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" " property="dataAuthCondition">
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -4,43 +4,69 @@
<sql id="column">
ID as "id",
SUBJECT_ID as "subjectId", <!-- 授权主体ID -->
SUBJECT_TYPE as "subjectType", <!-- 授权主体类别 -->
OBJECT_ID as "objectId", <!-- 授权客体ID -->
OBJECT_TYPE as "objectType", <!-- 授权客体类别 -->
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
PAGE_ENAME as "pageEname", <!-- 页面英文名 -->
PAGE_CNAME as "pageCname", <!-- 页面中文名 -->
AUTH_DEP_CODE as "authDepCode", <!-- 权限部门编码 -->
AUTH_DEP_NAME as "authDepName", <!-- 权限部门名称 -->
AUTH_TYPE as "authType", <!-- 权限类型 -->
LINKAGE_FLAG as "linkageFlag" <!-- 0-不联动,1-联动 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectId">
SUBJECT_ID = #subjectId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectType">
SUBJECT_TYPE = #subjectType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="objectId">
OBJECT_ID = #objectId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="objectType">
OBJECT_TYPE = #objectType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="pageEname">
PAGE_ENAME = #pageEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="pageCname">
PAGE_CNAME = #pageCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authDepCode">
AUTH_DEP_CODE = #authDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authDepName">
AUTH_DEP_NAME = #authDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authType">
AUTH_TYPE = #authType#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="authDepCodes">
AUTH_DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
ID ASC
</isEmpty>
</dynamic>
</sql>
......@@ -50,43 +76,140 @@
FROM ${hpjxSchema}.T_HPPZ010
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ010 WHERE 1=1
<include refid="condition" />
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ010 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<!-- 查询树节点 -->
<select id="queryPageTree" resultClass="java.util.HashMap">
SELECT
TREE_ENAME AS "parent",
NODE_ENAME AS "label",
NODE_CNAME AS "text",
(CASE WHEN NODE_TYPE='2' THEN 0 ELSE 1 END) AS "leaf",
NODE_SORT_ID AS "sortIndex"
FROM ${platSchema}.TEDPI10
WHERE 1=1
AND NODE_ENAME NOT IN ('EP') <!-- 排除系统页面 -->
<isNotEmpty prepend=" AND " property="node">
TREE_ENAME = #node#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="nodeEnames">
NODE_ENAME IN <iterate close=")" open="(" conjunction="," property="nodeEnames">#nodeEnames[]#</iterate>
</isNotEmpty>
<!-- nodeType:1-页面,2-目录。非管理员仅显示有权限的菜单 -->
<isEqual prepend=" AND " property="isUserAdmin" compareValue="Y">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'))
</isEqual>
<isEqual prepend=" AND " property="isUserAdmin" compareValue="N">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'
AND NODE_ENAME IN (
SELECT D.RESOURCE_ENAME
FROM ${platSchema}.XS_USER A,
${platSchema}.XS_USER_GROUP_MEMBER B,
${platSchema}.XS_AUTHORIZATION C,
${platSchema}.XS_RESOURCE D
WHERE A.USER_ID = B.MEMBER_ID
AND B.PARENT_ID = C.SUBJECT_ID
AND C.OBJECT_ID = D.ID
AND A.LOGIN_NAME = #loginName#
AND D.TYPE = 'PAGE'
)
))
</isEqual>
ORDER BY NODE_SORT_ID ASC
</select>
<!-- 组织机构子节点树查询 -->
<select id="queryOrgTree" resultClass="java.util.HashMap">
SELECT
ORG_ID as "label",
ORG_CNAME as "text",
ORG_NODE_TYPE as "leaf",
ORG_TYPE as "type",
PARENT_ORG_ID as "parentOrgId"
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND IS_DELETED = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="node">
PARENT_ORG_ID = #node#
</isNotEmpty>
ORDER BY SORT_INDEX ASC
</select>
<!-- 查询用户数据权限 -->
<select id="queryUserAuth" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ010A">
SELECT
A.LOGIN_NAME AS "userId",
A.USER_NAME AS "userName",
A.GENDER AS "gender",
A.MOBILE AS "mobile",
A.EMAIL AS "email",
B.ORG_ID AS "orgId",
C.ORG_CNAME AS "orgCname",
D.PAGE_ENAME AS "pageEname",
D.PAGE_CNAME AS "pageCname",
D.AUTH_TYPE AS "authType"
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
LEFT JOIN ${hpjxSchema}.T_HPPZ010 D ON B.ORG_ID = D.AUTH_DEP_CODE
WHERE 1=1
AND D.PAGE_ENAME IS NOT NULL
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.LOGIN_NAME = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgId">
B.ORG_ID = #orgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="pageCname">
D.PAGE_CNAME LIKE CONCAT('%', #pageCname#, '%')
</isNotEmpty>
ORDER BY A.LOGIN_NAME ASC, D.PAGE_CNAME ASC, B.ORG_ID ASC
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ010 (
SUBJECT_ID, <!-- 授权主体ID -->
SUBJECT_TYPE, <!-- 授权主体类别 -->
OBJECT_ID, <!-- 授权客体ID -->
OBJECT_TYPE, <!-- 授权客体类别 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
PAGE_ENAME, <!-- 页面英文名 -->
PAGE_CNAME, <!-- 页面中文名 -->
AUTH_DEP_CODE, <!-- 权限部门编码 -->
AUTH_DEP_NAME, <!-- 权限部门名称 -->
AUTH_TYPE, <!-- 权限类型 -->
LINKAGE_FLAG <!-- 0-不联动,1-联动 -->
) VALUES (
#subjectId#, #subjectType#, #objectId#, #objectType#, #createdBy#,
#createdName#, #createdTime#
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#pageEname#, #pageCname#, #authDepCode#, #authDepName#, #authType#,
#linkageFlag#
)
</insert>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPPZ010 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ010
SET
SUBJECT_ID = #subjectId#, <!-- 授权主体ID -->
SUBJECT_TYPE = #subjectType#, <!-- 授权主体类别 -->
OBJECT_ID = #objectId#, <!-- 授权客体ID -->
OBJECT_TYPE = #objectType#, <!-- 授权客体类别 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
UPDATE ${hpjxSchema}.T_HPPZ010
SET AUTH_TYPE = #authType#, <!-- 权限类型 -->
LINKAGE_FLAG = #linkageFlag#, <!-- 0-不联动,1-联动 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
......
......@@ -23,8 +23,21 @@
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -24,9 +24,22 @@
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -24,9 +24,22 @@
MAN_HOUR as "manHour" <!-- 工时 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -4,24 +4,37 @@
Version : 1.0
schema : hpjx
tableName : T_HPPZ015
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
PROJ_CODE VARCHAR,
TEMPLATE_CODE VARCHAR,
TEMPLATE_NAME VARCHAR,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
PROJ_CODE VARCHAR,
TEMPLATE_CODE VARCHAR,
TEMPLATE_NAME VARCHAR,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<sqlMap namespace="HPPZ015">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -79,7 +79,20 @@
B.STATUS as "pgStatus" <!-- 派工状态 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -109,7 +122,20 @@
</isNotEmpty>
</sql>
<sql id="authCondition1">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -4,12 +4,14 @@ import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
......@@ -32,6 +34,7 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -544,6 +547,58 @@ public class HPPZTools {
}
/**
* 数据权限管理
*
* @author:songx
* @date:2024/3/20,14:20
*/
public static class HpPz010 {
/**
* 查询菜单权限
*
* @param pageEname
* @param depCode
* @return
*/
public static HPPZ010 getByPage(String pageEname, String depCode) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
AssertUtils.isEmpty(depCode, "部门不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put(HPPZ010.FIELD_AUTH_DEP_CODE, depCode);
List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询菜单权限
*
* @param pageEname
* @param depCodes
* @return
*/
public static List<HPPZ010> listByPage(String pageEname, List<String> depCodes) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put("authDepCodes", depCodes);
return DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
}
}
/**
* @author:songx
* @date:2024/3/14,20:59
*/
......@@ -766,5 +821,5 @@ public class HPPZTools {
}
}
}
......@@ -3,20 +3,32 @@
<!-- table information
Generate time : 2024-02-23 15:28:50
Version : 1.0
tableName :hpjx.sys_operation_log
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
OPER_MODUL VARCHAR,
OPER_TYPE VARCHAR,
OPER_DESC VARCHAR,
tableName :hpjx.sys_operation_log
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
OPER_MODUL VARCHAR,
OPER_TYPE VARCHAR,
OPER_DESC VARCHAR,
OPER_CONTENT VARCHAR
-->
<sqlMap namespace="HPRZ001">
<select id="query" parameterClass="java.util.HashMap"
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.rz.domian.HPRZ001">
SELECT
ID as "id", <!-- 主键id -->
......@@ -29,6 +41,7 @@
OPER_DESC as "operDesc", <!-- 操作说明 -->
OPER_CONTENT as "operContent" <!-- 操作内容 -->
FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -55,11 +68,12 @@
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -79,8 +93,8 @@
OPER_TYPE = #operType#
</isNotEmpty>
</select>
<!--
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -120,27 +134,27 @@
OPER_TYPE, <!-- 操作类型 -->
OPER_DESC, <!-- 操作说明 -->
OPER_CONTENT <!-- 操作内容 -->
)
VALUES (#id#, #companyCode#, #createdBy#, #createdName#, #createdTime#, #operModul#, #operType#, #operDesc#, #operContent#)
)
VALUES (#id#, #companyCode#, #createdBy#, #createdName#, #createdTime#, #operModul#, #operType#, #operDesc#, #operContent#)
</insert>
<delete id="delete">
DELETE FROM hpjx.sys_operation_log WHERE
DELETE FROM hpjx.sys_operation_log WHERE
ID = #id#
</delete>
<update id="update">
UPDATE hpjx.sys_operation_log
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
OPER_MODUL = #operModul#, <!-- 操作模块 -->
OPER_TYPE = #operType#, <!-- 操作类型 -->
OPER_DESC = #operDesc#, <!-- 操作说明 -->
OPER_CONTENT = #operContent# <!-- 操作内容 -->
WHERE
UPDATE hpjx.sys_operation_log
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
OPER_MODUL = #operModul#, <!-- 操作模块 -->
OPER_TYPE = #operType#, <!-- 操作类型 -->
OPER_DESC = #operDesc#, <!-- 操作说明 -->
OPER_CONTENT = #operContent# <!-- 操作内容 -->
WHERE
ID = #id#
</update>
......@@ -163,5 +177,5 @@
COMPANY_CODE = #companyCode#
</isNotEmpty>
</select>
</sqlMap>
\ No newline at end of file
</sqlMap>
......@@ -53,9 +53,8 @@ public class ServiceHPSC002A extends ServiceEPBase {
if (CollectionUtils.isNotEmpty(dbSc002s) || CollectionUtils.isNotEmpty(HPSC006)) {
inInfo.set("inqu_status-0-bizType", queryMap.get("bizType"));
inInfo.set("inqu_status-0-matId", queryMap.get("id"));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC002A().eiMetadata);
}
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC002A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......
......@@ -2,33 +2,12 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
......
......@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
......@@ -20,7 +19,6 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......
......@@ -6,8 +6,6 @@ import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
......
......@@ -2,25 +2,18 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC007;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.text.DecimalFormat;
......
......@@ -2,10 +2,8 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC098;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
......
......@@ -2,6 +2,15 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
......@@ -21,6 +30,7 @@
REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -62,6 +72,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -213,6 +224,7 @@
REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -229,27 +241,27 @@
UPDATE hpjx.t_hpsc001 SET MATERIAL_STATUS = #materialStatus# WHERE PROJ_CODE = #projCode#
</update>
<select id="queryDomainById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRINC1 as "princ1", <!-- 本公司项目负责人 -->
PRINC2 as "princ2", <!-- 客户项目负责人 -->
STATUS as "status", <!-- 状态 0-未提交,1-已提交 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
<select id="queryDomainById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRINC1 as "princ1", <!-- 本公司项目负责人 -->
PRINC2 as "princ2", <!-- 客户项目负责人 -->
STATUS as "status", <!-- 状态 0-未提交,1-已提交 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
</sqlMap>
......@@ -80,6 +80,7 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -109,7 +110,20 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......@@ -140,11 +154,20 @@
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql id="authCondition1">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -3,12 +3,10 @@
<sqlMap namespace="HPSC003">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
PROJ_TYPE = #projType#
</isNotEmpty>
......@@ -59,6 +57,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -49,15 +49,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
......@@ -180,6 +175,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -53,15 +53,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE like CONCAT('%', #projCode#, '%')
</isNotEmpty>
......@@ -125,6 +120,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -23,7 +23,20 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -38,7 +38,20 @@
C.PROD_TASK_NO as "zlprodTaskNo"
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -98,7 +98,20 @@
COALESCE(C.ACTUAL_COMPLETION_NUM,0) as "actualCompletionTotalWt"<!-- 实际完工重量 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-02-05 9:36:07
Version : 1.0
schema : hpjx
tableName : T_HPSC006
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRODUCTION_ORDER_NO VARCHAR,
INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
INVENT_LENGTH DECIMAL,
INVENT_WIDTH DECIMAL,
INVENT_THICK DECIMAL,
INVENT_SPEC VARCHAR,
PLAN_COMPLETION_DATE VARCHAR,
NUM DECIMAL,
UNIT_WT DECIMAL,
TOTAL_WT DECIMAL,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
STATUS TINYINT,
ORG_NO VARCHAR,
ORG_NAME VARCHAR,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR,
FILE_PATH1 VARCHAR,
INVENT_RECORD_ID INTEGER
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC006">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -74,12 +39,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
......@@ -172,6 +135,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......
......@@ -4,36 +4,36 @@
Version : 1.0
schema : hpjx
tableName : T_HPSC006
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRODUCTION_ORDER_NO VARCHAR,
INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
INVENT_LENGTH DECIMAL,
INVENT_WIDTH DECIMAL,
INVENT_THICK DECIMAL,
INVENT_SPEC VARCHAR,
PLAN_COMPLETION_DATE VARCHAR,
NUM DECIMAL,
UNIT_WT DECIMAL,
TOTAL_WT DECIMAL,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
STATUS TINYINT,
ORG_NO VARCHAR,
ORG_NAME VARCHAR,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR,
FILE_PATH1 VARCHAR,
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRODUCTION_ORDER_NO VARCHAR,
INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
INVENT_LENGTH DECIMAL,
INVENT_WIDTH DECIMAL,
INVENT_THICK DECIMAL,
INVENT_SPEC VARCHAR,
PLAN_COMPLETION_DATE VARCHAR,
NUM DECIMAL,
UNIT_WT DECIMAL,
TOTAL_WT DECIMAL,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
STATUS TINYINT,
ORG_NO VARCHAR,
ORG_NAME VARCHAR,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR,
FILE_PATH1 VARCHAR,
INVENT_RECORD_ID INTEGER
-->
<sqlMap namespace="HPSC006A">
......@@ -118,6 +118,18 @@
B.PART_NAME AS "partName"
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-02-06 15:50:11
Version : 1.0
schema : hpjx
tableName : T_HPSC007
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
HPSC006_ID VARCHAR,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
ACTUAL_COMPLETION_TOTAL_WT DECIMAL,
USER_ID VARCHAR,
USER_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC007">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="hpsc006Id">
HPSC006_ID = #hpsc006Id#
</isNotEmpty>
......@@ -66,10 +45,22 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC007">
SELECT
ID as "id",
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
HPSC006_ID as "hpsc006Id", <!-- 生产下料ID -->
ACTUAL_COMPLETION_DATE as "actualCompletionDate", <!-- 实际完工日期 -->
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-03-07 17:21:17
Version : 1.0
schema : hpjx
tableName : T_HPXS001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
REGISTER_DATE VARCHAR,
FACTORY_CODE VARCHAR NOT NULL,
GROUP_CODE VARCHAR,
USER_ID VARCHAR,
GROUP_TYPE VARCHAR,
PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR,
WEIGHT DECIMAL,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC008">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
REGISTER_DATE = #registerDate#
</isNotEmpty>
......@@ -93,6 +63,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008">
SELECT
......
<?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">
<!-- table information
Generate time : 2024-01-10 9:33:44
Version : 1.0
tableName :hpjx.t_hpsc001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
PROJ_TYPE TINYINT,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRINC1 VARCHAR,
PRINC2 VARCHAR,
STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HPSC001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
......@@ -38,6 +32,7 @@
DEP_CODE as "depCode", <!-- 部门编码 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -73,6 +68,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -201,4 +197,4 @@
<update id="check">
UPDATE hpjx.t_hpsc001 SET status = #status# WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
</sqlMap>
package com.baosight.hpjx.hp.xs.domain;
import java.io.Serializable;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class Org implements Serializable {
/**
* 组织ID
*/
private String orgId;
public class Org extends DaoEPBase {
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
public static final String FIELD_ORG_TYPE = "orgType"; /* 用户ID*/
public static final String FIELD_PARENT_ORG_ID = "parentOrgId"; /* 用户中文名*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 性别*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 手机号*/
public static final String FIELD_LEVEL = "level"; /* 邮箱*/
private String companyCode = ""; /* 企业编码 */
private String orgId = ""; /* 组织ID */
private String orgEname = ""; /* 组织英文名 */
private String orgCname = ""; /* 组织中文名 */
private String orgType = ""; /* 组织类型 */
private String parentOrgId = ""; /* 父级组织ID */
private String factoryCode = ""; /* 厂区编码 */
private String factoryName = ""; /* 厂区名称 */
private String level = ""; /* 层级 */
/**
* 组织英文名
* initialize the metadata.
*/
private String orgEname;
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("组织ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ENAME);
eiColumn.setDescName("组织英文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_TYPE);
eiColumn.setDescName("组织类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_ORG_ID);
eiColumn.setDescName("父级组织ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME);
eiColumn.setDescName("厂区名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LEVEL);
eiColumn.setDescName("层级");
eiMetadata.addMeta(eiColumn);
}
/**
* 组织中文名
* the constructor.
*/
private String orgCname;
public Org() {
initMetaData();
}
/**
* 组织类型
*/
private String orgType;
public String getCompanyCode() {
return companyCode;
}
/**
* 父级组织ID
*/
private String parentOrgId;
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getOrgId() {
return orgId;
......@@ -73,4 +132,66 @@ public class Org implements Serializable {
this.parentOrgId = parentOrgId;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setOrgType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_TYPE)), orgType));
setParentOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ORG_ID)), parentOrgId));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setLevel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEVEL)), level));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
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_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
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_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_LEVEL, StringUtils.toString(level, eiMetadata.getMeta(FIELD_LEVEL)));
return map;
}
}
package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.xs.domain.User;
......@@ -18,6 +17,8 @@ import java.util.List;
import java.util.Map;
/**
* 当前类已屏蔽SQL自动补全企业参数,如需查询需要需自行添加企业编码参数
*
* @author:songx
* @date:2024/1/15,15:08
*/
......@@ -90,6 +91,7 @@ public class ServiceHPXSUser extends ServiceBase {
}
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
CommonMethod.initBlock(inInfo, list, queryMap, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败");
......
......@@ -4,20 +4,20 @@
Version : 1.0
schema : hpjx
tableName : TEUDM_TEMP
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
REAL_PATH VARCHAR
-->
<sqlMap namespace="HPXS002">
......
......@@ -63,6 +63,39 @@
<include refid="customCondition"/>
</select>
<!-- 查询指定组织机构下所有的子集组织机构(不包含root) -->
<select id="queryAll" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
(CASE WHEN T3.ORG_TYPE = 'factory' THEN T3.ORG_CNAME ELSE CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) END) AS "orgCname",
T3.ORG_TYPE AS "orgType", T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName"
FROM (
SELECT
@CODES AS CODES,
(SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01,
<isNotEmpty property="parentOrgId">
(SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4
</isNotEmpty>
<isEmpty property="parentOrgId">
(SELECT @CODES:='root', @LEVEL:= 0) T4
</isEmpty>
WHERE @CODES IS NOT NULL
) T2,
${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND T3.ORG_ID != 'root'
ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select>
<!-- 查询父级信息(递归) -->
<select id="queryParent" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT
......
......@@ -2,6 +2,8 @@ package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils;
......@@ -17,6 +19,7 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.constants.LoginConstants;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -29,31 +32,6 @@ import java.util.stream.Collectors;
public class HPXSTools {
/**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public static int countByCompany(String companyCode) {
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
List<Integer> results = DaoBase.getInstance().query("HPXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
}
/**
* 查询用户组织机构
*
* @return
*/
public static String getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString();
}
/**
* @author:songx
* @date:2024/2/4,10:35
*/
......@@ -102,6 +80,19 @@ public class HPXSTools {
}
/**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public static int countByCompany(String companyCode) {
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
List<Integer> results = DaoBase.getInstance().query("HPXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
}
/**
* 初始化新增用户
*
* @param companyCode
......@@ -173,12 +164,27 @@ public class HPXSTools {
AssertUtils.isEmpty(orgId, "组织编码不能为空");
Map paramMap = new HashMap();
paramMap.put("orgId", orgId);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.query", paramMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY, paramMap);
AssertUtils.isEmpty(results, String.format("组织信息[%s]不存在", orgId));
return results.get(0);
}
/**
* 查询用户组织机构
*
* @return
*/
public static List<String> getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ORG_ID, paramMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().map(item -> item.get("orgId").toString()).collect(Collectors.toList());
}
/**
* 查询
*
* @param orgId
......@@ -188,7 +194,7 @@ public class HPXSTools {
AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_PARENT, queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在父级信息", orgId));
return results;
}
......@@ -204,11 +210,44 @@ public class HPXSTools {
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode());
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_PARENT, queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在厂区信息", orgId));
return results.get(0);
}
/**
* 查询指定组织机构下所有的子集组织机构
*
* @param parentOrgId root:查询企业所有的组织信息
* @return
*/
public static List<Org> queryByParent(String parentOrgId) {
AssertUtils.isNull(parentOrgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentOrgId", parentOrgId);
return DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ALL, queryMap);
}
/**
* 查询企业下所有组织按厂区分组
*
* @return
*/
public static Map<String, List<Org>> queryAllFactoryMap() {
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ALL, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().filter(org -> StringUtils.isNotNull(org.getFactoryCode()))
.collect(Collectors.groupingBy(Org::getFactoryCode));
}
/**
* 查询
*
......@@ -228,6 +267,41 @@ public class HPXSTools {
return results;
}
/**
* 查询组织机构的子集
*
* @param orgId
* @return
*/
public static List<String> queryChildren(String orgId) {
// 查询组织子集
List<Org> dbOrgs = HPXSTools.XsOrg.queryByParent(orgId);
if (CollectionUtils.isEmpty(dbOrgs)) {
return null;
}
return dbOrgs.stream().map(Org::getOrgId).collect(Collectors.toList());
}
/**
* 查询组织机构的子集
*
* @param orgIds
* @return
*/
public static List<String> queryChildren(List<String> orgIds) {
List<String> childOrgIds = new ArrayList<>();
for (String orgId : orgIds) {
// 已经存在不在重复查询
if (childOrgIds.contains(orgId)) {
continue;
}
// 查询组织子集
List<Org> dbOrgs = HPXSTools.XsOrg.queryByParent(orgId);
childOrgIds.addAll(dbOrgs.stream().map(Org::getOrgId).collect(Collectors.toList()));
}
// 去除重复组织机构
return childOrgIds.stream().distinct().collect(Collectors.toList());
}
}
}
......@@ -6,8 +6,6 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
......@@ -17,7 +15,6 @@ import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
......
......@@ -34,8 +34,21 @@
DELETE_FLAG as "deleteFlag" <!-- 是否删除 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -26,26 +26,7 @@ public class LogUtils {
* @return
*/
public static void setDetailMsg(EiInfo inInfo, Throwable e, String title) {
title = StringUtils.isEmpty(title) ? "服务异常" : title;
// 打印日志
print(e, title);
// 设置EiInfo错误消息
if (inInfo == null) {
return;
}
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg(title);
if (e == null) {
inInfo.setDetailMsg("");
return;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo.setDetailMsg(e.getMessage());
if (e instanceof PlatException) {
inInfo.setMsg(inInfo.getMsg().concat(",原因:").concat(e.getMessage()));
} else {
inInfo.setMsg(inInfo.getMsg().concat(",原因参见详细错误描述!"));
}
setMsg(inInfo, e, title);
}
/**
......@@ -70,7 +51,11 @@ public class LogUtils {
inInfo.setMsg(msg.concat("未知"));
return;
}
inInfo.setMsg(msg.concat(e.getMessage()));
if (e instanceof PlatException) {
inInfo.setMsg(msg.concat(e.getMessage()));
} else {
inInfo.setMsg(msg.concat("内部错误,请稍后再试"));
}
}
/**
......
package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.common.AuthTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
import com.baosight.iplat4j.core.util.ExceptionUtil;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
......@@ -24,7 +35,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.query(name, parameters);
return ret;
} catch (RuntimeException var4) {
......@@ -35,7 +46,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List queryAll(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.queryAll(name, parameters);
return ret;
} catch (RuntimeException var4) {
......@@ -46,7 +57,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters, int offset, int limit) {
try {
// 初始化参数
this.initParam(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var6) {
......@@ -72,7 +83,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
try {
// 初始化参数
this.initParam(name, parameters);
this.setAuthParam(name, parameters);
int ret = super.count(name, parameters);
return ret;
} catch (RuntimeException var5) {
......@@ -149,23 +160,123 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
}
/**
* 初始化参数
* 设置权限参数
*
* @param name
* @param parameters
*/
private void initParam(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码
if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) {
private void setAuthParam(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
if (!name.startsWith("HP") || !(parameters instanceof Map)) {
return;
}
if (parameters == null) {
parameters = new HashMap();
}
// 企业编码
// 设置企业信息
this.setCompanyCode(name, parameters);
// 设置数据查询权限
this.setDataAuth(name, parameters);
}
/**
* 设置企业编码
*
* @param name
* @param parameters
*/
private void setCompanyCode(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return;
}
((Map) parameters).put("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
/**
* 设置数据权限
*
* @param name
* @param parameters
*/
private void setDataAuth(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ009.query", "HPPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return;
}
// 是否启用数据权限
if (!ThreadLocalTools.DATA_AUTH.get()) {
return;
}
String authEnable = PlatApplicationContext.getProperty("iplat4j.page.auth.enable");
if (StringUtils.isNotBlank(authEnable) && "0".equals(authEnable)) {
return;
}
// 页面英文名
String pageEname = ThreadLocalTools.FORM_ENAME.get();
if (StringUtils.isBlank(pageEname)) {
return;
}
// 当前用户所在的部门
List<String> userOrgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(userOrgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
// 构建部门权限
buildDepAuth(pageEname, userOrgIds, parameters);
}
/**
* 构建部门权限
*
* @param pageEname
* @param userOrgIds
* @param parameters
*/
private void buildDepAuth(String pageEname, List<String> userOrgIds, Object parameters) {
// 查询当前页面设置的所有权限
List<HPPZ010> dbPz010s = HPPZTools.HpPz010.listByPage(pageEname, userOrgIds);
if (CollectionUtils.isEmpty(dbPz010s)) {
((Map) parameters).put("depCode", AuthTypeEnum.NO_AUTH.getCode());
return;
}
// 构建数据范围权限查询条件
List<String> depCodes = new ArrayList<>();
for (HPPZ010 dbPz010 : dbPz010s) {
List<String> depAuths = buildDepCondition(dbPz010);
// ALL查看所有数据,仅限本企业
if (depAuths.contains(AuthTypeEnum.ALL.getCode())) {
depCodes = null;
break;
}
depCodes.addAll(depAuths);
}
((Map) parameters).put("depCodes", depCodes);
}
/**
* 组装 Custom Data Auth Condition
*
* @param dbPz010
*/
private List<String> buildDepCondition(HPPZ010 dbPz010) {
String authType = dbPz010.getAuthType();
if (StringUtils.isBlank(authType) || AuthTypeEnum.NO_AUTH.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
String authDepCode = dbPz010.getAuthDepCode();
// 看全部
if (AuthTypeEnum.ONLY_COMPANY.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.ALL.getCode());
} else if (AuthTypeEnum.ONLY_FACTORY.getCode().equals(authType)) {
// 查询当前部门所在的厂及子集
Org factoryOrg = HPXSTools.XsOrg.queryFactory(authDepCode);
return HPXSTools.XsOrg.queryChildren(factoryOrg.getOrgId());
} else if (AuthTypeEnum.ONLY_DEPT.getCode().equals(authType)) {
return HPXSTools.XsOrg.queryChildren(authDepCode);
} else {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
}
}
......@@ -26,7 +26,6 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......
package com.baosight.xservices.xs.og.service;
import com.baosight.hpjx.core.constant.CodesetConstant;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.CodeValueTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
......@@ -13,19 +11,13 @@ import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.og.domain.XSOG01;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.FrameworkInfo;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
......@@ -41,10 +40,10 @@ public class ServiceXS0705 extends MenuTreeService {
public List getChildNodes(String parentLabel) {
String manageSwitch = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.manage.switch"), "off");
Map params = new HashMap();
if (StringUtils.isEmpty(parentLabel) || "$".equals(parentLabel)) {
parentLabel = "root";
}
Map params = new HashMap();
String loginName = UserSession.getUser().getUsername();
params.put("node", parentLabel);
params.put("loginName", loginName);
......@@ -61,46 +60,41 @@ public class ServiceXS0705 extends MenuTreeService {
List ret = this.dao.query(stmt, params);
if ("off".equals(manageSwitch)) {
return ret;
} else {
List ret2 = new ArrayList();
for(int i = 0; i < ret.size(); ++i) {
Map node = (Map)ret.get(i);
String text = node.get("text").toString();
if (text.indexOf("[页面]") > 0) {
ret2.add(0, ret.get(i));
} else {
ret2.add(ret.get(i));
}
}
List ret2 = new ArrayList();
for (int i = 0; i < ret.size(); ++i) {
Map node = (Map) ret.get(i);
String text = node.get("text").toString();
if (text.indexOf("[页面]") > 0) {
ret2.add(0, ret.get(i));
} else {
ret2.add(ret.get(i));
}
List authorized = new ArrayList();
if (!LoginUserDetails.isUserAdmin(loginName)) {
if (AuthenticationInfo.userManageAuthentication.get(loginName) == null) {
AuthenticationInfo.getUserManageAuthentication(loginName);
}
List authManageList = (List)AuthenticationInfo.userManageAuthentication.get(loginName);
for(int i = 0; i < ret2.size(); ++i) {
Map node = (Map)ret.get(i);
BigDecimal nodeLeaf = new BigDecimal("1");
BigDecimal leaf = (BigDecimal)node.get("leaf");
if (nodeLeaf.equals(leaf)) {
String label = (String)node.get("label");
if (this.isManageResource(label, authManageList)) {
authorized.add(node);
}
} else {
authorized.add(node);
}
}
List authorized = new ArrayList();
if (LoginUserDetails.isUserAdmin(loginName)) {
authorized = ret2;
return authorized;
}
if (AuthenticationInfo.userManageAuthentication.get(loginName) == null) {
AuthenticationInfo.getUserManageAuthentication(loginName);
}
List authManageList = (List) AuthenticationInfo.userManageAuthentication.get(loginName);
for (int i = 0; i < ret2.size(); ++i) {
Map node = (Map) ret.get(i);
BigDecimal nodeLeaf = new BigDecimal("1");
BigDecimal leaf = (BigDecimal) node.get("leaf");
if (nodeLeaf.equals(leaf)) {
String label = (String) node.get("label");
if (this.isManageResource(label, authManageList)) {
authorized.add(node);
}
} else {
authorized = ret2;
authorized.add(node);
}
return authorized;
}
return authorized;
}
private boolean isManageResource(String label, List authManageList) {
......
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.baosight.xservices.xs.service;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XEventManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.util.JudgeCircleUtils;
import com.baosight.xservices.xs.common.AuthInfoManager;
import com.baosight.xservices.xs.util.XSServiceUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
public class ServiceXSResourceGroupManage extends ServiceEPBase {
private static final Logger logger = LogManager.getLogger(ServiceXSResourceGroupManage.class);
public ServiceXSResourceGroupManage() {
}
public EiInfo insertResourceGroup(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
String resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString() : "";
if (StringUtils.isBlank(resourceGroupId)) {
resourceGroupId = UUID.randomUUID().toString().replaceAll("-", "");
}
String resourceGroupEname;
String resourceGroupCname;
try {
resourceGroupEname = inInfoRowMap.get("resourceGroupEname").toString();
resourceGroupCname = inInfoRowMap.get("resourceGroupCname").toString();
} catch (Exception var23) {
inInfo.setMsg("没有提供有效的群组英文名/中文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
if ("".equals(resourceGroupEname) || "".equals(resourceGroupCname)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源群组英文名和中文名均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceGroupEname", resourceGroupEname.toUpperCase());
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (null != existResourceGroup && existResourceGroup.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该资源组信息已存在\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceGroupId", "");
return inInfo;
}
} else {
inInfoRowMap.put("resourceGroupEname", resourceGroupEname.toUpperCase());
inInfoRowMap.put("resourceGroupId", resourceGroupId);
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag.trim())) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (null == sortIndex || "".equals(sortIndex.trim())) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (StringUtils.isBlank(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (StringUtils.isBlank(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS05.insert", inInfoRowMap);
logger.info("新增第" + (i + 1) + "条记录成功\n");
Map map = new HashMap();
map.put("resourceGroupId", resourceGroupId);
List insertResourceGroupList = this.dao.query("XS05.query", map);
Map insertResourceGroupMap = (Map)insertResourceGroupList.get(0);
insertedResourceGroupList.add(insertResourceGroupMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2300");
xEyeEntity.setLogName("新增资源组");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recCreator") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "新增了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rge", resourceGroupEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
logger.error("新增第" + (i + 1) + "条记录失败\n");
buffer.append("新增第").append(i + 1).append("条记录失败\n").append(var24.getMessage());
inInfo.setStatus(-1);
inInfoRowMap.put("resourceGroupId", "");
String errorMsg = var24.getCause() == null ? var24.getMessage() : var24.getCause().toString();
detail.append(errorMsg);
logger.error(errorMsg);
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_40");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo deleteResourceGroup(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceGroupId;
String resourceGroupEname;
try {
resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString().trim() : "";
resourceGroupEname = inInfoRowMap.get("resourceGroupEname") != null ? inInfoRowMap.get("resourceGroupEname").toString().trim().toUpperCase() : "";
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isEmpty(resourceGroupEname)) {
throw new PlatException("没有提供有效的群组Id或群组英文名");
}
} catch (Exception var18) {
inInfo.setMsg("没有提供有效的群组Id/英文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
try {
HashMap map;
List resourceGroupIdList;
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isNotEmpty(resourceGroupEname)) {
map = new HashMap();
map.put("resourceGroupEname", resourceGroupEname);
resourceGroupIdList = this.dao.query("XS05.queryResourceGroupId", map);
if (null == resourceGroupIdList || resourceGroupIdList.size() <= 0) {
inInfo.setMsg("删除第" + (i + 1) + "条记录失败,群组英文名" + resourceGroupEname + "不存在!\n");
inInfo.setStatus(-1);
return inInfo;
}
HashMap resourceGroupIdMap = (HashMap)resourceGroupIdList.get(0);
resourceGroupId = resourceGroupIdMap.get("resourceGroupId").toString();
}
map = new HashMap();
map.put("resourceMemberId", resourceGroupId);
resourceGroupIdList = this.dao.query("XS06.query", map);
if (null != resourceGroupIdList && resourceGroupIdList.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组是其他资源组的成员,不能删除!");
}
map.put("resourceMemberId", "");
map.put("resourceParentId", resourceGroupId);
List resourceGroupAsParents = this.dao.query("XS06.query", map);
if (null != resourceGroupAsParents && resourceGroupAsParents.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组下有成员关系,不能删除!");
}
map.put("objectId", resourceGroupId);
List resourceGroupAsObjects = this.dao.query("XS07.query", map);
if (null != resourceGroupAsObjects && resourceGroupAsObjects.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组存在授权关系,不能删除!");
}
Map paramMap = new HashMap();
paramMap.put("resourceGroupId", resourceGroupId);
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (existResourceGroup.size() <= 0) {
throw new PlatException("没有查到resourceGroupId为" + resourceGroupId + "的数据!");
}
this.dao.delete("XS05.delete", paramMap);
deletedResourceGroupList.add(existResourceGroup);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2301");
xEyeEntity.setLogName("删除资源组");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "删除了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rge", inInfoRowMap.get("resourceGroupEname"));
this.log(xEyeEntity);
} catch (Exception var19) {
buffer.append("删除第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfo.setMsg(buffer.toString());
detail.append(var19.getMessage());
logger.error(var19.getMessage());
return inInfo;
}
}
buffer.append("删除").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_41");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("删除资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo updateResourceGroup(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuffer buffer = new StringBuffer();
StringBuffer detail = new StringBuffer();
List updatedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
HashMap paramMap = new HashMap();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
String resourceGroupId;
String resourceGroupEname;
try {
resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString() : "";
resourceGroupEname = inInfoRowMap.get("resourceGroupEname").toString().toUpperCase();
String resourceGroupCname = inInfoRowMap.get("resourceGroupCname").toString();
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isEmpty(resourceGroupEname)) {
throw new PlatException("没有提供有效的群组Id或群组英文名");
}
} catch (Exception var19) {
inInfo.setMsg("没有提供有效的群组Id/英文名/中文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
try {
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isNotEmpty(resourceGroupEname)) {
Map map = new HashMap();
map.put("resourceGroupEname", resourceGroupEname);
List resourceGroupIdList = this.dao.query("XS05.queryResourceGroupId", map);
if (null == resourceGroupIdList || resourceGroupIdList.size() <= 0) {
inInfo.setMsg("修改第" + (i + 1) + "条记录失败,群组英文名" + resourceGroupEname + "不存在!\n");
inInfo.setStatus(-1);
return inInfo;
}
map = (HashMap)resourceGroupIdList.get(0);
resourceGroupId = map.get("resourceGroupId").toString();
}
paramMap.put("resourceGroupId", resourceGroupId);
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (existResourceGroup.size() <= 0) {
throw new PlatException("没有查到resourceGroupId为" + resourceGroupId + "的数据!");
}
Map result = (Map)existResourceGroup.get(0);
Iterator var26 = inInfoRowMap.entrySet().iterator();
while(var26.hasNext()) {
Entry entry = (Entry)var26.next();
Object _value = entry.getValue();
if (_value != null) {
result.put(entry.getKey(), _value);
}
}
this.dao.update("XS05.update", result);
buffer.append("更新资源组:").append(eiBlock.getCell(i, "resourceGroupEname")).append(" 的记录成功\n");
Map map = new HashMap();
map.put("resourceGroupId", resourceGroupId);
List updateResourceGroupList = this.dao.query("XS05.query", map);
Map updateResourceGroupMap = (Map)updateResourceGroupList.get(0);
updatedResourceGroupList.add(updateResourceGroupMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2302");
xEyeEntity.setLogName("修改资源组");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "修改了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recRevisor"));
xEyeEntity.set("x_xs_rge", inInfoRowMap.get("resourceGroupEname"));
this.log(xEyeEntity);
} catch (Exception var20) {
buffer.append("更新资源组:").append(eiBlock.getCell(i, "resourceGroupEname")).append(" 的记录失败\n");
inInfo.setStatus(-1);
String errorMsg = var20.getCause() == null ? var20.getMessage().toString() : var20.getCause().toString();
detail.append(errorMsg);
logger.error(errorMsg);
}
}
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (updatedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", updatedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_42");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("更新资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo insertResourceGroupMember(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedMemberList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
if (inInfoRowMap.get("resourceMemberId") == null || inInfoRowMap.get("resourceParentId") == null) {
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
}
if (inInfoRowMap.get("resourceMemberEname") == null || inInfoRowMap.get("resourceParentEname") == null) {
inInfoRowMap.put("resourceMemberEname", "");
inInfoRowMap.put("resourceParentEname", "");
}
String resourceMemberId = inInfoRowMap.get("resourceMemberId").toString();
String resourceParentId = inInfoRowMap.get("resourceParentId").toString();
String resourceMemberEname = inInfoRowMap.get("resourceMemberEname").toString().toUpperCase();
String resourceParentEname = inInfoRowMap.get("resourceParentEname").toString().toUpperCase();
String memberType = inInfoRowMap.get("memberType").toString();
HashMap rowMap;
List list;
if ("".equals(resourceMemberId) || "".equals(resourceParentId) || "".equals(memberType)) {
if ("".equals(resourceMemberEname) || "".equals(resourceParentEname) || "".equals(memberType)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源ID、资源所属组ID或者资源英文名、资源组英文名及资源类别均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
rowMap = new HashMap();
rowMap.put("resourceGroupEname", resourceParentEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源组不存在\n");
inInfo.setStatus(-1);
return inInfo;
}
resourceParentId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
list.clear();
rowMap.clear();
try {
byte var18 = -1;
switch(memberType.hashCode()) {
case -973253906:
if (memberType.equals("RESOURCE_GROUP")) {
var18 = 0;
}
default:
switch(var18) {
case 0:
rowMap.put("resourceGroupEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
resourceMemberId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
break;
default:
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
resourceMemberId = ((HashMap)list.get(0)).get("resourceId").toString();
}
}
} catch (PlatException var26) {
inInfo.setMsg(var26.getMessage());
inInfo.setStatus(-1);
return inInfo;
}
}
if (resourceMemberId.equals(resourceParentId)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源与父节点不能是同一个\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
rowMap = new HashMap();
rowMap.put("resourceMemberId", resourceMemberId);
rowMap.put("resourceParentId", resourceParentId);
list = this.dao.query("XS06.query", rowMap);
if (list != null && list.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该记录已存在\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
return inInfo;
}
} else {
inInfoRowMap.put("resourceMemberId", resourceMemberId);
inInfoRowMap.put("resourceParentId", resourceParentId);
if (JudgeCircleUtils.judgeCircle("XS06.queryParentInfo", "XS06.queryChildInfo", resourceParentId, resourceMemberId).getStatus() < 0) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,父节点与子节点不能形成环状\n");
} else {
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (null == sortIndex || "".equals(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (StringUtils.isBlank(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (StringUtils.isBlank(recReviseTime)) {
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
inInfoRowMap.putIfAbsent("path", "");
this.dao.insert("XS06.insert", inInfoRowMap);
logger.info("新增第" + (i + 1) + "条记录成功\n");
Map map = new HashMap();
map.put("resourceMemberId", resourceMemberId);
map.put("resourceParentId", resourceParentId);
List insertMemberList = this.dao.query("XS06.query", map);
Map insertMemberMap = (Map)insertMemberList.get(0);
insertedMemberList.add(insertMemberMap);
map.put("objectId", resourceParentId);
this.dao.query("XS07.query", map);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2303");
xEyeEntity.setLogName("为资源组添加新成员");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recCreator") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "将 " + insertMemberMap.get("memberName") + " 添加为" + insertMemberMap.get("resourceParentName") + " 资源组的成员");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rmi", inInfoRowMap.get("resourceMemberId"));
xEyeEntity.set("x_xs_rpi", resourceParentId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rmn", insertMemberMap.get("memberName"));
xEyeEntity.set("x_xs_rpn", insertMemberMap.get("resourceParentName"));
this.log(xEyeEntity);
}
}
} catch (Exception var27) {
logger.info("新增第" + (i + 1) + "条记录失败\n");
buffer.append("新增第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceMemberId", "");
detail.append(var27.getMessage());
logger.error(var27.getMessage());
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedMemberList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedMemberList);
eiInfo.set(EiConstant.eventId, "E_XS_43");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源组成员失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
AuthInfoManager.clearAuthInfo();
}
return inInfo;
}
}
public EiInfo deleteResourceGroupMember(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedMemberList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
if (inInfoRowMap.get("resourceMemberId") == null || inInfoRowMap.get("resourceParentId") == null) {
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
continue;
}
if (inInfoRowMap.get("resourceMemberEname") == null || inInfoRowMap.get("resourceParentEname") == null) {
inInfoRowMap.put("resourceMemberEname", "");
inInfoRowMap.put("resourceParentEname", "");
}
String resourceParentId = inInfoRowMap.get("resourceParentId").toString();
String objectId = inInfoRowMap.get("resourceMemberId").toString();
String resourceMemberEname = inInfoRowMap.get("resourceMemberEname").toString().toUpperCase();
String resourceParentEname = inInfoRowMap.get("resourceParentEname").toString().toUpperCase();
String memberType = inInfoRowMap.get("memberType").toString();
HashMap rowMap;
List list;
if (StringUtils.isEmpty(resourceParentId) && StringUtils.isEmpty(objectId) && StringUtils.isNotEmpty(resourceMemberEname) && StringUtils.isNotEmpty(resourceParentEname)) {
rowMap = new HashMap();
rowMap.put("resourceGroupEname", resourceParentEname);
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
inInfo.setMsg("删除第" + (i + 1) + "条记录失败,资源组不存在\n");
inInfo.setStatus(-1);
return inInfo;
}
resourceParentId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
list.clear();
rowMap.clear();
try {
byte var17 = -1;
switch(memberType.hashCode()) {
case -973253906:
if (memberType.equals("RESOURCE_GROUP")) {
var17 = 0;
}
default:
switch(var17) {
case 0:
rowMap.put("resourceGroupEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
objectId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
break;
default:
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
objectId = ((HashMap)list.get(0)).get("resourceId").toString();
}
}
} catch (PlatException var20) {
inInfo.setMsg(var20.getMessage());
inInfo.setStatus(-1);
return inInfo;
}
}
if (!StringUtils.isNotEmpty(resourceParentId) || !StringUtils.isNotEmpty(objectId)) {
inInfo.setStatus(-1);
String errorMsg = "传入数据为空,删除失败!";
inInfo.setMsg(errorMsg);
logger.error(errorMsg);
return inInfo;
}
try {
inInfoRowMap.put("resourceMemberId", objectId);
inInfoRowMap.put("resourceParentId", resourceParentId);
rowMap = new HashMap();
rowMap.put("resourceMemberId", objectId);
rowMap.put("resourceParentId", resourceParentId);
list = this.dao.query("XS06.query", rowMap);
Map deleteMemberMap = (Map)list.get(0);
deletedMemberList.add(deleteMemberMap);
this.dao.delete("XS06.delete", inInfoRowMap);
Map map2 = new HashMap();
map2.put("objectId", resourceParentId);
this.dao.query("XS07.query", map2);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2304");
xEyeEntity.setLogName("解除资源组与资源的成员关系");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "解除了 " + inInfoRowMap.get("memberName") + " 与" + inInfoRowMap.get("resourceParentName") + " 资源组的成员关系");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rmi", inInfoRowMap.get("resourceMemberId"));
xEyeEntity.set("x_xs_rpi", resourceParentId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rmn", inInfoRowMap.get("memberName"));
xEyeEntity.set("x_xs_rpn", inInfoRowMap.get("resourceParentName"));
this.log(xEyeEntity);
} catch (Exception var21) {
buffer.append("删除第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfo.setMsg(buffer.toString());
detail.append(var21.getMessage());
logger.error(var21.getMessage());
return inInfo;
}
}
buffer.append("删除").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedMemberList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedMemberList);
eiInfo.set(EiConstant.eventId, "E_XS_44");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("删除资源组成员失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
AuthInfoManager.clearAuthInfo();
}
return inInfo;
}
}
public EiInfo getResourceByResourceGroupEname(EiInfo eiInfo) {
String msg = "";
int status = 0;
String resourceParentId = "";
String resourceGroupEname = eiInfo.get("resourceGroupEname").toString();
try {
if (null != resourceGroupEname && !"".equals(resourceGroupEname)) {
Map map = new HashMap();
if (!"root".equals(resourceGroupEname.toLowerCase())) {
Map map1 = new HashMap();
map1.put("resourceGroupEname", resourceGroupEname);
List resourceGroupList = this.dao.query("XSResourceManage.queryResourceGroup", map1);
if (null != resourceGroupList && resourceGroupList.size() > 0) {
Map resourceGroupMap = (Map)resourceGroupList.get(0);
resourceParentId = resourceGroupMap.get("resourceGroupId").toString();
} else {
msg = "该资源组英文名不存在!";
}
} else {
resourceParentId = resourceGroupEname;
}
if (StringUtils.isNotBlank(resourceParentId)) {
map.put("resourceParentId", resourceParentId);
List list = this.dao.query("XS06.query", map);
if (list != null && list.size() > 0) {
new HashMap();
String memberType = "";
Map paramMap = new HashMap();
List resourceList = new ArrayList();
String resourceMemberId = "";
for(int i = 0; i < list.size(); ++i) {
Map infoMap = (Map)list.get(i);
resourceMemberId = infoMap.get("resourceMemberId").toString();
memberType = infoMap.get("memberType").toString();
List resourceGroupInfoList;
Map resourceInfoMap;
if (memberType.equals("RESOURCE")) {
paramMap.put("resourceId", resourceMemberId);
resourceGroupInfoList = this.dao.query("XS04.queryResource", paramMap);
if (resourceGroupInfoList != null && resourceGroupInfoList.size() > 0) {
resourceInfoMap = (Map)resourceGroupInfoList.get(0);
String resourceMemberCname = resourceInfoMap.get("resourceCname") != null ? resourceInfoMap.get("resourceCname").toString() : " ";
infoMap.put("resourceMemberCname", resourceMemberCname);
}
} else if (memberType.equals("RESOURCE_GROUP")) {
paramMap.put("resourceGroupId", resourceMemberId);
resourceGroupInfoList = this.dao.query("XS05.query", paramMap);
if (resourceGroupInfoList != null && resourceGroupInfoList.size() > 0) {
resourceInfoMap = (Map)resourceGroupInfoList.get(0);
infoMap.put("resourceGroupEname", resourceInfoMap.get("resourceGroupEname").toString());
}
}
resourceList.add(infoMap);
}
status = 1;
msg = "该节点下存在资源组或资源信息!";
eiInfo.set("result", resourceList);
} else {
msg = "该节点下没有资源组或资源信息!";
}
}
} else {
msg = "传入的资源组英文名不能为空!";
status = -1;
}
} catch (Exception var17) {
logger.error(var17.getMessage());
status = -1;
msg = var17.getMessage();
}
eiInfo.setMsg(msg);
eiInfo.setStatus(status);
return eiInfo;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.baosight.xservices.xs.service;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XEventManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.util.XSServiceUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ServiceXSResourceManage extends ServiceEPBase {
private static final Logger logger = LogManager.getLogger(ServiceXSResourceManage.class);
public ServiceXSResourceManage() {
}
public EiInfo insertResource(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String type = (String)inInfoRowMap.get("type");
String recCreator = (String)inInfoRowMap.get("recCreator");
if (null == resourceEname || null == type || null == recCreator || "".equals(resourceEname) || "".equals(type) || "".equals(recCreator)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源英文名,类型,创建者均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
List existResource = this.dao.query("XSResourceManage.queryResource", paramMap);
if (null != existResource && existResource.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该资源信息已存在\n");
inInfo.setStatus(-1);
return inInfo;
}
} else {
String resourceId = inInfoRowMap.get("resourceId") != null ? inInfoRowMap.get("resourceId").toString() : "";
if (!StringUtils.isNotEmpty(resourceId) || resourceId.equals(" ")) {
resourceId = XSServiceUtils.getUUID();
inInfoRowMap.put("resourceId", resourceId);
}
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
inInfoRowMap.put("isAuth", "0");
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (StringUtils.isBlank(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (!"".equals(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (!"".equals(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS04.insert", inInfoRowMap);
Map map = new HashMap();
map.put("resourceId", resourceId);
List insertResourceList = this.dao.query("XS04.query", map);
Map insertResourceMap = (Map)insertResourceList.get(0);
insertedResourceList.add(insertResourceMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2000");
xEyeEntity.setLogName("新增资源");
xEyeEntity.setInvokeInfo(recCreator + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口新增了资源名为 " + resourceEname + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recCreator);
xEyeEntity.set("x_xs_re", resourceEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
buffer.append("新增第").append(i + 1).append("条记录失败\n").append(var24.getMessage());
inInfo.setStatus(-1);
inInfoRowMap.put("resourceId", "");
detail.append(var24.getMessage());
logger.error(var24.getMessage());
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedResourceList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_23");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo updateResource(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder builder = new StringBuilder();
StringBuilder detail = new StringBuilder();
List updatedResourceList = new ArrayList();
List insertedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String type = (String)inInfoRowMap.get("type");
if (null == resourceEname || null == type || null == recRevisor || "".equals(resourceEname) || "".equals(type) || "".equals(recRevisor)) {
inInfo.setStatus(-1);
inInfo.setMsg("传入的资源英文名,资源类型与修改人均不能为空!");
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
List existResource = this.dao.query("XSResourceManage.queryResource", paramMap);
if (null != existResource && existResource.size() > 0) {
if (!ignoreDuplicate) {
builder.append(resourceEname + " 的资源信息已存在\n");
Map existMap = (Map)existResource.get(0);
existMap.put("recReviseTime", DateUtils.curDateTimeStr14());
existMap.put("recRevisor", recRevisor);
this.dao.update("XS04.update", existMap);
Map map = new HashMap();
map.put("resourceId", existMap.get("id"));
List updateResourceList = this.dao.query("XS04.query", map);
Map updateResourceMap = (Map)updateResourceList.get(0);
updatedResourceList.add(updateResourceMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2002");
xEyeEntity.setLogName("修改资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口修改了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", existMap.get("resourceId"));
xEyeEntity.set("x_xs_re", inInfoRowMap.get("resourceEname"));
xEyeEntity.set("x_xs_on", recRevisor);
this.log(xEyeEntity);
}
} else {
String resourceId = inInfoRowMap.get("resourceId") != null ? inInfoRowMap.get("resourceId").toString() : "";
if (!StringUtils.isNotEmpty(resourceId)) {
resourceId = XSServiceUtils.getUUID();
inInfoRowMap.put("resourceId", resourceId);
}
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
inInfoRowMap.put("isAuth", "0");
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (StringUtils.isBlank(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
inInfoRowMap.put("recRevisor", " ");
inInfoRowMap.put("recCreator", recRevisor);
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (!"".equals(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS04.insert", inInfoRowMap);
Map map = new HashMap();
map.put("resourceId", resourceId);
List insertResourceList = this.dao.query("XS04.query", map);
Map insertResourceMap = (Map)insertResourceList.get(0);
insertedResourceList.add(insertResourceMap);
builder.append("同步").append(resourceEname).append("的资源信息成功");
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2000");
xEyeEntity.setLogName("新增资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口新增了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recRevisor);
xEyeEntity.set("x_xs_re", resourceEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
builder.append("同步").append(resourceEname).append(" 的资源信息失败\n");
inInfo.setStatus(-1);
detail.append(var24.getMessage());
logger.error(var24.getMessage());
}
}
inInfo.setMsg(builder.toString());
inInfo.setDetailMsg(detail.toString());
EiInfo eiInfo;
EiInfo outInfo;
if (insertedResourceList.size() > 0) {
eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_23");
outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("新增资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
if (updatedResourceList.size() > 0) {
eiInfo = new EiInfo();
eiInfo.set("list", updatedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_25");
outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("更新资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo deleteResource(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder builder = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String recRevisor = (String)inInfoRowMap.get("recRevisor");
if (null == resourceEname || "".equals(resourceEname) || null == recRevisor || "".equals(recRevisor)) {
inInfo.setStatus(-1);
inInfo.setMsg("传入的资源英文名与修改人不能为空!");
return inInfo;
}
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
try {
List resourceList = this.dao.query("XSResourceManage.queryResource", paramMap);
if (resourceList.size() < 1) {
builder.append("不存在 ").append(resourceEname).append(" 的资源信息\n");
} else {
Map resourceMap = (Map)resourceList.get(0);
String resourceId = (String)resourceMap.get("resourceId");
if (null != resourceId && !"".equals(resourceId)) {
inInfoRowMap.put("resourceId", resourceId);
EiInfo eiInfo = new EiInfo();
eiInfo.set(EiConstant.serviceId, "S_XS_27");
EiBlock block = new EiBlock("result");
eiInfo.setBlock(block);
Map map = new HashMap();
map.put("resourceMemberId", resourceId);
List resourceAsMembers = this.dao.query("XS06.query", map);
if (null != resourceAsMembers && resourceAsMembers.size() > 0) {
block.setRows(resourceAsMembers);
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
map.put("subjectId", "");
map.put("objectId", resourceId);
List resourceAsObjects = this.dao.query("XS07.query", map);
if (null != resourceAsObjects && resourceAsObjects.size() > 0) {
block.setRows(resourceAsObjects);
eiInfo.set(EiConstant.serviceId, "S_XS_26");
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
map.put("authResourceId", resourceId);
List resourceAsDataObjects = this.dao.query("XS10.query", map);
eiInfo.set(EiConstant.serviceId, "S_XS_31");
if (null != resourceAsDataObjects && resourceAsDataObjects.size() > 0) {
block.setRows(resourceAsDataObjects);
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
this.dao.delete("XS04.delete", inInfoRowMap);
deletedResourceList.add(resourceMap);
builder.append("删除资源:").append(resourceEname).append("的信息成功!\n");
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2001");
xEyeEntity.setLogName("删除资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口删除了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recRevisor);
xEyeEntity.set("x_xs_re", inInfoRowMap.get("resourceEname"));
this.log(xEyeEntity);
} else {
builder.append("不存在 ").append(resourceEname).append(" 的资源信息\n");
}
}
} catch (Exception var22) {
builder.append("删除资源:").append(resourceEname).append("的信息失败!\n");
inInfo.setStatus(-1);
detail.append(var22.getMessage());
logger.error(var22.getMessage());
}
}
inInfo.setMsg(builder.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedResourceList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_24");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("删除资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo getResourceInfo(EiInfo inInfo) {
String msg = "";
int status = -1;
List resourceList = new ArrayList();
Integer size = 0;
try {
String resourceEname = inInfo.getString("resourceEname");
String resourceCname = inInfo.getString("resourceCname");
String type = inInfo.getString("type");
Map resourceMap = new HashMap();
if (StringUtils.isNotEmpty(resourceEname)) {
resourceMap.put("resourceEname", resourceEname);
}
if (StringUtils.isNotEmpty(resourceCname)) {
resourceMap.put("resourceCname", resourceCname);
}
if (StringUtils.isNotEmpty(type)) {
resourceMap.put("type", type);
}
resourceList = this.dao.query("XS04.queryResource", resourceMap);
size = ((List)resourceList).size();
status = 1;
msg = "查询成功!";
} catch (Exception var10) {
msg = var10.getCause().toString();
}
EiInfo outInfo = new EiInfo();
outInfo.setMsg(msg);
outInfo.setStatus(status);
outInfo.set("result", resourceList);
outInfo.set("size", size);
return outInfo;
}
}
......@@ -67,7 +67,7 @@
<isNotEmpty prepend=" AND " property="node">
t1.node_ename like concat(#node#, '%')
</isNotEmpty>
order by "sortIndex"
order by sortIndex asc
</select>
<select id="query2" resultClass="java.util.HashMap">
......
......@@ -23,3 +23,4 @@
</script>
<script src="${ctx}/common/js/common.js"></script>
<script src="${ctx}/common/js/jsUtils.js"></script>
<EF:EFInput cname="parentFormEname" ename="efParentFormEname" type="hidden"/>
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
}
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFTree = {
"pageTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
pageTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {
leaf: false
}
},
"orgTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
orgTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {
leaf: false
}
}
};
// 保存
$("#BTN_SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
$("#SAVE").on("click", save);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
// 禁用Input
disableInput();
// 权限类型绑定事件
authTypeInputEvent();
});
/**
* 查询
* Input集合
*
* @returns {*|jQuery|HTMLElement}
*/
let query = function () {
resultGrid.dataSource.page(1);
let listAuthTypeInput = function () {
return $("input:radio[name='result-0-authType']");
}
/**
* 保存
* 清除Input选择
*
* @param bool
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
let clearCheckedInput = function () {
// 权限子项
checkedAuthTypeInput(false);
}
/**
* 选中或取消Input,权限子项
*
* @param bool
*/
let checkedAuthTypeInput = function (bool) {
listAuthTypeInput().prop('checked', bool);
}
/**
* 禁用或启用Input
*/
let disableInput = function () {
let bool = false;
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode.label;
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
if (isBlank(orgNode) || isBlank(pageNode) || pageLeaf) {
bool = true;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ009", "save", true);
// 数据权限
listAuthTypeInput().each(function () {
$(this).attr('readonly', bool);
});
}
/**
* 数据权限绑定事件
*/
let authTypeInputEvent = function () {
$("input:radio[name='result-0-authType']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
}
});
}
/**
* 删除
* 菜单树节点选中
*
* @param e
*/
let pageTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectPageTreeNode(nodeData);
// 清空选项
clearCheckedInput();
// 启用Input/禁用Input
disableInput();
// 叶子节点渲染权限
if (!nodeData.leaf) {
showAuthInput();
}
}
/**
* 组织树节点选中
*
* @param e
*/
let orgTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectOrgTreeNode(nodeData);
// 非叶子节点清空显示
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
disableInput(pageLeaf);
// 清空选项
clearCheckedInput();
// 渲染权限
showAuthInput();
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let setSelectPageTreeNode = function (nodeData) {
IPLATUI.EFTree.pageTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.pageTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.pageTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let setSelectOrgTreeNode = function (nodeData) {
IPLATUI.EFTree.orgTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.orgTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.orgTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 显示权限选择框
*
* @param node
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
let showAuthInput = function () {
let depCode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
let pageEname = IPLATUI.EFTree.pageTree.selectTreeNode.label;
if (isBlank(depCode) || isBlank(pageEname)) {
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ009", "delete", true);
// 渲染权限
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-pageEname", pageEname);
inInfo.set("inqu_status-0-authDepCode", depCode);
EiCommunicator.send("HPPZ010", "getByPage", inInfo, {
onSuccess: getByPageSuccess,
onFail: function (res) {
message(res.msg);
}
}, {async: false});
}
/**
* 获取页面权限成功
*
* @param res
*/
let getByPageSuccess = function (res) {
// 清空权限子项
checkedAuthTypeInput(false);
if (res.status < 0) {
message(res.msg);
return;
}
let resultRows = res.getBlock("result").getMappedRows();
if (resultRows.length == 0) {
return;
}
let authType = resultRows[0]['authType'];
if (!isBlank(authType)) {
listAuthTypeInput().each(function () {
if ($(this).val() == authType) {
$(this).prop('checked', 'true');
}
})
}
}
/**
* 保存
*/
let save = function () {
// 检查是否选择的叶子节点
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (isBlank(pageNode.label)) {
message("请选择菜单");
return;
}
if (pageNode.leaf) {
message("【" + pageNode.text + "】不是叶子节点,请选择菜单树叶子节点进行授权");
return;
}
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode;
if (isBlank(orgNode.label)) {
message("请选择部门");
return;
}
JSUtils.confirm("确定对勾选中的数据做\"保存\"操作? ", {
ok: saveOk(pageNode, orgNode)
});
}
/**
* 保存确认
*/
let saveOk = function (pageNode, orgNode) {
let inInfo = new EiInfo();
inInfo.set("result-0-pageEname", pageNode.label);
inInfo.set("result-0-pageCname", pageNode.text);
inInfo.set("result-0-authDepCode", orgNode.label);
inInfo.set("result-0-authDepName", orgNode.text);
inInfo.set("result-0-authType", $("input:radio[name='result-0-authType']:checked").val());
EiCommunicator.send("HPPZ010", "save", inInfo, {
onSuccess: function (res) {
message(res.msg);
},
onFail: function (res) {
}
}, {async: false});
}
<%@ page import="com.baosight.hpjx.hp.xs.tools.HPXSTools" %>
<%@ page import="java.util.List" %>
<%@ page import="com.baosight.hpjx.hp.xs.domain.Org" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.baosight.hpjx.core.enums.OrgTypeEnum" %>
<!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" %>
<%
Map<String, List<Org>> orgMap = HPXSTools.XsOrg.queryAllFactoryMap();
if (orgMap == null) {
orgMap = new HashMap<>();
}
request.setAttribute("orgMap", orgMap);
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage>
<div class="row" style="margin: 0 -10px;">
<div class="col-md-4">
<EF:EFRegion title="系统菜单树" id="tree" fitHeight="true">
<EF:EFTree bindId="groupsTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="XS0705" methodName="query" style="height:435px;">
<EF:EFTree bindId="pageTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HPPZ010" methodName="queryPageTree">
</EF:EFTree>
</EF:EFRegion>
</div>
<div class="col-md-8">
<EF:EFRegion title="查询区" id="inqu">
<div class="row" >
<EF:EFInput type="hidden" cname="授权主体ID" ename="subjectId" row="0" blockId="inqu_status"/>
<EF:EFInput type="hidden" ename="objectCname" row ="0" blockId="inqu_status"/>
<EF:EFInput type="hidden" cname="授权类别" ename="operationType" row="0" blockId="inqu_status" value="ACCESS"/>
<EF:EFInput row="0" blockId="inqu_status" ename="objectEname" cname="授权客体名称" type="hidden"/>
<div class="col-xs-4">
<div class="form-group">
<label class="col-md-5 control-label">
授权主体名称
</label>
<div class="col-md-7">
<input name="inqu_status-0-subjectName" data-query="gt" class="k-textbox input-time query-need"
placeholder="请输入授权主体名称" />
</div>
</div>
</div>
<EF:EFSelect blockId="inqu_status" cname="授权主体类别" ename="subjectType" row="0" defaultValue="全部" colWidth="4" ratio="5:7">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="iplat.xs.subjectType" textField="label" valueField="value"/>
</EF:EFSelect>
<div class="col-xs-4">
<div class="form-group">
<label class="col-md-5 control-label">
授权客体名称
</label>
<div class="col-md-7">
<input name="inqu_status-0-objectName" data-query="gt" class="k-textbox input-time query-need"
placeholder="请输入授权客体名称" />
</div>
</div>
</div>
<EF:EFSelect blockId="inqu_status" cname="授权客体类别" colWidth="4" ename="objectType" row="0" defaultValue="全部" ratio="5:7">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="xs.og.objectType" textField="label" valueField="value"/>
</EF:EFSelect>
<div class="col-xs-8" style="text-align: right" id="inqu_inside"></div>
</div>
</EF:EFRegion>
<EF:EFInput ename="objectCname" cname="授权主体名称" type="hidden"/>
<EF:EFRegion title="记录集" id="result" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="false">
<EF:EFColumn ename="subjectId" cname="授权主体ID" hidden="true"/>
<EF:EFColumn ename="subjectName" cname="授权主体名称" readonly="true" locked="true"/>
<EF:EFComboColumn enable="false" cname="授权主体类别" locked="true" ename="subjectType"
defaultValue="USER" style="text-align:center;">
<EF:EFCodeOption codeName="iplat.xs.subjectType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFColumn ename="objectId" cname="授权客体ID" hidden="true"/>
<EF:EFColumn ename="objectName" cname="授权客体名称" readonly="true" locked="true"/>
<EF:EFComboColumn enable="false" cname="授权客体类别" locked="true" ename="objectType"
defaultValue="RESOURCE" style="text-align:center;">
<EF:EFCodeOption codeName="xs.og.objectType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn cname="操作类型" ename="operationType" readonly="true"
defaultValue="ACCESS" style="text-align:center;">
<EF:EFCodeOption codeName="services.xs.operationType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sortIndex" cname="排序" style="text-align:center;"/>
<EF:EFColumn ename="recCreator" cname="创建人" style="text-align:center;" readonly="true"/>
<EF:EFColumn ename="recCreateTime" cname="创建时间" editType="datetime" readonly="true" displayType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" style="text-align:center;"/>
<EF:EFColumn ename="recRevisor" cname="修改人" style="text-align:center;" readonly="true"/>
<EF:EFColumn ename="recReviseTime" cname="修改时间" readonly="true" editType="datetime" displayType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" style="text-align:center;"/>
<EF:EFColumn ename="archiveFlag" cname="归档标记" style="text-align:center;"/>
</EF:EFGrid>
<div class="col-md-4">
<EF:EFRegion title="组织机构树" id="tree" fitHeight="true">
<EF:EFTree bindId="orgTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HPPZ010" methodName="queryOrgTree">
</EF:EFTree>
</EF:EFRegion>
</div>
</div>
<EF:EFWindow id="authSubject" width="58%" top="100px" left="280px">
<div id="ef_popup_gridA" >
<EF:EFRegion id="inquA" title="查询条件" type="query" efRegionShowClear="true" efRegionSave="true">
<div class="col-md-4">
<EF:EFRegion title="数据查看范围" id="result">
<div class="row">
<div class="col-xs-2 control-label">
<span>用户组英文名</span>
</div>
<div class="col-xs-2">
<EF:EFInput ename="inqu_status-0-groupEname" cname="用户组英文名" inline="true"/>
<div class="col-md-12">
<EF:EFInput cname="本公司" blockId="result" ename="authType" row="0" value="onlyCompany"
colWidth="3" type="radio" inline="true"/>
</div>
<div class="col-xs-3 control-label">
<span>用户组中文名</span>
</div>
<div class="row">
<div class="col-md-9">
<EF:EFInput cname="本厂" blockId="result" ename="authType" row="0" value="onlyFactory"
colWidth="3" type="radio" inline="true"/>
</div>
<div class="col-xs-2">
<EF:EFInput ename="inqu_status-0-groupCname" cname="用户组中文名" inline="true"/>
</div>
<div class="row">
<div class="col-md-6">
<EF:EFInput cname="本部门" blockId="result" ename="authType" row="0" value="onlyDept"
colWidth="3" type="radio" inline="true"/>
</div>
<div class="col-xs-2" style="text-align: right" id="inqua_inside"></div>
</div>
</EF:EFRegion>
<EF:EFRegion id="resultA" title="记录集">
<div class="text-right">
<EF:EFButton cname="确定" ename="ef_popup_gridA_commit"></EF:EFButton>
<div class="row">
<div class="col-md-6">
<EF:EFInput cname="不可查看" blockId="result" ename="authType" row="0" value="noAuth" colWidth="3"
type="radio" inline="true"/>
</div>
</div>
<EF:EFGrid blockId="resultA" queryMethod="queryForGridSubject" autoDraw="false">
<EF:EFColumn ename="groupId" locked="true" cname="群组ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="groupEname" locked="true" cname="群组英文名" readonly="true" width="300"/>
<EF:EFColumn ename="groupCname" cname="群组中文名" readonly="true" width="300"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</EF:EFWindow>
</div>
<EF:EFWindow id="menuPageAuth" url="${ctx}/web/XS0707" width="78%" top="80px" left="120px"></EF:EFWindow>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 15,
pageSizes: [15, 50, 70, 100],
},
"result": {
columns: []
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
<!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="查询条件">
<div class="row">
<EF:EFInput cname="登录名" blockId="inqu_status" ename="userId" row="0" colWidth="3"/>
<EF:EFInput cname="用户姓名" blockId="inqu_status" ename="userName" row="0" colWidth="3"/>
<EF:EFInput cname="菜单名称" blockId="inqu_status" ename="pageCname" row="0" colWidth="3"/>
<EF:EFSelect cname="组织机构" blockId="inqu_status" ename="orgId" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="org_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="userId" cname="登录名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="140" align="center"/>
<EF:EFColumn ename="pageCname" cname="菜单名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="orgId" cname="组织机构" enable="false" width="140" align="center">
<EF:EFOptions blockId="org_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="orgCname" cname="组织机构名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="authType" cname="数据权限" enable="false" width="140" align="center">
<EF:EFCodeOption codeName="hpjx.hppz.authType"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -31,7 +31,7 @@
<EF:EFInput cname="联系方式" blockId="inqu_status" ename="mobile" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
<EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
......@@ -56,7 +56,7 @@
<EF:EFColumn ename="mobile" cname="联系方式" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="status" cname="状态" width="80" align="center" defaultValue="1"
valueField="valueField" textField="textField">
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
<EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
</EF:EFGrid>
......
......@@ -543,7 +543,7 @@ $(function () {
if (ei["status"] == 1) {
var projCodeNew=ei["extAttr"]["projCode"];
JSColorbox.open({
href: "HPSC002C?methodName=initLoad",
href: "HPSC002C?methodName=initLoad&efParentFormEname=HPSC002",
title: "<div style='text-align: center;'>选择产品模板</div>",
width: "70%",
height: "70%",
......
......@@ -190,8 +190,10 @@
href = replacePos(href, (inx + 1), "?");
}
} else {
}
// 当前页面号
let efFormEname = __eiInfo.extAttr[EiConstant.EF_FORM_ENAME];
href = href + (href.indexOf("?") == -1 ? '?' : '&') + "efParentFormEname=" + efFormEname;
parameter["href"] = href;
popWindow = divhtml.data("kendoWindow");
popWindow.setOptions({
......
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