Commit f8f0ae8f authored by Memorydoc's avatar Memorydoc

#

parent 3e4f7a27
...@@ -336,25 +336,22 @@ public class ReportController { ...@@ -336,25 +336,22 @@ public class ReportController {
} }
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) /* @RequestMapping(value = "saveAndRefresh", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto saveAndRefresh(/*@RequestParam(value = "orgId") String orgId, public OperationResultDto saveAndRefresh(*//*@RequestParam(value = "orgId") String orgId,
@RequestParam(value = "period") Integer period, @RequestParam(value = "period") Integer period,
@RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations, @RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations,
@RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate, @RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate,
@RequestParam(value = "reportId") Long reportId,*/ @RequestBody RequestParameterDto requestParameterDto) { @RequestParam(value = "reportId") Long reportId,*//* @RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
String projId = getProjId(requestParameterDto.getOrgId(), requestParameterDto.getPeriod()); String projId = getProjId(requestParameterDto.getOrgId(), requestParameterDto.getPeriod());
try { try {
operationResultDto.setData(reportService.loadEbitData(requestParameterDto.getOrgId(), requestParameterDto.getPeriod(), requestParameterDto.getSpecialConsiderations(), requestParameterDto.getEbitRate())); operationResultDto.setData(reportService.loadEbitData(requestParameterDto.getOrgId(), requestParameterDto.getPeriod(), requestParameterDto.getSpecialConsiderations(), requestParameterDto.getEbitRate()));
/* new Thread(()->{
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto, reportService.getCellData(Long.parseLong(requestParameterDto.getReportId()),projId ).getData().getCellData());
}).start();*/
} catch (Exception e) { } catch (Exception e) {
return operationResultDto.error(); return operationResultDto.error();
} }
operationResultDto.setResultMsg("success"); operationResultDto.setResultMsg("success");
return operationResultDto; return operationResultDto;
} }*/
@RequestMapping("getlxbId") @RequestMapping("getlxbId")
public OperationResultDto getlxbId() { public OperationResultDto getlxbId() {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java"> <javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" /> <property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator> </javaClientGenerator>
<table tableName="ebit_spread_data" domainObjectName="EbitSpreadData"> <table tableName="profit_loss_statement_ebit" domainObjectName="ProfitLossStatementEbit">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>
......
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.ProfitLossStatementEbit;
import pwc.taxtech.atms.vat.entity.ProfitLossStatementEbitExample;
@Mapper
public interface ProfitLossStatementEbitMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
long countByExample(ProfitLossStatementEbitExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int deleteByExample(ProfitLossStatementEbitExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int insert(ProfitLossStatementEbit record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int insertSelective(ProfitLossStatementEbit record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
List<ProfitLossStatementEbit> selectByExampleWithRowbounds(ProfitLossStatementEbitExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
List<ProfitLossStatementEbit> selectByExample(ProfitLossStatementEbitExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
ProfitLossStatementEbit selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") ProfitLossStatementEbit record, @Param("example") ProfitLossStatementEbitExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int updateByExample(@Param("record") ProfitLossStatementEbit record, @Param("example") ProfitLossStatementEbitExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(ProfitLossStatementEbit record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table profit_loss_statement_ebit
*
* @mbg.generated
*/
int updateByPrimaryKey(ProfitLossStatementEbit record);
}
\ No newline at end of file
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
//var prokjectId = vatSessionService.project.id; //var prokjectId = vatSessionService.project.id;
//var period = vatSessionService.month; //var period = vatSessionService.month;
/* if (!init) { /* if (!init) {
addEbitRow(); scope.relation.addEbitRow();
setData(init) setData(init)
return; return;
}*/ }*/
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
scope.spread = spread; scope.spread = spread;
setColWidth(sheet); setColWidth(sheet);
if(sheet.getRowCount() <= 38) if(sheet.getRowCount() <= 38)
addEbitRow(sheet) scope.relation.addEbitRow(sheet)
if (scope.templateId && scope.reportSource) { if (scope.templateId && scope.reportSource) {
setData(); setData();
} }
...@@ -204,10 +204,9 @@ ...@@ -204,10 +204,9 @@
return $q.when(spread); return $q.when(spread);
}; };
var addEbitRow = function (sheet) { scope.relation.addEbitRow = function (sheet) {
if (sheet == undefined || sheet == null) if (sheet == undefined || sheet == null)
sheet = scope.spread.getActiveSheet(); sheet = scope.spread.getActiveSheet();
//添加单元格 //添加单元格
if (sheet.getRowCount() > 43) if (sheet.getRowCount() > 43)
return; return;
...@@ -218,10 +217,10 @@ ...@@ -218,10 +217,10 @@
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]);
} }
lockCell(scope.spread); scope.relation.lockCell(scope.spread);
} }
var lockCell = function (spread) { scope.relation.lockCell = function (spread) {
//todo:注册之后这里去掉注释 //todo:注册之后这里去掉注释
var sheet; var sheet;
if (constant.regesterInformation.active) { if (constant.regesterInformation.active) {
...@@ -321,9 +320,9 @@ ...@@ -321,9 +320,9 @@
return; return;
}*/ }*/
if(upload){ //上传上来的文件也要动态添加行 if(upload){ //上传上来的文件也要动态添加行
addEbitRow(sheet); scope.relation.addEbitRow(sheet);
scope.relation.loadEbitCell(sheet); scope.relation.loadEbitCell(sheet);
lockCell(scope.spread); scope.relation.lockCell(scope.spread);
setColWidth(sheet); setColWidth(sheet);
scope.spread.resumePaint(); scope.spread.resumePaint();
return return
...@@ -335,13 +334,13 @@ ...@@ -335,13 +334,13 @@
//spreadJsTipService.initialize(sheet); //spreadJsTipService.initialize(sheet);
/*if (!scope.isReadOnly) { /*if (!scope.isReadOnly) {
lockCell(scope.spread, false, true); scope.relation.lockCell(scope.spread, false, true);
}*/ }*/
scope.spread.suspendPaint(); scope.spread.suspendPaint();
/* if (scope.reportSource.length == 0 && scope.relation.emptyData && scope.relation.emptyData == true) { /* if (scope.reportSource.length == 0 && scope.relation.emptyData && scope.relation.emptyData == true) {
_init(scope.templateId, true);///如果没有数据,需要重新加载 _init(scope.templateId, true);///如果没有数据,需要重新加载
lockCell(scope.spread); scope.relation.lockCell(scope.spread);
return; return;
} }
*/ */
...@@ -367,7 +366,7 @@ ...@@ -367,7 +366,7 @@
} }
} }
} }
lockCell(scope.spread); scope.relation.lockCell(scope.spread);
scope.spread.resumePaint(); scope.spread.resumePaint();
scope.relation.saveToDbFlag = Math.random(); scope.relation.saveToDbFlag = Math.random();
......
...@@ -1100,7 +1100,7 @@ ...@@ -1100,7 +1100,7 @@
}; };
var getReportData = function (period) { var getReportData = function (period) {
if($scope.relation.orgId == null || $scope.relation.orgId == undefined ){ if ($scope.relation.orgId == null || $scope.relation.orgId == undefined) {
$scope.relation.loadSheet($scope.templateId); $scope.relation.loadSheet($scope.templateId);
return; return;
} }
...@@ -2931,16 +2931,23 @@ ...@@ -2931,16 +2931,23 @@
SweetAlert.error("请输入正确的EBIT Rate"); SweetAlert.error("请输入正确的EBIT Rate");
} }
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate).success(function (res) { /* vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate).success(function (res) {
if (res.resultMsg == "success") { if (res.resultMsg == "success") {
if (res.data) $scope.relation.data = res.data; if (res.data) $scope.relation.data = res.data;
$scope.relation.setData(true); $scope.relation.setData(true);
spreadTODb();
} }
}).error(function (error) { }).error(function (error) {
}); });*/
calculateEbitAndInsert($scope.sheet, true);
spreadTODb();
} }
var spreadTODb = function () { var spreadTODb = function () {
if ($scope.relation.period == undefined || $scope.relation.period == null) {
SweetAlert.error("请选择机构");
return;
}
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;
...@@ -2979,8 +2986,13 @@ ...@@ -2979,8 +2986,13 @@
}); });
//上传模板 //上传模板
$scope.upload = function (file) { $scope.upload = function (file) {
if (file == undefined || file == null || file.length == 0) if (file == undefined || file == null || file.length == 0)
return return
if ($scope.relation.orgId == null || $scope.relation.orgId == undefined) {
SweetAlert.error("请选择机构");
return;
}
file = file[0]; file = file[0];
frontImport(file);//前端导入 frontImport(file);//前端导入
/*if(file.length == 0) /*if(file.length == 0)
...@@ -3061,16 +3073,20 @@ ...@@ -3061,16 +3073,20 @@
excelIo.open(file, function (json) { excelIo.open(file, function (json) {
var workbookObj = json; var workbookObj = json;
$scope.spread.fromJSON(workbookObj); $scope.spread.fromJSON(workbookObj);
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, 0, "1").success(function (res) { var sheet = $scope.spread.sheets[0];
/*vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, 0, "1").success(function (res) {
if (res.resultMsg == "success") { if (res.resultMsg == "success") {
if (res.data) $scope.relation.data = res.data; if (res.data) $scope.relation.data = res.data;
$scope.relation.setData(true); $scope.relation.setData(true);
} }
}).error(function (error) { }).error(function (error) {
}); });*/
//进行ebit计算,这里是前端计算
$scope.relation.addEbitRow(sheet);
calculateEbitAndInsert(sheet, true);
$scope.relation.lockCell($scope.spread);
spreadTODb();
}, function (e) { }, function (e) {
// process error
alert(e.errorMessage); alert(e.errorMessage);
if (e.errorCode === 2/*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) { if (e.errorCode === 2/*noPassword*/ || e.errorCode === 3 /*invalidPassword*/) {
...@@ -3078,6 +3094,46 @@ ...@@ -3078,6 +3094,46 @@
}); });
} }
} }
$scope._ebitResult = {};
//给String 对象添加replaceAll方法
String.prototype.replaceAll = function (s1, s2) {
return this.replace(new RegExp(s1, "gm"), s2);
}
var calculateEbitAndInsert = function (sheet, insert) {
var yysr = Number(sheet.getValue(11, 2).toString().replaceAll(",", ""));//营业收入
var yycb = Number(sheet.getValue(12, 2).toString().replaceAll(",", ""));//营业成本
var yysjfj = Number(sheet.getValue(13, 2).toString().replaceAll(",", ""));//营业税金附加
var xsfy = Number(sheet.getValue(14, 2).toString().replaceAll(",", ""));//销售费用
var glfy = Number(sheet.getValue(15, 2).toString().replaceAll(",", ""));//管理费用
var yffy = Number(sheet.getValue(16, 2).toString().replaceAll(",", ""));//研发费用
var zcjzss = Number(sheet.getValue(18, 2).toString().replaceAll(",", ""));//资产减值损失
var ts = (sheet.getValue(38, 2) == "" || sheet.getValue(38, 2) == null) == true ? 0 : sheet.getValue(40, 2);
var rate = (sheet.getValue(40, 2) == "" || sheet.getValue(40, 2) == null) == true ? "1%" : sheet.getValue(40, 2);
$scope._ebitResult.klzcjsz = Number((yysr - yycb - yysjfj - xsfy - glfy - yffy - zcjzss).toFixed(4));
$scope._ebitResult.tsyskl = Number((Number(ts)).toFixed(4));
$scope._ebitResult.kltsys = ($scope._ebitResult.klzcjsz + $scope._ebitResult.tsyskl).toFixed(4);
$scope._ebitResult.rate = rate;
if($scope._ebitResult.rate.indexOf("%") != -1){
$scope._ebitResult.gljyye = Number((Number($scope._ebitResult.rate.replaceAll("%", "")) * $scope._ebitResult.kltsys).toFixed(4));
}else{
$scope._ebitResult.gljyye = Number(($scope._ebitResult.rate * $scope._ebitResult.kltsys).toFixed(4));
}
$scope._ebitResult.sixAddtax = Number((0.06 * $scope._ebitResult.gljyye).toFixed(4));
$scope._ebitResult.tsklys = Number(($scope._ebitResult.gljyye * 0.106).toFixed(4));
if (insert) {
sheet.setValue(37, 2, $scope._ebitResult.klzcjsz);
sheet.setValue(38, 2, $scope._ebitResult.tsklys);
sheet.setValue(39, 2, $scope._ebitResult.kltsys);
sheet.setValue(40, 2, $scope._ebitResult.rate);
sheet.setValue(41, 2, $scope._ebitResult.gljyye);
sheet.setValue(42, 2, $scope._ebitResult.sixAddtax);
sheet.setValue(43, 2, $scope._ebitResult.klzcjsz);
}
}
$scope.singleExport = function () { $scope.singleExport = function () {
if ($scope.spread != undefined && $scope.spread) { if ($scope.spread != undefined && $scope.spread) {
......
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