Commit b17fbf31 by wancheng

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

parents 3ce82e9f 394aaec5
...@@ -161,9 +161,16 @@ ...@@ -161,9 +161,16 @@
<artifactId>jxl</artifactId> <artifactId>jxl</artifactId>
<version>2.6.12</version> <version>2.6.12</version>
</dependency> </dependency>
<!-- S3 OSS -->
<dependency>
<groupId>com.baosight.iplat4j</groupId>
<artifactId>oss-plugin</artifactId>
<version>7.0.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>hpjx</finalName>
<resources> <resources>
<resource> <resource>
<directory>src/main/java</directory> <directory>src/main/java</directory>
......
...@@ -249,9 +249,14 @@ public enum DdynamicEnum { ...@@ -249,9 +249,14 @@ public enum DdynamicEnum {
* 用途:厂区查询 * 用途:厂区查询
* 编写:ly * 编写:ly
*/ */
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"); FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"),
/**
* 模块:工人管理
* 用途:工人管理下拉框
* 编写:wwl
*/
WORKER_BLOCK_ID("worker_block_id","userId","userName","HPPZ013.queryComboBox");
/** 将结果集放入的块名 */ /** 将结果集放入的块名 */
......
package com.baosight.hpjx.config;
import com.baosight.hpjx.xss.XssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author wwl
* @Date 2024/3/11 14:20
*/
@Configuration
public class FilterConfig {
@Bean
public FilterRegistrationBean<XssFilter> xssFilterRegistration() {
FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new XssFilter());
registration.addUrlPatterns("/*");
registration.setOrder(1);
return registration;
}
}
\ No newline at end of file
package com.baosight.hpjx.core.constant;
/**
* 平台消息统一存放key
*
* @author:songx
* @date:2024/3/12,10:49
*/
public class EPCodeConstant {
// 许可证不正确
public static final String EP_0000 = "ep.0000";
// 页面不存在或禁止访问
public static final String EP_0010 = "ep.0010";
// 页面不存在或禁止访问
public static final String EP_0012 = "ep.0012";
// 您所访问的页面没有访问权限
public static final String ES001 = "ES001";
// 空白页
public static final String ES999 = "ES999";
// 500页面
public static final String ES500 = "ES500";
}
package com.baosight.hpjx.core.exception;
import com.baosight.hpjx.core.constant.EPCodeConstant;
import com.baosight.hpjx.core.tools.ServletTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author:songx
* @date:2024/3/11,14:58
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
/**
* RuntimeException
*
* @param e
* @throws IOException
* @throws ServletException
*/
@ExceptionHandler(Exception.class)
public void exceptionHandler(Exception e) throws IOException, ServletException {
// 权限异常
if (e instanceof AccessDeniedException) {
ServletTools.dispatcherError(EPCodeConstant.ES001, request.getServletPath(), request, response);
} else if (e instanceof ClassNotFoundException) {
// class不存在
ServletTools.dispatcherError(EPCodeConstant.EP_0010, request.getServletPath(), request, response);
} else {
ServletTools.dispatcherError(EPCodeConstant.ES500, "您所访问的服务出错了", request, response);
}
}
}
package com.baosight.hpjx.core.filter;
import com.baosight.hpjx.core.constant.EPCodeConstant;
import com.baosight.hpjx.core.tools.ServletTools;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.security.web.firewall.RequestRejectedException;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
/**
* 滤波器处理
*
* @author:songx
* @date:2024/3/12,10:32
*/
@Slf4j
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class MyGenericFilterFilter extends GenericFilterBean {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
try {
chain.doFilter(servletRequest, servletResponse);
} catch (RequestRejectedException e) {
log.warn("request_rejected: remote={}, user_agent={}, request_url={}", request.getRemoteHost(),
request.getHeader(HttpHeaders.USER_AGENT), request.getRequestURL(), e);
ServletTools.dispatcherError(EPCodeConstant.EP_0010, request.getServletPath(), request, response);
}
}
}
package com.baosight.hpjx.core.interceptor;
import com.baosight.hpjx.core.constant.EPCodeConstant;
import com.baosight.hpjx.core.tools.ServletTools;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
/**
* 自定义拦截器
*
* @author:songx
* @date:2022/10/9,8:58
*/
@Slf4j
public class MyHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
try {
// 校验接口权限
boolean isInterfaceAuth = this.checkUserInterfaceAuth(request, response);
if (!isInterfaceAuth) {
return false;
}
} catch (IOException e) {
log.error("重定向失败:{}", e.getMessage(), e);
}
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object o,
ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object o, Exception e) {
}
/**
* 校验用户
*
* @param request
* @param response
*/
private boolean checkUserInterfaceAuth(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
String loginName = ObjectUtils.toString(session.getAttribute("loginname"));
String servletPath = request.getServletPath();
// // 从路径中截取页面号和方法名,例:/service/EDFA10/query
String[] servletPaths = servletPath.split("/");
// 异常请求不记录
if (servletPaths.length > 2 && "$src_url$".equals(servletPaths[2])) {
return true;
}
// length=3:接口
return this.checkInterfaceAuth(loginName, servletPaths, request, response);
}
/**
* 用户接口权限校验
* servletPaths.length=3:接口
*
* @param loginName
* @param servletPaths
* @param request
* @param response
*/
private boolean checkInterfaceAuth(String loginName, String[] servletPaths, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if (servletPaths.length != 4) {
return true;
}
// 从配置中读取需要验证的模块
String interfaceAuth = PlatApplicationContext.getProperty("iplat4j.interface.auth.module");
if (StringUtils.isBlank(interfaceAuth)) {
return true;
}
// 检查模块是否需要管理员权限
String moduleName = ServletTools.getModule(request);
if (!StringUtils.startsWithAny(moduleName, interfaceAuth.split(";"))) {
return true;
}
// 是超级管理员
if (LoginUserDetails.isUserAdmin(loginName)) {
return true;
}
ServletTools.dispatcherError(EPCodeConstant.ES001, request.getServletPath(), request, response);
return false;
}
}
package com.baosight.hpjx.core.interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author:songx
* @date:2023/11/23,11:13
*/
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {
/**
* 配置拦截规则与注入拦截器
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// addPathPattern 添加拦截规则 /** 拦截所有包括静态资源
// excludePathPattern 排除拦截规则 所以我们需要放开静态资源的拦截
registry.addInterceptor(new MyHandlerInterceptor())
.addPathPatterns("/service/**")
.addPathPatterns("/web/**")
.addPathPatterns("/**")
// .excludePathPatterns("/")
.excludePathPatterns("/login")
.excludePathPatterns("/css/**", "/fonts/**", "/images/**", "/js/**");
}
}
package com.baosight.hpjx.core.oss;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import lombok.extern.slf4j.Slf4j;
/**
* OSS凭证
*
* @author:songx
* @date:2023/8/28,11:26
*/
@Slf4j
public class OssClientUtils {
private OssClientUtils() {
}
/**
* 初始化配置信息(纯粹就打印日志而已,因为会加载该类的全局变量)
*/
public static void init() {
AmazonS3 s3Client = Instance.s3Client;
log.info("初始化OSS客户端完成:isReady -> {}", s3Client != null);
}
/**
* 获取S3客户端
*
* @return
*/
public static AmazonS3 getS3Client() {
return Instance.s3Client;
}
/**
* 刷新客户端
*/
public static void refresh() {
Instance.refresh();
}
/**
* 初始化Instance
*
* @author:songx
* @date:2022/4/2,9:58
*/
private static class Instance {
/**
* 客户端实例
*/
private static AmazonS3 s3Client = buildAmazonS3();
/**
* 刷新S3客户端
*/
private static void refresh() {
s3Client = buildAmazonS3();
log.info("刷新OSS客户端完成:isReady->{}", s3Client != null);
}
/**
* 获取AmazonS3Client实例
*
* @return
*/
private static synchronized AmazonS3 buildAmazonS3() {
String accessKey = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.accessKey");
String secretKey = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.secretKey");
String endpoint = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.endpoint");
if (StringUtils.isBlank(accessKey) || StringUtils.isBlank(secretKey) || StringUtils.isBlank(endpoint)) {
return null;
}
AmazonS3ClientBuilder client = AmazonS3ClientBuilder.standard();
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(com.amazonaws.Protocol.HTTPS);
config.setConnectionTimeout(10001);
config.setSignerOverride("S3SignerType");
client.setClientConfiguration(config);
client.setCredentials(new AWSStaticCredentialsProvider(
new BasicAWSCredentials(accessKey, secretKey)));
String url = endpoint + ":" + 80;
client.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, null));
return client.build();
}
}
}
package com.baosight.hpjx.core.oss;
import com.amazonaws.services.s3.AmazonS3;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.PageContext;
import java.io.File;
/**
* OSS工具类
*
* @author:songx
* @date:2023/8/28,11:25
*/
public class OssUtils {
// 桶名称
private static final String bucketName = PlatApplicationContext.getProperty(
"iplat4j.admin.objectStorage.s3.bucket");
/**
* 前端上传文件
*
* @param pageContext
* @return
* @throws Exception
*/
public static String uploadFile(PageContext pageContext) throws Exception {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
return null;
}
/**
* 上传文件
*
* @param key 默认不指定key的情况下,以文件内容的hash值作为文件名
* @param file
*/
public static void uploadFile(String key, File file) {
AmazonS3 client = OssClientUtils.getS3Client();
AssertUtils.isNull(client, "上传失败,OSS客户端未初始化,请检查");
client.putObject(bucketName, key, file);
}
}
...@@ -7,6 +7,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -7,6 +7,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager; import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -20,6 +21,7 @@ public class UserSessionUtils extends UserSession { ...@@ -20,6 +21,7 @@ public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap(); private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap depMap = new ConcurrentHashMap(); private static ConcurrentMap depMap = new ConcurrentHashMap();
private static ConcurrentMap userAdminMap = new ConcurrentHashMap();
/** /**
* 获取用户信息 * 获取用户信息
...@@ -86,4 +88,22 @@ public class UserSessionUtils extends UserSession { ...@@ -86,4 +88,22 @@ public class UserSessionUtils extends UserSession {
return depCode; return depCode;
} }
/**
* 获取登录用户是否超级管理员
*
* @return
*/
public static boolean isUserAdmin() {
String loginName = getLoginName();
if (loginName == null) {
return false;
}
Boolean isUserAdmin = MapUtils.getBoolean(userAdminMap, loginName);
if (isUserAdmin == null) {
isUserAdmin = LoginUserDetails.isUserAdmin(loginName);
userAdminMap.put(loginName, isUserAdmin);
}
return isUserAdmin;
}
} }
package com.baosight.hpjx.core.tools;
import com.baosight.hpjx.util.StringUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author:songx
* @date:2024/3/12,10:38
*/
public class ServletTools {
/**
* 获取模块名称
*
* @return
*/
public static String getModule(HttpServletRequest request) {
String servletPath = request.getServletPath();
if (StringUtils.isBlank(servletPath)) {
return "";
}
String[] servletPaths = servletPath.split("/");
if (servletPaths == null || servletPaths.length < 3) {
return servletPath;
}
return servletPaths[2];
}
/**
* 重定向到错误信息展示页面
*
* @param msgKey
* @param message
*/
public static void dispatcherError(String msgKey, String message, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("iplat_msgKey", msgKey);
request.setAttribute("iplat_msg", message);
request.getRequestDispatcher("/EP/EP01.jsp").forward(request, response);
}
}
...@@ -168,4 +168,21 @@ ...@@ -168,4 +168,21 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
USER_ID as "userId",
USER_NAME as "userName"
FROM ${hpjxSchema}.T_HPPZ013 WHERE STATUS = 1 AND DELETE_FLAG = '0'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
ORDER BY USER_ID
</select>
</sqlMap> </sqlMap>
...@@ -6,11 +6,7 @@ import com.baosight.hpjx.core.dao.DaoBase; ...@@ -6,11 +6,7 @@ import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004; import com.baosight.hpjx.hp.pz.domain.*;
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.HPPZ011;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
...@@ -534,6 +530,18 @@ public class HPPZTools { ...@@ -534,6 +530,18 @@ public class HPPZTools {
} }
} }
public static class HpPz013 {
public static HPPZ013 get(String userId) {
AssertUtils.isNull(userId, "工人ID不能为空");
Map queryMap = new HashMap();
queryMap.put("userId", userId);
List<HPPZ013> results = DaoBase.getInstance().query(HPPZ013.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("工人ID[%s]不存在", userId));
return results.get(0);
}
}
/** /**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案 * 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
* *
......
...@@ -6,6 +6,7 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -6,6 +6,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant; 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.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005; import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
...@@ -46,7 +47,10 @@ public class ServiceHPSC007 extends ServiceBase { ...@@ -46,7 +47,10 @@ public class ServiceHPSC007 extends ServiceBase {
HPSC006.setPartName(HPSC005.getPartName()); HPSC006.setPartName(HPSC005.getPartName());
inInfo.addBlock("detail").addRow(HPSC006); inInfo.addBlock("detail").addRow(HPSC006);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC007().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC007().eiMetadata);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null, false); Map map = new HashMap();
map.put("factoryCode", HPSC006.getFactoryCode());
map.put("groupCode", HPSC006.getOrgNo());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WORKER_BLOCK_ID), map, false);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败"); LogUtils.setMsg(inInfo, e, "初始化失败");
} }
...@@ -112,8 +116,7 @@ public class ServiceHPSC007 extends ServiceBase { ...@@ -112,8 +116,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue())); BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
actualCompletionTotalWt = actualCompletionTotalWt.add(totalWt); actualCompletionTotalWt = actualCompletionTotalWt.add(totalWt);
HPSC007.setactualCompletionTotalWt(totalWt); HPSC007.setactualCompletionTotalWt(totalWt);
Map<String,String> user = (Map<String, String>) this.dao.get("HPXSUser.queryComboBox", "userId", HPSC007.getUserId()); HPSC007.setUserName(HPPZTools.HpPz013.get(HPSC007.getUserId()).getUserName());
HPSC007.setUserName(user.get("userName"));
DaoUtils.insert("HPSC007.insert",HPSC007); DaoUtils.insert("HPSC007.insert",HPSC007);
} }
// 修改下料表中的字段 // 修改下料表中的字段
...@@ -178,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase { ...@@ -178,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue()))); BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
actualCompletionTotalWt = actualCompletionTotalWt.add(new BigDecimal(decimalFormat.format(Math.round(totalNum.multiply(unitWt).floatValue())))); actualCompletionTotalWt = actualCompletionTotalWt.add(new BigDecimal(decimalFormat.format(Math.round(totalNum.multiply(unitWt).floatValue()))));
HPSC007.setactualCompletionTotalWt(totalWt); HPSC007.setactualCompletionTotalWt(totalWt);
HPSC007.setUserName(HPPZTools.HpPz013.get(HPSC007.getUserId()).getUserName());
DaoUtils.insert("HPSC007.update",HPSC007); DaoUtils.insert("HPSC007.update",HPSC007);
} }
// 修改下料表中的字段 // 修改下料表中的字段
......
...@@ -8,6 +8,8 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -8,6 +8,8 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sc.domain.HPSC003; import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.xs.domain.HPXS001; import com.baosight.hpjx.hp.xs.domain.HPXS001;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -41,7 +43,16 @@ public class ServiceHPXS001 extends ServiceEPBase { ...@@ -41,7 +43,16 @@ public class ServiceHPXS001 extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
return super.query(inInfo,HPXS001.QUERY); EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
String startDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateFrom");
String endDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateTo");
if (!endDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,"createdDateTo", StringUtil.removeHorizontalLine(endDate));
}
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdDateFrom",StringUtil.removeHorizontalLine(startDate));
}
return super.query(inInfo,HPXS001.QUERY,new HPXS001());
} }
@OperationLogAnnotation(operModul = "报工管理",operType = "删除",operDesc = "删除操作") @OperationLogAnnotation(operModul = "报工管理",operType = "删除",operDesc = "删除操作")
......
package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.xs.domain.HPXS002;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
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 java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/3/11
*/
public class ServiceHPXS002 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo, new HPXS002());
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
String startDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateFrom");
String endDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateTo");
if (!endDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,"createdDateTo",StringUtil.removeHorizontalLine(endDate));
}
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdDateFrom",StringUtil.removeHorizontalLine(startDate));
}
return super.query(inInfo,HPXS002.QUERY,new HPXS002());
}
}
...@@ -85,6 +85,12 @@ ...@@ -85,6 +85,12 @@
<isNotEmpty prepend=" AND " property="updatedName"> <isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName# UPDATED_NAME = #updatedName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
REGISTER_DATE >= #createdDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
REGISTER_DATE &lt;= #createdDateTo#
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
SELECT DISTINCT SELECT DISTINCT
FACTORY_CODE as "factoryCode", FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName" FACTORY_NAME as "factoryName"
FROM ${hpjxSchema}.T_HPPZ014 WHERE 1=1 FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -275,7 +281,7 @@ ...@@ -275,7 +281,7 @@
GROUP_CODE as "groupCode", GROUP_CODE as "groupCode",
GROUP_NAME as "groupName", GROUP_NAME as "groupName",
FACTORY_CODE AS factoryCode FACTORY_CODE AS factoryCode
FROM ${hpjxSchema}.T_HPPZ014 WHERE 1=1 FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -297,7 +303,7 @@ ...@@ -297,7 +303,7 @@
SELECT DISTINCT SELECT DISTINCT
USER_ID as "userId", USER_ID as "userId",
USER_NAME as "userName" USER_NAME as "userName"
FROM ${hpjxSchema}.T_HPPZ014 WHERE 1=1 FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1'
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
......
<?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-03-06 16:14:16
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,
REAL_PATH VARCHAR
-->
<sqlMap namespace="HPXS002">
<sql id="condition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="archiveFlag">
ARCHIVE_FLAG = #archiveFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="realPath">
REAL_PATH = #realPath#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.xs.domain.HPXS002">
SELECT
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.DOC_ID as "docId", <!-- 文件标识 -->
A.DIR_ID as "dirId", <!-- 目录标识 -->
B.PROJ_NAME AS "projName", <!-- 项目名称 -->
B.PRDT_TYPE AS "prdtType", <!-- 产品类型 -->
B.PRDT_NAME AS "prdtName", <!-- 产品名称 -->
substr(A.DOC_NAME,1,INSTR(A.DOC_NAME,'.')-1) as "docName", <!-- 文件名 -->
A.CHG_NAME as "chgName", <!-- 物理文件名 -->
A.DOC_SIZE as "docSize", <!-- 文件大小 -->
A.DOC_TAG as "docTag", <!-- 文件标签 -->
A.CREATED_BY as "createdBy", <!-- 记录创建者 -->
CONCAT(A.CREATED_BY, '-', A.CREATED_NAME) as "createdName", <!-- 记录创建名称 -->
A.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
A.REAL_PATH as "realPath", <!-- 物理路径 -->
A.BIZ_TYPE as "bizType",
A.MAT_ID as "matId"
FROM ${hpjxSchema}.TEUDM_TEMP AS A
INNER JOIN ${hpjxSchema}.T_HPSC002 AS B ON A.MAT_ID = B.ID AND A.COMPANY_CODE = B.COMPANY_CODE
WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
B.PROJ_CODE LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtType">
B.PRDT_TYPE = #prdtType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
B.PRDT_NAME LIKE CONCAT('%', #prdtName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
A.DOC_NAME LIKE CONCAT('%',#docName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME >= #createdDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= #createdDateTo#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.COMPANY_CODE asc,
A.CREATED_TIME asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.TEUDM_TEMP AS A
INNER JOIN ${hpjxSchema}.T_HPSC002 AS B ON A.MAT_ID = B.ID AND A.COMPANY_CODE = B.COMPANY_CODE
WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
B.PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
B.PRDT_TYPE = #projType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
B.PRDT_NAME = #prdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
A.DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME >= #createdDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= #createdDateTo#
</isNotEmpty>
</select>
<!--
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="archiveFlag">
ARCHIVE_FLAG = #archiveFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="realPath">
REAL_PATH = #realPath#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.TEUDM_TEMP (
COMPANY_CODE, <!-- 企业编码 -->
DOC_ID, <!-- 文件标识 -->
DIR_ID, <!-- 目录标识 -->
DOC_NAME, <!-- 文件名 -->
CHG_NAME, <!-- 物理文件名 -->
DOC_SIZE, <!-- 文件大小 -->
DOC_TAG, <!-- 文件标签 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
ARCHIVE_FLAG, <!-- 同步标记 -->
REAL_PATH, <!-- 物理路径 -->
BIZ_TYPE,
MAT_ID
)
VALUES (#companyCode#, #docId#, #dirId#, #docName#, #chgName#, #docSize#, #docTag#, #createdBy#, #createdName#,
#createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #archiveFlag#, #realPath#, #bizType#, #matId#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.TEUDM_TEMP WHERE
COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</delete>
<update id="update">
UPDATE ${hpjxSchema}.TEUDM_TEMP
SET
DIR_ID = #dirId#, <!-- 目录标识 -->
DOC_NAME = #docName#, <!-- 文件名 -->
CHG_NAME = #chgName#, <!-- 物理文件名 -->
DOC_SIZE = #docSize#, <!-- 文件大小 -->
DOC_TAG = #docTag#, <!-- 文件标签 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
ARCHIVE_FLAG = #archiveFlag#, <!-- 同步标记 -->
REAL_PATH = #realPath# <!-- 物理路径 -->
BIZ_TYPE = #bizType#
MAT_ID = #matId#
WHERE
COMPANY_CODE = #companyCode# AND
DOC_ID = #docId#
<isNotEmpty prepend=" AND " property="bizType">
BIZ_TYPE = #bizType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</update>
</sqlMap>
package com.baosight.hpjx.xss;
import com.baosight.hpjx.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
/**
* xss过滤
*/
public class XssFilter implements Filter {
//不拦截的地址
private List<String> excludedList = new ArrayList<String>();
@Override
public void init(FilterConfig config) throws ServletException {
/*
* 这里只处理了需要拦截的url地址,如果想不拦截某个字段,比如富文本字段,
* 需要自己在XssHttpServletRequestWrapper类中去添加逻辑
*/
excludedList.add("/service/HP*/*");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper(
(HttpServletRequest) request);
String url = xssRequest.getServletPath();
if(isExcluded(url)){
chain.doFilter(request, response);
}else{
//使用XSS过滤
chain.doFilter(xssRequest, response);
}
}
@Override
public void destroy() {
}
/**
* 是否不拦截
* @param url 请求地址
* @return true不拦截,false拦截
*/
private boolean isExcluded(String url){
// if(StringUtils.isBlank(url)){
// return false;
// }
if(!StringUtils.matches(url, excludedList)){
return true;
}
// for (String excluded : excludedList) {
// if(!url.contains(excluded)){
// return true;
// }
// }
return false;
}
}
package com.baosight.hpjx.xss;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.LinkedHashMap;
import java.util.Map;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import org.apache.commons.io.IOUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
// 没被包装过的HttpServletRequest(特殊场景,需求自己过滤)
HttpServletRequest orgRequest;
// html过滤
private final static HTMLFilter htmlFilter = new HTMLFilter();
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
orgRequest = request;
}
/**
* 过滤json参数
*/
@Override
public ServletInputStream getInputStream() throws IOException {
String contentType = super.getHeader(HttpHeaders.CONTENT_TYPE);
//非json类型,直接返回
if(!(MediaType.APPLICATION_JSON_VALUE.
equalsIgnoreCase(contentType) ||
MediaType.APPLICATION_JSON_UTF8_VALUE.
equalsIgnoreCase(contentType))){
return super.getInputStream();
}
//为空,直接返回
String json = IOUtils.toString(super.getInputStream(), "utf-8");
if (StringUtils.isBlank(json)) {
return super.getInputStream();
}
//xss过滤
json =xssEncode(json);
json = StringEscapeUtils.unescapeHtml4(json);
final ByteArrayInputStream bis =
new ByteArrayInputStream(json.getBytes("utf-8"));
return new ServletInputStream() {
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value =xssEncode(value);
}
return StringEscapeUtils.unescapeHtml4(value);
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
parameters[i] = StringEscapeUtils.unescapeHtml4(parameters[i]);
}
return parameters;
}
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = new LinkedHashMap<>();
Map<String, String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = xssEncode(values[i]);
values[i] = StringEscapeUtils.unescapeHtml4(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return StringEscapeUtils.unescapeHtml4(value);
}
private String xssEncode(String input) {
return htmlFilter.filter(input);
}
/**
* 获取最原始的request
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* 获取最原始的request
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof XssHttpServletRequestWrapper) {
return ((XssHttpServletRequestWrapper) request).getOrgRequest();
}
return request;
}
}
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
} }
%> %>
</head> </head>
<body class="i-theme-${theme}"> <body class="i-theme-${theme}" style="background: url('${iPlatStaticURL}/common/img/login.png') no-repeat; background-size: 100% 100%;">
<div class="main"> <div class="main">
<div class="wrapper"> <div class="wrapper">
<div class="content overflow-hidden"> <div class="content overflow-hidden">
...@@ -302,29 +302,29 @@ ...@@ -302,29 +302,29 @@
</div> </div>
</div> </div>
</div> </div>
<div class="info"> <%--<div class="info">
<div class="row"> <div class="row">
<div class="footer-center col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3"> <div class="footer-center col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<div class="phone-number"> <div class="phone-number">
&emsp; &emsp;
<%-- <span>运维平台热线 8008200220、4008210860、26646708、26642410</span>--%> &lt;%&ndash; <span>运维平台热线 8008200220、4008210860、26646708、26642410</span>&ndash;%&gt;
</div> </div>
<div class="copyright-info"> <div class="copyright-info">
<%--<span>©上海宝信软件股份有限公司 Copyright ©2020 BAOSIGHT Corporation. All Rights Reserved</span>--%> &lt;%&ndash;<span>©上海宝信软件股份有限公司 Copyright ©2020 BAOSIGHT Corporation. All Rights Reserved</span>&ndash;%&gt;
</div> </div>
</div> </div>
<div class="footer-right col-sm-2 col-md-3"> <div class="footer-right col-sm-2 col-md-3">
<%-- <div class="footer-logo">--%> &lt;%&ndash; <div class="footer-logo">&ndash;%&gt;
<%-- <img src="${iPlatStaticURL}/iplatui/img/icon_ie.png" width="51"--%> &lt;%&ndash; <img src="${iPlatStaticURL}/iplatui/img/icon_ie.png" width="51"&ndash;%&gt;
<%-- onclick="window.open('https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads')">--%> &lt;%&ndash; onclick="window.open('https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads')">&ndash;%&gt;
<%-- </div>--%> &lt;%&ndash; </div>&ndash;%&gt;
<div class="footer-logo"> &lt;%&ndash;<div class="footer-logo">
<%--<img src="${iPlatStaticURL}/iplatui/img/icon_chrome.png" width="51" <img src="${iPlatStaticURL}/iplatui/img/icon_chrome.png" width="51"
onclick="downloadChrome()">--%> onclick="downloadChrome()">
</div> </div>&ndash;%&gt;
</div>
</div> </div>
</div> </div>
</div>--%>
</div> </div>
<div class="i-overlay"></div> <div class="i-overlay"></div>
</body> </body>
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="platFileUploader" class="com.baosight.iplat4j.eu.dm.util.PlatFileUploader">
<property name="dao" ref="platDao"/>
</bean>
<bean id="fileUpLoadManager" class="com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3">
<property name="fileUploader" ref="platFileUploader"/>
</bean>
</beans>
<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true" %>
<%@ page import="com.baosight.iplat4j.config.AdminFactoryConfig" %>
<%@ page import="com.baosight.iplat4j.eu.dm.util.IFileUploadManager" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="org.slf4j.Logger" %>
<%
Logger log = LoggerFactory.getLogger(IFileUploadManager.class);
try {
String result = AdminFactoryConfig.getFileUpLoadInterface().uploadFile(pageContext);
log.info("uploadFile result:{}", result);
} catch (Exception e) {
log.error("附件上传时出现异常{}", e.getMessage(), e);
response.sendError(500, e.getMessage());
return;
}
%>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<EF:EFColumn ename="hpsc006Id" cname="生产下料ID" hidden="true"/> <EF:EFColumn ename="hpsc006Id" cname="生产下料ID" hidden="true"/>
<EF:EFComboColumn ename="userId" cname="完成人" width="100" align="center" <EF:EFComboColumn ename="userId" cname="完成人" width="100" align="center"
filter="contains" readonly="true"> filter="contains" readonly="true">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="worker_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="userName" cname="完成名称" hidden="true"/> <EF:EFColumn ename="userName" cname="完成名称" hidden="true"/>
<EF:EFColumn ename="actualCompletionNum" cname="完成数量" format="{0:N3}" maxLength="12" displayType="0.000" <EF:EFColumn ename="actualCompletionNum" cname="完成数量" format="{0:N3}" maxLength="12" displayType="0.000"
......
$(function () {
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [/*{
field: "operator",
template: function (item) {
console.log(item)
let auditStatus = item.status;
let template = '';
if (item.matId != null) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件清单</a>';
}
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" '
+
'onclick="check(' + item.id + ',1, \'' + item.planInfoNo + '\')" >提交</a>';
}
/!*else {
template += '<a hidden="hidden" style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',0)" >撤回</a>';
}*!/
return template;
}
},*//*{
field: "registerDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},*/{
field: "docName",
title: "文件名称",
template: function (item) {
let docName = item.docName
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM06.jsp?docId=' + item.docId
+ '" >'+docName+'</a>';
return template;
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "factoryCode") {
// cell_label 表示子级节点 ,that 表示此 grid
var cell_label = "groupCode",that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
//e.preventDefault();
//let btnNode = $(this);
//禁用按钮
//btnNode.attr("disabled", true);
//saveResult(btnNode);
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'update'
|| e.eiInfo.extAttr.methodName == 'insert') {
query();
}
},
onRowClick: function (e) {
/*var block = detailGrid.getEiBlock();
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
var info = new EiInfo()
var parentId = e.model['planInfoNo'];
info.set("parentId", parentId);
EiCommunicator.send("HPSC004", "queryDetail", info, {
onSuccess: function (ei) {//返回结果集
detailGrid.setEiInfo(ei);
}, onFail: function (ei) {
}
}, {async: false});*/
},
}
}
$("#EXPORT").on("click",function () {
const checkedRows = resultGrid.getCheckedRows();
let docId = "";
if (checkedRows.length <= 0) {
NotificationUtil("请至少选中一条数据", "info");
} else {
for (let i = 0, length = checkedRows.length; i < length; i++) {
docId += checkedRows[i]["docId"];
docId += ","
}
docId = docId.substr(0, docId.lastIndexOf(','));
window.location.href = IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM14.jsp?docIds=' + docId
}
})
//工厂类型下拉联动
$('input[name="inqu_status-0-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
EiCommunicator.send("HPXS001", "queryComboBox", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
dataEdition=ei.getBlock("productionGroupCode_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
});
let query = function () { resultGrid.dataSource.page(1);}
/**
* 日期判断
* @param model 当前数据map
* @param rows 数据集合list
* @returns {boolean} 结束时间是否大于开始时间
*/
function check_time(model,rows){
for (var i=0;i<rows.length;i++){
if (model.planInfoNo == rows[i][5]) {
var start_time = rows[i][22];
var end_time = rows[i][23];
if (end_time < start_time) {
return false;
}
}
}
return true;
}
\ No newline at end of file
...@@ -6,11 +6,58 @@ ...@@ -6,11 +6,58 @@
To change this template use File | Settings | File Templates. To change this template use File | Settings | File Templates.
--%> --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<head> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<title>Title</title>
</head>
<body>
</body> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
</html>
<EF:EFPage title="设计图管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<%--<EF:EFAutoComplete ename="inqu_status-0-node_ename" dataField="node_ename" cname="项目名称" queryMethod="queryA"
serviceName="EEDM6001" resultId="blockA">
</EF:EFAutoComplete>--%>
<EF:EFSelect cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="proj_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<%--<EF:EFInput cname="项目名称" blockId="inqu_status" ename="projName" row="0" colWidth="3"/>--%>
<EF:EFSelect cname="产品类型" ename="inqu_status-0-prdtType" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<%--<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>--%>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('3','4','7')"/>
</EF:EFSelect>
<EF:EFInput cname="产品名称" blockId="inqu_status" ename="prdtName" row="0" colWidth="3"/>
<EF:EFInput cname="文件名称" blockId="inqu_status" ename="docName" row="0" colWidth="3"/>
<EF:EFDateSpan startCname="上传日期" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8">
</EF:EFDateSpan>
<%--<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>--%>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="matId" primaryKey="true" cname="物料清单ID" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="realPath" cname="物理路径" hidden="true"/>
<EF:EFColumn cname="项目名称" ename="projName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFComboColumn ename="prdtType" cname="产品类型" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('3','4','7')"/>
</EF:EFComboColumn>
<EF:EFColumn cname="产品名称" ename="prdtName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="文件名称" ename="docName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="150" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
\ No newline at end of file
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