Commit 08fc627f authored by kevin's avatar kevin

#

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