Commit 7abac3d1 authored by eddie.woo's avatar eddie.woo

Merge remote-tracking branch 'origin/dev_mysql' into uat_didi

parents a6ba18c1 a2ed84ef
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<version>4.2.3.RELEASE</version> <version>4.2.3.RELEASE</version>
</dependency> </dependency>
<!--去除swagger--> <!--去除swagger-->
<!-- <dependency> <!-- <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
...@@ -553,6 +554,14 @@ ...@@ -553,6 +554,14 @@
</includes> </includes>
<targetPath>${basedir}/target/classes/user_excel_template</targetPath> <targetPath>${basedir}/target/classes/user_excel_template</targetPath>
</resource> </resource>
<resource>
<directory>src/main/resources/analysis_excel_init</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
<targetPath>${basedir}/target/classes/analysis_excel_init</targetPath>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -13,7 +13,8 @@ public enum EnumImportType { ...@@ -13,7 +13,8 @@ public enum EnumImportType {
InvoiceRecord(9), InvoiceRecord(9),
ExtractFinancialData(10), ExtractFinancialData(10),
ExtractInvoiceData(11), ExtractInvoiceData(11),
RevenueMapping(12) RevenueMapping(12),
RevenueConfig(13)
; ;
private Integer code; private Integer code;
......
...@@ -15,7 +15,7 @@ public class RevenueConfEnum { ...@@ -15,7 +15,7 @@ public class RevenueConfEnum {
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
AccountType(Integer code, String name) { AccountType(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -32,6 +32,7 @@ public class RevenueConfEnum { ...@@ -32,6 +32,7 @@ public class RevenueConfEnum {
static { static {
for (RevenueConfEnum.AccountType accountType : RevenueConfEnum.AccountType.values()) { for (RevenueConfEnum.AccountType accountType : RevenueConfEnum.AccountType.values()) {
MAPPING.put(accountType.getCode(), accountType.getName()); MAPPING.put(accountType.getCode(), accountType.getName());
REVERSAL_MAPPING.put(accountType.getName(),accountType.getCode());
} }
} }
} }
...@@ -48,7 +49,7 @@ public class RevenueConfEnum { ...@@ -48,7 +49,7 @@ public class RevenueConfEnum {
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
TaxBase(Integer code, String name) { TaxBase(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -65,6 +66,7 @@ public class RevenueConfEnum { ...@@ -65,6 +66,7 @@ public class RevenueConfEnum {
static { static {
for (RevenueConfEnum.TaxBase taxBase : RevenueConfEnum.TaxBase.values()) { for (RevenueConfEnum.TaxBase taxBase : RevenueConfEnum.TaxBase.values()) {
MAPPING.put(taxBase.getCode(), taxBase.getName()); MAPPING.put(taxBase.getCode(), taxBase.getName());
REVERSAL_MAPPING.put(taxBase.getName(),taxBase.getCode());
} }
} }
} }
...@@ -80,7 +82,7 @@ public class RevenueConfEnum { ...@@ -80,7 +82,7 @@ public class RevenueConfEnum {
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
TaxType(Integer code, String name) { TaxType(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -97,6 +99,7 @@ public class RevenueConfEnum { ...@@ -97,6 +99,7 @@ public class RevenueConfEnum {
static { static {
for (RevenueConfEnum.TaxType taxType : RevenueConfEnum.TaxType.values()) { for (RevenueConfEnum.TaxType taxType : RevenueConfEnum.TaxType.values()) {
MAPPING.put(taxType.getCode(), taxType.getName()); MAPPING.put(taxType.getCode(), taxType.getName());
REVERSAL_MAPPING.put(taxType.getName(),taxType.getCode());
} }
} }
} }
...@@ -110,7 +113,7 @@ public class RevenueConfEnum { ...@@ -110,7 +113,7 @@ public class RevenueConfEnum {
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
RevenueType(Integer code, String name) { RevenueType(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -127,6 +130,7 @@ public class RevenueConfEnum { ...@@ -127,6 +130,7 @@ public class RevenueConfEnum {
static { static {
for (RevenueConfEnum.RevenueType revenueType : RevenueConfEnum.RevenueType.values()) { for (RevenueConfEnum.RevenueType revenueType : RevenueConfEnum.RevenueType.values()) {
MAPPING.put(revenueType.getCode(), revenueType.getName()); MAPPING.put(revenueType.getCode(), revenueType.getName());
REVERSAL_MAPPING.put(revenueType.getName(),revenueType.getCode());
} }
} }
} }
...@@ -140,7 +144,7 @@ public class RevenueConfEnum { ...@@ -140,7 +144,7 @@ public class RevenueConfEnum {
private Integer code; private Integer code;
private String name; private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>(); public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
Status(Integer code, String name) { Status(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
...@@ -157,8 +161,48 @@ public class RevenueConfEnum { ...@@ -157,8 +161,48 @@ public class RevenueConfEnum {
static { static {
for (RevenueConfEnum.Status status : RevenueConfEnum.Status.values()) { for (RevenueConfEnum.Status status : RevenueConfEnum.Status.values()) {
MAPPING.put(status.getCode(), status.getName()); MAPPING.put(status.getCode(), status.getName());
REVERSAL_MAPPING.put(status.getName(),status.getCode());
}
}
}
public enum EXECLColumn {
Column_1(0, "收入类型名称"),
Column_2(1, "适用公司"),
Column_3(2, "账载收入"),
Column_4(3, "科目代码"),
Column_5(4, "利润中心代码"),
Column_6(5, "产品代码"),
Column_7(6, "税率"),
Column_8(7, "计税收入"),
Column_9(8, "计税收入科目代码"),
Column_10(9, "收入类型"),
Column_11(10, "计税方法"),
Column_12(11, "状态"),
Column_13(12, "起始日期"),
Column_14(13, "终止日期")
;
private Integer index;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
EXECLColumn(Integer index, String name) {
this.index = index;
this.name = name;
} }
public Integer getIndex() {
return index;
} }
public String getName() {
return name;
} }
static {
for (TaxesCalculateReportEnum.Column accountType : TaxesCalculateReportEnum.Column.values()) {
MAPPING.put(accountType.getIndex(), accountType.getName());
}
}
}
} }
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import org.springframework.web.bind.annotation.PostMapping; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RestController; import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.dto.ApiResultDto; import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto; import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto; import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
...@@ -13,6 +13,9 @@ import pwc.taxtech.atms.service.impl.RevenueConfService; ...@@ -13,6 +13,9 @@ import pwc.taxtech.atms.service.impl.RevenueConfService;
import pwc.taxtech.atms.vat.entity.RevenueConfig; import pwc.taxtech.atms.vat.entity.RevenueConfig;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -48,4 +51,33 @@ public class RevenueConfController extends BaseController { ...@@ -48,4 +51,33 @@ public class RevenueConfController extends BaseController {
revenueConfService.delConfig(idList); revenueConfService.delConfig(idList);
return ApiResultDto.success(); return ApiResultDto.success();
} }
@PostMapping("upload")
public ApiResultDto upload(@RequestParam MultipartFile file, @RequestParam Integer type) throws Exception {
List<String> unSuccessList = revenueConfService.upload(file, type);
return ApiResultDto.success(unSuccessList);
}
@GetMapping("export")
public void export(HttpServletResponse response) throws Exception {
OutputStream ouputStream = null;
try {
InputStream inputStream = this.getClass().getResourceAsStream("/document/DataImport/" + EnumImportType.RevenueConfig.name() + ".xlsx");
Workbook tWorkbook = revenueConfService.export(inputStream);
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + EnumImportType.RevenueConfig.name() + ".xlsx");
ouputStream = response.getOutputStream();
tWorkbook.write(ouputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (ouputStream != null) {
ouputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} }
package pwc.taxtech.atms.vat.dao; package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
...@@ -8,6 +7,8 @@ import pwc.taxtech.atms.MyVatMapper; ...@@ -8,6 +7,8 @@ import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.RevenueConfig; import pwc.taxtech.atms.vat.entity.RevenueConfig;
import pwc.taxtech.atms.vat.entity.RevenueConfigExample; import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
import java.util.List;
@Mapper @Mapper
public interface RevenueConfigMapper extends MyVatMapper { public interface RevenueConfigMapper extends MyVatMapper {
/** /**
...@@ -105,4 +106,6 @@ public interface RevenueConfigMapper extends MyVatMapper { ...@@ -105,4 +106,6 @@ public interface RevenueConfigMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(RevenueConfig record); int updateByPrimaryKey(RevenueConfig record);
int batchInsert(List<RevenueConfig> list);
} }
\ No newline at end of file
...@@ -414,24 +414,4 @@ ...@@ -414,24 +414,4 @@
</if> </if>
</select> </select>
<insert id="batchInsert">
insert into revenue_type_mapping
(id, org_id, ou_name, content, tax_rate, revenue_type_name, start_date, end_date, status, create_by, update_by, create_time, update_time) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id},
#{item.orgId},
#{item.ouName},
#{item.content},
#{item.taxRate},
#{item.revenueTypeName},
#{item.startDate},
#{item.endDate},
#{item.status,jdbcType=TINYINT},
#{item.createBy},
#{item.updateBy},
#{item.createTime},
#{item.updateTime})
</foreach>
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -209,6 +209,12 @@ ...@@ -209,6 +209,12 @@
</foreach> </foreach>
AND ct.period = #{period,jdbcType=INTEGER} AND ct.period = #{period,jdbcType=INTEGER}
AND ct.project_id = #{projectId,jdbcType=VARCHAR} AND ct.project_id = #{projectId,jdbcType=VARCHAR}
and config.report_template_id IN
<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
AND config.period = #{period,jdbcType=INTEGER}
AND config.project_id = #{projectId,jdbcType=VARCHAR}
</select> </select>
<select id="getConfigWithReportTemplateId" resultType="pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig"> <select id="getConfigWithReportTemplateId" resultType="pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.RevenueConfigMapper">
<insert id="batchInsert">
insert into revenue_config
(id, serial_no, name, org_id, account_type, account_name, tax_rate, tax_base, revenue_type, tax_type, status, start_date, end_date, tb_segment3, tb_segment5, tb_segment6, update_time, create_time, update_by, create_by, base_cr_code, base_dr_code) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id,jdbcType=BIGINT},
#{item.serialNo,jdbcType=VARCHAR},
#{item.name,jdbcType=VARCHAR},
#{item.orgId,jdbcType=VARCHAR},
#{item.accountType,jdbcType=TINYINT},
#{item.accountName,jdbcType=VARCHAR},
#{item.taxRate,jdbcType=DECIMAL},
#{item.taxBase,jdbcType=TINYINT},
#{item.revenueType,jdbcType=TINYINT},
#{item.taxType,jdbcType=TINYINT},
#{item.status,jdbcType=TINYINT},
#{item.startDate,jdbcType=VARCHAR},
#{item.endDate,jdbcType=VARCHAR},
#{item.tbSegment3,jdbcType=VARCHAR},
#{item.tbSegment5,jdbcType=VARCHAR},
#{item.tbSegment6,jdbcType=VARCHAR},
#{item.updateTime,jdbcType=TIMESTAMP},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateBy,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},
#{item.baseCrCode,jdbcType=VARCHAR},
#{item.baseDrCode,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.RevenueTypeMappingMapper">
<insert id="batchInsert">
insert into revenue_type_mapping
(id, org_id, ou_name, content, tax_rate, revenue_type_name, start_date, end_date, status, create_by, update_by, create_time, update_time) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id},
#{item.orgId},
#{item.ouName},
#{item.content},
#{item.taxRate},
#{item.revenueTypeName},
#{item.startDate},
#{item.endDate},
#{item.status,jdbcType=TINYINT},
#{item.createBy},
#{item.updateBy},
#{item.createTime},
#{item.updateTime})
</foreach>
</insert>
</mapper>
\ No newline at end of file
...@@ -4,6 +4,59 @@ ...@@ -4,6 +4,59 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<script>
//获取地址栏参数,name:参数名称
window.str="";
var z =function getUrlParms(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)
return unescape(r[2]);
return null;
}
var ddTicket = z("ticketStr");
//設置cookie
var sc= function setCookie(name,value) {
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=./";
}
sc("ddTicket",ddTicket);
var ReUrl="https://me.xiaojukeji.com/project/stargate-auth/html/login.html?redirect_uri=http%3A%2F%2Fmis.diditaxi.com.cn%2Fauth%3Fapp_id%3D2500%26version%3D1.0%26jumpto%3Dhttp://dts-test.erp.didichuxing.com/orangeweb/index.html%26callback_index%3D0"
if(ddTicket==undefined || ddTicket=="" || ddTicket == null){
document.location=ReUrl;
}
/* else {
//创建核心对象
xmlhttp = null;
if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
//编写回调函数
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//
}
}
//這個 url 測試的
var getUserUrl="http://dts-test.erp.didichuxing.com/sso/getUser?ticket=";
//open设置请求方式和请求路径
xmlhttp.open("get", getUserUrl+ddTicket);
//send 发送
xmlhttp.send();
}*/
</script>
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>didi2</title> <title>didi2</title>
<link rel="stylesheet" href="font_roboto.css"> <link rel="stylesheet" href="font_roboto.css">
......
...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import pwc.taxtech.atms.common.DDUserInfoRes; import pwc.taxtech.atms.common.DDUserInfoRes;
import pwc.taxtech.atms.common.HttpUtil; import pwc.taxtech.atms.common.HttpUtil;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.AtmsTokenDto; import pwc.taxtech.atms.dto.AtmsTokenDto;
import pwc.taxtech.atms.web.AtmsWebSettings; import pwc.taxtech.atms.web.AtmsWebSettings;
import pwc.taxtech.atms.web.service.OrangeHeapService; import pwc.taxtech.atms.web.service.OrangeHeapService;
...@@ -196,7 +197,7 @@ public class IndexController { ...@@ -196,7 +197,7 @@ public class IndexController {
*/ */
@RequestMapping(value = {"/sso/getUser"}, method = RequestMethod.GET) @RequestMapping(value = {"/sso/getUser"}, method = RequestMethod.GET)
@ResponseBody @ResponseBody
public String accept(@RequestParam(value = "ticket") String ticket, HttpServletRequest request, public ApiResultDto accept(@RequestParam(value = "ticket") String ticket, HttpServletRequest request,
HttpServletResponse response) { HttpServletResponse response) {
DDUserInfoRes ddUserInfoRes = null; DDUserInfoRes ddUserInfoRes = null;
try { try {
...@@ -207,7 +208,7 @@ public class IndexController { ...@@ -207,7 +208,7 @@ public class IndexController {
} catch (Exception e) { } catch (Exception e) {
logger.info(String.format("调用DDSSO获取用户信息失败:[%s]", e.getMessage()), e); logger.info(String.format("调用DDSSO获取用户信息失败:[%s]", e.getMessage()), e);
} }
return JSON.toJSONString(ddUserInfoRes); return ApiResultDto.success(ddUserInfoRes);
} }
......
...@@ -3140,7 +3140,7 @@ ...@@ -3140,7 +3140,7 @@
sheet.setValue(40, 2, $scope._ebitResult.rate + "%"); sheet.setValue(40, 2, $scope._ebitResult.rate + "%");
sheet.setValue(41, 2, $scope._ebitResult.gljyye); sheet.setValue(41, 2, $scope._ebitResult.gljyye);
sheet.setValue(42, 2, $scope._ebitResult.sixAddtax); sheet.setValue(42, 2, $scope._ebitResult.sixAddtax);
sheet.setValue(43, 2, $scope._ebitResult.klzcjsz); sheet.setValue(43, 2, $scope._ebitResult.tsklys);
} }
setTimeout(function(){spreadTODb();}, 1000) setTimeout(function(){spreadTODb();}, 1000)
} }
......
...@@ -1563,7 +1563,8 @@ constant.importFileType = { ...@@ -1563,7 +1563,8 @@ constant.importFileType = {
invoiceRecord: 9, invoiceRecord: 9,
ExtractFinancialData: 10, ExtractFinancialData: 10,
ExtractInvoiceData: 11, ExtractInvoiceData: 11,
RevenueMapping: 12 RevenueMapping: 12,
RevenueConfig: 13
}; };
constant.citImportFileType = { constant.citImportFileType = {
......
vatModule.controller('VatRevenueConfigController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q', vatModule.controller('VatRevenueConfigController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q',
'$interval', 'dxDataGridService', '$http', 'apiConfig', '$interval', 'dxDataGridService', '$http', 'apiConfig','Upload','apiInterceptor','templateService',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval, dxDataGridService, $http, apiConfig) { function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval, dxDataGridService, $http, apiConfig,Upload,apiInterceptor,templateService) {
'use strict'; 'use strict';
$scope.upload = function(uploadType) {
if (!$scope.uploadFile || !$scope.uploadFile.file.name) {
SweetAlert.warning($translate.instant('SelectUploadFileRequired'));
return;
}
$('#busy-indicator-container').show();
var deferred = $q.defer();
Upload.upload({
url: apiInterceptor.webApiHostUrl + '/revenueConf/upload',
data: {
type: uploadType,
},
file: $scope.uploadFile.file,
// resumeChunkSize: resumable ? $scope.chunkSize : null,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
withCredentials: true
},
withCredentials: true
}).then(function(res) {
$('#busy-indicator-container').hide();
deferred.resolve();
if (res && res.data && 0 === res.data.code) {
if(res.data.data.length==0){
SweetAlert.success($translate.instant('ImportSuccess'));
}else{
var msg = '';
angular.forEach(res.data.data,function (item) {
msg += item +" \n ";
});
SweetAlert.success(msg);
}
$scope.refreshConfigGrid();
} else {
SweetAlert.error($translate.instant('SystemError'));
}
}, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else {
SweetAlert.warning($translate.instant('SaveFail'));
}
$('#busy-indicator-container').hide();
}, function(evt) {
deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
$log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
});
};
$scope.downloadTemplate = function () {
templateService.downloadTemplate(constant.importFileType.RevenueConfig).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "收入类型配置导入模板");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "收入类型配置导入模板.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
$scope.exportRevenueConf = function () {
$http.get('/revenueConf/export', apiConfig.create({ responseType: 'arraybuffer' })).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "收入类型配置报表");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "收入类型配置报表.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//表格配置 //表格配置
$scope.revenueGridOptions = $.extend(true, {}, dxDataGridService.BASIC_GRID_OPTIONS, { $scope.revenueGridOptions = $.extend(true, {}, dxDataGridService.BASIC_GRID_OPTIONS, {
columns: [ columns: [
......
...@@ -5,10 +5,22 @@ ...@@ -5,10 +5,22 @@
</div> </div>
<div id="tab_total"> <div id="tab_total">
<form class="form-inline"> <form class="form-inline">
<div class="form-group" style="margin-top: 5px;"><div class="import-wrapper"> <div class="form-group" style="margin-top: 5px;">
<button type="button" class="btn btn-primary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp; <button type="button" class="btn btn-secondary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button> <button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>
</div></div> <label class="control-label">文件:</label>
<input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/>
<button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload(1)"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload(2)"></button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i
class="fa fa-download" aria-hidden="true"></i>下载模板
</button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="exportRevenueConf()"><i
class="fa fa-download" aria-hidden="true"></i>导出报表
</button>
</div>
</form> </form>
<div class="dt-init-wrapper"> <div class="dt-init-wrapper">
......
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