Commit c6a1e283 authored by eddie.woo's avatar eddie.woo

modify

parent 89cee29d
package pwc.taxtech.atms.common.schedule; package pwc.taxtech.atms.common.schedule;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean; import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dao.EnterpriseAccountMapper;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper;
import pwc.taxtech.atms.dao.OrganizationMapper; import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.UserMapper; import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.service.impl.LgGlBalanceService;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List; import java.util.List;
public class LgGlBalanceJob extends QuartzJobBean { public class LgGlBalanceJob extends QuartzJobBean {
...@@ -25,12 +24,10 @@ public class LgGlBalanceJob extends QuartzJobBean { ...@@ -25,12 +24,10 @@ public class LgGlBalanceJob extends QuartzJobBean {
public static final String ORG_ID = "org_id"; public static final String ORG_ID = "org_id";
public static final String PERIOD = "period"; public static final String PERIOD = "period";
@Autowired
private EnterpriseAccountMapper accountMapper;
@Autowired @Autowired
private OrganizationMapper orgMapper; private OrganizationMapper orgMapper;
@Autowired @Resource
private EnterpriseAccountSetOrgMapper setOrgMapper; private LgGlBalanceService lgGlBalanceService;
@Override @Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
...@@ -45,10 +42,15 @@ public class LgGlBalanceJob extends QuartzJobBean { ...@@ -45,10 +42,15 @@ public class LgGlBalanceJob extends QuartzJobBean {
} }
for (Organization organization : orgList) { for (Organization organization : orgList) {
try { try {
SimpleDateFormat dateFormat = new SimpleDateFormat(Constant.DateFormat.YEAR_MONTH);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, -1);
period = StringUtils.isBlank(period) ? dateFormat.format(calendar.getTime()) : period;
lgGlBalanceService.queryGlBalance(organization, period);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("LgGlBalanceJob error. Organization: " + organization.getId(), e); LOGGER.error("LgGlBalanceJob error. Organization: " + organization.getId(), e);
} }
} }
} }
} }
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