Commit 12ac07af authored by kevin's avatar kevin

#

parent eded4cfd
......@@ -69,7 +69,7 @@ public class FileExcelUtil {
* @param path
* @throws IOException
*/
public static ZipOutputStream craeteZipPath(String path) throws IOException {
public static File craeteZipPath(String path) throws IOException {
ZipOutputStream zipOutputStream = null;
File file = new File(path + DateUtils.nowDateFormat() + ".zip");
zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
......@@ -98,7 +98,7 @@ public class FileExcelUtil {
/*if(zipOutputStream !=null){
zipOutputStream.close();
}*/
return zipOutputStream;
return file;
}
......@@ -195,15 +195,15 @@ public class FileExcelUtil {
* @throws Exception
*/
public static File generateExcelToPath(Workbook wb, String path) throws Exception {
String[] pathArr = path.split("\\\\");
/* String[] pathArr = path.split("\\\\");
String zipDir = pathArr[0];
FileExcelUtil.createFile(zipDir);
FileExcelUtil.createFile(zipDir);*/
File file = new File(path);
FileOutputStream fos = null;
List<File> listFile = Lists.newArrayList();
try {
fos = new FileOutputStream(path);
fos = new FileOutputStream(file);
wb.write(fos);
return new File(path);
return file;
}catch (Exception e ){
e.printStackTrace();
return null;
......@@ -235,6 +235,8 @@ public class FileExcelUtil {
srcfile[i] = files.get(i);
}
//生成.zip文件;
//File zip = craeteZipPath(zipPath);
FileInputStream inStream = null;
ServletOutputStream os = null;
try {
......
......@@ -8,6 +8,9 @@ public final class Constant {
public static final String Other = "其他";
public static final int WholeYear = -1;
/* ----------------------------- kevin insert -----------------*/
public static String ebitRate = "1%";
/*-----------------------------------------------------------------*/
public static final int CREATE_DB_SUCCESS = 1;
public static final int CREATE_DB_EXISTS = 0;
public static final int CREATE_DB_FAILED = -1;
......
......@@ -5,6 +5,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
......@@ -15,6 +16,7 @@ import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.periodReport.PeriodReportDataParam;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.OrganizationExample;
......@@ -22,7 +24,9 @@ import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.service.impl.BaseService;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.dao.EbitSpreadDataMapper;
import pwc.taxtech.atms.vat.dao.PwcReportAttachMapper;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
......@@ -34,6 +38,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
......@@ -331,18 +336,19 @@ public class ReportController {
}
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto saveAndRefresh(@RequestParam(value = "orgId") String orgId,
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto saveAndRefresh(/*@RequestParam(value = "orgId") String orgId,
@RequestParam(value = "period") Integer period,
@RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations,
@RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate,
@RequestParam(value = "reportId") Long reportId) {
@RequestParam(value = "reportId") Long reportId,*/ @RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto operationResultDto = new OperationResultDto();
String projId = getProjId(requestParameterDto.getOrgId(), requestParameterDto.getPeriod());
try{
operationResultDto.setData(reportService.loadEbitData(orgId, period, specialConsiderations, ebitRate));
new Thread(()->{
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto, BaseService._cellData);
}).start();
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){
return operationResultDto.error();
}
......@@ -356,30 +362,35 @@ public class ReportController {
OperationResultDto operationResultDto = new OperationResultDto();
String zipName = "利润表";
try {
String zipPath = "/zipDir";
//生成zip文件夹
FileExcelUtil.createFile(zipPath);
reportService.manyExport(requestParameterDto, zipName,request, response, zipPath);
} catch (URISyntaxException e) {
reportService.manyExport(requestParameterDto, zipName,request, response);
} catch (Exception e) {
e.printStackTrace();
operationResultDto.error(e.getMessage());
return operationResultDto;
}
return operationResultDto;
return operationResultDto.success();
}
@Autowired
private EbitSpreadDataMapper ebitSpreadDataMapper;
@Autowired
protected DistributedIdService idService;
/**
* 将spread序列化字符串保存到数据库
*/
@RequestMapping("spreadToDb")
public OperationResultDto spreadToDb(@RequestBody HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String,MultipartFile> fileMap = multipartRequest.getFileMap();
MultipartFile file = fileMap.get("llb.xlsx");
//didiFileUploadService.uploadFile(file, );
return null;
//return reportService.spreadToDb(ebitParam);
public OperationResultDto spreadToDb( HttpServletRequest request, Integer period, String orgId) {
OperationResultDto operationResultDto = new OperationResultDto();
try{
reportService.spreadToDb(request, period, orgId);
}catch (Exception e){
e.printStackTrace();
operationResultDto.error("保存失败");
}
return operationResultDto.success();
}
}
\ No newline at end of file
......@@ -9,10 +9,5 @@ package pwc.taxtech.atms.dto;
**/
public class RequestParameterBaseDto {
public String orgId;
public Integer period;
public String templateId;
public String projectId;
public String reportId;
}
......@@ -10,45 +10,40 @@ import java.io.Serializable;
* Version 1.0
* 请求参数封装
**/
public class RequestParameterDto extends RequestParameterBaseDto implements Serializable {
public class RequestParameterDto implements Serializable {
public class EbitParam extends RequestParameterDto{
private String jsonString;//excel传过来的数据 已经被序列化成字符串了
private Integer specialConsiderations;
private String ebitRate;
private String jsonString;//excel传过来的数据 已经被序列化成字符串了
private Integer specialConsiderations;
private String ebitRate;
public String getEbitRate() {
return ebitRate;
}
public String orgId;
public Integer period;
public String templateId;
public String projectId;
public String reportId;
public void setEbitRate(String ebitRate) {
this.ebitRate = ebitRate;
}
public Integer getSpecialConsiderations() {
return specialConsiderations;
}
public String getJsonString() {
return jsonString;
}
public void setSpecialConsiderations(Integer specialConsiderations) {
this.specialConsiderations = specialConsiderations;
}
public void setJsonString(String jsonString) {
this.jsonString = jsonString;
}
public String getJsonString() {
return jsonString;
}
public Integer getSpecialConsiderations() {
return specialConsiderations;
}
public void setJsonString(String jsonString) {
this.jsonString = jsonString;
}
public void setSpecialConsiderations(Integer specialConsiderations) {
this.specialConsiderations = specialConsiderations;
}
public String getReportId() {
return reportId;
public String getEbitRate() {
return ebitRate;
}
public void setReportId(String reportId) {
this.reportId = reportId;
public void setEbitRate(String ebitRate) {
this.ebitRate = ebitRate;
}
public String getOrgId() {
......@@ -83,15 +78,25 @@ public class RequestParameterDto extends RequestParameterBaseDto implements Se
this.projectId = projectId;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
@Override
public String toString() {
return "RequestParameterDto{" +
"reportId='" + reportId + '\'' +
"jsonString='" + jsonString + '\'' +
", specialConsiderations=" + specialConsiderations +
", ebitRate='" + ebitRate + '\'' +
", orgId='" + orgId + '\'' +
", period=" + period +
", templateId='" + templateId + '\'' +
", projectId='" + projectId + '\'' +
", reportId='" + reportId + '\'' +
'}';
}
}
......@@ -12,9 +12,9 @@ import java.math.BigDecimal;
public class EbitDataDto {
private BigDecimal ebitSubtraction; // 1. EBIT(考虑资产减值损失)
private BigDecimal specialFactors; //考虑特殊因素
private double ebitRate;// ebit比率 默认1%(可更改)
private String ebitRate;// ebit比率 默认1%(可更改)
private BigDecimal transactionAmount; //关联交易金额
private String sixAddTax; //6%增值税
private BigDecimal sixAddTax; //6%增值税
private BigDecimal totalAmountTax;// 价税合计金额
private String specialConsiderations;//特殊因素考虑
public String getSpecialConsiderations() {
......@@ -44,11 +44,11 @@ public class EbitDataDto {
this.specialFactors = specialFactors;
}
public double getEbitRate() {
public String getEbitRate() {
return ebitRate;
}
public void setEbitRate(double ebitRate) {
public void setEbitRate(String ebitRate) {
this.ebitRate = ebitRate;
}
......@@ -60,11 +60,11 @@ public class EbitDataDto {
this.transactionAmount = transactionAmount;
}
public String getSixAddTax() {
public BigDecimal getSixAddTax() {
return sixAddTax;
}
public void setSixAddTax(String sixAddTax) {
public void setSixAddTax(BigDecimal sixAddTax) {
this.sixAddTax = sixAddTax;
}
......
......@@ -5,15 +5,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.common.util.StringUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.CitTbamMapper;
import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dpo.GroupId;
import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.Exceptions;
......
......@@ -40,15 +40,15 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="pwc_report_attach" domainObjectName="PwcReportAttach">
<table tableName="ebit_spread_data" domainObjectName="EbitSpreadData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<!--<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
</table>-->
<!--
......
......@@ -50,22 +50,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/
int insertSelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBsWithRowbounds(EbitSpreadDataExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBs(EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
......@@ -98,14 +82,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/
int updateByExampleSelective(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
......@@ -122,14 +98,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/
int updateByPrimaryKeySelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
......
......@@ -21,6 +21,17 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
*/
private Long id;
/**
* Database Column Remarks:
* file下载地址
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ebit_spread_data.file_key
*
* @mbg.generated
*/
private String fileKey;
/**
*
* This field was generated by MyBatis Generator.
......@@ -112,17 +123,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
*/
private String fileName;
/**
* Database Column Remarks:
* spread json字符串(序列化之后)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
private byte[] spreadJsonString;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ebit_spread_data
......@@ -155,6 +155,30 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.file_key
*
* @return the value of ebit_spread_data.file_key
*
* @mbg.generated
*/
public String getFileKey() {
return fileKey;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ebit_spread_data.file_key
*
* @param fileKey the value for ebit_spread_data.file_key
*
* @mbg.generated
*/
public void setFileKey(String fileKey) {
this.fileKey = fileKey == null ? null : fileKey.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.create_by
......@@ -371,30 +395,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
this.fileName = fileName == null ? null : fileName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.spread_json_string
*
* @return the value of ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
public byte[] getSpreadJsonString() {
return spreadJsonString;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ebit_spread_data.spread_json_string
*
* @param spreadJsonString the value for ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
public void setSpreadJsonString(byte[] spreadJsonString) {
this.spreadJsonString = spreadJsonString;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
......@@ -408,6 +408,7 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", fileKey=").append(fileKey);
sb.append(", createBy=").append(createBy);
sb.append(", createTime=").append(createTime);
sb.append(", updateBy=").append(updateBy);
......@@ -417,7 +418,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
sb.append(", organizationId=").append(organizationId);
sb.append(", sheetName=").append(sheetName);
sb.append(", fileName=").append(fileName);
sb.append(", spreadJsonString=").append(spreadJsonString);
sb.append("]");
return sb.toString();
}
......
......@@ -255,6 +255,76 @@ public class EbitSpreadDataExample {
return (Criteria) this;
}
public Criteria andFileKeyIsNull() {
addCriterion("file_key is null");
return (Criteria) this;
}
public Criteria andFileKeyIsNotNull() {
addCriterion("file_key is not null");
return (Criteria) this;
}
public Criteria andFileKeyEqualTo(String value) {
addCriterion("file_key =", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotEqualTo(String value) {
addCriterion("file_key <>", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyGreaterThan(String value) {
addCriterion("file_key >", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyGreaterThanOrEqualTo(String value) {
addCriterion("file_key >=", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLessThan(String value) {
addCriterion("file_key <", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLessThanOrEqualTo(String value) {
addCriterion("file_key <=", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLike(String value) {
addCriterion("file_key like", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotLike(String value) {
addCriterion("file_key not like", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyIn(List<String> values) {
addCriterion("file_key in", values, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotIn(List<String> values) {
addCriterion("file_key not in", values, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyBetween(String value1, String value2) {
addCriterion("file_key between", value1, value2, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotBetween(String value1, String value2) {
addCriterion("file_key not between", value1, value2, "fileKey");
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
......
......@@ -847,7 +847,7 @@
"Form":"Form",
"DomesticDataImport":"Domestic Data Import",
"InternationalDataImport":"International Data Import",
"TBEBITForm":"TB EBIT Form",
"TBEBITForm":"TP EBIT Form",
"ClickEnsureTip": "Click Ensure Button!",
"ApproveCommitted":"Committed",
......
......@@ -329,4 +329,9 @@
float:left;
padding-left: 15px;
}
}
.dropdown-menu{
span{
white-space: nowrap;
}
}
\ No newline at end of file
......@@ -76,30 +76,42 @@
scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function (newValue, oldValue) {
if (scope.relation.orgId != null && scope.relation.period != null) {
setTimeout(function () {
/* setTimeout(function () {
if ((scope.relation.broadcast && scope.relation.broadcast == true) || scope.spread != undefined) {
loadSheet(scope.templateId, false)
} else {
loadSheet(scope.templateId, true);
}
}, 200);
}, 200);*/
loadSheet(scope.templateId);
}
});
scope.$watch('relation.broadcast', function (newValue, oldValue) {
if (scope.relation.orgId != null && scope.relation.period != null) {
loadSheet(scope.templateId, false)
// loadSheet(scope.templateId, false)
loadSheet(scope.templateId)
}
});
var loadSheet = function (templateId, init) {
var loadSheet = function (templateId) {
//var prokjectId = vatSessionService.project.id;
//var period = vatSessionService.month;
if (!init) {
/* if (!init) {
addEbitRow();
setData(init)
return;
}*/
if(scope.relation.orgId == undefined){
scope.relation.orgId = null;
}
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);*/
......@@ -111,21 +123,27 @@
};
//初始化spread
var _init = function(){
/* var _init = function(){
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
if (!_.isEmpty(reportSpread)) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
initSpreadExcel(reportSpread, true).then(function (spread) {
/* return locateCell(spread, true);*/
/!* return locateCell(spread, true);*!/
});
}
}, function (data) {
$log.info(data);
});
}
}*/
var initSpreadExcel = function (reportSpread, noCycle) {
var initSpreadExcel = function (reportSpread) {
var spread = getSpreadControl();
spread.suspendPaint();
spread.fromJSON(reportSpread);
spread.options.showVerticalScrollbar = true;
......@@ -164,14 +182,12 @@
sheet.clearSelection();
}
scope.spread = spread;
addEbitRow(sheet)
if (scope.templateId && scope.reportSource&& !noCycle) {
if(sheet.getRowCount() <= 38)
addEbitRow(sheet)
if (scope.templateId && scope.reportSource) {
setData(true);
}
spread.resumePaint();
return $q.when(spread);
};
......@@ -180,7 +196,7 @@
sheet = scope.spread.getActiveSheet();
sheet.setColumnWidth(0, 400)
//添加单元格
if (sheet.getRowCount > 43)
if (sheet.getRowCount() > 43)
return;
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
......@@ -189,9 +205,10 @@
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.setValue(i + 37, 0, profileList[i]);
}
lockCell(scope.spread);
}
var setEditable = function (spread) {
var lockCell = function (spread) {
//todo:注册之后这里去掉注释
var sheet;
if (constant.regesterInformation.active) {
......@@ -205,6 +222,9 @@
sheet.getCell(i, j).locked(true);
}
}
///解锁指定单元格
sheet.getCell(38, 2).locked(false);//特殊因素
sheet.getCell(40, 2).locked(false);//ebit比率
};
// 每个单元格大致由以下部分构成:_SumAll(_Inter(...)+_Manual(...)+C1)
......@@ -280,26 +300,26 @@
// 根据已有信息通过spreadJS计算各单元格的值
var setData = function (init) {
var sheet = scope.spread.sheets[0];
if (!init && scope.relation.broadcast == true) {
loadEbitCell(sheet);
/* if (!init && scope.relation.broadcast == true) {
scope.relation.loadEbitCell(sheet);
return;
}
}*/
if (angular.isArray(scope.reportSource)) {
//spreadJsTipService.initialize(sheet);
/*if (!scope.isReadOnly) {
setEditable(scope.spread, false, true);
lockCell(scope.spread, false, true);
}*/
scope.spread.suspendPaint();
scope.relation.loadEbitCell(sheet);
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);///如果没有数据,需要重新加载
setEditable(scope.spread);
lockCell(scope.spread);
return;
}
*/
scope.reportSource.forEach(function (data) {
scope.relation.emptyData == true;
//fix bug11737 导出需要显示千分位
......@@ -323,14 +343,14 @@
}
}
}
setEditable(scope.spread);
lockCell(scope.spread);
scope.spread.resumePaint();
scope.relation.saveToDbFlag = Math.random();
}
};
(function initialize() {
loadSheet(scope.templateId, true);
loadSheet(scope.templateId);
})();
}
......
......@@ -2833,7 +2833,7 @@
//--------------------------------------kevin insert -------------------------------------
$scope.relation = {};
var loadIndustry = function () {
/* var loadIndustry = function () {
vatReportService.getOrgLists().success(function (industryData) {
var _data = industryData.data;
$scope.relation.orgId = _data[0].id;
......@@ -2860,7 +2860,7 @@
$('#dx-select-industry').dxSelectBox('instance').option('value', $scope.relation.id);
}
});
};
};*/
$scope.changeDate = function (e) {
if (e && e.date) {
......@@ -2901,10 +2901,34 @@
$scope.changeDate(e);
});
ele1.datepicker("setDate", $scope.selectedDate);
$scope.templateId ="100610523201314816";//这里先写死 todo 这里先写死利润表模板,后续会修改模板id
//初始化
$scope.relation.period = year.toString() + monthRevert(mon);
loadCellData($scope.relation.period, $scope.relation.orgId, function(){
});
loadCellData($scope.selectedDate, $scope.relation.orgId, function(){
});//初始化数据,默认是当前period
};
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
bindingOptions: {
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
});
}
};
var monthRevert = function(mon){
......@@ -2916,14 +2940,21 @@
//保存并刷新,加载数据
$scope.saveAndRefresh = function(){
var sheet = $scope.spread.sheets[0];
var specialConsiderations = sheet.getCell(38,3).value();
var ebitRate = sheet.getCell(40,3).value();
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate).success(function(res){
var specialConsiderations = (sheet.getCell(38,2).value() == null ? 0 : sheet.getCell(38,2).value()); //如果有值取值,没有则取默认值(EBIT考虑资产减值损失)
var ebitRate = (sheet.getCell(40,2).value() == null ? "1" : sheet.getCell(40,2).value()); //如果有值取值,没有则取默认值(EBIT rate)
if($scope.relation.period != undefined)
$scope.relation.period = Number($scope.relation.period);
if($scope.relation.orgId == undefined || $scope.relation.orgId == null){
SweetAlert.error("没有选择机构,无法保存刷新");
return;
}
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate ).success(function(res){
if(res.result){
$scope.relation.data = res.data;
$timeout(function(){
spreadTODb();
}, 7000);
}, 3000);
}
}).error(function(error){
......@@ -2949,7 +2980,9 @@
});*/
var json = $scope.spread.toJSON({includeBindingSource: true});
var excelIo = new GC.Spread.Excel.IO();
var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb';
var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb?orgId='+ $scope.relation.orgId + "&period=" +$scope.relation.period;
//var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
//xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// here is excel IO API
excelIo.save(json, function (blob) {
var fd = new FormData(document.forms.namedItem("myform"));
......@@ -2960,6 +2993,10 @@
contentType:false,
processData: false,
data:fd,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()
},
success: function (data) {
if(data.result){
//alert("上传成功!");
......@@ -2971,6 +3008,7 @@
alert("上传失败:"+ex);
}
});
});
}
$scope.$watch('file', function (file) {
......@@ -2978,7 +3016,8 @@
});
//上传模板
$scope.upload = function (file) {
if(file.length == 0)
frontImport(file);//前端导入
/*if(file.length == 0)
return
file = file[0];
var token = $('input[name="__RequestVerificationToken"]').val();
......@@ -3015,7 +3054,7 @@
})
.error(function (data, status, headers, config) {
SweetAlert.error(status + "上传失败")
})
})*/
};
//加载Ebit数据
......@@ -3123,39 +3162,11 @@
$('#export').html('');
$log.debug(mainSpread);
}, 500);*/
vatReportService.manyExport(JSON.stringify(param)).success(function(res){
if(!res.result)
SweetAlert.error(res.resultMsg);
}).error(function(error){
SweetAlert.error("批量导出失败")
vatReportService.manyExport(JSON.stringify(param)).error(function(error){
SweetAlert.error(error);
});
};
$scope.relation._orgId = null;
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
bindingOptions: {
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
});
}
};
$scope.$watch('relation._orgId', function(n, o){
if(n != undefined )
$scope.relation.orgId = n.pop();
......@@ -3256,9 +3267,9 @@
//load cell data
var date=new Date;
var month=date.getMonth()+1;
$scope.templateId ="100610523201314816";//这里先写死 todo 这里先写死利润表模板,后续会修改模板id
/* var date=new Date;
var month=date.getMonth()+1;*/
///loadCellData($scope.relation.period);//默认当前月
/***************************************************************************************************************/
......
<div class="vat-report-view">
<!--Report SpreadJS-->
<div class="row" style=" height: 71px; background: #ccc;">
<div class="col-sm-7" style=" margin-top: 20px;">
<div class="row" style=" height: 53px; background: #ccc;">
<div class="col-sm-7" style=" margin-top: 10px;">
<div class="col-sm-8">
<span class="text-bold" translate="SelectedOrganization" style=" top: -7px; display: inline!important; position: relative; ">:</span>
<!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
......@@ -22,7 +22,7 @@
</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 navRight" style=" margin-top: 20px;width: 30%;; float: right;">
<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>
......@@ -42,5 +42,6 @@
<form name="myform" style="disply:none;" id="myform" enctype="multipart/form-data" method="post">
    
   </form>
<a href="#" id = "a"></a>
</div>
</div>
\ No newline at end of file
......@@ -109,3 +109,10 @@
}
}
}
@media screen and (max-width:1400px) {
.navRight{
width: 40%!important;
}
}
\ No newline at end of file
webservices.factory('vatReportService', ['$q', '$log', '$http', '$translate', 'apiConfig', 'enums', 'SweetAlert', 'vatOperationLogService',
'vatSessionService',
function ($q, $log, $http, $translate, apiConfig, enums, SweetAlert, vatOperationLogService, vatSessionService) {
'vatSessionService','FileSaver',
function ($q, $log, $http, $translate, apiConfig, enums, SweetAlert, vatOperationLogService, vatSessionService, FileSaver) {
'use strict';
$log.debug('vatReportService.ctor()...');
return {
......@@ -70,11 +70,24 @@
return $http.post('/Report/reportEbitData',param, apiConfig.createVat({ contentType:"application/json"}));
} ,
manyExport : function(param){
return $http.post('/Report/manyExport', param, apiConfig.createVat());
return $http.post('/Report/manyExport', param, apiConfig.createVat({responseType: 'arraybuffer'})).then(function (response) {
var a = document.createElement('a');
var blob = new Blob([response.data], {'type':"application/octet-stream" });
//FileSaver.saveAs(data, '利润表.zip');
a.href = URL.createObjectURL(blob);
a.download = "利润表.zip";
a.click();
});
}
,
saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) {
return $http.get('/Report/specialConsiderations?=' + orgId + '&period=' + period + "&specialConsiderations=" + specialConsiderations + "&ebitRate=" + ebitRate, apiConfig.createVat());
var paramObj = {
orgId: orgId,
period : period,
specialConsiderations : specialConsiderations,
ebitRate : ebitRate
};
return $http.post('/Report/saveAndRefresh', paramObj , apiConfig.createVat());
},
calculateKeyValue: function (projectId, period) {
return $http.post('/Report/calculateKeyValue/' + projectId + '/' + period, {}, apiConfig.createVat({ignoreLoadingBar: true}));
......
......@@ -18,7 +18,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
};
var getPeriodTemplateJsonByOrg = function (templateId,period,orgId) {
return getJsonFromExcelForPeriod(templateId,period,orgId, true);
return getJsonFromExcelForPeriodOrg(templateId,period,orgId);
};
var getPeriodTemplateJsonByInit = function (templateId,period,orgId) {
......@@ -115,15 +115,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
};
var getJsonFromExcelForPeriod = function (templateID,period,projectIdOrOrgId, ebit) {
var getJsonFromExcelForPeriod = function (templateID,period,projectIdOrOrgId) {
var deferred = $q.defer();
var promise = deferred.promise;
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period;
if(ebit){
url += "&orgId="+projectIdOrOrgId
}else{
url += "&projectId=" +projectIdOrOrgId;
}
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period + "&projectId=" +projectIdOrOrgId;
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
......@@ -172,6 +167,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var blob = this.response;
var excelIo = new GC.Spread.Excel.IO();
excelIo.open(blob, function (json) {
deferred.resolve(json);
}, function (e) {
// console.error(e.errorMessage);
......
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