Commit 2b136631 by wasx8023

1.文件上传下载区分测试和正式

parent 85b0240d
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() {
String str = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.switch");
log.warn("str -> {}", str);
return new PlatFileUploadManagerByAmazonS3();
}
}
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode# PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
ORDER BY PROJ_CODE ORDER BY PRDT_CODE
</select> </select>
<!--计划完成时间回写--> <!--计划完成时间回写-->
......
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
<isNotEmpty prepend=" AND " property="parentPrdtCode"> <isNotEmpty prepend=" AND " property="parentPrdtCode">
B.PRDT_CODE = #parentPrdtCode# B.PRDT_CODE = #parentPrdtCode#
</isNotEmpty> </isNotEmpty>
ORDER BY A.PROJ_CODE ORDER BY A.PRDT_CODE
</select> </select>
<select id="queryDate" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004"> <select id="queryDate" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004">
......
...@@ -11,9 +11,12 @@ import com.baosight.hpjx.hp.zl.tools.HPZLTools; ...@@ -11,9 +11,12 @@ import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.FrameworkInfo;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.ProjectConfig;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -59,7 +62,13 @@ public class ServiceHPZL001A extends ServiceEPBase { ...@@ -59,7 +62,13 @@ public class ServiceHPZL001A extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HPZL001A.QUERY, new HPZL001A()); // 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if ("run".equalsIgnoreCase(projectEnv)) {
inInfo = super.query(inInfo, "HPZL001A.queryRun", new HPZL001A());
} else {
inInfo = super.query(inInfo, "HPZL001A.queryDev", new HPZL001A());
}
} catch (Throwable e) { } catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
A.CHECK_ID as "checkId", <!-- 检查单ID --> A.CHECK_ID as "checkId", <!-- 检查单ID -->
A.DOC_TYPE as "docType", <!-- 文件类型 --> A.DOC_TYPE as "docType", <!-- 文件类型 -->
A.DOC_ID as "docId", <!-- 文件ID --> A.DOC_ID as "docId", <!-- 文件ID -->
B.DOC_NAME as "docName", <!-- 文件名称 -->
A.CREATED_BY as "createdBy", <!-- 创建人 --> A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 --> A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 --> A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
...@@ -18,6 +17,16 @@ ...@@ -18,6 +17,16 @@
A.UPDATED_TIME as "updatedTime"<!-- 修改时间 --> A.UPDATED_TIME as "updatedTime"<!-- 修改时间 -->
</sql> </sql>
<sql id="columnDev">
<include refid="column"/>,
B.DOC_NAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="columnRun">
<include refid="column"/>,
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
...@@ -77,9 +86,9 @@ ...@@ -77,9 +86,9 @@
</dynamic> </dynamic>
</sql> </sql>
<select id="query" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL001A"> <select id="queryDev" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL001A">
SELECT SELECT
<include refid="column"/> <include refid="columnDev"/>
FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM02 B FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM02 B
WHERE 1=1 WHERE 1=1
AND A.DOC_ID = B.DOC_ID AND A.DOC_ID = B.DOC_ID
...@@ -88,13 +97,31 @@ ...@@ -88,13 +97,31 @@
<include refid="order"/> <include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="countDev" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM02 B SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM02 B
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
<select id="queryRun" resultClass="com.baosight.hpjx.hp.zl.domain.HPZL001A">
SELECT
<include refid="columnRun"/>
FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM05 B
WHERE 1=1
AND A.DOC_ID = B.RES_ID
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="countRun" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPZL001A A, ${platSchema}.TEUDM05 B
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPZL001A ( INSERT INTO ${hpjxSchema}.T_HPZL001A (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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"> <!-- <bean id="platFileUploader" class="com.baosight.iplat4j.eu.dm.util.PlatFileUploader">-->
<property name="dao" ref="platDao"/> <!-- <property name="dao" ref="platDao"/>-->
</bean> <!-- </bean>-->
<bean id="fileUpLoadManager" class="com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3"> <!-- <bean id="fileUpLoadManager" class="com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3">-->
<property name="fileUploader" ref="platFileUploader"/> <!-- <property name="fileUploader" ref="platFileUploader"/>-->
</bean> <!-- </bean>-->
</beans> </beans>
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
Logger log = LoggerFactory.getLogger(IFileUploadManager.class); Logger log = LoggerFactory.getLogger(IFileUploadManager.class);
try { try {
String result = AdminFactoryConfig.getFileUpLoadInterface().uploadFile(pageContext); String result = AdminFactoryConfig.getFileUpLoadInterface().uploadFile(pageContext);
out.print(result);
log.info("uploadFile result:{}", result); log.info("uploadFile result:{}", result);
} catch (Exception e) { } catch (Exception e) {
log.error("附件上传时出现异常{}", e.getMessage(), e); log.error("附件上传时出现异常{}", e.getMessage(), e);
response.sendError(500, e.getMessage()); response.sendError(500, e.getMessage());
return; out.print("{msg: \"" + e.getMessage() + "\"}");
} }
%> %>
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