Commit 08fc627f authored by kevin's avatar kevin

#

parent 5e2fe986
...@@ -56,9 +56,8 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*; ...@@ -56,9 +56,8 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component @Component
public class CitReportServiceImpl extends BaseService { public class CitReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class);
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX", private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE", "SUM2", "SUM", "RSUMIF", "TABLESUM2"}; "JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "TABLESUMIF", "SUM"};
@Autowired @Autowired
private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper; private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper;
...@@ -166,13 +165,13 @@ public class CitReportServiceImpl extends BaseService { ...@@ -166,13 +165,13 @@ public class CitReportServiceImpl extends BaseService {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
//验证传入的业务类型参数和后台CIT所代表的业务类型是否一致 //验证传入的业务类型参数和后台CIT所代表的业务类型是否一致
MyAsserts.assertEq(serviceType, EnumServiceType.CIT, new NotFoundException()); MyAsserts.assertEq(serviceType, EnumServiceType.CIT, new NotFoundException());
MyAsserts.assertNull(periodJobMapper.getRunningJob(projectId,periodParam), Exceptions.TASK_HAS_BEGINNING); MyAsserts.assertNull(periodJobMapper.getRunningJob(projectId, periodParam), Exceptions.TASK_HAS_BEGINNING);
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam); String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam);
MyAsserts.assertTrue(status == null || !status.equals(Constant.APPROVAL_COMMITTED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION); MyAsserts.assertTrue(status == null || !status.equals(Constant.APPROVAL_COMMITTED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try { try {
//根据projectId获取相关报表 //根据projectId获取相关报表
List<Template> templates = getTemplatesByProjectId(projectId); List<Template> templates = getTemplatesByProjectId(projectId);
List<String> dataValidateArray= new ArrayList<String>(); List<String> dataValidateArray = new ArrayList<String>();
/*dataValidateArray.add("DA001"); /*dataValidateArray.add("DA001");
dataValidateArray.add("DA002"); dataValidateArray.add("DA002");
dataValidateArray.add("DA003");*/ dataValidateArray.add("DA003");*/
...@@ -186,7 +185,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -186,7 +185,7 @@ public class CitReportServiceImpl extends BaseService {
try { try {
// TODO 进行数据校验 // TODO 进行数据校验
DataValidation(periodParam, projectId,genJob ); DataValidation(periodParam, projectId, genJob);
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob); updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
...@@ -202,12 +201,12 @@ public class CitReportServiceImpl extends BaseService { ...@@ -202,12 +201,12 @@ public class CitReportServiceImpl extends BaseService {
evaluator.evaluateAll(); evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob); reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
setStatus(genJob,STATUS_END); setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
} catch (Exception e) { } catch (Exception e) {
setStatus(genJob, STATUS_ERROR); setStatus(genJob, STATUS_ERROR);
e.printStackTrace(); e.printStackTrace();
genJob.setErrorMsg("Sever error "+e.getClass().getName()); genJob.setErrorMsg("Sever error " + e.getClass().getName());
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
} }
} }
...@@ -224,6 +223,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -224,6 +223,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 根据projectId(卡片ID)获取模板 * 根据projectId(卡片ID)获取模板
*
* @param projectId * @param projectId
* @return * @return
*/ */
...@@ -247,6 +247,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -247,6 +247,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 根据报表模板组ID查询在该组的报表模板 * 根据报表模板组ID查询在该组的报表模板
*
* @param templateGroupId * @param templateGroupId
* @return * @return
*/ */
...@@ -260,7 +261,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -260,7 +261,7 @@ public class CitReportServiceImpl extends BaseService {
private CitJour*/ private CitJour*/
//数据校验 //数据校验
private void DataValidation(Integer periodParam, String projectId, PeriodJob genJob) { private void DataValidation(Integer periodParam, String projectId, PeriodJob genJob) {
setStatus(genJob,"DA004", STATUS_BEGIN); setStatus(genJob, "DA004", STATUS_BEGIN);
//本期余额表 //本期余额表
/* TrialBalanceExample trialBalanceExample = new TrialBalanceExample(); /* TrialBalanceExample trialBalanceExample = new TrialBalanceExample();
...@@ -280,18 +281,18 @@ public class CitReportServiceImpl extends BaseService { ...@@ -280,18 +281,18 @@ public class CitReportServiceImpl extends BaseService {
Map<String, Object> map1 = new HashedMap(); Map<String, Object> map1 = new HashedMap();
map1.put("projectId", projectId); map1.put("projectId", projectId);
map1.put("period", periodParam); map1.put("period", periodParam);
if((periodParam+"").length() == 1){ if ((periodParam + "").length() == 1) {
map1.put("period", "0"+ periodParam); map1.put("period", "0" + periodParam);
}else{ } else {
map1.put("period", "" + periodParam); map1.put("period", "" + periodParam);
} }
List<AdjustmentTable> adjustmentTables = adjustmentTableMapper.selectBeforeAdjustData(map1); List<AdjustmentTable> adjustmentTables = adjustmentTableMapper.selectBeforeAdjustData(map1);
Map<String, Object> map2 = new HashedMap(); Map<String, Object> map2 = new HashedMap();
map2.put("projectId", projectId); map2.put("projectId", projectId);
if((periodParam+"").length() == 1){ if ((periodParam + "").length() == 1) {
map2.put("period", "0"+ periodParam); map2.put("period", "0" + periodParam);
}else{ } else {
map2.put("period", "" + periodParam); map2.put("period", "" + periodParam);
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
...@@ -301,14 +302,14 @@ public class CitReportServiceImpl extends BaseService { ...@@ -301,14 +302,14 @@ public class CitReportServiceImpl extends BaseService {
map.put("companyCode", mapProject.get("code")); map.put("companyCode", mapProject.get("code"));
map.put("companyName", mapProject.get("name")); map.put("companyName", mapProject.get("name"));
List<JournalEntry> journalEntries = journalEntryMapper.selectNowAdjustData(map2); List<JournalEntry> journalEntries = journalEntryMapper.selectNowAdjustData(map2);
for(int i =0; i< adjustmentTables.size(); i++){ for (int i = 0; i < adjustmentTables.size(); i++) {
for(int j =0; j< journalEntries.size(); j++){ for (int j = 0; j < journalEntries.size(); j++) {
JournalEntry journalEntry = journalEntries.get(j); JournalEntry journalEntry = journalEntries.get(j);
AdjustmentTable adjustmentTable = adjustmentTables.get(j); AdjustmentTable adjustmentTable = adjustmentTables.get(j);
if(journalEntry.getSegment3().equals(adjustmentTable.getSegment3()) && if (journalEntry.getSegment3().equals(adjustmentTable.getSegment3()) &&
journalEntry.getSegment5().equals(adjustmentTable.getSegment5())&& journalEntry.getSegment5().equals(adjustmentTable.getSegment5()) &&
journalEntry.getSegment6().equals(adjustmentTable.getSegment6()) && journalEntry.getPeriodJrMinDr() != adjustmentTable.getPeriodDrMixCr() ){ journalEntry.getSegment6().equals(adjustmentTable.getSegment6()) && journalEntry.getPeriodJrMinDr() != adjustmentTable.getPeriodDrMixCr()) {
setStatus(genJob,STATUS_ERROR ); setStatus(genJob, STATUS_ERROR);
Constant.ReportDataValidateLog reportDataValidateLog = new Constant.ReportDataValidateLog(journalEntries.get(j).getSegment3(), journalEntries.get(j).getSegment5(), journalEntries.get(j).getSegment6()); Constant.ReportDataValidateLog reportDataValidateLog = new Constant.ReportDataValidateLog(journalEntries.get(j).getSegment3(), journalEntries.get(j).getSegment5(), journalEntries.get(j).getSegment6());
//记录校验结果 //记录校验结果
// //
...@@ -333,22 +334,23 @@ public class CitReportServiceImpl extends BaseService { ...@@ -333,22 +334,23 @@ public class CitReportServiceImpl extends BaseService {
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
} }
public void insertDataValidateResult(Map map){ public void insertDataValidateResult(Map map) {
DataValidateLog dataValidateLog = new DataValidateLog(); DataValidateLog dataValidateLog = new DataValidateLog();
dataValidateLog.setCreateTime(new Date()); dataValidateLog.setCreateTime(new Date());
dataValidateLog.setPeriod((Integer) map.get("period")); dataValidateLog.setPeriod((Integer) map.get("period"));
dataValidateLog.setProjectId((String)map.get("projectId")); dataValidateLog.setProjectId((String) map.get("projectId"));
dataValidateLog.setValidateResult((String)map.get("validateResult")); dataValidateLog.setValidateResult((String) map.get("validateResult"));
dataValidateLog.setResult((String)map.get("result")); dataValidateLog.setResult((String) map.get("result"));
dataValidateLog.setOrganizationId((String)map.get("organizationId")); dataValidateLog.setOrganizationId((String) map.get("organizationId"));
dataValidateLog.setCompanyCode((String)map.get("companyCode")); dataValidateLog.setCompanyCode((String) map.get("companyCode"));
dataValidateLog.setCompanyName((String)map.get("companyName")); dataValidateLog.setCompanyName((String) map.get("companyName"));
dataValidateLog.setTmsPeriod((Integer) map.get("tmsPeriod")); dataValidateLog.setTmsPeriod((Integer) map.get("tmsPeriod"));
dataValidateLogMapper.insert(dataValidateLog); dataValidateLogMapper.insert(dataValidateLog);
} }
/** /**
* 清除配置,复制配置 * 清除配置,复制配置
*
* @param projectId * @param projectId
* @param period * @param period
* @param isMergeManualData * @param isMergeManualData
...@@ -367,6 +369,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -367,6 +369,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 清除配置 * 清除配置
*
* @param projectId * @param projectId
* @param period * @param period
* @param templateIds * @param templateIds
...@@ -446,6 +449,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -446,6 +449,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 复制各种配置 * 复制各种配置
*
* @param projectId * @param projectId
* @param templates * @param templates
* @param period * @param period
...@@ -488,6 +492,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -488,6 +492,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 复制报表模板单元格定位及相关信息到卡片单元格模板 * 复制报表模板单元格定位及相关信息到卡片单元格模板
*
* @param projectId * @param projectId
* @param templateId * @param templateId
* @param period * @param period
...@@ -521,7 +526,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -521,7 +526,7 @@ public class CitReportServiceImpl extends BaseService {
periodCellTemplateList.add(periodCellTemplate); periodCellTemplateList.add(periodCellTemplate);
} }
CommonUtils.subListWithLen(periodCellTemplateList,CommonUtils.BATCH_NUM).forEach(batch->{ CommonUtils.subListWithLen(periodCellTemplateList, CommonUtils.BATCH_NUM).forEach(batch -> {
periodCellTemplateMapper.batchInsert(batch); periodCellTemplateMapper.batchInsert(batch);
}); });
...@@ -531,6 +536,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -531,6 +536,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 复制单元格内容到卡片单元格内容 * 复制单元格内容到卡片单元格内容
*
* @param projectId * @param projectId
* @param templateId * @param templateId
* @param period * @param period
...@@ -584,7 +590,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -584,7 +590,7 @@ public class CitReportServiceImpl extends BaseService {
periodCellTemplateConfigList.add(periodCellTemplateConfig); periodCellTemplateConfigList.add(periodCellTemplateConfig);
} }
CommonUtils.subListWithLen(periodCellTemplateConfigList,CommonUtils.BATCH_NUM).forEach(batch->{ CommonUtils.subListWithLen(periodCellTemplateConfigList, CommonUtils.BATCH_NUM).forEach(batch -> {
periodCellTemplateConfigMapper.batchInsert(batch); periodCellTemplateConfigMapper.batchInsert(batch);
}); });
...@@ -592,6 +598,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -592,6 +598,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 固定转换公式 * 固定转换公式
*
* @param pctc * @param pctc
*/ */
private void fixedParsedFormula(PeriodCellTemplateConfig pctc) { private void fixedParsedFormula(PeriodCellTemplateConfig pctc) {
...@@ -627,6 +634,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -627,6 +634,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 未知用途。。 * 未知用途。。
*
* @param pctc * @param pctc
*/ */
private void fixedAccountCode(PeriodCellTemplateConfig pctc) { private void fixedAccountCode(PeriodCellTemplateConfig pctc) {
...@@ -650,6 +658,7 @@ public class CitReportServiceImpl extends BaseService { ...@@ -650,6 +658,7 @@ public class CitReportServiceImpl extends BaseService {
/** /**
* 获取符合条件的PeriodJob以供前台判断job执行的阶段 * 获取符合条件的PeriodJob以供前台判断job执行的阶段
*
* @param projectId * @param projectId
* @param period * @param period
* @param jobId * @param jobId
...@@ -663,8 +672,8 @@ public class CitReportServiceImpl extends BaseService { ...@@ -663,8 +672,8 @@ public class CitReportServiceImpl extends BaseService {
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>(); OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
CommonUtils.copyProperties(getReportTemplate(projectId,serviceType,periodParam),result); CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result);
if(!result.getResult() || CollectionUtils.isEmpty(result.getData())) { if (!result.getResult() || CollectionUtils.isEmpty(result.getData())) {
return result; return result;
} }
int period = periodParam != null ? periodParam : 0; int period = periodParam != null ? periodParam : 0;
......
...@@ -131,7 +131,6 @@ public class FormulaAgent { ...@@ -131,7 +131,6 @@ public class FormulaAgent {
public PeriodCellData getCellData(String templateId, String cellId, int periodId, String projectId) { public PeriodCellData getCellData(String templateId, String cellId, int periodId, String projectId) {
PeriodReport report = getReportByTemplate(templateId, periodId, projectId); PeriodReport report = getReportByTemplate(templateId, periodId, projectId);
MyAsserts.assertNotNull(report, Exceptions.BB_REPORT_NULL); MyAsserts.assertNotNull(report, Exceptions.BB_REPORT_NULL);
PeriodCellData cellData = getCellDataListByTemplate(cellId, report.getId()); PeriodCellData cellData = getCellDataListByTemplate(cellId, report.getId());
MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL); MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL);
return cellData; return cellData;
......
...@@ -512,7 +512,7 @@ public class ReportGeneratorImpl { ...@@ -512,7 +512,7 @@ public class ReportGeneratorImpl {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext), FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext) new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext), , new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext),
new JFFS(formulaContext), new WPSR(formulaContext),new WPNAME(formulaContext),new WPTYPE(formulaContext), new SUM2(formulaContext), new JFFS(formulaContext), new WPSR(formulaContext), new WPNAME(formulaContext), new WPTYPE(formulaContext), new SUM2(formulaContext),
new SUM(formulaContext), new RSUMIF(formulaContext), new TABLESUMIF(formulaContext)}; new SUM(formulaContext), new RSUMIF(formulaContext), new TABLESUMIF(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls); UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs); UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
......
...@@ -60,7 +60,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -60,7 +60,7 @@ public class ReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>(); private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX", private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE"}; "JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE", "SUM2", "RSUMIF", "TABLESUMIF", "SUM"};
@Autowired @Autowired
private ReportGeneratorImpl reportGenerator; private ReportGeneratorImpl reportGenerator;
......
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