#HJ-29# 提交最新的代码

feature-LeeD-20221025
shilei 2 years ago
parent 70680ee176
commit b953af8f5e

@ -6,6 +6,7 @@ import okhttp3.*;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import sun.misc.BASE64Decoder;
import weaver.alioss.AliOSSObjectManager;
import weaver.conn.RecordSet;
import weaver.docs.docs.ImageFileIdUpdate;
import weaver.general.BaseBean;
@ -131,14 +132,14 @@ public class ESiginsCronJob extends BaseCronJob {
file.mkdirs();
}
long currentTime = System.currentTimeMillis();
// long currentTime = System.currentTimeMillis();
String imagefilename = DigestUtils.md5Hex(sysUserCode); //MD5加密
//String imageFilePath = filepath+"/"+imagefilename+Util.null2String(currentTime);
String imageFilePath = filepath+"/"+imagefilename;
String image_File_Path = saveImageFile(esignImage,imageFilePath,imagetype);
bb.writeLog("image_File_Path:"+image_File_Path);
if(!"".equals(image_File_Path))
if(StringUtils.isNotEmpty(image_File_Path))
{
File imageFile = new File(image_File_Path);
if(imageFile.exists())
@ -156,8 +157,7 @@ public class ESiginsCronJob extends BaseCronJob {
String imagefileid = "" ;
String markid = "" ;
String sql =" select t.markid,t.imagefileid from DocSignature t\n" +
" where t.isdefault = 1 and t.hrmresid= ?" ;
String sql =" select t.markid,t.imagefileid from DocSignature t where t.hrmresid= ? and sealtype = 1 " ;
bb.writeLog("userid:"+userid);
rs.executeQuery(sql,new Object[]{userid});
bb.writeLog("sql:"+sql);
@ -170,6 +170,23 @@ public class ESiginsCronJob extends BaseCronJob {
{
if(StringUtils.isNotEmpty(imagefileid))
{
String storagestatus = "" ;
String tokenkey = "" ;
sql = " select storagestatus,tokenkey from imagefile where imagefileid = ?" ;
rs.executeQuery(sql,new Object[]{imagefileid});
if(rs.next()){
storagestatus = Util.null2String(rs.getString("storagestatus"));
tokenkey = Util.null2String(rs.getString("tokenkey"));
}
if(StringUtils.isNotEmpty(tokenkey)){
sql = " update imagefile set storagestatus='',tokenkey='' where imagefileid=?" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imagefileid});
if(isTrue){
uploadAliOSS(imagefileid);
}
}
String sealtype = "1" ;
String markdate = TimeUtil.getCurrentTimeString();
sql = " update docsignature set isdefault=1,markname = ?,marktype = ?,markpath = ?,marksize = ?,markdate = ?,subcompanyid=?,sealtype = ? where markid= ?" ;
@ -179,7 +196,7 @@ public class ESiginsCronJob extends BaseCronJob {
String imageName = sysUserCode+"."+imagetype;
String imageFileType = "application/octet-stream";
sql = " update imagefile set imagefilename = ?,imagefiletype = ?,filerealpath = ?,filesize = ? where imagefileid = ? " ;
rs.executeUpdate(sql,new Object[]{imageName,imageFileType,image_File_Zip_Path,filesize,imagefileid});
boolean isTrue = rs.executeUpdate(sql,new Object[]{imageName,imageFileType,image_File_Zip_Path,filesize,imagefileid});
bb.writeLog("sql:"+sql);
}
}else{
@ -272,18 +289,30 @@ public class ESiginsCronJob extends BaseCronJob {
String sealtype = "1" ;
String isdefault = "1";
ImageFileIdUpdate im = new ImageFileIdUpdate();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String imagefileid = "" ;
String sql = " select imagefileid from imagefile where filerealpath = ? ";
String tokenkey = "" ;
String sql = " select imagefileid,storagestatus,tokenkey from imagefile where filerealpath = ? ";
rs.executeQuery(sql,new Object[]{image_File_Zip_Path});
if(rs.next()){
imagefileid = Util.null2String(rs.getString("imagefileid"));
tokenkey = Util.null2String(rs.getString("tokenkey"));
}
if(StringUtils.isNotEmpty(imagefileid))
{
if(StringUtils.isNotEmpty(tokenkey)){
sql = " update imagefile set storagestatus='',tokenkey='' where imagefileid=?" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imagefileid});
if(isTrue){
uploadAliOSS(imagefileid);
}
}
sql = " insert into DocSignature(hrmresid, markname, marktype, markpath, marksize, markdate, subcompanyid, sealtype, isdefault, imagefileid)\n" +
" values(?,?,?,?,?,?,?,?,?,?)" ;
rs.executeUpdate(sql,new Object[]{userid,sysUserCode,"."+imagetype,image_File_Path,marksize,markdate,subcompanyid1,sealtype,isdefault,imagefileid});
@ -330,13 +359,24 @@ public class ESiginsCronJob extends BaseCronJob {
String sealtype = "1" ;
String imagefileid = "" ;
String sql = " select imagefileid from imagefile where filerealpath = ? ";
String storagestatus = "" ;
String tokenkey = "" ;
String sql = " select imagefileid,storagestatus,tokenkey from imagefile where filerealpath = ? ";
rs.executeQuery(sql,new Object[]{image_File_Zip_Path});
if(rs.next()){
imagefileid = Util.null2String(rs.getString("imagefileid"));
tokenkey = Util.null2String(rs.getString("tokenkey"));
}
if(StringUtils.isNotEmpty(imagefileid))
{
if(StringUtils.isNotEmpty(tokenkey)){
sql = " update imagefile set storagestatus='',tokenkey='' where imagefileid=?" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imagefileid});
if(isTrue){
uploadAliOSS(imagefileid);
}
}
sql = " update imagefile set imagefilename = ?,imagefiletype = ?,filerealpath = ?,filesize = ? where imagefileid = ?" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imageName,imageFileType,image_File_Zip_Path,filesize,imagefileid});
bb.writeLog("sql:"+sql);
@ -476,5 +516,31 @@ public class ESiginsCronJob extends BaseCronJob {
return imagefilezippath;
}
/**
*
* @param imagefileid
*/
public void uploadAliOSS(String imagefileid){
RecordSet rs = new RecordSet();
String filerealpath = "";
String filename = "";
String iszip = "";
String isaesencrypt = "" ;
String aescode = "" ;
String sql = " select imagefilename,iszip,isaesencrypt,aescode,filerealpath,TokenKey from imagefile where imagefileid = ? ";
rs.executeQuery(sql,new Object[]{imagefileid});
if(rs.next()){
filerealpath = rs.getString("filerealpath");
filename = rs.getString("imagefilename");
iszip = rs.getString("iszip");
isaesencrypt = rs.getString("isaesencrypt");
aescode = rs.getString("aescode");
}
AliOSSObjectManager AliOSSObjectManager = new AliOSSObjectManager();
AliOSSObjectManager.uploadFile(filerealpath,filename,iszip,isaesencrypt,aescode);
}
}

Loading…
Cancel
Save