Commit ae8911bb authored by KeYong's avatar KeYong

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz…

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_dl_bugfix # Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/WordHtml.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/util/WordHtml.java
parents f021d979 3e89820d
package com.yeejoin.amos.boot.biz.common.utils; package com.yeejoin.amos.boot.biz.common.utils;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Random;
public class SecureRandomUtil { public class SecureRandomUtil {
public static int getIntSecureRandom(Integer bound) { public static int getIntSecureRandom(Integer bound) {
...@@ -17,14 +16,4 @@ public class SecureRandomUtil { ...@@ -17,14 +16,4 @@ public class SecureRandomUtil {
public static int getIntSecureRandom(Integer bound, SecureRandom secureRandom) { public static int getIntSecureRandom(Integer bound, SecureRandom secureRandom) {
return secureRandom.nextInt(bound); return secureRandom.nextInt(bound);
} }
public static void main(String[] args) {
SecureRandom secureRandom = new SecureRandom();
System.out.println((secureRandom.nextDouble() * 9 + 1) * 100000 + "-----");
Random random = new Random();
System.out.println((Math.random() * 9 + 1) * 100000);
System.out.println((int) (secureRandom.nextDouble() * 900 + 100));
}
} }
...@@ -22,7 +22,7 @@ import java.util.regex.Matcher; ...@@ -22,7 +22,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* *
* @Author lichenglong * @Author lichenglong
* *
*/ */
...@@ -40,7 +40,7 @@ public class oConvertUtils { ...@@ -40,7 +40,7 @@ public class oConvertUtils {
} }
return (false); return (false);
} }
public static boolean isNotEmpty(Object object) { public static boolean isNotEmpty(Object object) {
if (object != null && !object.equals("") && !object.equals("null")) { if (object != null && !object.equals("") && !object.equals("null")) {
return (true); return (true);
...@@ -164,7 +164,7 @@ public class oConvertUtils { ...@@ -164,7 +164,7 @@ public class oConvertUtils {
return (defval); return (defval);
} }
} }
public static Integer getInt(Object object) { public static Integer getInt(Object object) {
if (isEmpty(object)) { if (isEmpty(object)) {
return null; return null;
...@@ -208,7 +208,7 @@ public class oConvertUtils { ...@@ -208,7 +208,7 @@ public class oConvertUtils {
/*public static String escapeJava(Object s) { /*public static String escapeJava(Object s) {
return StringEscapeUtils.escapeJava(getString(s)); return StringEscapeUtils.escapeJava(getString(s));
}*/ }*/
public static String getString(Object object) { public static String getString(Object object) {
if (isEmpty(object)) { if (isEmpty(object)) {
return ""; return "";
...@@ -247,24 +247,10 @@ public class oConvertUtils { ...@@ -247,24 +247,10 @@ public class oConvertUtils {
return test.longValue(); return test.longValue();
} }
/**
* 获取本机IP
*/
public static String getIp() {
String ip = null;
try {
InetAddress address = InetAddress.getLocalHost();
ip = address.getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return ip;
}
/** /**
* 判断一个类是否为基本数据类型。 * 判断一个类是否为基本数据类型。
* *
* @param clazz * @param clazz
* 要判断的类。 * 要判断的类。
* @return true 表示为基本数据类型。 * @return true 表示为基本数据类型。
...@@ -293,41 +279,8 @@ public class oConvertUtils { ...@@ -293,41 +279,8 @@ public class oConvertUtils {
} }
/** /**
* @return 本机IP
* @throws SocketException
*/
public static String getRealIp() throws SocketException {
String localip = null;// 本地IP,如果没有配置外网IP则返回它
String netip = null;// 外网IP
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
InetAddress ip = null;
boolean finded = false;// 是否找到外网IP
while (netInterfaces.hasMoreElements() && !finded) {
NetworkInterface ni = netInterfaces.nextElement();
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
ip = address.nextElement();
if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP
netip = ip.getHostAddress();
finded = true;
break;
} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP
localip = ip.getHostAddress();
}
}
}
if (netip != null && !"".equals(netip)) {
return netip;
} else {
return localip;
}
}
/**
* java去除字符串中的空格、回车、换行符、制表符 * java去除字符串中的空格、回车、换行符、制表符
* *
* @param str * @param str
* @return * @return
*/ */
...@@ -344,7 +297,7 @@ public class oConvertUtils { ...@@ -344,7 +297,7 @@ public class oConvertUtils {
/** /**
* 判断元素是否在数组内 * 判断元素是否在数组内
* *
* @param substring * @param substring
* @param source * @param source
* @return * @return
...@@ -371,7 +324,7 @@ public class oConvertUtils { ...@@ -371,7 +324,7 @@ public class oConvertUtils {
/** /**
* SET转换MAP * SET转换MAP
* *
* @param str * @param str
* @return * @return
*/ */
...@@ -415,12 +368,12 @@ public class oConvertUtils { ...@@ -415,12 +368,12 @@ public class oConvertUtils {
private static boolean isInner(long userIp, long begin, long end) { private static boolean isInner(long userIp, long begin, long end) {
return (userIp >= begin) && (userIp <= end); return (userIp >= begin) && (userIp <= end);
} }
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。 * 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->helloWorld * 例如:hello_world->helloWorld
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -457,12 +410,12 @@ public class oConvertUtils { ...@@ -457,12 +410,12 @@ public class oConvertUtils {
} }
return result.toString(); return result.toString();
} }
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。 * 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world,test_id->helloWorld,testId * 例如:hello_world,test_id->helloWorld,testId
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -480,13 +433,13 @@ public class oConvertUtils { ...@@ -480,13 +433,13 @@ public class oConvertUtils {
String result = sf.toString(); String result = sf.toString();
return result.substring(0, result.length() - 1); return result.substring(0, result.length() - 1);
} }
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 //update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。(首字母写) * 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->HelloWorld * 例如:hello_world->HelloWorld
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -515,7 +468,7 @@ public class oConvertUtils { ...@@ -515,7 +468,7 @@ public class oConvertUtils {
return result.toString(); return result.toString();
} }
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 //update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/** /**
* 将驼峰命名转化成下划线 * 将驼峰命名转化成下划线
* @param para * @param para
...@@ -523,18 +476,18 @@ public class oConvertUtils { ...@@ -523,18 +476,18 @@ public class oConvertUtils {
*/ */
public static String camelToUnderline(String para){ public static String camelToUnderline(String para){
if(para.length()<3){ if(para.length()<3){
return para.toLowerCase(); return para.toLowerCase();
} }
StringBuilder sb=new StringBuilder(para); StringBuilder sb=new StringBuilder(para);
int temp=0;//定位 int temp=0;//定位
//从第三个字符开始 避免命名不规范 //从第三个字符开始 避免命名不规范
for(int i=2;i<para.length();i++){ for(int i=2;i<para.length();i++){
if(Character.isUpperCase(para.charAt(i))){ if(Character.isUpperCase(para.charAt(i))){
sb.insert(i+temp, "_"); sb.insert(i+temp, "_");
temp+=1; temp+=1;
} }
} }
return sb.toString().toLowerCase(); return sb.toString().toLowerCase();
} }
/** /**
...@@ -549,10 +502,10 @@ public class oConvertUtils { ...@@ -549,10 +502,10 @@ public class oConvertUtils {
} }
return sb.toString(); return sb.toString();
} }
/** /**
* 获取类的所有属性,包括父类 * 获取类的所有属性,包括父类
* *
* @param object * @param object
* @return * @return
*/ */
...@@ -567,7 +520,7 @@ public class oConvertUtils { ...@@ -567,7 +520,7 @@ public class oConvertUtils {
fieldList.toArray(fields); fieldList.toArray(fields);
return fields; return fields;
} }
/** /**
* 将map的key全部转成小写 * 将map的key全部转成小写
* @param list * @param list
...@@ -577,10 +530,10 @@ public class oConvertUtils { ...@@ -577,10 +530,10 @@ public class oConvertUtils {
List<Map<String, Object>> select = new ArrayList<>(); List<Map<String, Object>> select = new ArrayList<>();
for (Map<String, Object> row : list) { for (Map<String, Object> row : list) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
Set<String> keySet = row.keySet(); Set<String> keySet = row.keySet();
for (String key : keySet) { for (String key : keySet) {
String newKey = key.toLowerCase(); String newKey = key.toLowerCase();
resultMap.put(newKey, row.get(key)); resultMap.put(newKey, row.get(key));
} }
select.add(resultMap); select.add(resultMap);
} }
...@@ -676,7 +629,7 @@ public class oConvertUtils { ...@@ -676,7 +629,7 @@ public class oConvertUtils {
} }
return json; return json;
} }
/** /**
* 字符串转为数组 * 字符串转为数组
* @param strs * @param strs
......
...@@ -24,9 +24,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -24,9 +24,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -45,27 +45,21 @@ import java.net.InetAddress; ...@@ -45,27 +45,21 @@ import java.net.InetAddress;
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" }) "org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" }) @ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class AccessapiApplication { public class AccessapiApplication {
@Autowired @Autowired
private TaAccessConfigServiceImpl taAccessConfigServiceImpl; private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private static final Logger logger = LogManager.getLogger(AccessapiApplication.class); private static final Logger logger = LogManager.getLogger(AccessapiApplication.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// //license授权验证
// System.setProperty("root.path",ClassPathUtil.getPath()+"/config");
// log.info("(license.bat)url:" + ClassPathUtil.getPath()+"/config");
// A.v();
// 服务启动
ConfigurableApplicationContext context = SpringApplication.run(AccessapiApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AccessapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
@Bean @Bean
......
...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -50,11 +50,12 @@ public class AlarmApplication { ...@@ -50,11 +50,12 @@ public class AlarmApplication {
ConfigurableApplicationContext context = SpringApplication.run(AlarmApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AlarmApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -41,18 +41,16 @@ public class EquipDataApplication { ...@@ -41,18 +41,16 @@ public class EquipDataApplication {
private static final Logger logger = LogManager.getLogger(EquipDataApplication.class); private static final Logger logger = LogManager.getLogger(EquipDataApplication.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(EquipDataApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(EquipDataApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -54,11 +54,12 @@ public class OpenapiApplication { ...@@ -54,11 +54,12 @@ public class OpenapiApplication {
ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -5,6 +5,8 @@ import org.springframework.context.annotation.Bean; ...@@ -5,6 +5,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import java.util.Objects;
/** /**
* 路由限流配置 * 路由限流配置
* @author zhuyu * @author zhuyu
...@@ -15,6 +17,6 @@ public class RateLimiterConfig { ...@@ -15,6 +17,6 @@ public class RateLimiterConfig {
@Bean(value = "remoteAddrKeyResolver") @Bean(value = "remoteAddrKeyResolver")
public KeyResolver remoteAddrKeyResolver() { public KeyResolver remoteAddrKeyResolver() {
return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getAddress().getHostAddress()); return exchange -> Mono.just(Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress());
} }
} }
\ No newline at end of file
...@@ -292,7 +292,7 @@ select * from ( ...@@ -292,7 +292,7 @@ select * from (
group by cd.instance_id group by cd.instance_id
) result ) result
<if test="groupByName != null and groupByName!='' "> <if test="groupByName != null and groupByName!='' ">
group by #{groupByName} group by ${groupByName}
</if> </if>
</select> </select>
...@@ -335,7 +335,7 @@ select * from ( ...@@ -335,7 +335,7 @@ select * from (
group by cd.instance_id group by cd.instance_id
) result ) result
<if test="groupByName != null and groupByName!='' "> <if test="groupByName != null and groupByName!='' ">
group by #{groupByName} group by ${groupByName}
</if> </if>
</select> </select>
......
...@@ -107,16 +107,16 @@ ...@@ -107,16 +107,16 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldCodes[key] == 'like' and value !=null and value !=''"> <when test="fieldCodes[key] == 'like' and value !=null and value !=''">
and d.#{key} like concat('%',#{value},'%') and d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldCodes[key] == 'eq' and value !=null and value !=''"> <when test="fieldCodes[key] == 'eq' and value !=null and value !=''">
and d.#{key} = #{value} and d.${key} = #{value}
</when> </when>
<when test="fieldCodes[key] == 'ge' and value !=null and value !=''"> <when test="fieldCodes[key] == 'ge' and value !=null and value !=''">
and d.#{key} >= #{value} and d.${key} >= #{value}
</when> </when>
<when test="fieldCodes[key] == 'le' and value !=null and value !=''"> <when test="fieldCodes[key] == 'le' and value !=null and value !=''">
and d.#{key} <![CDATA[<=]]> #{value} and d.${key} <![CDATA[<=]]> #{value}
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -157,10 +157,10 @@ ...@@ -157,10 +157,10 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldCodes[key] == 'like' and value !=null and value !=''"> <when test="fieldCodes[key] == 'like' and value !=null and value !=''">
and d.#{key} like concat('%',#{value},'%') and d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldCodes[key] == 'eq' and value !=null and value !=''"> <when test="fieldCodes[key] == 'eq' and value !=null and value !=''">
and d.#{key} = #{value} and d.${key} = #{value}
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -211,10 +211,10 @@ ...@@ -211,10 +211,10 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldCodes[key] == 'like' and value !=null and value !=''"> <when test="fieldCodes[key] == 'like' and value !=null and value !=''">
and d.#{key} like concat('%',#{value},'%') and d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldCodes[key] == 'eq' and value !=null and value !=''"> <when test="fieldCodes[key] == 'eq' and value !=null and value !=''">
and d.#{key} = #{value} and d.${key} = #{value}
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -335,7 +335,7 @@ ...@@ -335,7 +335,7 @@
<foreach collection="fieldCodes" item="value" index="key" > <foreach collection="fieldCodes" item="value" index="key" >
,MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as #{key}, ,MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as #{key},
IF(FIND_IN_SET(i.field_type,'radio,select,treeSelect'), MAX(CASE WHEN i.FIELD_CODE = #{key} THEN IF(FIND_IN_SET(i.field_type,'radio,select,treeSelect'), MAX(CASE WHEN i.FIELD_CODE = #{key} THEN
i.FIELD_VALUE_LABEL END), null) as #{key}Label i.FIELD_VALUE_LABEL END), null) as ${key}Label
</foreach> </foreach>
from from
cb_dynamic_form_instance i cb_dynamic_form_instance i
...@@ -361,16 +361,16 @@ ...@@ -361,16 +361,16 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldCodes[key] == 'like' and value !=null and value !=''"> <when test="fieldCodes[key] == 'like' and value !=null and value !=''">
and d.#{key} like concat('%',#{value},'%') and d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldCodes[key] == 'eq' and value !=null and value !=''"> <when test="fieldCodes[key] == 'eq' and value !=null and value !=''">
and d.#{key} = #{value} and d.${key} = #{value}
</when> </when>
<when test="fieldCodes[key] == 'ge' and value !=null and value !=''"> <when test="fieldCodes[key] == 'ge' and value !=null and value !=''">
and d.#{key} >= #{value} and d.${key} >= #{value}
</when> </when>
<when test="fieldCodes[key] == 'le' and value !=null and value !=''"> <when test="fieldCodes[key] == 'le' and value !=null and value !=''">
and d.#{key} <![CDATA[<=]]> #{value} and d.${key} <![CDATA[<=]]> #{value}
</when> </when>
</choose> </choose>
</foreach> </foreach>
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
<foreach collection="map.fieldsValue.keys" item="item"> <foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'"> <if test="item != 'bizOrgName'">
AND a.#{item} = #{map.fieldsValue[#{item}]} AND a.${item} = #{map.fieldsValue[#{item}]}
</if> </if>
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
<if test="map.fieldsValue != null"> <if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item"> <foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'"> <if test="item != 'bizOrgName'">
AND a.#{item} = #{map.fieldsValue[#{item}]} AND a.${item} = #{map.fieldsValue[#{item}]}
</if> </if>
</foreach> </foreach>
</if> </if>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
u.biz_org_code bizOrgCode, u.biz_org_code bizOrgCode,
<if test="fields != null"> <if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then IFNULL(v.field_value_label, v.field_value) <foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then IFNULL(v.field_value_label, v.field_value)
end) #{item} end) ${item}
</foreach> </foreach>
</if> </if>
FROM FROM
......
...@@ -28,11 +28,9 @@ import org.slf4j.Logger; ...@@ -28,11 +28,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import java.io.BufferedReader; import java.io.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
...@@ -407,31 +405,33 @@ public class HttpContentTypeUtil { ...@@ -407,31 +405,33 @@ public class HttpContentTypeUtil {
/** /**
* 发送 delete请求带请求头 * 发送 delete请求带请求头
*/ */
public static String sendHttpDeleteJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) { public static String sendHttpDeleteJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) throws IOException {
StringBuffer content = new StringBuffer(); StringBuffer content = new StringBuffer();
try { URL url = new URL(httpUrl);
URL url = new URL(httpUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("DELETE");
connection.setRequestMethod("DELETE"); connection.setDoInput(true);
connection.setDoInput(true); connection.setDoOutput(true);
connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); for (Map.Entry<String, String> entry : headerMap.entrySet()) {
for (Map.Entry<String, String> entry : headerMap.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue());
connection.setRequestProperty(entry.getKey(), entry.getValue()); }
} try (
PrintWriter printWriter = new PrintWriter(connection.getOutputStream()); PrintWriter printWriter = new PrintWriter(connection.getOutputStream());
InputStream inputStream = connection.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader br = new BufferedReader(inputStreamReader);
) {
printWriter.write(paramsJson); printWriter.write(paramsJson);
printWriter.flush(); printWriter.flush();
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
content.append(line); content.append(line);
} }
br.close();
connection.disconnect(); connection.disconnect();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
return content.toString(); return content.toString();
} }
......
...@@ -21,6 +21,7 @@ import org.apache.http.impl.client.CloseableHttpClient; ...@@ -21,6 +21,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -29,8 +30,6 @@ import org.springframework.util.Assert; ...@@ -29,8 +30,6 @@ import org.springframework.util.Assert;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
...@@ -333,7 +332,7 @@ public class HttpUtil { ...@@ -333,7 +332,7 @@ public class HttpUtil {
* @param encoding * @param encoding
* @return * @return
*/ */
public static String postSSLUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, KeyManagementException, NoSuchAlgorithmException { public static String postSSLUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
String result; String result;
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
...@@ -385,23 +384,9 @@ public class HttpUtil { ...@@ -385,23 +384,9 @@ public class HttpUtil {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws KeyManagementException * @throws KeyManagementException
*/ */
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException { public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
SSLContext sc = SSLContext.getInstance("SSLv3"); // 信任所有证书
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法 return new SSLContextBuilder().loadTrustMaterial(null, (TrustStrategy) (arg0, arg1) -> true).build();
X509TrustManager trustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
};
sc.init(null, new TrustManager[]{trustManager}, new java.security.SecureRandom());
return sc;
} }
} }
...@@ -20,6 +20,7 @@ import org.apache.http.impl.client.CloseableHttpClient; ...@@ -20,6 +20,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.SSLContexts;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -349,8 +350,7 @@ public class HttpUtils { ...@@ -349,8 +350,7 @@ public class HttpUtils {
* @param encoding * @param encoding
* @return * @return
*/ */
public static ResponeVo postSSLUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, KeyManagementException, NoSuchAlgorithmException { public static ResponeVo postSSLUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
String result;
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
ResponeVo responeVo = null; ResponeVo responeVo = null;
...@@ -414,25 +414,9 @@ public class HttpUtils { ...@@ -414,25 +414,9 @@ public class HttpUtils {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws KeyManagementException * @throws KeyManagementException
*/ */
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException { public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
SSLContext sc = SSLContext.getInstance("SSLv3"); // 信任所有证书
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法 return new SSLContextBuilder().loadTrustMaterial(null, (TrustStrategy) (arg0, arg1) -> true).build();
X509TrustManager trustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
};
sc.init(null, new TrustManager[]{trustManager}, new java.security.SecureRandom());
return sc;
} }
......
...@@ -139,72 +139,6 @@ public class IpUtils { ...@@ -139,72 +139,6 @@ public class IpUtils {
return start <= end; return start <= end;
} }
public static List<String> getLocalIps() throws SocketException {
List<String> ips = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
ips.add(inetAddress.getHostAddress());
}
}
}
return ips;
}
/**
* 获取所有网卡,注意或过滤掉回路地址、链接地址\ipv6
* @return 网卡列表
* @throws SocketException 异常
*/
public static List<InetAddress> getLocalHostLANAddress() throws SocketException {
List<InetAddress> addresses = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
//非链接和回路真实ip
if(inetAddress.getHostAddress().contains(":")) {
//过滤ipv6
continue;
}
addresses.add(inetAddress);
}
}
}
return addresses;
}
public static InetAddress getInetAddress(String ip) throws SocketException {
validateIp(ip);
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if(inetAddress.getHostAddress().contains(ip)) {
return inetAddress;
}
}
}
throw new IllegalArgumentException("ip invalid, ip = " + ip);
}
public static String getMACAddress(InetAddress ia) throws SocketException { public static String getMACAddress(InetAddress ia) throws SocketException {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。 // 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress(); byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
...@@ -229,25 +163,5 @@ public class IpUtils { ...@@ -229,25 +163,5 @@ public class IpUtils {
} }
return macs; return macs;
} }
public static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements();) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements();) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
} }
...@@ -41,19 +41,13 @@ public class MyImageExtractor implements IImageExtractor { ...@@ -41,19 +41,13 @@ public class MyImageExtractor implements IImageExtractor {
imagePath = s1 + pre + s2; imagePath = s1 + pre + s2;
File imageFile = new File(baseDir, imagePath); File imageFile = new File(baseDir, imagePath);
imageFile.getParentFile().mkdirs(); imageFile.getParentFile().mkdirs();
InputStream in = null; try (
OutputStream out = null; InputStream in = new ByteArrayInputStream(imageData);
try { OutputStream out = new FileOutputStream(imageFile);
in = new ByteArrayInputStream(imageData); ) {
out = new FileOutputStream(imageFile);
IOUtils.copy(in, out); IOUtils.copy(in, out);
} finally { } catch (IOException e) {
if (in != null) { e.printStackTrace();
IOUtils.closeQuietly(in);
}
if (out != null) {
IOUtils.closeQuietly(out);
}
} }
} }
......
...@@ -5,11 +5,8 @@ import com.yeejoin.amos.boot.biz.common.utils.SecureRandomUtil; ...@@ -5,11 +5,8 @@ import com.yeejoin.amos.boot.biz.common.utils.SecureRandomUtil;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public class RandomUtil { public class RandomUtil {
private static ThreadLocalRandom threadLocalRandom;
public static String buildOrderNo() { public static String buildOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
...@@ -33,14 +30,12 @@ public class RandomUtil { ...@@ -33,14 +30,12 @@ public class RandomUtil {
* @Date 2020/12/18 11:49 * @Date 2020/12/18 11:49
*/ */
public static String buildNo(String resourceType, String companyCode) { public static String buildNo(String resourceType, String companyCode) {
threadLocalRandom = ThreadLocalRandom.current(); int intSecureRandom = SecureRandomUtil.getIntSecureRandom(9999 - 1000) + 1000;
int num = threadLocalRandom.nextInt(1000, 9999); return resourceType + companyCode + intSecureRandom;
return resourceType + companyCode + num;
} }
public static String buildNo() { public static String buildNo() {
threadLocalRandom = ThreadLocalRandom.current(); int num = SecureRandomUtil.getIntSecureRandom(9999 - 1000) + 1000;
int num = threadLocalRandom.nextInt(1000, 9999);
return String.valueOf(num); return String.valueOf(num);
} }
} }
...@@ -67,9 +67,8 @@ public class TikaUtils { ...@@ -67,9 +67,8 @@ public class TikaUtils {
ContentHandler handler = new ToHTMLContentHandler(); ContentHandler handler = new ToHTMLContentHandler();
AutoDetectParser parser = new AutoDetectParser(); AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata(); Metadata metadata = new Metadata();
InputStream stream = null; try (InputStream stream = new FileInputStream(new File(fileName));) {
try {
stream = new FileInputStream(new File(fileName));
parser.parse(stream, handler, metadata); parser.parse(stream, handler, metadata);
FileHelper.writeFile(handler.toString(), outPutFile + ".html"); FileHelper.writeFile(handler.toString(), outPutFile + ".html");
...@@ -78,8 +77,6 @@ public class TikaUtils { ...@@ -78,8 +77,6 @@ public class TikaUtils {
return null; return null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
} }
return ""; return "";
......
...@@ -78,7 +78,10 @@ public class WordConverterUtils { ...@@ -78,7 +78,10 @@ public class WordConverterUtils {
* @param readUrl html中img标签的图片存储路径 * @param readUrl html中img标签的图片存储路径
*/ */
private static void docToHtml(File srcFile, File targetFile, String readUrl) { private static void docToHtml(File srcFile, File targetFile, String readUrl) {
try { try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath; String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr); File imagePath = new File(imagePathStr);
if (!imagePath.exists()) { if (!imagePath.exists()) {
...@@ -86,13 +89,12 @@ public class WordConverterUtils { ...@@ -86,13 +89,12 @@ public class WordConverterUtils {
} }
String srcName = srcFile.getName(); String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_"; String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> { wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try { try (FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);) {
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
out.write(content); out.write(content);
return uri + suffix + name; return uri + suffix + name;
} catch (Exception e) { } catch (Exception e) {
...@@ -124,7 +126,10 @@ public class WordConverterUtils { ...@@ -124,7 +126,10 @@ public class WordConverterUtils {
* @return * @return
*/ */
private static String docToHtmlString(File srcFile, String readUrl) { private static String docToHtmlString(File srcFile, String readUrl) {
try { try (
FileInputStream inputStream = new FileInputStream(srcFile);
HWPFDocument wordDocument = new HWPFDocument(inputStream);
) {
String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath; String imagePathStr = srcFile.getParentFile().getAbsolutePath() + imgPath;
File imagePath = new File(imagePathStr); File imagePath = new File(imagePathStr);
if (!imagePath.exists()) { if (!imagePath.exists()) {
...@@ -132,13 +137,12 @@ public class WordConverterUtils { ...@@ -132,13 +137,12 @@ public class WordConverterUtils {
} }
String srcName = srcFile.getName(); String srcName = srcFile.getName();
String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_"; String suffix = srcName.substring(0, srcName.lastIndexOf(".")) + "_";
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(srcFile));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> { wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try { try (FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);) {
FileOutputStream out = new FileOutputStream(imagePathStr + suffix + name);
out.write(content); out.write(content);
return uri + suffix + name; return uri + suffix + name;
} catch (Exception e) { } catch (Exception e) {
...@@ -183,30 +187,22 @@ public class WordConverterUtils { ...@@ -183,30 +187,22 @@ public class WordConverterUtils {
} }
String temp = srcFile.getName(); String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_"; String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null; try (
try { FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile)); XWPFDocument document = new XWPFDocument(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "utf-8");
) {
XHTMLOptions options = XHTMLOptions.create(); XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix)); options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
System.out.println("uri :" + uri); System.out.println("uri :" + uri);
options.URIResolver(new MyURIResolver(uri)); options.URIResolver(new MyURIResolver(uri));
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(targetFile), "utf-8");
XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance(); XHTMLConverter xhtmlConverter = (XHTMLConverter) XHTMLConverter.getInstance();
xhtmlConverter.convert(document, outputStreamWriter, options); xhtmlConverter.convert(document, outputStreamWriter, options);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
} }
} }
/** /**
...@@ -223,9 +219,11 @@ public class WordConverterUtils { ...@@ -223,9 +219,11 @@ public class WordConverterUtils {
} }
String temp = srcFile.getName(); String temp = srcFile.getName();
String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_"; String suffix = temp.substring(0, temp.lastIndexOf(".")) + "_";
OutputStreamWriter outputStreamWriter = null; try (
try { FileInputStream inputStream = new FileInputStream(srcFile);
XWPFDocument document = new XWPFDocument(new FileInputStream(srcFile)); XWPFDocument document = new XWPFDocument(inputStream);
) {
XHTMLOptions options = XHTMLOptions.create(); XHTMLOptions options = XHTMLOptions.create();
options.setExtractor(new MyImageExtractor(imagePath, suffix)); options.setExtractor(new MyImageExtractor(imagePath, suffix));
String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs")); String uri = readUrl + imagePathStr.substring(imagePathStr.indexOf("docs"));
...@@ -237,15 +235,6 @@ public class WordConverterUtils { ...@@ -237,15 +235,6 @@ public class WordConverterUtils {
return stringWriter.toString(); return stringWriter.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
} }
return null; return null;
......
...@@ -89,27 +89,16 @@ public class WordTemplateUtils { ...@@ -89,27 +89,16 @@ public class WordTemplateUtils {
public File getWordFileItem(Map map, String title, String ftlFile) throws IOException { public File getWordFileItem(Map map, String title, String ftlFile) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl"); configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8"); Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null; // 调用工具类的createDoc方法生成Word文档
File file = createDoc(map, freemarkerTemplate);
File filepdf = new File("sellPlan.pdf"); File filepdf = new File("sellPlan.pdf");
InputStream fin = null; try (
OutputStream os = null; InputStream fin =new FileInputStream(file) ;
try { OutputStream os = new FileOutputStream(filepdf);
// 调用工具类的createDoc方法生成Word文档 )
file = createDoc(map, freemarkerTemplate); {
fin = new FileInputStream(file);
os = new FileOutputStream(filepdf);
wordTopdfByAspose(fin, os); wordTopdfByAspose(fin, os);
return filepdf; return filepdf;
} finally {
if (fin != null) {
fin.close();
}
if (os != null) {
os.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
} }
} }
......
...@@ -51,17 +51,25 @@ public class IOConfig { ...@@ -51,17 +51,25 @@ public class IOConfig {
tmp2.put("lower-greek", 1L); tmp2.put("lower-greek", 1L);
ILV1_MAP = Collections.unmodifiableMap(tmp2); ILV1_MAP = Collections.unmodifiableMap(tmp2);
NumberingDefinitionsPart numberingDefinitionsPart = null; NumberingDefinitionsPart numberingDefinitionsPart = null;
try { try (
numberingDefinitionsPart = new NumberingDefinitionsPart(); InputStream is = IOConfig.class.getClassLoader().getResourceAsStream("office/listStyle.xml");
InputStream is = IOConfig.class.getClassLoader().getResourceAsStream("office/listStyle.xml"); ) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); assert is != null;
StringBuilder builder = new StringBuilder(); try (InputStreamReader inputStreamReader = new InputStreamReader(is, "UTF-8");
String str; BufferedReader reader = new BufferedReader(inputStreamReader);
while ((str = reader.readLine()) != null) { ) {
builder.append(str); numberingDefinitionsPart = new NumberingDefinitionsPart();
StringBuilder builder = new StringBuilder();
String str;
while ((str = reader.readLine()) != null) {
builder.append(str);
}
Numbering numbering = (Numbering) XmlUtils.unmarshalString(builder.toString());
numberingDefinitionsPart.setJaxbElement(numbering);
} catch (Exception e) {
e.printStackTrace();
} }
Numbering numbering = (Numbering) XmlUtils.unmarshalString(builder.toString());
numberingDefinitionsPart.setJaxbElement(numbering);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -495,6 +495,7 @@ public class DocxBuilder { ...@@ -495,6 +495,7 @@ public class DocxBuilder {
*/ */
private static byte[] getRemotePic2Bytes(String picUrl) { private static byte[] getRemotePic2Bytes(String picUrl) {
byte[] picBytes = {}; byte[] picBytes = {};
InputStream is = null;
try { try {
if (picUrl.startsWith(IOConfig.PIC_ROUTER)) { if (picUrl.startsWith(IOConfig.PIC_ROUTER)) {
picUrl = picUrl.replaceFirst(IOConfig.PIC_ROUTER, IOConfig.PIC_URI); picUrl = picUrl.replaceFirst(IOConfig.PIC_ROUTER, IOConfig.PIC_URI);
...@@ -504,7 +505,7 @@ public class DocxBuilder { ...@@ -504,7 +505,7 @@ public class DocxBuilder {
// 设置请求超时为5s // 设置请求超时为5s
con.setConnectTimeout(5 * 1000); con.setConnectTimeout(5 * 1000);
// 输入流 // 输入流
InputStream is = con.getInputStream(); is = con.getInputStream();
// 1K的数据缓冲 // 1K的数据缓冲
byte[] current = new byte[1024]; byte[] current = new byte[1024];
// 读取到的数据长度 // 读取到的数据长度
...@@ -513,9 +514,16 @@ public class DocxBuilder { ...@@ -513,9 +514,16 @@ public class DocxBuilder {
picBytes = Arrays.copyOf(picBytes, picBytes.length + len); picBytes = Arrays.copyOf(picBytes, picBytes.length + len);
System.arraycopy(current, 0, picBytes, picBytes.length - len, len); System.arraycopy(current, 0, picBytes, picBytes.length - len, len);
} }
is.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
try {
if (null != is) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
return picBytes; return picBytes;
} }
......
...@@ -21,6 +21,7 @@ import org.apache.http.impl.client.CloseableHttpClient; ...@@ -21,6 +21,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -29,8 +30,6 @@ import org.springframework.util.Assert; ...@@ -29,8 +30,6 @@ import org.springframework.util.Assert;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
...@@ -337,7 +336,7 @@ public class HttpUtil { ...@@ -337,7 +336,7 @@ public class HttpUtil {
* @return * @return
*/ */
public static String postSslUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, public static String postSslUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException,
KeyManagementException, NoSuchAlgorithmException { NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
String result; String result;
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
...@@ -389,24 +388,8 @@ public class HttpUtil { ...@@ -389,24 +388,8 @@ public class HttpUtil {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws KeyManagementException * @throws KeyManagementException
*/ */
public static SSLContext createIgnoreVerifySsl() throws NoSuchAlgorithmException, KeyManagementException { public static SSLContext createIgnoreVerifySsl() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
SSLContext sc = SSLContext.getInstance("SSLv3"); // 信任所有证书
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法 return new SSLContextBuilder().loadTrustMaterial(null, (TrustStrategy) (arg0, arg1) -> true).build();
X509TrustManager trustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
};
sc.init(null, new TrustManager[]{trustManager}, new java.security.SecureRandom());
return sc;
} }
} }
...@@ -20,6 +20,7 @@ import org.apache.http.impl.client.CloseableHttpClient; ...@@ -20,6 +20,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts; import org.apache.http.ssl.SSLContexts;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -286,8 +287,7 @@ public class HttpUtils { ...@@ -286,8 +287,7 @@ public class HttpUtils {
* @return * @return
*/ */
public static ResponeVo postSslUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException, public static ResponeVo postSslUrl(String url, Map<String, Object> reqMap, String encoding) throws IOException,
KeyManagementException, NoSuchAlgorithmException { KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
String result;
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
ResponeVo responeVo = null; ResponeVo responeVo = null;
...@@ -351,25 +351,9 @@ public class HttpUtils { ...@@ -351,25 +351,9 @@ public class HttpUtils {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws KeyManagementException * @throws KeyManagementException
*/ */
public static SSLContext createIgnoreVerifySsl() throws NoSuchAlgorithmException, KeyManagementException { public static SSLContext createIgnoreVerifySsl() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
SSLContext sc = SSLContext.getInstance("SSLv3"); // 信任所有证书
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法 return new SSLContextBuilder().loadTrustMaterial(null, (TrustStrategy) (arg0, arg1) -> true).build();
X509TrustManager trustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] paramArrayOfX509Certificate, String paramString) {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
};
sc.init(null, new TrustManager[]{trustManager}, new java.security.SecureRandom());
return sc;
} }
private static String inputStreamToString(InputStream is) { private static String inputStreamToString(InputStream is) {
......
...@@ -137,73 +137,6 @@ public class IpUtils { ...@@ -137,73 +137,6 @@ public class IpUtils {
return start <= end; return start <= end;
} }
public static List<String> getLocalIps() throws SocketException {
List<String> ips = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
ips.add(inetAddress.getHostAddress());
}
}
}
return ips;
}
/**
* 获取所有网卡,注意或过滤掉回路地址、链接地址\ipv6
*
* @return 网卡列表
* @throws SocketException 异常
*/
public static List<InetAddress> getLocalHostLanAddress() throws SocketException {
List<InetAddress> addresses = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
//非链接和回路真实ip
if (inetAddress.getHostAddress().contains(":")) {
//过滤ipv6
continue;
}
addresses.add(inetAddress);
}
}
}
return addresses;
}
public static InetAddress getInetAddress(String ip) throws SocketException {
validateIp(ip);
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.getHostAddress().contains(ip)) {
return inetAddress;
}
}
}
throw new IllegalArgumentException("ip invalid, ip = " + ip);
}
public static String getMacAddress(InetAddress ia) throws SocketException { public static String getMacAddress(InetAddress ia) throws SocketException {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。 // 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress(); byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
......
...@@ -651,12 +651,12 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -651,12 +651,12 @@ public class EquipmentDetailController extends AbstractBaseController {
// List<EquipmentDetailDownloadTemplateVO> equipmentDetailDownloadS = ExcelUtils.importExcel(file, 1, 1, EquipmentDetailDownloadTemplateVO.class); // List<EquipmentDetailDownloadTemplateVO> equipmentDetailDownloadS = ExcelUtils.importExcel(file, 1, 1, EquipmentDetailDownloadTemplateVO.class);
String key=""; String stringUUid="";
try { try {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
key= uuid.toString(); stringUUid = uuid.toString();
ExcelEnums excelEnums = null; ExcelEnums excelEnums = null;
if (!enabled){ if (!enabled) {
excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZBSINGLE.getType()); excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZBSINGLE.getType());
}else { }else {
excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZB.getType()); excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZB.getType());
...@@ -664,14 +664,14 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -664,14 +664,14 @@ public class EquipmentDetailController extends AbstractBaseController {
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType()); ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
// date= excelService.commonUpload(file, excelDto, getSelectedOrgInfo(), getUserInfo()); // date= excelService.commonUpload(file, excelDto, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController controllerProxy1 = SpringUtils.getBean(EquipmentDetailController.class); EquipmentDetailController controllerProxy1 = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy1.commonUpload(file, excelDto,key, getSelectedOrgInfo(), getUserInfo()); controllerProxy1.commonUpload(file, excelDto, stringUUid, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class); EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy.refreshAllCount(); controllerProxy.refreshAllCount();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest(e.getMessage()); throw new BadRequest(e.getMessage());
} }
return ResponseHelper.buildResponse(key); return ResponseHelper.buildResponse(stringUUid);
} }
......
...@@ -272,17 +272,14 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe ...@@ -272,17 +272,14 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
@Override @Override
public void downLoad(FileUploadVo vo, HttpServletResponse response) { public void downLoad(FileUploadVo vo, HttpServletResponse response) {
String fileName = vo.getName() ; String fileName = vo.getName() ;
ServletOutputStream out;
response.setHeader("Content-Disposition", "attachment;fileName="+fileName); response.setHeader("Content-Disposition", "attachment;fileName="+fileName);
response.setHeader("Access-Control-Expose-Headers", "access_token"); response.setHeader("Access-Control-Expose-Headers", "access_token");
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
try { try (InputStream inputStream = getInputStreamFromURL(vo.getUrl());
InputStream inputStream = getInputStreamFromURL(vo.getUrl()); //3.通过response获取ServletOutputStream对象(out)
ServletOutputStream out = response.getOutputStream();
//3.通过response获取ServletOutputStream对象(out) ) {
out = response.getOutputStream();
int b = 0; int b = 0;
byte[] buffer = new byte[512]; byte[] buffer = new byte[512];
while (b != -1){ while (b != -1){
...@@ -290,10 +287,7 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe ...@@ -290,10 +287,7 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
//4.写到输出流(out)中 //4.写到输出流(out)中
out.write(buffer,0,b); out.write(buffer,0,b);
} }
inputStream.close();
out.close();
out.flush(); out.flush();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -618,27 +618,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -618,27 +618,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
return lists; return lists;
} }
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements(); ) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements(); ) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override @Override
public int getCountAlarmEquipment() { public int getCountAlarmEquipment() {
return equipmentSpecificAlarmMapper.getCountAlarmEquipment(); return equipmentSpecificAlarmMapper.getCountAlarmEquipment();
......
...@@ -1120,27 +1120,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1120,27 +1120,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType, createDate, type, equipmentId); return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType, createDate, type, equipmentId);
} }
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements(); ) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements(); ) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override @Override
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) { public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
......
...@@ -82,10 +82,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -82,10 +82,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Value("${equip.point.equipmentdata.url}") @Value("${equip.point.equipmentdata.url}")
private String equipmentdataUrl; private String equipmentdataUrl;
//
// @Value("${equip.point.statusApi.url}")
// private String statusApiUrl;
@Value("${mqtt.scene.host}") @Value("${mqtt.scene.host}")
private String sceneUrl; private String sceneUrl;
...@@ -243,12 +239,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -243,12 +239,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Override @Override
public List queryPartType() { public List queryPartType() {
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
String categoryUrl = url; String categoryUrl = url;
List<EquipmentCategory> list = iEquipmentCategoryService.list(); List<EquipmentCategory> list = iEquipmentCategoryService.list();
List<Map> returnList; List<Map> returnList;
...@@ -324,7 +314,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -324,7 +314,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
public List<PointTreeVo> getSystemmeanLsit() { public List<PointTreeVo> getSystemmeanLsit() {
return equipmentSpecificMapper.getSystemmeanLsit(); return equipmentSpecificMapper.getSystemmeanLsit();
} }
@Override @Override
public List<Map> getstatus(String sceneId) { public List<Map> getstatus(String sceneId) {
List<Map> data = new ArrayList<>(); List<Map> data = new ArrayList<>();
...@@ -334,7 +324,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -334,7 +324,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
}else{ }else{
equipIndexLatestStatus = equipmentSpecificMapper.getEquipLatestStatusBySceneId(sceneId); equipIndexLatestStatus = equipmentSpecificMapper.getEquipLatestStatusBySceneId(sceneId);
} }
equipIndexLatestStatus.forEach(action->{ equipIndexLatestStatus.forEach(action->{
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("equipCode", action.getQrCode()); map.put("equipCode", action.getQrCode());
...@@ -351,59 +341,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -351,59 +341,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
return data; return data;
} }
private String getStatusByQrCode(String qrCode) {
List<EquipmentSpecificIndex> equipMentStatus = equipmentSpecificMapper.getEquipMentStatus(qrCode);
if (equipMentStatus == null || equipMentStatus.size() == 0) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
// 组态图用
LinkedHashMap<String, String> map = equipMentStatus.stream().collect(LinkedHashMap::new, (n, v) -> n.put(v.getType(), v.getValue()), LinkedHashMap::putAll);
List<String> list = new ArrayList<>(map.keySet());
boolean flag = false;
if (0 < list.size()) {
for (String s : list) {
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.HZGJ.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
if (EquipmentRiskTypeEnum.GZ.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.GZ.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
if (EquipmentRiskTypeEnum.PB.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.PB.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
// 如果是运行状态且值为false 或 所有指标都不存在返回挂起
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
}
}
}
if (flag) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
private Map<String, Object> getSystemEquList(Map<String, Object> res, String orgCode, Long id) { private Map<String, Object> getSystemEquList(Map<String, Object> res, String orgCode, Long id) {
List<PointTreeVo> list = equipmentSpecificMapper.getSystemEquList(orgCode, id); List<PointTreeVo> list = equipmentSpecificMapper.getSystemEquList(orgCode, id);
String firstCanvas = equipmentSpecificMapper.getFirstCanvas(orgCode); String firstCanvas = equipmentSpecificMapper.getFirstCanvas(orgCode);
...@@ -428,70 +365,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -428,70 +365,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
return res; return res;
} }
private List<RiskSourceTreeVO> getImportantEquipTree(List<RiskSourceTreeVO> list) {
List<RiskSourceTreeVO> treeList = new ArrayList<>();
for (RiskSourceTreeVO tree : list) {
if (tree.getParentId() != null && tree.getParentId() == 0) {
treeList.add(tree);
}
for (RiskSourceTreeVO treeNode : list) {
if (treeNode.getParentId().longValue() == tree.getId()) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
riskSourceTreeVOs = null;
for (RiskSourceTreeVO x : treeList) {
if (x.getChildren() != null) {
for (RiskSourceTreeVO y : x.getChildren()) {
if (y.getChildren() != null) {
for (RiskSourceTreeVO z : y.getChildren()) {
if (z.getChildren() != null) {
for (RiskSourceTreeVO m : z.getChildren()) {
List<RiskSourceTreeVO> list1 = this.baseMapper.getImportantEquip(m.getId());
List<RiskSourceTreeVO> mapperImportantEquips = this.baseMapper.getImportantEquip(m.getId());
if (mapperImportantEquips.size() > 0) {
m.getChildren().addAll(mapperImportantEquips);
}
if (riskSourceTreeVOs == null && list1.size() > 0) {
riskSourceTreeVOs = list1;
}
if (list1.size() > 0 && riskSourceTreeVOs.size() < 4) {
riskSourceTreeVOs.addAll(list1);
}
}
List<RiskSourceTreeVO> mapperImportantEquips2 = this.baseMapper.getImportantEquip(z.getId());
if (mapperImportantEquips2.size() > 0) {
z.getChildren().addAll(mapperImportantEquips2);
}
}
}
}
List<RiskSourceTreeVO> mapperImportantEquips3 = this.baseMapper.getImportantEquip(y.getId());
if (mapperImportantEquips3.size() > 0) {
if (CollectionUtils.isEmpty(y.getChildren())) {
y.setChildren(new ArrayList<>());
}
y.getChildren().addAll(mapperImportantEquips3);
}
}
}
List<RiskSourceTreeVO> mapperImportantEquips4 = this.baseMapper.getImportantEquip(x.getId());
if (mapperImportantEquips4.size() > 0) {
x.getChildren().addAll(mapperImportantEquips4);
}
}
return treeList;
}
// @Override
// public String saveMorphic(PointTreeVo PointTreeVo) {
// RiskSourceScene risk = new RiskSourceScene();
// return null;
// }
private List<RiskSourceTreeVO> getRiskSourcesTree(List<RiskSourceTreeVO> list) { private List<RiskSourceTreeVO> getRiskSourcesTree(List<RiskSourceTreeVO> list) {
List<RiskSourceTreeVO> treeList = new ArrayList<>(); List<RiskSourceTreeVO> treeList = new ArrayList<>();
for (RiskSourceTreeVO tree : list) { for (RiskSourceTreeVO tree : list) {
......
...@@ -41,7 +41,9 @@ public class ExcelUtil { ...@@ -41,7 +41,9 @@ public class ExcelUtil {
Class<?> model, String token, String appKey, String product, boolean flag) { Class<?> model, String token, String appKey, String product, boolean flag) {
HorizontalCellStyleStrategy horizontalCellStyleStrategy = setMyCellStyle(); HorizontalCellStyleStrategy horizontalCellStyleStrategy = setMyCellStyle();
try { try (
OutputStream outputStream = getOutputStream(fileName, response, ExcelTypeEnum.XLSX);
) {
//下拉列表集合 //下拉列表集合
Map<Integer, String[]> explicitListConstraintMap = new HashMap<>(); Map<Integer, String[]> explicitListConstraintMap = new HashMap<>();
if (flag) { if (flag) {
...@@ -54,7 +56,7 @@ public class ExcelUtil { ...@@ -54,7 +56,7 @@ public class ExcelUtil {
resolveExplicitConstraint(explicitListConstraintMap, explicitConstraint,token,appKey,product); resolveExplicitConstraint(explicitListConstraintMap, explicitConstraint,token,appKey,product);
} }
} }
EasyExcel.write(getOutputStream(fileName, response, ExcelTypeEnum.XLSX), model) EasyExcel.write(outputStream, model)
.excelType(ExcelTypeEnum.XLSX).sheet(sheetName) .excelType(ExcelTypeEnum.XLSX).sheet(sheetName)
.registerWriteHandler(new TemplateCellWriteHandlerDate(explicitListConstraintMap)) .registerWriteHandler(new TemplateCellWriteHandlerDate(explicitListConstraintMap))
.registerWriteHandler(new TemplateCellWriteHandler()) .registerWriteHandler(new TemplateCellWriteHandler())
......
...@@ -434,62 +434,50 @@ public class FileHelper { ...@@ -434,62 +434,50 @@ public class FileHelper {
} }
public static void nioTransferCopy(File source, File target) { public static void nioTransferCopy(File source, File target) {
FileChannel in = null; try (
FileChannel out = null; FileInputStream inStream = new FileInputStream(source);
FileInputStream inStream = null; FileOutputStream outStream = new FileOutputStream(target);
FileOutputStream outStream = null; FileChannel in = inStream.getChannel();
try { FileChannel out = outStream.getChannel();
inStream = new FileInputStream(source); ) {
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
} }
private static boolean nioBufferCopy(File source, File target) { private static boolean nioBufferCopy(File source, File target) {
FileChannel in = null;
FileChannel out = null; try (
FileInputStream inStream = null; FileInputStream inStream = new FileInputStream(source);
FileOutputStream outStream = null; FileOutputStream outStream = new FileOutputStream(target);
try { FileChannel in = inStream.getChannel();
inStream = new FileInputStream(source); FileChannel out = outStream.getChannel();
outStream = new FileOutputStream(target); ) {
in = inStream.getChannel();
out = outStream.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(4096); ByteBuffer buffer = ByteBuffer.allocate(4096);
while (in.read(buffer) != -1) { while (in.read(buffer) != -1) {
buffer.flip(); buffer.flip();
out.write(buffer); out.write(buffer);
buffer.clear(); buffer.clear();
} }
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
return true; return true;
} }
public static void customBufferStreamCopy(File source, File target) { public static void customBufferStreamCopy(File source, File target) {
InputStream fis = null; try (
OutputStream fos = null; InputStream fis = new FileInputStream(source);
try { OutputStream fos = new FileOutputStream(target);
fis = new FileInputStream(source); ) {
fos = new FileOutputStream(target);
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int i; int i;
while ((i = fis.read(buf)) != -1) { while ((i = fis.read(buf)) != -1) {
...@@ -497,9 +485,6 @@ public class FileHelper { ...@@ -497,9 +485,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(fis);
close(fos);
} }
} }
......
...@@ -42,7 +42,7 @@ public class SocketClient { ...@@ -42,7 +42,7 @@ public class SocketClient {
logger.error(logs); logger.error(logs);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), port)); datagramSocket.send(new DatagramPacket(b, b.length, port));
int deltaSleep = getSleepDelta(len, 16000); int deltaSleep = getSleepDelta(len, 16000);
Thread.sleep(deltaSleep); Thread.sleep(deltaSleep);
TimeUnit.MILLISECONDS.sleep(100); TimeUnit.MILLISECONDS.sleep(100);
...@@ -53,28 +53,5 @@ public class SocketClient { ...@@ -53,28 +53,5 @@ public class SocketClient {
} }
} }
@Async
public void processTcp(int port, int type) {
if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1;
try (Socket socket = new Socket();
FileInputStream fis = new FileInputStream(testFilePath[type]);) {
socket.connect(new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), port));
OutputStream outputStream = socket.getOutputStream();
byte[] b = new byte[4096];
int len;
while ((len = fis.read(b)) > 0) {
String logs = String.format("send data pack length: %s", len);
logger.error(logs);
outputStream.write(b);
TimeUnit.MILLISECONDS.sleep(200);
}
outputStream.flush();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} }
...@@ -102,7 +102,6 @@ public class RealTimeStream2Text { ...@@ -102,7 +102,6 @@ public class RealTimeStream2Text {
map.add("number", number); map.add("number", number);
map.add("codec", "PCM"); map.add("codec", "PCM");
map.add("uuid", UUID.randomUUID().toString()); map.add("uuid", UUID.randomUUID().toString());
//map.add("dstip", InetAddress.getLocalHost().getHostAddress());
map.add("dstip", localIpAddress); map.add("dstip", localIpAddress);
map.add("dstport", String.valueOf(port)); map.add("dstport", String.valueOf(port));
map.add("marker", "amos"); map.add("marker", "amos");
......
...@@ -5,8 +5,6 @@ import java.io.FileInputStream; ...@@ -5,8 +5,6 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.net.DatagramPacket; import java.net.DatagramPacket;
import java.net.DatagramSocket; import java.net.DatagramSocket;
import java.net.InetAddress;
import com.alibaba.nls.client.AccessToken; import com.alibaba.nls.client.AccessToken;
import com.alibaba.nls.client.protocol.InputFormatEnum; import com.alibaba.nls.client.protocol.InputFormatEnum;
...@@ -171,7 +169,7 @@ public class SpeechTranscriberDemo { ...@@ -171,7 +169,7 @@ public class SpeechTranscriberDemo {
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
// logger.info("send data pack length: " + len); // logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), 25000)); datagramSocket.send(new DatagramPacket(b, b.length, 25000));
transcriber.send(b, len); transcriber.send(b, len);
//本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。 //本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。
......
...@@ -503,13 +503,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -503,13 +503,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
...@@ -588,13 +584,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -588,13 +584,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey,
long checkId) { long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
...@@ -851,35 +851,33 @@ public class CheckController extends AbstractBaseController { ...@@ -851,35 +851,33 @@ public class CheckController extends AbstractBaseController {
} }
InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Source source = new StreamSource(inputStream); Source source = new StreamSource(inputStream);
try { String filePath = Objects.requireNonNull(this.getClass().getResource("/")).getPath() + "temp" + File.separator + "checkTemplate.xsl";
String filePath = Objects.requireNonNull(this.getClass().getResource("/")).getPath() + "temp" + File.separator + "checkTemplate.xsl"; if (Files.notExists(Paths.get(filePath))) {
if (Files.notExists(Paths.get(filePath))) { throw new RuntimeException("模板文件不存在");
throw new RuntimeException("模板文件不存在"); }
}
FileInputStream fis1 = new FileInputStream(FilenameUtils.normalize(filePath)); Date date = new Date();
String path = request.getSession().getServletContext().getRealPath("/");
String subPath = path.substring(0, path.indexOf(File.separator) + 1);
String dir = subPath + "check";
String html = subPath + "check" + File.separator + "task_"
+ date.getTime() + ".html";
File htmlFile = new File(html);
try (
FileInputStream fis1 = new FileInputStream(FilenameUtils.normalize(filePath));
FileInputStream fis = new FileInputStream(htmlFile);
) {
Source template = new StreamSource(fis1); Source template = new StreamSource(fis1);
Date date = new Date();
String path = request.getSession().getServletContext().getRealPath("/");
String subPath = path.substring(0, path.indexOf(File.separator) + 1);
String dir = subPath + "check";
String html = subPath + "check" + File.separator + "task_"
+ date.getTime() + ".html";
File dirFile = new File(dir); File dirFile = new File(dir);
if (!dirFile.exists()) { if (!dirFile.exists()) {
dirFile.mkdirs(); dirFile.mkdirs();
} }
Result result = new StreamResult(html); Result result = new StreamResult(html);
TransformerFactory transformerFactory = TransformerFactory.newInstance(); TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
Transformer transformer = transformerFactory.newTransformer(template); Transformer transformer = transformerFactory.newTransformer(template);
transformer.transform(source, result); transformer.transform(source, result);
File htmlFile = new File(html);
FileInputStream fis = new FileInputStream(htmlFile);
String data = IOUtils.toString(fis, StandardCharsets.UTF_8); String data = IOUtils.toString(fis, StandardCharsets.UTF_8);
fis.close();
if (htmlFile.exists()) { if (htmlFile.exists()) {
htmlFile.delete(); htmlFile.delete();
} }
......
...@@ -875,18 +875,13 @@ public class CheckServiceImpl implements ICheckService { ...@@ -875,18 +875,13 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> { pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData()); pointImgUrls.add(action.getPhotoData());
}); });
Check check = checkDao.findById(checkId).get(); Check check = checkDao.findById(checkId).get();
...@@ -961,18 +956,13 @@ public class CheckServiceImpl implements ICheckService { ...@@ -961,18 +956,13 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId) { public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> { pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData()); pointImgUrls.add(action.getPhotoData());
}); });
Check check = checkDao.findById(checkId).get(); Check check = checkDao.findById(checkId).get();
......
...@@ -164,7 +164,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -164,7 +164,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// private String photoUrlPre; // private String photoUrlPre;
// @Value("${file.url}") // @Value("${file.url}")
// private String fileUrl; // private String fileUrl;
@Value("${file.url}") @Value("${file.url}")
private String fileServerAddress; private String fileServerAddress;
...@@ -371,15 +371,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -371,15 +371,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}); });
} }
private String buildLocalHost() {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
return "http://" + ip + ":" + port + "/";
} catch (Exception e) {
return "";
}
}
private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) { private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId); map.put("riskFactorId", riskFactorId);
......
...@@ -2108,12 +2108,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -2108,12 +2108,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
public static byte[] file2byte(File file) { public static byte[] file2byte(File file) {
try { try (
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
) {
//当文件没有结束时,每次读取一个字节显示 //当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()]; byte[] data = new byte[in.available()];
in.read(data); in.read(data);
in.close();
return data; return data;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -475,37 +475,26 @@ public class FileHelper { ...@@ -475,37 +475,26 @@ public class FileHelper {
} }
public static void nioTransferCopy(File source, File target) { public static void nioTransferCopy(File source, File target) {
FileChannel in = null; try (
FileChannel out = null; FileInputStream inStream = new FileInputStream(source);
FileInputStream inStream = null; FileOutputStream outStream = new FileOutputStream(target);
FileOutputStream outStream = null; FileChannel in = inStream.getChannel();
try { FileChannel out = outStream.getChannel();
inStream = new FileInputStream(source); ) {
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
} }
private static boolean nioBufferCopy(File source, File target) { private static boolean nioBufferCopy(File source, File target) {
FileChannel in = null; try (
FileChannel out = null; FileInputStream inStream = new FileInputStream(source);
FileInputStream inStream = null; FileOutputStream outStream = new FileOutputStream(target);
FileOutputStream outStream = null; FileChannel in = inStream.getChannel();
try { FileChannel out = outStream.getChannel();
inStream = new FileInputStream(source); ) {
outStream = new FileOutputStream(target);
in = inStream.getChannel();
out = outStream.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(4096); ByteBuffer buffer = ByteBuffer.allocate(4096);
while (in.read(buffer) != -1) { while (in.read(buffer) != -1) {
buffer.flip(); buffer.flip();
...@@ -515,22 +504,16 @@ public class FileHelper { ...@@ -515,22 +504,16 @@ public class FileHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally {
close(inStream);
close(in);
close(outStream);
close(out);
} }
return true; return true;
} }
public static void customBufferStreamCopy(File source, File target) { public static void customBufferStreamCopy(File source, File target) {
InputStream fis = null; try (
OutputStream fos = null; InputStream fis = new FileInputStream(source);
try { OutputStream fos = new FileOutputStream(target);
fis = new FileInputStream(source); ) {
fos = new FileOutputStream(target);
byte[] buf = new byte[4096]; byte[] buf = new byte[4096];
int i; int i;
while ((i = fis.read(buf)) != -1) { while ((i = fis.read(buf)) != -1) {
...@@ -538,9 +521,6 @@ public class FileHelper { ...@@ -538,9 +521,6 @@ public class FileHelper {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
close(fis);
close(fos);
} }
} }
......
...@@ -18,11 +18,9 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; ...@@ -18,11 +18,9 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import java.io.BufferedReader; import java.io.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
...@@ -395,31 +393,32 @@ public class HttpUtil { ...@@ -395,31 +393,32 @@ public class HttpUtil {
/** /**
* 发送 delete请求带请求头 * 发送 delete请求带请求头
*/ */
public static String sendHttpDeleteJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) { public static String sendHttpDeleteJsonWithHeader(String httpUrl, String paramsJson, Map<String, String> headerMap) throws IOException {
StringBuffer content = new StringBuffer(); StringBuffer content = new StringBuffer();
try { URL url = new URL(httpUrl);
URL url = new URL(httpUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("DELETE");
connection.setRequestMethod("DELETE"); connection.setDoInput(true);
connection.setDoInput(true); connection.setDoOutput(true);
connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); for (Map.Entry<String, String> entry : headerMap.entrySet()) {
for (Map.Entry<String, String> entry : headerMap.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue());
connection.setRequestProperty(entry.getKey(), entry.getValue()); }
} try (
PrintWriter printWriter = new PrintWriter(connection.getOutputStream()); OutputStream outputStream = connection.getOutputStream();
InputStreamReader inputStreamReader = new InputStreamReader(connection.getInputStream());
BufferedReader br = new BufferedReader(inputStreamReader);
PrintWriter printWriter = new PrintWriter(outputStream);
) {
printWriter.write(paramsJson); printWriter.write(paramsJson);
printWriter.flush(); printWriter.flush();
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
content.append(line); content.append(line);
} }
br.close();
connection.disconnect(); connection.disconnect();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
return content.toString(); return content.toString();
} }
......
...@@ -83,8 +83,7 @@ public class WordHtml implements AbstractHtml { ...@@ -83,8 +83,7 @@ public class WordHtml implements AbstractHtml {
private static void convertDoc2Html(InputStream is, String outPutFile) private static void convertDoc2Html(InputStream is, String outPutFile)
throws TransformerException, IOException, ParserConfigurationException { throws TransformerException, IOException, ParserConfigurationException {
StreamResult streamResult = null; StreamResult streamResult = null;
ByteArrayOutputStream out = null; try (ByteArrayOutputStream out = new ByteArrayOutputStream();) {
try {
String[] outPutFiles = outPutFile.split("\\\\"); String[] outPutFiles = outPutFile.split("\\\\");
outPutFiles = outPutFiles[outPutFiles.length - 1].split("/"); outPutFiles = outPutFiles[outPutFiles.length - 1].split("/");
final String root = outPutFiles[outPutFiles.length - 1]; final String root = outPutFiles[outPutFiles.length - 1];
...@@ -106,19 +105,18 @@ public class WordHtml implements AbstractHtml { ...@@ -106,19 +105,18 @@ public class WordHtml implements AbstractHtml {
if (pics != null) { if (pics != null) {
for (int i = 0; i < pics.size(); i++) { for (int i = 0; i < pics.size(); i++) {
Picture pic = (Picture) pics.get(i); Picture pic = (Picture) pics.get(i);
try { try (
FileOutputStream fileOutputStream = new FileOutputStream(outPutFile + "/" + pic.suggestFullFileName());
) {
// 指定doc文档中转换后图片保存的路径 // 指定doc文档中转换后图片保存的路径
pic.writeImageContent( pic.writeImageContent(fileOutputStream);
new FileOutputStream(outPutFile + "/" + pic.suggestFullFileName()));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
// #end save pictures // #end save pictures
out = new ByteArrayOutputStream();
streamResult = new StreamResult(out); streamResult = new StreamResult(out);
TransformerFactory tf = TransformerFactory.newInstance(); TransformerFactory tf = TransformerFactory.newInstance();
tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
// 创建执行从 Source 到 Result 的复制的新 Transformer。 // 创建执行从 Source 到 Result 的复制的新 Transformer。
...@@ -134,10 +132,8 @@ public class WordHtml implements AbstractHtml { ...@@ -134,10 +132,8 @@ public class WordHtml implements AbstractHtml {
FileHelper.writeFile(content, outPutFile + ".html"); FileHelper.writeFile(content, outPutFile + ".html");
// FileHelper.parseCharset(outPutFile + ".html"); // FileHelper.parseCharset(outPutFile + ".html");
// System.out.println(new String(out.toByteArray())); // System.out.println(new String(out.toByteArray()));
} finally { } catch (IOException e) {
if (null != out) { e.printStackTrace();
out.close();
}
} }
} }
...@@ -216,24 +212,9 @@ public class WordHtml implements AbstractHtml { ...@@ -216,24 +212,9 @@ public class WordHtml implements AbstractHtml {
Transformer transformer= transformerFactory.newTransformer(template); Transformer transformer= transformerFactory.newTransformer(template);
//处理xml进行交换 //处理xml进行交换
transformer.transform(source, result); transformer.transform(source, result);
} catch (FileNotFoundException e) { } catch (TransformerException | IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
} finally {
//关闭文件流
try {
if(null != fis1){
fis1.close();
}
if(null != fis){
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
} }
......
...@@ -109,27 +109,15 @@ public class WordTemplateUtils { ...@@ -109,27 +109,15 @@ public class WordTemplateUtils {
public File getWordFileItem(Map map, String title, String ftlFile,String type) throws IOException { public File getWordFileItem(Map map, String title, String ftlFile,String type) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl"); configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8"); Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null; File file = createDoc(map, freemarkerTemplate);
File filepdf = new File("sellPlan.pdf"); File filepdf = new File("sellPlan.pdf");
InputStream fin = null; try (
OutputStream os = null; InputStream fin = new FileInputStream(file);
try { OutputStream os = new FileOutputStream(filepdf);
) {
// 调用工具类的createDoc方法生成Word文档 // 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
os = new FileOutputStream(filepdf);
wordTopdfByAspose(fin, os,type); wordTopdfByAspose(fin, os,type);
return filepdf; return filepdf;
} finally {
if (fin != null) {
fin.close();
}
if (os != null) {
os.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
} }
} }
...@@ -214,24 +202,17 @@ public class WordTemplateUtils { ...@@ -214,24 +202,17 @@ public class WordTemplateUtils {
if (!file.exists()) { if (!file.exists()) {
return ""; return "";
} }
InputStream in = null;
byte[] data = null; byte[] data = null;
try { try (InputStream in = new FileInputStream(file);) {
in = new FileInputStream(file); data = new byte[in.available()];
} catch (FileNotFoundException e1) { in.read(data);
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
} catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
try { return null;
if (null != in) {
data = new byte[in.available()];
in.read(data);
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
} }
} }
...@@ -272,13 +272,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -272,13 +272,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
...@@ -356,13 +352,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -356,13 +352,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
...@@ -343,15 +343,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -343,15 +343,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerMapper.updateCheckInputDangerState(id, code); latentDangerMapper.updateCheckInputDangerState(id, code);
} }
private String buildLocalHost() {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
return "http://" + ip + ":" + port + "/";
} catch (Exception e) {
return "";
}
}
private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) { private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId); map.put("riskFactorId", riskFactorId);
......
...@@ -42,13 +42,13 @@ public class AmoAVICApplication { ...@@ -42,13 +42,13 @@ public class AmoAVICApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoAVICApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoAVICApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -50,12 +50,12 @@ public class AmosCasApplication { ...@@ -50,12 +50,12 @@ public class AmosCasApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosCasApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosCasApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -40,13 +40,13 @@ public class AmoCCSApplication { ...@@ -40,13 +40,13 @@ public class AmoCCSApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -58,20 +58,18 @@ public class AmostEquipApplication { ...@@ -58,20 +58,18 @@ public class AmostEquipApplication {
@Autowired @Autowired
private CarIotNewListener carIotNewListener; private CarIotNewListener carIotNewListener;
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" Environment env = context.getEnvironment();
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port String appName = env.getProperty("spring.application.name");
+ path + "/doc.html\n" + "----------------------------------------------------------"); logger.info(
} "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
@Bean @Bean
@LoadBalanced @LoadBalanced
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldNames[key] == 'like' and value !=null and value !=''"> <when test="fieldNames[key] == 'like' and value !=null and value !=''">
and d.#{key} like concat('%',#{value},'%') and d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldNames[key] == 'eq' and value !=null and value !=''"> <when test="fieldNames[key] == 'eq' and value !=null and value !=''">
and d.#{key} = #{value} and d.${key} = #{value}
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -80,10 +80,10 @@ ...@@ -80,10 +80,10 @@
<foreach collection="params" index="key" item="value" separator=""> <foreach collection="params" index="key" item="value" separator="">
<choose> <choose>
<when test="fieldNames[key] == 'like' and value !=null and value !=''"> <when test="fieldNames[key] == 'like' and value !=null and value !=''">
AND d.#{key} like concat('%',#{value},'%') AND d.${key} like concat('%',#{value},'%')
</when> </when>
<when test="fieldNames[key] == 'eq' and value !=null and value !=''"> <when test="fieldNames[key] == 'eq' and value !=null and value !=''">
AND d.#{key} = #{value} AND d.${key} = #{value}
</when> </when>
</choose> </choose>
......
...@@ -34,7 +34,7 @@ import com.yeejoin.amos.fas.context.IotContext; ...@@ -34,7 +34,7 @@ import com.yeejoin.amos.fas.context.IotContext;
/** /**
* *
* <pre> * <pre>
* 服务启动类 * 服务启动类
* </pre> * </pre>
...@@ -70,15 +70,14 @@ public class FireAutoSysApplication implements ApplicationContextAware { ...@@ -70,15 +70,14 @@ public class FireAutoSysApplication implements ApplicationContextAware {
logger.info("start Service.........."); logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
/** /**
......
...@@ -50,17 +50,18 @@ public class AmosJcsApplication { ...@@ -50,17 +50,18 @@ public class AmosJcsApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09 delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
String logs=String.format("%n----------------------------------------------------------%n Application Amos-Biz-Boot is running! Access URLs:%n Swagger文档: http://%s:%s%s/doc.html%n----------------------------------------------------------",ip,port,path); + "----------------------------------------------------------\n"
logger.info( logs); , appName
);
} }
/** /**
* 清空redis缓存数据 * 清空redis缓存数据
* *
* @author 陈浩 * @author 陈浩
* @param env * @param env
* @param context * @param context
......
...@@ -42,13 +42,13 @@ public class AmoKGDApplication { ...@@ -42,13 +42,13 @@ public class AmoKGDApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoKGDApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoKGDApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -39,13 +39,12 @@ public class KnowledgebaseApplication { ...@@ -39,13 +39,12 @@ public class KnowledgebaseApplication {
ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args); ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
and dc.USER_ID = #{userId} and dc.USER_ID = #{userId}
</if> </if>
<if test="orgCode != null and orgCode !=''"> <if test="orgCode != null and orgCode !=''">
and dc.ORG_CODE like '%#{orgCode}%' and dc.ORG_CODE like CONCAT('%',#{orgCode},'%' )
</if> </if>
) )
UNION ALL UNION ALL
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
and dc.USER_ID = #{userId} and dc.USER_ID = #{userId}
</if> </if>
<if test="orgCode != null and orgCode !=''"> <if test="orgCode != null and orgCode !=''">
and dc.ORG_CODE like '%#{orgCode}%' and dc.ORG_CODE like CONCAT('%',#{orgCode},'%' )
</if> </if>
) )
)d LIMIT #{offset},#{length} )d LIMIT #{offset},#{length}
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
(SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID) directoryName, (SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID) directoryName,
<if test="extraFields != null and extraFields.size > 0"> <if test="extraFields != null and extraFields.size > 0">
<foreach collection="extraFields" item="_field" > <foreach collection="extraFields" item="_field" >
#{_field}, ${_field},
</foreach> </foreach>
</if> </if>
IFNULL(collectNum, 0) collectNum, IFNULL(quoteNum, 0) quoteNum, IFNULL(collect, "UNCOLLECT") collect IFNULL(collectNum, 0) collectNum, IFNULL(quoteNum, 0) quoteNum, IFNULL(collect, "UNCOLLECT") collect
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
ORG_CODE LIKE CONCAT(#{permissionFilters.orgCode}, "%") ORG_CODE LIKE CONCAT(#{permissionFilters.orgCode}, "%")
AND AUDIT_STATUS IN AND AUDIT_STATUS IN
<foreach collection="permissionFilters.auditStatusList" item="auditStatus" open="(" close=")" separator=", "> <foreach collection="permissionFilters.auditStatusList" item="auditStatus" open="(" close=")" separator=", ">
#{auditStatus} ${auditStatus}
</foreach> </foreach>
) )
</if> </if>
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
</if> </if>
<if test="extraStrFilters != null and extraStrFilters.size > 0"> <if test="extraStrFilters != null and extraStrFilters.size > 0">
<foreach collection="extraStrFilters" item="str"> <foreach collection="extraStrFilters" item="str">
AND #{str} AND ${str}
</foreach> </foreach>
</if> </if>
</where> </where>
......
...@@ -70,14 +70,13 @@ public class LatentDangerApplication { ...@@ -70,14 +70,13 @@ public class LatentDangerApplication {
logger.info("start Service.........."); logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
\ No newline at end of file
...@@ -69,14 +69,13 @@ public class MaintenanceApplication { ...@@ -69,14 +69,13 @@ public class MaintenanceApplication {
ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
......
...@@ -85,14 +85,13 @@ public class PatrolApplication { ...@@ -85,14 +85,13 @@ public class PatrolApplication {
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
/** /**
......
...@@ -258,8 +258,8 @@ ...@@ -258,8 +258,8 @@
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
And pp.org_code= #{orgCode} And pp.org_code= #{orgCode}
</if> </if>
AND d.create_date &gt;= '#{startDate}' AND d.create_date &gt;= #{startDate}
AND d.create_date &lt;= '#{endDate}' AND d.create_date &lt;= #{endDate}
<if test="planId != null and planId !=''" > <if test="planId != null and planId !=''" >
and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId}) and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId})
</if> </if>
...@@ -532,8 +532,8 @@ ...@@ -532,8 +532,8 @@
LEFT JOIN p_plan_task pt on pt.id = d.task_no LEFT JOIN p_plan_task pt on pt.id = d.task_no
LEFT JOIN p_plan pl on pt.plan_id=pl.id LEFT JOIN p_plan pl on pt.plan_id=pl.id
WHERE WHERE
d.create_date &gt;= '#{startDate}' d.create_date &gt;= #{startDate}
AND d.create_date &lt;= '#{endDate}' AND d.create_date &lt;= #{endDate}
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
And (pl.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pl.org_code= #{orgCode} ) And (pl.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pl.org_code= #{orgCode} )
</if> </if>
...@@ -812,8 +812,8 @@ ...@@ -812,8 +812,8 @@
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
And (pt.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pt.org_code= #{orgCode} ) And (pt.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pt.org_code= #{orgCode} )
</if> </if>
AND d.create_date &gt;= '#{startDate}' AND d.create_date &gt;= #{startDate}
AND d.create_date &lt;= '#{endDate}' AND d.create_date &lt;= #{endDate}
<if test="planId != null and planId !=''" > <if test="planId != null and planId !=''" >
and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId}) and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId})
</if> </if>
...@@ -1089,8 +1089,8 @@ ...@@ -1089,8 +1089,8 @@
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
And (pp.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pp.org_code= #{orgCode} ) And (pp.org_code LIKE CONCAT( #{orgCode}, '-%' ) or pp.org_code= #{orgCode} )
</if> </if>
AND d.create_date &gt;= '#{startDate}' AND d.create_date &gt;= #{startDate}
AND d.create_date &lt;= '#{endDate}' AND d.create_date &lt;= #{endDate}
<if test="planId != null and planId !=''" > <if test="planId != null and planId !=''" >
and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId}) and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId})
</if> </if>
...@@ -1366,8 +1366,8 @@ ...@@ -1366,8 +1366,8 @@
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
And pr.org_code= #{orgCode} And pr.org_code= #{orgCode}
</if> </if>
AND d.create_date &gt;= '#{startDate}' AND d.create_date &gt;= #{startDate}
AND d.create_date &lt;= '#{endDate}' AND d.create_date &lt;= #{endDate}
<if test="planId != null and planId !=''" > <if test="planId != null and planId !=''" >
and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId}) and EXISTS(select 1 from p_plan_task pt where pt.id = d.task_no and pt.plan_id = #{planId})
</if> </if>
...@@ -1683,8 +1683,8 @@ FROM ...@@ -1683,8 +1683,8 @@ FROM
p_plan_task pt p_plan_task pt
WHERE WHERE
pt.user_id >0 pt.user_id >0
AND pt.end_time BETWEEN '#{startTime}' AND pt.end_time BETWEEN #{startTime}
AND '#{endTime}' AND #{endTime}
<if test="summation == 'false'"> <if test="summation == 'false'">
GROUP BY GROUP BY
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('#{checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS(#{checkTime})</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('#{checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS(#{checkTime})</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if> <if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('#{checkTime}')</if> <if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS(#{checkTime})</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
and d.biz_org_code LIKE CONCAT(#{bizOrgCode},'%') and d.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if> </if>
</trim> </trim>
order by #{orderBy} order by ${orderBy}
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when> <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
...@@ -404,7 +404,7 @@ ...@@ -404,7 +404,7 @@
<if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('#{checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS(#{checkTime})</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -425,7 +425,7 @@ ...@@ -425,7 +425,7 @@
<if test="isExecute!=null and isExecute!='' and isExecute == '3'">and a.is_OK != #{isExecute}</if> <if test="isExecute!=null and isExecute!='' and isExecute == '3'">and a.is_OK != #{isExecute}</if>
</trim> </trim>
order by order by
#{orderBy} ${orderBy}
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset}, #{pageSize}</when> <when test="pageSize!=-1">limit #{offset}, #{pageSize}</when>
...@@ -476,7 +476,7 @@ ...@@ -476,7 +476,7 @@
and a.org_code LIKE CONCAT(#{bizOrgCode},'%') and a.org_code LIKE CONCAT(#{bizOrgCode},'%')
</if> </if>
</trim> </trim>
order by #{orderBy} order by ${orderBy}
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when> <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
) a ) a
<include refid="plan-task-app-where"/> <include refid="plan-task-app-where"/>
<if test="orderBy != null and orderBy != ''"> order by #{orderBy} </if> <if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
limit #{offset},#{pageSize} limit #{offset},#{pageSize}
</select> </select>
<select id="getPlanTasksCount" resultType="long"> <select id="getPlanTasksCount" resultType="long">
......
...@@ -75,14 +75,13 @@ public class SupervisionApplication { ...@@ -75,14 +75,13 @@ public class SupervisionApplication {
ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
@Bean @Bean
......
...@@ -50,12 +50,12 @@ public class AmosTdcApplication { ...@@ -50,12 +50,12 @@ public class AmosTdcApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosTdcApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosTdcApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -74,18 +74,17 @@ public class AmosTzsApplication { ...@@ -74,18 +74,17 @@ public class AmosTzsApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port"); String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
logger.info("\n----------------------------------------------------------\n\t" logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "Application Amos-Biz-Boot is running!\n\t"
+ path + "/doc.html\n" + "----------------------------------------------------------"); + "----------------------------------------------------------");
} }
/** /**
* 初始化MQTT * 初始化MQTT
* *
* @throws MqttException * @throws MqttException
*/ */
@Bean @Bean
......
...@@ -50,12 +50,12 @@ public class AmosUgpApplication { ...@@ -50,12 +50,12 @@ public class AmosUgpApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosUgpApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosUgpApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -40,14 +40,9 @@ public class JpushApplication { ...@@ -40,14 +40,9 @@ public class JpushApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args);
// GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); logger.info("\n----------------------------------------------------------\n\t"
String port = env.getProperty("server.port"); + "Application Amos-Biz-Boot is running!\n\t"
String path = env.getProperty("server.servlet.context-path"); + "----------------------------------------------------------");
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
} }
} }
\ No newline at end of file
...@@ -41,13 +41,13 @@ public class AmosBootUtilsMessageApplication { ...@@ -41,13 +41,13 @@ public class AmosBootUtilsMessageApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + + "Application {} is running!\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + + "----------------------------------------------------------\n"
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + , appName
"----------------------------------------------------------"); );
} }
} }
...@@ -36,16 +36,15 @@ import java.net.UnknownHostException; ...@@ -36,16 +36,15 @@ import java.net.UnknownHostException;
public class VideoApplication { public class VideoApplication {
private static final Logger logger = LoggerFactory.getLogger(VideoApplication.class); private static final Logger logger = LoggerFactory.getLogger(VideoApplication.class);
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(VideoApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(VideoApplication.class, args);
// GlobalExceptionHandler.setAlwaysOk(true); Environment env = context.getEnvironment();
Environment env = context.getEnvironment(); String appName = env.getProperty("spring.application.name");
String ip = InetAddress.getLocalHost().getHostAddress(); logger.info(
String port = env.getProperty("server.port"); "\n----------------------------------------------------------\n\t"
String path = env.getProperty("server.servlet.context-path"); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
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