Commit 0ffde69d authored by neo's avatar neo

[DEV] bb formular args context fixed

parent 77dfceae
......@@ -16,20 +16,20 @@ public class BBParasBo {
private Integer period;
private Integer year;
public BBParasBo(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException {
public BBParasBo(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException {
reportCode = resolverString(args, ec, 0);
columnIndex = resolverInteger(args, ec, 1);
rowIndex = resolverInteger(args, ec, 3);
period = resolverInteger(args, ec, 4);
year = resolverInteger(args, ec, 5);
rowIndex = resolverInteger(args, ec, 2);
period = args.length == 4 ? resolverInteger(args, ec, 3) : 0;
year = args.length == 5 ? resolverInteger(args, ec, 4) : 0;
}
public void disCount(){
public void disCount() {
rowIndex--;
columnIndex--;
}
public BBParasBo(BBParasBo otherBo,int period,int curYear) {
public BBParasBo(BBParasBo otherBo, int period, int curYear) {
this.reportCode = otherBo.reportCode;
this.columnIndex = otherBo.getColumnIndex();
this.rowIndex = otherBo.rowIndex;
......
......@@ -72,7 +72,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
}
@Override
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public OperationResultDto saveOrEdit(CellTemplateConfigDto cellTemplateConfig) {
OperationResultDto result = new OperationResultDto();
CellTemplate cellTemplate = cellTemplateMapper.selectByPrimaryKey(cellTemplateConfig.getCellTemplateID());
......@@ -118,7 +118,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
OperationResultDto<List<CellTemplateConfig>> operationResultDto = new OperationResultDto<>();
List<CellTemplateConfig> cellTemplateConfigList = new ArrayList<>();
if (cellTemplateConfigDto.getHasFormula()) {
if (cellTemplateConfigDto.getHasFormula() != null && cellTemplateConfigDto.getHasFormula()) {
operationResultDto.setResultMsg(getFormulaDataSource(cellTemplateConfigDto.getFormula(), keyValueIds));
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
......@@ -135,7 +135,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasVoucher()) {
if (cellTemplateConfigDto.getHasVoucher() != null && cellTemplateConfigDto.getHasVoucher()){
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplateConfigDto.getCellTemplateID());
......@@ -150,7 +150,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasInvoice()) {
if (cellTemplateConfigDto.getHasInvoice()!=null&&cellTemplateConfigDto.getHasInvoice()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplateConfigDto.getCellTemplateID());
......@@ -167,7 +167,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasKeyIn()) {
if (cellTemplateConfigDto.getHasKeyIn()!=null&&cellTemplateConfigDto.getHasKeyIn()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplateConfigDto.getCellTemplateID());
......@@ -180,7 +180,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasModel()) {
if (cellTemplateConfigDto.getHasModel()!=null&&cellTemplateConfigDto.getHasModel()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplateConfigDto.getCellTemplateID());
......@@ -194,7 +194,7 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasValidation()) {
if (cellTemplateConfigDto.getHasValidation()!=null&&cellTemplateConfigDto.getHasValidation()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setId(distributedIDService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplateConfigDto.getCellTemplateID());
......
......@@ -97,9 +97,14 @@ public class ReportGeneratorImpl implements ReportGenerator {
if (workbook != null) {
Workbook newWorkbook = workbook.get();
FormulaContext formulaContext = new FormulaContext();
formulaContext.setFormulaAgent(formulaAgent);
formulaContext.setPeriod(6);//todo: assign value later
formulaContext.setReportTemplateGroupID(templateGroupID);
formulaContext.setProjectID(projectId);
formulaContext.setYear(2018);//todo: assign value later
addFunctionsToWorkbook(newWorkbook, templateGroupID);
addFunctionsToWorkbook(newWorkbook, formulaContext);
int sheetCount = newWorkbook.getNumberOfSheets();
for (int i = 0; i < sheetCount; i++) {
Sheet sheet = newWorkbook.getSheetAt(i);
......@@ -257,12 +262,8 @@ public class ReportGeneratorImpl implements ReportGenerator {
*
* @param workbook 工作簿
*/
private void addFunctionsToWorkbook(Workbook workbook, Long templateGroupID) {
private void addFunctionsToWorkbook(Workbook workbook, FormulaContext formulaContext) {
String[] functionNames = {"SGSR", "FSJZ", "ND", "BB"};
FormulaContext formulaContext = new FormulaContext();
formulaContext.setFormulaAgent(formulaAgent);
formulaContext.setPeriod(6);//todo: assign value later
formulaContext.setReportTemplateGroupID(templateGroupID);
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new ReportFormulaFactory.BB(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functionNames, functionImpls);
......
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