Commit 27e20682 authored by chase's avatar chase

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 63676740 ddbcf971
...@@ -198,7 +198,6 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -198,7 +198,6 @@ public class TemplateGroupServiceImpl extends AbstractService {
return ""; return "";
} }
public static final String PROTABLEID = "100610523201314816";
@Autowired @Autowired
private EbitCellDataMapper ebitCellDataMapper; private EbitCellDataMapper ebitCellDataMapper;
...@@ -217,8 +216,8 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -217,8 +216,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
List<InvoiceData> cfs = Lists.newArrayList(); List<InvoiceData> cfs = Lists.newArrayList();
String[] sheetName = sheet.getSheetName().split("-"); String[] sheetName = sheet.getSheetName().split("-");
String taypayerNum = sheetName[0]; String taypayerNum = sheetName[0];
String titleValue = sheet.getRow(0).getCell(3).getStringCellValue(); String titleValue = sheet.getRow(0).getCell(2).getStringCellValue();
if ("".equals(titleValue) || !"".equals("利润表(单家PRC)")) if (titleValue.indexOf("利润表") == -1)
throw new ServiceException(ErrorMessageCN.ErrorFileFormat); throw new ServiceException(ErrorMessageCN.ErrorFileFormat);
if (period == null) { if (period == null) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
...@@ -238,8 +237,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -238,8 +237,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
ebitCellData.setCol(j); ebitCellData.setCol(j);
ebitCellData.setRow(m); ebitCellData.setRow(m);
ebitCellData.setCreateTime(now); ebitCellData.setCreateTime(now);
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue()); if(sheet.getRow(m).getCell(j) != null)
ebitCellData.setTemplateId(PROTABLEID); ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
ebitCellData.setTemplateId(String.valueOf(idService.nextId()));
ebitCellData.setProjectId(projectId); ebitCellData.setProjectId(projectId);
ebitCellData.setOrganizationId(orgId); ebitCellData.setOrganizationId(orgId);
ebitCellData.setPeriod(period); ebitCellData.setPeriod(period);
...@@ -252,9 +252,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -252,9 +252,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.setResult(false); operationResultDto.success(e.getMessage());
} }
operationResultDto.setResult(true); operationResultDto.success();
return operationResultDto; return operationResultDto;
} }
......
...@@ -74,8 +74,8 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -74,8 +74,8 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
dataSource.add(reportCellTableSUMIFDataSourceDto); dataSource.add(reportCellTableSUMIFDataSourceDto);
tableName = resolverString(args, ec, 0); tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1); getField = resolverString(args, ec, 1);
filter= resolverString(args, ec, 2); filter = resolverString(args, ec, 2);
filterValue= resolverString(args, ec, 3); filterValue = resolverString(args, ec, 3);
year = resolverInteger(args, ec, 4);//会计年度 year = resolverInteger(args, ec, 4);//会计年度
period = Integer.parseInt(resolverString(args, ec, 5));//会计期间 period = Integer.parseInt(resolverString(args, ec, 5));//会计期间
cellValue = agent.getTableDataByName(tableName, getField, filter, filterValue, period, year, formulaContext); cellValue = agent.getTableDataByName(tableName, getField, filter, filterValue, period, year, formulaContext);
...@@ -85,17 +85,18 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -85,17 +85,18 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
return new NumberEval(0.00); return new NumberEval(0.00);
} finally { } finally {
boolean boo; boolean boo;
if(TableRule.map.get(tableName).substring(0, 3).equals("cit")){
boo = true;
}else{
boo = false;
}
Long dataSourceId = null; Long dataSourceId = null;
try { try {
if (TableRule.map.get(tableName).substring(0, 3).equals("cit")) {
boo = true;
} else {
boo = false;
}
dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto, dataSourceId = saveDataRSUMIFSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellTableSUMIFDataSourceDto,
cellValue, formulaContext.getPeriod(), cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(), formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(),
formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField,tableName,filter,filterValue,period,formulaContext,year, boo, true)); formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField, tableName, filter, filterValue, period, formulaContext, year, boo, true));
saveFormulaBlock(formulaContext.getPeriod(), ec, saveFormulaBlock(formulaContext.getPeriod(), ec,
new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId()); new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId());
} catch (Exception e) { } catch (Exception e) {
...@@ -108,12 +109,12 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction { ...@@ -108,12 +109,12 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
public FormulaDataSourceType selectShow(String tableName) { public FormulaDataSourceType selectShow(String tableName) {
if ("CIT_TBAM".equals(tableName)) { if ("CIT_TBAM".equals(tableName)) {
return FormulaDataSourceType.CIT_TBAM; return FormulaDataSourceType.CIT_TBAM;
}else{ } else {
return FormulaDataSourceType.Other; return FormulaDataSourceType.Other;
} }
} }
public static String getSql (){ public static String getSql() {
return ""; return "";
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
period, create_time, update_time period, create_time, update_time
</sql> </sql>
<insert id="insertBatch" parameterType="java.util.List"> <insert id="insertBatch" parameterType="java.util.List">
insert into profit_loss_statement_manual insert into ebit_cell_data
(<include refid="Base_Column_List_Ebit"/>) (<include refid="Base_Column_List_Ebit"/>)
values values
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) { scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource) { if (scope.templateId && scope.reportSource) {
setData(); setData(true);
} }
}); });
var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"]; var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"];
...@@ -85,49 +85,38 @@ ...@@ -85,49 +85,38 @@
} }
}; };
scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data', 'relation.broadcast'], function(newValue, oldValue){ scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function(newValue, oldValue){
if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){ if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){
loadSheet(scope.templateId, true) loadSheet(scope.templateId, true)
} }
}); });
scope.$watch('relation.broadcast', function(newValue, oldValue){
if(scope.relation.orgId != null && scope.relation.period != null && scope.spread != undefined){
loadSheet(scope.templateId, false)
}
});
var loadSheet = function (templateId, init) { var loadSheet = function (templateId, init) {
//var prokjectId = vatSessionService.project.id; //var prokjectId = vatSessionService.project.id;
//var period = vatSessionService.month; //var period = vatSessionService.month;
if(scope.relation.orgId == undefined){
scope.relation.orgId = "-1";
}
if(!init){ if(!init){
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) { addEbitRow();
var spreadCtrl = getSpreadControl(); setData(init)
if (spreadCtrl) { return;
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
return locateCell(spread, true);
});
}
}, function (data) {
$log.info(data);
});
}else{
return templateService.getPeriodTemplateJsonByInit(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
return locateCell(spread, true);
});
}
}, function (data) {
$log.info(data);
});
} }
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) {
return locateCell(spread, true);
});
}
}, function (data) {
$log.info(data);
});
}; };
var initSpreadExcel = function (reportSpread) { var initSpreadExcel = function (reportSpread) {
...@@ -177,11 +166,16 @@ ...@@ -177,11 +166,16 @@
} }
spread.resumePaint(); spread.resumePaint();
scope.spread = spread; scope.spread = spread;
addEbitRow(sheet)
if (scope.templateId && scope.reportSource ) { if (scope.templateId && scope.reportSource ) {
setData("true"); setData(true);
} }
// return $q.when(spread);
sheet.setColumnWidth(0, 350) };
var addEbitRow = function(sheet){
if(sheet == undefined || sheet == null)
sheet = scope.spread.getActiveSheet();
sheet.setColumnWidth(0, 400)
//添加单元格 //添加单元格
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
...@@ -190,8 +184,7 @@ ...@@ -190,8 +184,7 @@
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.setValue(i+37,0, profileList[i]); sheet.setValue(i+37,0, profileList[i]);
} }
return $q.when(spread); }
};
var setEditable = function (spread, isReadOnly, ifSuspend) { var setEditable = function (spread, isReadOnly, ifSuspend) {
...@@ -334,7 +327,7 @@ ...@@ -334,7 +327,7 @@
cell.value = modifiedReportCell.value; cell.value = modifiedReportCell.value;
cell.isModified = true; cell.isModified = true;
cell.modifiedReportCell = modifiedReportCell; cell.modifiedReportCell = modifiedReportCell;
setData(); setData(true);
}); });
var cellValueResetFunc = $rootScope.$on('cellValueReset', function (event, args) { var cellValueResetFunc = $rootScope.$on('cellValueReset', function (event, args) {
...@@ -344,7 +337,7 @@ ...@@ -344,7 +337,7 @@
cell.value = cell.modifiedReportCell ? cell.modifiedReportCell.originalValue : cell.value; cell.value = cell.modifiedReportCell ? cell.modifiedReportCell.originalValue : cell.value;
cell.isModified = false; cell.isModified = false;
cell.modifiedReportCell = null; cell.modifiedReportCell = null;
setData(); setData(true);
}); });
scope.$on('$destroy', function () { scope.$on('$destroy', function () {
...@@ -383,8 +376,12 @@ ...@@ -383,8 +376,12 @@
}; };
// 根据已有信息通过spreadJS计算各单元格的值 // 根据已有信息通过spreadJS计算各单元格的值
var setData = function (saveAndRefresh) { var setData = function (init) {
var sheet = scope.spread.sheets[0]; var sheet = scope.spread.sheets[0];
if(!init){
loadEbitCell(sheet);
return;
}
var isExportData = false; var isExportData = false;
if (angular.isArray(scope.reportSource)) { if (angular.isArray(scope.reportSource)) {
spreadJsTipService.initialize(sheet); spreadJsTipService.initialize(sheet);
...@@ -523,19 +520,15 @@ ...@@ -523,19 +520,15 @@
} }
} }
} }
if(saveAndRefresh && saveAndRefresh == "false"){ loadEbitCell(sheet, false);
loadEbitCell(sheet, false);
}else if ( saveAndRefresh && saveAndRefresh == "true"){
loadEbitCell(sheet, true);
}
spreadJsTipService.paintSheet(sheet); spreadJsTipService.paintSheet(sheet);
} }
}; };
//加载Ebit数据 //加载Ebit数据
var loadEbitCell = function(sheet, type){ var loadEbitCell = function(sheet){
for( var r = 37; r<= 43; r++ ){ for( var r = 37; r<= 43; r++ ){
for(var c = 1; c<=3; c++){ for(var c = 1; c<=3; c++){
if(c == 3 && type){ if(c == 3){
if(r == 37){ if(r == 37){
sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction)); sheet.setValue(r, c,PWC.tryParseStringToNum(scope.relation.data.ebitSubtraction));
} }
......
...@@ -2879,22 +2879,10 @@ ...@@ -2879,22 +2879,10 @@
}; };
var initDatePicker = function () { var initDatePicker = function () {
if ($scope.serviceTypeId === enums.serviceType.CIT) {
$scope.systemTitle = $translate.instant('CIT');
$scope.viewMode = 2;
}
if ($scope.serviceTypeId === enums.serviceType.VAT) {
$scope.systemTitle = $translate.instant('MenuVAT');
$scope.viewMode = 1;
}
if ($scope.serviceTypeId === enums.serviceType.AssetsManage) {
$scope.systemTitle = $translate.instant('AssetTitle');
$scope.viewMode = 1;
}
var date = new Date(); var date = new Date();
var year = date.getFullYear(); var year = date.getFullYear();
var month = date.getMonth(); var mon = date.getMonth()+ 1;
$scope.selectedDate = new Date(vatSessionService.year, vatSessionService.month - 1, 1); $scope.selectedDate = new Date(year, date.getMonth() + 1, 1);
$scope.startDate = new Date(year - 20, 1, 1); $scope.startDate = new Date(year - 20, 1, 1);
$scope.endDate = new Date(year + 20, 1, 1); $scope.endDate = new Date(year + 20, 1, 1);
var ele1 = $("#ebitDatepacker"); var ele1 = $("#ebitDatepacker");
...@@ -2906,14 +2894,21 @@ ...@@ -2906,14 +2894,21 @@
minViewMode: 1, minViewMode: 1,
autoclose: true, //选中之后自动隐藏日期选择框 autoclose: true, //选中之后自动隐藏日期选择框
clearBtn: true, //清除按钮 clearBtn: true, //清除按钮
todayBtn: false, //今日按钮 todayBtn: true, //今日按钮
format: "yyyy-mm" //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format format: "yyyy-mm" //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
}).on('changeDate', function (e) { }).on('changeDate', function (e) {
$scope.changeDate(e); $scope.changeDate(e);
}); });
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
//初始化
$scope.relation.period = year.toString() + monthRevert(mon);
}; };
var monthRevert = function(mon){
if(mon < 10)
mon = "0" + mon.toString();
return mon.toString();
}
//保存并刷新,加载数据 //保存并刷新,加载数据
$scope.saveAndRefresh = function(){ $scope.saveAndRefresh = function(){
...@@ -2933,37 +2928,39 @@ ...@@ -2933,37 +2928,39 @@
}); });
//上传模板 //上传模板
$scope.upload = function (file) { $scope.upload = function (file) {
var _file = $scope.importExcelFile; if(file.length == 0)
if(file == null)
return return
frontImport(_file); file = file[0];
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
var url = apiInterceptor.vatWebApiHostUrl + '/templateGroup/ebitTemplateImport'; var url = apiInterceptor.webApiHostUrl + '/templateGroup/ebitTemplateImport';
Upload.upload( Upload.upload(
{ {
url: url, url: url,
data: {orgId : $scope.relation.orgId, period : $scope.relation.period}, file: _file, data: {orgId : $scope.relation.orgId, period : $scope.relation.period != undefined ? $scope.relation.period : 0 }, file: file,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken() Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
}, __RequestVerificationToken: token,
__RequestVerificationToken: token, withCredentials: true
withCredentials: true },
__RequestVerificationToken: token,
withCredentials: true
}) })
.progress(function (evt) { .progress(function (evt) {
}) })
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
SweetAlert.error("上传成功"); frontImport(file);
$('#busy-indicator-container').hide();
SweetAlert.success("上传成功");
$scope.relation.fileName = config.file.name; $scope.relation.fileName = config.file.name;
vatReportService.frontImportBack().success(function(res){ //重新获取数据
getReportData(function(){ getReportData(function(){
$scope.relation.broadcast = true; $scope.relation.broadcast = true;
}, $scope.relation.period); }, $scope.relation.period);
});
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
SweetAlert.error(status + '错误' + ",上传失败") SweetAlert.error(status + "上传失败")
}) })
}; };
...@@ -2973,8 +2970,7 @@ ...@@ -2973,8 +2970,7 @@
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
excelIo.open(file, function (json) { excelIo.open(file, function (json) {
var workbookObj = json; var workbookObj = json;
spread.fromJSON(workbookObj); $scope.spread.fromJSON(workbookObj);
}, function (e) { }, function (e) {
// process error // process error
alert(e.errorMessage); alert(e.errorMessage);
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
</div> </div>
</div> </div>
<div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;"> <div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;">
<span ngf-select="" type="file" ng-model="importExcelFile" ngf-change="upload($files)" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false" <span ngf-select="" ngf-change="upload($files)" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span> ngf-allow-dir="false" class="" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span>
<span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span> <span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span>
<span ng-click="singleExport()"><i <span ng-click="singleExport()"><i
class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span> class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span>
......
...@@ -119,12 +119,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -119,12 +119,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
var url = null; var url = null;
if(!init){ url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&orgId="+projectId;
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&projectId="+projectId;
}else{
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID;
}
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口 xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob xhr.responseType = "blob"; // 返回类型blob
......
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