附件上传,按照日期存放

master
bmpandlcm 12 months ago
parent bd32e88586
commit 3d49049654

@ -2,17 +2,21 @@
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="IntegralManager:war exploded" />
<artifact name="IntegralManager:war" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="29bcb86b-1634-41e0-a498-79481163cba8" name="Changes" comment="新增附件上传接口">
<list default="true" id="29bcb86b-1634-41e0-a498-79481163cba8" name="Changes" comment="附件上传接口修改">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/controller/FileController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/controller/FileController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/controller/FileUploadController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/controller/FileUploadController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/service/impl/UserTableServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/service/impl/UserTableServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/service/impl/UserVehicleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/service/impl/UserVehicleServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/util/ImageUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/util/ImageUtils.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/nmgs/util/PubTools.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/nmgs/util/PubTools.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -143,7 +147,20 @@
<recent name="com.nmgs.entity" />
</key>
</component>
<component name="RunManager" selected="Tomcat Server.Tomcat 9.0.80">
<component name="RunManager" selected="Application.PubTools">
<configuration name="PubTools" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.nmgs.util.PubTools" />
<module name="IntegralManager" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.nmgs.util.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="SensitiveFilter" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.nmgs.util.SensitiveFilter" />
<module name="IntegralManager" />
@ -171,11 +188,12 @@
</method>
</configuration>
<configuration name="Tomcat 9.0.80" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 9.0.80" ALTERNATIVE_JRE_ENABLED="true" ALTERNATIVE_JRE_PATH="1.8 (2)" nameIsGenerated="true">
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OPEN_IN_BROWSER_URL" value="http://192.168.101.59:9003/IntegralManager/doc.html" />
<option name="COMMON_VM_ARGUMENTS" value="-Dfile.encoding=utf-8" />
<option name="UPDATING_POLICY" value="restart-server" />
<deployment>
<artifact name="IntegralManager:war exploded">
<artifact name="IntegralManager:war">
<settings>
<option name="CONTEXT_PATH" value="/IntegralManager" />
</settings>
@ -183,7 +201,6 @@
</deployment>
<server-settings>
<option name="BASE_DIRECTORY_NAME" value="f3020269-24f5-4e17-a252-787d327c95f4" />
<option name="HTTP_PORT" value="9003" />
</server-settings>
<log_file alias="Tomcat Host Manager Log" path="%IDEA_RUN:CATALINA_BASE%/logs/host-manager.*" />
<predefined_log_file enabled="true" id="Tomcat" />
@ -257,7 +274,7 @@
<option name="Make" enabled="true" />
<option name="BuildArtifacts" enabled="true">
<artifact name="dev_project:war exploded" />
<artifact name="IntegralManager:war exploded" />
<artifact name="IntegralManager:war" />
</option>
</method>
</configuration>
@ -369,11 +386,13 @@
</method>
</configuration>
<list>
<item itemvalue="Application.PubTools" />
<item itemvalue="Application.SensitiveFilter" />
<item itemvalue="Tomcat Server.Tomcat 9.0.80" />
</list>
<recent_temporary>
<list>
<item itemvalue="Application.PubTools" />
<item itemvalue="Application.SensitiveFilter" />
</list>
</recent_temporary>
@ -531,7 +550,13 @@
<workItem from="1731392801577" duration="11435000" />
<workItem from="1731462347759" duration="16745000" />
<workItem from="1731493469759" duration="2417000" />
<workItem from="1731543619015" duration="1862000" />
<workItem from="1731543619015" duration="1916000" />
<workItem from="1731982246589" duration="2483000" />
<workItem from="1732262083086" duration="3587000" />
<workItem from="1732673911947" duration="54000" />
<workItem from="1732764840073" duration="622000" />
<workItem from="1732842648636" duration="6217000" />
<workItem from="1732867224102" duration="1353000" />
</task>
<task id="LOCAL-00001" summary="特请处理">
<option name="closed" value="true" />
@ -645,12 +670,39 @@
<option name="project" value="LOCAL" />
<updated>1731484036276</updated>
</task>
<option name="localTasksCounter" value="15" />
<task id="LOCAL-00015" summary="新增附件上传接口">
<option name="closed" value="true" />
<created>1731577658829</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1731577658829</updated>
</task>
<task id="LOCAL-00016" summary="附件上传接口修改">
<option name="closed" value="true" />
<created>1731986350521</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1731986350521</updated>
</task>
<option name="localTasksCounter" value="17" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="解析车牌确认和车牌车型确认参数" />
<MESSAGE value="特请处理" />
@ -663,7 +715,8 @@
<MESSAGE value="人员认证加了一个校验" />
<MESSAGE value="给后端服务提供的websocket进行消息内容修改" />
<MESSAGE value="新增附件上传接口" />
<option name="LAST_COMMIT_MESSAGE" value="新增附件上传接口" />
<MESSAGE value="附件上传接口修改" />
<option name="LAST_COMMIT_MESSAGE" value="附件上传接口修改" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

