Commit 90650fb9 authored by chase's avatar chase

merge 档案管理

parent 57d00e04
......@@ -12,7 +12,8 @@ public enum FormulaDataSourceDetailType {
AssetDetailDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto.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 Class clas;
......
......@@ -91,22 +91,25 @@ public class OperationLogFileTypeController {
@RequestMapping("exportExcel")
@ResponseBody
public void exportExcelFile (HttpServletResponse response){
// public ReturnData selectListForLog(@RequestBody OperationLogFileType operationLogFileType){
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put("id", "id");
headers.put("operation_content", "操作内容");
headers.put("module_name", "模块名称");
headers.put("operation_object", "操作对象");
// headers.put("operation_content", "操作内容");
// headers.put("module_name", "模块名称");
// headers.put("operation_object", "操作对象");
headers.put("operation_action", "操作action");
headers.put("original_state", "原始状态");
headers.put("update_state", "更新状态");
// headers.put("original_state", "原始状态");
// headers.put("update_state", "更新状态");
headers.put("update_state", "操作内容");
headers.put("operation_user", "操作者");
headers.put("ip", "操作ip");
headers.put("comment", "内容");
headers.put("create_time", "创建时间");
List<OperationLogFileType> fileTypes = operationLogFileTypeService.selectFileTypesList();
// List<OperationLogFileType> operationLogFileTypes = operationLogFileTypeService.selectListForLog(operationLogFileType.getFileTypeIds());
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();
ExcelUtil.exportExcel(headers, fileTypes, ouputStream);
}catch(Exception e){
......
......@@ -71,23 +71,26 @@ public class OperationLogTaxDocController {
@RequestMapping("exportExcel")
@ResponseBody
// public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) {
public void exportExcelFile(HttpServletResponse response) {
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put("id", "id");
headers.put("operation_content", "操作内容");
headers.put("module_name", "模块名称");
headers.put("operation_object", "操作对象");
// headers.put("operation_content", "操作内容");
// headers.put("module_name", "模块名称");
// headers.put("operation_object", "操作对象");
headers.put("operation_action", "操作action");
headers.put("original_state", "原始状态");
headers.put("update_state", "更新状态");
// headers.put("original_state", "原始状态");
// headers.put("update_state", "更新状态");
headers.put("update_state", "操作内容");
headers.put("operation_user", "操作者");
headers.put("ip", "操作ip");
headers.put("comment", "内容");
headers.put("create_time", "创建时间");
List<OperationLogTaxDocument> TaxDocuments = operationLogTaxDocService.selectTaxDocumentList();
// List<String> ids = operationLogTaxDocument.getIds() == null ? Lists.newArrayList() : operationLogTaxDocument.getIds();
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();
ExcelUtil.exportExcel(headers, TaxDocuments, ouputStream);
} 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 {
requiredFieldFormatToJson(fileTypes);
//设置当前时间 当前创建人信息
fileTypes.setCreateTime(new Date());
fileTypes.setUpdateTime(new Date());
fileTypes.setCreator(authUserHelper.getCurrentAuditor().get());
fileTypes.setCreatorId(authUserHelper.getCurrentUserId());
int num = fileTypesMapper.insert(fileTypes);
......
......@@ -282,8 +282,8 @@ public class TaxDocumentServiceImpl {
if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setOperationAction("修改");
actionEntity.setId(taxDocument.getId().toString());
//设置更新值
actionEntity.setOriginalState(taxDocumentMapper.selectByPrimaryKey(taxDocument.getId()).toString());
actionEntity.setUpdateState(taxDocument.toString());
boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity);
if (result) {
......
......@@ -190,7 +190,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode());
dto.setType(FormulaDataSourceType.Report.getCode());
contain.add(dto);
}
return temp.stream().mapToDouble(a -> a.getPeriodCr().doubleValue()).sum();
......
......@@ -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,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val, int period, Long templateGroupId, String 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,
FormulaDataSourceDetailType formulaDataSourceDetailType, BigDecimal val,
int period, Long templateGroupId, Integer colNumP, Integer rowNumP, String projectId) {
......
......@@ -187,7 +187,7 @@ public class JFFS extends FunctionBase implements FreeRefFunction {
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode());
dto.setType(FormulaDataSourceType.Report.getCode());
contain.add(dto);
}
return temp.stream().mapToDouble(a -> a.getPeriodDr().doubleValue()).sum();
......
......@@ -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.ValueEval;
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.constant.Constant;
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.FormulaDataSourceType;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto;
import pwc.taxtech.atms.vat.entity.BillDetail;
import pwc.taxtech.atms.vat.entity.BillDetailExample;
import pwc.taxtech.atms.vat.entity.RevenueTypeMapping;
......@@ -40,18 +42,17 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
Integer billType = getIntParam(args[1], ec);//发票类型
String formulaExpression = "KPSR(\"" + revenueTypeName + "\","+billType+")";
logger.debug(formulaExpression);
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
List<OutputInvoiceDataSourceDto> dataSource = Lists.newArrayList();
double result = countForTrialBalance(revenueTypeName,dataSource,billType);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
double result = countForTrialBalance(revenueTypeName,dataSource,billType,ec);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), FormulaDataSourceDetailType.InputInvoiceDataSourceDto, new BigDecimal(result), formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
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()+""));
RevenueTypeMappingExample typeMappingExample = new RevenueTypeMappingExample();
typeMappingExample.createCriteria().andOrgIdEqualTo(formulaContext.getOrganizationId())
......@@ -72,13 +73,22 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
.andBillTypeEqualTo(BillDetailEnum.BillType.MAPPING.get(billType));
List<BillDetail> billDetails = SpringContextUtil.billDetailMapper.selectByExample(billDetailExample);
for (BillDetail billDetail : billDetails) {
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.setAmount(billDetail.getBillAmount());
dto.setPeriod(formulaContext.getPeriod());
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.Report.getCode());
contain.add(dto);
OutputInvoiceDataSourceDto outputInvoiceDataSourceDto = new OutputInvoiceDataSourceDto();
outputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(billDetail.getBillAmount(),
KeyValueConfigResultType.Accounting, null, formulaContext));
outputInvoiceDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
outputInvoiceDataSourceDto.setTaxAmount(FormulaHelper.roundValue(billDetail.getTaxAmount(),
KeyValueConfigResultType.Accounting, null, formulaContext));
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();
}
......
......@@ -9,8 +9,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
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.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException;
......@@ -47,7 +48,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction {
}
public BigDecimal bb(WPNAMEParasBo bo, OperationEvaluationContext ec, List<Object> dataSource) throws Exception {
ReportCellDataSourceDto nullCellDto = new ReportCellDataSourceDto();
TaxCellDataSourceDto nullCellDto = new TaxCellDataSourceDto();
dataSource.add(nullCellDto);
BigDecimal cellValue = BigDecimal.ZERO;
CellTemplatePerGroupDto cellTemplateData = null;
......@@ -69,7 +70,7 @@ public class WPNAME extends FunctionBase implements FreeRefFunction {
throw e;
} finally {
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(),
formulaContext.getReportTemplateGroupId(), cellTemplateData.getColumnIndex(), cellTemplateData.getRowIndex(),
formulaContext.getProjectId());
......
......@@ -643,11 +643,24 @@
|| $scope.selectedTabIndex === enums.formulaDataSourceType.OutputInvoice
|| $scope.selectedTabIndex === enums.formulaDataSourceType.InvoiceFilter) {
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);
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);
$("#dataGridFooterSummary").html($translate.instant('Conclusion')
+ '&nbsp;&nbsp;&nbsp;&nbsp;' + $translate.instant('Amount') + ':&nbsp;&nbsp;&nbsp;&nbsp;'
......
......@@ -446,7 +446,12 @@ taxDocumentManageModule.controller('taxDocumentListController',
//取消
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 () {
......@@ -779,60 +784,106 @@ taxDocumentManageModule.directive('multiFileUploader', function () {
$('#multiUploadPopDialog').modal('hide');
$('#busy-indicator-container').hide();
};
$scope.multiUploader.onSuccessItem = function (fileItem, response) {
// fileItem.filePositionUrl = response;
$scope.multiUploadSuccessItems.push(fileItem);
$('#busy-indicator-container').show();
};
$scope.multiUploadSubmit = function () {
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
var fileItem = $scope.multiUploader.queue[i];
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function (key) {
var fields = {};
var curItemValue = editFieldModel[key] ? editFieldModel[key] : "";
if (/ownTime/.test(key)) {
// var splitMark = curItemValue.indexOf("-") > -1 ? "-" : "/";
// fields[key] = parseInt(curItemValue.split(splitMark).join(""));
fields[key] = $scope.queryOwnTime(curItemValue, "int");
} else {
if (/(createTime|updateTime|uploadTime)/.test(key)) {
fields[key] = $scope.getQueryDate(curItemValue, "/");
} else fields[key] = curItemValue;
var alertContent = verifyRequiredFields($scope.editFieldModel_multi);
if(!alertContent){
multiUpload();
}else{
swal(alertContent);
}
function verifyRequiredFields(editFieldModel_multi){
var alertText = "";
for(var i = 0; i < editFieldModel_multi.length; i++){
var modelItem = editFieldModel_multi[i];
if(!modelItem.companyName){
alertText += ""+$translate.instant("CompanyName")+""
}
if(!modelItem.fileType){
alertText += ""+$translate.instant("DocumentType")+""
}
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);
// 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";
function multiUpload(){
for (var i = 0; i < $scope.multiUploader.queue.length; i++) {
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
var fileItem = $scope.multiUploader.queue[i];
fileItem.formData = [{
fileOriginName: fileItem.name ? fileItem.name : fileItem._file.name
}];
// 过滤参数格式,并把参数推进上传队列
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 {
_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 () {
// 5,文档类型ID
$scope.autoMatchAttrAndType = function (fileName, fieldModel) {
fileName = fileName ? fileName : "";
var fieldsAttrs = fileName.split("_");
if(fieldsAttrs.length){
fieldModel.companyName = fieldsAttrs[0];
fieldModel.fileType = fieldsAttrs[1];
var fieldsArray = fileName.split("_");
// 嘀嘀无限_增值税纳税申报表_增值税_201811_20181201
// 公司名_文档类型_税种_所属期间_到期日
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;
Object.keys($scope.typeAndAttrMap).forEach(function (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.matchCompanyId(fieldModel);
};
......@@ -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 () {
controller: ['$scope', 'taxDocumentListService', '$translate',
function ($scope, taxDocumentListService, $translate) {
//税种
$scope.taxTypeSelects = ["纳税申报表", "税票"];
$scope.taxTypeSelects =
[ "纳税申报表",
"税票",
"企业所得税",
"印花税",
"附加税",
"代扣代缴税",
"其它税",
"增值税",
];
$scope.getQueryDate = function (time, mark) {
if (!time) return "";
......@@ -1420,19 +1507,33 @@ taxDocumentManageModule.directive('tempModule', function () {
$scope.sortByFirstCode = function(src){
var result = [];
var typeKeys = [];
var typeMap = {};
src.forEach(function(key){
typeKeys.push((key + "").substr(0,1));
typeMap[(key + "").substr(0,1)] = key;
var firstCodesOrigin = [];
var originValuesMapping = [];
src.forEach(function(key,index){
// 记录原始的下标,拼在第一个字符后面
var firstCode = (key + "").substr(0,1) + "_" + index;
firstCodesOrigin.push(firstCode);
originValuesMapping.push(key);
});
typeKeys.sort().forEach(function(key){
result.push(typeMap[key]);
firstCodesOrigin.sort().forEach(function(firstCodeSortedItem,sortedIndex){
// 循环已排序的首字符数组,根据记录的原始下标,对换originValuesMapping的位置
var originIndex = firstCodeSortedItem.split("_").pop();
result[sortedIndex] = originValuesMapping[originIndex];
});
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 @@
/*left: 0;*/
/*top: 0;*/
float: left;
min-width: 100px;
/*min-width: 100px;*/
/*max-width: 100px;*/
width: 10%;
}
......@@ -339,6 +339,10 @@
color: #fff;
}
div.showSweetAlert{
box-shadow: 0 0 12px #9e9e9e;
animation: showSweetAlert 0.3s;
}
</style>
<div class="menu-header TDL-header">
<div class="TDL-query-bar" ng-init="MoreFields = false">
......@@ -853,7 +857,7 @@
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-content">
<form class="form-horizontal" name="newDocFileTypeForm" ng-submit="multiUploadSubmit()">
<form class="form-horizontal" name="newDocFileTypeForm">
<div class="modal-header" >
<div class="modal-title"><span>{{'MultiUpload'|translate}}</span></div>
<input id="multiUploadFilePlugin" type="file" multiple style="display:none" nv-file-select
......@@ -1025,14 +1029,18 @@
</label>
<div class="col-sm-11" style="width:61.67%">
<input class="form-control"
placeholder="{{'EntityStorageDescription'|translate}}"
placeholder="{{'PleaseSelected'|translate}}"
ng-model="editFieldItem.storageArea"
ng-required="isRequired('EntityStorageLocation')"
/>
</div>
<div class="DTL-special-external-btn"
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 class="col-sm-6 form-group">
......@@ -1082,7 +1090,7 @@
<div style="clear:both"></div>
</div>
<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()"
translate="Cancel"></button>
</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