Commit 8c19adb9 by yinyong

wish计算日费用

parent 3a4bcf45
......@@ -46,14 +46,19 @@ public class WishSyncJob extends PointJob {
List<JobAccountLog> listByPage = jobAccountLogMapper.getListByPage(AccountPlatformType.Wish.code(),pageSize * shardingContext.getShardingItem(), pageSize);
if(listByPage != null && listByPage.size() > 0) {
for (JobAccountLog jobAccountLog : listByPage) {
if (jobAccountLog.getId() == null) {
BeanUtils.copyProperties(jobAccountLog, jobPointLog);
jobAccountLog.setId(null);
}
handleCampaign(jobAccountLog);
LocalDateTime localDateTime = jobAccountLog.getStartTime();
do{
if (jobAccountLog.getId() == null) {
BeanUtils.copyProperties(jobAccountLog, jobPointLog);
jobAccountLog.setId(null);
}
handleCampaign(jobAccountLog);
localDateTime = localDateTime.plusDays(1L);
}while (!localDateTime.isAfter(jobAccountLog.getEndTime()));
jobAccountLog.setStartTime(jobAccountLog.getEndTime());
jobAccountLog.setMessage("执行成功");
jobAccountLog.setEndTime(jobAccountLog.getStartTime().plusDays(jobAccountLog.getIntervalTime()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobAccountLog.getEndTime().plusDays(jobAccountLog.getIntervalTime()));
jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class);
jobAccountLog.setStartTime(LocalDateTime.now());
jobAccountLog.setEndTime(LocalDateTime.now());
if (jobAccountLog.getId() == null) {
jobAccountLogMapper.insertSelective(jobAccountLog);
} else {
......@@ -124,11 +129,12 @@ public class WishSyncJob extends PointJob {
dcBaseFinanceWish.setOtherToCnyExchangeRate(exchangeRate);
dcBaseFinanceWish.setAccountId(jobAccountLog.getAccountId());
dcBaseFinanceWish.setCompanyId(jobAccountLog.getCompanyId());
dcBaseFinanceWish.setRecordTime(jobAccountLog.getStartTime().toLocalDate());
DcBaseFinanceWishMapper mapper = SessionUtil.getSession().getMapper(DcBaseFinanceWishMapper.class);
int updateInt = mapper.updateByExampleSelective(dcBaseFinanceWish, DcBaseFinanceWishExample.newAndCreateCriteria().andCampaignIdEqualTo(dcBaseFinanceWish.getCampaignId()).example());
int updateInt = mapper.updateDayByExampleSelective(dcBaseFinanceWish, DcBaseFinanceWishExample.newAndCreateCriteria().andCampaignIdEqualTo(dcBaseFinanceWish.getCampaignId()).andRecordTimeEqualTo(dcBaseFinanceWish.getRecordTime()).example());
if(updateInt == 0) {
DcBaseFinanceWishMapper mapper1 = SessionUtil.getSession().getMapper(DcBaseFinanceWishMapper.class);
mapper1.insertSelective(dcBaseFinanceWish);
mapper1.insertDaySelective(dcBaseFinanceWish);
updateInsert = false;
}
} catch (Exception e) {
......
......@@ -47,7 +47,7 @@ public interface DcBaseFinanceWishMapper {
*/
int insertSelective(DcBaseFinanceWish record);
int insertSelectiveReturnId(DcBaseFinanceWish dcBaseFinanceWish);
int insertDaySelective(DcBaseFinanceWish record);
/**
* This method was generated by MyBatis Generator.
......@@ -82,6 +82,8 @@ public interface DcBaseFinanceWishMapper {
*/
int updateByExampleSelective(@Param("record") DcBaseFinanceWish record, @Param("example") DcBaseFinanceWishExample example);
int updateDayByExampleSelective(@Param("record") DcBaseFinanceWish record, @Param("example") DcBaseFinanceWishExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_wish
......
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