@ -43,7 +43,7 @@ public class FileController {
LogUtil.WriteLog_Info("附件上传接口执行开始===========" + PubTools.getCurrentDate(), "FileController");
Properties props = System.getProperties();
String os = props.getProperty("os.name").toLowerCase();
String fileAddressLocal = PathUtil.uploadPath;
String fileAddressLocal = PathUtil.uploadPath + "/" + PubTools.getCurrentDateYMD();
if (os.startsWith("win")) {
// fileAddressLocal = PropertiesUtil.getValue("fileAddressWin");
fileAddressLocal = fileAddressLocal.replace("/", "\\");

@ -32,7 +32,7 @@ public class FileUploadController {
LogUtil.WriteLog_Info("附件上传接口执行开始===========" + PubTools.getCurrentDate(), "FileUploadController");
Properties props = System.getProperties();
String os = props.getProperty("os.name").toLowerCase();
String fileAddressLocal = PathUtil.uploadPath;
String fileAddressLocal = PathUtil.uploadPath + "/" + PubTools.getCurrentDateYMD();
if (os.startsWith("win")) {
// fileAddressLocal = PropertiesUtil.getValue("fileAddressWin");
fileAddressLocal = fileAddressLocal.replace("/", "\\");
@ -76,7 +76,7 @@ public class FileUploadController {
}
String addWaterImage = ImageUtils.addImageWaterMark(imageBase64, "仅用于内蒙古交通货运车辆积分会员认证", fileName);
if (!PubTools.isNull(addWaterImage)) {
// ImageUtils.delFile(fileName, false);
/*// ImageUtils.delFile(fileName, false);
byte[] imageBytes = Base64.getDecoder().decode(addWaterImage);
// 创建文件
File file = new File(fileAddressLocal, fileName); // 指定上传位置
@ -85,7 +85,7 @@ public class FileUploadController {
}
// 保存文件
LogUtil.WriteLog_Info("附件开始上传到服务器===========" + PubTools.getCurrentDate(), "FileUploadController");
FileUtils.writeByteArrayToFile(file, imageBytes);
FileUtils.writeByteArrayToFile(file, imageBytes);*/
LogUtil.WriteLog_Info("附件上传到服务器结束===========" + PubTools.getCurrentDate(), "FileUploadController");
} else if ("-9999".equals(addWaterImage)) {
throw new Exception("附件添加水印失败");

@ -135,6 +135,7 @@ public class UserTableServiceImpl implements UserTableService {
if("2".equals(DBType)){
numberPic=PubTools.StringToClob(numberPic);
}
fileName = PubTools.getCurrentDateYMD() + "/" + fileName;
String sql="update WEIXN_USER_TABLE " +
" set CERTIFICATION=2,CREATETIME=to_date('" + PubTools.getCurrentDate() + "','yyyy-MM-dd HH24:mi:ss'),NUMBERPICNAME='" + fileName + "'";
if (!PubTools.isNull(realName)) {

@ -295,31 +295,31 @@ public class UserVehicleServiceImpl implements UserVehicleService {
if (!PubTools.isNull(licensepic)) {
// licensepic = PubTools.StringToClob(licensepic);
// sql += ",LICENSEPIC=" + licensepic;
sql += ",LICENSEPICNAME='" + fileNamePre + "LICPIC" + fileNameAfter + "'";
sql += ",LICENSEPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "LICPIC" + fileNameAfter + "'";
}
if (!PubTools.isNull(permitpic)) {
// permitpic = PubTools.StringToClob(permitpic);
// sql += ",PERMITPIC=" + permitpic;
sql += ",PERMITPICNAME='" + fileNamePre + "PERPIC" + fileNameAfter + "'";
sql += ",PERMITPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "PERPIC" + fileNameAfter + "'";
}
if (!PubTools.isNull(vehiclePic)) {
// vehiclePic = PubTools.StringToClob(vehiclePic);
// sql += ",VEHICLEPIC=" + vehiclePic;
sql += ",VEHICLEPICNAME='" + fileNamePre + "VEHPIC" + fileNameAfter + "'";
sql += ",VEHICLEPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "VEHPIC" + fileNameAfter + "'";
}
} else if ("4".equals(DBType)) {
sql += ",CREATETIME=str_to_date('" + PubTools.getCurrentDate() + "','%Y-%m-%d %H:%i:%s')";
if (!PubTools.isNull(licensepic)) {
// sql += ",LICENSEPIC='" + licensepic + "'";
sql += ",LICENSEPICNAME='" + fileNamePre + "LICPIC" + fileNameAfter + "'";
sql += ",LICENSEPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "LICPIC" + fileNameAfter + "'";
}
if (!PubTools.isNull(permitpic)) {
// sql += ",PERMITPIC='" + permitpic + "'";
sql += ",PERMITPICNAME='" + fileNamePre + "PERPIC" + fileNameAfter + "'";
sql += ",PERMITPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "PERPIC" + fileNameAfter + "'";
}
if (!PubTools.isNull(vehiclePic)) {
// sql += ",VEHICLEPIC='" + vehiclePic + "'";
sql += ",VEHICLEPICNAME='" + fileNamePre + "VEHPIC" + fileNameAfter + "'";
sql += ",VEHICLEPICNAME='" + PubTools.getCurrentDateYMD() + "/" + fileNamePre + "VEHPIC" + fileNameAfter + "'";
}
}
if (!PubTools.isNull(referrerCode)) {

@ -28,7 +28,7 @@ public class ImageUtils {
String retStr="";
Properties props = System.getProperties();
String os = props.getProperty("os.name").toLowerCase();
String fileAddress = PathUtil.uploadPath;
String fileAddress = PathUtil.uploadPath + "/" + PubTools.getCurrentDateYMD();
ByteArrayInputStream inputStream = null;
try {
if (os.startsWith("win")) {
@ -191,7 +191,19 @@ public class ImageUtils {
Properties props = System.getProperties();
String os = props.getProperty("os.name").toLowerCase();
String fileAddressLocal = "";
fileAddressLocal = PathUtil.uploadPath;
String pathAfter = "";
if (fileName.contains("/")) {
String[] split = fileName.split("/");
if (split.length > 1) {
pathAfter = split[0];
fileName = split[1];
}
}
if (!PubTools.isNull(pathAfter)) {
fileAddressLocal = PathUtil.uploadPath + "/" + pathAfter;
} else {
fileAddressLocal = PathUtil.uploadPath;
}
if (os.startsWith("win")) {
//fileAddressLocal = PropertiesUtil.getValue("fileAddressWin");
fileAddressLocal = fileAddressLocal.replace("/", "\\");

@ -16,6 +16,7 @@ import java.util.*;
public class PubTools {
static SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static SimpleDateFormat dfYYD=new SimpleDateFormat("yyyy-MM-dd");
static SimpleDateFormat dfYMD = new SimpleDateFormat("yyyyMMdd");
@ -87,7 +88,9 @@ public class PubTools {
return dfYYD.format(new Date());
}
public static String getCurrentDateYMD() {
return dfYMD.format(new Date());
}
//拼接字符串
public static String StringToClob(String text) {
int content_length = text.length();
@ -212,7 +215,7 @@ public class PubTools {
}
public static void main(String[] args) {
System.out.println(getCurrentDateNoStr());
System.out.println(getCurrentDateYMD());
}
public static String ClobToString(Object clob) {
String reString = "";

Loading…
Cancel
Save