Commit 98867356 authored by zhkwei's avatar zhkwei

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

parents 5132c0ac 424abbe6
......@@ -16,9 +16,9 @@
<dependencies>
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc6 -->
<!--<dependency>-->
<!--<groupId>com.oracle</groupId>-->
<!--<artifactId>ojdbc</artifactId>-->
<!--<version>0.0.1</version>-->
<!--<groupId>com.oracle</groupId>-->
<!--<artifactId>ojdbc</artifactId>-->
<!--<version>0.0.1</version>-->
<!--</dependency>-->
<!--<dependency>
<groupId>com.oracle</groupId>
......@@ -74,17 +74,18 @@
<version>4.2.3.RELEASE</version>
</dependency>
<!--去除swagger-->
<!-- <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>-->
<!-- <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
......@@ -442,7 +443,7 @@
<profiles>
<profile>
<id>dev</id>
<activation>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
......@@ -454,8 +455,8 @@
<env>dev</env>
</properties>
</profile>
<profile>
<id>staging</id>
<build>
......@@ -522,13 +523,13 @@
<targetPath>${basedir}/target/classes/userTemplate</targetPath>
</resource>
<resource>
<directory>src/main/resources/vat_excel_template</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
<targetPath>${basedir}/target/classes/vat_excel_template</targetPath>
</resource>
<directory>src/main/resources/vat_excel_template</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
<targetPath>${basedir}/target/classes/vat_excel_template</targetPath>
</resource>
<resource>
<directory>src/main/resources/cit_excel_template</directory>
<includes>
......@@ -553,6 +554,14 @@
</includes>
<targetPath>${basedir}/target/classes/user_excel_template</targetPath>
</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>
<plugins>
<plugin>
......
......@@ -13,7 +13,8 @@ public enum EnumImportType {
InvoiceRecord(9),
ExtractFinancialData(10),
ExtractInvoiceData(11),
RevenueMapping(12)
RevenueMapping(12),
RevenueConfig(13)
;
private Integer code;
......
......@@ -15,7 +15,7 @@ public class RevenueConfEnum {
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
AccountType(Integer code, String name) {
this.code = code;
this.name = name;
......@@ -32,6 +32,7 @@ public class RevenueConfEnum {
static {
for (RevenueConfEnum.AccountType accountType : RevenueConfEnum.AccountType.values()) {
MAPPING.put(accountType.getCode(), accountType.getName());
REVERSAL_MAPPING.put(accountType.getName(),accountType.getCode());
}
}
}
......@@ -48,7 +49,7 @@ public class RevenueConfEnum {
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
TaxBase(Integer code, String name) {
this.code = code;
this.name = name;
......@@ -65,6 +66,7 @@ public class RevenueConfEnum {
static {
for (RevenueConfEnum.TaxBase taxBase : RevenueConfEnum.TaxBase.values()) {
MAPPING.put(taxBase.getCode(), taxBase.getName());
REVERSAL_MAPPING.put(taxBase.getName(),taxBase.getCode());
}
}
}
......@@ -80,7 +82,7 @@ public class RevenueConfEnum {
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
TaxType(Integer code, String name) {
this.code = code;
this.name = name;
......@@ -97,6 +99,7 @@ public class RevenueConfEnum {
static {
for (RevenueConfEnum.TaxType taxType : RevenueConfEnum.TaxType.values()) {
MAPPING.put(taxType.getCode(), taxType.getName());
REVERSAL_MAPPING.put(taxType.getName(),taxType.getCode());
}
}
}
......@@ -110,7 +113,7 @@ public class RevenueConfEnum {
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
RevenueType(Integer code, String name) {
this.code = code;
this.name = name;
......@@ -127,6 +130,7 @@ public class RevenueConfEnum {
static {
for (RevenueConfEnum.RevenueType revenueType : RevenueConfEnum.RevenueType.values()) {
MAPPING.put(revenueType.getCode(), revenueType.getName());
REVERSAL_MAPPING.put(revenueType.getName(),revenueType.getCode());
}
}
}
......@@ -140,7 +144,7 @@ public class RevenueConfEnum {
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
public static final Map<String, Integer> REVERSAL_MAPPING = new HashMap<>();
Status(Integer code, String name) {
this.code = code;
this.name = name;
......@@ -157,8 +161,48 @@ public class RevenueConfEnum {
static {
for (RevenueConfEnum.Status status : RevenueConfEnum.Status.values()) {
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
......@@ -13,6 +13,9 @@ import pwc.taxtech.atms.service.impl.RevenueConfService;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
@RestController
......@@ -48,4 +51,33 @@ public class RevenueConfController extends BaseController {
revenueConfService.delConfig(idList);
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();
}
}
}
}
......@@ -177,23 +177,32 @@ public class ProjectServiceImpl {
try {
project.setId(UUID.randomUUID().toString());
OrganizationServiceTemplateGroupExample example = new OrganizationServiceTemplateGroupExample();
example.createCriteria().andOrganizationIdEqualTo(projectDto.getOrganizationId());
organizationServiceTemplateGroupMapper.selectByExample(example).forEach(ostg -> {
ProjectServiceType pst = new ProjectServiceType();
pst.setId(UUID.randomUUID().toString());
pst.setProjectId(project.getId());
pst.setServiceTypeId(ostg.getServiceTypeId());
pst.setTemplateGroupId(ostg.getTemplateGroupId());
projectServiceTypeMapper.insert(pst);
project.setUpdateTime(new Date());
int row = projectMapper.insertOnWhere(project);
if(row<=0){
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andIsActiveEqualTo(true).andOrganizationIdEqualTo(project.getOrganizationId()).andYearEqualTo(project.getYear());
List<Project> dataList = projectMapper.selectByExample(projectExample);
project = dataList.get(0);
}else{
final Project project1 = project;
OrganizationServiceTemplateGroupExample example = new OrganizationServiceTemplateGroupExample();
example.createCriteria().andOrganizationIdEqualTo(projectDto.getOrganizationId());
organizationServiceTemplateGroupMapper.selectByExample(example).forEach(ostg -> {
ProjectServiceType pst = new ProjectServiceType();
pst.setId(UUID.randomUUID().toString());
pst.setProjectId(project1.getId());
pst.setServiceTypeId(ostg.getServiceTypeId());
pst.setTemplateGroupId(ostg.getTemplateGroupId());
projectServiceTypeMapper.insert(pst);
// operationLogService.addDataAddLog(pst, OperationModule.ProjectServiceType, userName,//TODO add peration log
// Message.Project.AddProjectServiceType, pst.getId(), projectDto.getName(), LOG_TYPE);
});
});
}
project.setUpdateTime(new Date());
projectMapper.insert(project);
// operationLogService.addDataAddLog(project, OperationModule.Project, userName, Message.Project.AddProject,
// project.getId(), projectDto.getName(), LOG_TYPE);
......
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -251,4 +250,6 @@ public interface ProjectMapper extends MyMapper {
List<ProjectAnaylsisDto> getTemlateWithServiceType2(@Param("orgId")String orgId, @Param("year") Integer year, @Param("month") Integer month,@Param("code")String code);
List<Project> queryChildOrgAndProjectByOrgId(@Param("year")Integer year ,@Param("orgId")String orgId);
int insertOnWhere(Project record);
}
\ No newline at end of file
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;
......@@ -8,6 +7,8 @@ import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
import java.util.List;
@Mapper
public interface RevenueConfigMapper extends MyVatMapper {
/**
......@@ -105,4 +106,6 @@ public interface RevenueConfigMapper extends MyVatMapper {
* @mbg.generated
*/
int updateByPrimaryKey(RevenueConfig record);
int batchInsert(List<RevenueConfig> list);
}
\ No newline at end of file
......@@ -46,7 +46,34 @@
and o.parent_id = #{orgId,jdbcType=VARCHAR}
</select>
<insert id="insertOnWhere" parameterType="pwc.taxtech.atms.entity.Project">
insert into project (id, code, name,
year, client_code, is_active,
create_time, update_time, region_id,
industry_id, rule_type, organization_id,
db_name, enterprise_account_set_id, start_period,
end_period)
select #{id,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{year,jdbcType=INTEGER}, #{clientCode,jdbcType=VARCHAR}, #{isActive,jdbcType=BIT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{regionId,jdbcType=VARCHAR},
#{industryId,jdbcType=VARCHAR}, #{ruleType,jdbcType=INTEGER}, #{organizationId,jdbcType=VARCHAR},
#{dbName,jdbcType=VARCHAR}, #{enterpriseAccountSetId,jdbcType=VARCHAR}, #{startPeriod,jdbcType=INTEGER},
#{endPeriod,jdbcType=INTEGER}
FROM dual
where not exists(
select
*
from
project
where
organization_id = #{organizationId,jdbcType=VARCHAR}
and
year = #{year,jdbcType=INTEGER}
and
is_active = 1
)
</insert>
......
......@@ -414,24 +414,4 @@
</if>
</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>
\ No newline at end of file
......@@ -209,6 +209,12 @@
</foreach>
AND ct.period = #{period,jdbcType=INTEGER}
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 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 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
<title>didi2</title>
<link rel="stylesheet" href="font_roboto.css">
......
......@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import pwc.taxtech.atms.common.DDUserInfoRes;
import pwc.taxtech.atms.common.HttpUtil;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.AtmsTokenDto;
import pwc.taxtech.atms.web.AtmsWebSettings;
import pwc.taxtech.atms.web.service.OrangeHeapService;
......@@ -196,7 +197,7 @@ public class IndexController {
*/
@RequestMapping(value = {"/sso/getUser"}, method = RequestMethod.GET)
@ResponseBody
public String accept(@RequestParam(value = "ticket") String ticket, HttpServletRequest request,
public ApiResultDto accept(@RequestParam(value = "ticket") String ticket, HttpServletRequest request,
HttpServletResponse response) {
DDUserInfoRes ddUserInfoRes = null;
try {
......@@ -207,7 +208,7 @@ public class IndexController {
} catch (Exception e) {
logger.info(String.format("调用DDSSO获取用户信息失败:[%s]", e.getMessage()), e);
}
return JSON.toJSONString(ddUserInfoRes);
return ApiResultDto.success(ddUserInfoRes);
}
......
......@@ -3140,7 +3140,7 @@
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);
sheet.setValue(43, 2, $scope._ebitResult.tsklys);
}
setTimeout(function(){spreadTODb();}, 1000)
}
......
......@@ -1563,7 +1563,8 @@ constant.importFileType = {
invoiceRecord: 9,
ExtractFinancialData: 10,
ExtractInvoiceData: 11,
RevenueMapping: 12
RevenueMapping: 12,
RevenueConfig: 13
};
constant.citImportFileType = {
......
vatModule.controller('VatRevenueConfigController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q',
'$interval', 'dxDataGridService', '$http', 'apiConfig',
function ($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,Upload,apiInterceptor,templateService) {
'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, {
columns: [
......
......@@ -5,10 +5,22 @@
</div>
<div id="tab_total">
<form class="form-inline">
<div class="form-group" style="margin-top: 5px;"><div class="import-wrapper">
<button type="button" class="btn btn-primary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<div class="form-group" style="margin-top: 5px;">
<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>
</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>
<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