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