|
|
@@ -12,8 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -33,7 +31,7 @@ public class ApCheckTask {
|
|
|
/**
|
|
|
* 更新对账金额语句
|
|
|
*/
|
|
|
- public static final String UPDATE_COUNT_SQL = "update purc$vendors set todo_apchek_count = %s, update_time = now() where ve_id = %d";
|
|
|
+ public static final String UPDATE_COUNT_SQL = "update purc$vendors set todo_apchek_count = '%s', update_time = now() where ve_id = %d";
|
|
|
|
|
|
@Autowired
|
|
|
private CommonDao commonDao;
|
|
|
@@ -55,18 +53,22 @@ public class ApCheckTask {
|
|
|
final int[] size = {0};
|
|
|
vendorList.forEach(vendorInfo -> {
|
|
|
List<TradeCount> tradeCounts = apCheckService.getDueTrade(vendorInfo.getVenduu(), vendorInfo.getCustuu());
|
|
|
+ String tradeString;
|
|
|
if (!CollectionUtil.isEmpty(tradeCounts)) {
|
|
|
- String tradeString = JSON.toJSONString(tradeCounts);
|
|
|
- try {
|
|
|
- commonDao.getJdbcTemplate().update(String.format(UPDATE_COUNT_SQL, tradeString, vendorInfo.getId()));
|
|
|
- size[0]++;
|
|
|
- } catch (RuntimeException e) {
|
|
|
- CommunalLog log = new CommunalLog();
|
|
|
- log.setTitle("更新客户关系表对账数据--更新失败");
|
|
|
- log.setMessage("id: " + vendorInfo.getId());
|
|
|
- log.setTime(System.currentTimeMillis());
|
|
|
- communalLogDao.save(log);
|
|
|
- }
|
|
|
+ tradeString = JSON.toJSONString(tradeCounts);
|
|
|
+ } else {
|
|
|
+ tradeString = "";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String sql = String.format(UPDATE_COUNT_SQL, tradeString, vendorInfo.getId());
|
|
|
+ commonDao.getJdbcTemplate().update(sql);
|
|
|
+ size[0]++;
|
|
|
+ } catch (RuntimeException e) {
|
|
|
+ CommunalLog log = new CommunalLog();
|
|
|
+ log.setTitle("更新客户关系表对账数据--更新失败");
|
|
|
+ log.setMessage("id: " + vendorInfo.getId());
|
|
|
+ log.setTime(System.currentTimeMillis());
|
|
|
+ communalLogDao.save(log);
|
|
|
}
|
|
|
});
|
|
|
CommunalLog log = new CommunalLog();
|