Commit 6f213aef authored by kevin's avatar kevin

#

parent 948117e7
...@@ -13,4 +13,5 @@ public class DataSourceName { ...@@ -13,4 +13,5 @@ public class DataSourceName {
public static final String SAPDataSource = "SAPDataSource"; public static final String SAPDataSource = "SAPDataSource";
public static final String LandSellDataSource = "LandSellDataSource"; public static final String LandSellDataSource = "LandSellDataSource";
public static final String UnbilledDataSource = "UnbilledDataSource"; public static final String UnbilledDataSource = "UnbilledDataSource";
public static final String TableSumIfDataSource = "TableSumIfDataSource";
} }
package pwc.taxtech.atms.constant.enums; package pwc.taxtech.atms.constant.enums;
import pwc.taxtech.atms.dto.vatdto.ReportCellTableSUMIFDataSourceDto;
public enum FormulaDataSourceDetailType { public enum FormulaDataSourceDetailType {
BSPLFormulaDataSourceDto(1, pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto.class), BSPLFormulaDataSourceDto(1, pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto.class),
...@@ -8,9 +10,9 @@ public enum FormulaDataSourceDetailType { ...@@ -8,9 +10,9 @@ public enum FormulaDataSourceDetailType {
InputInvoiceDetailDataSourceDto(4, pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto.class), InputInvoiceDetailDataSourceDto(4, pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto.class),
OutputInvoiceDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto.class), OutputInvoiceDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto.class),
AssetDetailDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto.class), AssetDetailDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto.class),
ReportCellDataSourceDto(6, pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto.class);
ReportCellDataSourceDto(6, pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto.class),
ReportCellTableSUMIFDataSourceDto(7,ReportCellTableSUMIFDataSourceDto.class);
private Integer code; private Integer code;
private Class clas; private Class clas;
......
...@@ -41,6 +41,7 @@ public enum FormulaDataSourceType { ...@@ -41,6 +41,7 @@ public enum FormulaDataSourceType {
/// </summary> /// </summary>
SapDaily(7), SapDaily(7),
/// <summary> /// <summary>
/// 土地出让金数据源 /// 土地出让金数据源
/// </summary> /// </summary>
...@@ -58,9 +59,12 @@ public enum FormulaDataSourceType { ...@@ -58,9 +59,12 @@ public enum FormulaDataSourceType {
ModelSource(13), ModelSource(13),
WPSRSource(33), WPSRSource(33),
TrialBalance(20), TrialBalance(20),
AssetListSource(21); AssetListSource(21),
// FSESource(14), // FSESource(14),
RSUMIF(22),
CIT_TBAM(50); //针对试算平衡表
private Integer code; private Integer code;
...@@ -100,8 +104,13 @@ public enum FormulaDataSourceType { ...@@ -100,8 +104,13 @@ public enum FormulaDataSourceType {
return FormulaDataSourceType.TrialBalance; return FormulaDataSourceType.TrialBalance;
case 21: case 21:
return FormulaDataSourceType.AssetListSource; return FormulaDataSourceType.AssetListSource;
case 22:
return FormulaDataSourceType.RSUMIF;
case 33: case 33:
return FormulaDataSourceType.WPSRSource; return FormulaDataSourceType.WPSRSource;
case 50:
return FormulaDataSourceType.CIT_TBAM;
default: default:
return FormulaDataSourceType.Other; return FormulaDataSourceType.Other;
} }
......
...@@ -3,13 +3,17 @@ package pwc.taxtech.atms.controller; ...@@ -3,13 +3,17 @@ package pwc.taxtech.atms.controller;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dao.CitTbamMapper;
import pwc.taxtech.atms.dpo.CitTbamDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.vat.entity.CellComment; import pwc.taxtech.atms.vat.entity.CellComment;
import pwc.taxtech.atms.vat.entity.PeriodCellComment; import pwc.taxtech.atms.vat.entity.PeriodCellComment;
import pwc.taxtech.atms.vat.service.impl.CellCommentServiceImpl; import pwc.taxtech.atms.vat.service.impl.CellCommentServiceImpl;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
@RestController @RestController
...@@ -26,4 +30,18 @@ public class CellCommentController { ...@@ -26,4 +30,18 @@ public class CellCommentController {
} }
return cellCommentService.getCellComments(cellDataId, projectId); return cellCommentService.getCellComments(cellDataId, projectId);
} }
@Autowired
private CitTbamMapper citTbamMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
//通过sql获取展示表格展示数据
@RequestMapping(value = "getCellInformation")
public OperationResultDto getCellInformation(String sql){
OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setResultMsg("success");
operationResultDto.setData(citTbamMapper.selectBySql(sql));
return operationResultDto;
}
} }
...@@ -5,6 +5,7 @@ public class CamelPagingDto { ...@@ -5,6 +5,7 @@ public class CamelPagingDto {
private Integer pageIndex; private Integer pageIndex;
private Integer pageSize; private Integer pageSize;
public Integer getTotalCount() { public Integer getTotalCount() {
return totalCount; return totalCount;
} }
......
...@@ -27,6 +27,7 @@ public class DataSourceDto { ...@@ -27,6 +27,7 @@ public class DataSourceDto {
// 1: +, 2: -, 3: *, 4: / // 1: +, 2: -, 3: *, 4: /
Integer operationType; Integer operationType;
String rel_sql;
// 1: Number, 2: Percentage, 3: Boolean, 4: String // 1: Number, 2: Percentage, 3: Boolean, 4: String
Integer resultType; Integer resultType;
...@@ -56,6 +57,14 @@ public class DataSourceDto { ...@@ -56,6 +57,14 @@ public class DataSourceDto {
@JsonProperty("reportTemplateID") @JsonProperty("reportTemplateID")
String reportTemplateId; String reportTemplateId;
public String getRel_sql() {
return rel_sql;
}
public void setRel_sql(String rel_sql) {
this.rel_sql = rel_sql;
}
public String getId() { public String getId() {
return this.id; return this.id;
} }
......
package pwc.taxtech.atms.dto.vatdto;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.ValueEval;
import java.util.ArrayList;
import java.util.List;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
import static pwc.taxtech.atms.exception.Exceptions.BAD_BBVO_PARAMS;
public class RSUMIFParasBo {
private String reportCode;
private Integer columnIndex;
private Integer rowIndex;
private Integer period;
private Integer year;
private String formulaExpression;
private List<PeriodCellDataTemplate> expressionData = new ArrayList<>();
public static class PeriodCellDataTemplate {
Integer period;
Long cellTemplateId;
@Override
public String toString() {
return period + ":" + cellTemplateId;
}
public PeriodCellDataTemplate(Integer period, Long cellTemplateId) {
this.period = period;
this.cellTemplateId = cellTemplateId;
}
}
public void putPeriodCellTempate(Integer period, Long cellTemplateId) {
if (period < 1 || period > 12 || cellTemplateId < 0) throw BAD_BBVO_PARAMS;
expressionData.add(new PeriodCellDataTemplate(period, cellTemplateId));
}
public String getExpression(ValueEval[] args, OperationEvaluationContext ec) throws EvaluationException {
StringBuilder expression = new StringBuilder("");
String _para = "";
begin(expression);
for(int i = 0 ; i< args.length; i++){
_para = resolverString(args, ec, i);
concatPara(expression, _para);
split(expression);
}
end(expression);
return expression.toString();
}
private StringBuilder begin(StringBuilder expression) {
return expression.append("RSUMIF(");
}
private StringBuilder end(StringBuilder expression) {
return expression.append(")");
}
private StringBuilder split(StringBuilder expression) {
return expression.append(",");
}
private StringBuilder concatPara(StringBuilder expression, String para) {
return expression.append("\"").append(para).append("\"");
}
private StringBuilder concatPara(StringBuilder expression, Integer para) {
return expression.append(para);
}
public RSUMIFParasBo(){}
public RSUMIFParasBo(RSUMIFParasBo otherBo, int period, int curYear) {
this.reportCode = otherBo.reportCode;
this.columnIndex = otherBo.getColumnIndex();
this.rowIndex = otherBo.rowIndex;
this.period = period;
this.year = curYear;
this.formulaExpression = otherBo.formulaExpression;
}
public String expression() {
return formulaExpression;
}
public String getReportCode() {
return this.reportCode;
}
public void setReportCode(String reportCode) {
this.reportCode = reportCode;
}
public Integer getColumnIndex() {
return this.columnIndex;
}
public void setColumnIndex(Integer columnIndex) {
this.columnIndex = columnIndex;
}
public Integer getRowIndex() {
return this.rowIndex;
}
public void setRowIndex(Integer rowIndex) {
this.rowIndex = rowIndex;
}
public Integer getPeriod() {
return this.period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public Integer getYear() {
return this.year;
}
public void setYear(Integer year) {
this.year = year;
}
public String getFormulaExpression() {
return this.formulaExpression;
}
public void setFormulaExpression(String formulaExpression) {
this.formulaExpression = formulaExpression;
}
public List<PeriodCellDataTemplate> getExpressionData() {
return this.expressionData;
}
public void setExpressionData(List<PeriodCellDataTemplate> expressionData) {
this.expressionData = expressionData;
}
}
package pwc.taxtech.atms.dto.vatdto;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import pwc.taxtech.atms.constant.DataSourceName;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.vat.entity.PeriodCellData;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
import java.math.BigDecimal;
public class ReportCellTableSUMIFDataSourceDto extends DataSourceDto {
private String tag = "RSUMIF";
private String name;
private Integer year;
private Integer period;
private Integer columnIndex;
private String columnName;
private Integer rowIndex;
private String rowName;
private String reportTemplateId;
private String reportName;
private String cellDataId;
private String cellTemplateId;
private Boolean isOnlyManualInput;
private Integer type;
private Integer resultType;
private BigDecimal amount;
private String tableName;
private String filter;
private String filterValue;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getFilter() {
return filter;
}
public void setFilter(String filter) {
this.filter = filter;
}
public String getFilterValue() {
return filterValue;
}
public void setFilterValue(String filterValue) {
this.filterValue = filterValue;
}
public ReportCellTableSUMIFDataSourceDto() {
this.type = FormulaDataSourceType.Report.getCode();
}
public void insertData(OperationEvaluationContext o, FormulaContext formulaContext) {
this.rowIndex = o.getRowIndex();
this.columnIndex = o.getColumnIndex();
this.cellTemplateId = null;
this.period = formulaContext.getPeriod();
this.reportTemplateId = formulaContext.getReportTemplateGroupId().toString();
this.year = formulaContext.getYear();
this.isOnlyManualInput = false;
this.reportName = formulaContext.getReportTemplateGroupId().toString();
this.name = DataSourceName.ReportDataSource;
}
public String getTag() {
return this.tag;
}
public void setTag(String tag) {
this.tag = tag;
}
@Override
public String getName() {
return this.name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public Integer getYear() {
return this.year;
}
@Override
public void setYear(Integer year) {
this.year = year;
}
@Override
public Integer getPeriod() {
return this.period;
}
@Override
public void setPeriod(Integer period) {
this.period = period;
}
@Override
public Integer getColumnIndex() {
return this.columnIndex;
}
@Override
public void setColumnIndex(Integer columnIndex) {
this.columnIndex = columnIndex;
}
@Override
public String getColumnName() {
return this.columnName;
}
@Override
public void setColumnName(String columnName) {
this.columnName = columnName;
}
@Override
public Integer getRowIndex() {
return this.rowIndex;
}
@Override
public void setRowIndex(Integer rowIndex) {
this.rowIndex = rowIndex;
}
@Override
public String getRowName() {
return this.rowName;
}
@Override
public void setRowName(String rowName) {
this.rowName = rowName;
}
@Override
public String getReportTemplateId() {
return this.reportTemplateId;
}
@Override
public void setReportTemplateId(String reportTemplateId) {
this.reportTemplateId = reportTemplateId;
}
public String getReportName() {
return this.reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
@Override
public String getCellDataId() {
return this.cellDataId;
}
@Override
public void setCellDataId(String cellDataId) {
this.cellDataId = cellDataId;
}
@Override
public String getCellTemplateId() {
return this.cellTemplateId;
}
@Override
public void setCellTemplateId(String cellTemplateId) {
this.cellTemplateId = cellTemplateId;
}
public Boolean getIsOnlyManualInput() {
return this.isOnlyManualInput;
}
public void setIsOnlyManualInput(Boolean onlyManualInput) {
this.isOnlyManualInput = onlyManualInput;
}
@Override
public Integer getType() {
return this.type;
}
@Override
public void setType(Integer type) {
this.type = type;
}
@Override
public Integer getResultType() {
return this.resultType;
}
@Override
public void setResultType(Integer resultType) {
this.resultType = resultType;
}
@Override
public BigDecimal getAmount() {
return this.amount;
}
@Override
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
@Override
public String toString() {
return "ReportCellTableSUMIFDataSourceDto{" +
"tag='" + tag + '\'' +
", name='" + name + '\'' +
", year=" + year +
", period=" + period +
", columnIndex=" + columnIndex +
", columnName='" + columnName + '\'' +
", rowIndex=" + rowIndex +
", rowName='" + rowName + '\'' +
", reportTemplateId='" + reportTemplateId + '\'' +
", reportName='" + reportName + '\'' +
", cellDataId='" + cellDataId + '\'' +
", cellTemplateId='" + cellTemplateId + '\'' +
", isOnlyManualInput=" + isOnlyManualInput +
", type=" + type +
", resultType=" + resultType +
", amount=" + amount +
", tableName='" + tableName + '\'' +
", filter='" + filter + '\'' +
", filterValue='" + filterValue + '\'' +
'}';
}
}
...@@ -57,7 +57,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*; ...@@ -57,7 +57,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
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", "RSUMIF", "TABLESUMIF", "SUM"}; "JXFP", "PSUM", "DFFS", "JFFS", "WPSR", "WPNAME", "WPTYPE", "SUM2", "RSUMIF", "SUM"};
@Autowired @Autowired
private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper; private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper;
......
...@@ -145,6 +145,7 @@ public class FormulaAgent { ...@@ -145,6 +145,7 @@ public class FormulaAgent {
} }
public static String buildSql(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) { public static String buildSql(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) {
/* /*
...@@ -159,13 +160,13 @@ public class FormulaAgent { ...@@ -159,13 +160,13 @@ public class FormulaAgent {
if (tableName.substring(0, 3).equals("cit")) { if (tableName.substring(0, 3).equals("cit")) {
try { try {
return _buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, true); return _buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, true, false);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
try { try {
return _buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, false); return _buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, false, false);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -173,8 +174,15 @@ public class FormulaAgent { ...@@ -173,8 +174,15 @@ public class FormulaAgent {
} }
public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool) throws Exception { public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool, boolean getSql) throws Exception {
String sql = "select sum(" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue; String sql = "";
if(getSql){
sql = "select * from " + tableName + " where 1=1 and " + filter + filterValue;
return sql;
}else{
sql = "select sum(" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue;
}
String _p = insertZero(formulaContext.getPeriod() - Math.abs(period)); String _p = insertZero(formulaContext.getPeriod() - Math.abs(period));
String _period = insertZero(formulaContext.getPeriod()); String _period = insertZero(formulaContext.getPeriod());
String per = insertZero((formulaContext.getPeriod() - 1)); String per = insertZero((formulaContext.getPeriod() - 1));
...@@ -210,15 +218,17 @@ public class FormulaAgent { ...@@ -210,15 +218,17 @@ public class FormulaAgent {
@Autowired @Autowired
JdbcTemplate jdbcTemplate; JdbcTemplate jdbcTemplate;
/*
public static void main(String[] args) { public static void main(String[] args) {
FormulaAgent formulaAgent = new FormulaAgent(); FormulaAgent formulaAgent = new FormulaAgent();
FormulaContext formulaContext = new FormulaContext(); FormulaContext formulaContext = new FormulaContext();
formulaContext.setPeriod(3); formulaContext.setPeriod(3);
formulaAgent.getTableDataByName("CIT_TBAM", "ending_balance", "attribute", "= '销售费用-财产损耗、盘亏及毁损损失'", 0, "2018", formulaContext); formulaAgent.getTableDataByName("CIT_TBAM", "ending_balance", "attribute", "= '销售费用-财产损耗、盘亏及毁损损失'", 0, "2018", formulaContext);
} }*/
public BigDecimal getTableDataByName(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) { public BigDecimal getTableDataByName(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) {
Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext)); Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext));
/* for (int i = 0, j = stringObjectMap.size(); i < j; i++) { /* for (int i = 0, j = stringObjectMap.size(); i < j; i++) {
if (i == 1) { if (i == 1) {
......
...@@ -95,7 +95,6 @@ public class ReportGeneratorImpl { ...@@ -95,7 +95,6 @@ public class ReportGeneratorImpl {
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream() Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code)) .filter(a -> a.getCode().equals(code))
.findFirst(); .findFirst();
Long templateId; Long templateId;
if (periodTemplate.isPresent()) { if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId(); templateId = periodTemplate.get().getTemplateId();
...@@ -209,8 +208,6 @@ public class ReportGeneratorImpl { ...@@ -209,8 +208,6 @@ public class ReportGeneratorImpl {
} else { } else {
cellData.setData(data); cellData.setData(data);
} }
if (StringUtils.isBlank(resultFormula)) { if (StringUtils.isBlank(resultFormula)) {
resultFormula = " "; resultFormula = " ";
} }
...@@ -240,19 +237,17 @@ public class ReportGeneratorImpl { ...@@ -240,19 +237,17 @@ public class ReportGeneratorImpl {
cellDataSource.setUpdateTime(new Date()); cellDataSource.setUpdateTime(new Date());
cellDataSource.setPeriod(period); cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId); cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource); SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
} }
periodCellDataMapper.insertSelective(cellData); periodCellDataMapper.insertSelective(cellData);
} }
} }
if (isMergeMunual) { if (isMergeMunual) {
List<PeriodCellTemplateConfig> keyInCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream() List<PeriodCellTemplateConfig> keyInCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.KeyIn.getCode())) .filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.KeyIn.getCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
for (PeriodCellTemplateConfig keyInCellTemplateConfig : keyInCellTemplateConfigs) { for (PeriodCellTemplateConfig keyInCellTemplateConfig : keyInCellTemplateConfigs) {
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample(); PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andPeriodEqualTo(period).andProjectIdEqualTo(projectId) dataSourceExample.createCriteria().andPeriodEqualTo(period).andProjectIdEqualTo(projectId)
...@@ -313,7 +308,6 @@ public class ReportGeneratorImpl { ...@@ -313,7 +308,6 @@ public class ReportGeneratorImpl {
} else { } else {
logger.warn("should not be !!!"); logger.warn("should not be !!!");
} }
} }
} }
...@@ -512,8 +506,7 @@ public class ReportGeneratorImpl { ...@@ -512,8 +506,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 RSUMIF(formulaContext), new SUM(formulaContext)};
new RSUMIF(formulaContext), new TABLESUMIF(formulaContext), new SUM(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls); UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs); UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack); workbook.addToolPack(udfToolpack);
......
...@@ -763,6 +763,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -763,6 +763,7 @@ public class ReportServiceImpl extends BaseService {
dataSourceDto.setColumnIndex(a.getColumnIndex()); dataSourceDto.setColumnIndex(a.getColumnIndex());
dataSourceDto.setColumnName(a.getColumnName()); dataSourceDto.setColumnName(a.getColumnName());
dataSourceDto.setReportTemplateId(a.getReportTemplateId().toString()); dataSourceDto.setReportTemplateId(a.getReportTemplateId().toString());
dataSourceDto.setRel_sql(a.getRelSql());
if (a.getType().equals(FormulaDataSourceType.Report.getCode())) { if (a.getType().equals(FormulaDataSourceType.Report.getCode())) {
if (a.getItems().size() == 0) { if (a.getItems().size() == 0) {
......
...@@ -99,12 +99,20 @@ public class FunctionBase { ...@@ -99,12 +99,20 @@ public class FunctionBase {
int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId) { int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId) {
return saveDataSource(ec, dataSourceList, FormulaDataSourceType.Report, formulaDataSourceDetailType, val, period, return saveDataSource(ec, dataSourceList, FormulaDataSourceType.Report, formulaDataSourceDetailType, val, period,
templateGroupId, colNumP, rowNumP, projectId); templateGroupId, colNumP, rowNumP, projectId, null);
}
public Long saveDataRSUMIFSource(OperationEvaluationContext ec, List<Object> dataSourceList,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val,
int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId, FormulaDataSourceType type, String sql) {
return saveDataSource(ec, dataSourceList, type, formulaDataSourceDetailType, val, period,
templateGroupId, colNumP, rowNumP, projectId, sql);
} }
public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList, FormulaDataSourceType dataSourceType, public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList, FormulaDataSourceType dataSourceType,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val, FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val,
int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId) { int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId, String sql ) {
String reportCode = ec.getWorkbook().getSheetName(ec.getSheetIndex()); String reportCode = ec.getWorkbook().getSheetName(ec.getSheetIndex());
int colNum = ec.getColumnIndex(); int colNum = ec.getColumnIndex();
int rowNum = ec.getRowIndex(); int rowNum = ec.getRowIndex();
...@@ -137,6 +145,9 @@ public class FunctionBase { ...@@ -137,6 +145,9 @@ public class FunctionBase {
dataSource.setCellTemplateId(periodCellTemplateId); dataSource.setCellTemplateId(periodCellTemplateId);
dataSource.setPeriod(period); dataSource.setPeriod(period);
dataSource.setProjectId(projectId); dataSource.setProjectId(projectId);
if(sql != null){
dataSource.setRelSql(sql);
}
SpringContextUtil.periodDataSourceMapper.insertSelective(dataSource); SpringContextUtil.periodDataSourceMapper.insertSelective(dataSource);
if (CollectionUtils.isNotEmpty(dataSourceList)) { if (CollectionUtils.isNotEmpty(dataSourceList)) {
for (Object obj : dataSourceList) { for (Object obj : dataSourceList) {
......
...@@ -3,15 +3,17 @@ package pwc.taxtech.atms.vat.service.impl.report.functions; ...@@ -3,15 +3,17 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import org.slf4j.LoggerFactory; import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.dto.vatdto.RSUMIFParasBo;
import pwc.taxtech.atms.dto.vatdto.ReportCellTableSUMIFDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException; import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -22,102 +24,99 @@ import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString; ...@@ -22,102 +24,99 @@ import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
/** /**
* @ClassName RSUMIF * @ClassName RSUMIF
* Description TODO 公式还需要校验 * Description TODO
* @Author pwc kevin * @Author pwc kevin
* @Date 3/8/2019 5:21 PM * @Date 3/11/2019 2:52 PM
* Version 1.0 * Version 1.0
**/ **/
public class RSUMIF extends FunctionBase implements FreeRefFunction { public class RSUMIF extends FunctionBase implements FreeRefFunction {
final static ValueEval defaultEval = new StringEval("0"); private String tableName;
static final Logger LOGGER = LoggerFactory.getLogger(RSUMIF.class); Map<String, String> _map = TableRule.map;
String tableName;
String getField;//取值列字段
Map<String, String> fileterMap = new HashMap<String, String>();
String year;
int period;
String selectPeriod = "";
String selectFilter = "";
Long result;
int argsLength;
int selectCount;
public RSUMIF(FormulaContext formulaContext) { public RSUMIF(FormulaContext formulaContext) {
super(formulaContext); super(formulaContext);
} }
@Override //进行参数验证
public ValueEval evaluate(ValueEval[] valueEvals, OperationEvaluationContext operationEvaluationContext) { public void parameterCheck(ValueEval[] args, OperationEvaluationContext ec) {
argsLength = args.length;
if (argsLength != 6) //参数小于6当做异常处理, 最后俩参数可以取默认值
throw Exceptions.parameterError;
try { try {
return wrapExceptionEval(valueEvals, operationEvaluationContext); tableName = resolverString(args, ec, 0);
} catch (Exception e) {
if (e instanceof FormulaException)
LOGGER.warn("Formula Exception || {}", e.getMessage());
e.printStackTrace();
return defaultEval;
}
}
public ValueEval wrapExceptionEval(ValueEval[] args, OperationEvaluationContext ec) throws Exception { if (!_map.containsKey(tableName))
List<Object> ds = new ArrayList<>(); throw Exceptions.parameterError;
parameterCheck(args); } catch (EvaluationException e) {
setWhere(args, ec);
List<CellTemplatePerGroupDto> tableData = null;
try {
tableData = agent.getTableData(tableName, getField, selectFilter, year, selectPeriod);
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new Exception("公式参数配置错误");
}
for (CellTemplatePerGroupDto cellTemplatePerGroupDto : tableData) {
result = result + Long.parseLong(cellTemplatePerGroupDto.getData());
} }
return new NumberEval(result);
}
//进行参数验证
public void parameterCheck(ValueEval[] args) {
argsLength = args.length;
if (argsLength < 4) {//参数小于3当做异常处理, 最后俩参数可以取默认值
throw Exceptions.parameterError;
}
} }
private void setWhere(ValueEval[] args, OperationEvaluationContext ec) { Integer argsLength;
String getField;
Integer period;
String year;
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
parameterCheck(args, ec);
BigDecimal cellValue = BigDecimal.ZERO;
List<Object> dataSource = new ArrayList<>();
Map map = new HashMap<String, String>();
ReportCellTableSUMIFDataSourceDto reportCellTableSUMIFDataSourceDto = new ReportCellTableSUMIFDataSourceDto();
reportCellTableSUMIFDataSourceDto.insertData(ec, formulaContext);
String filter = null;
String filterValue = null;
dataSource.add(reportCellTableSUMIFDataSourceDto);
try { try {
selectCount = (argsLength - 4) / 2;
tableName = resolverString(args, ec, 0); tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1); getField = resolverString(args, ec, 1);
period = resolverInteger(args, ec, argsLength - 1);//会计期间 filter= resolverString(args, ec, 2);
year = resolverString(args, ec, argsLength - 2);//会计年度 filterValue= resolverString(args, ec, 3);
if (selectCount % 2 != 0) period = resolverInteger(args, ec, 4);//会计期间
throw Exceptions.parameterError; year = resolverString(args, ec, 5);//会计年度
for (int i = 3; i < selectCount * 2 + 3; i++) { cellValue = agent.getTableDataByName(tableName, getField, filter, filterValue, period, year, formulaContext);
if (i % 2 != 0) { return new NumberEval(cellValue.doubleValue());
fileterMap.put(resolverString(args, ec, i), resolverString(args, ec, i + 1)); } catch (EvaluationException e) {
} e.printStackTrace();
return new NumberEval(0.00);
} finally {
boolean boo;
if(TableRule.map.get(tableName).substring(0, 3).equals("cit")){
boo = true;
}else{
boo = false;
} }
if (period == 0) { Long dataSourceId = null;
selectPeriod = "t.period = " + formulaContext.getPeriod(); try {
} else if (period == -99) { dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto,
selectPeriod = "t.period between '0' and " + (formulaContext.getPeriod() - 1); cellValue, formulaContext.getPeriod(),
} else if (period == 99) { formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(),
selectPeriod = "t.period between '0' and " + (formulaContext.getPeriod() - 1); formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField,tableName,filter,filterValue,period,formulaContext,year, boo, true));
} else { } catch (Exception e) {
selectPeriod = "t.period between " + (formulaContext.getPeriod() - period) + " and " + (formulaContext.getPeriod() - 1); e.printStackTrace();
} }
try {
for (Map.Entry<String, String> entry : fileterMap.entrySet()) { saveFormulaBlock(formulaContext.getPeriod(), ec,
if (selectFilter.equals("")) { new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId());
selectFilter = "t." + entry.getKey() + entry.getValue(); } catch (EvaluationException e) {
} else { e.printStackTrace();
selectFilter = selectFilter + " and " + "t." + entry.getKey() + entry.getValue();
}
} }
} catch (EvaluationException e) {
e.printStackTrace();
} }
} }
//解决不同表结构关联不同的展示方式
public FormulaDataSourceType selectShow(String tableName) {
if ("CIT_TBAM".equals(tableName)) {
return FormulaDataSourceType.CIT_TBAM;
}
return null;
}
public static String getSql (){
return "";
}
} }
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.exception.Exceptions;
import java.util.Map;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverInteger;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
/**
* @ClassName TABLESUMIF
* Description TODO
* @Author pwc kevin
* @Date 3/11/2019 2:52 PM
* Version 1.0
**/
public class TABLESUMIF extends FunctionBase implements FreeRefFunction {
private String tableName;
public TABLESUMIF(FormulaContext formulaContext) {
super(formulaContext);
}
//进行参数验证
public void parameterCheck(ValueEval[] args, OperationEvaluationContext ec) {
argsLength = args.length;
if (argsLength != 6) //参数小于6当做异常处理, 最后俩参数可以取默认值
throw Exceptions.parameterError;
try {
tableName = resolverString(args, ec, 0);
Map<String, String> map = TableRule.map;
if (!map.containsKey(tableName))
throw Exceptions.parameterError;
} catch (EvaluationException e) {
e.printStackTrace();
}
}
Integer argsLength;
String getField;
Integer period;
String year;
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
parameterCheck(args, ec);
try {
tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1);
String filter = resolverString(args, ec, 2);
String filterValue =resolverString(args, ec, 3);
period = resolverInteger(args, ec, 4);//会计期间
year = resolverString(args, ec, 5);//会计年度
return new NumberEval(agent.getTableDataByName(tableName, getField,filter,filterValue, period, year, formulaContext).doubleValue());
} catch (EvaluationException e) {
e.printStackTrace();
return new NumberEval(0.00);
}
}
}
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverInteger;
import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
/**
* @ClassName _RSUMIF
* Description TODO 公式还需要校验
* @Author pwc kevin
* @Date 3/8/2019 5:21 PM
* Version 1.0
**/
public class _RSUMIF extends FunctionBase implements FreeRefFunction {
final static ValueEval defaultEval = new StringEval("0");
static final Logger LOGGER = LoggerFactory.getLogger(_RSUMIF.class);
String tableName;
String getField;//取值列字段
Map<String, String> fileterMap = new HashMap<String, String>();
String year;
int period;
String selectPeriod = "";
String selectFilter = "";
Long result;
int argsLength;
int selectCount;
public _RSUMIF(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] valueEvals, OperationEvaluationContext operationEvaluationContext) {
try {
return wrapExceptionEval(valueEvals, operationEvaluationContext);
} catch (Exception e) {
if (e instanceof FormulaException)
LOGGER.warn("Formula Exception || {}", e.getMessage());
e.printStackTrace();
return defaultEval;
}
}
public ValueEval wrapExceptionEval(ValueEval[] args, OperationEvaluationContext ec) throws Exception {
List<Object> ds = new ArrayList<>();
parameterCheck(args);
setWhere(args, ec);
List<CellTemplatePerGroupDto> tableData = null;
try {
tableData = agent.getTableData(tableName, getField, selectFilter, year, selectPeriod);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("公式参数配置错误");
}
for (CellTemplatePerGroupDto cellTemplatePerGroupDto : tableData) {
result = result + Long.parseLong(cellTemplatePerGroupDto.getData());
}
return new NumberEval(result);
}
//进行参数验证
public void parameterCheck(ValueEval[] args) {
argsLength = args.length;
if (argsLength < 4) {//参数小于3当做异常处理, 最后俩参数可以取默认值
throw Exceptions.parameterError;
}
}
private void setWhere(ValueEval[] args, OperationEvaluationContext ec) {
try {
selectCount = (argsLength - 4) / 2;
tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1);
period = resolverInteger(args, ec, argsLength - 1);//会计期间
year = resolverString(args, ec, argsLength - 2);//会计年度
if (selectCount % 2 != 0)
throw Exceptions.parameterError;
for (int i = 3; i < selectCount * 2 + 3; i++) {
if (i % 2 != 0) {
fileterMap.put(resolverString(args, ec, i), resolverString(args, ec, i + 1));
}
}
if (period == 0) {
selectPeriod = "t.period = " + formulaContext.getPeriod();
} else if (period == -99) {
selectPeriod = "t.period between '0' and " + (formulaContext.getPeriod() - 1);
} else if (period == 99) {
selectPeriod = "t.period between '0' and " + (formulaContext.getPeriod() - 1);
} else {
selectPeriod = "t.period between " + (formulaContext.getPeriod() - period) + " and " + (formulaContext.getPeriod() - 1);
}
for (Map.Entry<String, String> entry : fileterMap.entrySet()) {
if (selectFilter.equals("")) {
selectFilter = "t." + entry.getKey() + entry.getValue();
} else {
selectFilter = selectFilter + " and " + "t." + entry.getKey() + entry.getValue();
}
}
} catch (EvaluationException e) {
e.printStackTrace();
}
}
}
...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.CitTbamDto;
import pwc.taxtech.atms.entity.CitTbam; import pwc.taxtech.atms.entity.CitTbam;
import pwc.taxtech.atms.entity.CitTbamExample; import pwc.taxtech.atms.entity.CitTbamExample;
...@@ -113,4 +114,6 @@ public interface CitTbamMapper extends MyMapper { ...@@ -113,4 +114,6 @@ public interface CitTbamMapper extends MyMapper {
* @return * @return
*/ */
int insertBatch(List<CitTbam> citTbamList); int insertBatch(List<CitTbam> citTbamList);
List<CitTbamDto> selectBySql(@Param("sql") String sql);
} }
\ No newline at end of file
package pwc.taxtech.atms.dpo;
import pwc.taxtech.atms.entity.CitTbam;
/**
* @ClassName CitTbamDto
* Description TODO
* @Author pwc kevin
* @Date 3/15/2019 3:46 PM
* Version 1.0
**/
public class CitTbamDto extends CitTbam {
}
...@@ -20,6 +20,15 @@ public class PeriodDataSource implements Serializable { ...@@ -20,6 +20,15 @@ public class PeriodDataSource implements Serializable {
* @mbg.generated * @mbg.generated
*/ */
private Long id; private Long id;
private String relSql;
public String getRelSql() {
return relSql;
}
public void setRelSql(String relSql) {
this.relSql = relSql;
}
/** /**
* *
...@@ -655,30 +664,27 @@ public class PeriodDataSource implements Serializable { ...@@ -655,30 +664,27 @@ public class PeriodDataSource implements Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "PeriodDataSource{" +
sb.append(getClass().getSimpleName()); "id=" + id +
sb.append(" ["); ", relSql='" + relSql + '\'' +
sb.append("Hash = ").append(hashCode()); ", type=" + type +
sb.append(", id=").append(id); ", name='" + name + '\'' +
sb.append(", type=").append(type); ", amount=" + amount +
sb.append(", name=").append(name); ", description='" + description + '\'' +
sb.append(", amount=").append(amount); ", keyValueDataId='" + keyValueDataId + '\'' +
sb.append(", description=").append(description); ", createBy='" + createBy + '\'' +
sb.append(", keyValueDataId=").append(keyValueDataId); ", createTime=" + createTime +
sb.append(", createBy=").append(createBy); ", updateBy='" + updateBy + '\'' +
sb.append(", createTime=").append(createTime); ", updateTime=" + updateTime +
sb.append(", updateBy=").append(updateBy); ", rowName='" + rowName + '\'' +
sb.append(", updateTime=").append(updateTime); ", columnName='" + columnName + '\'' +
sb.append(", rowName=").append(rowName); ", rowIndex=" + rowIndex +
sb.append(", columnName=").append(columnName); ", remapBatchId='" + remapBatchId + '\'' +
sb.append(", rowIndex=").append(rowIndex); ", columnIndex=" + columnIndex +
sb.append(", remapBatchId=").append(remapBatchId); ", cellTemplateId=" + cellTemplateId +
sb.append(", columnIndex=").append(columnIndex); ", period=" + period +
sb.append(", cellTemplateId=").append(cellTemplateId); ", projectId='" + projectId + '\'' +
sb.append(", period=").append(period); ", keyinData='" + keyinData + '\'' +
sb.append(", projectId=").append(projectId); '}';
sb.append(", keyinData=").append(keyinData);
sb.append("]");
return sb.toString();
} }
} }
\ No newline at end of file
...@@ -81,4 +81,10 @@ ...@@ -81,4 +81,10 @@
SELECT 1 FROM DUAL; SELECT 1 FROM DUAL;
</insert> </insert>
<select id ="selectBySql" parameterType="java.lang.String" resultType="pwc.taxtech.atms.dpo.CitTbamDto">
<if test ="sql != null and sql != '' ">
${sql}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -231,7 +231,11 @@ ...@@ -231,7 +231,11 @@
<if test="keyinData != null"> <if test="keyinData != null">
keyin_data, keyin_data,
</if> </if>
<if test="relSql != null">
rel_sql
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id,jdbcType=BIGINT},
...@@ -290,6 +294,9 @@ ...@@ -290,6 +294,9 @@
<if test="keyinData != null"> <if test="keyinData != null">
#{keyinData,jdbcType=VARCHAR}, #{keyinData,jdbcType=VARCHAR},
</if> </if>
<if test="relSql != null">
#{relSql,jdbcType=VARCHAR}
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodDataSourceExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodDataSourceExample" resultType="java.lang.Long">
......
...@@ -245,6 +245,7 @@ ...@@ -245,6 +245,7 @@
<result column="CELL_TEMPLATE_ID" jdbcType="BIGINT" property="cellTemplateId"/> <result column="CELL_TEMPLATE_ID" jdbcType="BIGINT" property="cellTemplateId"/>
<result column="CELL_DATA_ID" jdbcType="BIGINT" property="cellDataId"/> <result column="CELL_DATA_ID" jdbcType="BIGINT" property="cellDataId"/>
<result column="REPORT_TEMPLATE_ID" jdbcType="BIGINT" property="reportTemplateId"/> <result column="REPORT_TEMPLATE_ID" jdbcType="BIGINT" property="reportTemplateId"/>
<result column="REL_SQL" jdbcType="VARCHAR" property="relSql"/>
</resultMap> </resultMap>
<select id="getFormulaDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap"> <select id="getFormulaDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap">
...@@ -268,6 +269,7 @@ ...@@ -268,6 +269,7 @@
DS.period as PERIOD, DS.period as PERIOD,
DS.project_id as PROJECT_ID, DS.project_id as PROJECT_ID,
DS.keyin_data as KEYIN_DATA, DS.keyin_data as KEYIN_DATA,
DS.rel_sql as REL_SQL,
CDS.operation_type AS OPERATION_TYPE, CDS.operation_type AS OPERATION_TYPE,
CD.cell_template_id AS CELL_TEMPLATE_ID, CD.cell_template_id AS CELL_TEMPLATE_ID,
CD.id AS CELL_DATA_ID, CD.id AS CELL_DATA_ID,
......
...@@ -1495,6 +1495,53 @@ ...@@ -1495,6 +1495,53 @@
{dataField: 'money', caption: 'Amount', alignment: 'center', width: '100%'}, {dataField: 'money', caption: 'Amount', alignment: 'center', width: '100%'},
]; ];
break; break;
case enums.formulaDataSourceType.CIT_TBAM:
dataGridColumns = [
{
dataField: 'accountCode',
caption: $translate.instant('AccountCode'),
alignment: 'center',
},
{
dataField: 'accountDescription',
caption: $translate.instant('AccountName'),
alignment: 'left',
},
{
dataField: 'customerCode',
caption: $translate.instant('CustomerCode'),
alignment: 'left'
},
{
dataField: 'beginningBalance',
caption: $translate.instant('BegBal'),
alignment: 'left'
},
{
dataField: 'debitAmount',
caption: $translate.instant('DebitBal'),
alignment: 'left'
}
,
{
dataField: 'creditAmount',
caption: $translate.instant('CreditAmount'),
alignment: 'left'
}
,
{
dataField: 'endingBalance',
caption: $translate.instant('EndingBalance'),
alignment: 'left'
}
,
{
dataField: 'Attribute',
caption: $translate.instant('Attribute'),
alignment: 'left'
}
];
break;
} }
return dataGridColumns; return dataGridColumns;
}; };
...@@ -2161,6 +2208,11 @@ ...@@ -2161,6 +2208,11 @@
break; break;
case enums.formulaDataSourceType.InputInvoice: case enums.formulaDataSourceType.InputInvoice:
$scope.detail.dataGridSourceBind = [$scope.detail.dataGridSource[0]]; $scope.detail.dataGridSourceBind = [$scope.detail.dataGridSource[0]];
break;case enums.formulaDataSourceType.InputInvoice:
$scope.detail.dataGridSourceBind = [$scope.detail.dataGridSource[0]];
break;
case enums.formulaDataSourceType.CIT_TBAM:
$scope.detail.dataGridSourceBind = getBlowGridData($scope.detail.dataGridSource[0]);
break; break;
default : default :
$scope.detail.dataGridSourceBind = $scope.detail.dataGridSource; $scope.detail.dataGridSourceBind = $scope.detail.dataGridSource;
...@@ -2181,6 +2233,17 @@ ...@@ -2181,6 +2233,17 @@
}, 500); }, 500);
}); });
var getBlowGridData = function( data){
cellCommentService.getCellInformation(data).success(function (res) {
if(res.resultMsg){
return res.data;
}
}).error(function (error) {
});
}
//当数据源数量变化是,重新排序数据源 //当数据源数量变化是,重新排序数据源
$scope.$watch('detail.items.length', function (newVal, oldValue) { $scope.$watch('detail.items.length', function (newVal, oldValue) {
......
...@@ -21,13 +21,11 @@ ...@@ -21,13 +21,11 @@
<!--<i ng-show="detail.hasModelError" class="fa fa-exclamation-circle red-color"></i>--> <!--<i ng-show="detail.hasModelError" class="fa fa-exclamation-circle red-color"></i>-->
<!--{{'ModelAnalysisResults' | translate}}</span>--> <!--{{'ModelAnalysisResults' | translate}}</span>-->
<span ng-show="detail.validationErrorList && detail.validationErrorList.length > 0" ng-model="tabType" <span ng-show="detail.validationErrorList && detail.validationErrorList.length > 0" ng-model="tabType"
uib-btn-radio="3"> uib-btn-radio="3"><i class="fa fa-exclamation-circle red-color"></i>{{'ReportCheckResult' | translate}}</span>
<i class="fa fa-exclamation-circle red-color"></i>{{'ReportCheckResult' | translate}}</span>
<span ng-model="tabType" uib-btn-radio="4">{{'cellComment'|translate}}</span> <span ng-model="tabType" uib-btn-radio="4">{{'cellComment'|translate}}</span>
<span ng-model="tabType" uib-btn-radio="5" ng-click = "loadAttach()">{{'RelatedAttach'|translate}}</span> <span ng-model="tabType" uib-btn-radio="5" ng-click = "loadAttach()">{{'RelatedAttach'|translate}}</span>
</div> </div>
<div class="content-info" ng-show="tabType === 1"> <div class="content-info" ng-show="tabType === 1">
<div class="cell-info-sammary"> <div class="cell-info-sammary">
<!-- <div class="tab tab-selected cell-info-title">{{'CellInfo' | translate}}</div> --> <!-- <div class="tab tab-selected cell-info-title">{{'CellInfo' | translate}}</div> -->
...@@ -44,11 +42,11 @@ ...@@ -44,11 +42,11 @@
<label class="cell-info-subject-label">{{'ColumnName' | translate}}:</label> <label class="cell-info-subject-label">{{'ColumnName' | translate}}:</label>
{{detail.cellInfo.column}} {{detail.cellInfo.column}}
</div> </div>
<!--<div class="cell-info-subject"> <div class="cell-info-subject">
<label class="cell-info-subject-label">{{'Formula' | translate}}</label> <label class="cell-info-subject-label">{{'Formula' | translate}}</label>
<formula-translator formula-list="formulaList" key-value-list="keyValueList" include-optional="false" <formula-translator formula-list="formulaList" key-value-list="keyValueList" include-optional="false"
account-data-source="accountDataSource" formula-exp="detail.config.formula"></formula-translator> account-data-source="accountDataSource" formula-exp="detail.config.formula"></formula-translator>
</div>--> </div>
<div class="cell-info-subject"> <div class="cell-info-subject">
<label class="cell-info-subject-label">{{'SourceOrFormula' | translate}}:</label> <label class="cell-info-subject-label">{{'SourceOrFormula' | translate}}:</label>
{{detail.cellInfo.description}} {{detail.cellInfo.description}}
...@@ -121,6 +119,7 @@ ...@@ -121,6 +119,7 @@
<i class="material-icons add-icon">add_circle</i><a translate="AddDataSource"></a> <i class="material-icons add-icon">add_circle</i><a translate="AddDataSource"></a>
</div> </div>
</div> </div>
<div class="data-source-detail-container"> <div class="data-source-detail-container">
<!--数据源--> <!--数据源-->
<div class="income-data-source" ng-if="selectedDataSourceTabIndex === 1 && detail.cellType != 0"> <div class="income-data-source" ng-if="selectedDataSourceTabIndex === 1 && detail.cellType != 0">
......
...@@ -1023,7 +1023,6 @@ ...@@ -1023,7 +1023,6 @@
var html = $compile(report)($scope); var html = $compile(report)($scope);
$('.export-container').append(html); $('.export-container').append(html);
} }
timeOutExportSpread(exportReportData); timeOutExportSpread(exportReportData);
}); });
return; return;
......
...@@ -439,8 +439,8 @@ commonModule.factory('enums', ['$translate', function ($translate) { ...@@ -439,8 +439,8 @@ commonModule.factory('enums', ['$translate', function ($translate) {
// 条件判断数据源 // 条件判断数据源
Judgment: 6, Judgment: 6,
//// Sap日报数据源 //RUSUM公式数据源
//SapDaily: 7, SapDaily: 7,
//// 土地出让金数据源 //// 土地出让金数据源
//LandSell: 8, //LandSell: 8,
...@@ -464,8 +464,9 @@ commonModule.factory('enums', ['$translate', function ($translate) { ...@@ -464,8 +464,9 @@ commonModule.factory('enums', ['$translate', function ($translate) {
// 用于存放特殊逻辑中获取的数据源数值与备注等信息,如未开票视同销售等 // 用于存放特殊逻辑中获取的数据源数值与备注等信息,如未开票视同销售等
Special: 19, Special: 19,
BSPL: 20, BSPL: 20,
RSUMIF : 22,
WPSR: 33 WPSR: 33,
CIT_TBAM :50 //试算平衡表
}, },
......
...@@ -11,5 +11,8 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http ...@@ -11,5 +11,8 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http
deleteCellComment: function (commentId) { deleteCellComment: function (commentId) {
return $http.post('/CellComment/Delete/' + commentId, {}, apiConfig.createVat()); return $http.post('/CellComment/Delete/' + commentId, {}, apiConfig.createVat());
}, },
getCellInformation: function(data){
return $http.get('/CellComment/getCellInformation?sql=' + data.relSql, apiConfig.vat());
}
}; };
}]); }]);
\ No newline at end of file
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