活动同步问题修复

This commit is contained in:
liyj 2025-11-03 18:00:47 +08:00
parent d3790fae0d
commit 88e9a52071
3 changed files with 16 additions and 47 deletions

View File

@ -186,8 +186,8 @@ public class BaseDao {
int total=0;
Connection connection=getConnection(ip,username,password,portNumber,dataBaseName);
try {
String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master m on " +
" d.plan_no =m.plan_no %s";
String sql="select count(1) from t_pub_plan_detail_b d left join t_pub_plan_master t on " +
" d.plan_no =t.plan_no %s";
sql=String.format(sql,where);
log.info(sql);
PreparedStatement ps= connection.prepareStatement(sql);

View File

@ -178,8 +178,12 @@ public class SxDataDao extends BaseDao{
* @return
*/
public int getTBditemInfoJoninTotal(DataBaseInfo dataBaseInfo){
String stockOperateWhere="";
if(StringUtils.isNotEmpty(dataBaseInfo.getStockOperateWhere())){
stockOperateWhere="where "+dataBaseInfo.getStockOperateWhere();
}
return getBaseGoodsJoinTotal(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),"where "+dataBaseInfo.getStockOperateWhere());
,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),stockOperateWhere);
}
/**
@ -200,8 +204,12 @@ public class SxDataDao extends BaseDao{
* @param pageSize
*/
public List<SxSyncGoods> findBditemInfoListPage(DataBaseInfo dataBaseInfo,int pageNo,int pageSize){
String stockOperateWhere="";
if(StringUtils.isNotEmpty(dataBaseInfo.getStockOperateWhere())){
stockOperateWhere=" and "+dataBaseInfo.getStockOperateWhere();
}
ResultDto resultDto=baseFindGoodsListJoinPage(dataBaseInfo.getIp(),dataBaseInfo.getUserName(),dataBaseInfo.getPassword(),dataBaseInfo.getDbPort(),dataBaseInfo.getDataBaseName()
,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere()," and "+dataBaseInfo.getStockOperateWhere());
,pageNo,pageSize,dataBaseInfo.getWhere()==null?DEFALTWHERE:dataBaseInfo.getWhere(),stockOperateWhere);
ResultSet rs= resultDto.getResultSet();
List<SxSyncGoods> sxSyncGoodses=new ArrayList<>();
SxSyncGoods sxSyncGoods=null;
@ -1134,7 +1142,7 @@ public class SxDataDao extends BaseDao{
,dataBaseInfo.getPassword()
,dataBaseInfo.getDbPort()
,dataBaseInfo.getDataBaseName()
,T_PUB_PLAN_MASTER
,T_PUB_PLAN_MASTER +" b"
,PLAN_NO
,pageNo
,pageSize

View File

@ -22,31 +22,22 @@ import com.small.client.service.WebClientService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.LaxRedirectStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.*;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StreamUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
@ -694,7 +685,8 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
log.error("文件下载失败:{}",e.getMessage());
return null;
}
return downloadDirectory+originalFileName;
File file=new File(downloadDirectory+originalFileName);
return file.length()>0?downloadDirectory+originalFileName:null;
}
@ -845,7 +837,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
String where="where 1=1";
Integer total =0;
if(StringUtils.isNotEmpty(commentModel.getSyncTime())){
where+=" and m.oper_date>'"+commentModel.getSyncTime()+"' ";
where+=" and t.oper_date>'"+commentModel.getSyncTime()+"' ";
// where+=" or m.oper_date>'"+commentModel.getSyncTime()+"') ";
}
@ -898,35 +890,4 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
return map;
}
/**
* 创建跳过SSL验证的RestTemplate
* 仅用于测试环境生产环境不安全
*/
private RestTemplate createUnsafeRestTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
// 配置请求参数
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(30000)
.setSocketTimeout(30000)
.setRedirectsEnabled(true)
.setMaxRedirects(10)
.build();
// 创建SSL上下文信任所有证书 - 仅测试环境使用
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
.loadTrustMaterial((chain, authType) -> true)
.build();
// 创建HttpClient配置SSL和重定向
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(config)
.setSSLContext(sslContext)
.setRedirectStrategy(new LaxRedirectStrategy())
.build();
// 创建请求工厂
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
return new RestTemplate(factory);
}
}