Commit aab60a50 authored by Memorydoc's avatar Memorydoc

#

parent 9e20505d
...@@ -289,7 +289,7 @@ public class TemplateController extends BaseController { ...@@ -289,7 +289,7 @@ public class TemplateController extends BaseController {
@RequestMapping(value = "getPeriodTemplateJsonOrg", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @RequestMapping(value = "getPeriodTemplateJsonOrg", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody public @ResponseBody
void getPeriodTemplateJsonOrg(@RequestParam(name = "templateId") Long templateId, void getPeriodTemplateJsonOrg(@RequestParam(name = "templateId") Long templateId,
@RequestParam(name = "period") Integer period, @RequestParam(name = "period") Integer period,
@RequestParam(name = "orgId") String orgId, @RequestParam(name = "orgId") String orgId,
HttpServletResponse response) throws URISyntaxException { HttpServletResponse response) throws URISyntaxException {
...@@ -359,17 +359,9 @@ public class TemplateController extends BaseController { ...@@ -359,17 +359,9 @@ public class TemplateController extends BaseController {
} }
} }
} }
List<PeriodTemplate> templates = Lists.newArrayList(); List<Template> templates = templateService.getTL(templateId);
if (projectId == null || "".equals(projectId)) {
templates = templateService.getTemplates(templateId);
} else {
templates = templateService.getPeriodTemplates(templateId, period, projectId);
}
if(templates.size() == 0){
templates = templateService.getTemplates(templateId);
}
MyAsserts.assertNotEmpty(templates, new NotFoundException()); MyAsserts.assertNotEmpty(templates, new NotFoundException());
PeriodTemplate template = templates.get(0); Template template = templates.get(0);
String templatePath = template.getPath(); String templatePath = template.getPath();
MyAsserts.assertNotEmpty(templatePath, new NotFoundException()); MyAsserts.assertNotEmpty(templatePath, new NotFoundException());
filePath = this.getClass().getResource("").toURI().getPath(); filePath = this.getClass().getResource("").toURI().getPath();
......
...@@ -128,6 +128,11 @@ public class TemplateServiceImpl extends AbstractService { ...@@ -128,6 +128,11 @@ public class TemplateServiceImpl extends AbstractService {
example.createCriteria().andTemplateIdEqualTo(templateId); example.createCriteria().andTemplateIdEqualTo(templateId);
return periodTemplateMapper.selectByExample(example); return periodTemplateMapper.selectByExample(example);
} }
public List<Template> getTL(Long templateId){
TemplateExample example = new TemplateExample();
example.createCriteria().andIdEqualTo(templateId);
return templateMapper.selectByExample(example);
}
public String getTemplatePath(Long templateId) { public String getTemplatePath(Long templateId) {
......
...@@ -20,6 +20,7 @@ import org.slf4j.Logger; ...@@ -20,6 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -2457,6 +2458,20 @@ public class ReportServiceImpl extends BaseService { ...@@ -2457,6 +2458,20 @@ public class ReportServiceImpl extends BaseService {
example.createCriteria().andIdEqualTo(orgId); example.createCriteria().andIdEqualTo(orgId);
return organizationMapper.selectByExample(example).get(0).getName(); return organizationMapper.selectByExample(example).get(0).getName();
} }
@Autowired
private JdbcTemplate jdbcTemplate;
//获取利润表模板Id
public String getlxbId() throws Exception {
try{
String sql = "select * from template t where t.name = '利润表'";
Map<String, Object> stringObjectMap = new HashMap<>();
stringObjectMap = jdbcTemplate.queryForList("select * from template t where t.name = '利润表' ").get(0);
return stringObjectMap.get("id").toString();
}catch (Exception e ){
e.printStackTrace();
throw new Exception("获取EBIT利润表模板失败");
}
}
/* private String getCellStringValue(Cell cell) { /* private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) { if (cell.getCellTypeEnum().equals(CellType.STRING)) {
......
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
if(scope.relation.orgId == undefined){ if(scope.relation.orgId == undefined){
scope.relation.orgId = null; scope.relation.orgId = null;
} }
if(templateId == undefined )
return;
return templateService.getPeriodTemplateJsonByOrg(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(); var spreadCtrl = getSpreadControl();
if (spreadCtrl) { if (spreadCtrl) {
......
...@@ -1100,6 +1100,10 @@ ...@@ -1100,6 +1100,10 @@
}; };
var getReportData = function (period) { var getReportData = function (period) {
if($scope.relation.orgId == null || $scope.relation.orgId == undefined ){
$scope.relation.loadSheet($scope.templateId);
return;
}
vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, period != undefined ? period : ($scope.relation.period == undefined ? period : $scope.relation.period)).success(function (reportData) { vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, period != undefined ? period : ($scope.relation.period == undefined ? period : $scope.relation.period)).success(function (reportData) {
if (reportData && reportData.data && reportData.data.cellData) { if (reportData && reportData.data && reportData.data.cellData) {
_.each(reportData.data.cellData, function (x) { _.each(reportData.data.cellData, function (x) {
...@@ -1129,9 +1133,9 @@ ...@@ -1129,9 +1133,9 @@
//todo: according to templateId and period get reportId //todo: according to templateId and period get reportId
period = Number(period);//转成Number类型 period = Number(period);//转成Number类型
vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) { vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) {
if ( report.data) { if (report.data) {
$scope.reportId = report.data.id; $scope.reportId = report.data.id;
} else { } else {
$scope.reportData = []; $scope.reportData = [];
$scope.formulaBlocks = []; $scope.formulaBlocks = [];
$scope.manualDataSources = []; $scope.manualDataSources = [];
...@@ -2832,34 +2836,6 @@ ...@@ -2832,34 +2836,6 @@
//--------------------------------------kevin insert ------------------------------------- //--------------------------------------kevin insert -------------------------------------
$scope.relation = {}; $scope.relation = {};
/* var loadIndustry = function () {
vatReportService.getOrgLists().success(function (industryData) {
var _data = industryData.data;
$scope.relation.orgId = _data[0].id;
if (_data && _data.length > 0) {
//配置行业下拉列表
$scope.dataSourceIndustryList = {
dataSource: new DevExpress.data.ArrayStore({
data: _data
}),
displayExpr: 'name',
valueExpr: "id",
value: _data[0].id,
itemTemplate: 'orgList',
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
});
},
onInitialized: function (e) {
$scope.dataSourceIndustryListInstance = e.component;
}
}
$scope.curIndustry = _data[0];
$('#dx-select-industry').dxSelectBox('instance').option('value', $scope.relation.id);
}
});
};*/
$scope.changeDate = function (e) { $scope.changeDate = function (e) {
if (e && e.date) { if (e && e.date) {
...@@ -2899,10 +2875,25 @@ ...@@ -2899,10 +2875,25 @@
$scope.changeDate(e); $scope.changeDate(e);
}); });
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
$scope.templateId = "100610523201314816";//这里先写死 todo 这里先写死利润表模板,后续会修改模板id var webApiHostUrl = loginContext.apiHost + constant.webapi.prefix;
$.ajax({
url: webApiHostUrl + "/Report/getlxbId",
type: "POST",
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
}, success: function (res) {
if (res.data) {
$scope.templateId = res.data;
loadCellData($scope.selectedDate, $scope.relation.orgId);
} else {
SweetAlert.error(res.resultMsg);
}
}
});
//初始化 //初始化
$scope.relation.period = year.toString() + monthRevert(mon); $scope.relation.period = year.toString() + monthRevert(mon);
loadCellData($scope.selectedDate, $scope.relation.orgId);//初始化数据,默认是当前period
}; };
var monthRevert = function (mon) { var monthRevert = function (mon) {
...@@ -2924,7 +2915,7 @@ ...@@ -2924,7 +2915,7 @@
} }
//数字校验 //数字校验
var reg = /^[0-9]+([.]{1}[0-9]+){0,1}$/; var reg = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
if (!reg.test(specialConsiderations) && specialConsiderations != "" ) { if (!reg.test(specialConsiderations) && specialConsiderations != "") {
SweetAlert.error("请输入正确的特殊因素考虑值"); SweetAlert.error("请输入正确的特殊因素考虑值");
return; return;
...@@ -2952,23 +2943,6 @@ ...@@ -2952,23 +2943,6 @@
}); });
} }
var spreadTODb = function () { var spreadTODb = function () {
/*//spread序列化参数
var serializationOption = {
ignoreFormula: false, // indicate to ignore the style when convert workbook to json, default value is false
ignoreStyle: false, // indicate to ignore the formula when convert workbook to json, default value is false
rowHeadersAsFrozenColumns: false, // indicate to treat the row headers as frozen columns when convert workbook to json, default value is false
columnHeadersAsFrozenRows: false // indicate to treat the column headers as frozen rows when convert workbook to json, default value is false
}
var jsonString = JSON.stringify($scope.spread.toJSON(serializationOption));
var obj = {
period : $scope.relation.period != undefined ? $scope.relation.period : null,
orgId : $scope.relation.orgId,
jsonString : jsonString
}
$http.post('/Report/spreadToDb', obj ,function(res){
if(!res.result)
SweetAlert.error("保存表单到数据库失败");
});*/
var json = $scope.spread.toJSON({includeBindingSource: true}); var json = $scope.spread.toJSON({includeBindingSource: true});
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb?orgId=' + $scope.relation.orgId + "&period=" + $scope.relation.period; var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb?orgId=' + $scope.relation.orgId + "&period=" + $scope.relation.period;
...@@ -3159,24 +3133,24 @@ ...@@ -3159,24 +3133,24 @@
}, 500);*/ }, 500);*/
vatReportService.manyExport(param); vatReportService.manyExport(param);
}; };
/* $scope.relation._orgId = null; /* $scope.relation._orgId = null;
$scope.$watch('relation._orgId', function (n, o) { $scope.$watch('relation._orgId', function (n, o) {
if (n != undefined) if (n != undefined)
$scope.relation.orgId = n.pop(); $scope.relation.orgId = n.pop();
});*/ });*/
var initCompanyList = function () { var initCompanyList = function () {
var joinText = " <option value=''>请选择机构</option>"; var joinText = " <option value=''>请选择机构</option>";
vatReportService.getOrgLists().success(function (data) { vatReportService.getOrgLists().success(function (data) {
if (data) { if (data) {
/*$scope.companyList = data.data;*/ /*$scope.companyList = data.data;*/
for(var a = 0; a < data.data.length; a++){ for (var a = 0; a < data.data.length; a++) {
joinText += "<option value ="+data.data[a].id+" ng-bind = 'relation.orgId' data-id ="+data.data[a].id+" >"+data.data[a].name+"</option>"; joinText += "<option value =" + data.data[a].id + " ng-bind = 'relation.orgId' data-id =" + data.data[a].id + " >" + data.data[a].name + "</option>";
} }
$('#orgList').html(joinText); $('#orgList').html(joinText);
$('.selectpicker').selectpicker(); $('.selectpicker').selectpicker();
setTimeout( function(){ setTimeout(function () {
$('.dropdown-menu').css({"min-width" : "0!important;", "width" : "100%"}) $('.dropdown-menu').css({"min-width": "0!important;", "width": "100%"})
}, 1000); }, 1000);
} }
}); });
...@@ -3184,7 +3158,7 @@ ...@@ -3184,7 +3158,7 @@
}; };
$('.selectpicker').on('changed.bs.select', function (e, clickedIndex, isSelected, value) { $('.selectpicker').on('changed.bs.select', function (e, clickedIndex, isSelected, value) {
$scope.relation.orgId = e.currentTarget[clickedIndex].value; $scope.relation.orgId = e.currentTarget[clickedIndex].value;
loadCellData($scope.relation.period, e.currentTarget[clickedIndex].value); loadCellData($scope.relation.period, e.currentTarget[clickedIndex].value);
}); });
......
<div class="vat-report-view" style="overflow-y: scroll"> <div class="vat-report-view" style="overflow-y: scroll">
<!--Report SpreadJS--> <!--Report SpreadJS-->
<div class="row" style=" height: 53px; background: #ccc;"> <div class="row" style=" height: 53px; background: #f5f5f5;">
<div class="col-sm-7 navLeft " style=" margin-top: 10px;"> <div class="col-sm-7 navLeft " style=" margin-top: 10px;">
<div class="col-sm-8"> <div class="col-sm-8">
<span class="text-bold" translate="SelectedOrganization"></span><span>:</span> <span class="text-bold" translate="SelectedOrganization"></span><span>:</span>
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
} }
@media screen and (min-width:1400px) { @media screen and (min-width:1400px) {
.navRight{ .navRight{
right: -8%!important; right: -7%!important;
} }
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
return $http.post('/Report/reportEbitData', param, apiConfig.createVat({contentType: "application/json"})); return $http.post('/Report/reportEbitData', param, apiConfig.createVat({contentType: "application/json"}));
}, },
manyExport: function (param) { manyExport: function (param) {
var toParam = JSON.stringify(param); var toParam = JSON.stringify(param);
return $http.post('/Report/manyExport', toParam, apiConfig.createVat({responseType: 'arraybuffer'})).then(function (response) { return $http.post('/Report/manyExport', toParam, apiConfig.createVat({responseType: 'arraybuffer'})).then(function (response) {
var a = document.createElement('a'); var a = document.createElement('a');
...@@ -237,8 +237,12 @@ ...@@ -237,8 +237,12 @@
if (!_.isNumber(period)) { if (!_.isNumber(period)) {
period = 0; period = 0;
} }
return $http.get('/Report/getReportByTemplateEbit/' + templateId + '/' + period + '/' + orgId, apiConfig.createVat()); var param = {
templateId: templateId,
period: period,
orgId: orgId
}
return $http.post("/Report/getReportByTemplateEbit", JSON.stringify(param), apiConfig.createVat());
}, },
getDataSourceDetailList: function (dataSourceId) { getDataSourceDetailList: function (dataSourceId) {
return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat()); return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat());
......
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