Commit 12b33350 authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 8f252d0a aa5e4c32
......@@ -18,8 +18,8 @@ import pwc.taxtech.atms.service.impl.AnalysisServiceImpl;
import javax.annotation.Resource;
import java.util.List;
public class AnylysisJob extends QuartzJobBean {
private static final Logger logger = LoggerFactory.getLogger(AnylysisJob.class);
public class AnalysisJob extends QuartzJobBean {
private static final Logger logger = LoggerFactory.getLogger(AnalysisJob.class);
@Resource
private OrganizationMapper organizationMapper;
......@@ -43,19 +43,19 @@ public class AnylysisJob extends QuartzJobBean {
logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period));
logger.info(String.format("开始分析%s费用数据",period));
analysisJobService.analysisFee(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period));
logger.info(String.format("开始分析%s档案管理数据",period));
analysisJobService.analysisFileManagement(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period));
logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period));
logger.info(String.format("开始分析%s申报表数据",period));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
logger.info(String.format("开始分析%s预期返还税数据",period));
logger.info(String.format("开始分析%s返还后税数据",period));
analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode());
}
......
......@@ -45,6 +45,7 @@ public class OrgSyncJob extends QuartzJobBean {
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap();
Map<String, String> headers = new HashMap<>();
// todo 这里token需确认
headers.put("token", token);
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Idap", "eddie.wu_v");
......
......@@ -289,6 +289,25 @@ public class DateUtils {
return hour;
}
public static Date getZero(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
}
public static Date getThreeDayZero(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH,-3);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
}
/**
* 得到现在分钟
*
......
......@@ -138,6 +138,47 @@ public class HttpUtil {
return result;
}
public static String post(String url,Map<String, String> headers, String mimeType,String charset, Integer connTimeout, Integer readTimeout)
throws ConnectTimeoutException, SocketTimeoutException, Exception {
HttpClient client = null;
HttpPost post = new HttpPost(url);
String result = "";
try {
if (headers != null && !headers.isEmpty()) {
for (Entry<String, String> entry : headers.entrySet()) {
post.addHeader(entry.getKey(), entry.getValue());
}
}
// 设置参数
Builder customReqConf = RequestConfig.custom();
if (connTimeout != null) {
customReqConf.setConnectTimeout(connTimeout);
}
if (readTimeout != null) {
customReqConf.setSocketTimeout(readTimeout);
}
post.setConfig(customReqConf.build());
HttpResponse res;
if (url.startsWith("https")) {
// 执行 Https 请求.
client = createSSLInsecureClient();
res = client.execute(post);
} else {
// 执行 Http 请求.
client = HttpUtil.client;
res = client.execute(post);
}
result = IOUtils.toString(res.getEntity().getContent(), charset);
} finally {
post.releaseConnection();
if (url.startsWith("https") && client != null&& client instanceof CloseableHttpClient) {
((CloseableHttpClient) client).close();
}
}
return result;
}
/**
* 提交form表单
......
......@@ -3,6 +3,7 @@ import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.ProjectServiceImpl;
import sun.misc.BASE64Decoder;
......@@ -24,16 +25,13 @@ import java.util.TimeZone;
* @Date: 20/03/2019 20:41
* @Description:
*/
@Service
public class DtsTokenService {
private static final Logger logger = LoggerFactory.getLogger(ProjectServiceImpl.class);
private static String PUBKEY;
@Value("${dd_pubkey}")
public void setDriver(String pubkey) {
PUBKEY= pubkey;
}
private String pubKey;
public static final String KEY_ALGORITHM = "RSA";
......@@ -49,7 +47,6 @@ public class DtsTokenService {
* @throws
*/
public String encryptInput(){
String pubKey = PUBKEY;
BASE64Encoder base64 = new BASE64Encoder();
BASE64Decoder base64Decoder = new BASE64Decoder();
byte[] encodeData;
......@@ -60,11 +57,9 @@ public class DtsTokenService {
long rNum = generateRandomNumber();
String inputStr1 = sDate + "@@" + "DTS" + "@@" + nonce+rNum;
byte[] data1 = inputStr1.getBytes();
logger.info("原文:" + inputStr1);
logger.debug("原文:" + inputStr1);
encodeData = encryptByPublicKey(data1, publicKey);
logger.info("公钥加密后:" + base64.encode(encodeData));
logger.debug("公钥加密后:" + base64.encode(encodeData));
} catch (Exception ex) {
throw new ServiceException("cus" + ex);
}
......@@ -98,7 +93,7 @@ public class DtsTokenService {
private byte[] encryptByPublicKey(byte[] data, byte[] key) throws Exception {
private static byte[] encryptByPublicKey(byte[] data, byte[] key) throws Exception {
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(key);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
......
package pwc.taxtech.atms.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.*;
......@@ -138,7 +139,7 @@ public class AnalysisJobServiceImpl extends BaseService {
am.setSeqNo(o.getCode() + "" + period);
List<Organization> parents = orgs.stream().filter(org -> org.getId().equals(o.getParentId())).collect(Collectors.toList());
String parentAbbreviation = "";
if (parents.isEmpty()) {
if (!parents.isEmpty()) {
parentAbbreviation = parents.get(0).getAbbreviation();
}
am.setParentCompanyAbbreviation(parentAbbreviation);
......@@ -369,71 +370,80 @@ public class AnalysisJobServiceImpl extends BaseService {
private void generalAnaysisReturnTaxEnd(Organization org, List<AnalysisTax> orgATList, List<AnalysisActualTaxReturn> aatrs) {
BigDecimal selfTax = new BigDecimal(0);
for (AnalysisTax at : orgATList) {
if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) {
selfTax.add(at.getTaxAmount());
}
AnalysisTaxReturnEnd taxReturnEnd = new AnalysisTaxReturnEnd();
taxReturnEnd.setId(idService.nextId());
taxReturnEnd.setOrganizationId(org.getId());
taxReturnEnd.setCompanyName(at.getCompanyName());
taxReturnEnd.setPeriod(at.getPeriod());
taxReturnEnd.setSeqNo(org.getCode() + "" + at.getPeriod());
taxReturnEnd.setTaxGroup(at.getTaxGroup());
BigDecimal taxAmount = at.getTaxAmount();
if ("城建税".equals(at.getTaxGroup())) {
String returnTaxName = "城建税返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
}
} else if ("教育费附加".equals(at.getTaxGroup())) {
String returnTaxName = "教育费附加返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
if(null!=orgATList){
for (AnalysisTax at : orgATList) {
if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) {
selfTax.add(at.getTaxAmount());
}
} else if ("地方教育费附加".equals(at.getTaxGroup())) {
String returnTaxName = "地方教育费附加返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
AnalysisTaxReturnEnd taxReturnEnd = new AnalysisTaxReturnEnd();
taxReturnEnd.setId(idService.nextId());
taxReturnEnd.setOrganizationId(org.getId());
taxReturnEnd.setCompanyName(at.getCompanyName());
taxReturnEnd.setPeriod(at.getPeriod());
taxReturnEnd.setSeqNo(org.getCode() + "" + at.getPeriod());
taxReturnEnd.setTaxGroup(at.getTaxGroup());
BigDecimal taxAmount = at.getTaxAmount();
// 该机构返还税信息不空时进行计算
if(null!=aatrs){
if ("城建税".equals(at.getTaxGroup())) {
String returnTaxName = "城建税返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
}
} else if ("教育费附加".equals(at.getTaxGroup())) {
String returnTaxName = "教育费附加返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
}
} else if ("地方教育费附加".equals(at.getTaxGroup())) {
String returnTaxName = "地方教育费附加返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
}
} else if ("印花税".equals(at.getTaxGroup())) {
String returnTaxName = "增值税返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
}
}
}
}
} else if ("印花税".equals(at.getTaxGroup())) {
String returnTaxName = "增值税返还";
taxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(taxReturnEnd);
}
BigDecimal selfTaxReturn = new BigDecimal(0);
String returnTaxName = "个人所得税返还";
// 该机构返还税信息不空时进行计算
if (null != aatrs) {
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
taxAmount = at.getTaxAmount().subtract(attr.getTaxReturnAmount());
selfTaxReturn = attr.getTaxReturnAmount();
}
}
}
taxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(taxReturnEnd);
// 个人所得税 = 员工个税 + 司机个税
AnalysisTaxReturnEnd selfTaxReturnEnd = new AnalysisTaxReturnEnd();
selfTaxReturnEnd.setId(idService.nextId());
selfTaxReturnEnd.setOrganizationId(org.getId());
selfTaxReturnEnd.setCompanyName(orgATList.get(0).getCompanyName());
selfTaxReturnEnd.setPeriod(orgATList.get(0).getPeriod());
selfTaxReturnEnd.setSeqNo(org.getCode() + "" + orgATList.get(0).getPeriod());
selfTaxReturnEnd.setTaxGroup(orgATList.get(0).getTaxGroup());
BigDecimal taxAmount = selfTax.subtract(selfTaxReturn);
selfTaxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd);
}
BigDecimal selfTaxReturn = new BigDecimal(0);
String returnTaxName = "个人所得税返还";
for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) {
selfTaxReturn = attr.getTaxReturnAmount();
}
}
// 个人所得税 = 员工个税 + 司机个税
AnalysisTaxReturnEnd selfTaxReturnEnd = new AnalysisTaxReturnEnd();
selfTaxReturnEnd.setId(idService.nextId());
selfTaxReturnEnd.setOrganizationId(org.getId());
selfTaxReturnEnd.setCompanyName(orgATList.get(0).getCompanyName());
selfTaxReturnEnd.setPeriod(orgATList.get(0).getPeriod());
selfTaxReturnEnd.setSeqNo(org.getCode() + "" + orgATList.get(0).getPeriod());
selfTaxReturnEnd.setTaxGroup(orgATList.get(0).getTaxGroup());
BigDecimal taxAmount = selfTax.subtract(selfTaxReturn);
selfTaxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd);
}
/**
......@@ -565,9 +575,12 @@ public class AnalysisJobServiceImpl extends BaseService {
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(e1);
List<OrganizationTaxRule> taxRules = organizationTaxRuleMapper.selectByExample(new OrganizationTaxRuleExample());
Map<String, OrganizationTaxRule> ruleMap = taxRules.stream().collect(Collectors.toMap(OrganizationTaxRule::getGroupName, Function.identity()));
taxDocuments.forEach(td -> {
// Map<String, OrganizationTaxRule> ruleMap = taxRules.stream().collect(Collectors.toMap(OrganizationTaxRule::getGroupName, Function.identity()));
Map<String, List<OrganizationTaxRule>> ruleMap = taxRules.stream().collect(Collectors.groupingBy(OrganizationTaxRule::getGroupName));
for(TaxDocument td : taxDocuments){
Organization o = orgMap.get(td.getCompanyId());
AnalysisFileManagement afm = new AnalysisFileManagement();
afm.setId(idService.nextId());
......@@ -576,7 +589,14 @@ public class AnalysisJobServiceImpl extends BaseService {
// 周期性上传 校验当年的当前及之前的周期是否有上传文件
if (StringUtils.isNotEmpty(td.getTaxType()) && null != td.getOwnTime()) {
OrganizationTaxRule rule = ruleMap.get(td.getTaxType());
List<OrganizationTaxRule> otrs = ruleMap.get(td.getTaxType());
Optional<OrganizationTaxRule> otrOP= otrs.stream().filter(otr->otr.getGroupName().equals(td.getTaxType())).map(OrganizationTaxRule::getUpdateTime).max(new ComparatorDate());
OrganizationTaxRule rule = otrOP.get();
if(null==rule){
break;
}
afm.setReportingFrequency(rule.getTaxDecCycle());
String archivingStatus = "未归档";
TaxDocumentExample example = new TaxDocumentExample();
......@@ -608,6 +628,22 @@ public class AnalysisJobServiceImpl extends BaseService {
afm.setCompanyName(o.getName());
afm.setPeriod(period);
analysisFileManagementMapper.insertSelective(afm);
});
}
}
public class ComparatorDate implements Comparator {
public static final String TAG = "ComparatorDate";
@Override
public int compare(Object obj1, Object obj2) {
Date d1 = (Date) obj1;
Date d2 = (Date) obj2;
if (d1.before(d2)) {
return 1;
} else {
return -1;
}
}
}
}
......@@ -8,6 +8,7 @@ import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.ResponseMessageBuilder;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.security.dd.DtsTokenService;
public class BaseService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
......@@ -28,5 +29,7 @@ public class BaseService {
protected CommonDocumentHelper commonDocumentHelper;
@Autowired
protected ResponseMessageBuilder responseMessageBuilder;
@Autowired
protected DtsTokenService dtsTokenService;
}
......@@ -42,6 +42,7 @@ import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.security.dd.DtsTokenService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*;
......@@ -1849,7 +1850,7 @@ public class DataImportService extends BaseService {
orgs.forEach(o -> {
try {
Callable callEbs = new CallEbsThread(type, o,ebsCallUrl,dataImportLogMapper,authUserHelper,
idService,period, effectiveDateFrom, effectiveDateTo);
idService,dtsTokenService,period, effectiveDateFrom, effectiveDateTo);
executorService.submit(callEbs);
// resList.add(future);
} catch (RejectedExecutionException rje) {
......@@ -1872,6 +1873,12 @@ public class DataImportService extends BaseService {
logger.error(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), e.getMessage()), e);
}
});
// 三天外的日志隐藏
DataImportLog dil = new DataImportLog();
dil.setDisplay(false);
DataImportLogExample e = new DataImportLogExample();
e.createCriteria().andCreateTimeLessThan(DateUtils.getThreeDayZero());
dataImportLogMapper.updateByExampleSelective(dil,e);
});
// 校验是否全部调用成功 这里有点问题
/*int res = 0;
......@@ -1957,18 +1964,21 @@ public class DataImportService extends BaseService {
private DistributedIdService idService;
private DtsTokenService dtsTokenService;
private String effectiveDateFrom;
private String effectiveDateTo;
CallEbsThread(int type, Organization org,String ebsCallUrl,DataImportLogMapper dataImportLogMapper,
AuthUserHelper authUserHelper,DistributedIdService idService,String period,
String effectiveDateFrom, String effectiveDateTo) {
CallEbsThread(int type, Organization org, String ebsCallUrl, DataImportLogMapper dataImportLogMapper,
AuthUserHelper authUserHelper, DistributedIdService idService, DtsTokenService dtsTokenService,
String period,String effectiveDateFrom, String effectiveDateTo) {
this.type = type;
this.org = org;
this.period = period;
this.ebsCallUrl = ebsCallUrl;
this.authUserHelper = authUserHelper;
this.dtsTokenService = dtsTokenService;
this.idService = idService;
this.dataImportLogMapper = dataImportLogMapper;
this.effectiveDateFrom = effectiveDateFrom;
......@@ -2008,44 +2018,46 @@ public class DataImportService extends BaseService {
dataImportLogMapper.insertSelective(log);
return 0;
}
String secureToken = dtsTokenService.encryptInput();
Map<String,String> headers = new HashMap<>();
headers.put("secureToken",secureToken);
switch (type) {
case EbsExtractTypeConstant.TB:
response = HttpUtil.post(ebsCallUrl + "/glMonthlyBal?ledgerId="+ledgerId+"&companyCode="+ code + "&period=" + period,
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.JE:
// 这里BA反馈可按期间获取当月日记账即可
String effecDateFrom = DateUtils.getFirstDayOfMonth(year,month);
String effecDateTo = DateUtils.getLastDayOfMonth(year,month);
response = HttpUtil.post(ebsCallUrl + "/glJeLines"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&effectiveDateFrom=" + effecDateFrom+"&effectiveDateTo="+effecDateTo,
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.BSPRC:
response = HttpUtil.post(ebsCallUrl + "/fsgAsset"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=Y",
"",
"application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.PLPRC:
response = HttpUtil.post(ebsCallUrl + "/fsgProfit"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=Y",
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.BS:
response = HttpUtil.post(ebsCallUrl + "/fsgAsset"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=N",
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.PL:
response = HttpUtil.post(ebsCallUrl + "/fsgProfit"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=N",
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.CF:
response = HttpUtil.post(ebsCallUrl + "/fsgCash"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period,
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
case EbsExtractTypeConstant.OCTB:
break;
case EbsExtractTypeConstant.RATE:
response = HttpUtil.post(ebsCallUrl + "/dailyRates"+"?period=" + period,
"","application/json;charset=utf-8", "UTF-8", 10000, 10000);
headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break;
default:
break;
......
......@@ -36,12 +36,14 @@
<list>
<ref bean="lgApiJobTrigger"/>
<ref bean="orgSyncJobTrigger"/>
<ref bean="analysisJobTrigger"/>
</list>
</property>
<property name="jobDetails">
<list>
<ref bean="lgGlBalanceJob"/>
<ref bean="orgSyncJob"/>
<ref bean="analysisJob"/>
</list>
</property>
<property name="taskExecutor" ref="executor"/>
......@@ -68,11 +70,24 @@
<property name="description" value="机构信息同步"/>
</bean>
<bean name="analysisJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.AnalysisJob"/>
<property name="durability" value="true"/>
<property name="requestsRecovery" value="false"/>
<property name="description" value="分析模块"/>
</bean>
<!-- 每月1日执行一次-->
<bean id="orgSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="orgSyncJob"/>
<property name="cronExpression" value="0 0 0 1 * ?"/>
</bean>
<!-- 每天凌晨一点执行一次-->
<bean id="analysisJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="analysisJob"/>
<property name="cronExpression" value="0 0 1 * * ?"/>
</bean>
<!-- 分布式事务配置 end -->
</beans>
\ No newline at end of file
package pwc.taxtech.atms.service.impl;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample;
import java.util.List;
/**
* @Auther: Gary J Li
* @Date: 21/03/2019 11:37
* @Description:
*/
public class AnalysisTest extends CommonIT {
private static final Logger logger = LoggerFactory.getLogger(DataInitTest.class);
@Autowired
private AnalysisJobServiceImpl analysisJobService;
@Test
public void analysisExpectedTax(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode());
}
@Test
public void analysisFee(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s费用数据",period));
analysisJobService.analysisFee(orgs,period, EnumTbImportType.CoverImport.getCode());
}
@Test
public void analysisFileManagement(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s文档管理数据",period));
analysisJobService.analysisFileManagement(orgs,period, EnumTbImportType.CoverImport.getCode());
}
@Test
public void analysisMaster(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s机构数据",period));
analysisJobService.analysisMaster(orgs,period, EnumTbImportType.CoverImport.getCode());
}
@Test
public void analysisSales(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s申报表数据",period));
analysisJobService.analysisSales(orgs,period, EnumTbImportType.CoverImport.getCode());
}
@Test
public void analysisTaxReturnEnd(){
Integer period = DateUtils.getPeriodNow();
OrganizationExample e = new OrganizationExample();
e.createCriteria().andIsActiveEqualTo(true);
List<Organization> orgs = organizationMapper.selectByExample(e);
logger.info(String.format("开始分析%s返还后税数据",period));
analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode());
}
}
......@@ -11,6 +11,7 @@ import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.OrganizationExtra;
import pwc.taxtech.atms.entity.OrganizationExtraExample;
import pwc.taxtech.atms.security.dd.DtsTokenService;
import java.util.List;
......
......@@ -246,7 +246,7 @@ public interface ProjectMapper extends MyMapper {
" AND b.service_type_id = #{serviceType}")
Long getTemplateGroupIdByProject(@Param("projectId") String projectId, @Param("serviceType") Integer serviceType);
List<ProjectAnaylsisDto> getTemlateWithServiceType(@Param("orgIds") List<String> orgIds, @Param("year") Integer year, @Param("month") Integer month,@Param("reportName")String reportName);
List<ProjectAnaylsisDto> getTemlateWithServiceType(@Param("list") List<String> orgIds, @Param("year") Integer year, @Param("month") Integer month,@Param("reportName")String reportName);
List<ProjectAnaylsisDto> getTemlateWithServiceType2(@Param("orgId")String orgId, @Param("year") Integer year, @Param("month") Integer month,@Param("code")String code);
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
#{item}
</foreach>
and p.year = #{year}
and p.stat_period &lt; #{month}
and p.start_period &lt; #{month}
and p.end_period &gt; #{month}
and t.name = #{reportName}
</select>
......@@ -32,7 +32,7 @@
on pp.template_id = t.id
where p.organization_id = #{orgId}
and p.year = #{year}
and p.stat_period &lt; #{month}
and p.start_period &lt; #{month}
and p.end_period &gt; #{month}
and t.code = #{code}
</select>
......
......@@ -101,7 +101,7 @@
</select>
<select id = "selectAnalysisSalesValueDto" resultType="pwc.taxtech.atms.dpo.AnalysisSalesValueDto">
select pcd.data as data,pct.column_index as columnIndex,pct.row_index as rowIndex,
select pcd.data as data,pct.column_index as columnIndex,pct.row_index as rowIndex
from
period_cell_data pcd
left join period_cell_template pct
......
......@@ -127,6 +127,7 @@
.success(function (res) {
if (res && 0 === res.code) {
$scope.selectOrgList = res.data;
$scope.refreshConfigGrid();
}else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
......@@ -275,7 +276,7 @@
function init() {
getMyOrgList();
$scope.refreshConfigGrid();
}
init()
......
......@@ -155,6 +155,7 @@
.success(function (res) {
if (res && 0 === res.code) {
$scope.selectOrgList = res.data;
$scope.refreshConfigGrid();
}else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
......@@ -344,7 +345,7 @@
function init() {
getMyOrgList();
$scope.refreshConfigGrid();
}
init()
......
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