Commit 791d25fb authored by Memorydoc's avatar Memorydoc

#

parent 6ffa49d4
......@@ -61,7 +61,6 @@ public class AnalysisJob extends QuartzJobBean {
logger.info(String.format("开始分析%税种税金计算数据",period));
analysisJobService.analysisTax(orgs,period, EnumTbImportType.CoverImport.getCode());
}
}
......@@ -16,6 +16,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.analysis.dao.*;
import pwc.taxtech.atms.analysis.entity.*;
......@@ -98,6 +99,7 @@ public class AnalysisJobServiceImpl extends BaseService {
private final static List<Integer> MONTH_LIST = Lists.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
private final static List<Integer> Q_LIST = Lists.newArrayList(3, 6, 9, 12);
private final static List<Integer> ZZS_DATE_LIST = Lists.newArrayList(1, 4, 7, 10);
/**
......@@ -110,6 +112,7 @@ public class AnalysisJobServiceImpl extends BaseService {
* @author Gary J Li
*/
public void analysisMaster(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisMasterExample example = new AnalysisMasterExample();
......@@ -535,7 +538,6 @@ public class AnalysisJobServiceImpl extends BaseService {
*/
public void analysisExpectedTax(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
if (type.equals(EnumTbImportType.CoverImport.getCode())) {
AnalysisExpectedTaxReturnExample example = new AnalysisExpectedTaxReturnExample();
example.createCriteria().andOrganizationIdIn(orgIds).andPeriodEqualTo(period);
......@@ -553,7 +555,7 @@ public class AnalysisJobServiceImpl extends BaseService {
atMap.forEach((k, v) -> {
try {
List<OrganizationReturnRate> orgsOrr = orrs.stream().filter(orr -> orr.getOrganizationId().equals(k)).collect(Collectors.toList());
//List<OrganizationReturnRate> orgsOrr = orrs.stream().filter(orr -> orr.getOrganizationId().equals(k)).collect(Collectors.toList());
Map<String, List<OrganizationReturnRate>> orgOrrMap = orrs.stream().collect(Collectors.groupingBy(OrganizationReturnRate::getGroupName));
AnalysisExpectedTaxReturn aetr = new AnalysisExpectedTaxReturn();
aetr.setId(idService.nextId());
......@@ -561,13 +563,19 @@ public class AnalysisJobServiceImpl extends BaseService {
for (AnalysisTax at : v) {
if ("增值税".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment1(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate()));
} else if ("附加税".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment2(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate()));
aetr.setSegment1(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate() / 100));
} else if ("个人所得税".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment2(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate()));
aetr.setSegment3(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate() / 100));
} else if ("教育费附加".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment4(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate() / 100));
} else if ("城市教育费附加".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment5(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate() / 100));
} else if ("城建税".equals(at.getTaxGroup()) && orgOrrMap.get(at.getTaxGroup()) != null) {
OrganizationReturnRate orr = orgOrrMap.get(at.getTaxGroup()).get(0);
aetr.setSegment6(new BigDecimal(at.getTaxAmount().floatValue() * orr.getReturnRate() / 100));
}
}
aetr.setOrganizationId(k);
......@@ -611,19 +619,20 @@ public class AnalysisJobServiceImpl extends BaseService {
Organization org = orgMap.get(k);
String subjectCode = tb.getSegment3();
af.setSeqNo(getSeqNoByPeriod(tb.getOrganizationId(), period));
af.setSubject(subjectCode);
af.setFeeClassification1(tb.getAcctName1());
af.setFeeClassification2(tb.getAcctName2());
af.setFeeClassification3(tb.getAcctName3());
// 这里费用取的 本位币本期借方发生额
af.setFee(tb.getPeriodDrBeq());
String interrelatedDeal = "";
if (subjectCode == "60050100") return;
if (subjectCode.startsWith("6")) {
// 这里取得公司间代码是否为0
interrelatedDeal = "0".equals(tb.getSegment8()) ? "否" : "是";
} else if (subjectCode.startsWith("8")) {
} else if (subjectCode.startsWith("8002")) {
interrelatedDeal = "是";
}
af.setSubject(subjectCode.substring(-2) + "00");
af.setInterrelatedDeal(interrelatedDeal);
af.setOrganizationId(org.getId());
af.setCompanyName(org.getName());
......@@ -633,6 +642,9 @@ public class AnalysisJobServiceImpl extends BaseService {
});
}
@Autowired
private OrganizationApprovedLevyInfoMapper organizationApprovedLevyInfoMapper;
/**
* 19/03/2019 15:59
* tax_document
......@@ -652,13 +664,11 @@ public class AnalysisJobServiceImpl extends BaseService {
TaxDocumentExample e1 = new TaxDocumentExample();
e1.createCriteria().andCompanyIdIn(orgIds).andOwnTimeEqualTo(period);
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()));
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();
......@@ -675,12 +685,17 @@ public class AnalysisJobServiceImpl extends BaseService {
if (null == rule) {
break;
}
afm.setReportingFrequency(rule.getTaxDecCycle());
// afm.setReportingFrequency(rule.getTaxDecCycle());
String reporingFrequency = "/";
if (td.getFileType().indexOf("所属期间") != -1 || td.getFileType().indexOf("税种") != -1) {
OrganizationApprovedLevyInfoExample example = new OrganizationApprovedLevyInfoExample();
example.createCriteria().andOrganizationIdEqualTo(o.getId());
List<OrganizationApprovedLevyInfo> organizationApprovedLevyInfos = organizationApprovedLevyInfoMapper.selectByExample(example);
reporingFrequency = organizationApprovedLevyInfos.get(0).getApprovedTaxPeriod();
}
afm.setReportingFrequency(reporingFrequency);
String archivingStatus = "未归档";
TaxDocumentExample example = new TaxDocumentExample();
List<Integer> fileterTime = Lists.newArrayList();
if ("年度".equals(rule.getTaxDecCycle())) {
/*if ("年度".equals(rule.getTaxDecCycle())) {
Integer str = DateUtils.getNowYear() * 100;
Integer end = DateUtils.getNowYear() * 100 + 12;
example.createCriteria().andOwnTimeGreaterThanOrEqualTo(str).andOwnTimeLessThanOrEqualTo(end).andFileTypeEqualTo(td.getFileType());
......@@ -696,13 +711,28 @@ public class AnalysisJobServiceImpl extends BaseService {
});
example.createCriteria().andOwnTimeIn(fileterTime).andFileTypeEqualTo(td.getFileType());
archivingStatus = taxDocumentMapper.countByExample(example) > 0 ? "已归档" : archivingStatus;
}
}*/
if (td.getFileType().indexOf("增值税") != -1) {
if( ZZS_DATE_LIST.contains(td.getOwnTime()%100)){
archivingStatus = "已归档";
}
} else if (td.getFileType().indexOf("印花税") != -1) {
List<AnalysisFileManagement> maps = analysisFileManagementMapper.getYHSsql(getYHSsql(String.valueOf(td.getOwnTime() / 100), td.getFileType()));
if(maps.size() != 0)
archivingStatus = "已归档";
}/*else{
TaxDocumentExample example = new TaxDocumentExample();
example.createCriteria().andOwnTimeEqualTo(td.getOwnTime());
if(taxDocumentMapper.selectByExample(example).size() != 0)
archivingStatus = "已归档";
}*/
afm.setArchivingStatus(archivingStatus);
} else {
afm.setReportingFrequency("/");
// 由于是根据文档列表查询 必然已归档
afm.setArchivingStatus("已归档");
}
afm.setOrganizationId(o.getId());
afm.setCompanyName(o.getName());
afm.setPeriod(period);
......@@ -710,6 +740,15 @@ public class AnalysisJobServiceImpl extends BaseService {
}
}
@Autowired
private JdbcTemplate jdbcTemplate;
public String getYHSsql(String year, String fileType){
String str = "";
str.format("select * from tax_document t where t.own_time like %s and t.file_type = %s", year, fileType);
return str;
}
public void analysisTax(List<Organization> orgs, Integer period, Integer type) {
List<String> orgIds = orgs.stream().map(Organization::getId).collect(Collectors.toList());
......@@ -765,7 +804,7 @@ public class AnalysisJobServiceImpl extends BaseService {
values.forEach(v -> {
vMap.put(v.getRowIndex() + ":" + v.getColumnIndex(), v.getData());
});
BigDecimal zzse = getSegmentAmount(vMap, 42, 35).add(getSegmentAmount(vMap, 42, 18));
BigDecimal zzse = getSegmentAmount(vMap, 24, 10);
analysisTaxMapper.insertSelective(as);
} catch (Exception e) {
logger.error(String.format("公司:[%s]生成应缴税额表分析数据失败!", o.getName()), e);
......
......@@ -1608,7 +1608,7 @@ public class ReportServiceImpl extends BaseService {
ebitDataDto.setEbitRate(ebitRate + "%");
}
ebitDataDto.setSixAddTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.06)));
ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.16)));
ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(1.06)));
ebitDataDto.setSpecialConsiderations(specialConsiderations);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -13,10 +13,12 @@
<property name="queueCapacity" value="100"/>
</bean>
<bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- quartzScheduler -->
<!-- 配置调度任务-->
<bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="configLocation" value="classpath:job.properties"/>
......@@ -49,45 +51,55 @@
<property name="taskExecutor" ref="executor"/>
</bean>
<!-- 配置Job详情 -->
<!-- lgGlBalanceJob -->
<bean name="lgGlBalanceJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.LgGlBalanceJob"/>
<property name="durability" value="true"/>
<property name="requestsRecovery" value="false"/>
<property name="description" value="科目余额数据同步"/>
</bean>
<!-- 定时任务 -->
<bean id="lgApiJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="lgGlBalanceJob"/>
<property name="cronExpression" value="0 0 1 3 * ?"/>
</bean>
<!--orgSyncJob-->
<bean name="orgSyncJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.OrgSyncJob"/>
<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>
<!--analysisJob-->
<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.analysis.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyAnalysisMapper;
import pwc.taxtech.atms.analysis.entity.AnalysisFileManagement;
......@@ -105,4 +105,6 @@ public interface AnalysisFileManagementMapper extends MyAnalysisMapper {
* @mbg.generated
*/
int updateByPrimaryKey(AnalysisFileManagement record);
@Select("#{sql}")
List<AnalysisFileManagement> getYHSsql(@Param("sql") String sql );
}
\ No newline at end of file
......@@ -3117,7 +3117,6 @@
var glfy = nullToZero(sheet.getValue(15, 2));//管理费用
var yffy = nullToZero(sheet.getValue(16, 2));//研发费用
var zcjzss = nullToZero(sheet.getValue(18, 2));//资产减值损失
var ts = nullToZero(sheet.getValue(38, 2));
var rate = 1;
if(sheet.getValue(40, 2) != null){
......
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