Commit 90650fb9 authored by chase's avatar chase

merge 档案管理

parent 57d00e04
...@@ -12,7 +12,8 @@ public enum FormulaDataSourceDetailType { ...@@ -12,7 +12,8 @@ public enum FormulaDataSourceDetailType {
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); ReportCellTableSUMIFDataSourceDto(7,ReportCellTableSUMIFDataSourceDto.class),
TaxCellDataSourceDto(60, pwc.taxtech.atms.dto.vatdto.TaxCellDataSourceDto.class),;
private Integer code; private Integer code;
private Class clas; private Class clas;
......
...@@ -91,22 +91,25 @@ public class OperationLogFileTypeController { ...@@ -91,22 +91,25 @@ public class OperationLogFileTypeController {
@RequestMapping("exportExcel") @RequestMapping("exportExcel")
@ResponseBody @ResponseBody
public void exportExcelFile (HttpServletResponse response){ public void exportExcelFile (HttpServletResponse response){
// public ReturnData selectListForLog(@RequestBody OperationLogFileType operationLogFileType){
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("id", "id"); headers.put("id", "id");
headers.put("operation_content", "操作内容"); // headers.put("operation_content", "操作内容");
headers.put("module_name", "模块名称"); // headers.put("module_name", "模块名称");
headers.put("operation_object", "操作对象"); // headers.put("operation_object", "操作对象");
headers.put("operation_action", "操作action"); headers.put("operation_action", "操作action");
headers.put("original_state", "原始状态"); // headers.put("original_state", "原始状态");
headers.put("update_state", "更新状态"); // headers.put("update_state", "更新状态");
headers.put("update_state", "操作内容");
headers.put("operation_user", "操作者"); headers.put("operation_user", "操作者");
headers.put("ip", "操作ip"); headers.put("ip", "操作ip");
headers.put("comment", "内容"); headers.put("comment", "内容");
headers.put("create_time", "创建时间"); headers.put("create_time", "创建时间");
List<OperationLogFileType> fileTypes = operationLogFileTypeService.selectFileTypesList(); List<OperationLogFileType> fileTypes = operationLogFileTypeService.selectFileTypesList();
// List<OperationLogFileType> operationLogFileTypes = operationLogFileTypeService.selectListForLog(operationLogFileType.getFileTypeIds());
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("档案类型日志".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream(); OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, fileTypes, ouputStream); ExcelUtil.exportExcel(headers, fileTypes, ouputStream);
}catch(Exception e){ }catch(Exception e){
......
...@@ -71,23 +71,26 @@ public class OperationLogTaxDocController { ...@@ -71,23 +71,26 @@ public class OperationLogTaxDocController {
@RequestMapping("exportExcel") @RequestMapping("exportExcel")
@ResponseBody @ResponseBody
// public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) {
public void exportExcelFile(HttpServletResponse response) { public void exportExcelFile(HttpServletResponse response) {
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("id", "id"); headers.put("id", "id");
headers.put("operation_content", "操作内容"); // headers.put("operation_content", "操作内容");
headers.put("module_name", "模块名称"); // headers.put("module_name", "模块名称");
headers.put("operation_object", "操作对象"); // headers.put("operation_object", "操作对象");
headers.put("operation_action", "操作action"); headers.put("operation_action", "操作action");
headers.put("original_state", "原始状态"); // headers.put("original_state", "原始状态");
headers.put("update_state", "更新状态"); // headers.put("update_state", "更新状态");
headers.put("update_state", "操作内容");
headers.put("operation_user", "操作者"); headers.put("operation_user", "操作者");
headers.put("ip", "操作ip"); headers.put("ip", "操作ip");
headers.put("comment", "内容"); headers.put("comment", "内容");
headers.put("create_time", "创建时间"); headers.put("create_time", "创建时间");
List<OperationLogTaxDocument> TaxDocuments = operationLogTaxDocService.selectTaxDocumentList(); List<OperationLogTaxDocument> TaxDocuments = operationLogTaxDocService.selectTaxDocumentList();
// List<String> ids = operationLogTaxDocument.getIds() == null ? Lists.newArrayList() : operationLogTaxDocument.getIds();
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("档案列表日志".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream(); OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream); ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream);
} catch (Exception e) { } catch (Exception e) {
......
package pwc.taxtech.atms.dto.vatdto;
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 java.math.BigDecimal;
public class TaxCellDataSourceDto extends DataSourceDto {
private String tag = "";
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;
public TaxCellDataSourceDto() {
this.type = FormulaDataSourceType.Report.getCode();
}
public void extractFromGroup(WPNAMEParasBo parasBo, Integer period, Integer year,
CellTemplatePerGroupDto cellTemplateData) {
this.tag = "WPNAME";
this.name = DataSourceName.ReportDataSource;
this.year = year;
this.period = period;
this.columnIndex = cellTemplateData.getColumnIndex();
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = cellTemplateData.getRowIndex();
this.rowName = cellTemplateData.getRowName();
this.reportTemplateId = cellTemplateData.getReportTemplateId();
this.cellTemplateId = cellTemplateData.getCellTemplateId() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = parasBo.getReportCode();
}
public void extractFromGroup(WPTYPEParasBo parasBo, Integer period, Integer year,
CellTemplatePerGroupDto cellTemplateData) {
this.tag = "WPTYPE";
this.name = DataSourceName.ReportDataSource;
this.year = year;
this.period = period;
this.columnIndex = cellTemplateData.getColumnIndex();
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = cellTemplateData.getRowIndex();
this.rowName = cellTemplateData.getRowName();
this.reportTemplateId = cellTemplateData.getReportTemplateId();
this.cellTemplateId = cellTemplateData.getCellTemplateId() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = parasBo.getReportCode();
}
public static TaxCellDataSourceDto nullDataSource(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo) {
TaxCellDataSourceDto nulDataSource = new TaxCellDataSourceDto();
nulDataSource.name = DataSourceName.ReportDataSource;
nulDataSource.reportTemplateId = bbParasBo.getReportCode();
nulDataSource.year = currentPeriodBo.curYear;
nulDataSource.period = currentPeriodBo.getCurPeriod();
nulDataSource.columnIndex = bbParasBo.getColumnIndex() - 1;
nulDataSource.rowIndex = bbParasBo.getRowIndex() - 1;
nulDataSource.isOnlyManualInput = false;
nulDataSource.reportName = bbParasBo.getReportCode();
return nulDataSource;
}
public void extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo,
PeriodCellData cellData, CellTemplatePerGroupDto cellTemplateData) {
this.name = DataSourceName.ReportDataSource;
this.year = currentPeriodBo.curYear;
this.period = currentPeriodBo.curPeriod;
this.columnIndex = bbParasBo.getColumnIndex() - 1;
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = bbParasBo.getRowIndex() - 1;
this.rowName = cellTemplateData.getRowName();
this.reportTemplateId = cellTemplateData.getReportTemplateId();
this.cellDataId = cellData.getId() + "";
this.cellTemplateId = cellData.getCellTemplateId() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = bbParasBo.getReportCode();
}
public void extractFromGroup(BBParasBo bbParasBo, Integer period, Integer year,
CellTemplatePerGroupDto cellTemplateData) {
this.name = DataSourceName.ReportDataSource;
this.year = year;
this.period = period;
this.columnIndex = bbParasBo.getColumnIndex() - 1;
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = bbParasBo.getRowIndex() - 1;
this.rowName = cellTemplateData.getRowName();
this.reportTemplateId = cellTemplateData.getReportTemplateId();
this.cellTemplateId = cellTemplateData.getCellTemplateId() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = bbParasBo.getReportCode();
}
public void fixedWithGroup(CellTemplatePerGroupDto dto) {
cellTemplateId = dto.getCellTemplateId();
rowName = dto.getRowName();
columnName = dto.getColumnName();
reportTemplateId = dto.getReportTemplateId();
resultType = dto.getResultType();
}
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;
}
}
...@@ -51,6 +51,7 @@ public class FileTypesServiceImpl { ...@@ -51,6 +51,7 @@ public class FileTypesServiceImpl {
requiredFieldFormatToJson(fileTypes); requiredFieldFormatToJson(fileTypes);
//设置当前时间 当前创建人信息 //设置当前时间 当前创建人信息
fileTypes.setCreateTime(new Date()); fileTypes.setCreateTime(new Date());
fileTypes.setUpdateTime(new Date());
fileTypes.setCreator(authUserHelper.getCurrentAuditor().get()); fileTypes.setCreator(authUserHelper.getCurrentAuditor().get());
fileTypes.setCreatorId(authUserHelper.getCurrentUserId()); fileTypes.setCreatorId(authUserHelper.getCurrentUserId());
int num = fileTypesMapper.insert(fileTypes); int num = fileTypesMapper.insert(fileTypes);
......
...@@ -282,8 +282,8 @@ public class TaxDocumentServiceImpl { ...@@ -282,8 +282,8 @@ public class TaxDocumentServiceImpl {
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setOperationAction("修改"); actionEntity.setOperationAction("修改");
actionEntity.setId(taxDocument.getId().toString());
//设置更新值 //设置更新值
actionEntity.setOriginalState(taxDocumentMapper.selectByPrimaryKey(taxDocument.getId()).toString());
actionEntity.setUpdateState(taxDocument.toString()); actionEntity.setUpdateState(taxDocument.toString());
boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity); boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity);
if (result) { if (result) {
......
...@@ -190,7 +190,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -190,7 +190,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
dto.setPeriod(period); dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE); dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource); dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode()); dto.setType(FormulaDataSourceType.Report.getCode());
contain.add(dto); contain.add(dto);
} }
return temp.stream().mapToDouble(a -> a.getPeriodCr().doubleValue()).sum(); return temp.stream().mapToDouble(a -> a.getPeriodCr().doubleValue()).sum();
......
...@@ -89,11 +89,23 @@ public class FunctionBase { ...@@ -89,11 +89,23 @@ public class FunctionBase {
} }
} }
public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList,FormulaDataSourceType sourceType,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val, int period, Long templateGroupId, String projectId) {
return saveDataSource(ec, dataSourceList, sourceType,formulaDataSourceDetailType, val, period, templateGroupId, null, null, projectId);
}
public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList, public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val, int period, Long templateGroupId, String projectId) { FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val, int period, Long templateGroupId, String projectId) {
return saveDataSource(ec, dataSourceList, formulaDataSourceDetailType, val, period, templateGroupId, null, null, projectId); return saveDataSource(ec, dataSourceList, formulaDataSourceDetailType, val, period, templateGroupId, null, null, projectId);
} }
public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList,FormulaDataSourceType sourceType,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val,
int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId) {
return saveDataSource(ec, dataSourceList, sourceType, formulaDataSourceDetailType, val, period,
templateGroupId, colNumP, rowNumP, projectId, null);
}
public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList, public Long saveDataSource(OperationEvaluationContext ec, List<Object> dataSourceList,
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) {
......
...@@ -187,7 +187,7 @@ public class JFFS extends FunctionBase implements FreeRefFunction { ...@@ -187,7 +187,7 @@ public class JFFS extends FunctionBase implements FreeRefFunction {
dto.setPeriod(period); dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE); dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource); dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode()); dto.setType(FormulaDataSourceType.Report.getCode());
contain.add(dto); contain.add(dto);
} }
return temp.stream().mapToDouble(a -> a.getPeriodDr().doubleValue()).sum(); return temp.stream().mapToDouble(a -> a.getPeriodDr().doubleValue()).sum();
......
...@@ -6,12 +6,14 @@ import org.apache.poi.ss.formula.OperationEvaluationContext; ...@@ -6,12 +6,14 @@ import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
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 pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.BillDetailEnum; import pwc.taxtech.atms.constant.enums.BillDetailEnum;
import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto; import pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto;
import pwc.taxtech.atms.vat.entity.BillDetail; import pwc.taxtech.atms.vat.entity.BillDetail;
import pwc.taxtech.atms.vat.entity.BillDetailExample; import pwc.taxtech.atms.vat.entity.BillDetailExample;
import pwc.taxtech.atms.vat.entity.RevenueTypeMapping; import pwc.taxtech.atms.vat.entity.RevenueTypeMapping;
...@@ -40,18 +42,17 @@ public class KPSR extends FunctionBase implements FreeRefFunction { ...@@ -40,18 +42,17 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
Integer billType = getIntParam(args[1], ec);//发票类型 Integer billType = getIntParam(args[1], ec);//发票类型
String formulaExpression = "KPSR(\"" + revenueTypeName + "\","+billType+")"; String formulaExpression = "KPSR(\"" + revenueTypeName + "\","+billType+")";
logger.debug(formulaExpression); logger.debug(formulaExpression);
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList(); List<OutputInvoiceDataSourceDto> dataSource = Lists.newArrayList();
double result = countForTrialBalance(revenueTypeName,dataSource,billType); double result = countForTrialBalance(revenueTypeName,dataSource,billType,ec);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), FormulaDataSourceDetailType.InputInvoiceDataSourceDto, new BigDecimal(result), formulaContext.getPeriod(),
FormulaDataSourceDetailType.FormulaDataSourceDto, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
new BigDecimal(result), formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId()); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result); return new NumberEval(result);
} }
private double countForTrialBalance(String revenueTypeName, List<ReportCellDataSourceDto> contain, Integer billType) { private double countForTrialBalance(String revenueTypeName, List<OutputInvoiceDataSourceDto> contain, Integer billType,OperationEvaluationContext ec) {
String queryDate = formulaContext.getYear()+(formulaContext.getPeriod()<10?("0"+formulaContext.getPeriod()):(formulaContext.getPeriod()+"")); String queryDate = formulaContext.getYear()+(formulaContext.getPeriod()<10?("0"+formulaContext.getPeriod()):(formulaContext.getPeriod()+""));
RevenueTypeMappingExample typeMappingExample = new RevenueTypeMappingExample(); RevenueTypeMappingExample typeMappingExample = new RevenueTypeMappingExample();
typeMappingExample.createCriteria().andOrgIdEqualTo(formulaContext.getOrganizationId()) typeMappingExample.createCriteria().andOrgIdEqualTo(formulaContext.getOrganizationId())
...@@ -72,13 +73,22 @@ public class KPSR extends FunctionBase implements FreeRefFunction { ...@@ -72,13 +73,22 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
.andBillTypeEqualTo(BillDetailEnum.BillType.MAPPING.get(billType)); .andBillTypeEqualTo(BillDetailEnum.BillType.MAPPING.get(billType));
List<BillDetail> billDetails = SpringContextUtil.billDetailMapper.selectByExample(billDetailExample); List<BillDetail> billDetails = SpringContextUtil.billDetailMapper.selectByExample(billDetailExample);
for (BillDetail billDetail : billDetails) { for (BillDetail billDetail : billDetails) {
ReportCellDataSourceDto dto = new ReportCellDataSourceDto(); OutputInvoiceDataSourceDto outputInvoiceDataSourceDto = new OutputInvoiceDataSourceDto();
dto.setAmount(billDetail.getBillAmount()); outputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(billDetail.getBillAmount(),
dto.setPeriod(formulaContext.getPeriod()); KeyValueConfigResultType.Accounting, null, formulaContext));
dto.setIsOnlyManualInput(Boolean.FALSE); outputInvoiceDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
dto.setName(Constant.DataSourceName.ReportDataSource); outputInvoiceDataSourceDto.setTaxAmount(FormulaHelper.roundValue(billDetail.getTaxAmount(),
dto.setType(FormulaDataSourceType.Report.getCode()); KeyValueConfigResultType.Accounting, null, formulaContext));
contain.add(dto); outputInvoiceDataSourceDto.setTaxRate(billDetail.getTaxRate());
outputInvoiceDataSourceDto.setBuyerName(billDetail.getCustomer());
outputInvoiceDataSourceDto.setInvoiceCode(billDetail.getBillCode());
outputInvoiceDataSourceDto.setInvoiceNumber(billDetail.getBillNo());
outputInvoiceDataSourceDto.setInvoiceDate(DateUtils.strToDate(billDetail.getBillDate()));
outputInvoiceDataSourceDto.setInvoiceType(billType);
outputInvoiceDataSourceDto.setPeriod(formulaContext.getPeriod());
outputInvoiceDataSourceDto.setName(Constant.DataSourceName.OutputInvoiceDataSource);
outputInvoiceDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
contain.add(outputInvoiceDataSourceDto);
} }
return billDetails.stream().mapToDouble(a -> a.getBillAmount().doubleValue()).sum(); return billDetails.stream().mapToDouble(a -> a.getBillAmount().doubleValue()).sum();
} }
......
...@@ -9,8 +9,9 @@ import org.slf4j.Logger; ...@@ -9,8 +9,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.common.util.MyAsserts; import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto; import pwc.taxtech.atms.dto.vatdto.TaxCellDataSourceDto;
import pwc.taxtech.atms.dto.vatdto.WPNAMEParasBo; import pwc.taxtech.atms.dto.vatdto.WPNAMEParasBo;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException; import pwc.taxtech.atms.exception.FormulaException;
...@@ -47,7 +48,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction { ...@@ -47,7 +48,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction {
} }
public BigDecimal bb(WPNAMEParasBo bo, OperationEvaluationContext ec, List<Object> dataSource) throws Exception { public BigDecimal bb(WPNAMEParasBo bo, OperationEvaluationContext ec, List<Object> dataSource) throws Exception {
ReportCellDataSourceDto nullCellDto = new ReportCellDataSourceDto(); TaxCellDataSourceDto nullCellDto = new TaxCellDataSourceDto();
dataSource.add(nullCellDto); dataSource.add(nullCellDto);
BigDecimal cellValue = BigDecimal.ZERO; BigDecimal cellValue = BigDecimal.ZERO;
CellTemplatePerGroupDto cellTemplateData = null; CellTemplatePerGroupDto cellTemplateData = null;
...@@ -69,7 +70,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction { ...@@ -69,7 +70,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction {
throw e; throw e;
} finally { } finally {
LOGGER.warn("[BB_Exception] error for bb cacls for {}", bo.toString()); LOGGER.warn("[BB_Exception] error for bb cacls for {}", bo.toString());
Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellDataSourceDto, Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceType.Other,FormulaDataSourceDetailType.TaxCellDataSourceDto,
cellValue, formulaContext.getPeriod(), cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), cellTemplateData.getColumnIndex(), cellTemplateData.getRowIndex(), formulaContext.getReportTemplateGroupId(), cellTemplateData.getColumnIndex(), cellTemplateData.getRowIndex(),
formulaContext.getProjectId()); formulaContext.getProjectId());
......
...@@ -643,11 +643,24 @@ ...@@ -643,11 +643,24 @@
|| $scope.selectedTabIndex === enums.formulaDataSourceType.OutputInvoice || $scope.selectedTabIndex === enums.formulaDataSourceType.OutputInvoice
|| $scope.selectedTabIndex === enums.formulaDataSourceType.InvoiceFilter) { || $scope.selectedTabIndex === enums.formulaDataSourceType.InvoiceFilter) {
evalVal = _.reduce($scope.detail.dataGridSource, function (memo, x) { evalVal = _.reduce($scope.detail.dataGridSource, function (memo, x) {
return memo + x.money; if(x.money){
return memo + x.money;
}else if(x.amount){
return memo + x.amount;
}else{
return memo;
}
}, 0); }, 0);
evalTaxVal = _.reduce($scope.detail.dataGridSource, function (memo, x) { evalTaxVal = _.reduce($scope.detail.dataGridSource, function (memo, x) {
return memo + x.taxMoney; if(x.taxMoney){
return memo + x.taxMoney;
}else if(x.taxAmount){
return memo + x.taxAmount;
}else{
return memo;
}
}, 0); }, 0);
$("#dataGridFooterSummary").html($translate.instant('Conclusion') $("#dataGridFooterSummary").html($translate.instant('Conclusion')
+ '&nbsp;&nbsp;&nbsp;&nbsp;' + $translate.instant('Amount') + ':&nbsp;&nbsp;&nbsp;&nbsp;' + '&nbsp;&nbsp;&nbsp;&nbsp;' + $translate.instant('Amount') + ':&nbsp;&nbsp;&nbsp;&nbsp;'
......
...@@ -446,7 +446,12 @@ taxDocumentManageModule.controller('taxDocumentListController', ...@@ -446,7 +446,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
//取消 //取消
var cancelDocFileType = function () { var cancelDocFileType = function () {
console.log("cancelDocFileType") $scope.multiUploadSuccessItems.length = 0;
$scope.multiUploader.clearQueue();
$scope.uploader.clearQueue();
$scope.multiUploadErrorItems.length = 0;
$scope.editFieldModel = {};
$scope.editFieldModel_multi = [];
}; };
var delRecord = function () { var delRecord = function () {
...@@ -779,60 +784,106 @@ taxDocumentManageModule.directive('multiFileUploader', function () { ...@@ -779,60 +784,106 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$('#multiUploadPopDialog').modal('hide'); $('#multiUploadPopDialog').modal('hide');
$('#busy-indicator-container').hide();
}; };
$scope.multiUploader.onSuccessItem = function (fileItem, response) { $scope.multiUploader.onSuccessItem = function (fileItem, response) {
// fileItem.filePositionUrl = response; // fileItem.filePositionUrl = response;
$scope.multiUploadSuccessItems.push(fileItem); $scope.multiUploadSuccessItems.push(fileItem);
$('#busy-indicator-container').show();
}; };
$scope.multiUploadSubmit = function () { $scope.multiUploadSubmit = function () {
$scope.multiUploadErrorItems = []; $scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = []; $scope.multiUploadSuccessItems = [];
for (var i = 0; i < $scope.multiUploader.queue.length; i++) { var alertContent = verifyRequiredFields($scope.editFieldModel_multi);
// 先设置uploader队列里每个文件的请求参数:fileOriginalName if(!alertContent){
var fileItem = $scope.multiUploader.queue[i]; multiUpload();
fileItem.formData = [{ }else{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name swal(alertContent);
}]; }
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function (key) { function verifyRequiredFields(editFieldModel_multi){
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : ""; var alertText = "";
if (/ownTime/.test(key)) {
// var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/"; for(var i = 0; i < editFieldModel_multi.length; i++){
// fields[key] = parseInt(curItemValue.split(splitMark).join("")); var modelItem = editFieldModel_multi[i];
if(!modelItem.companyName){
fields[key] = $scope.queryOwnTime(curItemValue, "int"); alertText += ""+$translate.instant("CompanyName")+""
} else { }
if (/(createTime|updateTime|uploadTime)/.test(key)) { if(!modelItem.fileType){
fields[key] = $scope.getQueryDate(curItemValue, "/"); alertText += ""+$translate.instant("DocumentType")+""
} else fields[key] = curItemValue; }
if(!modelItem.fileAttr){
alertText += ""+$translate.instant("DocumentAttr")+""
}
if(!modelItem.taxType){
alertText += ""+$translate.instant("DocumentType")+""
}
if(!modelItem.ownTime){
alertText += ""+$translate.instant("Duration")+""
}
if(!modelItem.fileTime){
alertText += ""+$translate.instant("AvailabilityDate")+""
} }
fileItem.formData.push(fields);
});
if(alertText.length > 0){
alertText = "档案" + (i + 1) + "," + alertText + "为必填字段,不能为空,请检查";
break;
}
}
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) { return alertText;
}
var params = angular.copy(_editFieldModel); function multiUpload(){
// params.ownTime = params.ownTime ? params.ownTime : ""; for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
params.ownTime = $scope.queryOwnTime(params.ownTime, "int"); // 先设置uploader队列里每个文件的请求参数:fileOriginalName
params.fileTime = $scope.getQueryDate(params.fileTime, "-"); var fileItem = $scope.multiUploader.queue[i];
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-"); fileItem.formData = [{
_taxDocumentListService.verifyDuplicate(params).then(function (data) { fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
if (data == true) { }];
_fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/add";
// 过滤参数格式,并把参数推进上传队列
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function (key) {
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) {
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else { } else {
_fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/edit"; if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
} }
_multiUploader.uploadItem(_i); fileItem.formData.push(fields);
}); });
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
(function (_i, _fileItem, _editFieldModel, _taxDocumentListService, _multiUploader) {
var params = angular.copy(_editFieldModel);
// params.ownTime = params.ownTime ? params.ownTime : "";
// params.ownTime = parseInt(_editFieldModel.ownTime.split("-").join(""));
params.ownTime = $scope.queryOwnTime(params.ownTime, "int");
params.fileTime = $scope.getQueryDate(params.fileTime, "-");
params.effectiveTime = $scope.getQueryDate(params.effectiveTime, "-");
_taxDocumentListService.verifyDuplicate(params).then(function (data) {
if (data == true) {
_fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/add";
} else {
_fileItem.url = "http://etms.longi-silicon.com:8180//api/v1/taxDoc/edit";
}
_multiUploader.uploadItem(_i);
});
})(i, fileItem, editFieldModel, taxDocumentListService, $scope.multiUploader);
}
} }
}; };
...@@ -1266,19 +1317,26 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1266,19 +1317,26 @@ taxDocumentManageModule.directive('watchGroup', function () {
// 5,文档类型ID // 5,文档类型ID
$scope.autoMatchAttrAndType = function (fileName, fieldModel) { $scope.autoMatchAttrAndType = function (fileName, fieldModel) {
fileName = fileName ? fileName : ""; fileName = fileName ? fileName : "";
var fieldsAttrs = fileName.split("_"); var fieldsArray = fileName.split("_");
if(fieldsAttrs.length){ // 嘀嘀无限_增值税纳税申报表_增值税_201811_20181201
fieldModel.companyName = fieldsAttrs[0]; // 公司名_文档类型_税种_所属期间_到期日
fieldModel.fileType = fieldsAttrs[1]; if(fieldsArray.length){
//需要验证每个值在对应的下拉菜单里面有没有对应的值
fieldModel.companyName = $scope.verifyRequiredData(fieldsArray[0],"companyName");
fieldModel.fileType = $scope.verifyRequiredData(fieldsArray[1],"fileType");
fieldModel.taxType = $scope.verifyRequiredData(fieldsArray[2],"taxType");
fieldModel.ownTime = $scope.intToDate(fieldsArray[3]);
fieldModel.fileTime = $scope.intToDate(fieldsArray[4]);
} }
// 根据Type来匹配Attr; // 根据Type来匹配Attr;
Object.keys($scope.typeAndAttrMap).forEach(function (key) { Object.keys($scope.typeAndAttrMap).forEach(function (key) {
if (fieldModel.fileType === key) { if (fieldModel.fileType === key) {
fieldModel.fileAttr = $scope.typeAndAttrMap[key]; fieldModel.fileAttr = $scope.verifyRequiredData($scope.typeAndAttrMap[key],"fileAttr");
} }
}); });
$scope.syncFileType(fieldModel.fileAttr);
$scope.syncRequiredFields(fieldModel); $scope.syncRequiredFields(fieldModel);
$scope.matchCompanyId(fieldModel); $scope.matchCompanyId(fieldModel);
}; };
...@@ -1319,6 +1377,26 @@ taxDocumentManageModule.directive('watchGroup', function () { ...@@ -1319,6 +1377,26 @@ taxDocumentManageModule.directive('watchGroup', function () {
}) })
}; };
// 根据当前获取的字段值来匹配下拉菜单,如果匹配不到就返回空字符串,以使得form表单验证功能正常
$scope.verifyRequiredData = function(src,type){
var pass = false;
switch (type){
case "taxType":
pass = $scope.taxTypeSelects.indexOf(src) > -1;
break;
case "fileAttr":
pass = $scope.fileAttrOptions.indexOf(src) > -1;
break;
case "fileType":
pass = $scope.fileTypeOptions.indexOf(src) > -1;
break;
case "companyName":
pass = Object.values($scope.companyNameOptionsMap).indexOf(src) > -1;
break;
}
return pass ? src : undefined;
}
}] }]
} }
}); });
...@@ -1329,7 +1407,16 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1329,7 +1407,16 @@ taxDocumentManageModule.directive('tempModule', function () {
controller: ['$scope', 'taxDocumentListService', '$translate', controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope, taxDocumentListService, $translate) { function ($scope, taxDocumentListService, $translate) {
//税种 //税种
$scope.taxTypeSelects = ["纳税申报表", "税票"]; $scope.taxTypeSelects =
[ "纳税申报表",
"税票",
"企业所得税",
"印花税",
"附加税",
"代扣代缴税",
"其它税",
"增值税",
];
$scope.getQueryDate = function (time, mark) { $scope.getQueryDate = function (time, mark) {
if (!time) return ""; if (!time) return "";
...@@ -1420,19 +1507,33 @@ taxDocumentManageModule.directive('tempModule', function () { ...@@ -1420,19 +1507,33 @@ taxDocumentManageModule.directive('tempModule', function () {
$scope.sortByFirstCode = function(src){ $scope.sortByFirstCode = function(src){
var result = []; var result = [];
var typeKeys = []; var firstCodesOrigin = [];
var typeMap = {}; var originValuesMapping = [];
src.forEach(function(key){ src.forEach(function(key,index){
typeKeys.push((key + "").substr(0,1)); // 记录原始的下标,拼在第一个字符后面
typeMap[(key + "").substr(0,1)] = key; var firstCode = (key + "").substr(0,1) + "_" + index;
firstCodesOrigin.push(firstCode);
originValuesMapping.push(key);
}); });
typeKeys.sort().forEach(function(key){ firstCodesOrigin.sort().forEach(function(firstCodeSortedItem,sortedIndex){
result.push(typeMap[key]); // 循环已排序的首字符数组,根据记录的原始下标,对换originValuesMapping的位置
var originIndex = firstCodeSortedItem.split("_").pop();
result[sortedIndex] = originValuesMapping[originIndex];
}); });
return result; return result;
} }
$scope.intToDate = function(src,type){
src = src + "";
if(!src) return src;
type = type ? type : "/";
var year = src.substr(0,4);
var mon = src.substr(4,2);
var day = src.substr(6,2);
if(!day) return year + type + mon;
return year + type + mon + type + day;
};
}] }]
} }
}); });
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
/*left: 0;*/ /*left: 0;*/
/*top: 0;*/ /*top: 0;*/
float: left; float: left;
min-width: 100px; /*min-width: 100px;*/
/*max-width: 100px;*/ /*max-width: 100px;*/
width: 10%; width: 10%;
} }
...@@ -339,6 +339,10 @@ ...@@ -339,6 +339,10 @@
color: #fff; color: #fff;
} }
div.showSweetAlert{
box-shadow: 0 0 12px #9e9e9e;
animation: showSweetAlert 0.3s;
}
</style> </style>
<div class="menu-header TDL-header"> <div class="menu-header TDL-header">
<div class="TDL-query-bar" ng-init="MoreFields = false"> <div class="TDL-query-bar" ng-init="MoreFields = false">
...@@ -853,7 +857,7 @@ ...@@ -853,7 +857,7 @@
aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false"> aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:80%;height:200px;max-width:1028px" role="document"> <div class="modal-dialog" style="width:80%;height:200px;max-width:1028px" role="document">
<div class="modal-content"> <div class="modal-content">
<form class="form-horizontal" name="newDocFileTypeForm" ng-submit="multiUploadSubmit()"> <form class="form-horizontal" name="newDocFileTypeForm">
<div class="modal-header" > <div class="modal-header" >
<div class="modal-title"><span>{{'MultiUpload'|translate}}</span></div> <div class="modal-title"><span>{{'MultiUpload'|translate}}</span></div>
<input id="multiUploadFilePlugin" type="file" multiple style="display:none" nv-file-select <input id="multiUploadFilePlugin" type="file" multiple style="display:none" nv-file-select
...@@ -1025,14 +1029,18 @@ ...@@ -1025,14 +1029,18 @@
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
<input class="form-control" <input class="form-control"
placeholder="{{'EntityStorageDescription'|translate}}" placeholder="{{'PleaseSelected'|translate}}"
ng-model="editFieldItem.storageArea" ng-model="editFieldItem.storageArea"
ng-required="isRequired('EntityStorageLocation')" ng-required="isRequired('EntityStorageLocation')"
/> />
</div> </div>
<div class="DTL-special-external-btn" <div class="DTL-special-external-btn"
title="{{'EntityStorageDescription'|translate}}"> title="{{'EntityStorageDescription'|translate}}">
<i class="fa fake-exclamatory-circle"></i> <!--<i class="fa fake-exclamatory-circle"></i>-->
<a href="javascript:void(0)" ng-click="openHelpPopForEntityStorage()">
<i class="fa fake-exclamatory-circle" aria-hidden="true"></i>
</a>
</div> </div>
</div> </div>
<div class="col-sm-6 form-group"> <div class="col-sm-6 form-group">
...@@ -1082,7 +1090,7 @@ ...@@ -1082,7 +1090,7 @@
<div style="clear:both"></div> <div style="clear:both"></div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary" translate="Confirm"></button> <button type="button" class="btn btn-primary" translate="Confirm" ng-click="multiUploadSubmit()"></button>
<button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()" <button type="button" class="btn btn-third" data-dismiss="modal" ng-click="cancelDocFileType()"
translate="Cancel"></button> translate="Cancel"></button>
</div> </div>
......
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