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; ...@@ -18,8 +18,8 @@ import pwc.taxtech.atms.service.impl.AnalysisServiceImpl;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
public class AnylysisJob extends QuartzJobBean { public class AnalysisJob extends QuartzJobBean {
private static final Logger logger = LoggerFactory.getLogger(AnylysisJob.class); private static final Logger logger = LoggerFactory.getLogger(AnalysisJob.class);
@Resource @Resource
private OrganizationMapper organizationMapper; private OrganizationMapper organizationMapper;
...@@ -43,19 +43,19 @@ public class AnylysisJob extends QuartzJobBean { ...@@ -43,19 +43,19 @@ public class AnylysisJob extends QuartzJobBean {
logger.info(String.format("开始分析%s预期返还税数据",period)); logger.info(String.format("开始分析%s预期返还税数据",period));
analysisJobService.analysisExpectedTax(orgs,period, EnumTbImportType.CoverImport.getCode()); 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()); 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()); 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()); 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()); 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()); analysisJobService.analysisTaxReturnEnd(orgs,period, EnumTbImportType.CoverImport.getCode());
} }
......
...@@ -45,6 +45,7 @@ public class OrgSyncJob extends QuartzJobBean { ...@@ -45,6 +45,7 @@ public class OrgSyncJob extends QuartzJobBean {
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap(); JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap();
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
// todo 这里token需确认
headers.put("token", token); headers.put("token", token);
headers.put("Content-Type", "application/x-www-form-urlencoded"); headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Idap", "eddie.wu_v"); headers.put("Idap", "eddie.wu_v");
......
...@@ -289,6 +289,25 @@ public class DateUtils { ...@@ -289,6 +289,25 @@ public class DateUtils {
return hour; 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 { ...@@ -138,6 +138,47 @@ public class HttpUtil {
return result; 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表单 * 提交form表单
......
...@@ -3,6 +3,7 @@ import org.apache.commons.codec.binary.Base64; ...@@ -3,6 +3,7 @@ import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.ProjectServiceImpl; import pwc.taxtech.atms.service.impl.ProjectServiceImpl;
import sun.misc.BASE64Decoder; import sun.misc.BASE64Decoder;
...@@ -24,16 +25,13 @@ import java.util.TimeZone; ...@@ -24,16 +25,13 @@ import java.util.TimeZone;
* @Date: 20/03/2019 20:41 * @Date: 20/03/2019 20:41
* @Description: * @Description:
*/ */
@Service
public class DtsTokenService { public class DtsTokenService {
private static final Logger logger = LoggerFactory.getLogger(ProjectServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(ProjectServiceImpl.class);
private static String PUBKEY;
@Value("${dd_pubkey}") @Value("${dd_pubkey}")
public void setDriver(String pubkey) { private String pubKey;
PUBKEY= pubkey;
}
public static final String KEY_ALGORITHM = "RSA"; public static final String KEY_ALGORITHM = "RSA";
...@@ -49,7 +47,6 @@ public class DtsTokenService { ...@@ -49,7 +47,6 @@ public class DtsTokenService {
* @throws * @throws
*/ */
public String encryptInput(){ public String encryptInput(){
String pubKey = PUBKEY;
BASE64Encoder base64 = new BASE64Encoder(); BASE64Encoder base64 = new BASE64Encoder();
BASE64Decoder base64Decoder = new BASE64Decoder(); BASE64Decoder base64Decoder = new BASE64Decoder();
byte[] encodeData; byte[] encodeData;
...@@ -60,11 +57,9 @@ public class DtsTokenService { ...@@ -60,11 +57,9 @@ public class DtsTokenService {
long rNum = generateRandomNumber(); long rNum = generateRandomNumber();
String inputStr1 = sDate + "@@" + "DTS" + "@@" + nonce+rNum; String inputStr1 = sDate + "@@" + "DTS" + "@@" + nonce+rNum;
byte[] data1 = inputStr1.getBytes(); byte[] data1 = inputStr1.getBytes();
logger.debug("原文:" + inputStr1);
logger.info("原文:" + inputStr1);
encodeData = encryptByPublicKey(data1, publicKey); encodeData = encryptByPublicKey(data1, publicKey);
logger.debug("公钥加密后:" + base64.encode(encodeData));
logger.info("公钥加密后:" + base64.encode(encodeData));
} catch (Exception ex) { } catch (Exception ex) {
throw new ServiceException("cus" + ex); throw new ServiceException("cus" + ex);
} }
...@@ -98,7 +93,7 @@ public class DtsTokenService { ...@@ -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); X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(key);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
PublicKey publicKey = keyFactory.generatePublic(x509KeySpec); PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.*; import java.util.*;
...@@ -138,7 +139,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -138,7 +139,7 @@ public class AnalysisJobServiceImpl extends BaseService {
am.setSeqNo(o.getCode() + "" + period); am.setSeqNo(o.getCode() + "" + period);
List<Organization> parents = orgs.stream().filter(org -> org.getId().equals(o.getParentId())).collect(Collectors.toList()); List<Organization> parents = orgs.stream().filter(org -> org.getId().equals(o.getParentId())).collect(Collectors.toList());
String parentAbbreviation = ""; String parentAbbreviation = "";
if (parents.isEmpty()) { if (!parents.isEmpty()) {
parentAbbreviation = parents.get(0).getAbbreviation(); parentAbbreviation = parents.get(0).getAbbreviation();
} }
am.setParentCompanyAbbreviation(parentAbbreviation); am.setParentCompanyAbbreviation(parentAbbreviation);
...@@ -369,6 +370,7 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -369,6 +370,7 @@ public class AnalysisJobServiceImpl extends BaseService {
private void generalAnaysisReturnTaxEnd(Organization org, List<AnalysisTax> orgATList, List<AnalysisActualTaxReturn> aatrs) { private void generalAnaysisReturnTaxEnd(Organization org, List<AnalysisTax> orgATList, List<AnalysisActualTaxReturn> aatrs) {
BigDecimal selfTax = new BigDecimal(0); BigDecimal selfTax = new BigDecimal(0);
if(null!=orgATList){
for (AnalysisTax at : orgATList) { for (AnalysisTax at : orgATList) {
if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) { if ("员工个税".equals(at.getTaxGroup()) || "司机个税".equals(at.getTaxGroup())) {
selfTax.add(at.getTaxAmount()); selfTax.add(at.getTaxAmount());
...@@ -381,6 +383,8 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -381,6 +383,8 @@ public class AnalysisJobServiceImpl extends BaseService {
taxReturnEnd.setSeqNo(org.getCode() + "" + at.getPeriod()); taxReturnEnd.setSeqNo(org.getCode() + "" + at.getPeriod());
taxReturnEnd.setTaxGroup(at.getTaxGroup()); taxReturnEnd.setTaxGroup(at.getTaxGroup());
BigDecimal taxAmount = at.getTaxAmount(); BigDecimal taxAmount = at.getTaxAmount();
// 该机构返还税信息不空时进行计算
if(null!=aatrs){
if ("城建税".equals(at.getTaxGroup())) { if ("城建税".equals(at.getTaxGroup())) {
String returnTaxName = "城建税返还"; String returnTaxName = "城建税返还";
for (AnalysisActualTaxReturn attr : aatrs) { for (AnalysisActualTaxReturn attr : aatrs) {
...@@ -410,6 +414,8 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -410,6 +414,8 @@ public class AnalysisJobServiceImpl extends BaseService {
} }
} }
} }
}
taxReturnEnd.setTaxAmount(taxAmount); taxReturnEnd.setTaxAmount(taxAmount);
analysisTaxReturnEndMapper.insertSelective(taxReturnEnd); analysisTaxReturnEndMapper.insertSelective(taxReturnEnd);
} }
...@@ -417,12 +423,14 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -417,12 +423,14 @@ public class AnalysisJobServiceImpl extends BaseService {
BigDecimal selfTaxReturn = new BigDecimal(0); BigDecimal selfTaxReturn = new BigDecimal(0);
String returnTaxName = "个人所得税返还"; String returnTaxName = "个人所得税返还";
// 该机构返还税信息不空时进行计算
if (null != aatrs) {
for (AnalysisActualTaxReturn attr : aatrs) { for (AnalysisActualTaxReturn attr : aatrs) {
if (returnTaxName.equals(attr.getTaxReturnGroup())) { if (returnTaxName.equals(attr.getTaxReturnGroup())) {
selfTaxReturn = attr.getTaxReturnAmount(); selfTaxReturn = attr.getTaxReturnAmount();
} }
} }
}
// 个人所得税 = 员工个税 + 司机个税 // 个人所得税 = 员工个税 + 司机个税
AnalysisTaxReturnEnd selfTaxReturnEnd = new AnalysisTaxReturnEnd(); AnalysisTaxReturnEnd selfTaxReturnEnd = new AnalysisTaxReturnEnd();
selfTaxReturnEnd.setId(idService.nextId()); selfTaxReturnEnd.setId(idService.nextId());
...@@ -436,6 +444,8 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -436,6 +444,8 @@ public class AnalysisJobServiceImpl extends BaseService {
analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd); analysisTaxReturnEndMapper.insertSelective(selfTaxReturnEnd);
} }
}
/** /**
* 19/03/2019 15:57 * 19/03/2019 15:57
* analysis_tax 与 organization_return_rate 计算预期返还税额 * analysis_tax 与 organization_return_rate 计算预期返还税额
...@@ -565,9 +575,12 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -565,9 +575,12 @@ public class AnalysisJobServiceImpl extends BaseService {
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(e1); List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(e1);
List<OrganizationTaxRule> taxRules = organizationTaxRuleMapper.selectByExample(new OrganizationTaxRuleExample()); 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()); Organization o = orgMap.get(td.getCompanyId());
AnalysisFileManagement afm = new AnalysisFileManagement(); AnalysisFileManagement afm = new AnalysisFileManagement();
afm.setId(idService.nextId()); afm.setId(idService.nextId());
...@@ -576,7 +589,14 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -576,7 +589,14 @@ public class AnalysisJobServiceImpl extends BaseService {
// 周期性上传 校验当年的当前及之前的周期是否有上传文件 // 周期性上传 校验当年的当前及之前的周期是否有上传文件
if (StringUtils.isNotEmpty(td.getTaxType()) && null != td.getOwnTime()) { 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()); afm.setReportingFrequency(rule.getTaxDecCycle());
String archivingStatus = "未归档"; String archivingStatus = "未归档";
TaxDocumentExample example = new TaxDocumentExample(); TaxDocumentExample example = new TaxDocumentExample();
...@@ -608,6 +628,22 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -608,6 +628,22 @@ public class AnalysisJobServiceImpl extends BaseService {
afm.setCompanyName(o.getName()); afm.setCompanyName(o.getName());
afm.setPeriod(period); afm.setPeriod(period);
analysisFileManagementMapper.insertSelective(afm); 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; ...@@ -8,6 +8,7 @@ import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper; import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.ResponseMessageBuilder; import pwc.taxtech.atms.common.ResponseMessageBuilder;
import pwc.taxtech.atms.common.util.BeanUtil; import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.security.dd.DtsTokenService;
public class BaseService { public class BaseService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
...@@ -28,5 +29,7 @@ public class BaseService { ...@@ -28,5 +29,7 @@ public class BaseService {
protected CommonDocumentHelper commonDocumentHelper; protected CommonDocumentHelper commonDocumentHelper;
@Autowired @Autowired
protected ResponseMessageBuilder responseMessageBuilder; protected ResponseMessageBuilder responseMessageBuilder;
@Autowired
protected DtsTokenService dtsTokenService;
} }
...@@ -42,6 +42,7 @@ import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto; ...@@ -42,6 +42,7 @@ import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam; import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.security.dd.DtsTokenService;
import pwc.taxtech.atms.vat.dao.*; import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
...@@ -1849,7 +1850,7 @@ public class DataImportService extends BaseService { ...@@ -1849,7 +1850,7 @@ public class DataImportService extends BaseService {
orgs.forEach(o -> { orgs.forEach(o -> {
try { try {
Callable callEbs = new CallEbsThread(type, o,ebsCallUrl,dataImportLogMapper,authUserHelper, Callable callEbs = new CallEbsThread(type, o,ebsCallUrl,dataImportLogMapper,authUserHelper,
idService,period, effectiveDateFrom, effectiveDateTo); idService,dtsTokenService,period, effectiveDateFrom, effectiveDateTo);
executorService.submit(callEbs); executorService.submit(callEbs);
// resList.add(future); // resList.add(future);
} catch (RejectedExecutionException rje) { } catch (RejectedExecutionException rje) {
...@@ -1872,6 +1873,12 @@ public class DataImportService extends BaseService { ...@@ -1872,6 +1873,12 @@ public class DataImportService extends BaseService {
logger.error(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), e.getMessage()), e); 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; /*int res = 0;
...@@ -1957,18 +1964,21 @@ public class DataImportService extends BaseService { ...@@ -1957,18 +1964,21 @@ public class DataImportService extends BaseService {
private DistributedIdService idService; private DistributedIdService idService;
private DtsTokenService dtsTokenService;
private String effectiveDateFrom; private String effectiveDateFrom;
private String effectiveDateTo; private String effectiveDateTo;
CallEbsThread(int type, Organization org,String ebsCallUrl,DataImportLogMapper dataImportLogMapper, CallEbsThread(int type, Organization org, String ebsCallUrl, DataImportLogMapper dataImportLogMapper,
AuthUserHelper authUserHelper,DistributedIdService idService,String period, AuthUserHelper authUserHelper, DistributedIdService idService, DtsTokenService dtsTokenService,
String effectiveDateFrom, String effectiveDateTo) { String period,String effectiveDateFrom, String effectiveDateTo) {
this.type = type; this.type = type;
this.org = org; this.org = org;
this.period = period; this.period = period;
this.ebsCallUrl = ebsCallUrl; this.ebsCallUrl = ebsCallUrl;
this.authUserHelper = authUserHelper; this.authUserHelper = authUserHelper;
this.dtsTokenService = dtsTokenService;
this.idService = idService; this.idService = idService;
this.dataImportLogMapper = dataImportLogMapper; this.dataImportLogMapper = dataImportLogMapper;
this.effectiveDateFrom = effectiveDateFrom; this.effectiveDateFrom = effectiveDateFrom;
...@@ -2008,44 +2018,46 @@ public class DataImportService extends BaseService { ...@@ -2008,44 +2018,46 @@ public class DataImportService extends BaseService {
dataImportLogMapper.insertSelective(log); dataImportLogMapper.insertSelective(log);
return 0; return 0;
} }
String secureToken = dtsTokenService.encryptInput();
Map<String,String> headers = new HashMap<>();
headers.put("secureToken",secureToken);
switch (type) { switch (type) {
case EbsExtractTypeConstant.TB: case EbsExtractTypeConstant.TB:
response = HttpUtil.post(ebsCallUrl + "/glMonthlyBal?ledgerId="+ledgerId+"&companyCode="+ code + "&period=" + period, 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; break;
case EbsExtractTypeConstant.JE: case EbsExtractTypeConstant.JE:
// 这里BA反馈可按期间获取当月日记账即可 // 这里BA反馈可按期间获取当月日记账即可
String effecDateFrom = DateUtils.getFirstDayOfMonth(year,month); String effecDateFrom = DateUtils.getFirstDayOfMonth(year,month);
String effecDateTo = DateUtils.getLastDayOfMonth(year,month); String effecDateTo = DateUtils.getLastDayOfMonth(year,month);
response = HttpUtil.post(ebsCallUrl + "/glJeLines"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&effectiveDateFrom=" + effecDateFrom+"&effectiveDateTo="+effecDateTo, 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; break;
case EbsExtractTypeConstant.BSPRC: case EbsExtractTypeConstant.BSPRC:
response = HttpUtil.post(ebsCallUrl + "/fsgAsset"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=Y", response = HttpUtil.post(ebsCallUrl + "/fsgAsset"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=Y",
"", headers,"application/json;charset=utf-8", "UTF-8", 10000, 10000);
"application/json;charset=utf-8", "UTF-8", 10000, 10000);
break; break;
case EbsExtractTypeConstant.PLPRC: case EbsExtractTypeConstant.PLPRC:
response = HttpUtil.post(ebsCallUrl + "/fsgProfit"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=Y", 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; break;
case EbsExtractTypeConstant.BS: case EbsExtractTypeConstant.BS:
response = HttpUtil.post(ebsCallUrl + "/fsgAsset"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=N", 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; break;
case EbsExtractTypeConstant.PL: case EbsExtractTypeConstant.PL:
response = HttpUtil.post(ebsCallUrl + "/fsgProfit"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period+"&prcFlag=N", 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; break;
case EbsExtractTypeConstant.CF: case EbsExtractTypeConstant.CF:
response = HttpUtil.post(ebsCallUrl + "/fsgCash"+"?ledgerId=" + ledgerId + "&companyCode=" + code + "&period=" + period, 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; break;
case EbsExtractTypeConstant.OCTB: case EbsExtractTypeConstant.OCTB:
break; break;
case EbsExtractTypeConstant.RATE: case EbsExtractTypeConstant.RATE:
response = HttpUtil.post(ebsCallUrl + "/dailyRates"+"?period=" + period, 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; break;
default: default:
break; break;
......
...@@ -36,12 +36,14 @@ ...@@ -36,12 +36,14 @@
<list> <list>
<ref bean="lgApiJobTrigger"/> <ref bean="lgApiJobTrigger"/>
<ref bean="orgSyncJobTrigger"/> <ref bean="orgSyncJobTrigger"/>
<ref bean="analysisJobTrigger"/>
</list> </list>
</property> </property>
<property name="jobDetails"> <property name="jobDetails">
<list> <list>
<ref bean="lgGlBalanceJob"/> <ref bean="lgGlBalanceJob"/>
<ref bean="orgSyncJob"/> <ref bean="orgSyncJob"/>
<ref bean="analysisJob"/>
</list> </list>
</property> </property>
<property name="taskExecutor" ref="executor"/> <property name="taskExecutor" ref="executor"/>
...@@ -68,11 +70,24 @@ ...@@ -68,11 +70,24 @@
<property name="description" value="机构信息同步"/> <property name="description" value="机构信息同步"/>
</bean> </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日执行一次--> <!-- 每月1日执行一次-->
<bean id="orgSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <bean id="orgSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="orgSyncJob"/> <property name="jobDetail" ref="orgSyncJob"/>
<property name="cronExpression" value="0 0 0 1 * ?"/> <property name="cronExpression" value="0 0 0 1 * ?"/>
</bean> </bean>
<!-- 每天凌晨一点执行一次-->
<bean id="analysisJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="analysisJob"/>
<property name="cronExpression" value="0 0 1 * * ?"/>
</bean>
<!-- 分布式事务配置 end --> <!-- 分布式事务配置 end -->
</beans> </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; ...@@ -11,6 +11,7 @@ import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample; import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.OrganizationExtra; import pwc.taxtech.atms.entity.OrganizationExtra;
import pwc.taxtech.atms.entity.OrganizationExtraExample; import pwc.taxtech.atms.entity.OrganizationExtraExample;
import pwc.taxtech.atms.security.dd.DtsTokenService;
import java.util.List; import java.util.List;
......
...@@ -246,7 +246,7 @@ public interface ProjectMapper extends MyMapper { ...@@ -246,7 +246,7 @@ public interface ProjectMapper extends MyMapper {
" AND b.service_type_id = #{serviceType}") " AND b.service_type_id = #{serviceType}")
Long getTemplateGroupIdByProject(@Param("projectId") String projectId, @Param("serviceType") Integer 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); 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 @@ ...@@ -16,7 +16,7 @@
#{item} #{item}
</foreach> </foreach>
and p.year = #{year} and p.year = #{year}
and p.stat_period &lt; #{month} and p.start_period &lt; #{month}
and p.end_period &gt; #{month} and p.end_period &gt; #{month}
and t.name = #{reportName} and t.name = #{reportName}
</select> </select>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
on pp.template_id = t.id on pp.template_id = t.id
where p.organization_id = #{orgId} where p.organization_id = #{orgId}
and p.year = #{year} and p.year = #{year}
and p.stat_period &lt; #{month} and p.start_period &lt; #{month}
and p.end_period &gt; #{month} and p.end_period &gt; #{month}
and t.code = #{code} and t.code = #{code}
</select> </select>
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
</select> </select>
<select id = "selectAnalysisSalesValueDto" resultType="pwc.taxtech.atms.dpo.AnalysisSalesValueDto"> <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 from
period_cell_data pcd period_cell_data pcd
left join period_cell_template pct left join period_cell_template pct
......
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
.success(function (res) { .success(function (res) {
if (res && 0 === res.code) { if (res && 0 === res.code) {
$scope.selectOrgList = res.data; $scope.selectOrgList = res.data;
$scope.refreshConfigGrid();
}else { }else {
SweetAlert.error($translate.instant('RevenueGetOrgError')); SweetAlert.error($translate.instant('RevenueGetOrgError'));
} }
...@@ -275,7 +276,7 @@ ...@@ -275,7 +276,7 @@
function init() { function init() {
getMyOrgList(); getMyOrgList();
$scope.refreshConfigGrid();
} }
init() init()
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
.success(function (res) { .success(function (res) {
if (res && 0 === res.code) { if (res && 0 === res.code) {
$scope.selectOrgList = res.data; $scope.selectOrgList = res.data;
$scope.refreshConfigGrid();
}else { }else {
SweetAlert.error($translate.instant('RevenueGetOrgError')); SweetAlert.error($translate.instant('RevenueGetOrgError'));
} }
...@@ -344,7 +345,7 @@ ...@@ -344,7 +345,7 @@
function init() { function init() {
getMyOrgList(); getMyOrgList();
$scope.refreshConfigGrid();
} }
init() 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